/* ==========================================================================
   Generate Letters — design tokens and components
   One file for the consultant app and the marketing site.
   (The white-label portal uses portal.css, which re-maps the brand tokens to
   the consultant's own colors.)
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* Brand blues (PRODUCT_REQUIREMENTS §2) */
  --gl-header: #00529c;
  --gl-primary: #2563eb;
  --gl-primary-hover: #1d4ed8;
  --gl-deep: #1e3a8a;
  --gl-light: #dbeafe;
  --gl-lighter: #eff6ff;

  /* Neutrals */
  --gl-bg: #f6f8fb;
  --gl-surface: #ffffff;
  --gl-surface-2: #f1f5f9;
  --gl-border: #e2e8f0;
  --gl-border-strong: #cbd5e1;
  --gl-text: #0f172a;
  --gl-text-muted: #475569;
  --gl-text-soft: #5b6b82;
  --gl-on-brand: #ffffff;

  /* Status (each pair passes WCAG AA for text on its background) */
  --gl-success: #047857;  --gl-success-bg: #d1fae5;
  --gl-warning: #92400e;  --gl-warning-bg: #fef3c7;
  --gl-danger: #b91c1c;   --gl-danger-bg: #fee2e2;
  --gl-info: #1e40af;     --gl-info-bg: #dbeafe;
  --gl-neutral: #334155;  --gl-neutral-bg: #e2e8f0;

  /* Type */
  --gl-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --gl-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gl-fs-xs: .75rem; --gl-fs-sm: .875rem; --gl-fs-md: 1rem; --gl-fs-lg: 1.125rem;
  --gl-fs-xl: 1.375rem; --gl-fs-2xl: 1.75rem; --gl-fs-3xl: clamp(2rem, 4vw + 1rem, 3.25rem);

  /* Spacing, radius, shadow */
  --gl-s1: .25rem; --gl-s2: .5rem; --gl-s3: .75rem; --gl-s4: 1rem; --gl-s5: 1.5rem; --gl-s6: 2rem; --gl-s7: 3rem; --gl-s8: 4.5rem;
  --gl-r-sm: 6px; --gl-r: 10px; --gl-r-lg: 16px; --gl-r-pill: 999px;
  --gl-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --gl-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .05);
  --gl-shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
  --gl-focus: 0 0 0 3px rgba(37, 99, 235, .45);

  /* Layout */
  --gl-sidebar-w: 240px;
  --gl-header-h: 56px;
  --gl-bottomnav-h: 64px;
  --gl-max: 1180px;
  color-scheme: light;
}

/* Dark mode: only surfaces change; brand blues stay recognisable. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --gl-bg: #0b1220; --gl-surface: #111a2e; --gl-surface-2: #17223a;
    --gl-border: #24314d; --gl-border-strong: #33415f;
    --gl-text: #e5ecf6; --gl-text-muted: #a9b6cc; --gl-text-soft: #8a98b2;
    --gl-light: #1b2b55; --gl-lighter: #14203d;
    --gl-success: #6ee7b7; --gl-success-bg: #0b3b2c;
    --gl-warning: #fcd34d; --gl-warning-bg: #3d2c08;
    --gl-danger: #fca5a5;  --gl-danger-bg: #431414;
    --gl-info: #93c5fd;    --gl-info-bg: #13264f;
    --gl-neutral: #cbd5e1; --gl-neutral-bg: #26324a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --gl-bg: #0b1220; --gl-surface: #111a2e; --gl-surface-2: #17223a;
  --gl-border: #24314d; --gl-border-strong: #33415f;
  --gl-text: #e5ecf6; --gl-text-muted: #a9b6cc; --gl-text-soft: #8a98b2;
  --gl-light: #1b2b55; --gl-lighter: #14203d;
  --gl-success: #6ee7b7; --gl-success-bg: #0b3b2c;
  --gl-warning: #fcd34d; --gl-warning-bg: #3d2c08;
  --gl-danger: #fca5a5;  --gl-danger-bg: #431414;
  --gl-info: #93c5fd;    --gl-info-bg: #13264f;
  --gl-neutral: #cbd5e1; --gl-neutral-bg: #26324a;
  color-scheme: dark;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--gl-font); font-size: var(--gl-fs-md); line-height: 1.55;
  color: var(--gl-text); background: var(--gl-bg); overflow-x: hidden;
}
img, svg, video, iframe { max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 var(--gl-s3); color: var(--gl-text); }
h1 { font-size: var(--gl-fs-2xl); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: var(--gl-fs-xl); font-weight: 650; }
h3 { font-size: var(--gl-fs-lg); font-weight: 600; }
p { margin: 0 0 var(--gl-s4); }
a { color: var(--gl-primary); text-underline-offset: 2px; }
a:hover { color: var(--gl-primary-hover); }
small, .gl-muted { color: var(--gl-text-muted); }
.gl-soft { color: var(--gl-text-soft); }
code, kbd { font-family: var(--gl-mono); font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--gl-border); margin: var(--gl-s5) 0; }

:focus-visible { outline: none; box-shadow: var(--gl-focus); border-radius: var(--gl-r-sm); }

.gl-skip {
  position: absolute; left: var(--gl-s3); top: -100px; z-index: 1000;
  background: var(--gl-surface); color: var(--gl-text); padding: var(--gl-s2) var(--gl-s4);
  border-radius: var(--gl-r-sm); box-shadow: var(--gl-shadow-lg); font-weight: 600;
}
.gl-skip:focus { top: var(--gl-s3); }
.gl-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Bot trap field: off-screen for people, still filled in by naive bots. */
.gl-hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- 3. Buttons ---------- */
.gl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--gl-s2);
  min-height: 44px; padding: 0 var(--gl-s5); border-radius: var(--gl-r);
  font: inherit; font-weight: 600; font-size: var(--gl-fs-sm); line-height: 1;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
  background: var(--gl-primary); color: var(--gl-on-brand);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.gl-btn:hover { background: var(--gl-primary-hover); color: var(--gl-on-brand); }
.gl-btn--secondary { background: var(--gl-surface); color: var(--gl-text); border-color: var(--gl-border-strong); }
.gl-btn--secondary:hover { background: var(--gl-surface-2); color: var(--gl-text); }
.gl-btn--ghost { background: transparent; color: var(--gl-primary); }
.gl-btn--ghost:hover { background: var(--gl-lighter); color: var(--gl-primary-hover); }
.gl-btn--danger { background: var(--gl-danger); color: #fff; }
.gl-btn--danger:hover { background: #991b1b; color: #fff; }
.gl-btn--lg { min-height: 52px; padding: 0 var(--gl-s6); font-size: var(--gl-fs-md); }
.gl-btn--sm { min-height: 36px; min-width: 44px; padding: 0 var(--gl-s3); }
.gl-btn--block { width: 100%; }
.gl-btn--on-brand, .gl-btn--on-brand:hover { color: #fff; background: rgba(255,255,255,.08); }
.gl-btn[disabled], .gl-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.gl-btn-row { display: flex; flex-wrap: wrap; gap: var(--gl-s3); align-items: center; }

/* ---------- 4. Cards and surfaces ---------- */
.gl-card {
  background: var(--gl-surface); border: 1px solid var(--gl-border); border-radius: var(--gl-r-lg);
  box-shadow: var(--gl-shadow-sm); padding: var(--gl-s5);
}
.gl-card + .gl-card { margin-top: var(--gl-s4); }
.gl-grid > .gl-card, .gl-grid > .gl-card + .gl-card { margin-top: 0; }
.gl-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--gl-s3); margin-bottom: var(--gl-s4); flex-wrap: wrap; }
.gl-card__title { margin: 0; font-size: var(--gl-fs-lg); }
.gl-card--flush { padding: 0; overflow: hidden; }
.gl-card--accent { border-top: 4px solid var(--gl-primary); }
.gl-card--link { display: block; text-decoration: none; color: inherit; transition: box-shadow .15s ease, border-color .15s ease; }
.gl-card--link:hover { border-color: var(--gl-primary); box-shadow: var(--gl-shadow); color: inherit; }

.gl-grid { display: grid; gap: var(--gl-s4); }
.gl-grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.gl-grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.gl-grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }

.gl-stat { display: flex; flex-direction: column; gap: var(--gl-s1); }
.gl-stat__label { font-size: var(--gl-fs-sm); color: var(--gl-text-muted); font-weight: 500; }
.gl-stat__value { font-size: var(--gl-fs-2xl); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gl-text); }
.gl-stat__note { font-size: var(--gl-fs-xs); color: var(--gl-text-soft); }

/* ---------- 5. Badges ---------- */
.gl-badge {
  display: inline-flex; align-items: center; gap: .35em; padding: .2em .65em;
  border-radius: var(--gl-r-pill); font-size: var(--gl-fs-xs); font-weight: 600; line-height: 1.5;
  background: var(--gl-neutral-bg); color: var(--gl-neutral); white-space: nowrap;
}
.gl-badge::before { content: ""; width: .5em; height: .5em; border-radius: 50%; background: currentColor; opacity: .8; }
.gl-badge--success { background: var(--gl-success-bg); color: var(--gl-success); }
.gl-badge--warning { background: var(--gl-warning-bg); color: var(--gl-warning); }
.gl-badge--danger  { background: var(--gl-danger-bg);  color: var(--gl-danger); }
.gl-badge--info    { background: var(--gl-info-bg);    color: var(--gl-info); }
.gl-badge--plain::before { display: none; }

/* ---------- 6. Alerts ---------- */
.gl-alert {
  display: flex; gap: var(--gl-s3); padding: var(--gl-s3) var(--gl-s4); border-radius: var(--gl-r);
  border: 1px solid var(--gl-border); background: var(--gl-surface-2); margin-bottom: var(--gl-s4);
}
.gl-alert--success { background: var(--gl-success-bg); color: var(--gl-success); border-color: transparent; }
.gl-alert--warning { background: var(--gl-warning-bg); color: var(--gl-warning); border-color: transparent; }
.gl-alert--danger  { background: var(--gl-danger-bg);  color: var(--gl-danger);  border-color: transparent; }
.gl-alert--info    { background: var(--gl-info-bg);    color: var(--gl-info);    border-color: transparent; }
.gl-draft-banner {
  background: repeating-linear-gradient(45deg, var(--gl-warning-bg), var(--gl-warning-bg) 12px, #fde68a 12px, #fde68a 24px);
  color: #78350f; font-weight: 700; text-align: center; padding: var(--gl-s2) var(--gl-s4);
  border-radius: var(--gl-r); margin-bottom: var(--gl-s4);
}

/* ---------- 7. Forms ---------- */
.gl-field { display: flex; flex-direction: column; gap: var(--gl-s1); margin-bottom: var(--gl-s4); }
.gl-label { font-weight: 600; font-size: var(--gl-fs-sm); color: var(--gl-text); }
.gl-label .gl-req { color: var(--gl-danger); margin-left: .15em; }
.gl-hint { font-size: var(--gl-fs-xs); color: var(--gl-text-muted); }
.gl-input, .gl-select, .gl-textarea {
  width: 100%; min-height: 44px; padding: .6rem .8rem; font: inherit; font-size: 16px; /* 16px stops iOS zoom */
  color: var(--gl-text); background: var(--gl-surface); border: 1px solid var(--gl-border-strong);
  border-radius: var(--gl-r); transition: border-color .15s ease, box-shadow .15s ease;
}
.gl-textarea { min-height: 120px; resize: vertical; }
.gl-input:focus, .gl-select:focus, .gl-textarea:focus { outline: none; border-color: var(--gl-primary); box-shadow: var(--gl-focus); }
.gl-field--error .gl-input, .gl-field--error .gl-select, .gl-field--error .gl-textarea { border-color: var(--gl-danger); }
.gl-error { font-size: var(--gl-fs-sm); color: var(--gl-danger); font-weight: 500; }
.gl-check { display: flex; gap: var(--gl-s2); align-items: flex-start; min-height: 44px; padding-top: .6rem; }
.gl-check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--gl-primary); flex: none; }
.gl-form-row { display: grid; gap: 0 var(--gl-s4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
fieldset { border: 0; padding: 0; margin: 0 0 var(--gl-s4); min-width: 0; }
legend { font-weight: 650; padding: 0; margin-bottom: var(--gl-s2); }

/* ---------- 8. Tables (stack into cards on phones) ---------- */
.gl-table-wrap { width: 100%; overflow-x: auto; }
.gl-table { width: 100%; border-collapse: collapse; font-size: var(--gl-fs-sm); }
.gl-table th, .gl-table td { padding: var(--gl-s3) var(--gl-s4); text-align: left; border-bottom: 1px solid var(--gl-border); vertical-align: middle; }
.gl-table th { font-size: var(--gl-fs-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--gl-text-muted); font-weight: 600; background: var(--gl-surface-2); }
.gl-table tbody tr:hover { background: var(--gl-lighter); }
.gl-table td.gl-num, .gl-table th.gl-num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .gl-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .gl-table--stack, .gl-table--stack tbody, .gl-table--stack tr, .gl-table--stack td { display: block; width: 100%; }
  .gl-table--stack tr { border: 1px solid var(--gl-border); border-radius: var(--gl-r); margin: 0 0 var(--gl-s3); background: var(--gl-surface); padding: var(--gl-s2) 0; }
  .gl-table--stack td { border: 0; display: flex; justify-content: space-between; gap: var(--gl-s4); padding: var(--gl-s2) var(--gl-s4); text-align: right; }
  .gl-table--stack td::before { content: attr(data-label); font-weight: 600; color: var(--gl-text-muted); text-align: left; }
  .gl-table--stack td.gl-num { text-align: right; }
}

/* ---------- 9. Lists, empty states, misc ---------- */
.gl-list { list-style: none; margin: 0; padding: 0; }
.gl-list > li { display: flex; align-items: center; justify-content: space-between; gap: var(--gl-s3); padding: var(--gl-s3) 0; border-bottom: 1px solid var(--gl-border); }
.gl-list > li:last-child { border-bottom: 0; }
.gl-empty { text-align: center; padding: var(--gl-s7) var(--gl-s4); color: var(--gl-text-muted); }
.gl-empty__title { font-weight: 650; color: var(--gl-text); margin-bottom: var(--gl-s2); }
.gl-progress { height: 10px; background: var(--gl-surface-2); border-radius: var(--gl-r-pill); overflow: hidden; }
.gl-progress > span { display: block; height: 100%; background: var(--gl-primary); border-radius: inherit; }
.gl-steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.gl-steps li { display: flex; gap: var(--gl-s3); align-items: flex-start; padding: var(--gl-s2) 0; }
.gl-steps li::before {
  counter-increment: step; content: counter(step); flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: var(--gl-fs-sm); font-weight: 700;
  background: var(--gl-light); color: var(--gl-deep);
}
.gl-steps li.is-done::before { content: "✓"; background: var(--gl-success-bg); color: var(--gl-success); }
.gl-steps li.is-done { color: var(--gl-text-muted); }
.gl-steps li a { display: inline-block; padding: .55rem 0; margin: -.55rem 0; }
.gl-table td a { display: inline-block; padding: .55rem 0; }
.gl-fieldset { border: 0; padding: 0; margin: 0 0 var(--gl-s5); min-width: 0; }
.gl-fieldset > legend { font-weight: 700; font-size: var(--gl-fs-lg, 1.125rem); margin-bottom: var(--gl-s3); padding: 0; }
.gl-pager { display: flex; gap: var(--gl-s2); justify-content: space-between; align-items: center; flex-wrap: wrap; margin-top: var(--gl-s4); }
.gl-kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: var(--gl-s2) var(--gl-s4); margin: 0; }
.gl-kv dt { color: var(--gl-text-muted); font-size: var(--gl-fs-sm); }
.gl-kv dd { margin: 0; }
.gl-tabs { display: flex; gap: var(--gl-s1); overflow-x: auto; border-bottom: 1px solid var(--gl-border); margin-bottom: var(--gl-s4); scrollbar-width: thin; }
.gl-tabs a { padding: var(--gl-s3) var(--gl-s4); text-decoration: none; color: var(--gl-text-muted); font-weight: 600; font-size: var(--gl-fs-sm); border-bottom: 2px solid transparent; white-space: nowrap; }
.gl-tabs a[aria-current="page"] { color: var(--gl-primary); border-bottom-color: var(--gl-primary); }
.gl-avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--gl-light); color: var(--gl-deep); font-weight: 700; font-size: var(--gl-fs-sm); flex: none; }
.gl-video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--gl-r); overflow: hidden; background: #000; }
.gl-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- 10. Consultant app shell ---------- */
.gl-app { min-height: 100vh; display: grid; grid-template-columns: var(--gl-sidebar-w) 1fr; grid-template-rows: var(--gl-header-h) 1fr; grid-template-areas: "header header" "side main"; }
.gl-header {
  grid-area: header; position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: var(--gl-s4);
  padding: 0 var(--gl-s4); background: var(--gl-header); color: var(--gl-on-brand); box-shadow: var(--gl-shadow);
}
.gl-header a { color: var(--gl-on-brand); }
.gl-brand { display: inline-flex; align-items: center; min-height: 44px; gap: var(--gl-s2); font-weight: 750; font-size: var(--gl-fs-lg); text-decoration: none; letter-spacing: -.01em; }
.gl-brand__mark { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.16); display: grid; place-items: center; }
.gl-header__spacer { flex: 1; }
.gl-header__tools { display: flex; align-items: center; gap: var(--gl-s2); }
.gl-header__tools a { text-decoration: none; font-size: var(--gl-fs-sm); padding: var(--gl-s2) var(--gl-s3); border-radius: var(--gl-r-sm); }
.gl-header__tools a:hover { background: rgba(255,255,255,.12); }
.gl-search { flex: 0 1 360px; }
.gl-search input { width: 100%; min-height: 38px; border-radius: var(--gl-r-pill); border: 0; padding: 0 var(--gl-s4); font: inherit; font-size: 16px; background: rgba(255,255,255,.14); color: #fff; }
.gl-search input::placeholder { color: rgba(255,255,255,.75); }

.gl-sidebar { grid-area: side; background: var(--gl-surface); border-right: 1px solid var(--gl-border); padding: var(--gl-s4) var(--gl-s3); position: sticky; top: var(--gl-header-h); height: calc(100vh - var(--gl-header-h)); overflow-y: auto; }
.gl-nav { list-style: none; margin: 0; padding: 0; }
.gl-nav a { display: flex; align-items: center; gap: var(--gl-s3); padding: .6rem var(--gl-s3); border-radius: var(--gl-r); color: var(--gl-text-muted); text-decoration: none; font-weight: 550; font-size: var(--gl-fs-sm); }
.gl-nav a:hover { background: var(--gl-surface-2); color: var(--gl-text); }
.gl-nav a[aria-current="page"] { background: var(--gl-light); color: var(--gl-deep); }
.gl-nav__group { font-size: var(--gl-fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--gl-text-soft); padding: var(--gl-s4) var(--gl-s3) var(--gl-s1); }
.gl-icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.gl-main { grid-area: main; min-width: 0; padding: var(--gl-s5); }
.gl-container { max-width: var(--gl-max); margin: 0 auto; }
.gl-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--gl-s4); flex-wrap: wrap; margin-bottom: var(--gl-s5); }
.gl-page-head h1 { margin: 0; }
.gl-page-head p { margin: var(--gl-s1) 0 0; color: var(--gl-text-muted); }

.gl-bottomnav { display: none; }

@media (max-width: 960px) {
  .gl-app { grid-template-columns: 1fr; grid-template-areas: "header" "main"; }
  .gl-sidebar { display: none; }
  .gl-search { display: none; }
  .gl-main { padding: var(--gl-s4) var(--gl-s4) calc(var(--gl-bottomnav-h) + var(--gl-s5)); }
  .gl-bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(var(--gl-bottomnav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--gl-surface); border-top: 1px solid var(--gl-border); box-shadow: 0 -4px 16px rgba(15,23,42,.06);
  }
  .gl-bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--gl-text-muted); text-decoration: none; min-width: 0; }
  .gl-bottomnav a[aria-current="page"] { color: var(--gl-primary); }
  .gl-bottomnav .gl-icon { width: 22px; height: 22px; }
  .gl-header__tools .gl-hide-sm { display: none; }
}
@media (max-width: 480px) {
  .gl-card { padding: var(--gl-s4); }
  h1 { font-size: var(--gl-fs-xl); }
  .gl-page-head .gl-btn-row { width: 100%; }
  .gl-page-head .gl-btn-row .gl-btn { flex: 1; }
}

/* ---------- 11. Marketing site ---------- */
.gl-site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--gl-border); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gl-site-header { background: rgba(11,18,32,.9); } }
.gl-site-header__inner { max-width: var(--gl-max); margin: 0 auto; display: flex; align-items: center; gap: var(--gl-s5); padding: var(--gl-s3) var(--gl-s4); }
.gl-site-header .gl-brand { color: var(--gl-header); }
.gl-site-header .gl-brand__mark { background: var(--gl-header); color: #fff; }
.gl-site-nav { display: flex; gap: var(--gl-s4); flex: 1; }
.gl-site-nav a { display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; color: var(--gl-text-muted); text-decoration: none; font-weight: 550; font-size: var(--gl-fs-sm); }
.gl-site-nav a:hover, .gl-site-nav a[aria-current="page"] { color: var(--gl-primary); }
.gl-menu-toggle { display: none; }
@media (max-width: 880px) {
  .gl-site-header__inner { flex-wrap: wrap; gap: var(--gl-s3); }
  .gl-site-nav { order: 3; flex-basis: 100%; overflow-x: auto; gap: var(--gl-s4); padding-bottom: var(--gl-s1); }
  .gl-site-header .gl-hide-sm { display: none; }
}
.gl-section { padding: var(--gl-s8) var(--gl-s4); }
.gl-section--tight { padding: var(--gl-s7) var(--gl-s4); }
.gl-section--alt { background: var(--gl-surface); border-top: 1px solid var(--gl-border); border-bottom: 1px solid var(--gl-border); }
.gl-section--brand { background: linear-gradient(135deg, var(--gl-deep), var(--gl-primary)); color: #fff; }
.gl-section--brand h2, .gl-section--brand p { color: #fff; }
.gl-section__inner { max-width: var(--gl-max); margin: 0 auto; }
.gl-section__head { max-width: 720px; margin: 0 auto var(--gl-s6); text-align: center; }
.gl-section__head h2 { font-size: clamp(1.5rem, 2vw + 1rem, 2.25rem); letter-spacing: -.015em; }
.gl-section__head p { color: var(--gl-text-muted); font-size: var(--gl-fs-lg); }
.gl-eyebrow { display: inline-block; font-size: var(--gl-fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gl-primary); margin-bottom: var(--gl-s2); }
.gl-hero { padding: var(--gl-s8) var(--gl-s4) var(--gl-s7); background: radial-gradient(1200px 500px at 80% -10%, var(--gl-light), transparent 60%), var(--gl-bg); }
.gl-hero__inner { max-width: var(--gl-max); margin: 0 auto; display: grid; gap: var(--gl-s7); grid-template-columns: 1.05fr 1fr; align-items: center; }
.gl-hero h1 { font-size: var(--gl-fs-3xl); letter-spacing: -.025em; line-height: 1.08; color: var(--gl-deep); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gl-hero h1 { color: #fff; } }
.gl-hero__lead { font-size: var(--gl-fs-lg); color: var(--gl-text-muted); max-width: 560px; }
.gl-hero__note { font-size: var(--gl-fs-sm); color: var(--gl-text-soft); margin-top: var(--gl-s3); }
@media (max-width: 880px) { .gl-hero__inner { grid-template-columns: 1fr; } .gl-hero { padding-top: var(--gl-s7); } }
.gl-feature { display: flex; flex-direction: column; gap: var(--gl-s2); }
.gl-feature__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--gl-light); color: var(--gl-deep); }
.gl-feature__icon--center { margin: 0 auto; }
.gl-items-center { align-items: center; }
.gl-mx-auto { margin-left: auto; margin-right: auto; }
.gl-narrow { max-width: 760px; }
.gl-feature h3 { margin: var(--gl-s2) 0 0; }
.gl-feature p { margin: 0; color: var(--gl-text-muted); font-size: var(--gl-fs-sm); }
.gl-checklist { list-style: none; padding: 0; margin: 0; }
.gl-checklist li { position: relative; padding-left: 1.75rem; margin-bottom: var(--gl-s2); }
.gl-checklist li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--gl-success); font-weight: 800; }
.gl-price { display: flex; flex-direction: column; gap: var(--gl-s3); }
.gl-price > .gl-badge { align-self: flex-start; }
.gl-price--featured { border: 2px solid var(--gl-primary); box-shadow: var(--gl-shadow-lg); }
.gl-price__amount { font-size: 2.5rem; font-weight: 800; letter-spacing: -.02em; color: var(--gl-text); }
.gl-price__amount small { font-size: var(--gl-fs-md); font-weight: 500; color: var(--gl-text-muted); }
.gl-compare th:first-child, .gl-compare td:first-child { width: 45%; }
.gl-yes { color: var(--gl-success); font-weight: 700; }
.gl-no { color: var(--gl-text-soft); }
.gl-faq { max-width: 760px; margin: 0 auto; }
.gl-faq details { border-bottom: 1px solid var(--gl-border); padding: var(--gl-s4) 0; }
.gl-faq summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: var(--gl-s4); min-height: 44px; align-items: center; }
.gl-faq summary::-webkit-details-marker { display: none; }
.gl-faq summary::after { content: "+"; font-size: 1.4rem; color: var(--gl-primary); }
.gl-faq details[open] summary::after { content: "–"; }
.gl-faq p { margin: var(--gl-s3) 0 0; color: var(--gl-text-muted); }
.gl-mock { border-radius: var(--gl-r-lg); background: var(--gl-surface); border: 1px solid var(--gl-border); box-shadow: var(--gl-shadow-lg); overflow: hidden; }
.gl-mock__bar { height: 34px; background: var(--gl-header); display: flex; align-items: center; gap: 6px; padding: 0 12px; }
.gl-mock__bar i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.4); display: block; }
.gl-mock__body { padding: var(--gl-s4); display: grid; gap: var(--gl-s3); }
.gl-site-footer { background: var(--gl-deep); color: #c7d6f5; padding: var(--gl-s7) var(--gl-s4) var(--gl-s6); font-size: var(--gl-fs-sm); }
.gl-site-footer a { color: #fff; text-decoration: none; }
.gl-site-footer a:hover { text-decoration: underline; }
.gl-site-footer__inner { max-width: var(--gl-max); margin: 0 auto; display: grid; gap: var(--gl-s5); grid-template-columns: 2fr repeat(3, 1fr); }
.gl-site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--gl-s2); }
.gl-site-footer h2 { color: #fff; font-size: var(--gl-fs-sm); text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 720px) { .gl-site-footer__inner { grid-template-columns: 1fr 1fr; } .gl-site-footer__inner > :first-child { grid-column: 1 / -1; } }

/* ---------- 12. Utilities ---------- */
.gl-center { text-align: center; }
.gl-mt-0 { margin-top: 0; } .gl-mb-0 { margin-bottom: 0; }
.gl-mt-4 { margin-top: var(--gl-s4); } .gl-mb-4 { margin-bottom: var(--gl-s4); }
.gl-mt-6 { margin-top: var(--gl-s6); }
.gl-row { display: flex; align-items: center; gap: var(--gl-s3); flex-wrap: wrap; }
.gl-between { justify-content: space-between; }
.gl-stack > * + * { margin-top: var(--gl-s3); }
.gl-nowrap { white-space: nowrap; }
.gl-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

@media print {
  .gl-header, .gl-sidebar, .gl-bottomnav, .gl-site-header, .gl-site-footer, .gl-skip { display: none !important; }
  .gl-app { display: block; }
  body { background: #fff; }
}

/* ---------- 13. Sign-in screens ---------- */
.gl-auth { min-height: 100vh; background-attachment: fixed; background: radial-gradient(900px 400px at 50% -10%, var(--gl-light), transparent 70%), var(--gl-bg); }
.gl-auth__main { max-width: 440px; margin: 0 auto; padding: var(--gl-s6) var(--gl-s4) var(--gl-s7); }
.gl-auth__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--gl-s5); }
.gl-auth__brand { color: var(--gl-header); }
.gl-auth__brand .gl-brand__mark { background: var(--gl-header); color: #fff; }
.gl-auth__card h1 { font-size: var(--gl-fs-xl); }
.gl-code { font-family: var(--gl-mono); font-size: var(--gl-fs-lg); letter-spacing: .08em; background: var(--gl-surface-2); padding: var(--gl-s3) var(--gl-s4); border-radius: var(--gl-r); word-break: break-all; }
.gl-codes { columns: 2; font-family: var(--gl-mono); list-style: none; padding: 0; }

/* ---- Tabs (1.5 client hub) ---- */
.gl-tabs { margin: 0 0 var(--gl-s4); border-bottom: 1px solid var(--gl-border); max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.gl-tabs ul { display: flex; gap: var(--gl-s1); list-style: none; margin: 0; padding: 0; min-width: max-content; }
.gl-tabs a { display: inline-flex; align-items: center; gap: var(--gl-s2); min-height: 44px; padding: 0 var(--gl-s3); color: var(--gl-text-muted); text-decoration: none; font-weight: 600; font-size: var(--gl-fs-sm); border-bottom: 3px solid transparent; white-space: nowrap; }
.gl-tabs a:hover { color: var(--gl-primary); }
.gl-tabs a[aria-current="page"] { color: var(--gl-primary); border-bottom-color: var(--gl-primary); }
.gl-tabs__count { display: inline-block; min-width: 1.5em; padding: 0 .4em; border-radius: 999px; background: var(--gl-surface-2); color: var(--gl-text-muted); font-size: var(--gl-fs-xs); text-align: center; }
.gl-timeline { list-style: none; margin: 0; padding: 0; }
.gl-timeline li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--gl-s1) var(--gl-s3); padding: var(--gl-s3) 0; border-bottom: 1px solid var(--gl-border); }
.gl-timeline li:last-child { border-bottom: 0; }
.gl-timeline__who { color: var(--gl-text-muted); font-size: var(--gl-fs-sm); }
.gl-timeline time { color: var(--gl-text-muted); font-size: var(--gl-fs-xs); white-space: nowrap; }
@media (max-width: 640px) {
  /* Phones: wrap the tabs into pills so the current one is always visible (no hidden sideways strip). */
  .gl-tabs { border-bottom: 0; overflow: visible; }
  .gl-tabs ul { flex-wrap: wrap; gap: var(--gl-s2); min-width: 0; }
  .gl-tabs a { min-height: 40px; border: 1px solid var(--gl-border); border-radius: 999px; background: var(--gl-surface); }
  .gl-tabs a[aria-current="page"] { background: var(--gl-primary); border-color: var(--gl-primary); color: #fff; }
  .gl-tabs a[aria-current="page"] .gl-tabs__count { background: rgba(255,255,255,.25); color: #fff; }
}

/* ---- Team members (1.6) ---- */
.gl-member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gl-s3); }
.gl-member-list > .gl-card + .gl-card { margin-top: 0; }
.gl-member { display: flex; flex-wrap: wrap; gap: var(--gl-s4); justify-content: space-between; align-items: flex-start; }
.gl-member__who { display: flex; gap: var(--gl-s3); min-width: 0; flex: 1 1 260px; }
.gl-member__email { overflow-wrap: anywhere; font-size: var(--gl-fs-sm); }
.gl-member__badges { gap: var(--gl-s2); margin: var(--gl-s2) 0; }
.gl-member__actions { display: grid; gap: var(--gl-s3); flex: 1 1 300px; justify-items: start; }
.gl-member__role { display: flex; flex-wrap: wrap; gap: var(--gl-s2); align-items: flex-end; }
.gl-member__role .gl-field { margin: 0; min-width: 170px; }
.gl-member__actions form { margin: 0; }
.gl-kv--stack { grid-template-columns: 1fr; gap: var(--gl-s1); }
.gl-kv--stack dd { margin-bottom: var(--gl-s3); color: var(--gl-text-muted); font-size: var(--gl-fs-sm); }
.gl-mb-2 { margin-bottom: var(--gl-s2); }
.gl-kv--stack dt { color: var(--gl-text); font-weight: 600; font-size: var(--gl-fs-sm); }

/* ---- Settings (1.7) ---- */
.gl-settings__section { scroll-margin-top: calc(var(--gl-header-h) + var(--gl-s4)); }
.gl-settings__section h3 { font-size: var(--gl-fs-base); margin: 0 0 var(--gl-s3); }
.gl-settings__logo { display: block; max-width: 220px; max-height: 90px; width: auto; height: auto; margin: 0 0 var(--gl-s3); padding: var(--gl-s2); border: 1px solid var(--gl-border); border-radius: var(--gl-r); background: #fff; }
.gl-settings__sample { border-radius: var(--gl-r); padding: var(--gl-s4); margin: var(--gl-s3) 0 var(--gl-s4); border: 1px solid var(--gl-border); }
.gl-settings__sample-btn { display: inline-block; color: #fff; font-weight: 600; padding: var(--gl-s2) var(--gl-s4); border-radius: var(--gl-r); }
.gl-settings__host { overflow-wrap: anywhere; }
.gl-settings__video { max-width: 560px; margin: 0 0 var(--gl-s4); }
input[type="color"].gl-input { padding: 4px; height: 44px; cursor: pointer; }

/* ---- Client documents (1.8) ---- */
.gl-docs__upload { margin: 0 0 var(--gl-s4); }
.gl-docs__upload > summary { list-style: none; cursor: pointer; display: inline-flex; }
.gl-docs__upload > summary::-webkit-details-marker { display: none; }
.gl-docs__form { margin-top: var(--gl-s4); padding: var(--gl-s4); border: 1px dashed var(--gl-border); border-radius: var(--gl-r); background: var(--gl-surface-2); }
.gl-docs__camera .gl-label { display: inline-flex; align-items: center; gap: var(--gl-s2); }
.gl-docs__more { margin-top: var(--gl-s2); }
.gl-docs__more > summary { cursor: pointer; color: var(--gl-primary); font-size: var(--gl-fs-sm); min-height: 32px; display: flex; align-items: center; }
.gl-docs__more form { margin-top: var(--gl-s2); }
.gl-docs__inline { display: flex; flex-wrap: wrap; gap: var(--gl-s2); align-items: flex-end; }
.gl-docs__inline .gl-field { margin: 0; }
/* 1.9 tasks */
.gl-task-add > summary { list-style: none; display: inline-flex; }
.gl-task-add > summary::-webkit-details-marker { display: none; }
.gl-task-add[open] > summary { margin-bottom: var(--gl-s3); }
.gl-tasks { list-style: none; margin: 0; padding: 0; }
.gl-task { display: flex; gap: var(--gl-s3); align-items: flex-start; padding: var(--gl-s3) 0; border-bottom: 1px solid var(--gl-border); }
.gl-task:last-child { border-bottom: 0; }
.gl-task__toggle { flex: none; }
.gl-task__check { width: 32px; height: 32px; margin: 6px; border: 2px solid var(--gl-border-strong); border-radius: 50%; background: var(--gl-surface); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.gl-task__check:hover { border-color: var(--gl-success); }
.gl-task__check.is-done { background: var(--gl-success); border-color: var(--gl-success); }
.gl-task__check svg { width: 16px; height: 16px; }
.gl-task__body { flex: 1; min-width: 0; padding-top: 8px; }
.gl-task__title { font-weight: 600; overflow-wrap: anywhere; }
.gl-task--done .gl-task__title { text-decoration: line-through; color: var(--gl-text-muted); }
.gl-task__meta { display: flex; flex-wrap: wrap; gap: var(--gl-s2); align-items: center; color: var(--gl-text-muted); font-size: var(--gl-fs-sm); margin-top: 2px; }
.gl-task__meta svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.gl-task__more { margin-top: var(--gl-s2); }
.gl-task__more > summary { cursor: pointer; color: var(--gl-primary); font-size: var(--gl-fs-sm); min-height: 32px; display: inline-flex; align-items: center; }
.gl-task__more form { margin-top: var(--gl-s2); }
/* 1.10 notes + logins vault */
.gl-notes__list, .gl-vault { list-style: none; margin: 0; padding: 0; }
.gl-note, .gl-vault__item { padding: var(--gl-s3) 0; border-top: 1px solid var(--gl-border); }
.gl-note__body { white-space: normal; overflow-wrap: anywhere; }
.gl-note__meta { color: var(--gl-text-muted); font-size: var(--gl-fs-sm); margin-top: var(--gl-s1); }
.gl-vault__head { display: flex; gap: var(--gl-s2); align-items: center; flex-wrap: wrap; }
.gl-vault__values { margin: var(--gl-s2) 0; }
.gl-vault__values code { overflow-wrap: anywhere; user-select: all; }
/* 1.11 downloads */
.gl-export { list-style: none; margin: 0; padding: 0; }
.gl-export li { display: flex; gap: var(--gl-s3); align-items: center; justify-content: space-between; flex-wrap: wrap; padding: var(--gl-s3) 0; border-top: 1px solid var(--gl-border); }
.gl-card--warning { border-top: 4px solid var(--gl-warning); }

/* 2.3 Import code for the browser extension */
.gl-input--mono { font-family: var(--gl-mono); font-size: var(--gl-fs-sm, .9rem); }
[hidden] { display: none !important; }

/* ---------- 2.5 Report viewer (3 bureaus side by side) ---------- */
.gl-rv-filter { display: flex; flex-wrap: wrap; gap: var(--gl-s2); margin: var(--gl-s3) 0 var(--gl-s4); }
.gl-rv-acct { border: 1px solid var(--gl-border); border-radius: var(--gl-r); padding: var(--gl-s4); margin: 0 0 var(--gl-s4); background: var(--gl-surface); }
.gl-rv-acct--neg { border-left: 4px solid var(--gl-danger); }
.gl-rv-acct__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--gl-s2); margin-bottom: var(--gl-s3); }
.gl-rv-acct__name { font-size: var(--gl-fs-lg); margin: 0; overflow-wrap: anywhere; }
.gl-rv-acct__badges { display: flex; flex-wrap: wrap; gap: var(--gl-s1); align-items: flex-start; }
.gl-rv-cmp th[scope="row"] { font-weight: 600; color: var(--gl-text-muted); white-space: nowrap; }
.gl-rv-cmp td { overflow-wrap: anywhere; }
.gl-rv-cmp__diff th, .gl-rv-cmp__diff td { background: var(--gl-warning-bg); }
.gl-rv-flag { font-size: var(--gl-fs-xs); font-weight: 700; color: var(--gl-warning); text-transform: uppercase; }
@media (max-width: 720px) {
  .gl-rv-cmp th[scope="row"] { display: block; padding: var(--gl-s2) var(--gl-s4) 0; white-space: normal; }
  .gl-rv-cmp td::before { flex-shrink: 0; }
  .gl-rv-cmp tr { padding: var(--gl-s1) 0; margin-bottom: var(--gl-s2); }
  .gl-rv-cmp td { padding: var(--gl-s1) var(--gl-s4); }
  .gl-rv-acct { padding: var(--gl-s3); }
}

/* ---------- 2.6 Rules engine findings ---------- */
.gl-rules { list-style: none; margin: var(--gl-s3) 0 0; padding: 0; display: grid; gap: var(--gl-s2); }
.gl-rule { border: 1px solid var(--gl-border); border-left: 4px solid var(--gl-border-strong); border-radius: var(--gl-r-sm); padding: var(--gl-s2) var(--gl-s3); background: var(--gl-surface); }
.gl-rule--critical, .gl-rule--high { border-left-color: var(--gl-danger); }
.gl-rule--medium { border-left-color: var(--gl-warning); }
.gl-rule--low { border-left-color: var(--gl-info); }
.gl-rule__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gl-s1) var(--gl-s2); }
.gl-rule__why { margin: var(--gl-s1) 0 0; font-size: var(--gl-fs-sm); color: var(--gl-text-muted); }
.gl-rules__counts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gl-s2); }
.gl-rules__n { font-weight: 700; margin-right: var(--gl-s2); }
.gl-rv-acct__rules { margin-bottom: var(--gl-s3); }

/* ---------- 3.3 Letter template library ---------- */
.gl-tpl-list { list-style: none; margin: 0; padding: 0; }
.gl-tpl-item { display: flex; gap: var(--gl-s4); align-items: flex-start; justify-content: space-between; padding: var(--gl-s4) 0; border-top: 1px solid var(--gl-border); }
.gl-tpl-item:first-child { border-top: 0; padding-top: 0; }
.gl-tpl-main { min-width: 0; flex: 1; }
.gl-tpl-title { font-weight: 600; font-size: var(--gl-fs-md); color: var(--gl-text); text-decoration: none; overflow-wrap: anywhere; }
.gl-tpl-title:hover { color: var(--gl-primary); text-decoration: underline; }
.gl-tpl-meta { display: flex; flex-wrap: wrap; gap: var(--gl-s2); align-items: center; margin-top: var(--gl-s1); font-size: var(--gl-fs-sm); }
.gl-tpl-desc { margin: var(--gl-s2) 0 0; color: var(--gl-text-muted); font-size: var(--gl-fs-sm); }
.gl-tpl-actions { display: flex; flex-wrap: wrap; gap: var(--gl-s2); justify-content: flex-end; flex-shrink: 0; }
.gl-inline-form { display: inline; margin: 0; }
.gl-tpl-filters { display: grid; gap: var(--gl-s3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); align-items: end; }
.gl-tpl-filters .gl-field { margin-bottom: 0; }
@media (max-width: 720px) {
  .gl-tpl-item { flex-direction: column; }
  .gl-tpl-actions { justify-content: flex-start; }
}
/* The letter itself: always white paper with dark ink, like the printed page. */
.gl-paper-wrap { margin: 0; }
.gl-paper {
  background: #fff; color: #111; font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1.5;
  border: 1px solid var(--gl-border-strong); border-radius: var(--gl-r-sm); box-shadow: var(--gl-shadow);
  padding: clamp(1rem, 4vw, 3rem); max-width: 8.5in; overflow-wrap: anywhere;
}
.gl-paper p { margin: 0 0 1em; }
.gl-paper ol, .gl-paper ul { margin: 0 0 1em; padding-left: 1.5em; }
.gl-paper li { margin-bottom: .6em; }
.gl-paper .page-break { border-top: 1px dashed #999; margin: 1.5em 0; }
.gl-paper .letter-signature { font-style: italic; font-size: 1.2em; }
.gl-mono { font-family: var(--gl-mono); font-size: 14px; }
.gl-editor-bar { display: flex; flex-wrap: wrap; gap: var(--gl-s1); margin-bottom: var(--gl-s2); }
.gl-editor-area { min-height: 360px; outline: none; max-width: none; }
.gl-editor-area:focus { box-shadow: var(--gl-focus); }
.gl-token-picker { margin-top: var(--gl-s3); }
.gl-token-picker .gl-row { flex-wrap: wrap; }
.gl-token-picker .gl-select { flex: 1 1 260px; width: auto; }
.gl-tpl-detail dt { font-weight: 600; font-size: var(--gl-fs-sm); }
.gl-tpl-detail dd { margin: 0 0 var(--gl-s3); color: var(--gl-text-muted); }
.gl-plain-list { list-style: none; margin: 0; padding: 0; } .gl-plain-list li { padding: var(--gl-s1) 0; }
.gl-token-picker .gl-select { min-width: 0; max-width: 100%; }
.gl-editor-bar .gl-btn { min-width: 44px; justify-content: center; }
/* 3.4 Dispute rounds */
.gl-mt-2 { margin-top: var(--gl-s2); }
.gl-input--sm { min-height: 40px; padding: .35rem .6rem; width: auto; max-width: 100%; }
.gl-warn-text { color: var(--gl-warning); display: flex; gap: .35rem; align-items: center; }
.gl-round-items { list-style: none; margin: 0; padding: 0; }
.gl-round-item { border-top: 1px solid var(--gl-border); padding: var(--gl-s3) 0; }
.gl-round-item:first-child { border-top: 0; }
.gl-round-item { padding-left: var(--gl-s2); padding-right: var(--gl-s2); }
.gl-round-item.is-on { background: var(--gl-lighter); border-radius: var(--gl-r-sm); }
.gl-round-item__head { flex-wrap: wrap; padding-top: 0; }
.gl-round-item__head label { flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere; cursor: pointer; }
.gl-round-item__badges { display: flex; flex-wrap: wrap; gap: .25rem; }
.gl-round-item__fields { margin-left: 28px; max-width: 40rem; }
.gl-round-item__fields details { margin-top: var(--gl-s2); }
.gl-round-item__fields summary { cursor: pointer; color: var(--gl-primary); min-height: 44px; display: flex; align-items: center; }
.gl-letter-field { background: #fff3c4; padding: 0 .2em; border-radius: 3px; font-family: var(--gl-mono); font-size: .85em; }
@media (max-width: 720px) { .gl-round-item__fields { margin-left: 0; } }
.gl-extra { border-top: 1px solid var(--gl-border); padding: var(--gl-s2) 0; }
.gl-extra summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: var(--gl-s2); flex-wrap: wrap; }
.gl-extra fieldset { margin: var(--gl-s2) 0 0; }
.gl-print-page { background: var(--gl-bg); padding: var(--gl-s4); }
.gl-print-bar { display: flex; flex-wrap: wrap; gap: var(--gl-s3); align-items: center; max-width: 8.5in; margin: 0 auto var(--gl-s4); }
.gl-paper--print { margin: 0 auto; }
@page { size: letter; margin: 0.75in; }
@media print {
  .gl-print-page { padding: 0; background: #fff; }
  .gl-print-bar { display: none !important; }
  .gl-paper--print { border: 0; box-shadow: none; padding: 0; max-width: none; font-size: 12pt; }
  .gl-paper--print .page-break { border: 0; margin: 0; page-break-after: always; break-after: page; }
}

/* 3.6 Case law library */
.gl-cl-sits ul { list-style: none; margin: 0 0 var(--gl-s4); padding: 0; display: flex; flex-wrap: wrap; gap: var(--gl-s2); }
.gl-cl-sit { display: inline-flex; align-items: center; gap: var(--gl-s2); min-height: 36px; padding: 0 var(--gl-s3); border: 1px solid var(--gl-border-strong); border-radius: 999px; background: var(--gl-surface); color: var(--gl-text); text-decoration: none; font-size: var(--gl-fs-sm); }
.gl-cl-sit:hover { border-color: var(--gl-primary); color: var(--gl-primary); }
.gl-cl-sit--on, .gl-cl-sit--on:hover { background: var(--gl-primary); border-color: var(--gl-primary); color: var(--gl-on-brand); }
.gl-cl-sit--bg { border-style: dashed; }
.gl-cl-n { font-weight: 700; opacity: .8; }
.gl-cl-cite { font-family: ui-serif, Georgia, serif; color: var(--gl-text-muted); overflow-wrap: anywhere; }
.gl-cl-quote { margin: 0 0 var(--gl-s4); padding: var(--gl-s3) var(--gl-s4); border-left: 4px solid var(--gl-primary); background: var(--gl-surface-2); font-family: ui-serif, Georgia, serif; overflow-wrap: anywhere; }
.gl-cl-actions { display: flex; flex-wrap: wrap; gap: var(--gl-s3); align-items: flex-end; }
.gl-cl-statusform { display: flex; flex-wrap: wrap; gap: var(--gl-s2); align-items: center; margin: 0; }
.gl-cl-plist { list-style: none; margin: var(--gl-s3) 0 0; padding: 0; }
.gl-cl-plist > li { padding: var(--gl-s3) 0; border-top: 1px solid var(--gl-border); }
.gl-cl-plist > li:first-child { border-top: 0; }
.gl-cl-filters { display: grid; gap: var(--gl-s3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); align-items: end; }
.gl-letter-edit { display: grid; gap: var(--gl-s4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .gl-letter-edit { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; } }
.gl-letter-edit > .gl-card, .gl-letter-edit > div > .gl-card:first-child { margin-top: 0; }

/* 2.7 What changed */
.gl-rc-h { font-size: var(--gl-fs-base); margin: var(--gl-s4) 0 0; display: flex; gap: var(--gl-s2); align-items: center; }
.gl-rc-h--success { color: var(--gl-success); }
.gl-rc-h--warning { color: var(--gl-warning); }
.gl-rc-table { margin-top: var(--gl-s2); font-size: var(--gl-fs-sm); }
.gl-rc-table th[scope="row"] { font-weight: 600; text-align: left; }
.gl-rc-round { min-height: 32px; padding: 0 .75em; text-decoration: none; }

/* 2.8 Credit audit report (client-facing, white-label: --gl-car-brand is the business color) */
.gl-car { --gl-car-brand: var(--gl-primary); color: #111; }
.gl-car h1 { font-size: 1.6em; color: var(--gl-car-brand); margin: 0 0 .2em; }
.gl-car h2 { font-size: 1.15em; color: var(--gl-car-brand); border-bottom: 2px solid var(--gl-car-brand); padding-bottom: .2em; margin: 1.4em 0 .6em; }
.gl-car h3 { font-size: 1em; margin: 0 0 .2em; }
.gl-car-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1em; border-bottom: 4px solid var(--gl-car-brand); padding-bottom: .8em; margin-bottom: .8em; }
.gl-car-head p { margin: 0; }
.gl-car-head__right { text-align: right; }
.gl-car-biz { font-weight: 700; font-size: 1.2em; }
.gl-car-muted { color: #555; font-size: .9em; }
.gl-car-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); gap: .6em; }
.gl-car-stat { border: 1px solid #ccd; border-radius: 6px; padding: .5em .7em; display: flex; flex-direction: column; break-inside: avoid; }
.gl-car-stat__v { font-size: 1.5em; font-weight: 700; color: var(--gl-car-brand); }
.gl-car-stat__l { font-size: .85em; color: #444; }
.gl-car-acct { border-left: 3px solid #ccd; padding: .2em 0 .2em .8em; margin: 0 0 1em; break-inside: avoid; }
.gl-car-acct p { margin: 0 0 .3em; }
.gl-car-neg { font-size: .75em; font-weight: 700; color: #9b1c1c; border: 1px solid #9b1c1c; border-radius: 4px; padding: 0 .35em; vertical-align: middle; }
.gl-car-check { font-size: .85em; color: #7a4b00; }
.gl-car-list { margin: .3em 0 0; padding-left: 1.3em; }
.gl-car-list li { margin-bottom: .5em; }
.gl-car-rights { background: #f4f6fa; padding: .2em 1em .6em; border-radius: 6px; break-inside: avoid; }
.gl-car-foot { border-top: 1px solid #ccd; margin-top: 1.5em; padding-top: .6em; }
.gl-car-foot p { margin: 0 0 .3em; }
@media (max-width: 600px) { .gl-car-head__right { text-align: left; } }
/* 3.9 Follow-ups ("Next steps" card) and the printable dispute history */
.gl-followup { border-left: 3px solid var(--gl-primary); padding: .2em 0 .4em .9em; margin: 0 0 1.2em; }
.gl-followup h3 { font-size: 1rem; margin: 0 0 .3em; }
.gl-followup p { margin: 0 0 .4em; }
.gl-followup--cfpb, .gl-followup--creditor { border-left-color: #9b1c1c; }
.gl-followup--review { border-left-color: #7a4b00; }
.gl-followup__items { margin: 0 0 .5em; padding-left: 1.2em; font-size: .92em; }
.gl-history h1 { font-size: 1.5em; margin: .1em 0 .3em; }
.gl-history h2 { font-size: 1.12em; border-bottom: 2px solid #ccd; padding-bottom: .2em; margin: 1.3em 0 .6em; }
.gl-history h3 { font-size: 1em; margin: 1.1em 0 .4em; }
.gl-history__letter { margin: 0 0 1em; break-inside: avoid; }
.gl-history__letter p { margin: 0 0 .25em; }
/* 3.10 Client explanation of a letter */
.gl-explain { border-top: 1px solid #dde3ee; padding-top: .6em; margin-top: .6em; }
.gl-explain:first-of-type { border-top: 0; margin-top: 0; }
.gl-explain h3 { font-size: 1rem; margin: 0 0 .4em; }
.gl-explain p { margin: 0 0 .5em; }
.gl-explain__items { margin: 0 0 .6em; padding-left: 1.2em; }
.gl-explain__items li { margin-bottom: .4em; }
.gl-explain__result { font-weight: 600; }
