/* ─────────────────────────────────────────
   Design Tokens
   ───────────────────────────────────────── */
:root {
  --bg:            #f4efe6;
  --surface:       #ffffff;
  --surface-alt:   #faf7f1;
  --ink:           #1a1c18;
  --muted:         #5c6354;
  --line:          #e0d8ca;
  --accent:        #c0522a;
  --accent-hover:  #9e3f1e;
  --accent-light:  #fdf0eb;
  --accent-text:   #7a2f0f;

  --success:       #166534;
  --success-bg:    #f0fdf4;
  --success-border:#bbf7d0;
  --error:         #991b1b;
  --error-bg:      #fef2f2;
  --error-border:  #fecaca;
  --warning:       #92400e;
  --warning-bg:    #fffbeb;
  --warning-border:#fde68a;
  --info:          #1e40af;
  --info-bg:       #eff6ff;
  --info-border:   #bfdbfe;
  --neutral:       #374151;
  --neutral-bg:    #f9fafb;
  --neutral-border:#d1d5db;

  --shadow-xs: 0 1px 3px rgba(60,40,20,.07);
  --shadow-sm: 0 2px 8px  rgba(60,40,20,.08);
  --shadow:    0 4px 20px rgba(60,40,20,.09);
  --shadow-lg: 0 8px 40px rgba(60,40,20,.11);

  --r-sm:  8px;
  --r:     14px;
  --r-lg:  22px;
  --r-xl:  28px;
  --r-full:9999px;

  --t: .18s ease;
}

/* ─────────────────────────────────────────
   Reset & Base
   ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

a { color: var(--accent-text); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--accent); text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.15;
  margin-top: 0;
}

p { margin-top: 0; }

code {
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: .875em;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: .15em .45em;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #1e1b16;
  color: #e8dfc8;
  border-radius: var(--r);
  padding: 1.25rem 1.5rem;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: .85rem;
  line-height: 1.65;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* ─────────────────────────────────────────
   Page enter animation
   ───────────────────────────────────────── */
@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

main {
  animation: page-in .22s cubic-bezier(.4,0,.2,1) both;
}

/* ─────────────────────────────────────────
   Layout wrapper
   ───────────────────────────────────────── */
.site-header, .site-footer, main {
  width: min(1140px, calc(100% - 2.5rem));
  margin-inline: auto;
}

/* ─────────────────────────────────────────
   Header
   ───────────────────────────────────────── */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
}

.brand-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: 0;
  flex-shrink: 0;
}

.site-header nav {
  display: flex;
  gap: .15rem;
  flex-wrap: wrap;
}

.site-header nav a {
  position: relative;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  padding: .4rem .75rem;
  border-radius: var(--r-full);
  transition: background var(--t), color var(--t);
}

.site-header nav a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 50%;
  right: 50%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: left .22s cubic-bezier(.4,0,.2,1), right .22s cubic-bezier(.4,0,.2,1), opacity .22s;
  opacity: 0;
}

.site-header nav a:hover {
  background: var(--accent-light);
  color: var(--accent);
  text-decoration: none;
}

.site-header nav a:hover::after {
  left: 12%;
  right: 12%;
  opacity: .45;
}

.site-header nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

.site-header nav a[aria-current="page"]::after {
  left: 12%;
  right: 12%;
  opacity: 1;
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}

.nav-email {
  font-size: .8rem;
  color: var(--muted);
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Profile dropdown ── */
.profile-menu-wrap {
  position: relative;
}

.profile-avatar-btn {
  display: flex;
  align-items: center;
  gap: .35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: .3rem .6rem .3rem .35rem;
  cursor: pointer;
  transition: background var(--t), border-color var(--t), box-shadow var(--t);
}
.profile-avatar-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.profile-avatar-icon {
  width: 26px;
  height: 26px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + .5rem);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  z-index: 500;
  overflow: hidden;
  animation: dropdown-in .15s cubic-bezier(.4,0,.2,1);
}
.profile-dropdown.open { display: block; }

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

.profile-dropdown-header {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.profile-dropdown-email {
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-dropdown-unverified {
  font-size: .75rem;
  color: var(--warning);
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .6rem 1rem;
  font-size: .875rem;
  color: var(--ink);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background var(--t);
}
.profile-dropdown-item:hover {
  background: var(--surface-alt);
  text-decoration: none;
  color: var(--ink);
}

.profile-dropdown-divider {
  height: 1px;
  background: var(--line);
  margin: .25rem 0;
}

.profile-dropdown-logout {
  color: var(--error);
}
.profile-dropdown-logout:hover {
  background: var(--error-bg);
}

.btn-link {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  padding: .4rem .75rem;
  border-radius: var(--r-full);
  transition: background var(--t), color var(--t);
  text-decoration: none;
  display: inline-block;
}

.btn-link:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.btn-sm {
  font-size: .8rem;
  padding: .35rem .9rem;
}

/* ─────────────────────────────────────────
   Limit Banner
   ───────────────────────────────────────── */
.limit-banner {
  border-radius: var(--r-sm);
  padding: .75rem 1rem;
  font-size: .875rem;
  margin-bottom: 1rem;
}

.limit-banner-warn {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning);
}

.limit-banner-full {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error);
}

.limit-banner a { color: inherit; font-weight: 600; text-decoration: underline; }

/* ─────────────────────────────────────────
   Auth Pages
   ───────────────────────────────────────── */
.auth-page {
  display: flex;
  justify-content: center;
  padding: 3rem 1rem;
}

.auth-panel {
  width: 100%;
  max-width: 420px;
}

.auth-panel h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.form-field label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--ink);
}

.form-input {
  width: 100%;
  padding: .6rem .85rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: .95rem;
  color: var(--ink);
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192,82,42,.12);
}

.form-error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error);
  border-radius: var(--r-sm);
  padding: .65rem .9rem;
  font-size: .875rem;
  margin-bottom: .5rem;
}

.auth-switch {
  margin-top: 1.25rem;
  text-align: center;
  font-size: .875rem;
  color: var(--muted);
}

/* ─────────────────────────────────────────
   Footer
   ───────────────────────────────────────── */
.site-footer {
  padding: 2.5rem 0 3.5rem;
  border-top: 1px solid var(--line);
  margin-top: 4rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-brand {
  font-weight: 700;
  font-size: .875rem;
  color: var(--ink);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: .35rem;
}

.footer-tagline {
  color: var(--muted);
  font-size: .85rem;
  max-width: 36ch;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-links a {
  font-size: .875rem;
  color: var(--muted);
}

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

/* ─────────────────────────────────────────
   Main spacing
   ───────────────────────────────────────── */
main { padding-bottom: 4rem; }

/* ─────────────────────────────────────────
   Hero
   ───────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: start;
  padding: 3rem 0 1.5rem;
}

.hero-copy { padding-top: .5rem; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0 0 .9rem;
  padding: .3rem .75rem;
  background: var(--accent-light);
  border: 1px solid rgba(192,82,42,.18);
  border-radius: var(--r-full);
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 700;
}

.hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.6rem);
  line-height: 1.08;
  margin: 0 0 1.1rem;
  color: var(--ink);
}

.lede {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 54ch;
  margin-bottom: 1.5rem;
}

.format-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.format-badge {
  font-size: .78rem;
  font-weight: 600;
  padding: .28rem .7rem;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  letter-spacing: .02em;
}

/* ─────────────────────────────────────────
   Panels / Cards
   ───────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.panel + .panel { margin-top: 1rem; }

.panel h2 {
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  margin: 0 0 1rem;
  color: var(--ink);
}

/* ─────────────────────────────────────────
   Upload Panel
   ───────────────────────────────────────── */
.upload-panel {
  position: sticky;
  top: 1.5rem;
}

.upload-panel h2 {
  font-family: Georgia, serif;
  font-size: 1.2rem;
  margin-bottom: 1.25rem;
}

/* Drop zone */
.drop-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 2rem 1rem;
  border: 2px dashed var(--line);
  border-radius: var(--r);
  background: var(--surface-alt);
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
  text-align: center;
  min-height: 130px;
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

.drop-zone.has-file {
  border-color: var(--success);
  background: var(--success-bg);
}

.drop-icon {
  font-size: 2rem;
  line-height: 1;
}

.drop-label {
  font-weight: 600;
  font-size: .925rem;
  color: var(--ink);
}

.drop-hint {
  font-size: .8rem;
  color: var(--muted);
}

.drop-filename {
  font-size: .85rem;
  font-weight: 600;
  color: var(--success);
  margin-top: .25rem;
}

/* Attachments field (smaller) */
.attach-zone {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--r);
  background: var(--surface-alt);
  cursor: pointer;
  position: relative;
  transition: border-color var(--t), background var(--t);
}

.attach-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.attach-zone.has-file {
  border-color: var(--success);
  background: var(--success-bg);
}

.attach-label {
  font-size: .875rem;
  color: var(--muted);
}

.attach-filename {
  font-size: .8rem;
  font-weight: 600;
  color: var(--success);
}

/* Field label */
.field-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: .5rem;
}

.upload-form {
  display: grid;
  gap: 1rem;
}

/* ─────────────────────────────────────────
   Buttons
   ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .85rem 1.5rem;
  border: none;
  border-radius: var(--r-full);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), transform var(--t), box-shadow var(--t);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(192,82,42,.3);
  width: 100%;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(192,82,42,.4);
  color: #fff;
  text-decoration: none;
}

.btn-primary:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--surface-alt);
  color: var(--ink);
  text-decoration: none;
}

.btn-sm {
  padding: .5rem 1rem;
  font-size: .85rem;
}

/* Loading spinner in button */
.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

.btn.loading .btn-spinner { display: block; }
.btn.loading .btn-text { opacity: .7; }

/* Legacy button compat */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .85rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-full);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t);
}

button:hover { background: var(--accent-hover); }

/* ─────────────────────────────────────────
   Status Badges
   ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .28rem .75rem;
  border-radius: var(--r-full);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-queued {
  background: var(--neutral-bg);
  color: var(--neutral);
  border: 1px solid var(--neutral-border);
}
.badge-queued::before { background: #9ca3af; }

.badge-running {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
}
.badge-running::before {
  background: var(--info);
  animation: pulse 1.2s ease-in-out infinite;
}

.badge-succeeded {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.badge-succeeded::before { background: var(--success); }

.badge-failed {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}
.badge-failed::before { background: var(--error); }

.badge-valid {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.badge-valid::before { background: var(--success); }

.badge-invalid {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}
.badge-invalid::before { background: var(--error); }

.badge-skipped {
  background: var(--neutral-bg);
  color: var(--neutral);
  border: 1px solid var(--neutral-border);
}
.badge-skipped::before { background: #9ca3af; }

/* ─────────────────────────────────────────
   Status Timeline
   ───────────────────────────────────────── */
.status-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow-x: auto;
}

.timeline-step {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}

.timeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  flex-shrink: 0;
  transition: all var(--t);
}

.timeline-dot.done {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.timeline-dot.active {
  background: var(--info-bg);
  border-color: var(--info);
  color: var(--info);
  animation: pulse-border 1.4s ease-in-out infinite;
}

.timeline-dot.error {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

.timeline-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.timeline-label.done { color: var(--success); }
.timeline-label.active { color: var(--info); }
.timeline-label.error { color: var(--error); }

.timeline-connector {
  flex: 1;
  min-width: 2rem;
  height: 2px;
  background: var(--line);
  margin: 0 .75rem;
  flex-shrink: 0;
}

.timeline-connector.done { background: var(--success); }

/* ─────────────────────────────────────────
   Job Detail Layout
   ───────────────────────────────────────── */
.job-page { padding-top: 1.5rem; }

.job-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.job-page-title {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.job-page-title h1 {
  font-size: 1.5rem;
  margin: 0;
  word-break: break-all;
}

.job-page-title .job-filename {
  font-size: .95rem;
  color: var(--muted);
  font-family: inherit;
}

.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: .75rem;
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

.job-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

/* ─────────────────────────────────────────
   Metadata Table
   ───────────────────────────────────────── */
.meta-table {
  display: grid;
  gap: .6rem;
}

.meta-row {
  display: grid;
  grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr);
  gap: .85rem;
  align-items: start;
  font-size: .9rem;
}

.meta-key {
  font-weight: 600;
  color: var(--muted);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding-top: .1rem;
}

.meta-val {
  color: var(--ink);
  word-break: normal;
  overflow-wrap: anywhere;
}

/* ─────────────────────────────────────────
   Artifact Cards
   ───────────────────────────────────────── */
.artifact-list {
  display: grid;
  gap: .6rem;
}

.artifact-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1rem;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--r);
  text-decoration: none;
  color: var(--ink);
  transition: background var(--t), border-color var(--t), box-shadow var(--t);
}

.artifact-card:hover {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  text-decoration: none;
}

.artifact-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.artifact-body {
  flex: 1;
  min-width: 0;
}

.artifact-title {
  font-size: .9rem;
  font-weight: 600;
  display: block;
}

.artifact-sub {
  font-size: .78rem;
  color: var(--muted);
  display: block;
}

.artifact-arrow {
  font-size: 1rem;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform var(--t), color var(--t);
}

.artifact-card:hover .artifact-arrow {
  transform: translateX(2px);
  color: var(--accent);
}

/* ─────────────────────────────────────────
   Error Panel
   ───────────────────────────────────────── */
.error-panel {
  background: var(--error-bg);
  border-color: var(--error-border);
}

.error-panel h2 { color: var(--error); }

.error-text {
  font-size: .9rem;
  color: var(--error);
  background: rgba(153,27,27,.06);
  padding: .75rem 1rem;
  border-radius: var(--r-sm);
  border-left: 3px solid var(--error);
}

/* ─────────────────────────────────────────
   Collapsible Report Section
   ───────────────────────────────────────── */
.report-section {
  margin-top: 1rem;
}

.report-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  transition: background var(--t);
}

.report-toggle:hover { background: var(--surface-alt); }

.report-toggle-icon {
  font-size: .85rem;
  color: var(--muted);
  transition: transform var(--t);
}

.report-section.open .report-toggle {
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  border-bottom-color: transparent;
}

.report-section.open .report-toggle-icon { transform: rotate(180deg); }

.report-body {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  overflow: hidden;
}

.report-section.open .report-body { display: block; }

.report-body pre {
  border-radius: 0;
  margin: 0;
  max-height: 500px;
  overflow-y: auto;
}

/* ─────────────────────────────────────────
   Feature Grid (Landing)
   ───────────────────────────────────────── */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 2rem 0 1.5rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t), transform var(--t);
}

.feature-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 1.75rem;
  margin-bottom: .75rem;
  display: block;
}

.feature-card h3 {
  font-family: inherit;
  font-size: .975rem;
  font-weight: 700;
  margin: 0 0 .45rem;
}

.feature-card p {
  font-size: .875rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

/* ─────────────────────────────────────────
   Page Cards (Marketing links)
   ───────────────────────────────────────── */
.page-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.page-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t), border-color var(--t), transform var(--t);
}

.page-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.page-card h3 {
  font-family: inherit;
  font-size: .975rem;
  font-weight: 700;
  margin: 0 0 .35rem;
}

.page-card h3 a {
  color: var(--ink);
}

.page-card h3 a:hover { color: var(--accent); text-decoration: none; }

.page-card p {
  font-size: .875rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
}

/* ─────────────────────────────────────────
   Content Page (Marketing)
   ───────────────────────────────────────── */
.content-page {
  max-width: 52rem;
  padding-top: 2.5rem;
}

.content-page h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin-bottom: 1.2rem; }

.content-page .lede { margin-bottom: 1.5rem; }

.content-page p {
  font-size: .975rem;
  color: var(--muted);
  line-height: 1.75;
  max-width: 60ch;
}

/* ─────────────────────────────────────────
   Divider
   ───────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

/* ─────────────────────────────────────────
   Hint text
   ───────────────────────────────────────── */
.hint {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.5;
}

.upload-legal-hint {
  margin: .6rem 0 0;
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}
.upload-legal-hint a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.upload-legal-hint a:hover { color: var(--accent); }

/* ─────────────────────────────────────────
   Spinner
   ───────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}

/* ─────────────────────────────────────────
   Action selector (validate / extract)
   ───────────────────────────────────────── */
.action-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}

.action-option {
  position: relative;
}

.action-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.action-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  padding: .75rem;
  border: 2px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  text-align: center;
  transition: border-color var(--t), background var(--t);
  background: var(--surface-alt);
}

.action-label:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.action-option input[type="radio"]:checked + .action-label {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-text);
}

.action-label-icon { font-size: 1.25rem; }
.action-label-text { font-size: .82rem; font-weight: 600; }

/* ─────────────────────────────────────────
   Invoice Preview (standalone)
   ───────────────────────────────────────── */
.invoice-preview-page {
  font-family: -apple-system, "Segoe UI", sans-serif;
  background: #f5f0e8;
  color: #1a1c18;
  margin: 0;
  padding: 2rem;
}

/* ─────────────────────────────────────────
   Animations
   ───────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .6; transform: scale(1.3); }
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(30,64,175,.3); }
  50%       { box-shadow: 0 0 0 4px rgba(30,64,175,.15); }
}

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

.fade-in { animation: fadeIn .3s ease forwards; }

/* ─────────────────────────────────────────
   Info Pages (Extraktion, FAQ)
   ───────────────────────────────────────── */
.info-page .lede { max-width: 72ch; }

.section-h2 {
  font-size: 1.35rem;
  margin: 2.5rem 0 1.25rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

/* Info Cards */
.info-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.75rem 0;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.5rem;
}

.info-card-accent {
  border-color: var(--accent);
  background: var(--accent-light);
}

.info-card-icon {
  font-size: 1.75rem;
  margin-bottom: .75rem;
}

.info-card h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.info-card p  { font-size: .9rem; color: var(--muted); margin-bottom: .75rem; }

.info-list {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.info-list li { font-size: .875rem; }

/* Steps */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 1.25rem 0;
  position: relative;
}

.step {
  display: flex;
  gap: 1.25rem;
  padding-bottom: 1.75rem;
  position: relative;
}

.step::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 2.5rem;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.step:last-child::before { display: none; }

.step-num {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 800;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.step-body h4 { margin: .2rem 0 .4rem; font-size: .95rem; }
.step-body p  { margin: 0; font-size: .9rem; color: var(--muted); max-width: 60ch; }

/* Format Support Grid */
.format-support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.format-support-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 1rem 1.1rem;
}

.fsc-label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink);
  margin-bottom: .4rem;
}

.fsc-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .55rem;
  border-radius: var(--r-full);
  margin-bottom: .6rem;
}

.fsc-ok  { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.fsc-err { background: var(--error-bg);   color: var(--error);   border: 1px solid var(--error-border); }

.format-support-card p { font-size: .82rem; color: var(--muted); margin: 0; }

/* Code Block */
.code-block {
  background: #1e1b16;
  border-radius: var(--r-sm);
  overflow: hidden;
}

.code-block-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 1rem;
  background: rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.code-method {
  font-size: .72rem;
  font-weight: 800;
  padding: .15rem .5rem;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #fff;
  letter-spacing: .04em;
}

.code-method-get { background: #166534; }

.code-path {
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: .82rem;
  color: #e8dfc8;
}

.code-hint { font-size: .75rem; color: #888; margin-left: auto; }

.code-block pre {
  margin: 0;
  border-radius: 0;
  padding: .9rem 1rem;
  font-size: .82rem;
}

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin: 1.25rem 0;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  transition: border-color var(--t);
}

.faq-item[open] { border-color: var(--accent); }

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
  gap: 1rem;
}

.faq-question::-webkit-details-marker { display: none; }

.faq-question::after {
  content: '▾';
  font-size: .8rem;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform var(--t);
}

.faq-item[open] .faq-question::after { transform: rotate(180deg); }
.faq-item[open] .faq-question { color: var(--accent-text); }

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  font-size: .9rem;
  color: var(--muted);
}

.faq-answer p { margin: 0 0 .6rem; }
.faq-answer p:last-child { margin-bottom: 0; }
.faq-answer .info-list { margin-top: .4rem; }

.status-explain-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.status-explain { display: flex; flex-direction: column; gap: .5rem; }
.status-explain p { margin: 0; }

.faq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  margin: .75rem 0;
}

.faq-table th {
  text-align: left;
  padding: .5rem .75rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.faq-table td {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.faq-table tbody tr:last-child td { border-bottom: none; }

/* ─────────────────────────────────────────
   Upload Tabs
   ───────────────────────────────────────── */
.upload-tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.25rem;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: .2rem;
}

.upload-tab {
  flex: 1;
  background: none;
  border: none;
  border-radius: calc(var(--r-sm) - 2px);
  padding: .45rem .75rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--t), color var(--t);
}

.upload-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ─────────────────────────────────────────
   Job Actions
   ───────────────────────────────────────── */
.job-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.25rem;
  border-radius: var(--r-full);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--t), background var(--t);
  text-decoration: none;
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  text-decoration: none;
}

/* ─────────────────────────────────────────
   Result Grid (job detail)
   ───────────────────────────────────────── */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.party-block { display: flex; flex-direction: column; gap: .2rem; }
.party-role { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.party-name { font-size: 1.05rem; font-weight: 600; color: var(--ink); }

.amount-summary {
  margin-top: 1.25rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.amount-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: .3rem 0;
  font-size: .9rem;
}

.amount-label { color: var(--muted); }
.amount-val { font-weight: 600; }

.amount-row-total {
  border-top: 1px solid var(--line);
  margin-top: .35rem;
  padding-top: .6rem;
}

.amount-total { font-size: 1.15rem; color: var(--accent-text); }

/* ─────────────────────────────────────────
   Line Items Table
   ───────────────────────────────────────── */
.line-items-wrap { overflow-x: auto; }

.line-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.line-items-table th {
  text-align: left;
  padding: .6rem .85rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
}

.line-items-table td {
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.line-items-table tbody tr:last-child td { border-bottom: none; }
.line-items-table tbody tr:hover td { background: var(--surface-alt); }

/* ─────────────────────────────────────────
   Validation Result
   ───────────────────────────────────────── */
.validation-result {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}

.validation-result-valid   { background: var(--success-bg); border-color: var(--success-border); }
.validation-result-invalid { background: var(--error-bg);   border-color: var(--error-border); }
.validation-result-skipped { background: var(--neutral-bg); border-color: var(--neutral-border); }
.validation-result-error   { background: var(--error-bg);   border-color: var(--error-border); }

.validation-result-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.validation-result-valid   .validation-result-icon { color: var(--success); }
.validation-result-invalid .validation-result-icon { color: var(--error); }
.validation-result-skipped .validation-result-icon { color: var(--neutral); }

/* ─────────────────────────────────────────
   History Table
   ───────────────────────────────────────── */
.history-table-wrap { overflow-x: auto; }

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.history-table th {
  text-align: left;
  padding: .65rem 1rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
  white-space: nowrap;
}

.history-table td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.history-table tbody tr:last-child td { border-bottom: none; }
.history-table tbody tr:hover td { background: var(--surface-alt); }

.history-filename {
  font-weight: 600;
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta { color: var(--muted); font-size: .82rem; }

/* ─────────────────────────────────────────
   Recent Section (on index)
   ───────────────────────────────────────── */
.recent-section { margin-top: 2rem; }

.recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.recent-header h2 { margin: 0; font-size: 1.25rem; }

/* ─────────────────────────────────────────
   Rechnungsarten Page
   ───────────────────────────────────────── */
.rechnungsarten-page .lede { max-width: 72ch; }

.format-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 1.5rem 0 2.5rem;
}

.format-nav a {
  font-size: .82rem;
  font-weight: 600;
  padding: .35rem .85rem;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  transition: border-color var(--t), color var(--t), background var(--t);
}

.format-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  text-decoration: none;
}

.format-section {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0;
}

.format-section:first-of-type { border-top: none; }

.format-header {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.format-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .04em;
  color: #fff;
  flex-shrink: 0;
}

.format-de      { background: #1a1c18; }
.format-eu      { background: #003399; }
.format-fr      { background: #002395; }
.format-neutral { background: var(--muted); }

.format-header h2 { margin: 0 0 .2rem; font-size: 1.35rem; }
.format-sub { margin: 0; font-size: .85rem; color: var(--muted); }

.format-section p { max-width: 74ch; }

.format-facts {
  margin: 1rem 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.format-facts li { font-size: .9rem; }

.format-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: 1rem;
}

.ftag {
  font-size: .78rem;
  font-weight: 600;
  padding: .25rem .7rem;
  border-radius: var(--r-full);
  background: var(--neutral-bg);
  border: 1px solid var(--neutral-border);
  color: var(--neutral);
}

.ftag-green { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.ftag-blue  { background: var(--info-bg);    border-color: var(--info-border);    color: var(--info); }
.ftag-orange { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
  margin: 1.25rem 0;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: .85rem 1rem;
}

.profile-card-highlight { border-color: var(--accent); background: var(--accent-light); }
.profile-name { display: block; font-weight: 700; font-size: .875rem; margin-bottom: .3rem; }
.profile-desc { display: block; font-size: .8rem; color: var(--muted); }
.profile-card-highlight .profile-name { color: var(--accent-text); }

/* Compare Table */
.compare-wrap { overflow-x: auto; }

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.compare-table th {
  text-align: left;
  padding: .65rem 1rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}

.compare-table td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.compare-table tbody tr:hover td { background: var(--surface-alt); }
.compare-table .check { color: var(--success); font-weight: 700; }

/* ─────────────────────────────────────────
   Responsive
   ───────────────────────────────────────── */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; padding-top: 2rem; }
  .upload-panel { position: static; }
  .features { grid-template-columns: 1fr; }
  .page-list { grid-template-columns: 1fr; }
  .job-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .status-timeline { flex-direction: column; align-items: flex-start; }
  .timeline-connector { width: 2px; min-width: 2px; height: 1.5rem; margin: .5rem .75rem; }
  .job-page-header { flex-direction: column; align-items: flex-start; }
  .job-actions { width: 100%; }
  .format-header { flex-direction: column; gap: .75rem; }
  .info-cards { grid-template-columns: 1fr; }
  .status-explain-grid { grid-template-columns: 1fr; }
}

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

@media (max-width: 640px) {
  .meta-row {
    grid-template-columns: 1fr;
    gap: .2rem;
  }
}

/* ─────────────────────────────────────────
   History Drawer
   ───────────────────────────────────────── */
.history-toggle {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--muted);
  padding: .45rem 1rem;
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: background var(--t), color var(--t), border-color var(--t), box-shadow var(--t);
}
.history-toggle:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow);
}

.history-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,15,10,.35);
  z-index: 900;
  backdrop-filter: blur(2px);
}
.history-overlay.open { display: block; }

.history-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: min(380px, 88vw);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  z-index: 901;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.history-drawer.open { transform: translateX(0); }

.history-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.history-drawer-title {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .02em;
}
.history-drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  padding: .25rem .5rem;
  border-radius: var(--r-sm);
  line-height: 1;
  transition: background var(--t), color var(--t);
}
.history-drawer-close:hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.history-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: .75rem 0;
}

.history-drawer-empty {
  color: var(--muted);
  font-size: .875rem;
  text-align: center;
  padding: 2rem 1.25rem;
  margin: 0;
}

.history-drawer-item {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .7rem 1.25rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background var(--t);
}
.history-drawer-item:hover {
  background: var(--surface-alt);
  text-decoration: none;
}
.history-drawer-item:last-child { border-bottom: none; }

.history-drawer-filename {
  font-size: .875rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-drawer-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  font-size: .775rem;
  color: var(--muted);
}

/* ─────────────────────────────────────────
   Shared feedback banners
   ───────────────────────────────────────── */
.form-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
  border-radius: var(--r-sm);
  padding: .65rem 1rem;
  font-size: .875rem;
}

/* ─────────────────────────────────────────
   Profile page
   ───────────────────────────────────────── */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.75rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}

.profile-hero-avatar {
  width: 52px;
  height: 52px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.profile-hero-title {
  font-size: 1.25rem;
  margin: 0 0 .3rem;
  font-family: Georgia, "Times New Roman", serif;
}

.profile-hero-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .825rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.profile-hero-sep { opacity: .4; }

.profile-verified   { color: var(--success); font-weight: 500; }
.profile-unverified { color: var(--warning);  font-weight: 500; }

.profile-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: .9rem;
}

.field-hint {
  font-size: .8rem;
  color: var(--muted);
  font-weight: 400;
}

.profile-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.profile-section-sub {
  font-size: .85rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
}

.profile-empty {
  color: var(--muted);
  font-size: .875rem;
  margin: 0 0 1.25rem;
}

/* API key table uses .history-table — just need the reveal box */
.key-prefix-code {
  font-size: .8rem;
  background: var(--surface-alt);
  border: 1px solid var(--line);
}

.api-key-reveal {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: var(--r-sm);
  padding: .85rem 1rem;
  margin-bottom: 1.25rem;
}

.api-key-reveal-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .825rem;
  font-weight: 600;
  color: var(--success);
  margin-bottom: .6rem;
}

.api-key-reveal-box {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.api-key-reveal-box code {
  flex: 1;
  word-break: break-all;
  font-size: .8rem;
  background: var(--surface);
  border: 1px solid var(--success-border);
}

.api-key-create-form {
  display: flex;
  gap: .75rem;
  align-items: flex-end;
}

.btn-danger-link {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--error);
  font-size: .825rem;
  padding: .3rem .6rem;
  border-radius: var(--r-sm);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t);
}
.btn-danger-link:hover {
  background: var(--error-bg);
  text-decoration: none;
}

/* ─────────────────────────────────────────
   History page bulk actions
   ───────────────────────────────────────── */
.history-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.history-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .6rem .25rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}

.history-select-all-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
}
.history-select-all-wrap input { cursor: pointer; accent-color: var(--accent); }

.history-toolbar-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.history-selected-count {
  font-size: .825rem;
  color: var(--accent);
  font-weight: 600;
}

.history-row.selected { background: var(--accent-light); }

.delete-hint {
  display: inline-block;
  font-size: .75rem;
  color: var(--muted);
  margin-top: .15rem;
}
.delete-hint-soon {
  color: var(--warning);
  font-weight: 500;
}

.job-checkbox { accent-color: var(--accent); cursor: pointer; }

/* ─────────────────────────────────────────
   Retention rule selector
   ───────────────────────────────────────── */
.retention-form { }

.retention-options {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.retention-option {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  font-size: .875rem;
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t);
  color: var(--muted);
  background: var(--surface);
}
.retention-option input[type="radio"] { display: none; }

.retention-option:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.retention-option.selected,
.retention-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 700px) {
  .profile-settings-grid { grid-template-columns: 1fr; }
  .api-key-create-form { flex-direction: column; align-items: stretch; }
}

@media (max-width: 560px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .site-header nav { gap: .1rem; }
  .action-selector { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: 1.5rem; }
}
