/* ============================================================================
   Verithink : official brand design system (2026-07-03)
   ----------------------------------------------------------------------------
   Dark theme, assistant-style layout (left sidebar + centered working area),
   the disposition people already know from ChatGPT/Claude. Source of truth:
   brand/verithink-brand/verithink.pdf and artifacts/docs/branding.md.
   Two self-hosted families (OFL licences alongside the files in
   static/brand/fonts/):
     - JetBrains Mono (the brand voice: wordmark is ExtraBold; headings use it)
     - Inter (body and UI)
   Both fall back to system stacks, so nothing breaks if the files are absent.

   HARD RULES (Jorge, 2026-07-03):
   - Verdicts use FUNCTIONAL bright traffic lights (green/amber/red), chosen for
     instant readability; they are deliberately not brand colours.
   - The brand hues (teal, crimson, ochre) appear only on brand surfaces: the
     header badge, the app icon, marketing. Never on verdicts or chrome.
   - UI chrome (buttons, nav, focus, spinner) is MONOCHROME (off-white on dark),
     like the badge itself, so chrome can never be misread as a verdict.
   ============================================================================ */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;            /* variable-font weight range */
  font-display: swap;
  src: local('JetBrains Mono'),
       url('brand/fonts/JetBrainsMono-Variable.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: local('Inter'),
       url('brand/fonts/Inter-Variable.ttf') format('truetype');
}

:root {
  /* --- Surfaces: neutral near-black. --- */
  --bg: #141416;            /* page background, deepest layer            */
  --surface: #1E1E21;       /* cards, panels, the sidebar                */
  --surface-2: #28282C;     /* raised: bars, rings, inset wells          */
  --surface-3: #323238;     /* hover / active raise on surface-2         */

  /* --- Text: the brand off-white as primary ink. --- */
  --fg: #D9D9D7;            /* primary text (brand off-white)            */
  --soft-fg: #C2C2BF;       /* secondary body text                       */
  --muted-fg: #96969A;      /* captions, metadata                        */

  /* --- Lines --- */
  --border: #2E2E32;        /* default hairline                          */
  --border-strong: #3E3E44; /* emphasised divider                        */

  /* --- Chrome: monochrome interactive layer (no hue, like the badge). --- */
  --chrome: #D9D9D7;        /* primary interactive fill / focus          */
  --chrome-strong: #FFFFFF; /* hover                                     */
  --on-chrome: #141416;     /* ink placed on a chrome fill               */

  /* --- The four Verithink brand colours (brand surfaces only). --- */
  --brand-teal:    #668688;
  --brand-crimson: #8A2C33;
  --brand-ochre:   #935F28;
  --brand-offwhite:#D9D9D7;

  /* --- Verdict traffic lights: bright, functional, NOT brand colours (the
         brand hues above stay on brand surfaces only).
         Aliases (--success/--warning/--danger) kept for existing JS/CSS. --- */
  --score-strong: #5FCA90;  /* bright green : "Strong"                   */
  --score-mixed:  #E8B04C;  /* bright amber : "Mixed"                    */
  --score-weak:   #F0776B;  /* bright red   : "Weak" / high severity     */
  --success: var(--score-strong);
  --warning: var(--score-mixed);
  --danger:  var(--score-weak);

  /* --- Typography: mono display for the brand voice, Inter for reading. --- */
  --display: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto,
          'Helvetica Neue', Arial, sans-serif;

  --sidebar-w: 262px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* The hidden attribute must win over the display rules below (.status and .results
   set display:flex), or toggling .hidden in JS does not actually hide the element. */
[hidden] { display: none !important; }
body { font-family: var(--sans); background: var(--bg); color: var(--fg); line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* Accessible-but-invisible: the h1 stays for screen readers and SEO while the
   badge carries the visual name. */
.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; }

/* --- The shell: fixed-width sidebar + fluid main, full viewport height. --- */
.shell { display: flex; min-height: 100vh; }

.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-top { display: flex; align-items: center; padding: 4px 8px 10px; }
.side-top img { display: block; border-radius: 8px; }
.side-nav, .side-bottom { display: flex; flex-direction: column; gap: 4px; }
.side-spacer { flex: 1; }
.side-bottom { border-top: 1px solid var(--border); padding-top: 10px; }

/* Sidebar navigation buttons (assistant-style: subtle highlight, no pills). */
.nav-btn { display: block; width: 100%; text-align: left; background: transparent; border: none; color: var(--soft-fg); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.nav-btn:hover { background: var(--surface-2); color: var(--fg); }
.nav-btn.active { background: var(--surface-2); color: var(--fg); font-weight: 600; }

.side-account { display: flex; flex-direction: column; gap: 8px; padding: 8px 8px 2px; }
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.account-email { color: var(--muted-fg); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.credits { background: var(--surface-2); border: 1px solid var(--border); color: var(--fg); border-radius: 20px; padding: 5px 12px; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
.credits:hover { border-color: var(--border-strong); }
.credits.low { color: var(--danger); border-color: var(--danger); }
.link-btn { background: none; border: none; color: var(--muted-fg); text-decoration: underline; cursor: pointer; font: inherit; font-size: 12.5px; flex-shrink: 0; }
.link-btn:hover { color: var(--fg); }

/* Logged-out callout at the bottom of the sidebar (the familiar pattern). */
.login-callout { padding: 10px 8px 4px; display: flex; flex-direction: column; gap: 6px; }
.callout-title { font-weight: 700; font-size: 13.5px; }
.callout-text { color: var(--muted-fg); font-size: 12.5px; line-height: 1.45; }
.btn-block { width: 100%; margin-top: 4px; }

/* --- Main column --- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; }
.brand { display: block; }
.brand img { display: block; height: 38px; width: auto; }
.top-actions { display: flex; gap: 8px; }

.views { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 0 20px 40px; }
.app-footer { text-align: center; color: var(--muted-fg); font-size: 12px; padding: 14px 20px 18px; }

/* --- Hero: the rotating prompt above the composer. --- */
.hero { text-align: center; margin: 13vh 0 26px; }
.hero h2 { font-family: var(--display); font-size: 26px; font-weight: 700; line-height: 1.35; transition: opacity .45s ease; }

/* --- Composer: one rounded box, textarea on top, controls inside at the
       bottom, submit as a compact arrow button (the familiar pattern). --- */
.composer { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 16px 16px 12px; }
.composer:focus-within { border-color: var(--border-strong); }
textarea { width: 100%; min-height: 110px; border: none; padding: 2px 4px; font: inherit; font-size: 15px; resize: vertical; background: transparent; color: var(--fg); }
textarea::placeholder { color: #77777B; }
textarea:focus { outline: none; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.hint { color: var(--muted-fg); font-size: 12.5px; }
.send-btn { width: 40px; height: 40px; border: none; border-radius: 12px; background: var(--chrome); color: var(--on-chrome); font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer; flex-shrink: 0; }
.send-btn:hover { background: var(--chrome-strong); }
.send-btn:disabled { opacity: .45; cursor: default; }

/* Generic buttons (login, plans). */
.btn-primary { background: var(--chrome); color: var(--on-chrome); border: none; border-radius: 24px; padding: 12px 32px; font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; }
.btn-primary:hover { background: var(--chrome-strong); }
.btn-primary:disabled { opacity: .45; cursor: default; }
.btn-sm { padding: 8px 20px; font-size: 14px; }

.status { margin-top: 18px; padding: 14px 18px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted-fg); }
.status.error { background: var(--surface-2); border-color: var(--danger); color: var(--fg); }
.spinner { width: 16px; height: 16px; border: 3px solid var(--surface-2); border-top-color: var(--chrome); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.results { margin-top: 24px; display: flex; flex-direction: column; gap: 18px; }
.overall { display: flex; gap: 24px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
.overall-ring { position: relative; flex-shrink: 0; width: 110px; height: 110px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-direction: column; background: var(--surface-2); }
.overall-ring::after { content: ''; position: absolute; inset: 10px; background: var(--surface); border-radius: 50%; }
.overall-score { position: relative; z-index: 1; font-family: var(--display); font-size: 34px; font-weight: 800; line-height: 1; }
.overall-max { position: relative; z-index: 1; font-size: 12px; color: var(--muted-fg); }
.overall-label { margin-bottom: 8px; }
.chip { display: inline-block; font-size: 13px; color: var(--muted-fg); font-style: italic; margin-bottom: 6px; }
.content-title { font-family: var(--display); font-weight: 700; font-size: 18px; line-height: 1.3; margin: 0 0 8px; }
.overall-text p { font-size: 15px; }

/* Verdict tag: band word in white on its band colour (dims, findings, library). */
.band-tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; line-height: 1.5; color: #FFFFFF; letter-spacing: .02em; vertical-align: middle; }
.band-tag.lg { font-size: 14px; padding: 4px 16px; }

.dims { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dim { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.dim-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.dim-name { font-weight: 600; font-size: 16px; }
.dim-scorewrap { display: inline-flex; align-items: center; gap: 8px; }
.dim-score { font-weight: 700; font-size: 14px; color: var(--muted-fg); }
.bar { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.bar-fill { height: 100%; border-radius: 6px; width: 0; transition: width .6s ease; }
.dim-summary { font-size: 14px; color: var(--muted-fg); }

.findings-title { font-family: var(--display); font-size: 19px; font-weight: 700; margin-top: 6px; }
.findings { display: flex; flex-direction: column; gap: 20px; }
.finding-group { display: flex; flex-direction: column; gap: 10px; }
.finding-group-title { font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-fg); }
.finding { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.finding-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; flex-wrap: wrap; }
.finding-title { font-weight: 600; font-size: 15px; }
.finding-detail { font-size: 14px; color: var(--soft-fg); }
.finding blockquote { margin-top: 8px; padding: 8px 12px; border-left: 3px solid var(--border); background: var(--bg); font-style: italic; font-size: 13px; color: var(--muted-fg); }

.muted { color: var(--muted-fg); font-size: 14px; }

.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; max-width: 460px; margin: 12vh auto 0; }
.login-card h2 { font-family: var(--display); font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.login-form { display: flex; gap: 10px; margin: 18px 0 12px; }
.login-form input { flex: 1; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font: inherit; font-size: 15px; background: var(--bg); color: var(--fg); }
.login-form input:focus { outline: none; border-color: var(--chrome); }
.dev-note { font-size: 12px; color: var(--muted-fg); font-style: italic; }
.status-line { margin-top: 12px; font-size: 14px; color: var(--fg); }

.library-head { display: flex; justify-content: space-between; align-items: center; margin: 20px 0 14px; }
.kept-filter { font-size: 13px; color: var(--muted-fg); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.library-list { display: flex; flex-direction: column; gap: 12px; }
.lib-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.lib-main { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.score-badge { flex-shrink: 0; width: 46px; height: 46px; border: 2px solid var(--border); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 17px; }
.lib-text { flex: 1; min-width: 0; }
.lib-type { font-weight: 600; font-size: 15px; }
.lib-preview { color: var(--soft-fg); font-size: 13px; margin: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-meta { color: var(--muted-fg); font-size: 12px; }
.lib-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted-fg); border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.icon-btn:hover { color: var(--fg); border-color: var(--border-strong); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.lib-detail { padding: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 16px; }
.lib-detail .overall { background: var(--bg); }

.plan-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.plan-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; text-align: center; }
.plan-card.current { border-color: var(--chrome); }
.plan-name { font-family: var(--display); font-size: 19px; font-weight: 700; }
.plan-price { font-size: 30px; font-weight: 700; margin: 10px 0; }
.plan-price span { font-size: 14px; color: var(--muted-fg); font-weight: 400; }
.plan-credits { color: var(--muted-fg); font-size: 14px; margin-bottom: 16px; }
.plan-card .btn-primary { width: 100%; }

@media (max-width: 900px) {
  :root { --sidebar-w: 220px; }
}
@media (max-width: 680px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; border-right: none; border-bottom: 1px solid var(--border); padding: 8px 10px; overflow: visible; }
  .side-top { padding: 0 6px 0 2px; }
  .side-nav { flex-direction: row; }
  .side-bottom { flex-direction: row; align-items: center; border-top: none; padding-top: 0; margin-left: auto; }
  .login-callout .callout-title, .login-callout .callout-text { display: none; }
  .login-callout { padding: 0; }
  .btn-block { width: auto; margin: 0; padding: 8px 18px; font-size: 14px; }
  .side-account { flex-direction: row; align-items: center; padding: 0; }
  .account-email { display: none; }
  .hero { margin-top: 7vh; }
  .hero h2 { font-size: 21px; }
  .dims { grid-template-columns: 1fr; }
  .overall { flex-direction: column; text-align: center; }
  .plan-cards { grid-template-columns: 1fr; }
}
