:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --surface-muted: #eef4fb;
  --border: #d9e2ee;
  --border-strong: #c7d3e5;
  --text: #22344d;
  --muted: #7a889e;
  --blue: #2a73f5;
  --blue-soft: #dcebff;
  --green: #189c67;
  --green-soft: #ccf4df;
  --yellow-soft: #f3f5f8;
  --shadow: 0 14px 35px rgba(28, 48, 82, 0.08);
}

body.dark-theme {
  --bg: #0f1720;
  --surface: #182433;
  --surface-soft: #223245;
  --surface-muted: #2a3d54;
  --border: #324962;
  --border-strong: #44607e;
  --text: #f4f8ff;
  --muted: #b1c0d4;
  --blue: #79abff;
  --blue-soft: #294a78;
  --green: #49cf94;
  --green-soft: #1f4f3e;
  --yellow-soft: #2b3d55;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(89, 143, 255, 0.1), transparent 24%),
    linear-gradient(180deg, #f9fbfe 0%, #f4f7fb 100%);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 13px;
}

body.dark-theme {
  background:
    radial-gradient(circle at top left, rgba(121, 171, 255, 0.16), transparent 24%),
    linear-gradient(180deg, #111a24 0%, #0f1720 100%);
}

button,
input,
a,
kbd {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(209, 220, 235, 0.9);
  box-shadow: 0 1px 0 rgba(214, 224, 238, 0.4);
}

body.dark-theme .topbar {
  background: rgba(18, 28, 40, 0.94);
  border-bottom-color: rgba(62, 88, 115, 0.96);
  box-shadow: 0 1px 0 rgba(18, 28, 40, 0.85);
}

.topbar-inner {
  width: min(1520px, calc(100% - 36px));
  margin: 0 auto;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand-lockup,
.brand-copy,
.main-nav,
.topbar-actions,
.toolbar-actions,
.toolbar-filters,
.queue-actions,
.series-main,
.metric-cell,
.subscription-list {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 10px;
  min-width: 180px;
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: block;
  background: linear-gradient(135deg, #eef5ff, #ffffff 58%, #eff5ff);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.brand-glyph {
  position: absolute;
  display: block;
  border-radius: 999px;
  background: linear-gradient(180deg, #2a73f5, #6ca6ff);
}

.brand-glyph-a {
  width: 8px;
  height: 24px;
  left: 10px;
  top: 9px;
}

.brand-glyph-b {
  width: 8px;
  height: 18px;
  left: 20px;
  top: 15px;
}

.brand-glyph-c {
  width: 18px;
  height: 8px;
  left: 13px;
  top: 25px;
  transform: rotate(36deg);
}

.brand-copy {
  gap: 8px;
}

.brand-copy strong {
  font-size: 22px;
  letter-spacing: -0.06em;
}

.brand-copy span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 10px;
  font-weight: 700;
}

.main-nav {
  gap: 8px;
  flex: 0 0 auto;
}

.nav-link {
  border: 0;
  background: transparent;
  color: #4f617b;
  padding: 24px 14px 22px;
  font-weight: 700;
  font-size: 15px;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}

.nav-link.active {
  color: var(--text);
  border-bottom-color: var(--blue);
}

.topbar-actions {
  gap: 14px;
  margin-left: auto;
}

.theme-toggle {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid #d5e0ef;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 10px 22px rgba(35, 61, 99, 0.05);
  position: relative;
  cursor: pointer;
}

.theme-toggle-sun,
.theme-toggle-moon {
  position: absolute;
  inset: 0;
  margin: auto;
  transition: opacity 0.18s ease;
}

.theme-toggle-sun {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #f5b940;
  box-shadow: 0 0 0 4px rgba(245, 185, 64, 0.18);
}

.theme-toggle-moon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #cfd9eb;
  clip-path: path("M 9 0 A 9 9 0 1 0 18 9 A 7 7 0 1 1 9 0");
  opacity: 0;
}

body.dark-theme .theme-toggle {
  border-color: var(--border);
  background: linear-gradient(180deg, #1b283b, #182334);
  box-shadow: none;
}

body.dark-theme .theme-toggle-sun {
  opacity: 0;
}

body.dark-theme .theme-toggle-moon {
  opacity: 1;
}

.quick-search {
  min-width: 350px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid #d5e0ef;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #8294ad;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(35, 61, 99, 0.05);
}

.quick-search kbd {
  margin-left: auto;
  padding: 4px 7px;
  border-radius: 8px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: #7a8798;
  font-size: 12px;
}

.search-icon {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.search-icon::before,
.search-icon::after {
  content: "";
  position: absolute;
}

.search-icon::before {
  width: 11px;
  height: 11px;
  top: 0;
  left: 0;
  border: 2px solid #8b98aa;
  border-radius: 50%;
}

.search-icon::after {
  width: 7px;
  height: 2px;
  right: -1px;
  bottom: 1px;
  transform: rotate(45deg);
  background: #8b98aa;
}

.app-shell {
  width: min(1520px, calc(100% - 36px));
  margin: 22px auto 40px;
}

.app-alerts {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.app-status {
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.app-status.hidden {
  display: none;
}

.app-status-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--muted);
}

.status-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(78, 125, 255, 0.22);
  border-top-color: var(--blue);
  animation: spin 0.75s linear infinite;
  flex: 0 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.app-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.app-alert.success {
  border-color: #b8e2ca;
  background: #f3fcf7;
  color: #1c6b47;
}

.app-alert.error {
  border-color: #f0c1c8;
  background: #fff5f6;
  color: #9a4050;
}

body.dark-theme .app-alert.success {
  border-color: #245139;
  background: #163025;
}

body.dark-theme .app-alert.error {
  border-color: #6a3340;
  background: #321821;
}

.alert-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.page-panel.hidden {
  display: none;
}

.toolbar-card,
.queue-panel,
.list-panel,
.modal-card,
.discovery-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.toolbar-card,
.queue-panel {
  padding: 20px 22px;
}

.toolbar-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.toolbar-filters,
.toolbar-actions {
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-filters {
  flex: 1;
}

.select-chip,
.filter-chip,
.status-select,
.secondary,
.primary,
.ghost-action,
.menu-trigger,
.close-modal,
.ghost-link,
.import-button {
  border: 1px solid var(--border);
  border-radius: 14px;
}

.select-chip,
.filter-chip,
.status-select,
.secondary,
.primary,
.ghost-action,
.ghost-link {
  height: 48px;
  padding: 0 18px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.select-chip {
  min-width: 160px;
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
}

.status-select {
  position: relative;
  min-width: 180px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  padding: 0 18px;
}

.status-select select {
  appearance: none;
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  padding-right: 22px;
  cursor: pointer;
}

.status-select .caret {
  position: absolute;
  right: 18px;
  pointer-events: none;
}

.filter-chip {
  height: 42px;
  background: var(--surface-soft);
  color: #5f7087;
  font-weight: 600;
}

.filter-chip.active {
  color: var(--blue);
  border-color: #c2d9ff;
  background: #eef5ff;
}

.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
  font-weight: 700;
}

.secondary {
  font-weight: 700;
}

.ghost-action,
.ghost-link {
  background: transparent;
  color: #61738b;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.caret {
  width: 10px;
  height: 10px;
  border-right: 2px solid #91a0b5;
  border-bottom: 2px solid #91a0b5;
  transform: rotate(45deg) translateY(-2px);
}

.searchbox {
  height: 48px;
  border: 1px solid #d2deee;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: linear-gradient(180deg, #ffffff, #f9fbff);
  box-shadow: 0 8px 18px rgba(40, 64, 102, 0.05);
}

.list-searchbox {
  min-width: 360px;
}

.searchbox input,
.modal-searchbar input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
}

.queue-panel,
.list-panel {
  margin-top: 18px;
}

.discovery-panel {
  margin-top: 18px;
  padding: 20px 22px;
}

.queue-panel {
  padding-top: 16px;
  padding-bottom: 16px;
}

.queue-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue);
}

.queue-head h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.05em;
}

.subtle,
.detail-meta,
.queue-meta,
.series-copy p,
.chapter-title,
.result-copy p {
  color: var(--muted);
}

.queue-grid {
  display: grid;
  grid-auto-columns: minmax(260px, 1fr);
  grid-auto-flow: column;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
}

.queue-item {
  display: grid;
  grid-template-rows: minmax(48px, auto) auto;
  min-height: 82px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  padding: 14px;
}

.queue-grid::-webkit-scrollbar {
  height: 10px;
}

.queue-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.queue-grid::-webkit-scrollbar-track {
  background: transparent;
}

.queue-copy {
  display: grid;
  grid-template-rows: minmax(48px, auto) auto;
  gap: 12px;
  height: 100%;
}

.queue-series {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.queue-actions {
  align-items: flex-end;
  align-self: end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: auto;
}

.queue-actions .chapter-pill {
  flex: 0 0 auto;
}

.queue-meta {
  display: block;
  min-height: 38px;
  line-height: 1.45;
}

@media (max-width: 1500px) {
  .queue-grid {
    grid-auto-columns: minmax(250px, 1fr);
  }
}

@media (max-width: 1240px) {
  .queue-grid {
    grid-auto-columns: minmax(240px, 1fr);
  }
}

@media (max-width: 920px) {
  .queue-grid {
    grid-auto-columns: minmax(220px, 82vw);
  }
}

.list-summary,
.table-head {
  display: grid;
  grid-template-columns: minmax(320px, 2.6fr) 140px 190px 190px 170px;
  gap: 16px;
  align-items: center;
  padding: 0 20px;
}

.list-summary {
  min-height: 72px;
  border-bottom: 1px solid var(--border);
}

.table-head {
  min-height: 48px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  color: #8190a3;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.list-table {
  display: flex;
  flex-direction: column;
}

.series-row {
  border-bottom: 1px solid var(--border);
}

.series-grid {
  display: grid;
  grid-template-columns: minmax(320px, 2.6fr) 140px 190px 190px 170px;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
}

.series-main {
  gap: 14px;
}

.series-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 5px solid #d8e6fb;
  background: #97abc5;
}

.series-dot.active {
  background: var(--blue);
}

.cover-thumb {
  width: 54px;
  height: 74px;
  border-radius: 12px;
  background: #eaf0f8;
  overflow: hidden;
  flex: 0 0 54px;
}

.cover-thumb img,
.result-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.series-copy h3 {
  margin: 0 0 5px;
  font-size: 15px;
  line-height: 1.2;
}

.series-copy p {
  margin: 0;
  font-size: 12px;
}

.metric-cell {
  gap: 8px;
}

.metric-cell.detail {
  align-items: flex-start;
  flex-direction: column;
}

.metric-cell.actions {
  justify-content: flex-end;
}

.metric-badge,
.status-pill,
.chapter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

.metric-badge {
  min-width: 60px;
  padding: 8px 14px;
  background: var(--yellow-soft);
  color: #d8e7fb;
}

.status-pill {
  padding: 9px 16px;
  font-size: 13px;
}

.status-pill.good {
  background: var(--green-soft);
  color: #82efbf;
}

.status-pill.pending {
  background: #314258;
  color: #d0dff4;
}

.status-pill.hold {
  background: #5e5020;
  color: #ffe89a;
}

.status-pill.dropped {
  background: #59303a;
  color: #ffc7d3;
}

.chapter-pill {
  border: 0;
  padding: 8px 14px;
  background: var(--blue-soft);
  color: #dcebff;
}

.chapter-pill.neutral {
  background: #314258;
  color: #d0dff4;
}

.link-like {
  cursor: pointer;
}

.more-button {
  min-width: 88px;
}

.menu-shell {
  position: relative;
}

.menu-trigger {
  width: 42px;
  height: 42px;
  background: var(--surface);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.context-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 32px rgba(20, 39, 70, 0.12);
  padding: 8px;
  display: grid;
  gap: 4px;
  z-index: 10;
}

.context-menu button {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.context-menu button:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.series-detail {
  padding: 0 20px 20px 82px;
}

.series-detail.hidden {
  display: none;
}

.detail-group {
  margin-top: 12px;
}

.detail-group h4 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7f8ea2;
}

.subscription-list {
  flex-wrap: wrap;
  gap: 10px;
}

.subscription-chip {
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.chapter-list {
  display: grid;
  gap: 10px;
}

.chapter-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px;
  gap: 16px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.chapter-row.read {
  background: #f3fbf7;
}

.chapter-row > div {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.notes-box,
.inline-empty,
.search-feedback {
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
  line-height: 1.5;
}

.muted-box {
  color: var(--muted);
}

.empty-state {
  padding: 28px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 16px;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.modal-shell.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(34, 52, 77, 0.42);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(980px, calc(100% - 28px));
  margin: 30px auto;
  max-height: calc(100vh - 60px);
  overflow: auto;
  padding: 20px;
}

.modal-searchbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 0 18px;
  border: 1px solid #cedcf0;
  border-radius: 22px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 14px 28px rgba(35, 61, 99, 0.06);
}

.modal-searchbar input {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.close-modal {
  width: 42px;
  height: 42px;
  background: transparent;
  color: #7f8ea2;
  font-size: 30px;
  cursor: pointer;
}

.modal-controls {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.modal-controls h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.05em;
  line-height: 1.15;
}

.source-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.source-pill.connected {
  border-color: #b9d7c7;
  background: linear-gradient(180deg, #ffffff, #f4fcf7);
}

.source-pill input {
  margin: 0;
}

.source-pill span {
  display: grid;
  gap: 2px;
}

.source-pill small {
  color: var(--muted);
}

.source-pill.disabled {
  opacity: 0.55;
}

.source-inline-action {
  margin-left: auto;
  height: 38px;
  padding: 0 14px;
}

.search-results {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.result-card {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.result-cover {
  width: 74px;
  height: 100px;
  border-radius: 14px;
  overflow: hidden;
  background: #eaf0f8;
}

.result-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.provider-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef3ff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.result-copy h3 {
  margin: 0 0 6px;
  font-size: 19px;
  letter-spacing: -0.03em;
}

.result-copy p {
  margin: 0;
  font-size: 13px;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.discovery-sections {
  display: grid;
  gap: 18px;
}

.discovery-source {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  padding: 18px;
}

.discovery-source-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.discovery-source-head h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.04em;
}

.discovery-source-head span {
  color: var(--muted);
}

.discovery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.discovery-load-more {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.discovery-card {
  display: grid;
  grid-template-rows: 180px auto auto;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.discovery-card-note {
  grid-template-rows: auto auto;
}

.discovery-cover {
  width: 100%;
  height: 180px;
  border-radius: 14px;
  background: #eaf0f8;
  overflow: hidden;
}

.discovery-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.discovery-copy h4 {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.25;
}

.discovery-copy p {
  margin: 0;
  color: var(--muted);
}

.discovery-actions {
  display: flex;
  gap: 10px;
}

.import-button.loading {
  cursor: progress;
  opacity: 0.9;
}

.secondary.loading,
.primary.loading,
.ghost-link.loading,
.ghost-action.loading {
  cursor: progress;
  opacity: 0.88;
}

.loading-state h3 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

body.dark-theme .quick-search,
body.dark-theme .searchbox,
body.dark-theme .modal-searchbar,
body.dark-theme .status-select,
body.dark-theme .secondary,
body.dark-theme .ghost-action,
body.dark-theme .ghost-link,
body.dark-theme .menu-trigger,
body.dark-theme .source-pill,
body.dark-theme .discovery-card,
body.dark-theme .result-card,
body.dark-theme .toolbar-card,
body.dark-theme .queue-panel,
body.dark-theme .list-panel,
body.dark-theme .modal-card,
body.dark-theme .discovery-panel,
body.dark-theme .discovery-source,
body.dark-theme .queue-item,
body.dark-theme .chapter-row,
body.dark-theme .notes-box,
body.dark-theme .inline-empty,
body.dark-theme .search-feedback,
body.dark-theme .cover-thumb,
body.dark-theme .result-cover,
body.dark-theme .discovery-cover {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: none;
}

body.dark-theme .table-head,
body.dark-theme .chapter-row,
body.dark-theme .subscription-chip,
body.dark-theme .chapter-pill.neutral,
body.dark-theme .metric-badge,
body.dark-theme .status-pill.pending,
body.dark-theme .search-feedback,
body.dark-theme .notes-box,
body.dark-theme .inline-empty {
  background: var(--surface-soft);
}

body.dark-theme .chapter-row.read {
  background: #173025;
}

body.dark-theme .brand-mark {
  background: linear-gradient(135deg, #1f3046, #172232 58%, #223248);
  border-color: var(--border);
}

body.dark-theme .quick-search kbd {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--muted);
}

body.dark-theme .nav-link {
  color: var(--muted);
}

body.dark-theme .nav-link.active,
body.dark-theme .brand-copy strong,
body.dark-theme .queue-head h2,
body.dark-theme .series-copy h3,
body.dark-theme .result-copy h3,
body.dark-theme .discovery-copy h4,
body.dark-theme .discovery-source-head h3,
body.dark-theme .empty-state h3 {
  color: var(--text);
}

body.dark-theme .subtle,
body.dark-theme .detail-meta,
body.dark-theme .queue-meta,
body.dark-theme .series-copy p,
body.dark-theme .chapter-title,
body.dark-theme .result-copy p,
body.dark-theme .discovery-copy p,
body.dark-theme .discovery-source-head span {
  color: var(--muted);
}

body.dark-theme .search-icon::before {
  border-color: var(--muted);
}

body.dark-theme .search-icon::after {
  background: var(--muted);
}

@media (max-width: 1180px) {
  .topbar-inner,
  .app-shell {
    width: calc(100% - 18px);
  }

  .toolbar-row,
  .modal-controls {
    grid-template-columns: 1fr;
    display: grid;
  }

  .main-nav {
    display: none;
  }

  .quick-search {
    min-width: 220px;
  }

  .list-summary,
  .table-head,
  .series-grid,
  .chapter-row,
  .result-card {
    grid-template-columns: 1fr;
  }

  .table-head {
    display: none;
  }

  .series-detail {
    padding-left: 20px;
  }

  .metric-cell.actions {
    justify-content: flex-start;
  }

  .result-cover {
    width: 100px;
    height: 136px;
  }
}

@media (max-width: 760px) {
  .topbar-inner {
    min-height: 68px;
  }

  .topbar-actions {
    width: 100%;
  }

  .quick-search,
  .list-searchbox {
    min-width: 100%;
    width: 100%;
  }

  .toolbar-card,
  .queue-panel,
  .modal-card {
    padding: 16px;
  }

  .queue-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .queue-head h2 {
    font-size: 22px;
  }

  .queue-head .subtle,
  #provider-summary {
    max-width: none;
    width: 100%;
    line-height: 1.45;
  }

  .queue-grid {
    grid-auto-columns: minmax(230px, 86vw);
    padding-right: 0;
  }

  .queue-item {
    min-height: 132px;
  }

  .queue-copy {
    grid-template-rows: minmax(52px, auto) auto;
  }

  .queue-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .queue-meta {
    min-height: 0;
  }

  .series-grid,
  .list-summary,
  .series-detail {
    padding-left: 16px;
    padding-right: 16px;
  }

  .series-grid {
    gap: 14px;
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .series-main {
    align-items: flex-start;
    flex-wrap: nowrap;
    gap: 12px;
  }

  .series-dot {
    margin-top: 14px;
    flex: 0 0 18px;
  }

  .series-copy {
    min-width: 0;
  }

  .series-copy h3 {
    font-size: 14px;
    line-height: 1.3;
  }

  .series-copy p,
  .detail-meta {
    line-height: 1.45;
  }

  .metric-cell,
  .metric-cell.detail,
  .metric-cell.actions {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .metric-cell.actions {
    width: 100%;
  }

  .metric-cell.actions .secondary,
  .metric-cell.actions .menu-button {
    align-self: flex-start;
  }

  .menu-shell {
    width: 100%;
  }

  .row-menu {
    left: 0;
    right: auto;
    min-width: min(280px, calc(100vw - 64px));
  }
}
