/* ============================================================
   ACTION ITEM EXTRACTOR — Premium Dark UI
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --bg: #09090B;
  --surface: #111113;
  --surface-2: #18181B;
  --surface-glass: rgba(255,255,255,0.045);
  --surface-glass-hover: rgba(255,255,255,0.07);

  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.16);

  --text: #FFFFFF;
  --text-soft: #A1A1AA;
  --text-muted: #71717A;

  --accent: #6366F1;
  --accent-2: #8B5CF6;
  --accent-grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --accent-glow: rgba(99,102,241,0.35);

  --success: #22C55E;
  --success-bg: rgba(34,197,94,0.12);
  --error: #EF4444;
  --error-bg: rgba(239,68,68,0.12);
  --warning: #F59E0B;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.45);
  --shadow-lg: 0 20px 56px rgba(0,0,0,0.55);
  --shadow-glow: 0 0 0 1px rgba(99,102,241,0.15), 0 8px 40px rgba(99,102,241,0.18);

  --ease: cubic-bezier(0.22,1,0.36,1);
  --ease-spring: cubic-bezier(0.34,1.56,0.64,1);
  --dur-fast: 140ms;
  --dur-base: 240ms;
  --dur-slow: 420ms;

  --header-h: 68px;
}

[data-theme="light"] {
  --bg: #F7F7F8;
  --surface: #FFFFFF;
  --surface-2: #F1F1F3;
  --surface-glass: rgba(17,17,19,0.035);
  --surface-glass-hover: rgba(17,17,19,0.06);
  --border: rgba(17,17,19,0.09);
  --border-hover: rgba(17,17,19,0.16);
  --text: #111113;
  --text-soft: #52525B;
  --text-muted: #8A8A93;
  --shadow-sm: 0 1px 3px rgba(17,17,19,0.08);
  --shadow-md: 0 8px 24px rgba(17,17,19,0.08);
  --shadow-lg: 0 20px 56px rgba(17,17,19,0.10);
}
.aie-why, .brn-why, .cmg-why, .cl-why, .yts-why {
  --why-card-bg:           rgba(255,255,255,0.035);
  --why-card-bg-hover:     rgba(255,255,255,0.065);
  --why-card-border:       rgba(255,255,255,0.075);
  --why-card-border-hover: rgba(255,255,255,0.14);
  --why-icon-bg:           rgba(255,255,255,0.07);
  --why-icon-border:       rgba(255,255,255,0.10);
  --why-icon-color:        rgba(255,255,255,0.72);
  --why-heading-color:     #ffffff;
  --why-label-color:       rgba(255,255,255,0.92);
  --why-desc-color:        rgba(255,255,255,0.45);
  --why-sub-color:         rgba(255,255,255,0.45);
  --why-radius-card:       14px;
  --why-radius-icon:       9px;
}
 
/* ── Shared card / grid structure (applied via each prefix) ── */
.aie-why-card, .brn-why-card, .cmg-why-card, .cl-why-card, .yts-why-card {
  background: var(--why-card-bg);
  border: 1px solid var(--why-card-border);
  border-radius: var(--why-radius-card);
  padding: 1.3rem 1.15rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
 
.aie-why-card:hover, .brn-why-card:hover, .cmg-why-card:hover,
.cl-why-card:hover, .yts-why-card:hover {
  background: var(--why-card-bg-hover);
  border-color: var(--why-card-border-hover);
  transform: translateY(-2px);
}
 
.aie-why-icon, .brn-why-icon, .cmg-why-icon, .cl-why-icon, .yts-why-icon {
  width: 34px;
  height: 34px;
  background: var(--why-icon-bg);
  border: 1px solid var(--why-icon-border);
  border-radius: var(--why-radius-icon);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.3rem;
  flex-shrink: 0;
}
 
.aie-why-icon svg, .brn-why-icon svg, .cmg-why-icon svg,
.cl-why-icon svg, .yts-why-icon svg {
  width: 16px;
  height: 16px;
  color: var(--why-icon-color);
}
 
.aie-why-label, .brn-why-label, .cmg-why-label,
.cl-why-label, .yts-why-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--why-label-color);
  margin: 0;
}
 
.aie-why-desc, .brn-why-desc, .cmg-why-desc,
.cl-why-desc, .yts-why-desc {
  font-size: 0.855rem;
  color: var(--why-desc-color);
  line-height: 1.65;
  margin: 0;
}
 
.cmg-why-desc code {
  font-family: monospace;
  font-size: 0.8rem;
  background: rgba(255,255,255,0.07);
  padding: 1px 5px;
  border-radius: 4px;
}
 

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
ul { list-style: none; }
::selection { background: rgba(99,102,241,0.35); color: #fff; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 10px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ============================================================
   AMBIENT BACKGROUND
   ============================================================ */
.bg-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 85% 55% at 50% 15%, black 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 85% 55% at 50% 15%, black 20%, transparent 100%);
}

.bg-blob { position: absolute; border-radius: 50%; filter: blur(120px); will-change: transform; }
.bg-blob-1 {
  width: 620px; height: 620px; top: -260px; right: -140px;
  background: radial-gradient(circle, rgba(99,102,241,0.16) 0%, transparent 70%);
  animation: blobDrift 24s ease-in-out infinite;
}
.bg-blob-2 {
  width: 520px; height: 520px; bottom: -220px; left: -120px;
  background: radial-gradient(circle, rgba(139,92,246,0.12) 0%, transparent 70%);
  animation: blobDrift 30s ease-in-out infinite reverse;
}
.bg-blob-3 {
  width: 380px; height: 380px; top: 45%; left: 45%;
  background: radial-gradient(circle, rgba(34,197,94,0.05) 0%, transparent 70%);
  animation: blobDrift 20s ease-in-out infinite 4s;
}
@keyframes blobDrift {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(40px,-30px) scale(1.06); }
  66% { transform: translate(-24px,22px) scale(0.96); }
}

.mouse-glow {
  position: fixed; width: 460px; height: 460px; pointer-events: none; z-index: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 70%);
  transform: translate(-50%,-50%);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease);
}

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h);
  padding: 0 28px;
  background: rgba(9,9,11,0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .app-header { background: rgba(255,255,255,0.75); }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 22px var(--accent-glow);
  animation: brandPulse 3.4s ease-in-out infinite;
}
@keyframes brandPulse {
  0%, 100% { box-shadow: 0 0 18px var(--accent-glow); }
  50% { box-shadow: 0 0 32px var(--accent-glow); }
}
.brand-icon svg { width: 19px; height: 19px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.brand-sub { font-size: 11.5px; color: var(--text-muted); }

.header-right { display: flex; align-items: center; gap: 8px; }
.header-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-glass);
  color: var(--text-soft);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring);
}
.header-btn svg { width: 17px; height: 17px; }
.header-btn:hover { background: var(--surface-glass-hover); border-color: var(--border-hover); color: var(--text); transform: translateY(-1px); }
.header-btn:active { transform: translateY(0) scale(0.94); }

/* ============================================================
   PAGE / HERO
   ============================================================ */
.page { position: relative; z-index: 2; max-width: 1300px; margin: 0 auto; padding: 0 28px 80px; }

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 40px;
  padding: 64px 0 48px;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-glass);
  font-size: 12.5px; font-weight: 600; color: var(--text-soft);
  letter-spacing: 0.02em;
}
.eyebrow-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(34,197,94,0.7);
  animation: dotPulse 1.8s ease-in-out infinite;
}
@keyframes dotPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.hero-title {
  margin-top: 18px;
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  background: linear-gradient(180deg, var(--text) 30%, var(--text-soft));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  margin-top: 18px;
  font-size: 17px;
  color: var(--text-soft);
  max-width: 480px;
  line-height: 1.65;
}

.hero-visual { position: relative; display: flex; align-items: center; justify-content: center; height: 300px; }
.hero-visual-glow {
  position: absolute; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.22), transparent 70%);
  filter: blur(30px);
}
.hero-illustration { width: 100%; max-width: 380px; overflow: visible; }

.orbit-ring { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 1; }
.ring-a { animation: spinSlow 40s linear infinite; }
.ring-b { animation: spinSlow 30s linear infinite reverse; }
@keyframes spinSlow { to { transform: rotate(360deg); } }

.doc-group { animation: docFloat 5s ease-in-out infinite; transform-origin: 160px 130px; }
@keyframes docFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.doc-line { fill: rgba(255,255,255,0.14); }
.scan-mask { clip-path: inset(0 round 10px); }
.scan-line { animation: scanSweep 3.2s ease-in-out infinite; }
@keyframes scanSweep {
  0% { transform: translateY(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(128px); opacity: 0; }
}

.float-badge { animation: badgeFloat 4.5s ease-in-out infinite; }
.badge-1 { animation-delay: 0s; }
.badge-2 { animation-delay: 1.2s; }
.badge-3 { animation-delay: 2.4s; }
@keyframes badgeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ============================================================
   WORKSPACE / PANELS
   ============================================================ */
.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.glass-card {
  background: var(--surface-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
  position: relative;
  overflow: hidden;
}
.glass-card::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 25% 15%, rgba(255,255,255,0.035), transparent 55%);
  pointer-events: none;
}

.panel-input { padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.panel-output { padding: 28px; min-height: 560px; display: flex; flex-direction: column; }

/* ---- Segmented control ---- */
.segmented {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.segmented-btn {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px;
  border: none; background: transparent;
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  border-radius: calc(var(--radius-lg) - 4px);
  transition: color var(--dur-fast) var(--ease);
}
.segmented-btn svg { width: 15px; height: 15px; }
.segmented-btn.active { color: var(--text); }
.segmented-indicator {
  position: absolute; top: 4px; left: 4px;
  width: calc(50% - 5px); height: 42px;
  background: var(--accent-grad);
  border-radius: calc(var(--radius-lg) - 4px);
  box-shadow: 0 6px 18px rgba(99,102,241,0.35);
  transition: transform var(--dur-base) var(--ease-spring);
  z-index: 1;
}
.segmented-indicator.pos-1 { transform: translateX(100%); }

/* ---- Input pane ---- */
.input-pane { display: flex; flex-direction: column; gap: 10px; animation: fadeIn var(--dur-base) var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.02em; }

.text-input {
  width: 100%; min-height: 200px; max-height: 420px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  font-size: 14.5px; line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}
.text-input::placeholder { color: var(--text-muted); }
.text-input:hover { border-color: var(--border-hover); }
.text-input:focus {
  border-color: var(--accent);
  background: rgba(99,102,241,0.03);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.12);
}

.field-meta { display: flex; justify-content: flex-end; }
.char-counter { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.char-counter.warn { color: var(--warning); }
.aie-why {
  width: 100%;
  max-width: 860px;
  margin: 4rem auto 2rem;
  padding: 0 1.25rem;
}
 
.aie-why-heading {
  font-size: clamp(1.4rem, 2.8vw, 1.85rem);
  font-weight: 700;
  color: var(--why-heading-color);
  text-align: center;
  margin: 0 0 0.55rem;
  letter-spacing: -0.022em;
}
 
.aie-why-sub {
  font-size: 0.9rem;
  color: var(--why-sub-color);
  text-align: center;
  max-width: 500px;
  margin: 0 auto 2.25rem;
  line-height: 1.65;
}
 
.aie-why-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
 
@media (max-width: 720px) { .aie-why-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .aie-why-grid { grid-template-columns: 1fr; } }
 

/* ---- Dropzone ---- */
.dropzone {
  position: relative;
  min-height: 200px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--border-hover);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.015);
  transition: border-color var(--dur-base) var(--ease), background var(--dur-base) var(--ease), transform var(--dur-fast) var(--ease);
  cursor: pointer;
  padding: 24px;
}
.dropzone:hover { border-color: var(--accent); background: rgba(99,102,241,0.04); }
.dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(99,102,241,0.08);
  transform: scale(1.01);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.12);
}
.dropzone.has-error { border-color: var(--error); background: rgba(239,68,68,0.05); }

.dropzone-idle { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.dropzone-icon {
  width: 52px; height: 52px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text-soft);
  animation: iconBob 2.6s ease-in-out infinite;
}
@keyframes iconBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.dropzone-icon svg { width: 22px; height: 22px; }
.dropzone-title { font-size: 14.5px; font-weight: 500; color: var(--text-soft); }
.dropzone-title span { color: var(--accent-2); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.dropzone-hint { font-size: 12.5px; color: var(--text-muted); }

.dropzone-file {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  padding: 6px;
  animation: scaleIn var(--dur-base) var(--ease-spring);
}
@keyframes scaleIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
.file-icon {
  position: relative;
  width: 46px; height: 46px; border-radius: var(--radius-md); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-grad); color: #fff;
  box-shadow: 0 6px 18px rgba(99,102,241,0.3);
}
.file-icon svg { width: 20px; height: 20px; }
.file-success-ring {
  position: absolute; inset: -4px; border-radius: calc(var(--radius-md) + 4px);
  border: 2px solid var(--success); opacity: 0;
}
.file-success-ring.flash { animation: successRing 0.9s var(--ease) forwards; }
@keyframes successRing {
  0% { opacity: 1; transform: scale(0.85); }
  100% { opacity: 0; transform: scale(1.35); }
}
.file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-name { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 12px; color: var(--text-muted); }
.file-remove {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring);
}
.file-remove svg { width: 14px; height: 14px; }
.file-remove:hover { background: var(--error-bg); color: var(--error); transform: rotate(90deg); }

/* ---- Validation ---- */
.validation-msg {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--error-bg);
  border: 1px solid rgba(239,68,68,0.25);
  color: #FCA5A5;
  font-size: 13px; font-weight: 500;
  animation: shake 0.4s var(--ease);
}
.validation-msg::before {
  content: '!'; flex-shrink: 0;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--error); color: #fff;
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ---- Submit button ---- */
.submit-btn {
  position: relative;
  height: 54px;
  border: none; border-radius: var(--radius-lg);
  background: var(--accent-grad);
  color: #fff; font-size: 15px; font-weight: 700;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(99,102,241,0.35);
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast) var(--ease);
}
.submit-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(99,102,241,0.45); }
.submit-btn:active { transform: translateY(0) scale(0.98); }
.submit-btn:disabled { opacity: 0.55; pointer-events: none; }
.submit-btn-bg {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  transform: translateX(-100%);
}
.submit-btn:hover .submit-btn-bg { animation: sweep 1.1s var(--ease); }
@keyframes sweep { to { transform: translateX(100%); } }

.submit-content {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; height: 100%;
}
.submit-content svg { width: 17px; height: 17px; }
.submit-btn.state-success { background: linear-gradient(135deg, #22C55E, #16A34A); box-shadow: 0 8px 28px rgba(34,197,94,0.35); }
.submit-btn.state-error { background: linear-gradient(135deg, #EF4444, #DC2626); box-shadow: 0 8px 28px rgba(239,68,68,0.35); }

.btn-spinner {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   OUTPUT STATES
   ============================================================ */
.state-view {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  gap: 14px;
}
.state-view.state-results { align-items: stretch; text-align: left; justify-content: flex-start; }

.state-title { font-size: 17px; font-weight: 700; }
.state-desc { font-size: 13.5px; color: var(--text-soft); max-width: 340px; line-height: 1.6; }

.empty-illustration { animation: emptyFloat 4.5s ease-in-out infinite; opacity: 0.85; }
@keyframes emptyFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ---- Loading state ---- */
.scan-loader { margin-bottom: 4px; }
.scan-loader-doc { width: 96px; height: 120px; overflow: visible; }
.scan-loader-lines rect { fill: rgba(255,255,255,0.12); }
.scan-loader-beam { animation: loaderScan 2.4s ease-in-out infinite; }
@keyframes loaderScan {
  0% { transform: translateY(0); opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  100% { transform: translateY(100px); opacity: 0; }
}

.progress-steps {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 300px;
  text-align: left;
}
.progress-steps li {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; color: var(--text-muted);
  transition: color var(--dur-base) var(--ease);
}
.progress-steps li .step-check {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--border-hover);
  position: relative;
  transition: border-color var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}
.progress-steps li.active .step-check {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
}
.progress-steps li.active .step-check::after {
  content: ''; position: absolute; inset: 4px; border-radius: 50%;
  background: var(--accent); animation: pulseDot 1s ease-in-out infinite;
}
@keyframes pulseDot { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.progress-steps li.done { color: var(--text); }
.progress-steps li.done .step-check { background: var(--success); border-color: var(--success); }
.progress-steps li.done .step-check::before {
  content: ''; position: absolute; left: 5px; top: 2px;
  width: 5px; height: 9px;
  border-right: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(40deg);
}

/* ---- Error state ---- */
.error-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--error-bg);
  display: flex; align-items: center; justify-content: center;
  animation: errorPop 0.5s var(--ease-spring);
}
.error-icon svg { width: 28px; height: 28px; }
@keyframes errorPop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.retry-btn {
  margin-top: 4px;
  height: 42px; padding: 0 22px;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  background: var(--surface-glass);
  font-size: 13.5px; font-weight: 600;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring);
}
.retry-btn:hover { background: var(--surface-glass-hover); border-color: var(--accent); transform: translateY(-1px); }

/* ---- Results state ---- */
.results-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.results-title-group { display: flex; align-items: baseline; gap: 10px; }
.results-count {
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill);
  background: rgba(99,102,241,0.15); color: #A5B4FC;
}
.results-actions { display: flex; align-items: center; gap: 6px; }
.icon-action-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-glass); color: var(--text-soft);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring);
}
.icon-action-btn svg { width: 15px; height: 15px; }
.icon-action-btn:hover { background: var(--surface-glass-hover); border-color: var(--border-hover); color: var(--text); transform: translateY(-1px); }
.icon-action-btn.danger:hover { background: var(--error-bg); border-color: rgba(239,68,68,0.3); color: var(--error); }
.icon-action-btn.success-flash { background: var(--success-bg) !important; border-color: rgba(34,197,94,0.35) !important; color: var(--success) !important; }

.results-toolbar { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.search-field {
  flex: 1; min-width: 160px;
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: rgba(255,255,255,0.02);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.search-field svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.search-field:focus-within { border-color: var(--accent); background: rgba(99,102,241,0.03); }
.search-field input { flex: 1; border: none; outline: none; background: transparent; font-size: 13.5px; }
.search-field input::placeholder { color: var(--text-muted); }

.sort-field select {
  height: 38px; padding: 0 30px 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: rgba(255,255,255,0.02);
  font-size: 13px; font-weight: 500; color: var(--text-soft);
  outline: none; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23A1A1AA' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--dur-fast) var(--ease);
}
.sort-field select:focus { border-color: var(--accent); }
.sort-field select option { background: var(--surface-2); color: var(--text); }

.results-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.no-match-msg { margin-top: 24px; text-align: center; color: var(--text-muted); font-size: 13.5px; }

/* ---- Task card ---- */
.task-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.02);
  padding: 16px 18px;
  animation: cardIn var(--dur-slow) var(--ease-spring) both;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.task-card:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.035); transform: translateY(-2px); }

.task-card-header { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.task-card-index {
  width: 26px; height: 26px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: var(--accent-grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.task-card-task { flex: 1; font-size: 14.5px; font-weight: 600; line-height: 1.5; }
.task-card-chevron {
  width: 22px; height: 22px; flex-shrink: 0; color: var(--text-muted);
  transition: transform var(--dur-base) var(--ease);
}
.task-card-chevron svg { width: 100%; height: 100%; }
.task-card.collapsed .task-card-chevron { transform: rotate(-90deg); }
.task-card.collapsed .task-card-body { max-height: 0; opacity: 0; margin-top: 0; pointer-events: none; }

.task-card-body {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 12px; padding-left: 38px;
  max-height: 60px; opacity: 1;
  transition: max-height var(--dur-base) var(--ease), opacity var(--dur-base) var(--ease), margin-top var(--dur-base) var(--ease);
}

.badge-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border);
}
.badge-chip svg { width: 12px; height: 12px; }
.badge-chip.badge-assignee { background: rgba(99,102,241,0.12); color: #A5B4FC; border-color: rgba(99,102,241,0.25); }
.badge-chip.badge-assignee.unassigned { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.badge-chip.badge-deadline { background: rgba(245,158,11,0.12); color: #FCD34D; border-color: rgba(245,158,11,0.25); }
.badge-chip.badge-deadline.none { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 240px; max-width: 360px;
  padding: 12px 16px;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  background: rgba(17,17,19,0.97);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 500;
  pointer-events: all;
  animation: toastIn 0.3s var(--ease-spring) both;
  position: relative; overflow: hidden;
}
[data-theme="light"] .toast { background: rgba(255,255,255,0.97); }
.toast::after {
  content: ''; position: absolute; bottom: 0; left: 0; height: 2px; width: 100%;
  background: var(--accent); animation: toastProgress 3s linear forwards; transform-origin: left;
}
.toast.toast-success::after { background: var(--success); }
.toast.toast-error::after { background: var(--error); }
@keyframes toastProgress { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.toast.removing { animation: toastOut 0.2s var(--ease) both; }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(0.95); } }
.toast-icon { width: 16px; height: 16px; flex-shrink: 0; }
.toast.toast-success .toast-icon { color: var(--success); }
.toast.toast-error .toast-icon { color: var(--error); }
.toast.toast-info .toast-icon { color: var(--accent-2); }

/* ============================================================
   ANIMATION UTILITIES
   ============================================================ */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-in-up { animation: fadeInUp var(--dur-slow) var(--ease) both; }
@keyframes scaleInAnim { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
.animate-scale-in { animation: scaleInAnim var(--dur-slow) var(--ease-spring) both; }
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding-top: 48px; }
  .hero-copy { display: flex; flex-direction: column; align-items: center; }
  .hero-subtitle { max-width: 520px; }
  .workspace { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .app-header { padding: 0 16px; }
  .page { padding: 0 16px 60px; }
  .hero { padding: 36px 0 32px; gap: 24px; }
  .hero-visual { height: 240px; }
  .panel-input, .panel-output { padding: 20px; }
  .results-toolbar { flex-direction: column; align-items: stretch; }
  .sort-field select { width: 100%; }
  .toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
}

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

/* ── Bookmark button ── */
#bookmarkBtn:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}
#bookmarkBtn.is-bookmarked {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}
#bookmarkBtn.is-bookmarked svg path {
  fill: #f59e0b;
  stroke: #f59e0b;
}