/* ==========================================================================
   advisioflow.css — shared design system
   --------------------------------------------------------------------------
   One stylesheet, loaded on every page before its own <style> block. Pages
   reference tokens and component classes from here instead of hardcoding
   colors and spacing, so the whole product restyles from one place.

   Layers, in order:
     1. Tokens        CSS variables — the single source of truth
     2. Reset & base  sensible defaults, typography
     3. Layout        the app shell (works alongside sidebar.js)
     4. Components     buttons, cards, forms, tables, badges, modals, toasts
     5. Utilities      spacing/flex helpers used sparingly
   ========================================================================== */

/* ---- Type, loaded once --------------------------------------------------
   Inter carries the whole app. Newsreader is reserved for moments that want
   a touch of editorial weight — a login welcome, a marketing headline — not
   for dense data screens, which stay in Inter for scanability. ------------ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,500&display=swap');

/* ========================================================================== *
 * 1. TOKENS
 * ========================================================================== */
:root {
  /* Brand — deep navy shell, emerald as the one accent */
  --navy-900: #0D1626;   /* sidebar / darkest */
  --navy-800: #14213D;   /* headers, wordmark */
  --navy-700: #1B2A4A;
  --navy-600: #24345A;
  --navy-400: #5A6B8C;

  --emerald-600: #0E9F6E;  /* primary actions */
  --emerald-500: #10B981;  /* accent, active states */
  --emerald-100: #D1FAE5;
  --emerald-50:  #ECFDF5;

  /* Neutrals */
  --bg:        #EEF1F6;   /* app background — cooler so cards pop */
  --surface:   #FFFFFF;   /* cards */
  --surface-2: #F4F7FA;   /* inset panels, table headers */
  --border:    #E6EBF2;
  --border-2:  #CBD4E1;

  --text:      #1A2233;   /* primary text */
  --text-2:    #4B5768;   /* secondary */
  --muted:     #8895A7;   /* captions, meta */

  /* Status */
  --success:   #0E9F6E;  --success-bg: #E7F7F0;  --success-tx: #0A7350;
  --warning:   #D9820A;  --warning-bg: #FEF4E5;  --warning-tx: #92610A;
  --error:     #D64545;  --error-bg:   #FCECEC;  --error-tx:   #9B2C2C;
  --info:      #2563EB;  --info-bg:    #E8F0FE;  --info-tx:    #1E48A8;

  /* Radius */
  --r-sm: 6px;  --r-md: 10px;  --r-lg: 16px;  --r-pill: 100px;

  /* Shadow — layered for real depth, cards should lift off the page */
  --sh-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
  --sh-md: 0 2px 4px rgba(15,23,42,.04), 0 6px 16px rgba(15,23,42,.08);
  --sh-lg: 0 4px 8px rgba(15,23,42,.05), 0 16px 40px rgba(15,23,42,.14);
  --sh-xl: 0 8px 16px rgba(15,23,42,.06), 0 24px 60px rgba(15,23,42,.18);
  --sh-focus: 0 0 0 3px rgba(16,185,129,.22);
  --sh-emerald: 0 6px 18px rgba(16,185,129,.28);

  /* Spacing scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;

  /* Type scale */
  --fs-xs: 11.5px; --fs-sm: 12.5px; --fs-base: 14px; --fs-md: 15px;
  --fs-lg: 17px; --fs-xl: 20px; --fs-2xl: 24px; --fs-3xl: 30px;

  --font: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --serif: 'Newsreader', Georgia, serif;

  /* App shell metrics — kept in sync with sidebar.js */
  --sidebar-w: 236px;
  --sidebar-collapsed: 64px;
  --content-max: 1180px;
}

/* ========================================================================== *
 * 2. RESET & BASE
 * ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { color: var(--navy-800); line-height: 1.2; font-weight: 700; }
h1 { font-size: 26px; letter-spacing: -0.03em; font-weight: 800; }
h2 { font-size: var(--fs-lg); letter-spacing: -0.01em; }
h3 { font-size: var(--fs-md); }

a { color: var(--emerald-600); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--emerald-100); color: var(--navy-800); }

/* Visible keyboard focus everywhere — quality floor */
:focus-visible {
  outline: 2px solid var(--emerald-500);
  outline-offset: 2px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ========================================================================== *
 * 3. LAYOUT — the app shell
 * sidebar.js sets body padding-left; these give pages a consistent frame.
 * ========================================================================== */
.app-main {
  padding: var(--s-6) var(--s-8) var(--s-12);
  max-width: calc(var(--content-max) + var(--s-8) * 2);
  margin: 0 auto;
}

/* Top bar — sits at the top of a page's main content */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.topbar__titles { min-width: 0; }
.topbar__breadcrumb {
  font-size: var(--fs-sm); color: var(--muted); margin-bottom: 3px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.topbar__breadcrumb a { color: var(--muted); }
.topbar__breadcrumb a:hover { color: var(--text-2); }
.topbar__breadcrumb .sep { color: var(--border-2); }
.topbar__actions { display: flex; align-items: center; gap: var(--s-3); flex: none; }

/* User chip / avatar */
.user-chip { display: flex; align-items: center; gap: var(--s-3); font-size: var(--fs-sm); color: var(--text-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-sm); flex: none;
}
.avatar--navy { background: linear-gradient(135deg, var(--navy-600), var(--navy-800)); }

/* Section heading with optional action on the right */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: var(--s-8) 0 var(--s-4);
}
.section-head:first-child { margin-top: 0; }
.section-head h2, .section-head h3 { margin: 0; }
.section-head .hint { font-size: var(--fs-sm); color: var(--muted); }

/* ========================================================================== *
 * 4. COMPONENTS
 * ========================================================================== */

/* ---- Cards -------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
}
.card--pad { padding: var(--s-6); }
.card + .card { margin-top: var(--s-5); }
.card__head {
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
}
.card__head h2, .card__head h3 { margin: 0; }
.card__body { padding: var(--s-6); }
.card--hover { transition: transform .14s ease, box-shadow .14s ease; }
.card--hover:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); }

/* ---- Stat cards --------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-4); }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--s-5) var(--s-5) var(--s-6);
  box-shadow: var(--sh-md); position: relative; overflow: hidden;
  transition: transform .14s ease, box-shadow .14s ease;
}
.stat::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--emerald-500), var(--emerald-600));
  opacity: 0; transition: opacity .14s ease;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); }
.stat:hover::before { opacity: 1; }
.stat__icon {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--emerald-50); color: var(--emerald-600);
  font-size: var(--fs-md); margin-bottom: var(--s-4);
  box-shadow: inset 0 0 0 1px rgba(16,185,129,.12);
}
.stat__num { font-size: 34px; font-weight: 800; color: var(--navy-800); letter-spacing: -0.03em; line-height: 1; }
.stat__label { font-size: var(--fs-sm); color: var(--muted); margin-top: var(--s-3); font-weight: 500; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  font-family: inherit; font-size: var(--fs-base); font-weight: 600;
  padding: 10px 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .55; cursor: not-allowed; }
.btn:hover { text-decoration: none; }

.btn--primary { background: var(--emerald-600); color: #fff; box-shadow: var(--sh-emerald); }
.btn--primary:hover:not(:disabled) { background: #0C8A5F; box-shadow: 0 8px 22px rgba(16,185,129,.36); }

.btn--navy { background: var(--navy-800); color: #fff; }
.btn--navy:hover:not(:disabled) { background: var(--navy-700); }

.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border-2); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); }

.btn--subtle { background: var(--surface-2); color: var(--text); }
.btn--subtle:hover:not(:disabled) { background: #E4EAF1; }

.btn--danger { background: var(--surface); color: var(--error-tx); border-color: #EBC4C4; }
.btn--danger:hover:not(:disabled) { background: var(--error-bg); }

.btn--sm { padding: 7px 12px; font-size: var(--fs-sm); }
.btn--lg { padding: 13px 22px; font-size: var(--fs-md); }
.btn--block { width: 100%; }
.btn--icon { padding: 8px; }

/* ---- Forms -------------------------------------------------------------- */
.field { margin-bottom: var(--s-4); }
.field > label, .label {
  display: block; font-size: var(--fs-sm); font-weight: 600;
  color: var(--text-2); margin-bottom: 6px;
}
.input, .select, .textarea,
input[type="text"].input, input[type="email"].input, input[type="password"].input {
  width: 100%; font-family: inherit; font-size: var(--fs-base); color: var(--text);
  padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--emerald-500); box-shadow: var(--sh-focus);
}
.textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.field__hint { font-size: var(--fs-xs); color: var(--muted); margin-top: 5px; }

/* ---- Badges ------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-xs); font-weight: 600; padding: 3px 10px;
  border-radius: var(--r-pill); line-height: 1.4; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge--neutral { background: var(--surface-2); color: var(--text-2); }
.badge--success { background: var(--success-bg); color: var(--success-tx); }
.badge--warning { background: var(--warning-bg); color: var(--warning-tx); }
.badge--error   { background: var(--error-bg);   color: var(--error-tx); }
.badge--info    { background: var(--info-bg);     color: var(--info-tx); }
.badge--no-dot::before { display: none; }

/* ---- Tables ------------------------------------------------------------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
table.data th {
  text-align: left; padding: 12px 16px; background: var(--surface-2);
  color: var(--text-2); font-size: var(--fs-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
table.data td { padding: 14px 16px; border-top: 1px solid var(--border); color: var(--text); vertical-align: middle; }
table.data tbody tr { transition: background .1s ease; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data tr:first-child td { border-top: none; }

/* ---- Banners / inline alerts ------------------------------------------- */
.banner {
  padding: 12px 14px; border-radius: var(--r-md); font-size: var(--fs-sm);
  line-height: 1.55; border-left: 3px solid transparent;
}
.banner--info    { background: var(--info-bg);    color: var(--info-tx);    border-color: var(--info); }
.banner--success { background: var(--success-bg); color: var(--success-tx); border-color: var(--success); }
.banner--warning { background: var(--warning-bg); color: var(--warning-tx); border-color: var(--warning); }
.banner--error   { background: var(--error-bg);   color: var(--error-tx);   border-color: var(--error); }

/* ---- Modals ------------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(13,22,38,.55);
  display: none; align-items: center; justify-content: center; z-index: 1000; padding: var(--s-6);
  animation: overlay-in .15s ease;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--r-lg);
  width: 100%; max-width: 440px; box-shadow: var(--sh-lg);
  animation: modal-in .18s cubic-bezier(.2,.8,.2,1);
  max-height: 90vh; display: flex; flex-direction: column;
}
.modal--wide { max-width: 760px; }
.modal__head { padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal__head h2, .modal__head h3 { margin: 0; }
.modal__body { padding: var(--s-6); overflow-y: auto; }
.modal__foot { padding: var(--s-4) var(--s-6); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--s-3); }
.modal__x { background: none; border: none; cursor: pointer; font-size: 22px; line-height: 1; color: var(--muted); padding: 4px; border-radius: var(--r-sm); }
.modal__x:hover { color: var(--text); background: var(--surface-2); }

@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---- Workflow stepper — the product's spine ----------------------------
   Every case moves through the same five stages. This is the one element
   that has to communicate "flow" at a glance: where you are, what's done,
   what's next — so the done/active states carry more visual weight than a
   typical stepper (filled connecting line, elevated active dot, a quiet
   pulse ring) without tipping into decoration. --------------------------- */
.workflow {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
  padding: var(--s-5) var(--s-6); margin-bottom: var(--s-6);
}
.workflow__label { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: var(--s-5); }
.workflow__steps { display: flex; align-items: flex-start; }
.wf-step { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: none; width: 108px; }
.wf-step__dot {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-sm); position: relative;
  background: var(--surface-2); color: var(--muted); border: 1.5px solid var(--border-2);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease;
}
.wf-step__text { font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; text-align: center; transition: color .18s ease; }
.wf-step--done .wf-step__dot { background: var(--emerald-500); color: #fff; border-color: var(--emerald-500); }
.wf-step--active .wf-step__dot {
  background: var(--navy-800); color: #fff; border-color: var(--navy-800);
  box-shadow: 0 0 0 5px rgba(20,33,61,.10);
}
.wf-step--active .wf-step__dot::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1.5px solid var(--navy-800); opacity: 0; animation: wf-pulse 2.2s ease-out infinite;
}
.wf-step--active .wf-step__text { color: var(--navy-800); font-weight: 700; }
.wf-line { flex: 1; height: 2px; background: var(--border); margin: 16px 0 0; min-width: 20px; }
.wf-line--done { background: var(--emerald-500); }
a.wf-step { text-decoration: none; }
a.wf-step:hover .wf-step__dot { border-color: var(--navy-600); }
a.wf-step:hover .wf-step__text { color: var(--navy-800); text-decoration: none; }

@keyframes wf-pulse {
  0% { opacity: .5; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.35); }
}
@media (prefers-reduced-motion: reduce) { .wf-step--active .wf-step__dot::after { animation: none; display: none; } }

/* ---- Empty & loading states -------------------------------------------- */
.empty {
  text-align: center; padding: var(--s-10) var(--s-6); color: var(--muted);
}
.empty__icon { font-size: 32px; margin-bottom: var(--s-3); opacity: .5; }
.empty__title { font-size: var(--fs-md); font-weight: 600; color: var(--text-2); margin-bottom: var(--s-2); }
.empty__text { font-size: var(--fs-sm); max-width: 360px; margin: 0 auto var(--s-4); }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, #E9EEF4 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton--line { height: 12px; margin-bottom: 10px; }
.skeleton--line:last-child { width: 60%; }

.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
.spinner--dark { border-color: var(--border-2); border-top-color: var(--emerald-600); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Toasts ------------------------------------------------------------- */
#toast-host {
  position: fixed; bottom: var(--s-6); right: var(--s-6); z-index: 2000;
  display: flex; flex-direction: column; gap: var(--s-3); max-width: 360px;
}
.toast {
  background: var(--navy-800); color: #fff; padding: 12px 16px;
  border-radius: var(--r-md); box-shadow: var(--sh-lg); font-size: var(--fs-sm);
  display: flex; align-items: flex-start; gap: var(--s-3);
  animation: toast-in .2s cubic-bezier(.2,.8,.2,1);
}
.toast.out { animation: toast-out .2s ease forwards; }
.toast__icon { flex: none; font-weight: 700; }
.toast--success .toast__icon { color: var(--emerald-500); }
.toast--error .toast__icon { color: #FF8A8A; }
.toast--info .toast__icon { color: #7FB0FF; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ---- AI feature cards — dark HUD treatment ------------------------------
 * Shared by any page that surfaces an AI agent's output (review.html's
 * Report Analysis, client.html's Round Comparison, etc.) so every AI
 * feature reads as the same visual language instead of each page
 * reinventing it. --------------------------------------------------------- */
@keyframes aiScan { 0% { background-position: -220% 0; } 100% { background-position: 220% 0; } }
@keyframes aiPulseGlow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(16,185,129,.32), 0 0 20px rgba(16,185,129,.16), 0 10px 40px rgba(4,10,20,.45); }
  50%      { box-shadow: 0 0 0 1px rgba(16,185,129,.55), 0 0 34px rgba(16,185,129,.3), 0 10px 40px rgba(4,10,20,.5); }
}
@keyframes aiIconPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.14); opacity: .8; } }
@keyframes aiDotBlink { 0%, 100% { opacity: .2; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }

.aiCard {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(155deg, #060B16 0%, #0A1730 48%, #07211C 100%);
  border-radius: var(--r-lg); padding: var(--s-6); margin-bottom: var(--s-5);
  color: #DCE6F0; animation: aiPulseGlow 4.5s ease-in-out infinite;
}
.aiCard::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(16,185,129,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16,185,129,.08) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at top left, black 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at top left, black 0%, transparent 72%);
}
.aiCard__scanbar {
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #22D3EE, var(--emerald-500), transparent);
  background-size: 220% 100%; animation: aiScan 3.4s linear infinite;
}
.aiCard__head { display: flex; align-items: center; gap: 14px; margin-bottom: var(--s-5); }
.aiCard__icon {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle, rgba(16,185,129,.28), rgba(16,185,129,.03));
  border: 1px solid rgba(16,185,129,.4); color: #34E7B5;
  animation: aiIconPulse 2.6s ease-in-out infinite;
}
.aiCard__eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: 2px; color: #34E7B5; text-transform: uppercase; }
.aiCard__title { font-size: var(--fs-lg); font-weight: 700; color: #F2F6FA; letter-spacing: -.01em; margin-top: 2px; }

.aiReadout {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px; color: #7FA3C7; border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03); border-radius: var(--r-sm);
  padding: 10px 14px; margin-bottom: var(--s-5);
}
.aiReadout b { color: #9FF3D2; font-weight: 600; }
.aiReadoutActions { margin-left: auto; }

.aiBtn {
  background: rgba(16,185,129,.12); color: #6EF0BE; border: 1px solid rgba(16,185,129,.4);
  padding: 6px 14px; border-radius: var(--r-pill); font-size: 11px; font-weight: 700;
  letter-spacing: .4px; text-transform: uppercase; cursor: pointer; font-family: inherit;
  transition: background .15s, box-shadow .15s;
}
.aiBtn:hover:not(:disabled) { background: rgba(16,185,129,.22); box-shadow: 0 0 16px rgba(16,185,129,.35); }
.aiBtn:disabled { opacity: .5; cursor: not-allowed; }
.aiBtn--primary {
  background: linear-gradient(135deg, var(--emerald-500), #22D3EE); color: #04140F; border: none;
  padding: 11px 22px; font-size: var(--fs-sm); box-shadow: 0 0 24px rgba(16,185,129,.35);
}
.aiBtn--primary:hover:not(:disabled) { box-shadow: 0 0 32px rgba(16,185,129,.55); transform: translateY(-1px); }

.aiSummary { font-size: var(--fs-base); line-height: 1.6; color: #D3E0EC; margin-bottom: var(--s-6); }

.aiSection { margin-top: var(--s-6); }
.aiSection__title {
  font-size: 10.5px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase;
  color: #5FBFA0; margin-bottom: var(--s-4); display: flex; align-items: center; gap: 8px;
}
.aiSection__title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(95,191,160,.4), transparent); }

.aiFactor { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid rgba(255,255,255,.06); }
.aiFactor:first-of-type { border-top: none; }
.aiFactor__meter { flex: none; width: 5px; height: 38px; border-radius: 3px; background: rgba(255,255,255,.08); position: relative; overflow: hidden; }
.aiFactor__meter i { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 3px; display: block; }
.aiFactor--high .aiFactor__meter i { height: 100%; background: linear-gradient(180deg, #FF6B6B, #D64545); box-shadow: 0 0 10px rgba(214,69,69,.6); }
.aiFactor--medium .aiFactor__meter i { height: 62%; background: linear-gradient(180deg, #FFC15E, #D9820A); box-shadow: 0 0 10px rgba(217,130,10,.5); }
.aiFactor--low .aiFactor__meter i { height: 34%; background: linear-gradient(180deg, #6EE7F5, #22D3EE); box-shadow: 0 0 10px rgba(34,211,238,.5); }
.aiFactor__sev { font-size: 9.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; margin-right: 8px; }
.aiFactor--high .aiFactor__sev { color: #FF8A8A; }
.aiFactor--medium .aiFactor__sev { color: #FFC15E; }
.aiFactor--low .aiFactor__sev { color: #6EE7F5; }
.aiFactor__label { font-size: var(--fs-sm); font-weight: 700; color: #F2F6FA; }
.aiFactor__text { font-size: var(--fs-sm); color: #9FB0C3; margin-top: 3px; line-height: 1.5; }

.aiFlag { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid rgba(255,255,255,.06); }
.aiFlag:first-of-type { border-top: none; }
.aiFlag__tag { flex: none; font-size: 9.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; padding: 4px 9px; border-radius: var(--r-pill); margin-top: 2px; }
.aiFlag--duplicate .aiFlag__tag { background: rgba(34,211,238,.14); color: #6EE7F5; border: 1px solid rgba(34,211,238,.4); }
.aiFlag--outdated .aiFlag__tag { background: rgba(217,130,10,.14); color: #FFC15E; border: 1px solid rgba(217,130,10,.4); }
.aiFlag--inconsistency .aiFlag__tag { background: rgba(214,69,69,.14); color: #FF8A8A; border: 1px solid rgba(214,69,69,.4); }
.aiFlag__ref { font-size: var(--fs-sm); font-weight: 700; color: #F2F6FA; }
.aiFlag__text { font-size: var(--fs-sm); color: #9FB0C3; margin-top: 3px; line-height: 1.5; }

.aiPriorities { position: relative; padding-left: 6px; }
.aiPriority { position: relative; padding: 0 0 22px 34px; }
.aiPriority:last-child { padding-bottom: 0; }
.aiPriority::before { content: ""; position: absolute; left: 10px; top: 26px; bottom: -4px; width: 1px; background: linear-gradient(180deg, rgba(16,185,129,.5), rgba(16,185,129,0)); }
.aiPriority:last-child::before { display: none; }
.aiPriority__num {
  position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800;
  background: linear-gradient(135deg, var(--emerald-500), #22D3EE); color: #04140F;
  box-shadow: 0 0 14px rgba(16,185,129,.5);
}
.aiPriority__ref { font-size: var(--fs-sm); font-weight: 700; color: #F2F6FA; }
.aiPriority__reason { font-size: var(--fs-sm); color: #9FB0C3; margin-top: 3px; line-height: 1.5; }
.aiPriority__approach { font-size: var(--fs-sm); color: #6EE7F5; margin-top: 5px; line-height: 1.5; }
.aiPriority__approach::before { content: "→ "; opacity: .7; }

.aiEmpty { text-align: center; padding: var(--s-8) var(--s-4); }
.aiEmpty svg { color: #34E7B5; opacity: .85; margin-bottom: var(--s-4); }
.aiEmpty__title { font-size: var(--fs-md); font-weight: 700; color: #F2F6FA; margin-bottom: 8px; }
.aiEmpty p { max-width: 440px; margin: 0 auto var(--s-5); color: #8CA0B8; font-size: var(--fs-sm); line-height: 1.6; }

.aiLoadingDots { display: flex; justify-content: center; gap: 7px; }
.aiLoadingDots span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #34E7B5; box-shadow: 0 0 10px rgba(52,231,181,.7); animation: aiDotBlink 1.2s infinite; }
.aiLoadingDots span:nth-child(2) { animation-delay: .2s; }
.aiLoadingDots span:nth-child(3) { animation-delay: .4s; }

@media (prefers-reduced-motion: reduce) {
  .aiCard, .aiCard__scanbar, .aiCard__icon, .aiLoadingDots span { animation: none !important; }
}

/* ---- Utilities (used sparingly) ---------------------------------------- */
.row { display: flex; align-items: center; gap: var(--s-3); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); }
.muted { color: var(--muted); }
.text-sm { font-size: var(--fs-sm); }
.mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); }
.mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); }
.hidden { display: none !important; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .app-main { padding: var(--s-5) var(--s-4) var(--s-10); }
}
@media (max-width: 620px) {
  .stat-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .workflow__steps { overflow-x: auto; padding-bottom: var(--s-2); }
  .wf-step__text { font-size: var(--fs-xs); }
  .topbar { flex-wrap: wrap; }
}
