:root {
  color-scheme: light;
  --bg: #f6f1e6;
  --bg-alt: #efe7d4;
  --ink: #1f1b16;
  --muted: #6b5d4d;
  --accent: #d9822b;
  --accent-dark: #b85f1e;
  --cool: #2c6d8d;
  --panel: #fffaf0;
  --danger: #b33b2e;
  --shadow: 0 18px 50px rgba(46, 33, 22, 0.15);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Gill Sans", "Nimbus Sans", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff7e3 0%, rgba(255, 247, 227, 0) 60%),
    radial-gradient(circle at 20% 80%, #f8e4cf 0%, rgba(248, 228, 207, 0) 55%),
    linear-gradient(120deg, var(--bg) 0%, var(--bg-alt) 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.theme-login {
  background: radial-gradient(circle at 10% 10%, #fff1d6 0%, rgba(255, 241, 214, 0) 70%),
    linear-gradient(140deg, #f9f3e8 0%, #f2e4cf 100%);
}

body.theme-admin {
  background: radial-gradient(circle at 100% 0%, #f6e6d1 0%, rgba(246, 230, 209, 0) 65%),
    linear-gradient(160deg, #f8efe1 0%, #efe1cb 100%);
}

h1, h2, h3 {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  background: rgba(255, 250, 240, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(71, 54, 37, 0.08);
  overflow: visible;
  position: relative;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  font-size: 28px;
  color: var(--accent-dark);
}

.topbar-actions,
.topbar-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-menu {
  margin: 0;
  padding: 0;
}

.menu-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.menu-dropdown-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--panel);
  border-radius: 12px;
  box-shadow: 0 16px 30px rgba(50, 35, 23, 0.18);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

.menu-dropdown:hover .menu-dropdown-list,
.menu-dropdown:focus-within .menu-dropdown-list {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.menu-dropdown-list form {
  margin: 0;
}

.menu-item {
  background: none;
  border: none;
  padding: 6px 4px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.menu-item:hover,
.menu-item:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.menu-item.danger {
  color: var(--danger);
}

.btn {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: inherit;
  font-weight: 600;
  letter-spacing: 0.2px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(50, 35, 23, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(50, 35, 23, 0.16);
}

.btn.primary {
  background: linear-gradient(120deg, var(--accent) 0%, #e7a059 100%);
  color: #2c1b0e;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.btn.danger {
  background: linear-gradient(120deg, var(--danger) 0%, #d45a4d 100%);
  color: #fffaf0;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.console-grid {
  display: grid;
  grid-template-columns: 260px minmax(300px, 1fr);
  gap: 18px;
  padding: 20px 24px 30px;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.panel {
  background: var(--panel);
  border-radius: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(94, 70, 44, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: panelIn 0.6s ease both;
  min-height: 0;
}

.panel.feed,
.panel.chat {
  height: 100%;
}

.panel-stack {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.panel-stack.is-collapsed {
  display: none;
}

/* Split layout: group feed + chat side by side */
#feedSection.is-split {
  flex-direction: row;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

#feedSection.is-split .panel-stack {
  flex: 1;
  min-width: 0;
  height: 100%;
}

#feedSection.is-split #groupPanel + #chatPanel {
  border-left: 1px solid rgba(94, 70, 44, 0.12);
}

/* In split mode, keep groupPanel visible even when chat is open */
#feedSection.is-split #groupPanel.is-collapsed {
  display: flex !important;
  opacity: 1 !important;
  transform: none !important;
  pointer-events: auto !important;
}

/* Split layout toggle button */
.feed-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#splitLayoutBtn {
  font-size: 13px;
  padding: 2px 7px;
  opacity: 0.6;
}

#splitLayoutBtn:hover,
body.split-layout #splitLayoutBtn {
  opacity: 1;
}

body.split-layout #splitLayoutBtn {
  background: rgba(94, 70, 44, 0.1);
}

body.chat-collapsed .console-grid {
  grid-template-columns: 260px minmax(300px, 1fr);
}

body.chat-collapsed #chatPanel {
  max-width: 0;
  border-width: 0;
  margin: 0;
}

.panel.column {
  gap: 16px;
  padding: 16px;
  overflow-y: auto;
}

.desktop-download-link {
  display: block;
  margin-top: auto;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(94, 70, 44, 0.07);
  color: var(--text-secondary, #6b5c4e);
  text-decoration: none;
  font-size: 13px;
  text-align: center;
  border: 1px solid rgba(94, 70, 44, 0.12);
  transition: background 0.15s ease;
}

.desktop-download-link:hover {
  background: rgba(94, 70, 44, 0.14);
  color: var(--text, #3b2e22);
}

.panel-block {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  padding: 12px;
  box-shadow: inset 0 0 0 1px rgba(121, 92, 60, 0.1);
}

.accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: relative;
}

.accordion-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 1200px;
  overflow: hidden;
  opacity: 1;
  transition: max-height 0.3s ease, opacity 0.25s ease;
}

.accordion.collapsed .accordion-body {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.accordion.nested {
  padding: 12px;
  border-radius: 14px;
  background: rgba(247, 241, 232, 0.6);
  border: 1px solid rgba(94, 70, 44, 0.12);
}

.accordion h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(65, 38, 8, 0.7);
}

.accordion-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  padding: 0;
}

.accordion-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 0.25s ease;
}

.accordion.collapsed .accordion-toggle svg {
  transform: rotate(-90deg);
}

.accordion.collapsed.has-unread > .accordion-header::after {
  content: "";
  position: absolute;
  right: 42px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 130, 43, 0.22);
}

.panel-block h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.list li {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.list li.presence-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #d64b3a;
  box-shadow: inset 0 0 0 1px rgba(138, 48, 34, 0.3);
  flex: 0 0 auto;
}

.presence-online .presence-dot {
  background: #2bb673;
  box-shadow: 0 0 0 3px rgba(43, 182, 115, 0.18);
}

.presence-active .presence-dot {
  background: #2bb673;
  box-shadow: 0 0 0 3px rgba(43, 182, 115, 0.18);
}

.presence-name {
  flex: 1 1 auto;
}

.presence-hourglass {
  display: none;
  margin-left: 6px;
  color: #8b5e34;
  font-size: 12px;
  line-height: 1;
}

.presence-idle .presence-hourglass {
  display: inline-block;
}

.list li.active {
  background: rgba(217, 130, 43, 0.2);
}

.list li.unread {
  border-left: 4px solid var(--accent);
}

.list li:hover {
  transform: translateX(4px);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(94, 70, 44, 0.12);
}

.status-pill {
  padding: 6px 12px;
  font-size: 12px;
  background: rgba(44, 109, 141, 0.12);
  color: var(--cool);
  border-radius: 999px;
}

.feed-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.message-group {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(122, 93, 61, 0.12);
  box-shadow: 0 8px 20px rgba(50, 35, 23, 0.1);
  animation: messageIn 0.35s ease both;
  margin-bottom: 2px;
}

.message-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.message-sender {
  color: var(--accent-dark);
  font-weight: 700;
}

.message-entry {
  position: relative;
  padding-right: 28px;
}

.message-entry + .message-entry {
  margin-top: 4px;
}

.message-body {
  white-space: pre-wrap;
}

.message-delete {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #1a73e8;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.message-entry:hover .message-delete {
  opacity: 1;
  pointer-events: auto;
}

.message-delete:hover {
  text-decoration: underline;
}

.message-body img {
  max-width: 100%;
  border-radius: 12px;
  margin-top: 8px;
}

.img-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
}

.img-lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 6px;
  object-fit: contain;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.6);
}

.chat {
  display: flex;
  flex-direction: column;
}

.chat-body {
  flex: 1;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  min-height: 0;
}

.chat-actions {
  border-top: 1px solid rgba(94, 70, 44, 0.12);
  padding: 14px;
  display: grid;
  gap: 12px;
  position: sticky;
  bottom: 0;
  background: var(--panel);
  overflow: visible;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-panel,
#chatPanel {
  transition: transform 0.35s ease, opacity 0.35s ease, max-height 0.35s ease, margin 0.35s ease;
}

.chat-panel.is-collapsed,
#chatPanel.is-collapsed {
  opacity: 0;
  transform: translateY(12px);
  max-height: 0;
  margin-top: 0;
  pointer-events: none;
}

/* In split mode, chat slides in from the right instead of up */
#feedSection.is-split #chatPanel {
  transition: flex 0.35s ease, opacity 0.35s ease;
  transform: none;
}

#feedSection.is-split #chatPanel.is-collapsed {
  flex: 0;
  max-height: none;
  transform: none;
  opacity: 0;
}

.chat-panel.is-collapsed .chat-body,
.chat-panel.is-collapsed .chat-actions,
.chat-panel.is-collapsed .panel-header,
.chat-panel.is-collapsed .d-flex.align-items-center,
#chatPanel.is-collapsed .chat-body,
#chatPanel.is-collapsed .chat-actions,
#chatPanel.is-collapsed .panel-header,
#chatPanel.is-collapsed .d-flex.align-items-center {
  display: none;
}

.chat-actions textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(94, 70, 44, 0.2);
  padding: 10px;
  font-family: inherit;
}

.chat-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.emoji-picker {
  position: absolute;
  right: 14px;
  bottom: 86px;
  display: none;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  padding: 10px;
  background: var(--panel);
  border-radius: 14px;
  border: 1px solid rgba(94, 70, 44, 0.18);
  box-shadow: var(--shadow);
  z-index: 20;
  max-width: 340px;
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.emoji-picker.open {
  display: grid;
}

.emoji-item {
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  padding: 6px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.emoji-item:hover {
  background: rgba(217, 130, 43, 0.16);
  transform: translateY(-1px);
}

.file-btn input {
  display: none;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(240px, 1fr);
  gap: 24px;
  padding: 60px 8vw;
  align-items: center;
}

.login-card {
  background: var(--panel);
  padding: 28px;
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.login-form {
  margin-top: 20px;
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.login-form input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(94, 70, 44, 0.2);
  font-family: inherit;
}

.login-ambient {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ambient-card {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.alert {
  background: rgba(179, 59, 46, 0.12);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 12px;
  margin-top: 12px;
}

.alert.success {
  background: rgba(46, 145, 95, 0.16);
  color: #1f6b45;
}

.login-help {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.text-link {
  color: #1a73e8;
  text-decoration: none;
  font-weight: 600;
}

.text-link:hover {
  text-decoration: underline;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(31, 27, 22, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2000;
}

.modal.open {
  display: flex;
}

.modal-card {
  background: var(--panel);
  border-radius: 20px;
  width: min(420px, 90vw);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(94, 70, 44, 0.12);
}

.modal-body {
  padding: 18px 20px 24px;
  display: grid;
  gap: 12px;
}

.modal-body label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-flex;
  align-items: center;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: rgba(107, 93, 77, 0.35);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 2px 6px rgba(46, 33, 22, 0.2);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-slider {
  background: rgba(217, 130, 43, 0.7);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch-slider {
  outline: 2px solid rgba(44, 109, 141, 0.6);
  outline-offset: 2px;
}

.modal-body input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(94, 70, 44, 0.2);
  font-family: inherit;
}

.modal-body select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(94, 70, 44, 0.2);
  font-family: inherit;
  background: var(--panel);
  color: var(--ink);
}

.markdown-preview {
  display: none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(94, 70, 44, 0.2);
  background: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  white-space: normal;
}

.markdown-preview.open {
  display: block;
}

.markdown-preview pre {
  margin: 6px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(31, 27, 22, 0.08);
  overflow: auto;
}

.markdown-preview code {
  font-family: "Courier New", "Nimbus Mono L", monospace;
  font-size: 12px;
}

body.markdown-enabled textarea {
  font-family: "Courier New", "Nimbus Mono L", monospace;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status {
  font-size: 13px;
  color: var(--muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  padding: 24px;
}

.panel-body {
  padding: 16px 18px 20px;
  display: grid;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.form-row input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(94, 70, 44, 0.2);
  font-family: inherit;
}

.table {
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.85);
  align-items: center;
}

.table-row > :last-child {
  justify-self: end;
}

.table-row.header {
  font-weight: 700;
  background: rgba(44, 109, 141, 0.12);
  color: var(--cool);
}

#groupsTable .table-row.group {
  grid-template-columns: 1fr 1fr auto auto;
}

#plainUsersTable .table-row {
  grid-template-columns: 1fr 1fr auto;
}

#supportUsersTable .table-row {
  grid-template-columns: 1fr 1fr auto;
}

.hint {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(94, 70, 44, 0.7);
}

.icon-btn {
  padding: 6px 10px;
  font-size: 14px;
  line-height: 1;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .console-grid {
    grid-template-columns: 1fr;
  }

  .panel.column {
    flex-direction: row;
    overflow-x: auto;
  }

  .panel-block {
    min-width: 220px;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .login-shell {
    grid-template-columns: 1fr;
    padding: 30px 8vw;
  }
}

body.theme-dark {
  color-scheme: dark;
  --bg: #2C3E50;
  --bg-alt: #2C3E50;
  --ink: #e8f0f7;
  --muted: #a8bccf;
  --accent: #f2a34a;
  --accent-dark: #d27b28;
  --cool: #7bbdd6;
  --panel: #34495E;
  --danger: #e46b5b;
  --shadow: 0 18px 50px rgba(10, 20, 30, 0.4);
  background: #2C3E50;
}

body.theme-dark.theme-login {
  background: #2C3E50;
}

body.theme-dark.theme-admin {
  background: #2C3E50;
}

body.theme-dark .topbar {
  background: rgba(44, 62, 80, 0.92);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .menu-dropdown-list {
  background: var(--panel);
  box-shadow: 0 16px 30px rgba(10, 20, 30, 0.45);
}

body.theme-dark .menu-item {
  color: var(--ink);
}

body.theme-dark .btn {
  background: #3D5570;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 14px rgba(10, 20, 30, 0.3);
}

body.theme-dark .btn.ghost {
  background: #3D5570;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

body.theme-dark .btn.primary {
  background: linear-gradient(120deg, var(--accent) 0%, #e7a059 100%);
  border-color: transparent;
  color: #fff;
}

body.theme-dark .btn.danger {
  background: linear-gradient(120deg, var(--danger) 0%, #d45a4d 100%);
  border-color: transparent;
  color: #fff;
}

body.theme-dark .panel {
  border-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .message-group {
  background: rgba(61, 85, 112, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .chat-actions {
  background: var(--panel);
  border-top-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .modal {
  background: rgba(20, 32, 44, 0.65);
}

body.theme-dark .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .modal-body input,
body.theme-dark .modal-body select,
body.theme-dark .form-row input {
  background: #2C3E50;
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--ink);
}

body.theme-dark .markdown-preview {
  background: rgba(44, 62, 80, 0.85);
  border-color: rgba(255, 255, 255, 0.12);
}

body.theme-dark .markdown-preview pre {
  background: rgba(30, 45, 60, 0.7);
}

body.theme-dark .switch-slider {
  background: rgba(168, 188, 207, 0.3);
}

body.theme-dark .switch-slider::before {
  background: #c8dae8;
}

body.theme-dark .switch input:checked + .switch-slider {
  background: rgba(242, 163, 74, 0.75);
}

body.theme-dark .table-row {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
}

body.theme-dark .table-row.header {
  background: rgba(61, 130, 168, 0.2);
}

body.theme-dark .list li {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
}

body.theme-dark .list li.active {
  background: rgba(217, 130, 43, 0.28);
}

body.theme-dark .panel-block {
  background: rgba(255, 255, 255, 0.05);
}

body.theme-dark .accordion.nested {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .desktop-download-link {
  background: #3D5570;
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--ink);
}

body.theme-dark .desktop-download-link:hover {
  background: #476480;
  color: var(--ink);
}

body.theme-dark .chat-actions textarea {
  background: #2C3E50;
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--ink);
}

body.theme-dark .feed-body,
body.theme-dark .chat-body {
  background: #3D5570;
}
