:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #060a12;
  --page-grid: rgba(113, 145, 193, 0.045);
  --sidebar-bg: #070b14;
  --topbar-bg: rgba(8, 13, 23, 0.9);
  --surface-1: #0c121d;
  --surface-2: #111927;
  --surface-raised: #151f2f;
  --surface-hover: #182437;
  --border-subtle: rgba(153, 177, 211, 0.16);
  --border-strong: rgba(162, 190, 230, 0.3);
  --focus-ring: #7c9cff;
  --text-primary: #f5f7fb;
  --text-secondary: #aab6c8;
  --text-muted: #738197;
  --text-tertiary: #7a879b;
  --text-inverse: #07101c;
  --accent-blue: #5a82ff;
  --accent-cyan: #4ed6cb;
  --accent-violet: #8d76ff;
  --accent-pink: #e95b9f;
  --accent-orange: #f2a65a;
  --status-success: #42cda4;
  --status-warning: #f1c75b;
  --status-danger: #ef7186;
  --status-info: #69a1ff;
  --chart-1: #5f86ff;
  --chart-2: #52d3c6;
  --chart-3: #9c7cff;
  --chart-4: #e75fa6;
  --chart-5: #f4a261;
  --chart-6: #f5cf66;
  --chart-7: #6eb7ff;
  --chart-8: #8fd6a8;
  --chart-axis: #74849a;
  --chart-grid: rgba(147, 169, 201, 0.12);
  --chart-tooltip: #171f2c;
  --shadow-raised: 0 18px 46px rgba(0, 0, 0, 0.28);
  --radius-panel: 12px;

  /* Legacy aliases kept while the remaining workflows migrate. */
  --ink: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-subtle);
  --panel: var(--surface-1);
  --page: var(--page-bg);
  --blue: var(--accent-blue);
  --navy: var(--sidebar-bg);
  --pink: var(--accent-pink);
  --teal: var(--accent-cyan);
  --yellow: var(--status-warning);
  --orange: var(--accent-orange);
  --green: var(--status-success);
  --shadow: var(--shadow-raised);
}

html {
  background: var(--page-bg);
}

body {
  min-width: 320px;
  color: var(--text-primary);
  background-color: var(--page-bg);
  background-image:
    linear-gradient(var(--page-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--page-grid) 1px, transparent 1px),
    radial-gradient(circle at 78% 2%, rgba(77, 118, 208, 0.1), transparent 34%);
  background-size: 32px 32px, 32px 32px, auto;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-variant-numeric: tabular-nums;
}

button,
input,
select,
textarea {
  color: var(--text-primary);
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

::selection {
  color: var(--text-primary);
  background: rgba(90, 130, 255, 0.42);
}

.login-screen,
body.password-change-required .password-change-screen {
  background:
    radial-gradient(circle at 20% 10%, rgba(141, 118, 255, 0.18), transparent 34%),
    radial-gradient(circle at 85% 88%, rgba(78, 214, 203, 0.12), transparent 30%),
    var(--page-bg);
}

.login-card,
.password-change-panel,
.modal {
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-panel);
  background: rgba(12, 18, 29, 0.96);
  box-shadow: var(--shadow-raised);
}

.login-card,
.password-change-panel {
  border-top: 1px solid rgba(124, 156, 255, 0.65);
}

.login-form input,
input,
select,
textarea,
.audit-toolbar select,
.audit-toolbar input {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-2);
  outline-color: var(--focus-ring);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

.form-grid select,
.url-import input {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-2);
  outline-color: var(--focus-ring);
}

.form-grid label span,
.url-import span,
.upload-option,
.upload-zone span {
  color: var(--text-secondary);
}

.upload-zone,
.library-help {
  color: var(--text-secondary);
  border-color: var(--border-subtle);
  background: var(--surface-2);
}

.upload-zone strong {
  color: var(--text-primary);
}

.upload-zone.dragging {
  border-color: var(--accent-blue);
  background: rgba(94, 128, 240, 0.12);
  box-shadow: inset 0 0 0 1px rgba(124, 156, 255, 0.22);
}

.app-shell {
  grid-template-columns: 228px minmax(0, 1fr);
}

.sidebar {
  z-index: 30;
  gap: 28px;
  padding: 22px 16px;
  color: var(--text-primary);
  border-right: 1px solid var(--border-subtle);
  background:
    linear-gradient(180deg, rgba(112, 135, 179, 0.06), transparent 28%),
    var(--sidebar-bg);
}

.brand strong,
.sidebar-footer strong {
  color: var(--text-primary);
}

.brand span,
.sidebar-footer span {
  color: var(--text-muted);
}

.brand-mark {
  box-shadow: 0 0 28px rgba(90, 130, 255, 0.15);
}

.nav-list {
  gap: 6px;
}

.nav-item {
  min-height: 46px;
  height: auto;
  color: var(--text-secondary);
  border-radius: 9px;
}

.nav-item:hover {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-hover);
}

.nav-item.active {
  position: relative;
  color: var(--text-primary);
  border-color: rgba(110, 139, 255, 0.45);
  background: linear-gradient(90deg, rgba(87, 126, 255, 0.2), rgba(141, 118, 255, 0.08));
}

.nav-item.active::before {
  position: absolute;
  inset: 8px auto 8px -1px;
  width: 2px;
  content: "";
  border-radius: 999px;
  background: linear-gradient(var(--accent-cyan), var(--accent-blue), var(--accent-pink));
}

.nav-icon {
  color: var(--text-primary);
  background: rgba(126, 151, 193, 0.12);
}

.sidebar-footer {
  border-color: var(--border-subtle);
  background: var(--surface-1);
}

.workspace {
  max-width: 1760px;
  width: 100%;
  margin: 0 auto;
  padding: 22px 26px 40px;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  margin: -22px -26px 22px;
  padding: 18px 26px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--topbar-bg);
  backdrop-filter: blur(18px);
}

.topbar h1 {
  color: var(--text-primary);
  font-size: clamp(24px, 2vw, 30px);
  letter-spacing: -0.03em;
}

.eyebrow {
  color: var(--accent-cyan);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-card,
.panel,
.insight-card,
.ops-item,
.insight-list article,
.doc-card,
.quick-card,
.template-card,
.role-row,
.review-list article,
.generation-history article,
.todo-list article,
.activity-strip article,
.roadmap article,
.format-check,
.pending-intake-list article {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-1);
  box-shadow: none;
}

.panel,
.metric-card {
  border-radius: var(--radius-panel);
}

.panel {
  padding: 18px;
}

.panel-heading h2,
.panel h2,
.metric-card strong,
.insight-card strong,
.doc-card h3,
.quick-card strong {
  color: var(--text-primary);
}

.panel-subtitle,
.metric-card span,
.metric-card small,
.insight-card span,
.insight-card small,
.ops-item span,
.ops-item small,
.doc-meta,
.doc-card p,
.quick-card span,
.template-card p,
.roadmap p {
  color: var(--text-secondary);
}

.metric-card {
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--border-subtle);
}

.metric-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  content: "";
  background: var(--chart-1);
}

.metric-card:nth-child(2)::before { background: var(--chart-2); }
.metric-card:nth-child(3)::before { background: var(--chart-4); }
.metric-card:nth-child(4)::before { background: var(--chart-6); }

.primary-button {
  color: white;
  border: 1px solid rgba(141, 165, 255, 0.35);
  background: linear-gradient(90deg, #566ff0, #7d63ee);
  box-shadow: 0 10px 24px rgba(76, 98, 222, 0.2);
}

.primary-button:hover {
  filter: brightness(1.08);
}

.text-button,
.icon-button,
.compact-button {
  color: var(--text-secondary);
  border-color: var(--border-subtle);
  background: var(--surface-1);
}

.text-button:hover,
.icon-button:hover,
.compact-button:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.pill {
  color: var(--text-secondary);
  border-color: var(--border-subtle);
  background: rgba(112, 137, 179, 0.12);
}

.pill.success,
.text-button.success {
  color: var(--status-success);
  border-color: rgba(66, 205, 164, 0.28);
  background: rgba(66, 205, 164, 0.1);
}

.pill.warning {
  color: var(--status-warning);
  border-color: rgba(241, 199, 91, 0.28);
  background: rgba(241, 199, 91, 0.1);
}

.chart-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-panel);
  background: var(--surface-1);
}

.chart-canvas {
  width: 100%;
  min-height: 260px;
}

.chart-canvas[data-chart-state="missing-data"],
.chart-canvas[data-chart-state="missing-runtime"] {
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  border: 1px dashed var(--border-subtle);
  border-radius: 8px;
  background: rgba(5, 10, 18, 0.28);
}

.chart-summary {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}

.aurora-command {
  position: relative;
  overflow: hidden;
  border-color: rgba(104, 139, 255, 0.28);
  background:
    radial-gradient(circle at 88% 12%, rgba(141, 118, 255, 0.13), transparent 34%),
    var(--surface-1);
}

.aurora-command::after {
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue), var(--accent-pink), transparent 82%);
}

.aurora-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.aurora-kpi {
  position: relative;
  min-width: 0;
  min-height: 118px;
  display: grid;
  align-content: space-between;
  gap: 7px;
  padding: 15px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(92, 125, 190, 0.08), transparent 55%), var(--surface-1);
}

.aurora-kpi::after {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  content: "";
  opacity: 0.72;
  background: linear-gradient(90deg, var(--chart-1), transparent 72%);
}

.aurora-kpi:nth-child(2)::after { background-image: linear-gradient(90deg, var(--chart-2), transparent 72%); }
.aurora-kpi:nth-child(3)::after { background-image: linear-gradient(90deg, var(--chart-4), transparent 72%); }
.aurora-kpi:nth-child(4)::after { background-image: linear-gradient(90deg, var(--chart-5), transparent 72%); }
.aurora-kpi:nth-child(5)::after { background-image: linear-gradient(90deg, var(--chart-3), transparent 72%); }

.aurora-kpi span,
.aurora-kpi small {
  color: var(--text-tertiary);
}

.aurora-kpi span {
  font-size: 12px;
  letter-spacing: 0.04em;
}

.aurora-kpi strong {
  color: var(--text-primary);
  font-size: clamp(27px, 2.3vw, 38px);
  line-height: 1;
}

.aurora-kpi small {
  font-size: 11px;
}

.aurora-kpi-grid .aurora-kpi {
  --kpi-icon: var(--chart-1);
}

.aurora-kpi-grid .aurora-kpi:nth-child(2) { --kpi-icon: var(--chart-2); }
.aurora-kpi-grid .aurora-kpi:nth-child(3) { --kpi-icon: var(--chart-4); }
.aurora-kpi-grid .aurora-kpi:nth-child(4) { --kpi-icon: var(--chart-5); }
.aurora-kpi-grid .aurora-kpi:nth-child(5) { --kpi-icon: var(--chart-3); }
.aurora-kpi-grid .aurora-kpi:nth-child(6) { --kpi-icon: var(--chart-7); }

.aurora-kpi-grid .aurora-kpi-label {
  max-width: calc(100% - 58px);
}

.aurora-kpi-grid .aurora-kpi-icon {
  width: 48px;
  height: 48px;
  position: absolute;
  top: 13px;
  right: 13px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--kpi-icon);
  border: 1px solid color-mix(in srgb, var(--kpi-icon) 30%, transparent);
  border-radius: 14px;
  background:
    radial-gradient(circle at 34% 24%, color-mix(in srgb, var(--kpi-icon) 36%, transparent), transparent 42%),
    linear-gradient(145deg, color-mix(in srgb, var(--kpi-icon) 18%, var(--surface-raised)), rgba(8, 14, 24, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -8px 18px rgba(0, 0, 0, 0.2),
    0 10px 24px color-mix(in srgb, var(--kpi-icon) 14%, transparent);
  transform: rotate(-5deg);
}

.aurora-kpi-grid .aurora-kpi-icon::after {
  width: 32px;
  height: 10px;
  position: absolute;
  top: -4px;
  left: 3px;
  content: "";
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  filter: blur(5px);
}

.aurora-kpi-grid .aurora-kpi-icon svg {
  width: 25px;
  height: 25px;
  position: relative;
  z-index: 1;
  stroke-width: 1.8;
  filter: drop-shadow(0 3px 5px color-mix(in srgb, var(--kpi-icon) 34%, transparent));
  transform: rotate(5deg);
}

.aurora-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.aurora-dashboard-grid > .panel {
  margin: 0;
}

.dashboard-activity-panel {
  grid-column: span 8;
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
  align-content: stretch;
}

.dashboard-activity-panel .chart-canvas {
  height: 100%;
  min-height: 260px;
}
.dashboard-health-panel { grid-column: span 4; }
.dashboard-review-panel,
.dashboard-quality-panel,
.dashboard-todo-panel { grid-column: span 4; }

.insights-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.insights-diagnostic-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.insights-diagnostic-grid > .panel,
.insights-ops-grid > .panel {
  margin: 0;
}

.insights-activity-panel,
.insights-acceptance-panel { grid-column: span 8; }

.insights-quality-panel,
.insights-sources-panel { grid-column: span 4; }

.insights-review-panel,
.insights-feedback-panel { grid-column: span 6; }

.insights-ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.compact-chart {
  min-height: 220px;
}

.dashboard-health-grid {
  margin-top: 4px;
}

.dashboard-health-grid article {
  background: var(--surface-2);
}

.dashboard-health-grid span,
.ops-grid span,
.panel-subtitle,
.chart-summary {
  color: var(--text-tertiary);
}

.aurora-dashboard-bottom {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  margin-top: 14px;
}

.library-command-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}

.library-command-grid > .panel {
  margin: 0;
}

.library-coverage-panel { grid-column: span 4; }
.library-ingestion-panel { grid-column: span 5; }
.library-upload-panel { grid-column: span 3; grid-row: span 2; }
.library-format-panel { grid-column: span 9; }

.library-upload-panel {
  align-self: stretch;
}

.library-command-grid.is-read-only .library-coverage-panel,
.library-command-grid.is-read-only .library-ingestion-panel {
  grid-column: span 6;
}

.library-command-grid.is-read-only .library-format-panel {
  grid-column: span 12;
}

.library-acceptance-details {
  margin-bottom: 14px;
}

.library-acceptance-details > summary {
  min-height: 30px;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 700;
}

.library-acceptance-details[open] > summary {
  margin-bottom: 14px;
  color: var(--text-primary);
}

.library-heading {
  gap: 16px;
}

.library-heading .search-box {
  width: min(420px, 100%);
}

.library-toolbar {
  gap: 10px;
}

.library-filter-group,
.library-view-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}

.library-view-toggle {
  margin-left: auto;
}

.library-view-toggle .active {
  color: var(--text-primary);
  border-color: rgba(104, 139, 255, 0.42);
  background: rgba(90, 130, 255, 0.16);
}

.document-table-view {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
}

.document-table-view .doc-card {
  min-width: 0;
  min-height: 136px;
  grid-template-columns: 58px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-1);
}

.document-table-view .doc-thumb {
  width: 58px;
  height: 76px;
}

.document-table-view .doc-card > div:nth-child(2) {
  min-width: 0;
}

.document-table-view .doc-card h3 {
  max-width: 100%;
  margin-bottom: 4px;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-table-view .doc-meta,
.document-table-view .doc-fingerprint {
  font-size: 10px;
  line-height: 1.45;
}

.document-table-view .doc-card > div:nth-child(2) > .doc-meta:last-of-type {
  display: -webkit-box;
  max-height: 2.9em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.document-table-view .doc-tags {
  max-height: 22px;
  margin: 4px 0;
  overflow: hidden;
}

.document-table-view .doc-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.document-table-view .doc-actions .pill {
  margin-right: auto;
}

.document-table-view .doc-actions button {
  min-height: 26px;
  padding-inline: 7px;
  font-size: 10px;
}

.document-card-view {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.document-card-view .doc-card {
  min-width: 0;
  grid-template-columns: 58px minmax(0, 1fr);
}

.document-card-view .doc-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 960px) {
  .document-table-view,
  .document-card-view {
    grid-template-columns: 1fr;
  }
}

.skeleton {
  overflow: hidden;
  color: transparent;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--surface-2), var(--surface-hover), var(--surface-2));
  background-size: 240% 100%;
  animation: aurora-skeleton 1.4s ease-in-out infinite;
}

@keyframes aurora-skeleton {
  to { background-position: -240% 0; }
}

.modal-backdrop {
  background: rgba(1, 4, 10, 0.78);
  backdrop-filter: blur(8px);
}

pre,
.command-snippet,
#healthOutput,
#generatedOutput {
  color: var(--text-secondary);
  border-color: var(--border-subtle);
  background: #070c14;
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 204px minmax(0, 1fr); }
  .workspace { padding-inline: 20px; }
  .topbar { margin-inline: -20px; padding-inline: 20px; }
  .aurora-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-activity-panel { grid-column: span 12; }
  .dashboard-health-panel,
  .dashboard-review-panel,
  .dashboard-quality-panel,
  .dashboard-todo-panel { grid-column: span 6; }
  .insights-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .insights-activity-panel,
  .insights-quality-panel,
  .insights-acceptance-panel,
  .insights-sources-panel,
  .insights-review-panel,
  .insights-feedback-panel { grid-column: span 6; }
  .library-coverage-panel,
  .library-ingestion-panel,
  .library-upload-panel,
  .library-format-panel { grid-column: span 6; grid-row: auto; }
}

@media (max-width: 780px) {
  body { padding-bottom: 74px; }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 80;
    inset: auto 0 0;
    width: 100%;
    height: 68px;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-strong);
    border-right: 0;
    background: rgba(7, 11, 20, 0.96);
    backdrop-filter: blur(18px);
  }

  .sidebar > .brand,
  .sidebar-footer {
    display: none;
  }

  .nav-list {
    height: 100%;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
  }

  .nav-item {
    min-width: 0;
    min-height: 48px;
    height: 48px;
    justify-content: center;
    padding: 0;
  }

  .nav-item.active::before {
    inset: auto 14px -1px;
    width: auto;
    height: 2px;
  }

  .nav-icon {
    width: 30px;
    height: 30px;
  }

  .workspace,
  body.compact .workspace {
    width: 100%;
    padding: 14px 12px 22px;
    overflow-x: clip;
  }

  .topbar {
    margin: -14px -12px 14px;
    padding: 12px;
  }

  .topbar > div:first-child {
    min-width: 0;
  }

  .topbar h1 {
    max-width: 100%;
    font-size: 22px;
    overflow-wrap: anywhere;
  }

  .top-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 7px;
  }

  #currentUserBadge,
  #logoutBtn,
  .top-actions [data-view-shortcut="ask"] {
    display: none;
  }

  #backendStatus {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .panel,
  body.compact .panel {
    padding: 14px;
  }

  .metrics-grid,
  .insight-metrics,
  .intake-summary,
  .ops-grid,
  .ops-summary,
  .ops-check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .aurora-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .aurora-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-activity-panel,
  .dashboard-health-panel,
  .dashboard-review-panel,
  .dashboard-quality-panel,
  .dashboard-todo-panel {
    grid-column: auto;
  }

  .dashboard-activity-panel {
    display: block;
  }

  .dashboard-activity-panel .chart-canvas {
    height: 240px;
    min-height: 240px;
  }

  .aurora-dashboard-bottom {
    grid-template-columns: 1fr;
  }

  .insights-diagnostic-grid,
  .insights-ops-grid {
    grid-template-columns: 1fr;
  }

  .insights-activity-panel,
  .insights-quality-panel,
  .insights-acceptance-panel,
  .insights-sources-panel,
  .insights-review-panel,
  .insights-feedback-panel {
    grid-column: auto;
  }

  .library-command-grid {
    grid-template-columns: 1fr;
  }

  .library-coverage-panel,
  .library-ingestion-panel,
  .library-upload-panel,
  .library-format-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .library-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .library-filter-group,
  .library-view-toggle {
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
  }

  .library-filter-group button,
  .library-view-toggle button {
    flex: 1;
    min-height: 44px;
  }

  .document-table-view,
  .document-card-view {
    grid-template-columns: 1fr;
  }

  .document-table-view .doc-card,
  .document-card-view .doc-card {
    min-height: 0;
    grid-template-columns: 62px minmax(0, 1fr);
    padding: 12px;
  }

  .document-table-view .doc-actions,
  .document-card-view .doc-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }

  .metric-card,
  .insight-card {
    min-width: 0;
  }

  .chart-canvas {
    min-height: 240px;
  }

  .modal {
    max-height: calc(100dvh - 24px);
    overflow: auto;
  }
}

/* Aurora v2: full-site visual harmonization. Legacy workflows now share the
   same dark surfaces, controls and contrast rules as the dashboard. */

[data-lucide],
.lucide {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  stroke: currentColor;
}

.nav-icon .lucide {
  width: 16px;
  height: 16px;
}

.primary-button,
.text-button,
.status-button,
.image-start-primary,
.image-start-outline {
  gap: 8px;
}

.primary-button .lucide,
.text-button .lucide,
.status-button .lucide,
.image-start-primary .lucide,
.image-start-outline .lucide {
  width: 15px;
  height: 15px;
}

.topbar > div:first-child {
  min-width: 210px;
}

.top-actions {
  flex: 1;
  flex-wrap: nowrap;
}

.global-search {
  width: min(340px, 28vw);
  height: 38px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  padding: 0 11px;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(14, 22, 34, 0.86);
}

.global-search:focus-within {
  color: var(--text-secondary);
  border-color: rgba(106, 140, 255, 0.52);
  box-shadow: 0 0 0 3px rgba(90, 130, 255, 0.1);
}

.global-search input {
  min-width: 0;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.global-search kbd {
  padding: 2px 6px;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  background: var(--surface-2);
  font: inherit;
  font-size: 10px;
}

.status-button,
#logoutBtn,
.top-actions [data-view-shortcut="ask"] {
  display: inline-flex;
  align-items: center;
}

/* Ask: remove the light canvas and give the conversation a compact cockpit. */

#ask .ask-layout {
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: stretch;
}

#ask .ask-panel,
#ask .source-panel {
  border-color: var(--border-subtle);
  background: linear-gradient(145deg, rgba(90, 130, 255, 0.035), transparent 40%), var(--surface-1);
}

#ask .ask-panel {
  display: grid;
  grid-template-rows: min-content minmax(420px, 1fr) min-content;
}

.chat-window {
  height: auto;
  min-height: 420px;
  max-height: 62vh;
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background:
    radial-gradient(circle at 20% 0%, rgba(92, 126, 255, 0.08), transparent 34%),
    rgba(4, 9, 16, 0.62);
}

#ask .chat-window {
  max-height: none;
}

#ask .ask-form {
  align-items: center;
}

#ask .ask-form > .primary-button {
  height: 44px;
  min-height: 44px;
  align-self: center;
  white-space: nowrap;
}

.message,
.message.assistant {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-2);
}

.message.user {
  border-color: rgba(116, 145, 255, 0.48);
  background: linear-gradient(135deg, #4d6ce8, #745ae6);
}

.source-citation,
.search-match,
.search-empty,
.scope-list button {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-2);
}

.scope-list button:hover,
.source-citation:hover {
  color: var(--text-primary);
  border-color: rgba(110, 139, 255, 0.55);
  background: var(--surface-hover);
}

.source-note {
  color: var(--text-secondary);
  border-color: rgba(78, 214, 203, 0.2);
  background: rgba(42, 151, 142, 0.08);
}

.ask-form input,
.ask-form textarea {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-2);
}

/* Brand library: dark albums, filters, review cards and dialogs. */

#brand-assets .brand-asset-command {
  border-left: 0;
  border-color: rgba(104, 139, 255, 0.28);
  background:
    radial-gradient(circle at 88% 12%, rgba(141, 118, 255, 0.13), transparent 34%),
    var(--surface-1);
}

#brand-assets .brand-asset-command::after {
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue), var(--accent-pink), transparent 82%);
}

.brand-asset-command,
.brand-asset-album-panel,
.brand-asset-filters,
.brand-asset-ai-toolbar,
.brand-asset-review-toolbar,
.brand-asset-management-toolbar,
.brand-asset-gallery,
.brand-asset-detail {
  position: relative;
  border-color: var(--border-subtle);
  background: var(--surface-1);
}

.brand-asset-status-tabs .text-button {
  color: var(--text-secondary);
  border-color: var(--border-subtle);
  background: var(--surface-1);
}

.brand-asset-status-tabs .text-button.active {
  color: var(--text-primary);
  border-color: rgba(110, 139, 255, 0.48);
  background: linear-gradient(90deg, rgba(90, 130, 255, 0.22), rgba(141, 118, 255, 0.12));
}

.brand-asset-album-search input,
.brand-asset-filters input,
.brand-asset-filters select,
.brand-asset-dialog input,
.brand-asset-dialog select,
.brand-asset-dialog textarea,
.review-task-toolbar select,
.audit-toolbar input,
.audit-toolbar select {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-2);
}

.brand-asset-album,
.brand-asset-management-menu summary,
.brand-asset-management-menu button,
.brand-asset-card {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-2);
}

.brand-asset-album:hover,
.brand-asset-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.brand-asset-album.active {
  color: var(--text-primary);
  border-color: rgba(101, 134, 255, 0.7);
  background: linear-gradient(145deg, rgba(90, 130, 255, 0.16), rgba(141, 118, 255, 0.07)), var(--surface-2);
  box-shadow: 0 0 0 1px rgba(90, 130, 255, 0.18);
}

.brand-asset-album-cover,
.brand-asset-preview-missing,
.brand-asset-card img,
.brand-asset-detail-preview {
  color: var(--text-muted);
  background: #080e18;
}

.brand-asset-album-cover .lucide {
  width: 25px;
  height: 25px;
}

.brand-asset-ai-review {
  border-color: rgba(141, 118, 255, 0.24);
  background: rgba(105, 87, 224, 0.09);
}

.brand-asset-ai-review > strong {
  color: var(--accent-violet);
}

.asset-status {
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  background: rgba(8, 15, 25, 0.9);
  backdrop-filter: blur(10px);
}

.asset-ai-state {
  color: var(--accent-violet);
  border: 1px solid rgba(141, 118, 255, 0.2);
  background: rgba(24, 20, 53, 0.9);
}

.brand-asset-dialog {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--surface-1);
}

/* Legacy operation cards: stop white islands from appearing on long pages. */

.acceptance-summary,
.acceptance-quality-grid article,
.acceptance-history-item,
.acceptance-item,
.role-row,
.user-list article,
.review-list article,
.generation-history article,
.generation-image-card,
.format-check,
.pending-intake-list article,
.audit-list article,
.ops-summary,
.ops-check,
.ops-next article,
.roadmap article,
.source-context-section,
.queue-list div {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-2);
}

.empty-state,
.brand-asset-grid > .empty-state,
.brand-asset-detail > .empty-state {
  color: var(--text-secondary);
  border-color: var(--border-subtle);
  background: rgba(7, 13, 22, 0.56);
}

.brand-asset-grid > .empty-state,
.brand-asset-detail > .empty-state {
  min-height: 108px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px dashed var(--border-subtle);
  border-radius: 8px;
}

.user-form input,
.user-form select,
.brand-asset-workflow-form input,
.brand-asset-workflow-form select,
.brand-asset-workflow-form textarea {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-2);
}

.user-password-field small,
.user-form-status {
  color: var(--text-muted);
}

.user-form [aria-invalid="true"] {
  border-color: color-mix(in srgb, var(--status-danger) 72%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-danger) 14%, transparent);
}

.user-form-status.is-error {
  color: var(--status-danger);
}

.user-form-status.is-success {
  color: var(--status-success);
}

.acceptance-history-item:hover,
.acceptance-history-item.selected,
.role-row.active,
.review-record.published,
.review-record.archived {
  color: var(--text-primary);
  border-color: rgba(104, 139, 255, 0.44);
  background: var(--surface-hover);
}

.review-actions button {
  color: var(--text-secondary);
  border-color: var(--border-subtle);
  background: var(--surface-1);
}

.review-actions button:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.modal,
.source-modal {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--surface-1);
}

.document-detail-modal {
  width: min(1180px, 100%);
  height: min(780px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 0%, rgba(107, 93, 255, 0.1), transparent 30%),
    var(--surface-1);
}

.document-detail-heading {
  align-items: flex-start;
}

.document-detail-heading h2 {
  max-width: 860px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-detail-tags {
  display: flex;
  min-height: 26px;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.document-detail-tags span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 9px;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 11px;
}

.document-detail-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 12px;
}

.document-original-panel,
.document-parsed-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: rgba(5, 11, 20, 0.54);
}

.document-original-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.document-parsed-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.document-detail-section-heading,
.document-original-actions,
.document-content-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.document-detail-section-heading h3,
.document-detail-section-heading p {
  margin: 0;
}

.document-detail-section-heading h3 {
  color: var(--text-primary);
  font-size: 14px;
}

.document-detail-section-heading p,
.document-content-pagination span {
  color: var(--text-tertiary);
  font-size: 11px;
}

.document-original-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.document-original-actions .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.document-original-preview,
.document-parsed-content {
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(113, 135, 176, 0.18);
  border-radius: 8px;
  background: #050a12;
}

.document-original-preview iframe,
.document-original-preview img {
  width: 100%;
  height: 100%;
  min-height: 460px;
  display: block;
  border: 0;
  object-fit: contain;
}

.document-preview-placeholder {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 28px;
  color: var(--text-tertiary);
  text-align: center;
}

.document-preview-placeholder svg {
  width: 42px;
  height: 42px;
  color: #7185ff;
  filter: drop-shadow(0 0 14px rgba(113, 133, 255, 0.34));
}

.document-preview-placeholder strong {
  color: var(--text-primary);
}

.document-preview-placeholder p {
  max-width: 340px;
  margin: 0;
  line-height: 1.6;
}

.document-content-chunk {
  padding: 14px;
}

.document-content-chunk + .document-content-chunk {
  border-top: 1px solid var(--border-subtle);
}

.document-content-chunk > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.document-content-chunk strong {
  color: #7ce7d4;
  font-size: 12px;
}

.document-content-chunk span {
  color: var(--text-tertiary);
  font-size: 11px;
}

.document-content-chunk p {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.72;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.document-content-pagination {
  justify-content: center;
}

.document-content-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

@media (max-width: 960px) {
  .document-detail-modal {
    height: calc(100vh - 32px);
    max-height: calc(100vh - 32px);
    overflow: auto;
  }

  .document-detail-layout {
    grid-template-columns: 1fr;
  }

  .document-original-panel,
  .document-parsed-panel {
    min-height: 420px;
  }

  .document-original-preview iframe,
  .document-original-preview img {
    min-height: 340px;
  }
}

/* Image studio home and editor: preserve its specialist layout, but bring it
   into the same Aurora shell instead of switching the entire app to white. */

body.image-studio-active,
body.image-studio-active.image-studio-home,
body.image-studio-active .workspace {
  color: var(--text-primary);
  background-color: var(--page-bg);
  background-image:
    linear-gradient(var(--page-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--page-grid) 1px, transparent 1px),
    radial-gradient(circle at 74% 0%, rgba(77, 118, 208, 0.12), transparent 36%);
  background-size: 32px 32px, 32px 32px, auto;
}

body.image-studio-active .app-shell {
  grid-template-columns: 228px minmax(0, 1fr);
}

.image-start-screen {
  color: var(--text-primary);
  background: transparent;
}

.image-start-header > div:first-child > span,
.image-start-header p,
.image-start-steps li,
.image-start-steps small,
.image-start-quick-panel header small,
.image-start-quick-fields label,
.image-start-copy > small,
.image-start-copy > b,
.image-start-card-footer > span,
.image-start-side-card small,
.image-start-side-card time,
.image-start-side-card p,
.image-start-rules article small,
.image-start-rules > p {
  color: var(--text-secondary);
}

.image-start-outline,
.image-start-side-card button {
  color: var(--text-secondary);
  border-color: var(--border-subtle);
  background: var(--surface-1);
}

.image-start-outline:hover,
.image-start-side-card button:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.image-start-primary {
  color: #fff;
  border-color: rgba(141, 165, 255, 0.38);
  background: linear-gradient(90deg, #566ff0, #7d63ee);
  box-shadow: 0 10px 24px rgba(76, 98, 222, 0.2);
}

.image-start-quick-panel,
.image-start-card {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-1);
  box-shadow: none;
}

.image-start-quick-panel {
  background:
    radial-gradient(circle at 86% 0%, rgba(141, 118, 255, 0.11), transparent 32%),
    var(--surface-1);
}

.image-start-quick-panel header em {
  color: var(--accent-violet);
  background: rgba(141, 118, 255, 0.12);
}

.image-start-selection-status > span {
  color: var(--text-secondary);
  background: rgba(133, 151, 188, 0.1);
}

.image-start-quick-fields input,
.image-start-quick-fields select {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-2);
}

.image-start-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-raised);
}

.image-start-card.selected {
  border-color: rgba(105, 139, 255, 0.82);
  box-shadow: 0 0 0 1px rgba(105, 139, 255, 0.26), 0 18px 42px rgba(0, 0, 0, 0.18);
}

.image-start-card.selected .image-start-visual::after {
  content: "当前模板";
}

.image-start-copy {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-2);
}

.image-start-copy > span > em {
  color: var(--template-accent);
}

.image-start-card-footer {
  border-color: var(--border-subtle);
  background: rgba(8, 14, 25, 0.72);
}

.image-start-card-footer > button {
  color: var(--text-primary);
  border-color: rgba(var(--template-accent-rgb), 0.32);
  background: rgba(var(--template-accent-rgb), 0.11);
}

.image-start-card.selected .image-start-card-footer > button {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(100deg, var(--template-accent), #7d63ee);
  box-shadow: 0 8px 18px rgba(var(--template-accent-rgb), 0.18);
}

.image-studio-toolbar {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: rgba(8, 13, 23, 0.94);
  backdrop-filter: blur(18px);
}

.image-studio-title span,
.image-studio-tools label > span,
.image-settings-panel label > span,
.image-advanced-settings summary,
.image-reference-settings summary,
.image-provider-note,
.image-reference-upload {
  color: var(--text-secondary);
}

.image-studio-tools select,
.image-toolbar-icon,
.image-toolbar-button,
.image-artboard-tools,
.image-artboard-tools button,
.image-settings-title button,
.image-settings-panel select {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-2);
}

.image-studio-shell,
.image-artboard-area {
  background-color: #080e18;
  background-image:
    radial-gradient(circle, rgba(117, 145, 190, 0.16) 1px, transparent 1.1px),
    radial-gradient(circle at 50% 45%, rgba(81, 96, 229, 0.08), transparent 34%);
}

.image-artboard-heading > strong,
.image-artboard-tools,
.image-canvas-hint,
.image-settings-panel,
.image-template-dialog,
.image-history-dialog,
.image-template-dialog > header,
.image-history-dialog > header {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: rgba(12, 18, 29, 0.94);
  box-shadow: var(--shadow-raised);
}

.image-settings-title {
  background: linear-gradient(180deg, rgba(12, 18, 29, 0.99) 76%, rgba(12, 18, 29, 0));
}

.image-reference-upload,
.image-history-item {
  border-color: var(--border-subtle);
  background: var(--surface-2);
}

.image-history-copy .image-history-resume {
  color: var(--accent-violet);
}

/* Keep the native tone select accessible without allowing the generic select
   rule to expand the visually-hidden control and create a horizontal bar. */
.image-settings-panel select.sr-only {
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.image-settings-panel {
  overflow-x: hidden;
}

.image-prompt-dock {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: rgba(12, 18, 29, 0.96);
  box-shadow: var(--shadow-raised);
  backdrop-filter: blur(18px);
}

.image-prompt-dock textarea {
  color: var(--text-primary);
  background: transparent;
}

.image-prompt-dock textarea::placeholder {
  color: var(--text-muted);
}

.image-progress {
  background:
    radial-gradient(circle at 42% 42%, rgba(103, 91, 232, 0.2), transparent 29%),
    radial-gradient(circle at 62% 58%, rgba(54, 211, 189, 0.09), transparent 31%),
    rgba(4, 9, 17, 0.74);
}

.image-progress-card {
  border-color: var(--border-strong);
  background:
    radial-gradient(circle at 100% 0%, rgba(130, 94, 231, 0.12), transparent 34%),
    linear-gradient(135deg, rgba(18, 28, 46, 0.97), rgba(8, 15, 27, 0.98));
  box-shadow: var(--shadow-raised), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.image-progress-copy strong {
  color: var(--text-primary);
}

.image-progress-copy small,
.image-progress-card > p {
  color: var(--text-secondary);
}

.image-tone-picker,
.image-advanced-settings,
.image-reference-settings {
  border-color: var(--border-subtle);
}

.image-advanced-settings summary span,
.image-reference-settings summary span,
.image-settings-title small,
.image-setting-help {
  color: var(--text-muted);
}

.image-brand-note {
  color: var(--accent-violet);
  background: rgba(141, 118, 255, 0.1);
}

.image-brand-note small {
  color: var(--text-secondary);
}

@media (max-width: 1280px) {
  .global-search {
    display: none;
  }

  #ask .ask-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

@media (max-width: 940px) {
  #ask .ask-layout {
    grid-template-columns: 1fr;
  }

  #ask .source-panel {
    order: 0;
  }

  .chat-window {
    max-height: 56vh;
  }

  body.image-studio-active .app-shell {
    grid-template-columns: 204px minmax(0, 1fr);
  }
}

@media (max-width: 780px) {
  body.image-studio-active .app-shell {
    display: block;
  }

  .nav-list,
  body.image-studio-active .nav-list {
    grid-template-columns: repeat(9, minmax(34px, 1fr));
  }

  body.image-studio-active {
    min-height: 100vh;
    padding-bottom: 74px;
    overflow: auto;
  }

  body.image-studio-active .sidebar {
    position: fixed;
    z-index: 80;
    inset: auto 0 0;
    width: 100%;
    height: 68px;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-strong);
    border-right: 0;
    background: rgba(7, 11, 20, 0.97);
    backdrop-filter: blur(18px);
  }

  body.image-studio-active .sidebar > .brand,
  body.image-studio-active .sidebar-footer {
    display: none;
  }

  body.image-studio-active .nav-item {
    min-width: 0;
    min-height: 48px;
    height: 48px;
    justify-content: center;
    padding: 0;
  }

  body.image-studio-active .nav-item span:last-child {
    display: none;
  }

  body.image-studio-active .nav-item.active::before {
    inset: auto 9px -1px;
    width: auto;
    height: 2px;
  }

  body.image-studio-active .workspace {
    width: 100%;
    min-height: 100vh;
    padding: 0 0 22px;
    overflow-x: clip;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  #ask .ask-panel {
    grid-template-rows: auto minmax(280px, 43vh) auto;
  }

  #ask .chat-window {
    min-height: 280px;
    max-height: 43vh;
  }

  .status-button span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .image-start-screen {
    padding-inline: 12px;
  }

  .image-start-grid,
  .image-start-rail {
    grid-template-columns: 1fr;
  }

  .image-start-rules {
    grid-column: auto;
  }
}

@media (max-width: 420px) {
  .top-actions { grid-template-columns: auto minmax(0, 1fr); }
  .top-actions > :last-child { display: none; }
}

/* Aurora v3: responsive workspace cohesion.
   The dashboard is a full-width operating surface; every workflow now shares
   the same gutters, density and dark component treatment. */

:root {
  --shell-sidebar: 216px;
  --content-gutter: clamp(14px, 1.15vw, 24px);
  --section-gap: clamp(10px, 0.8vw, 14px);
  --panel-padding: clamp(13px, 0.95vw, 16px);
}

.app-shell,
body.image-studio-active .app-shell {
  grid-template-columns: var(--shell-sidebar) minmax(0, 1fr);
}

.workspace,
body.compact .workspace,
body.image-studio-active .workspace {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: var(--content-gutter) var(--content-gutter) 32px;
}

.view.active {
  width: 100%;
  gap: var(--section-gap);
}

.panel,
body.compact .panel {
  padding: var(--panel-padding);
}

.topbar {
  min-height: 76px;
  margin: calc(var(--content-gutter) * -1) calc(var(--content-gutter) * -1) var(--section-gap);
  padding: 13px var(--content-gutter) 12px;
}

.topbar h1 {
  font-size: clamp(23px, 1.7vw, 28px);
}

.top-actions {
  min-width: 0;
  gap: 9px;
}

.top-actions > *,
.status-button,
#logoutBtn,
.top-actions [data-view-shortcut="ask"] {
  flex: 0 0 auto;
  white-space: nowrap;
}

.global-search {
  width: clamp(230px, 24vw, 340px);
}

.panel-heading {
  margin-bottom: 12px;
}

.aurora-kpi-grid,
.aurora-dashboard-grid,
.insights-diagnostic-grid,
.insights-ops-grid,
.library-command-grid,
.split-layout,
.two-column,
.ask-layout,
.generator-layout,
.dashboard-layout,
.dashboard-main,
.dashboard-side,
.dashboard-bottom {
  gap: var(--section-gap);
}

.aurora-kpi-grid {
  margin: var(--section-gap) 0;
}

.aurora-kpi {
  min-height: 102px;
  padding: 13px;
}

.chart-canvas {
  min-height: 220px;
}

.compact-chart {
  min-height: 190px;
}

#dashboard .dashboard-command {
  min-height: 94px;
}

.aurora-dashboard-bottom,
.insights-ops-grid {
  margin-top: var(--section-gap);
}

/* Retire the remaining light-theme islands from legacy workflows. */

.template-card.active,
.intake-summary article,
.runbook-item,
.search-box,
.doc-thumb,
.message-meta,
.queue-list .error,
.generation-controls select,
.doc-tags span,
.match-score,
.match-terms span,
.format-check b {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-2);
}

.template-card.active {
  border-color: rgba(105, 139, 255, 0.62);
  background: linear-gradient(145deg, rgba(90, 130, 255, 0.18), rgba(141, 118, 255, 0.07)), var(--surface-2);
  box-shadow: inset 2px 0 0 var(--accent-blue);
}

.search-box {
  box-shadow: none;
}

.search-box input {
  color: var(--text-primary);
  background: transparent;
}

.doc-thumb {
  background-color: #080e18;
}

.doc-tags span,
.match-terms span {
  color: var(--text-secondary);
  background: rgba(90, 130, 255, 0.11);
}

.match-score,
.format-check.pass b,
.message-meta {
  color: var(--status-success);
  background: rgba(66, 205, 164, 0.1);
}

.format-check.warn b {
  color: var(--status-warning);
  background: rgba(241, 199, 91, 0.11);
}

.format-check.fail b,
.queue-list .error {
  color: var(--status-danger);
  background: rgba(239, 113, 134, 0.1);
}

.generation-controls select {
  background-color: var(--surface-2);
}

.generator-layout {
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
}

#generatedOutput {
  min-height: clamp(220px, 32vh, 340px);
  max-height: 44vh;
}

.generation-visual-prompt {
  position: relative;
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid rgba(90, 130, 255, 0.28);
  border-radius: var(--radius-panel);
  background:
    linear-gradient(135deg, rgba(90, 130, 255, 0.1), rgba(141, 118, 255, 0.07) 54%, rgba(78, 214, 203, 0.04)),
    var(--surface-2);
}

.generation-visual-prompt::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue), var(--accent-violet), var(--accent-pink));
}

.generation-visual-prompt[hidden] {
  display: none;
}

.generation-visual-prompt-heading {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.generation-visual-prompt-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--accent-cyan);
  border: 1px solid rgba(78, 214, 203, 0.24);
  border-radius: 10px;
  background: rgba(78, 214, 203, 0.09);
}

.generation-visual-prompt-icon .lucide {
  width: 18px;
  height: 18px;
}

.generation-visual-prompt-heading h3,
.generation-visual-prompt-heading p {
  margin: 0;
}

.generation-visual-prompt-heading h3 {
  font-size: 15px;
}

.generation-visual-prompt-heading p {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.generation-visual-prompt-field {
  display: grid;
  gap: 6px;
}

.generation-visual-prompt-field > span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.generation-visual-prompt-field textarea {
  min-height: 118px;
  max-height: 220px;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
  background: rgba(5, 10, 18, 0.7);
  line-height: 1.65;
}

.generation-visual-prompt-field textarea:focus {
  color: var(--text-primary);
  border-color: rgba(90, 130, 255, 0.58);
}

.generation-visual-prompt-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.generation-visual-prompt-actions small {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-right: auto;
  color: var(--text-muted);
  line-height: 1.45;
}

.generation-visual-prompt-actions small .lucide,
.generation-visual-prompt-actions .primary-button .lucide {
  width: 15px;
  height: 15px;
}

.generation-visual-prompt-actions .primary-button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  min-height: 38px;
}

@media (max-width: 720px) {
  .generation-visual-prompt-heading {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .generation-visual-prompt-heading .pill {
    grid-column: 2;
    justify-self: start;
  }

  .generation-visual-prompt-actions {
    flex-wrap: wrap;
  }

  .generation-visual-prompt-actions small {
    flex-basis: 100%;
  }
}

/* Image studio: align to the shared shell instead of a fixed 1280px island. */

body.image-studio-active.image-studio-home .workspace,
body.image-studio-active.image-studio-home .image-studio-view.active {
  width: 100%;
  max-width: none;
}

.image-start-screen {
  min-height: 100dvh;
  padding: 18px var(--content-gutter) 28px;
}

.image-start-header,
.image-start-layout {
  width: 100%;
  max-width: none;
}

.image-start-header {
  margin-bottom: 12px;
}

.image-start-layout {
  display: block;
}

.image-start-quick-panel {
  margin-bottom: var(--section-gap);
}

.image-start-quick-panel {
  padding: 13px;
}

.image-start-grid {
  gap: var(--section-gap);
}

.image-start-visual {
  height: clamp(154px, 9.2vw, 176px);
}

.image-start-copy {
  padding: 11px 12px 12px;
}

/* Brand library: denser albums/toolbars and more gallery columns on wide screens. */

#brand-assets.view.active {
  gap: 10px;
}

.brand-asset-command,
.brand-asset-status-tabs,
.brand-asset-album-panel,
.brand-asset-filters,
.brand-asset-ai-toolbar,
.brand-asset-review-toolbar,
.brand-asset-management-toolbar {
  margin: 0;
}

.brand-asset-album-panel {
  padding: 14px;
}

.brand-asset-album-heading {
  margin-bottom: 10px;
}

.brand-asset-albums {
  grid-auto-columns: 132px;
  gap: 9px;
  padding-bottom: 4px;
}

.brand-asset-management-album,
.brand-asset-album {
  width: 132px;
}

.brand-asset-album {
  grid-template-rows: 72px auto auto;
  gap: 5px;
  padding-bottom: 8px;
}

.brand-asset-album-cover {
  height: 72px;
}

.brand-asset-ai-toolbar,
.brand-asset-review-toolbar,
.brand-asset-management-toolbar {
  min-height: 48px;
  padding: 8px 12px;
}

.brand-asset-filters {
  grid-template-columns: minmax(240px, 1fr) repeat(5, minmax(104px, auto));
  gap: 8px;
  padding: 12px;
}

.brand-asset-filters input,
.brand-asset-filters select,
.brand-asset-album-search input {
  min-height: 36px;
}

.brand-asset-layout {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 12px;
}

.brand-asset-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.brand-asset-card {
  gap: 5px;
  padding-bottom: 10px;
}

.brand-asset-card-shell {
  display: flex;
  flex-direction: column;
}

.brand-asset-card-shell .brand-asset-card {
  height: auto;
  flex: 1 1 auto;
}

.brand-asset-detail {
  top: 88px;
}

.brand-asset-detail-preview {
  min-height: 150px;
  max-height: 280px;
}

.brand-asset-pagination,
.brand-asset-actions {
  margin-top: 12px;
}

/* Operations pages keep more signal above the fold. */

.ops-check-grid {
  gap: 10px;
}

.ops-check {
  min-height: 118px;
  padding: 12px;
}

.runbook-item {
  grid-template-rows: auto auto minmax(130px, 1fr);
  gap: 9px;
  padding: 12px;
}

.command-snippet {
  min-height: 130px;
}

.roadmap article {
  min-height: 124px;
  padding: 14px;
}

@media (min-width: 1700px) {
  .brand-asset-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .image-start-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .image-start-visual {
    height: clamp(148px, 8.2vw, 170px);
  }

  .image-start-copy > small {
    min-height: 27px;
  }

  .ops-check-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1500px) {
  :root {
    --shell-sidebar: 204px;
    --content-gutter: 18px;
  }

  .global-search {
    display: none;
  }

  .top-actions {
    gap: 7px;
  }
}

@media (max-width: 1280px) {
  .brand-asset-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .brand-asset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #currentUserBadge {
    display: none;
  }
}

@media (max-width: 1180px) {
  .generator-layout {
    grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  }

  .image-start-layout {
    grid-template-columns: 1fr;
  }

  .image-start-grid,
  .image-start-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) and (min-width: 781px) {
  :root {
    --shell-sidebar: 76px;
    --content-gutter: 16px;
  }

  .sidebar {
    gap: 18px;
    padding: 16px 10px;
  }

  .sidebar > .brand,
  .sidebar-footer {
    justify-content: center;
    padding-inline: 8px;
  }

  .sidebar > .brand > div,
  .sidebar-footer > div,
  .nav-item > span:last-child {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding-inline: 0;
  }

  .nav-icon {
    width: 32px;
    height: 32px;
  }

  .generator-layout,
  #ask .ask-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .image-start-grid,
  .image-start-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  :root {
    --content-gutter: 12px;
  }

  .app-shell,
  body.image-studio-active .app-shell {
    display: block;
  }

  .nav-list,
  body.image-studio-active .nav-list {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-item,
  body.image-studio-active .nav-item {
    flex: 0 0 56px;
  }

  .workspace,
  body.compact .workspace,
  body.image-studio-active .workspace {
    padding: 12px 12px 22px;
  }

  .topbar {
    margin: -12px -12px 12px;
  }

  .brand-asset-layout,
  .generator-layout,
  #ask .ask-layout {
    grid-template-columns: 1fr;
  }

  .brand-asset-filters,
  .brand-asset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .brand-asset-detail {
    position: static;
  }

  .image-start-layout,
  .image-start-grid,
  .image-start-rail {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 820px) and (min-width: 781px) {
  :root {
    --content-gutter: 14px;
    --section-gap: 10px;
    --panel-padding: 12px;
  }

  .sidebar {
    gap: 14px;
    padding-block: 14px;
  }

  .nav-list {
    gap: 3px;
  }

  .nav-item {
    min-height: 40px;
  }

  .topbar {
    min-height: 66px;
    padding-block: 9px;
  }

  .topbar h1 {
    font-size: 23px;
  }

  .eyebrow {
    margin-bottom: 2px;
    font-size: 11px;
  }

  .aurora-kpi {
    min-height: 88px;
    padding: 11px;
  }

  .aurora-kpi strong {
    font-size: 28px;
  }

  .chart-canvas {
    min-height: 180px;
  }

  .dashboard-activity-panel {
    grid-template-rows: auto minmax(180px, 1fr) auto;
  }

  .dashboard-activity-panel .chart-canvas {
    min-height: 180px;
  }

  .compact-chart {
    min-height: 160px;
  }

  .image-start-screen {
    padding-top: 14px;
  }

  .image-start-header {
    margin-bottom: 9px;
  }

  .image-start-header h1 {
    font-size: 23px;
  }

  .image-start-steps {
    padding: 11px 16px;
  }

  .image-start-quick-panel,
  .image-start-side-card {
    padding: 11px;
  }

  .image-start-quick-panel {
    gap: 9px;
  }

  .image-start-visual {
    height: 132px;
  }

  .image-start-copy {
    gap: 4px;
    padding: 9px 10px 10px;
  }

  .image-start-copy > small {
    min-height: 0;
  }

  .image-start-recent-list article {
    padding-block: 6px;
  }

  .brand-asset-album-panel {
    padding: 12px;
  }

  .brand-asset-ai-toolbar,
  .brand-asset-review-toolbar,
  .brand-asset-management-toolbar {
    min-height: 42px;
    padding-block: 6px;
  }

  .ops-check {
    min-height: 104px;
  }

  #generatedOutput {
    min-height: 220px;
    max-height: 38vh;
  }
}

/* Backend workspace: keep quality, review and account operations inside one
   viewport instead of stacking three long operational surfaces. */

.review-workspace-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: rgba(7, 13, 22, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.review-workspace-tab {
  min-width: 0;
  min-height: 50px;
  display: grid;
  grid-template-columns: 30px auto minmax(0, 1fr);
  grid-template-rows: repeat(2, auto);
  align-content: center;
  align-items: center;
  column-gap: 9px;
  padding: 7px 12px;
  color: var(--text-secondary);
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.review-workspace-tab .lucide {
  width: 18px;
  height: 18px;
  grid-row: 1 / 3;
  place-self: center;
  color: var(--text-muted);
}

.review-workspace-tab span {
  align-self: end;
  color: inherit;
  font-size: 13px;
  font-weight: 800;
}

.review-workspace-tab small {
  grid-column: 2 / 4;
  align-self: start;
  color: var(--text-tertiary);
  font-size: 10px;
}

.review-workspace-tab:hover {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: var(--surface-hover);
}

.review-workspace-tab.active {
  color: var(--text-primary);
  border-color: rgba(105, 139, 255, 0.52);
  background: linear-gradient(135deg, rgba(70, 119, 255, 0.18), rgba(154, 92, 255, 0.08)), var(--surface-2);
  box-shadow: inset 2px 0 0 var(--accent-blue), 0 8px 24px rgba(33, 58, 118, 0.12);
}

.review-workspace-tab.active .lucide {
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 8px rgba(75, 216, 214, 0.36));
}

.review-workspace-tab:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.review-workspace-panel[hidden] {
  display: none !important;
}

.review-admin-layout {
  display: contents;
}

.acceptance-overview {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(300px, 0.62fr) minmax(0, 1.38fr);
  gap: 10px;
}

.acceptance-overview .acceptance-summary,
.acceptance-overview .acceptance-quality-grid article {
  min-height: 72px;
}

.acceptance-overview .acceptance-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  align-content: center;
  padding: 10px 12px;
}

.acceptance-overview .acceptance-summary strong {
  white-space: nowrap;
}

.acceptance-overview .acceptance-summary span {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.acceptance-overview .acceptance-quality-grid article {
  padding: 9px 10px;
}

.acceptance-overview .acceptance-quality-grid strong {
  font-size: 20px;
  line-height: 1;
}

.acceptance-workspace-grid {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 0.72fr) minmax(0, 1.28fr);
  gap: 10px;
}

.acceptance-history-block,
.acceptance-detail-pane {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: rgba(7, 13, 22, 0.48);
}

.acceptance-history,
.acceptance-detail-scroll {
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.acceptance-history {
  gap: 4px;
  align-content: start;
  grid-auto-rows: max-content;
  padding-right: 3px;
}

.acceptance-detail-scroll {
  display: grid;
  align-content: start;
  gap: 8px;
  padding-right: 4px;
}

.acceptance-history-item {
  position: relative;
  min-height: 48px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 5px 9px;
  padding: 8px 9px;
}

.acceptance-history-metrics {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.acceptance-history-item > .pill {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}

details.acceptance-item {
  display: block;
  padding: 0;
  border-left-width: 3px;
  overflow: clip;
}

.acceptance-detail-scroll .acceptance-list {
  gap: 5px;
}

.acceptance-item summary {
  min-width: 0;
  min-height: 40px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  list-style: none;
  cursor: pointer;
}

.acceptance-item summary::-webkit-details-marker {
  display: none;
}

.acceptance-item summary::before {
  content: "›";
  width: 16px;
  color: var(--text-tertiary);
  font-size: 19px;
  line-height: 1;
  transition: transform 160ms ease;
}

.acceptance-item[open] summary::before {
  transform: rotate(90deg);
}

.acceptance-item-heading {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  grid-column: 2;
}

.acceptance-item-heading strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acceptance-item-heading small {
  flex: 0 0 auto;
  color: var(--text-tertiary);
  font-size: 11px;
}

.acceptance-item-summary-badges,
.acceptance-item-checks {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

.acceptance-item-summary-badges {
  grid-column: 3;
  grid-row: 1;
}

.acceptance-item-summary-badges .pill,
.acceptance-item-checks .pill {
  font-size: 10px;
}

.acceptance-item-body {
  display: grid;
  gap: 7px;
  padding: 10px 12px 12px 27px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(4, 9, 16, 0.28);
}

.acceptance-item-body p {
  margin: 0;
  line-height: 1.6;
}

.acceptance-item-checks {
  justify-content: flex-start;
}

@media (min-width: 901px) {
  #review.view.active {
    height: calc(100dvh - 126px);
    min-height: 560px;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  #review > .review-workspace-panel,
  #review > .review-admin-layout > .review-workspace-panel {
    min-height: 0;
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
  }

  #review > .acceptance-panel {
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 10px;
    overflow: hidden;
  }

  #review > .acceptance-panel > .panel-heading {
    margin-bottom: 0;
  }
}

@media (max-height: 820px) and (min-width: 901px) {
  #review.view.active {
    height: calc(100dvh - 108px);
  }

  .review-workspace-tab {
    min-height: 44px;
    padding-block: 5px;
  }

  .acceptance-overview .acceptance-summary,
  .acceptance-overview .acceptance-quality-grid article {
    min-height: 62px;
  }

  .acceptance-history-block,
  .acceptance-detail-pane {
    padding: 9px;
  }
}

@media (max-width: 1180px) and (min-width: 901px) {
  .acceptance-overview {
    grid-template-columns: minmax(250px, 0.5fr) minmax(0, 1.5fr);
  }

  .acceptance-workspace-grid {
    grid-template-columns: minmax(310px, 0.64fr) minmax(0, 1.36fr);
  }
}

@media (max-width: 900px) {
  #review.view.active {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .review-workspace-tabs {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .acceptance-overview,
  .acceptance-workspace-grid {
    grid-template-columns: 1fr;
  }

  .acceptance-overview .acceptance-summary {
    grid-template-columns: 1fr;
  }

  .acceptance-overview .acceptance-summary span {
    text-align: left;
  }

  .acceptance-history {
    max-height: 360px;
  }

  .acceptance-detail-scroll {
    max-height: none;
    overflow: visible;
  }

  .acceptance-item summary {
    grid-template-columns: 16px minmax(0, 1fr);
  }

  .acceptance-item-summary-badges {
    grid-column: 2;
    grid-row: auto;
    justify-content: flex-start;
    padding-left: 24px;
  }

  .review-workspace-panel {
    height: auto;
    overflow: visible;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* AI image studio — canvas-first creation with a conversation rail. */
body.image-studio-active .workspace {
  height: 100dvh;
  padding: 0;
  overflow: hidden;
}

.image-studio-view.active,
.image-editor-screen {
  height: 100%;
  min-height: 0;
}

.image-editor-screen {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
}

.image-studio-toolbar {
  height: 64px;
  min-height: 64px;
  padding: 0 16px;
  border-bottom: 1px solid #26354a;
  background: rgba(7, 14, 25, 0.96);
}

.image-studio-tools {
  gap: 8px;
}

.image-studio-tools select,
.image-toolbar-button {
  height: 36px;
  border-color: #26354a;
  background: #0d1726;
}

.image-canvas-add-button {
  cursor: pointer;
}

.image-studio-shell {
  height: auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  overflow: hidden;
  background: #07101d;
}

.image-artboard-area {
  min-height: 0;
  position: relative;
  inset: auto;
  border-right: 1px solid #26354a;
  background-color: #07101d;
  background-image:
    radial-gradient(circle, rgba(118, 151, 202, 0.18) 1px, transparent 1.2px),
    radial-gradient(circle at 50% 42%, rgba(102, 116, 244, 0.08), transparent 34%);
  background-size: 24px 24px, 100% 100%;
}

.image-artboard-area.is-drop-target {
  box-shadow: inset 0 0 0 2px #42d5bc, inset 0 0 80px rgba(66, 213, 188, 0.08);
}

.image-artboard-heading {
  right: 18px;
}

.image-artboard-heading > strong,
.image-artboard-tools {
  border-color: rgba(55, 72, 99, 0.9);
  background: rgba(13, 23, 38, 0.9);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.image-artboard-heading > strong:hover,
.image-artboard-heading > strong:focus-visible {
  border-color: rgba(111, 121, 255, 0.76);
  background: rgba(17, 29, 48, 0.96);
  box-shadow: 0 0 0 3px rgba(92, 103, 239, 0.14), 0 14px 32px rgba(0, 0, 0, 0.28);
}

.image-project-title-input {
  caret-color: #7c84ff;
}

.image-canvas-hint {
  right: 18px;
  bottom: 18px;
  color: #7f8da5;
  border-color: rgba(55, 72, 99, 0.86);
  background: rgba(13, 23, 38, 0.86);
}

.image-artboard-stage {
  min-height: 0;
  inset: 0;
  padding: 0;
  place-items: center;
}

.image-artwork-cluster {
  width: 1px;
  height: 1px;
  position: relative;
  display: block;
  transform: scale(var(--canvas-zoom, 0.75));
  transform-origin: center;
}

.image-canvas-empty {
  width: 300px;
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px 24px;
  color: #8795ac;
  border: 1px dashed #31425d;
  border-radius: 16px;
  background: rgba(13, 23, 38, 0.7);
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.image-canvas-empty[hidden] {
  display: none;
}

.image-canvas-empty > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #aeb8ff;
  border: 1px solid rgba(102, 116, 244, 0.42);
  border-radius: 50%;
  background: rgba(102, 116, 244, 0.12);
  font-size: 23px;
}

.image-canvas-empty strong {
  color: #e6ebf5;
  font-size: 15px;
}

.image-canvas-empty small {
  font-size: 11px;
}

.image-canvas-nodes {
  position: absolute;
  left: 0;
  top: 0;
}

.image-canvas-node {
  width: 480px;
  position: absolute;
  left: var(--node-x, 0px);
  top: var(--node-y, 0px);
  overflow: hidden;
  border: 1px solid #2a3a51;
  border-radius: 14px;
  background: #0d1726;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34);
  transform: translate(-50%, -50%);
  cursor: move;
  user-select: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.image-canvas-node.selected {
  border-color: #7482ff;
  box-shadow: 0 0 0 3px rgba(102, 116, 244, 0.2), 0 22px 58px rgba(0, 0, 0, 0.42);
}

.image-canvas-node.is-reference {
  border-color: #45d7b7;
  box-shadow: 0 0 0 3px rgba(69, 215, 183, 0.18), 0 22px 58px rgba(0, 0, 0, 0.42);
}

.image-canvas-node.is-dragging {
  transition: none;
}

.image-canvas-node > img {
  width: 100%;
  max-height: 680px;
  display: block;
  object-fit: contain;
  background: #080f1a;
  user-select: none;
  -webkit-user-drag: none;
}

.image-canvas-node-bar {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px 6px 11px;
  color: #9aa8bd;
  font-size: 10px;
}

.image-canvas-node-actions {
  display: flex;
  gap: 5px;
}

.image-canvas-node-actions button {
  min-height: 25px;
  padding: 0 8px;
  color: #aeb8c9;
  border: 1px solid #30415a;
  border-radius: 7px;
  background: #111d2e;
  font-size: 9px;
  cursor: pointer;
}

.image-canvas-node-actions button:hover {
  color: #ffffff;
  border-color: #6674f4;
}

.image-canvas-node.is-reference .image-node-reference-button {
  color: #75efd3;
  border-color: rgba(69, 215, 183, 0.5);
  background: rgba(23, 119, 100, 0.18);
}

.image-progress {
  inset: 0;
  padding: 24px;
}

.image-chat-panel {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #0d1726;
}

.image-chat-header {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid #26354a;
}

.image-chat-header > div {
  display: grid;
  gap: 2px;
}

.image-chat-header span {
  color: #42d5bc;
  font-size: 9px;
  letter-spacing: 0.13em;
}

.image-chat-header h2 {
  margin: 0;
  color: #f3f6fb;
  font-size: 16px;
}

.image-chat-header .image-provider-note {
  max-width: 160px;
  color: #7f8da5;
  letter-spacing: 0;
  text-align: right;
}

.image-chat-messages {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  overflow: auto;
  overscroll-behavior: contain;
}

.image-chat-message {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
}

.image-chat-message.user {
  padding: 11px;
  border: 1px solid rgba(102, 116, 244, 0.25);
  border-radius: 12px;
  background: rgba(102, 116, 244, 0.09);
}

.image-chat-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #c9d0ff;
  border: 1px solid rgba(102, 116, 244, 0.3);
  border-radius: 9px;
  background: rgba(102, 116, 244, 0.12);
  font-size: 11px;
}

.image-chat-message > div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.image-chat-message strong {
  color: #e8edf6;
  font-size: 12px;
}

.image-chat-message p {
  margin: 0;
  color: #8c9ab0;
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.image-chat-message.success .image-chat-avatar {
  color: #42d5bc;
  border-color: rgba(66, 213, 188, 0.35);
  background: rgba(66, 213, 188, 0.1);
}

.image-chat-message.warning .image-chat-avatar {
  color: #ffab74;
  border-color: rgba(255, 129, 87, 0.35);
  background: rgba(255, 129, 87, 0.1);
}

.image-chat-message-preview {
  width: 76px;
  height: 76px;
  margin-top: 4px;
  border: 1px solid #2a3a51;
  border-radius: 9px;
  object-fit: cover;
}

.image-chat-composer {
  position: relative;
  display: grid;
  gap: 9px;
  margin: 0 12px 12px;
  padding: 10px;
  border: 1px solid #2c3b52;
  border-radius: 15px;
  background: #101c2d;
  box-shadow: 0 -14px 38px rgba(5, 10, 18, 0.24);
  transition: border-color 180ms ease, box-shadow 180ms ease, inset 180ms ease;
}

.image-chat-composer:focus-within {
  border-color: rgba(102, 116, 244, 0.72);
  box-shadow: 0 0 0 3px rgba(102, 116, 244, 0.11), 0 -14px 38px rgba(5, 10, 18, 0.24);
}

.image-prompt-field {
  min-height: 0;
  position: relative;
  display: flex;
}

.image-chat-composer textarea {
  width: 100%;
  min-height: 104px;
  max-height: 220px;
  resize: none;
  padding: 2px 36px 2px 2px;
  color: #f1f4fa;
  border: 0;
  outline: 0;
  background: transparent;
  line-height: 1.6;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(132, 150, 178, 0.36) transparent;
}

.image-chat-composer textarea::-webkit-scrollbar {
  width: 6px;
}

.image-chat-composer textarea::-webkit-scrollbar-track {
  background: transparent;
}

.image-chat-composer textarea::-webkit-scrollbar-thumb {
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(132, 150, 178, 0.34);
  background-clip: padding-box;
}

.image-chat-composer textarea::-webkit-scrollbar-thumb:hover {
  background: rgba(151, 168, 198, 0.56);
  background-clip: padding-box;
}

.image-chat-composer textarea::placeholder {
  color: #65738a;
}

.image-prompt-expand {
  width: 28px;
  height: 28px;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 0;
  color: #7f8da5;
  border: 1px solid rgba(77, 95, 124, 0.68);
  border-radius: 8px;
  background: rgba(13, 23, 38, 0.9);
  box-shadow: 0 6px 18px rgba(4, 9, 16, 0.22);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.image-prompt-expand:hover,
.image-prompt-expand:focus-visible {
  color: #f1f4fa;
  border-color: rgba(116, 130, 255, 0.74);
  background: rgba(32, 42, 73, 0.96);
  outline: 0;
}

.image-prompt-expand svg {
  width: 15px;
  height: 15px;
  transition: transform 180ms ease;
}

.image-chat-composer.is-expanded {
  position: absolute;
  inset: 78px 12px 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 14px;
  border-color: rgba(102, 116, 244, 0.76);
  background: linear-gradient(155deg, rgba(16, 28, 45, 0.99), rgba(11, 20, 34, 0.99));
  box-shadow: 0 0 0 1px rgba(102, 116, 244, 0.08), 0 24px 60px rgba(3, 8, 15, 0.58);
}

.image-chat-composer.is-expanded .image-prompt-field {
  flex: 1 1 auto;
}

.image-chat-composer.is-expanded .image-prompt-field textarea {
  height: 100% !important;
  min-height: 220px;
  max-height: none;
  padding-top: 4px;
  font-size: 13px;
  line-height: 1.75;
}

.image-chat-composer.is-expanded .image-prompt-expand svg {
  transform: rotate(180deg);
}

.image-reference-chip {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 9px;
  padding: 7px;
  border: 1px solid rgba(66, 213, 188, 0.24);
  border-radius: 10px;
  background: rgba(66, 213, 188, 0.07);
}

.image-reference-chip[hidden] {
  display: none;
}

.image-reference-chip img {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  object-fit: cover;
}

.image-reference-chip > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.image-reference-chip strong,
.image-reference-chip small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-reference-chip strong {
  color: #e4ebf5;
  font-size: 10px;
}

.image-reference-chip small {
  color: #42d5bc;
  font-size: 9px;
}

.image-reference-chip button {
  width: 26px;
  height: 26px;
  color: #8e9bb0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}

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

.image-chat-actions > small {
  flex: 1;
  color: #65738a;
  font-size: 8px;
  text-align: right;
}

.image-chat-attach {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  color: #aab5c7;
  border: 1px solid #31415a;
  border-radius: 9px;
  background: #0d1726;
  font-size: 10px;
  cursor: pointer;
}

.image-chat-actions .primary-button {
  min-width: 76px;
  min-height: 34px;
}

@media (max-width: 1040px) {
  .image-studio-shell {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

  .image-studio-tools label > span,
  .image-toolbar-button > span {
    display: none;
  }
}

@media (max-width: 780px) {
  body.image-studio-active .workspace {
    height: auto;
    min-height: 100dvh;
  }

  .image-editor-screen {
    min-height: 100dvh;
  }

  .image-studio-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(430px, 58dvh) minmax(360px, 42dvh);
    overflow: visible;
  }

  .image-artboard-area {
    border-right: 0;
    border-bottom: 1px solid #26354a;
  }

  .image-chat-panel {
    min-height: 360px;
  }

  .image-chat-composer.is-expanded {
    inset: 76px 10px 10px;
  }

  .image-canvas-node {
    width: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .image-canvas-node,
  .image-chat-composer,
  .image-artwork-cluster {
    transition: none !important;
  }
}

/* EO personalized workbench header: greeting, navigation context and account
   identity share one compact rhythm instead of floating as unrelated tags. */

.topbar {
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(260px, 360px) auto;
  align-items: center;
  gap: clamp(16px, 1.35vw, 26px);
  position: sticky;
  isolation: isolate;
  overflow: hidden;
}

.topbar::after {
  content: "";
  width: 210px;
  height: 1px;
  position: absolute;
  left: var(--content-gutter);
  bottom: -1px;
  background: linear-gradient(90deg, #42d5bc 0%, #6674f4 54%, rgba(190, 104, 222, 0) 100%);
  box-shadow: 0 0 14px rgba(102, 116, 244, 0.48);
  pointer-events: none;
}

.topbar-identity {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.topbar-greeting-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: #7f8da5;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.topbar-greeting-line strong {
  color: #aeb9ca;
  font-size: 11px;
  font-weight: 650;
}

.topbar-greeting-mark {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #42d5bc;
  box-shadow: 0 0 0 4px rgba(66, 213, 188, 0.09), 0 0 12px rgba(66, 213, 188, 0.48);
}

.topbar-title-line {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.topbar .topbar-title-line h1 {
  min-width: 0;
  margin: 0;
  color: #f1f4fa;
  font-size: clamp(21px, 1.45vw, 25px);
  line-height: 1.14;
  letter-spacing: -0.035em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-context {
  flex: 0 0 auto;
  color: #64738a;
  font-size: 9px;
  letter-spacing: 0.04em;
}

.topbar > .global-search {
  width: 100%;
  max-width: 360px;
  justify-self: center;
  margin: 0;
  border-color: rgba(54, 72, 101, 0.82);
  background: rgba(13, 23, 38, 0.78);
}

.topbar .top-actions {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 7px;
}

.topbar .top-actions > button,
.top-user-badge {
  min-height: 38px;
}

.top-user-badge {
  min-width: 132px;
  max-width: 184px;
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 6px;
  border: 1px solid rgba(69, 86, 113, 0.68);
  border-radius: 10px;
  background: rgba(18, 29, 47, 0.82);
}

.top-user-avatar {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  color: #dce3ff;
  border: 1px solid rgba(102, 116, 244, 0.44);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(102, 116, 244, 0.3), rgba(190, 104, 222, 0.15));
  font-size: 11px;
  font-weight: 700;
}

.top-user-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.top-user-copy strong,
.top-user-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-user-copy strong {
  color: #e7ebf4;
  font-size: 10px;
  font-weight: 650;
}

.top-user-copy small {
  color: #7e8da5;
  font-size: 8px;
}

.top-user-badge[data-role="admin"] .top-user-avatar {
  color: #e5dcff;
  border-color: rgba(159, 121, 255, 0.5);
  background: linear-gradient(145deg, rgba(102, 116, 244, 0.34), rgba(190, 104, 222, 0.24));
}

.top-user-badge[data-role="editor"] .top-user-avatar {
  color: #bff8ee;
  border-color: rgba(66, 213, 188, 0.44);
  background: rgba(66, 213, 188, 0.14);
}

.top-user-badge[data-role="reviewer"] .top-user-avatar {
  color: #d5f7d8;
  border-color: rgba(88, 210, 132, 0.44);
  background: rgba(88, 210, 132, 0.13);
}

.top-user-badge[data-role="viewer"] .top-user-avatar {
  color: #d6dfed;
  border-color: rgba(132, 150, 178, 0.38);
  background: rgba(132, 150, 178, 0.12);
}

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

  .topbar > .global-search {
    display: none;
  }
}

@media (max-width: 1280px) {
  .topbar-context,
  #currentUserBadge {
    display: none;
  }
}

@media (max-width: 940px) {
  .topbar-greeting-line > span:last-child,
  #backendStatus > span,
  #logoutBtn > span,
  .top-actions [data-view-shortcut="ask"] > span {
    display: none;
  }

  .topbar .top-actions > button {
    width: 38px;
    min-width: 38px;
    padding-inline: 0;
    justify-content: center;
  }
}

@media (max-width: 780px) {
  .topbar {
    min-height: 66px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding-block: 9px;
  }

  .topbar-title-line {
    gap: 0;
  }

  .topbar .topbar-title-line h1 {
    font-size: 19px;
  }

  .topbar-greeting-line {
    font-size: 9px;
  }

  .topbar::after {
    width: 130px;
  }
}
