@import url('https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ============================================================================
   VendGrade , base + component classes
   Requires tokens.css. All color comes from --vg-* tokens, so this file is
   theme-agnostic: flip data-theme="dark" on <html> and everything follows.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--vg-bg);
  color: var(--vg-text);
  font-family: var(--vg-font-sans);
  font-size: var(--vg-fs-body);
  line-height: 1.45;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: var(--vg-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; }
::selection { background: color-mix(in srgb, var(--vg-accent) 24%, transparent); }

/* ---- utilities ---- */
.vg-mono  { font-family: var(--vg-font-mono); }
.vg-label { font-family: var(--vg-font-mono); font-size: var(--vg-fs-label); letter-spacing: var(--vg-tracking-label); text-transform: uppercase; color: var(--vg-text-3); }
.vg-muted { color: var(--vg-text-2); }
.vg-faint { color: var(--vg-text-3); }
.vg-hr    { height: 1px; background: var(--vg-border); border: 0; }

/* ============================================================================
   APP SHELL
   ========================================================================== */
.vg-app { display: flex; width: 1360px; height: 884px; overflow: hidden; background: var(--vg-bg); }

.vg-sidebar { width: 224px; flex-shrink: 0; background: var(--vg-surface); border-right: 1px solid var(--vg-border); display: flex; flex-direction: column; padding: 20px 14px 16px; }
.vg-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.vg-brand__mark { width: 22px; height: 22px; background: var(--vg-accent); border-radius: 5px; transform: rotate(45deg); position: relative; }
.vg-brand__mark::after { content: ""; position: absolute; inset: 6px; background: var(--vg-surface); border-radius: 2px; }
.vg-brand__word { font-weight: 700; font-size: 16px; letter-spacing: var(--vg-tracking-tight); }

.vg-nav { display: flex; flex-direction: column; gap: 2px; }
.vg-nav__item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 7px; color: var(--vg-text-2); }
.vg-nav__ico { width: 15px; height: 15px; border-radius: 3px; border: 1.5px solid var(--vg-text-3); flex-shrink: 0; }
.vg-nav__item--active { background: var(--vg-accent-weak); color: var(--vg-accent-strong); font-weight: 600; box-shadow: inset 2px 0 0 var(--vg-accent); }
.vg-nav__item--active .vg-nav__ico { background: var(--vg-accent); border-color: transparent; }

.vg-sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.vg-user { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
/* min-width:0 is REQUIRED: without it this flex child refuses to shrink below its content and the
   email overflows the 224px sidebar instead of ellipsing. Full address stays one hover away (title). */
.vg-user__meta { min-width: 0; }
.vg-user__name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vg-avatar { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600; flex-shrink: 0; background: var(--vg-standard-line); }
.vg-avatar--accent { background: var(--vg-accent); }
.vg-upsell { padding: 11px 12px; border: 1px solid var(--vg-border); border-radius: 9px; background: var(--vg-surface-2); }
/* persona change-control (never a trap; design 2.2) */
.vg-mode__seg { display: flex; gap: 4px; padding: 3px; background: var(--vg-surface-2); border: 1px solid var(--vg-border); border-radius: 9px; }
.vg-mode__btn { flex: 1; padding: 6px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--vg-text-2); }
.vg-mode__btn.is-on { background: var(--vg-surface); color: var(--vg-accent-strong); box-shadow: var(--vg-shadow-card); }

.vg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vg-topbar { min-height: 62px; flex-shrink: 0; border-bottom: 1px solid var(--vg-border); background: var(--vg-surface); padding: 0 24px; display: flex; align-items: center; justify-content: space-between; }
.vg-topbar__title { font-size: var(--vg-fs-title); font-weight: var(--vg-fw-title); letter-spacing: var(--vg-tracking-tight); line-height: 1.1; }
.vg-topbar__sub { font-size: 12.5px; color: var(--vg-text-2); }
.vg-topbar__right { display: flex; align-items: center; gap: 12px; }
.vg-scroll { flex: 1; overflow-y: auto; padding: 22px 26px 44px; }
.vg-scroll::-webkit-scrollbar { width: 10px; }
.vg-scroll::-webkit-scrollbar-thumb { background: var(--vg-border-strong); border-radius: 6px; border: 3px solid var(--vg-surface); }

/* ============================================================================
   PRIMITIVES
   ========================================================================== */
/* buttons */
.vg-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: var(--vg-radius-md); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.vg-btn--primary { background: var(--vg-accent); color: #fff; }
.vg-btn--ghost { border: 1px solid var(--vg-border-strong); background: var(--vg-surface); color: var(--vg-text); }
.vg-btn--sm { padding: 6px 12px; font-size: 11.5px; }
.vg-btn--link { padding: 0; background: none; color: var(--vg-accent); font-size: 11.5px; font-weight: 600; }
.vg-btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* generic bordered chip / dropdown-look */
.vg-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border: 1px solid var(--vg-border-strong); border-radius: 7px; font-size: 12px; color: var(--vg-text-2); }
.vg-chip--active { border-color: var(--vg-accent); background: var(--vg-accent-weak); color: var(--vg-accent-strong); }
.vg-chip strong { color: var(--vg-text); font-weight: 600; }
.vg-caret { font-size: 9px; color: var(--vg-text-3); }
.vg-tag { font-family: var(--vg-font-mono); font-size: 11px; padding: 3px 9px; border-radius: 5px; background: var(--vg-surface-2); color: var(--vg-text-2); }
.vg-plan-tag { font-family: var(--vg-font-mono); font-size: 9px; letter-spacing: 0.06em; padding: 1px 5px; border-radius: 4px; background: var(--vg-accent-weak); color: var(--vg-accent-strong); text-transform: uppercase; }

/* TIER chip , the semantic workhorse */
.vg-tier { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: var(--vg-radius-sm); font-size: 11px; font-weight: 600; width: fit-content; }
.vg-tier__sq { width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.vg-tier--critical  { background: var(--vg-critical-bg);  color: var(--vg-critical);  }
.vg-tier--important { background: var(--vg-important-bg); color: var(--vg-important); }
.vg-tier--standard  { background: var(--vg-standard-bg);  color: var(--vg-standard);  }

/* status text + dot */
.vg-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.vg-status__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.vg-status--ok    { color: var(--vg-ok); }
.vg-status--warn  { color: var(--vg-attention); }
.vg-status--over  { color: var(--vg-overdue); }
.vg-status--info  { color: var(--vg-accent-strong); }
.vg-status--muted { color: var(--vg-text-2); }

/* aging badge (mono) */
.vg-badge { font-family: var(--vg-font-mono); font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 5px; background: var(--vg-surface-2); color: var(--vg-text-2); width: fit-content; }
.vg-badge--over { background: var(--vg-overdue-bg);   color: var(--vg-overdue); }
.vg-badge--warn { background: var(--vg-attention-bg); color: var(--vg-attention); }

/* verdict pill */
.vg-verdict { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--vg-radius-sm); font-size: 11.5px; font-weight: 600; }
.vg-verdict--ok   { background: var(--vg-ok-bg);        color: var(--vg-ok); }
.vg-verdict--weak { background: var(--vg-important-bg); color: var(--vg-important); }

/* ---- THE REVEAL GESTURE , "there but not there" ---------------------------
   .vg-why  = the circle-i node (a <button data-why="ID">). Inherits the
              color of its context (neutral, tier, or status).
   .vg-because = the backing panel (id must match data-why). Hidden until
              .is-open is toggled (see app.js). Use everywhere the tool makes
              a claim: a tier, a requirement, a verdict, a decision, a number. */
.vg-why { width: 16px; height: 16px; border: 1px solid currentColor; border-radius: 50%; color: inherit; opacity: 0.7; display: inline-flex; align-items: center; justify-content: center; font-family: var(--vg-font-mono); font-style: italic; font-size: 10px; line-height: 1; }
.vg-why:hover { opacity: 1; }
.vg-why--sm { width: 15px; height: 15px; font-size: 9.5px; }
.vg-because { display: none; margin-top: 11px; padding: 11px 13px; background: var(--vg-surface-2); border-left: 2px solid var(--vg-accent); border-radius: 0 7px 7px 0; }
.vg-because.is-open { display: block; }
.vg-because__label { font-family: var(--vg-font-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--vg-text-3); margin-bottom: 5px; }
.vg-because__body { font-family: var(--vg-font-mono); font-size: 12px; color: var(--vg-text-2); line-height: 1.55; }
.vg-because__body b { color: var(--vg-text); font-weight: 600; }

/* drill affordance (dashboard traceability) */
.vg-drill { display: inline-flex; align-items: center; gap: 6px; font-family: var(--vg-font-mono); font-size: 11px; color: var(--vg-accent); }
.vg-drill .vg-why { border-color: var(--vg-accent); color: var(--vg-accent); }

/* cards */
.vg-card { border: 1px solid var(--vg-border); border-radius: var(--vg-radius-lg); background: var(--vg-surface); }
.vg-card--xl { border-radius: var(--vg-radius-xl); }
.vg-card__pad { padding: 16px 18px; }

/* progress / distribution bars */
.vg-bar { height: 8px; border-radius: 4px; background: var(--vg-surface-2); overflow: hidden; }
.vg-bar__fill { height: 100%; }
.fill-ok   { background: var(--vg-ok); }
.fill-crit { background: var(--vg-critical); }
.fill-imp  { background: var(--vg-important); }
.fill-std  { background: var(--vg-standard); }
.fill-accent { background: var(--vg-accent); }

/* ---- window chrome (for the standalone demo frame only) ---- */
.vg-frame { border-radius: var(--vg-radius-xl); overflow: hidden; border: 1px solid var(--vg-border-strong); box-shadow: var(--vg-shadow-float); }
.vg-frame__bar { height: 38px; background: var(--vg-surface-2); border-bottom: 1px solid var(--vg-border); display: flex; align-items: center; gap: 8px; padding: 0 16px; }
.vg-frame__dot { width: 11px; height: 11px; border-radius: 50%; background: var(--vg-border-strong); }
.vg-frame__url { margin-left: 12px; font-family: var(--vg-font-mono); font-size: 11px; color: var(--vg-text-3); }

/* theme toggle (demo affordance) */
.vg-theme-toggle { position: fixed; top: 16px; right: 16px; z-index: 50; }

/* ============================================================================
   MODAL + FORM FIELDS + TOAST (write-action primitives; token-based, theme-aware)
   ========================================================================== */
.vg-modal-overlay { position: fixed; inset: 0; z-index: 100; background: color-mix(in srgb, #0b0f16 52%, transparent); display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; overflow-y: auto; }
.vg-modal { width: 100%; max-width: 460px; background: var(--vg-surface); border: 1px solid var(--vg-border); border-radius: var(--vg-radius-xl); box-shadow: var(--vg-shadow-float); overflow: hidden; }
.vg-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--vg-border); }
.vg-modal__head h3 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.vg-modal__x { font-size: 20px; line-height: 1; color: var(--vg-text-3); width: 26px; height: 26px; border-radius: 6px; }
.vg-modal__x:hover { background: var(--vg-surface-2); color: var(--vg-text); }
.vg-modal__intro { padding: 12px 18px 0; font-size: 12.5px; color: var(--vg-text-2); }
.vg-modal__body { padding: 16px 18px; display: flex; flex-direction: column; gap: 13px; }
.vg-modal__foot { padding: 14px 18px; border-top: 1px solid var(--vg-border); display: flex; justify-content: flex-end; gap: 9px; background: var(--vg-surface-2); }

.vg-field { display: flex; flex-direction: column; gap: 5px; }
.vg-field label { font-family: var(--vg-font-mono); font-size: var(--vg-fs-label); letter-spacing: var(--vg-tracking-label); text-transform: uppercase; color: var(--vg-text-3); }
.vg-field input, .vg-field textarea, .vg-field select { width: 100%; padding: 9px 11px; border: 1px solid var(--vg-border-strong); border-radius: 8px; background: var(--vg-surface); color: var(--vg-text); font-family: inherit; font-size: 13px; }
.vg-field textarea { resize: vertical; min-height: 62px; }
.vg-field input:focus, .vg-field textarea:focus, .vg-field select:focus { outline: none; border-color: var(--vg-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--vg-accent) 18%, transparent); }
.vg-field--err input, .vg-field--err textarea, .vg-field--err select { border-color: var(--vg-overdue); }
/* segmented field (explicit few-option control inside a modal; never a dropdown) */
.vg-fseg { display: flex; gap: 6px; flex-wrap: wrap; }
.vg-fseg button { padding: 8px 14px; border: 1px solid var(--vg-border-strong); border-radius: 8px; background: var(--vg-surface); color: var(--vg-text-2); font-size: 12.5px; font-weight: 600; }
.vg-fseg button.is-on { border-color: var(--vg-accent); background: var(--vg-accent-weak); color: var(--vg-accent-strong); }
.vg-field--err .vg-fseg button { border-color: var(--vg-overdue); }

#vg-toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.vg-toast { pointer-events: auto; font-size: 12.5px; font-weight: 600; padding: 10px 16px; border-radius: 9px; box-shadow: var(--vg-shadow-float); border: 1px solid var(--vg-border); background: var(--vg-surface); color: var(--vg-text); opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; max-width: 480px; }
.vg-toast.is-in { opacity: 1; transform: translateY(0); }
.vg-toast--ok { border-color: color-mix(in srgb, var(--vg-ok) 45%, transparent); background: var(--vg-ok-bg); color: var(--vg-ok); }
.vg-toast--err { border-color: color-mix(in srgb, var(--vg-overdue) 45%, transparent); background: var(--vg-overdue-bg); color: var(--vg-overdue); }
.vg-toast--info { border-color: color-mix(in srgb, var(--vg-attention) 45%, transparent); background: var(--vg-attention-bg); color: var(--vg-attention); }
