:root {
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --bg: #f4efe6;
  --bg-soft: #fbf8f2;
  --bg-strong: #ebe2d2;
  --panel: rgba(255, 251, 245, 0.82);
  --panel-strong: rgba(255, 250, 242, 0.94);
  --panel-border: rgba(113, 93, 65, 0.14);
  --text: #1f2430;
  --muted: #6e727c;
  --accent: #cb6b3e;
  --accent-strong: #954020;
  --accent-soft: rgba(203, 107, 62, 0.12);
  --shadow: 0 24px 70px rgba(49, 37, 17, 0.14);
  --shadow-strong: 0 18px 38px rgba(32, 27, 18, 0.16);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --max-width: 1360px;
  --line: 1px solid var(--panel-border);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #0f1724;
    --bg-soft: #141e2d;
    --bg-strong: #0a1220;
    --panel: rgba(16, 24, 38, 0.82);
    --panel-strong: rgba(18, 26, 40, 0.94);
    --panel-border: rgba(161, 179, 207, 0.14);
    --text: #edf2fb;
    --muted: #c4cede;
    --accent: #ff9158;
    --accent-strong: #ffba8c;
    --accent-soft: rgba(255, 145, 88, 0.12);
    --shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
    --shadow-strong: 0 20px 44px rgba(0, 0, 0, 0.35);
  }
}

html[data-theme="dark"] {
  --bg: #0f1724;
  --bg-soft: #141e2d;
  --bg-strong: #0a1220;
  --panel: rgba(16, 24, 38, 0.82);
  --panel-strong: rgba(18, 26, 40, 0.94);
  --panel-border: rgba(161, 179, 207, 0.14);
  --text: #edf2fb;
  --muted: #c4cede;
  --accent: #ff9158;
  --accent-strong: #ffba8c;
  --accent-soft: rgba(255, 145, 88, 0.12);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
  --shadow-strong: 0 20px 44px rgba(0, 0, 0, 0.35);
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"],
html[data-theme="auto"] {
  color-scheme: light dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 175, 117, 0.14), transparent 28%),
    radial-gradient(circle at 100% 10%, rgba(88, 146, 255, 0.1), transparent 24%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.02));
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] body::before {
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.18));
  }
}

html[data-theme="dark"] body::before {
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.18));
}

.site-aura,
.site-grid {
  position: fixed;
  pointer-events: none;
  inset: auto;
  z-index: 0;
}

.site-aura-one {
  top: -120px;
  right: -80px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 148, 101, 0.22), transparent 68%);
  filter: blur(10px);
  animation: drift 18s ease-in-out infinite;
}

.site-aura-two {
  left: -140px;
  bottom: 8%;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(101, 154, 255, 0.18), transparent 66%);
  filter: blur(12px);
  animation: drift 22s ease-in-out infinite reverse;
}

.site-grid {
  inset: 0;
  background-image:
    linear-gradient(rgba(120, 120, 120, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 120, 120, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.34), transparent 80%);
}

@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(0, 24px, 0) scale(1.06); }
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
textarea,
select {
  width: 100%;
  border: var(--line);
  border-radius: var(--radius-sm);
  padding: 0.98rem 1rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.56);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease, transform 180ms ease;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] input,
  html[data-theme="auto"] textarea,
  html[data-theme="auto"] select {
    background: rgba(9, 15, 25, 0.58);
  }
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: rgba(9, 15, 25, 0.58);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(203, 107, 62, 0.45);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

textarea {
  resize: vertical;
  min-height: 132px;
}

label {
  display: grid;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.95rem;
}

h1,
h2,
h3,
strong,
summary,
.panel-topline,
.metric-panel strong {
  text-wrap: balance;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4.9rem);
  line-height: 0.95;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.55rem, 2.5vw, 2.35rem);
  line-height: 1.04;
  margin-bottom: 0.8rem;
}

p,
li,
span,
small,
code,
dd,
dt {
  overflow-wrap: anywhere;
}

.eyebrow,
.panel-topline,
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  margin-bottom: 1rem;
  padding: 0.45rem 0.72rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}

.lede,
.section-copy,
.section-note,
.muted,
.history-mini span,
.consult-metrics span {
  color: var(--muted);
  line-height: 1.7;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.content-shell {
  display: grid;
  gap: 1.5rem;
}

.panel {
  border-radius: var(--radius-xl);
}

.panel-shell {
  background: var(--panel);
  border: var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.ad-surface {
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
  padding: 0.95rem 1.1rem;
}

.ad-surface-label {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.15rem;
  margin-bottom: 1.2rem;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  min-width: 0;
}

.brand-copy {
  min-width: 0;
  max-width: 34rem;
}

.brand-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: var(--shadow-strong);
  background: rgba(255, 255, 255, 0.5);
  padding: 0.3rem;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .brand-logo {
    background: rgba(8, 12, 20, 0.92);
    border: 1px solid rgba(196, 206, 222, 0.14);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
    padding: 0.22rem;
    filter: saturate(0.96) brightness(0.96);
  }
}

html[data-theme="dark"] .brand-logo {
  background: rgba(8, 12, 20, 0.92);
  border: 1px solid rgba(196, 206, 222, 0.14);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
  padding: 0.22rem;
  filter: saturate(0.96) brightness(0.96);
}

.brand-title {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.45;
  max-width: 30ch;
  text-wrap: pretty;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-button,
.theme-toggle,
.nav-button,
.primary-button,
.secondary-button,
.nav-pill {
  border: var(--line);
  border-radius: 999px;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.icon-button:hover,
.theme-toggle:hover,
.nav-button:hover,
.primary-button:hover,
.secondary-button:hover,
.nav-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.icon-button {
  display: none;
  width: 48px;
  height: 48px;
  background: var(--panel-strong);
  align-items: center;
  justify-content: center;
  gap: 0.24rem;
}

.icon-button span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.theme-toggle,
.nav-button,
.secondary-button,
.nav-pill {
  padding: 0.82rem 1.08rem;
  background: rgba(255, 255, 255, 0.34);
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .theme-toggle,
  html[data-theme="auto"] .nav-button,
  html[data-theme="auto"] .secondary-button,
  html[data-theme="auto"] .nav-pill,
  html[data-theme="auto"] .icon-button {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(196, 206, 222, 0.16);
  }
}

html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .nav-button,
html[data-theme="dark"] .secondary-button,
html[data-theme="dark"] .nav-pill,
html[data-theme="dark"] .icon-button {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(196, 206, 222, 0.16);
}

html[data-theme="dark"] .secondary-button,
html[data-theme="dark"] .nav-button,
html[data-theme="dark"] .nav-pill,
html[data-theme="dark"] .theme-toggle {
  color: #f3f7ff;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .secondary-button,
  html[data-theme="auto"] .nav-button,
  html[data-theme="auto"] .nav-pill,
  html[data-theme="auto"] .theme-toggle {
    color: #f3f7ff;
  }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.theme-toggle-label {
  color: var(--muted);
}

.theme-toggle-value {
  font-weight: 700;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.95rem 1.3rem;
  background: linear-gradient(135deg, var(--accent), #ffb07a);
  color: #201008;
  border: 0;
  box-shadow: 0 18px 36px rgba(203, 107, 62, 0.26);
  font-weight: 800;
}

.button-wide {
  width: 100%;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
  min-width: 0;
}

.top-nav > a,
.top-nav > span {
  padding: 0.78rem 1rem;
  border-radius: 999px;
}

.top-nav > a.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.user-chip {
  border: var(--line);
  background: rgba(255, 255, 255, 0.36);
  color: var(--muted);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .user-chip {
    background: rgba(255, 255, 255, 0.03);
  }
}

html[data-theme="dark"] .user-chip {
  background: rgba(255, 255, 255, 0.03);
}

.flash-stack {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.flash {
  padding: 0.95rem 1rem;
  border: var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
}

.flash-success { border-color: rgba(53, 170, 111, 0.28); }
.flash-warning { border-color: rgba(212, 144, 46, 0.28); }
.flash-error { border-color: rgba(204, 78, 78, 0.28); }
.flash-info { border-color: rgba(75, 112, 202, 0.24); }

.hero-grid,
.capability-band,
.workspace-hero,
.workspace-grid,
.metric-strip,
.admin-grid,
.history-grid {
  display: grid;
  gap: 1.4rem;
}

.hero-grid-home {
  grid-template-columns: minmax(0, 1.4fr) minmax(330px, 0.85fr);
  align-items: stretch;
}

.hero-stage,
.login-panel,
.capability-card,
.consult-panel,
.workspace-hero-main,
.workspace-hero-side,
.workflow-panel,
.result-panel,
.section-banner,
.metric-panel,
.table-panel,
.empty-state {
  padding: 1.5rem;
}

.hero-stage {
  position: relative;
  overflow: hidden;
}

.hero-stage::after {
  content: "";
  position: absolute;
  inset: auto -10% -25% 40%;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 145, 88, 0.18), transparent 65%);
  pointer-events: none;
}

.hero-actions,
.hero-metrics,
.consult-metrics,
.workspace-summary-pills,
.workspace-links,
.history-stack,
.upload-strip,
.settings-grid,
.hero-inline-grid,
.option-grid,
.preview-grid,
.metric-strip,
.breakdown-list {
  display: grid;
  gap: 1rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.hero-metrics,
.capability-band,
.metric-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card,
.history-mini,
.breakdown-row,
.timeline-item {
  border: var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.26);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .metric-card,
  html[data-theme="auto"] .history-mini,
  html[data-theme="auto"] .breakdown-row,
  html[data-theme="auto"] .timeline-item {
    background: rgba(255, 255, 255, 0.025);
  }
}

html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .history-mini,
html[data-theme="dark"] .breakdown-row,
html[data-theme="dark"] .timeline-item {
  background: rgba(255, 255, 255, 0.025);
}

.metric-card {
  padding: 1rem;
}

.metric-card strong,
.metric-panel strong {
  display: block;
  font-size: 1.25rem;
  margin-bottom: 0.45rem;
}

.capability-card p,
.metric-card span,
.history-mini p,
.history-mini span,
.breakdown-row span,
.metric-panel span {
  color: var(--muted);
}

.stack-form,
.workflow-form,
.question-stack,
.timeline-list {
  display: grid;
  gap: 1rem;
}

.hero-inline-grid,
.settings-grid,
.option-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-grid {
  align-items: start;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.inline-check input {
  width: auto;
}

.compact-check {
  font-size: 0.94rem;
  color: var(--text);
}

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

.upload-card {
  display: grid;
  gap: 0.55rem;
  padding: 1rem;
  border: 1px dashed rgba(203, 107, 62, 0.38);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.16));
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .upload-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  }
}

html[data-theme="dark"] .upload-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.upload-card span {
  font-weight: 700;
  color: var(--text);
}

.upload-card small {
  color: var(--muted);
}

.upload-card-wide {
  width: 100%;
}

.settings-group {
  border: var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .settings-group {
    background: rgba(255, 255, 255, 0.02);
  }
}

html[data-theme="dark"] .settings-group {
  background: rgba(255, 255, 255, 0.02);
}

.settings-group summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.1rem;
  font-weight: 700;
  position: relative;
}

.settings-group summary::-webkit-details-marker,
.question-card summary::-webkit-details-marker {
  display: none;
}

.settings-group summary::after,
.question-card summary::after {
  content: "+";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: var(--muted);
}

.settings-group[open] summary::after,
.question-card[open] summary::after {
  content: "-";
}

.settings-group > div,
.question-body {
  padding: 0 1.1rem 1.1rem;
}

.workspace-hero {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.8fr);
}

.workspace-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.78fr);
  align-items: start;
}

.workspace-main,
.workspace-aside {
  display: grid;
  gap: 1.4rem;
}

.workspace-summary-pills {
  display: flex;
  flex-wrap: wrap;
}

.workspace-summary-pills span,
.nav-pill {
  padding: 0.72rem 0.95rem;
  border: var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .workspace-summary-pills span {
    background: rgba(255, 255, 255, 0.03);
  }
}

html[data-theme="dark"] .workspace-summary-pills span {
  background: rgba(255, 255, 255, 0.03);
}

.workspace-links {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  font-weight: 700;
  width: 100%;
  max-width: 20rem;
}

.nav-pill.is-active {
  background: linear-gradient(135deg, var(--accent), #ffb07a);
  color: #211007;
  border-color: transparent;
}

.auth-divider {
  position: relative;
  text-align: center;
  margin: 0.25rem 0;
}

.auth-divider::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  border-top: var(--line);
}

.auth-divider span {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding: 0 0.75rem;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.86rem;
}

.workflow-panel {
  display: none;
}

.workflow-panel.is-active {
  display: block;
  animation: panelLift 260ms ease;
}

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

.result-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 1.25rem;
  align-items: center;
}

.result-preview img,
.preview-grid img,
.history-thumb {
  width: 100%;
  border-radius: var(--radius-lg);
  border: var(--line);
  box-shadow: var(--shadow-strong);
}

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

.question-card {
  border: var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .question-card {
    background: rgba(255, 255, 255, 0.02);
  }
}

html[data-theme="dark"] .question-card {
  background: rgba(255, 255, 255, 0.02);
}

.question-card summary {
  position: relative;
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.25rem;
  cursor: pointer;
}

.question-card summary small {
  color: var(--muted);
}

.history-stack.compact-stack {
  gap: 0.75rem;
}

.history-mini {
  padding: 0.8rem 0.85rem;
  display: grid;
  gap: 0.65rem;
}

.history-mini p,
.history-mini span {
  font-size: 0.9rem;
  line-height: 1.45;
}

.history-mini strong {
  display: block;
  margin-bottom: 0.2rem;
  line-height: 1.25;
}

.history-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.history-actions small {
  font-size: 0.82rem;
}

.history-empty-state {
  padding: 0.65rem 0.1rem 0.1rem;
}

.vertical-actions {
  align-items: flex-start;
  flex-direction: column;
}

.history-actions a,
.data-table a {
  color: var(--accent-strong);
  font-weight: 700;
}

.section-heading,
.action-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.section-heading.compact {
  margin-bottom: 0.75rem;
}

.section-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.history-panel {
  padding: 1.08rem;
}

.history-panel-kicker {
  margin-bottom: 0.55rem;
}

.history-panel-title {
  margin: 0 0 0.38rem;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.8vw, 1.72rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.history-page-banner {
  padding: 1.15rem 1.2rem;
}

.history-page-title {
  font-size: clamp(1.95rem, 3.4vw, 3rem);
  margin-bottom: 0.55rem;
}

.history-page-copy {
  max-width: 58rem;
}

.history-page-banner .secondary-button {
  align-self: flex-start;
}

.history-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.history-card-full {
  overflow: hidden;
  padding: 0.92rem;
}

.history-card-full.has-thumbnail {
  display: grid;
  grid-template-columns: minmax(230px, 0.9fr) minmax(0, 1.1fr);
  gap: 0.9rem;
  align-items: stretch;
}

.history-card-full:not(.has-thumbnail) .history-card-body {
  padding: 0;
}

.history-card-body {
  padding: 0.05rem 0.1rem 0.1rem 0;
  display: grid;
  gap: 0.68rem;
  align-content: start;
}

.history-card-body h2 {
  font-size: clamp(1.12rem, 1.5vw, 1.5rem);
  line-height: 1;
  margin-bottom: 0.55rem;
}

.history-card-full .section-heading.compact {
  align-items: flex-start;
  gap: 0.75rem;
}

.history-card-full .section-heading.compact > div {
  min-width: 0;
}

.history-card-full .status-pill {
  flex: 0 0 auto;
  white-space: nowrap;
  align-self: flex-start;
  font-size: 0.78rem;
  padding-inline: 0.66rem;
}

.history-thumb {
  aspect-ratio: 4 / 3;
  height: 100%;
  min-height: 186px;
  object-fit: cover;
}

.meta-list {
  display: grid;
  gap: 0.54rem;
  margin: 0.25rem 0 0.2rem;
}

.meta-list > div,
.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.8rem;
}

.meta-list dt,
.breakdown-row span {
  color: var(--muted);
}

.meta-list dd {
  margin: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.82rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  flex: 0 0 auto;
}

.metric-panel {
  display: grid;
  gap: 0.4rem;
}

.metric-panel strong {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
}

.admin-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 1.45rem 1.5rem;
}

.admin-hero-copy {
  display: grid;
  gap: 0.2rem;
  max-width: 52rem;
}

.admin-hero .lede {
  max-width: 44rem;
}

.admin-metric-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-stat-card {
  padding: 1.05rem 1rem;
}

.admin-chart-panel {
  display: grid;
  gap: 1rem;
  padding: 1.2rem;
}

.admin-chart-note {
  display: grid;
  gap: 0.15rem;
  justify-items: end;
  text-align: right;
}

.admin-chart-note strong {
  font-size: 1.65rem;
  line-height: 1;
}

.admin-chart-note span,
.admin-chart-foot,
.admin-collapsible-count {
  color: var(--muted);
}

.admin-chart-stack {
  display: grid;
  gap: 0.9rem;
}

.admin-chart-row {
  display: grid;
  gap: 0.45rem;
}

.admin-chart-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.admin-chart-row-head span {
  font-weight: 700;
}

.admin-chart-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  overflow: hidden;
  border: 1px solid rgba(128, 138, 154, 0.14);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .admin-chart-track {
    background: rgba(255, 255, 255, 0.06);
  }
}

html[data-theme="dark"] .admin-chart-track {
  background: rgba(255, 255, 255, 0.06);
}

.admin-chart-fill {
  height: 100%;
  width: var(--bar-width, 6%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ffb07a);
}

.admin-chart-fill.is-document {
  background: linear-gradient(90deg, #5b7be8, #85a2ff);
}

.admin-chart-fill.is-question {
  background: linear-gradient(90deg, #7a5ce0, #a58cff);
}

.admin-chart-foot {
  margin: 0;
  font-size: 0.9rem;
}

.admin-collapsible {
  overflow: hidden;
  padding: 1rem 1.05rem 0.95rem;
}

.admin-collapsible summary {
  list-style: none;
  cursor: pointer;
}

.admin-collapsible summary::-webkit-details-marker {
  display: none;
}

.admin-collapsible-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.admin-collapsible-summary h2 {
  margin-bottom: 0;
  font-size: clamp(1.2rem, 1.8vw, 1.65rem);
}

.admin-collapsible-summary::after {
  content: "+";
  margin-left: auto;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
}

.admin-collapsible[open] .admin-collapsible-summary::after {
  content: "-";
}

.admin-collapsible-body {
  padding-top: 0.95rem;
}

.admin-collapsible-count {
  font-weight: 700;
  white-space: nowrap;
}

.admin-minimal-table {
  min-width: 0;
}

.admin-empty-cell {
  padding: 1rem 0.2rem 0.4rem;
  color: var(--muted);
}

.admin-activity-list {
  gap: 0.8rem;
}

.admin-activity-item {
  padding: 0.95rem 1rem;
}

.admin-activity-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.admin-activity-head p,
.admin-activity-summary {
  margin: 0;
}

.admin-activity-head strong {
  font-size: 1rem;
}

.admin-activity-summary {
  color: var(--muted);
  line-height: 1.6;
}

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

.admin-span-two {
  grid-column: 1 / -1;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.95rem 0.8rem;
  border-bottom: var(--line);
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.data-table td small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
}

.timeline-list {
  gap: 0.9rem;
}

.timeline-item {
  padding: 1rem;
  display: grid;
  gap: 0.7rem;
}

.timeline-item p,
.timeline-item code {
  margin: 0;
}

.timeline-item code {
  display: block;
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.42);
  color: var(--muted);
  white-space: pre-wrap;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .timeline-item code {
    background: rgba(255, 255, 255, 0.04);
  }
}

html[data-theme="dark"] .timeline-item code {
  background: rgba(255, 255, 255, 0.04);
}

.site-footer {
  margin-top: 0.6rem;
  padding: 1.1rem 0 0.6rem;
  border-top: var(--line);
  color: var(--muted);
  display: grid;
  gap: 0.8rem;
}

.site-footer-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
}

.footer-note {
  margin: 0;
  max-width: 56rem;
}

.powered-by-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  width: 100%;
}

.powered-by-label {
  font-size: 0.95rem;
  color: var(--muted);
}

.powered-by-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.58rem 0.9rem;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid rgba(203, 107, 62, 0.22);
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  width: 100%;
}

.site-footer-links a {
  text-decoration: none;
}

.site-footer-links a:hover {
  color: var(--text);
}

.footer-centered-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: 100%;
}

.footer-link-button,
.footer-link-anchor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 0.98rem;
  border: var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.28);
  font-weight: 700;
  text-decoration: none;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .footer-link-button,
  html[data-theme="auto"] .footer-link-anchor {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(196, 206, 222, 0.16);
  }
}

html[data-theme="dark"] .footer-link-button,
html[data-theme="dark"] .footer-link-anchor {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(196, 206, 222, 0.16);
}

.footer-link-button:hover,
.footer-link-anchor:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.legal-panel {
  padding: 1.6rem;
}

.legal-panel h2 {
  margin-top: 1.5rem;
  margin-bottom: 0.45rem;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
}

.legal-panel p {
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.legal-panel a {
  color: var(--accent-strong);
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 420ms ease, transform 420ms ease;
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.history-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  margin-top: 1rem;
  padding: 0.95rem 1rem;
}

.history-pagination-copy {
  display: grid;
  gap: 0.2rem;
  color: var(--muted);
}

.history-pagination-copy strong {
  color: var(--text);
}

.history-pagination-links {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.history-pagination-current {
  color: var(--muted);
  font-size: 0.95rem;
}

.preview-open-button {
  width: 100%;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.preview-open-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-strong);
}

.preview-open-button img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: var(--line);
}

.preview-grid-compact {
  gap: 0.55rem;
}

.preview-grid-compact img {
  aspect-ratio: 1 / 1.08;
  object-fit: cover;
}

.export-preview-card {
  display: grid;
  gap: 0.85rem;
  padding: 1.08rem;
}

.site-dialog {
  width: min(960px, calc(100vw - 1.25rem));
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.site-dialog::backdrop {
  background: rgba(8, 12, 20, 0.58);
  backdrop-filter: blur(8px);
}

.site-dialog-card {
  background: var(--panel-strong);
  border: var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-strong);
  padding: 1.2rem;
}

.site-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.95rem;
}

.site-dialog-head h2 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 2.3vw, 2.1rem);
}

.site-dialog-body {
  display: grid;
  gap: 0.95rem;
}

.site-dialog-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.site-dialog-body a {
  color: var(--accent-strong);
}

.site-dialog-wide {
  width: min(1120px, calc(100vw - 1.25rem));
}

.dialog-close-button {
  border: var(--line);
  border-radius: 999px;
  padding: 0.72rem 1rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.28);
  font-weight: 700;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .dialog-close-button {
    background: rgba(255, 255, 255, 0.06);
  }
}

html[data-theme="dark"] .dialog-close-button {
  background: rgba(255, 255, 255, 0.06);
}

.dialog-preview-image {
  width: 100%;
  max-height: min(74vh, 780px);
  object-fit: contain;
  border-radius: var(--radius-lg);
  border: var(--line);
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 1100px) {
  .site-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .top-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 1180px) {
  .hero-grid-home,
  .workspace-hero,
  .workspace-grid,
  .result-panel,
  .admin-grid,
  .admin-metric-strip,
  .history-grid {
    grid-template-columns: 1fr;
  }

  .hero-metrics,
  .capability-band,
  .metric-strip,
  .preview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 840px) {
  .site-header {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .icon-button {
    display: inline-flex;
  }

  .top-nav {
    grid-column: 1 / -1;
    display: none;
    justify-content: flex-start;
    padding-top: 0.4rem;
  }

  .top-nav.is-open {
    display: flex;
  }

  .hero-inline-grid,
  .settings-grid,
  .upload-strip,
  .option-grid {
    grid-template-columns: 1fr;
  }

  .history-card-full {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-collapsible-summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .history-thumb {
    min-height: 180px;
  }

  .section-banner,
  .section-heading,
  .action-row,
  .hero-actions,
  .workspace-links,
  .history-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .theme-toggle-label {
    display: none;
  }

  .site-footer-main {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(var(--max-width), calc(100% - 1rem));
    padding-top: 0.5rem;
  }

  .site-header,
  .hero-stage,
  .login-panel,
  .capability-card,
  .consult-panel,
  .workspace-hero-main,
  .workspace-hero-side,
  .workflow-panel,
  .result-panel,
  .section-banner,
  .metric-panel,
  .table-panel,
  .empty-state {
    padding: 1.1rem;
  }

  .history-panel,
  .history-page-banner,
  .history-pagination {
    padding: 1rem;
  }

  h1 {
    font-size: 2.25rem;
  }

  .brand-title {
    font-size: 0.9rem;
  }

  .brand-logo {
    width: 52px;
    height: 52px;
  }

  .history-card-body h2 {
    font-size: clamp(1.15rem, 5vw, 1.55rem);
  }
}
