/* App-level styles for the web-app UI kit */
/* =============================================================
   AutoInspect AI — Design Tokens
   Colors, type, spacing, radii, shadows, motion
   ============================================================= */

/* ---- Fonts (Google Fonts — see README for substitution note) -- */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ---------- COLOR — Brand violet ramp ---------- */
  --violet-50:  #F4F0FF;
  --violet-100: #EDE6FF;
  --violet-200: #DDD0FF;
  --violet-300: #C3B0FF;
  --violet-400: #9C82FF;
  --violet-500: #7C5CFF;   /* primary */
  --violet-600: #6A45F2;   /* primary hover */
  --violet-700: #5A35DB;   /* primary pressed */
  --violet-800: #4326B0;
  --violet-900: #2A1773;

  /* gradient stops used everywhere on CTAs, halos, accents */
  --grad-violet-start: #8B6BFF;
  --grad-violet-end:   #5A35DB;
  --grad-halo-start:   #E5DBFF;
  --grad-halo-end:     #F4F0FF;

  /* ---------- COLOR — Neutrals (warm-cool ink) ---------- */
  --ink-50:  #FAFAFD;
  --ink-100: #F4F4F8;
  --ink-200: #E8E6F0;
  --ink-300: #D2CFE0;
  --ink-400: #9C97B2;
  --ink-500: #6E6987;
  --ink-600: #4B4666;
  --ink-700: #2F2B47;
  --ink-800: #1E1B36;
  --ink-900: #0F0D24;

  /* ---------- COLOR — Surface ---------- */
  --bg-page:        #F8F5FF;   /* the lavender page wash */
  --bg-page-deep:   #EFE9FF;   /* gradient pair for page bg */
  --bg-card:        #FFFFFF;
  --bg-card-soft:   #FBFAFF;
  --bg-glass:       rgba(255, 255, 255, 0.72);
  --bg-overlay:     rgba(15, 13, 36, 0.45);

  /* ---------- COLOR — Borders ---------- */
  --border-soft:    #ECE7F8;
  --border-medium:  #DDD5EE;
  --border-strong:  #C3B7E2;
  --border-focus:   #7C5CFF;

  /* ---------- COLOR — Semantic ---------- */
  --success-50:  #ECFDF5;
  --success-500: #22C55E;
  --success-600: #16A34A;
  --success-700: #15803D;

  --warning-50:  #FFFBEB;
  --warning-500: #F59E0B;
  --warning-600: #D97706;

  --danger-50:   #FEF2F2;
  --danger-500:  #EF4444;
  --danger-600:  #DC2626;
  --danger-700:  #B91C1C;

  --info-50:     #EFF6FF;
  --info-500:    #3B82F6;

  /* magenta accent — only used in results bbox + charts */
  --accent-magenta: #FF4FC6;
  --accent-cyan:    #4FC4FF;

  /* ---------- COLOR — Foreground (semantic) ---------- */
  --fg-strong:    var(--ink-900);
  --fg-default:   var(--ink-800);
  --fg-muted:     var(--ink-500);
  --fg-subtle:    var(--ink-400);
  --fg-on-violet: #FFFFFF;
  --fg-link:      var(--violet-600);

  /* ---------- TYPE — Families ---------- */
  --font-sans: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: 'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* ---------- TYPE — Scale (rem-relative; html=16px) ---------- */
  --text-2xs: 11px;
  --text-xs:  12px;
  --text-sm:  13px;
  --text-md:  14px;
  --text-base:15px;
  --text-lg:  17px;
  --text-xl:  20px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  --text-4xl: 36px;
  --text-5xl: 48px;

  /* ---------- TYPE — Weights ---------- */
  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;
  --fw-black:   800;

  /* ---------- TYPE — Leading + tracking ---------- */
  --lh-tight: 1.15;
  --lh-snug:  1.3;
  --lh-base:  1.5;
  --lh-loose: 1.7;
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide:  0.04em;
  --tracking-caps:  0.12em;

  /* ---------- SPACING (4px base) ---------- */
  --space-0:  0;
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-7:  32px;
  --space-8:  40px;
  --space-9:  48px;
  --space-10: 64px;
  --space-11: 80px;

  /* ---------- RADII ---------- */
  --radius-xs:  6px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-2xl: 28px;
  --radius-pill: 999px;

  /* ---------- SHADOWS / ELEVATION ----------
     Soft, diffuse, violet-tinted. Never harsh black. */
  --shadow-xs: 0 1px 2px rgba(60, 40, 130, 0.05);
  --shadow-sm: 0 2px 6px rgba(60, 40, 130, 0.06), 0 1px 2px rgba(60, 40, 130, 0.04);
  --shadow-md: 0 8px 24px rgba(60, 40, 130, 0.08), 0 2px 6px rgba(60, 40, 130, 0.05);
  --shadow-lg: 0 20px 48px rgba(60, 40, 130, 0.12), 0 4px 12px rgba(60, 40, 130, 0.06);
  --shadow-xl: 0 32px 72px rgba(60, 40, 130, 0.18), 0 8px 16px rgba(60, 40, 130, 0.08);
  --shadow-focus: 0 0 0 4px rgba(124, 92, 255, 0.22);
  --shadow-glow-violet: 0 0 32px rgba(124, 92, 255, 0.35), 0 8px 24px rgba(90, 53, 219, 0.25);

  /* inner highlights — used on glass cards */
  --shadow-inset-top: inset 0 1px 0 rgba(255, 255, 255, 0.9);

  /* ---------- MOTION ---------- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 120ms;
  --dur-base: 220ms;
  --dur-slow: 380ms;

  /* ---------- LAYOUT ---------- */
  --container-max: 1440px;
  --sidebar-w: 280px;
  --topbar-h: 72px;
}

/* =============================================================
   Semantic element styles — apply automatically
   ============================================================= */
html, body {
  font-family: var(--font-sans);
  color: var(--fg-default);
  background: var(--bg-page);
  font-size: var(--text-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, .h1 {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--fg-strong);
  margin: 0;
}
h2, .h2 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--fg-strong);
  margin: 0;
}
h3, .h3 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--fw-semi);
  line-height: var(--lh-snug);
  color: var(--fg-strong);
  margin: 0;
}
h4, .h4 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--fw-semi);
  line-height: var(--lh-snug);
  color: var(--fg-strong);
  margin: 0;
}
h5, .h5 {
  font-size: var(--text-lg);
  font-weight: var(--fw-semi);
  line-height: var(--lh-snug);
  color: var(--fg-strong);
  margin: 0;
}

p, .body {
  font-size: var(--text-base);
  line-height: var(--lh-base);
  color: var(--fg-default);
  margin: 0;
}

.body-sm   { font-size: var(--text-sm); line-height: var(--lh-base); color: var(--fg-default); }
.body-muted{ color: var(--fg-muted); }
.caption   { font-size: var(--text-xs); line-height: var(--lh-base); color: var(--fg-muted); }
.eyebrow   {
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--violet-600);
}

code, .code, pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--ink-700);
  background: var(--violet-50);
  border-radius: var(--radius-xs);
  padding: 2px 6px;
}

/* link */
a {
  color: var(--fg-link);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--violet-700); }

/* utility — the brand gradient text */
.text-gradient {
  background: linear-gradient(135deg, var(--grad-violet-start), var(--grad-violet-end));
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

/* utility — the violet CTA gradient */
.bg-grad-violet {
  background: linear-gradient(135deg, var(--grad-violet-start) 0%, var(--grad-violet-end) 100%);
}

/* utility — the page background */
.bg-page-grad {
  background:
    radial-gradient(1100px 700px at 12% 6%, #EFE6FF 0%, transparent 60%),
    radial-gradient(900px 600px at 95% 100%, #F4ECFF 0%, transparent 65%),
    linear-gradient(180deg, #FAF7FF 0%, #F4EEFF 100%);
}


*, *::before, *::after { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  background:
    radial-gradient(1100px 700px at 12% 6%, #EFE6FF 0%, transparent 60%),
    radial-gradient(900px 600px at 95% 100%, #F4ECFF 0%, transparent 65%),
    linear-gradient(180deg, #FAF7FF 0%, #F4EEFF 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}
html.dark body {
  background:
    radial-gradient(1100px 700px at 12% 6%, rgba(90,53,219,.15) 0%, transparent 60%),
    radial-gradient(900px 600px at 95% 100%, rgba(124,92,255,.1) 0%, transparent 65%),
    linear-gradient(180deg, #0E0C20 0%, #0A0918 100%);
  background-attachment: fixed;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ---------------- Layout shell ---------------- */
.app { height: 100vh; display: flex; overflow: hidden; }
.app__main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.app__content { flex: 1; padding: 8px 24px 8px; min-width: 0; overflow-y: auto; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  padding: 14px 14px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 400px at 20% 20%, rgba(229,219,255,0.5), transparent 70%);
  pointer-events: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.brand__title { font-size: 16px; font-weight: 700; color: var(--ink-900); line-height: 1.1; }
.brand__title em { color: var(--violet-500); font-style: normal; }
.brand__sub { font-size: 12px; color: var(--ink-500); font-weight: 500; margin-top: 2px; }

.hero-car {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 8px 8px 4px;
  text-align: center;
}
.hero-car svg { width: 100%; max-width: 180px; filter: drop-shadow(0 18px 22px rgba(124,92,255,.18)); }
.hero-car__shield {
  position: absolute;
  right: 20px;
  top: 24px;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(124,92,255,.85), rgba(90,53,219,.85));
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(124,92,255,.4);
  color: #fff;
  font: 700 13px var(--font-display);
  letter-spacing: .04em;
}

.ai-intro { position: relative; z-index: 1; }
.ai-intro h4 { font-size: 15px; font-weight: 700; color: var(--ink-900); margin: 0 0 4px; }
.ai-intro p { font-size: 11px; line-height: 1.5; color: var(--ink-500); margin: 0; }

.steps { display: flex; flex-direction: column; gap: 6px; position: relative; z-index: 1; }
.step {
  display: flex;
  align-items: center;
  gap: 12px;
}
.step__num {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font: 700 11px var(--font-mono);
  color: var(--ink-500);
  background: #fff;
  border: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.step--active .step__num {
  background: linear-gradient(135deg, var(--grad-violet-start), var(--grad-violet-end));
  color: #fff;
  border: 0;
  box-shadow: 0 4px 12px rgba(124,92,255,.35);
}
.step__body {
  flex: 1;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 10px;
}
.step__icon {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--violet-50); color: var(--violet-600);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step__title { font-weight: 600; font-size: 12px; color: var(--ink-800); }
.step__sub   { font-size: 10px; color: var(--ink-500); margin-top: 1px; }

.ready-card {
  margin-top: auto;
  position: relative; z-index: 1;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(20px);
  border-radius: 12px;
  padding: 10px;
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border-soft);
}
.ready-card__icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--violet-50);
  display: flex; align-items: center; justify-content: center;
  color: var(--violet-600);
}
.ready-card__title { font-weight: 700; font-size: 14px; color: var(--ink-800); }
.ready-card__sub   { font-size: 11px; color: var(--ink-500); }

/* ---------------- Topbar ---------------- */
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 12px 24px 6px;
  gap: 16px;
  flex-shrink: 0;
}
.topbar__title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar__mark {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.topbar__title h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--ink-900); }
.topbar__title p  { font-size: 13px; color: var(--ink-500); margin-top: 2px; }
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px;
  background: #fff; border: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-700);
  transition: all .2s var(--ease-out);
}
.icon-btn:hover { color: var(--violet-600); border-color: var(--violet-300); }
.help-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 18px;
  background: #fff; border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--ink-800);
  font-weight: 600; font-size: 14px;
  transition: all .2s var(--ease-out);
}
.help-btn:hover { border-color: var(--violet-300); color: var(--violet-600); }

/* ---------------- Capture page layout ---------------- */
.capture {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: stretch;
  height: 100%;
}
.upload-center {
  position: relative;
  width: min(760px, 100%);
  min-height: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 34px 28px 28px;
  background:
    radial-gradient(circle at 50% 42%, rgba(244,240,255,.72), transparent 46%),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.9));
  border: 1px solid rgba(221, 212, 246, .82);
  border-radius: 32px;
  box-shadow: 0 24px 70px rgba(78, 55, 145, .11), inset 0 1px 0 rgba(255,255,255,.9);
}
.capture-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 0;
  overflow: hidden;
  justify-content: center;
}

/* ---------------- Upload ring ---------------- */
.ring-wrap { position: relative; width: 340px; height: 340px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }.ring-halo {
  position: absolute; inset: -20px;
  background: radial-gradient(circle at center, rgba(229,219,255,.65) 0%, transparent 65%);
  border-radius: 50%;
  animation: pulse 4s var(--ease-in-out) infinite;
}
@keyframes pulse { 0%,100% { opacity: .85; transform: scale(1); } 50% { opacity: 1; transform: scale(1.02); } }

.ring-track {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px dashed var(--violet-300);
  background:
    radial-gradient(circle at center, #fff 30%, rgba(255,255,255,.6) 70%, transparent 100%);
}
.ring-progress {
  position: absolute; inset: 0;
  transform: rotate(-90deg);
}
.ring-progress circle {
  fill: none;
  stroke: url(#prog-grad);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset .6s var(--ease-out);
}
.ring-inner {
  position: relative; z-index: 2;
  text-align: center; padding: 0 20px;
}
.ring-cloud {
  width: 52px; height: 52px; border-radius: 50%;
  background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--violet-600);
  box-shadow: var(--shadow-glow-violet);
  margin: 0 auto 6px;
}
.ring-inner h3 { font-size: 20px; font-weight: 700; color: var(--ink-900); letter-spacing: -.01em; }
.ring-inner .sub { font-size: 13px; color: var(--ink-500); margin: 4px 0; }
.ring-inner .or  { font-size: 12px; color: var(--ink-400); margin: 5px 0; }
.ring-inner .formats { font-size: 11px; color: var(--ink-500); margin-top: 8px; line-height: 1.5; }
.ring-inner .max-chip {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 8px;
  padding: 5px 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--border-soft);
  font-size: 11px; color: var(--ink-600);
  box-shadow: var(--shadow-xs);
}

.btn { display: inline-flex; align-items: center; gap: 8px; font: 600 14px var(--font-sans); border: 0; transition: all .2s var(--ease-out); cursor: pointer; }
.btn-primary {
  color: #fff; padding: 11px 22px; border-radius: 12px;
  background: linear-gradient(135deg, var(--grad-violet-start), var(--grad-violet-end));
  box-shadow: 0 10px 24px rgba(124,92,255,.35), 0 4px 8px rgba(90,53,219,.22);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(124,92,255,.45), 0 6px 12px rgba(90,53,219,.28); }
.btn-primary:active { transform: translateY(0); background: var(--violet-700); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary {
  color: var(--violet-700); background: #fff; border: 1px solid var(--border-medium);
  padding: 10px 18px; border-radius: 12px;
}
.btn-secondary:hover { border-color: var(--violet-400); background: var(--violet-50); }
.btn-ghost {
  color: var(--violet-700); background: var(--violet-50);
  padding: 10px 16px; border-radius: 12px;
}
.btn-ghost:hover { background: var(--violet-100); }
.btn-danger { color:#fff; background: var(--danger-600); padding: 10px 18px; border-radius: 12px; }
.btn-danger:hover { background: var(--danger-700); }

/* ---------------- Thumbnails ---------------- */
.thumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 440px; }
.thumb {
  width: 50px; height: 50px; border-radius: 7px;
  background: #1E1B36; overflow: hidden; position: relative;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb__x {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; color: var(--ink-700);
  display: flex; align-items: center; justify-content: center;
  border: 0; font-size: 12px;
  box-shadow: var(--shadow-sm);
}
.thumb-add {
  width: 50px; height: 50px; border-radius: 7px;
  background: rgba(255,255,255,.6);
  border: 2px dashed var(--violet-300);
  display: flex; align-items: center; justify-content: center;
  color: var(--violet-500);
  flex-shrink: 0;
  cursor: pointer;
}
.thumb-add:hover { background: var(--violet-50); }
.thumb-count {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ink-600); margin-top: 2px;
}
.thumb-count::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--violet-500);
}

/* ---------------- OCR right panel ---------------- */
.ocr {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 14px 18px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-soft);
  display: flex; flex-direction: column; gap: 10px;
  max-height: 100%;
  overflow-y: auto;
}
.ocr__head { display: flex; align-items: center; gap: 12px; }
.ocr__head .icon-wrap {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--violet-50); color: var(--violet-600);
  display: flex; align-items: center; justify-content: center;
}
.ocr__head h4 { font-size: 15px; font-weight: 700; color: var(--ink-900); }
.ocr__head h4 .opt { font-weight: 500; color: var(--ink-400); font-size: 14px; margin-left: 6px; }
.ocr__progress {
  height: 4px; border-radius: 2px;
  background: var(--violet-100);
  overflow: hidden;
}
.ocr__progress > div { height: 100%; background: linear-gradient(90deg, var(--grad-violet-start), var(--grad-violet-end)); width: 60%; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0;}
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-700); }
.required-mark {
  color: var(--danger-600);
  font-weight: 800;
  margin-left: 3px;
}
.field .ctrl {
  min-width: 0;
  overflow: hidden;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px;
  background: #fff; border: 1px solid var(--border-medium);
  color: var(--ink-700);
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.field .ctrl:focus-within { border-color: var(--violet-500); box-shadow: var(--shadow-focus); }
.field .ctrl input, .field .ctrl select {
  min-width: 0;
  flex: 1; border: 0; outline: 0; background: transparent; font-size: 14px; color: var(--ink-800);
}
.field .ctrl .chev { color: var(--ink-400); }
.field textarea {
  resize: vertical;
  padding: 10px 12px; border-radius: 12px;
  background: #fff; border: 1px solid var(--border-medium);
  font-size: 14px; color: var(--ink-800); min-height: 56px;
  outline: 0;
}
.field textarea:focus { border-color: var(--violet-500); box-shadow: var(--shadow-focus); }
.field .counter { font-size: 11px; color: var(--ink-400); align-self: flex-end; margin-top: 4px; }

/* OCR upload duo */
.ocr-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ocr-slot {
  position: relative;
  border-radius: 14px;
  border: 1.5px dashed var(--violet-300);
  background: rgba(244,240,255,.5);
  min-height: 70px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--violet-700);
  cursor: pointer;
  transition: all .2s var(--ease-out);
  text-align: center;
  padding: 12px;
}
.ocr-slot:hover { background: var(--violet-50); border-color: var(--violet-500); }
.ocr-slot.filled {
  border-style: solid; border-color: var(--success-500); background: var(--success-50);
  color: var(--success-700);
}
.ocr-slot__label { font-size: 12px; font-weight: 600; }
.ocr-slot__hint  { font-size: 11px; color: var(--ink-500); }
.ocr-slot.filled .ocr-slot__hint { color: var(--success-700); }
.ocr-status {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--violet-50);
  border: 1px solid var(--border-soft);
  color: var(--ink-600);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
.ocr-status--done { background: var(--success-50); color: var(--success-700); border-color: var(--success-500); }
.ocr-status--running { color: var(--violet-700); border-color: var(--violet-200); }
.ocr-status--error,
.ocr-status--unavailable { background: var(--warning-50); color: var(--warning-700); border-color: var(--warning-500); }

.info-tip {
  display: flex; gap: 10px;
  padding: 10px; border-radius: 12px;
  background: var(--violet-50);
  border: 1px solid var(--violet-100);
}
.info-tip__icon { color: var(--violet-600); flex-shrink: 0; }
.info-tip__title { font-weight: 600; font-size: 13px; color: var(--violet-700); }
.info-tip__body  { font-size: 12px; color: var(--ink-600); line-height: 1.55; margin-top: 4px; }

/* ---------------- Launch bar ---------------- */
.launch-bar {
  margin-top: auto;
  background: #fff;
  border-radius: 14px;
  padding: 10px 18px;
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  position: relative;
  flex-shrink: 0;
}
.launch-bar__side {
  display: flex; align-items: center; gap: 12px;
}
.launch-bar__side--right { justify-content: flex-end; }
.launch-bar .icon-wrap {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--violet-50); color: var(--violet-600);
  display: flex; align-items: center; justify-content: center;
}
.launch-bar__label { font-weight: 700; color: var(--ink-900); font-size: 13px; }
.launch-bar__hint  { font-size: 12px; color: var(--ink-500); display: flex; align-items: center; gap: 6px; }
.launch-bar__hint .check { color: var(--success-500); }

.launch-cta {
  background: linear-gradient(135deg, var(--grad-violet-start), var(--grad-violet-end));
  color: #fff;
  padding: 10px 20px;
  border-radius: 12px;
  border: 0;
  font: 700 13px var(--font-sans);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: center;
  box-shadow: 0 14px 32px rgba(124,92,255,.42), 0 4px 8px rgba(90,53,219,.25);
  transition: all .2s var(--ease-out);
  min-width: 180px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer;
}
.launch-cta:hover { transform: translateY(-1px); box-shadow: 0 18px 36px rgba(124,92,255,.55), 0 6px 12px rgba(90,53,219,.32); }
.launch-cta:active { transform: translateY(0); }
.launch-cta:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: var(--shadow-md); }
.launch-cta__sub { font-weight: 500; font-size: 10px; opacity: .9; text-transform: none; letter-spacing: 0; }

.security-line {
  text-align: center;
  font-size: 10px;
  color: var(--ink-500);
  margin: 2px 0 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* ---------------- Modal ---------------- */
.scrim {
  position: fixed; inset: 0;
  background: rgba(15, 13, 36, 0.45);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: fade .2s var(--ease-out);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: 24px;
  max-width: 600px;
  width: 100%;
  padding: 32px;
  box-shadow: var(--shadow-xl);
  animation: lift .28s var(--ease-out);
}
@keyframes lift { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal__head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.modal__icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.modal__icon--warn { background: var(--warning-50); color: var(--warning-600); }
.modal__icon--danger { background: var(--danger-50); color: var(--danger-600); }
.modal h3 { font-size: 22px; font-weight: 700; color: var(--ink-900); }
.modal__sub { font-size: 14px; color: var(--ink-500); margin-top: 6px; line-height: 1.55; }

.modal__list {
  background: var(--violet-50);
  border-radius: 14px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  margin: 18px 0;
  max-height: 260px;
  overflow-y: auto;
}
.modal__list-item {
  display: flex; align-items: center; gap: 12px;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow-xs);
}
.modal__list-item .thumb-mini { width: 44px; height: 44px; border-radius: 8px; background: #2A1773; overflow:hidden; }
.modal__list-item .thumb-mini img { width: 100%; height: 100%; object-fit: cover; }
.modal__list-item .meta { flex: 1; }
.modal__list-item .meta .name { font-weight: 600; font-size: 13px; color: var(--ink-800); }
.modal__list-item .meta .why  { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.modal__list-item .tag {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
}
.tag--warn { background: var(--warning-50); color: var(--warning-600); }
.tag--danger { background: var(--danger-50); color: var(--danger-600); }

.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
/* ===== DARK MODE ===== */
html.dark .sidebar::before {
  background: radial-gradient(600px 400px at 20% 20%, rgba(90,53,219,0.15), transparent 70%);
}
html.dark .step__body,
html.dark .icon-btn,
html.dark .ready-card {
  background: #171432;
  border-color: #2A2548;
}
html.dark .step__num {
  background: #171432;
  border-color: #2A2548;
}
html.dark .ocr {
  background: rgba(23, 20, 50, 0.85);
  border-color: #2A2548;
}
html.dark .field .ctrl {
  background: #171432;
  border-color: #352F5A;
}
html.dark .field .ctrl input,
html.dark .field .ctrl select {
  color: #EEEAF8;
}
html.dark .field textarea {
  background: #171432;
  border-color: #352F5A;
  color: #EEEAF8;
}
html.dark .upload-center {
  background:
    radial-gradient(circle at 50% 42%, rgba(61,45,110,.36), transparent 48%),
    linear-gradient(180deg, #171432, #141129);
  border-color: #2A2548;
  box-shadow: 0 24px 70px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.05);
}
html.dark .ring-track {
  border-color: #3D2D6E;
  background: radial-gradient(circle at center, #171432 30%, rgba(23,20,50,.6) 70%, transparent 100%);
}
html.dark .ring-cloud {
  background: #171432;
}
html.dark .launch-bar {
  background: #171432;
  border: 1px solid #2A2548;
}
html.dark .modal {
  background: #171432;
  border: 1px solid #2A2548;
}
html.dark .modal__list { background: #1A1430; }
html.dark .modal__list-item { background: #1A1735; }
html.dark .ocr-slot {
  background: rgba(26,20,48,.5);
  border-color: #3D2D6E;
}
html.dark .ocr-slot.filled {
  border-color: #22C55E;
  background: #0D2818;
}
html.dark .ocr-status {
  background: #1A1735;
  border-color: #2A2548;
  color: #C9C2E6;
}
html.dark .info-tip {
  background: #1A1430;
  border-color: #221A3D;
}
html.dark .thumb-add {
  background: rgba(26,20,48,.5);
  border-color: #3D2D6E;
}
html.dark .max-chip {
  background: #171432;
  border-color: #2A2548;
}
html.dark {
  --violet-50:  #1A1430;  --violet-100: #221A3D;
  --violet-200: #2E2252;  --violet-300: #3D2D6E;
  --violet-400: #6B50B8;  --violet-500: #8B6BFF;
  --violet-600: #9F83FF;  --violet-700: #B39DFF;
  --violet-800: #CFC0FF;  --violet-900: #EDE6FF;

  --ink-50:  #0F0D24;   --ink-100: #1A1835;
  --ink-200: #252245;   --ink-300: #352F5A;
  --ink-400: #6E6987;   --ink-500: #9C97B2;
  --ink-600: #C4C0D5;   --ink-700: #DDD9EC;
  --ink-800: #EEEAF8;   --ink-900: #FAFAFD;

  --bg-page: #0E0C20;     --bg-card: #171432;
  --bg-glass: rgba(23, 20, 50, 0.85);
  --border-soft: #2A2548;  --border-medium: #352F5A;

  --success-50: #0D2818;  --danger-50: #2A0F0F;
  --warning-50: #2A1F05;

  --fg-strong: #FAFAFD;   --fg-default: #EEEAF8;
  --fg-muted: #9C97B2;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.25);
  --shadow-sm: 0 2px 6px rgba(0,0,0,.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,.35);
  --shadow-focus: 0 0 0 4px rgba(139, 107, 255, 0.35);
  --shadow-glow-violet: 0 0 32px rgba(139, 107, 255, 0.3);
}

html.dark, html.dark body {
  background: #0E0C20;
  color: #EEEAF8;
}
