/* ============================================================
   CaliberSuite™ — Personal AI Advisor for Senior HR Leaders
   Look & feel: light + airy (Aura-style) with a slim dark
   floating icon-rail. Brand palette: cream / gold / plum.
   Dark mode via [data-theme="dark"] on <html>.
   ============================================================ */

:root {
  /* Brand */
  --gold:         #E1A33A;
  --gold-bright:  #F2BC5B;
  --gold-hover:   #C88E2C;
  --plum:         #6B3F5E;
  --navy:         #0F1F3D;

  /* LIGHT THEME (default) — white + professional navy blues */
  --bg:           #FFFFFF;   /* white page */
  --bg-2:         #F4F7FC;
  --panel:        #FFFFFF;   /* cards */
  --panel-2:      #F5F8FD;
  --panel-3:      #EBF0F9;
  --feature-dark: #0F1F3D;   /* navy high-contrast card / active states */

  --border:        #E3E9F2;
  --border-strong: #C7D2E2;
  --border-gold:   rgba(225, 163, 58, 0.5);

  --text:           #0F1F3D;   /* navy */
  --text-secondary: #44516B;
  --text-muted:     #8190AA;
  --on-gold:        #2A1B05;
  --on-dark:        #FFFFFF;

  /* Navy floating rail */
  --rail-bg:        #0F1F3D;
  --rail-grad:      linear-gradient(180deg, #18305A, #0B1730);
  --rail-text:      #AEBCD7;
  --rail-active:    rgba(255, 255, 255, 0.12);
  --rail-chip:      #FFFFFF;

  /* Primary button (navy, executive) */
  --btn-primary:    linear-gradient(180deg, #213A66, #0F1F3D);
  --on-btn:         #FFFFFF;

  /* Accent (gold) */
  --accent:         var(--gold);
  --accent-bright:  var(--gold-bright);
  --accent-soft:    rgba(225, 163, 58, 0.14);

  --shadow-sm:  0 1px 2px rgba(38, 22, 33, 0.05);
  --shadow-md:  0 8px 24px rgba(38, 22, 33, 0.08);
  --shadow-lg:  0 24px 60px rgba(38, 22, 33, 0.16);

  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  18px;

  --rail:       88px;
  --rail-open:  256px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Source Serif Pro", Georgia, "Times New Roman", serif;
}

[data-theme="dark"] {
  /* Executive navy-charcoal. Deep blue-grays (not black, not plum) so the page
     harmonizes with the navy rail and lets the gold accent read as premium. */
  --bg:           #0E1726;   /* deep navy charcoal page */
  --bg-2:         #131F33;
  --panel:        #18243A;   /* cards: a touch lighter than the page */
  --panel-2:      #1F2D46;
  --panel-3:      #273655;
  --feature-dark: #223149;

  --border:        rgba(173, 196, 232, 0.12);
  --border-strong: rgba(173, 196, 232, 0.24);
  --border-gold:   rgba(225, 163, 58, 0.55);

  --text:           #EAF0FA;   /* soft blue-white */
  --text-secondary: #AEBCD5;
  --text-muted:     #7488A6;

  /* Rail sits slightly deeper than the page so it reads as its own surface,
     but in the same navy family — no clash. */
  --rail-bg:        #0A1322;
  --rail-grad:      linear-gradient(180deg, #16294A, #0A1322);

  /* Gold primary button + brighter gold for labels so accents pop on dark navy. */
  --btn-primary:    linear-gradient(180deg, var(--gold-bright), var(--gold));
  --on-btn:         #2A1B05;
  --gold-hover:     #EDB552;
  --accent-soft:    rgba(225, 163, 58, 0.18);

  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:  0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg:  0 24px 60px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}

body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(800px 480px at 8% -8%, var(--accent-soft), transparent 60%),
    radial-gradient(900px 520px at 100% 0%, rgba(15, 31, 61, 0.06), transparent 55%);
}

/* "Outside" pages (login, consent, intake, reset all carry .no-rail) get the
   NYC financial-district skyline. Signed-in app keeps the plain off-white.
   The body's own background must be transparent here so the fixed skyline
   layer behind it is visible. */
body.no-rail { background: var(--navy); }
body.no-rail::before {
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(10,19,34,0.62) 0%, rgba(10,19,34,0.42) 45%, rgba(10,19,34,0.66) 100%),
    url("/skyline.jpg") center center / cover no-repeat,
    var(--navy);
}
/* Lift the card shells above the skyline layer */
body.no-rail .auth-shell,
body.no-rail .consent-shell,
body.no-rail .intake-shell,
body.no-rail .brand-footer { position: relative; z-index: 1; }

a { color: var(--gold-hover); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ============================================================
   BRAND MARK (text fallback) + logo images
   ============================================================ */
.brand-mark { display: inline-flex; align-items: baseline; gap: 3px; font-weight: 700; color: var(--text); }
.brand-mark-c { font-family: var(--font-serif); color: var(--gold); font-size: 1.45em; line-height: 1; }
.brand-mark-text sup { font-size: 0.5em; color: var(--gold); }

.auth-logo { width: 230px; max-width: 78%; height: auto; display: block; margin: 0 auto 6px; }
.consent-logo { height: 30px; width: auto; }

/* ============================================================
   GLOBAL FOOTER
   ============================================================ */
.brand-footer {
  margin-left: var(--rail);
  padding: 22px 38px 30px;
  color: var(--text-muted);
  font-size: 0.78rem; line-height: 1.5;
  max-width: 1100px;
}
.brand-footer p { margin: 0; }
.brand-footer-links { margin-top: 6px !important; }
.brand-footer-links a { color: var(--gold-hover); font-weight: 600; }
.brand-footer-links a:hover { text-decoration: underline; }
body.no-rail .brand-footer { margin-left: 0; text-align: center; max-width: none; }

/* ============================================================
   AUTH + CONSENT SHELLS
   ============================================================ */
.auth-shell, .consent-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}

.auth-card {
  width: 100%; max-width: 430px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.auth-card-header { padding: 36px 34px 6px; text-align: center; }
.auth-card-header h1 { font-size: 1.18rem; margin: 16px 0 6px; font-weight: 600; }
.auth-card-header p { margin: 0; color: var(--text-secondary); font-size: 0.92rem; }
.auth-card-body { padding: 22px 34px 30px; }

.auth-tabs {
  display: flex; gap: 4px; margin-bottom: 22px;
  background: var(--panel-2); padding: 4px; border-radius: 999px;
}
.auth-tab {
  flex: 1; padding: 10px; border-radius: 999px; border: none;
  background: transparent; color: var(--text-secondary);
  font-size: 0.9rem; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.auth-tab.active { background: var(--feature-dark); color: #fff; box-shadow: var(--shadow-sm); }

.auth-form label, .field label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--text-secondary); margin: 14px 0 6px;
}
.field-help { font-size: 0.78rem; color: var(--text-muted); margin: -2px 0 8px; line-height: 1.45; }
.auth-form input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.98rem; font-family: inherit;
  color: var(--text); background: var(--panel-2);
}
.auth-form input:focus { outline: none; border-color: var(--border-gold); box-shadow: 0 0 0 3px var(--accent-soft); }

.auth-submit, .btn-primary {
  width: 100%; margin-top: 22px; padding: 13px; border: none;
  border-radius: var(--radius-sm);
  background: var(--btn-primary);
  color: var(--on-btn); font-size: 0.92rem; font-weight: 600; cursor: pointer;
  transition: filter 0.15s, transform 0.05s; font-family: inherit;
}
.auth-submit:hover, .btn-primary:hover { filter: brightness(1.05); }
.auth-submit:active, .btn-primary:active { transform: translateY(1px); }
.auth-submit:disabled, .btn-primary:disabled { opacity: 0.6; cursor: default; }

.auth-msg { margin: 14px 0 0; font-size: 0.86rem; min-height: 1.2em; text-align: center; line-height: 1.5; }
.auth-msg-error { color: #C0392B; }
.auth-msg-success { color: #1F8A53; }
.pw-wrap { position: relative; }
.pw-wrap input { width: 100%; padding-right: 44px; }
.pw-toggle {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 30px; height: 30px; padding: 0; border: none; background: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); border-radius: 6px;
}
.pw-toggle:hover { color: var(--text); background: var(--panel-2); }
.pw-toggle svg { width: 18px; height: 18px; }
/* When the password is visible, draw a slash through the eye */
.pw-toggle.pw-shown { color: var(--gold-hover); }

.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px; margin-bottom: 18px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--text); font-family: inherit;
  font-size: 0.92rem; font-weight: 600; transition: background 0.15s;
}
.oauth-btn:hover { background: var(--panel-2); }
.auth-divider {
  display: flex; align-items: center; gap: 12px; margin: 0 0 14px;
  color: var(--text-muted); font-size: 0.76rem;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-link {
  display: block; width: 100%; margin: 14px 0 0; padding: 4px;
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 0.84rem; color: var(--gold-hover); text-align: center;
}
.auth-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth-form .field-row { gap: 12px; margin-bottom: 0; }
.auth-form .field-row label { margin-top: 0; }
.auth-card-footer {
  padding: 18px 34px; border-top: 1px solid var(--border);
  font-size: 0.82rem; color: var(--text-muted); text-align: center;
}

.consent-card {
  width: 100%; max-width: 660px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.consent-card-header {
  padding: 24px 36px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
}
.consent-card-header h1 { font-size: 1.18rem; margin: 0; font-weight: 600; }
.consent-card-body { padding: 28px 36px; }
.consent-card-body h2 { font-size: 1.25rem; margin: 0 0 12px; }
.consent-card-body p { color: var(--text-secondary); font-size: 0.94rem; }
.consent-block {
  margin: 18px 0; padding: 16px 18px; border: 1px solid var(--border);
  border-left: 3px solid #1F8A53; border-radius: var(--radius-sm); background: var(--panel-2);
}
.consent-block.warn { border-left-color: var(--plum); }
.consent-block-title { display: block; font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.consent-block ul { margin: 0; padding-left: 18px; color: var(--text-secondary); font-size: 0.9rem; }
.consent-block li { margin: 4px 0; }
.consent-card-footer-text { font-size: 0.82rem; color: var(--text-muted); }
.consent-actions { padding: 22px 36px; border-top: 1px solid var(--border); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.consent-msg { flex: 1 1 100%; margin: 0; font-size: 0.85rem; color: var(--text-secondary); }
.consent-msg-error { color: #C0392B; }
.consent-btn { padding: 12px 22px; border-radius: 999px; font-weight: 700; font-size: 0.92rem; cursor: pointer; border: 1px solid var(--border); font-family: inherit; }
.consent-btn-secondary { background: var(--panel-2); color: var(--text); }
.consent-btn-primary { border: none; background: var(--btn-primary); color: var(--on-btn); margin-left: auto; }

/* ============================================================
   FLOATING SIDEBAR RAIL
   ============================================================ */
.sidebar {
  position: fixed; top: 14px; bottom: 14px; left: 14px;
  width: calc(var(--rail) - 14px);
  z-index: 50; display: flex; flex-direction: column;
  padding: 16px 0 18px; background: var(--rail-grad);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: width 0.24s cubic-bezier(0.4,0,0.2,1), box-shadow 0.24s;
}
.sidebar:hover, .sidebar.open { width: var(--rail-open); box-shadow: var(--shadow-lg); }

.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  min-height: 40px; padding: 2px 0 16px 16px; margin-bottom: 12px;
  border-bottom: 0.5px solid rgba(255,255,255,0.08);
  white-space: nowrap; overflow: visible;
}
/* Real CaliberSuite icon on a white chip (icon is navy, sidebar is navy) */
.rail-logo-icon {
  flex: 0 0 36px; width: 36px; height: 36px; object-fit: contain;
  background: #fff; border-radius: 9px; padding: 5px; box-sizing: border-box;
}
/* Full navy wordmark hidden in the rail (navy-on-navy); shown via white text instead */
.rail-logo-full { display: none; }
.sidebar-brand::after {
  content: 'CaliberSuite'; color: #fff; font-weight: 600; font-size: 0.98rem;
  letter-spacing: -0.01em; opacity: 0; transition: opacity 0.18s;
}
.sidebar:hover .sidebar-brand::after, .sidebar.open .sidebar-brand::after { opacity: 1; }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; padding: 0 10px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 14px; padding: 9px 11px;
  border: none; border-left: 2px solid transparent; background: transparent;
  color: var(--rail-text); border-radius: 7px; cursor: pointer;
  font-size: 0.9rem; font-weight: 400; font-family: inherit;
  white-space: nowrap; text-align: left; width: 100%;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active {
  background: rgba(255,255,255,0.06); color: #fff; font-weight: 500;
  border-left: 2px solid var(--gold); border-radius: 0 7px 7px 0;
}
.nav-item.active .nav-icon { color: var(--gold); }
.nav-icon { flex: 0 0 22px; width: 22px; display: inline-flex; align-items: center; justify-content: center; color: inherit; }
.nav-icon svg { width: 19px; height: 19px; }
.nav-label { opacity: 0; transition: opacity 0.18s; }
.sidebar:hover .nav-label, .sidebar.open .nav-label { opacity: 1; }

.sidebar-user {
  display: flex; align-items: center; gap: 11px; padding: 12px 10px 2px; margin: 12px 8px 0;
  border-top: 0.5px solid rgba(255,255,255,0.08); cursor: pointer;
  white-space: nowrap; overflow: hidden;
}
.avatar {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(225,163,58,0.18); background-size: cover; background-position: center;
  color: var(--gold); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 500; font-size: 0.72rem;
}
.sidebar-user-meta { overflow: hidden; opacity: 0; transition: opacity 0.18s; display: flex; flex-direction: column; }
.sidebar:hover .sidebar-user-meta, .sidebar.open .sidebar-user-meta { opacity: 1; }
.sidebar-user-name { font-size: 0.8rem; font-weight: 500; color: #fff; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.72rem; color: rgba(255,255,255,0.55); }

/* ============================================================
   CONTENT AREA + THEME TOGGLE
   ============================================================ */
.content { margin-left: var(--rail); min-height: 100vh; padding: 18px 26px 16px; }

/* Top bar: section label + calibrated pill + theme toggle */
.app-topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 18px; margin-bottom: 14px;
}
.topbar-label { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.calib-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary);
}
.calib-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px var(--accent-soft); }

.app-actions { display: inline-flex; }
.theme-toggle {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel); color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { background: var(--panel-2); color: var(--text); }
.theme-toggle svg { width: 17px; height: 17px; }

/* Client switcher (multi-company) */
.client-switcher { position: relative; }
.client-pill {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font: inherit; font-size: 0.84rem; font-weight: 600;
  max-width: 220px;
}
.client-pill:hover { background: var(--panel-2); }
.client-pill-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-dd, .account-dd {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 200; min-width: 230px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15,31,61,0.18); padding: 6px;
}
.client-dd { left: 0; right: auto; }
.client-dd.hidden, .account-dd.hidden { display: none; }
.client-dd-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted); padding: 8px 10px 4px; font-weight: 600; }
.client-dd-item, .account-dd-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; cursor: pointer;
  padding: 9px 10px; border: none; background: none; border-radius: 8px;
  font: inherit; font-size: 0.9rem; color: var(--text);
}
.client-dd-item:hover, .account-dd-item:hover { background: var(--panel-2); }
.client-dd-item.active { font-weight: 700; }
.client-dd-item.add { color: var(--gold-hover); font-weight: 600; border-top: 1px solid var(--border); margin-top: 4px; border-radius: 0 0 8px 8px; }
.client-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); flex: 0 0 auto; }
.client-dot.on { background: var(--gold); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Account menu (top-right, all screens) */
.account-menu { position: relative; }
.account-avatar { padding: 0; border: none; background: none; cursor: pointer; border-radius: 50%; }
.account-avatar .avatar { width: 34px; height: 34px; }
.account-avatar:hover { box-shadow: 0 0 0 3px var(--accent-soft); border-radius: 50%; }
.account-dd-head { padding: 10px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.account-dd-name { font-weight: 700; font-size: 0.92rem; color: var(--text); }
.account-dd-email { font-size: 0.8rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; }
.account-dd-item svg { width: 16px; height: 16px; }
.account-dd-item.danger { color: #C0392B; }
.account-dd-item.danger:hover { background: rgba(192,57,43,0.08); }

/* Briefing chat header + new session */
.chat-head { display: flex; align-items: center; justify-content: space-between; }
.link-btn { background: none; border: none; cursor: pointer; font: inherit; font-size: 0.84rem;
  font-weight: 600; color: var(--gold-hover); padding: 4px 2px; }
.link-btn:hover { text-decoration: underline; }

/* Working sessions list */
.session-row { display: flex; align-items: center; gap: 10px; padding: 16px 18px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel); margin-bottom: 10px; }
.session-main { flex: 1; cursor: pointer; min-width: 0; }
.session-title { font-weight: 600; color: var(--text); font-size: 0.98rem; }
.session-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.session-row:hover { border-color: var(--gold); }
.session-del { width: 28px; height: 28px; border: none; background: none; cursor: pointer;
  border-radius: 6px; font-size: 1.2rem; color: var(--text-muted); flex: 0 0 auto; }
.session-del:hover { background: rgba(192,57,43,0.10); color: #C0392B; }

.view { max-width: 1500px; margin: 0 auto; }
.view--narrow { max-width: 880px; }
.view-head { margin-bottom: 24px; }

/* Dashboard two-column layout (fills the screen) */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.dash-main { min-width: 0; }
.dash-aside { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 30px; }
.mini-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.mini-card h3 { margin: 0 0 4px; font-size: 0.95rem; font-weight: 700; }
.mini-card p { margin: 0; color: var(--text-secondary); font-size: 0.86rem; }
.mini-card .mini-cta { margin-top: 14px; }
.quick-list { display: flex; flex-direction: column; gap: 4px; }
.quick-item { display: flex; align-items: center; gap: 14px; padding: 12px 10px; border-radius: 12px; cursor: pointer; border: none; background: transparent; width: 100%; text-align: left; font-family: inherit; color: var(--text); transition: background 0.15s; }
.quick-item:hover { background: var(--panel-2); }
.quick-item .qi-icon { flex: 0 0 22px; width: 22px; color: var(--gold-hover); display: inline-flex; }
.quick-item .qi-icon svg { width: 20px; height: 20px; }
.quick-item .qi-text { display: flex; flex-direction: column; }
.quick-item .qi-title { font-size: 0.9rem; font-weight: 600; }
.quick-item .qi-sub { font-size: 0.78rem; color: var(--text-muted); }

@media (max-width: 1080px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-aside { position: static; }
}
.view-head h1 { font-size: 2.3rem; margin: 0 0 6px; font-weight: 800; letter-spacing: -0.02em; }
.view-head p { margin: 0; color: var(--text-secondary); font-size: 1rem; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 18px; }
.card h2 { font-size: 1.05rem; margin: 0 0 16px; font-weight: 700; }

/* Settings: 2-up grid of cards */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-grid .card + .card { margin-top: 0; }
.card-label { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 16px; }
.card-label.gold { color: var(--gold-hover); }
.card--accent { border-left: 3px solid var(--gold); }
.stat-title { font-size: 1.05rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.stat-sub { font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 18px; }
.trial-countdown {
  background: linear-gradient(180deg, rgba(225,163,58,0.10), rgba(225,163,58,0.04));
  border: 1px solid rgba(225,163,58,0.35);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 18px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.trial-countdown .trial-days {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--gold-hover);
  margin-right: 6px;
  line-height: 1;
}
.trial-countdown .trial-end {
  margin-top: 6px;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.45;
}
.trial-countdown.trial-soon {
  background: linear-gradient(180deg, rgba(192,57,43,0.10), rgba(192,57,43,0.04));
  border-color: rgba(192,57,43,0.40);
}
.trial-countdown.trial-soon .trial-days { color: #C0392B; }
.btn-ghost.danger { color: #C0392B; border-color: rgba(192,57,43,0.4); }
.btn-ghost.danger:hover { background: rgba(192,57,43,0.06); }
.settings-foot { margin-top: 18px; }

/* Account card: avatar with eye overlay */
.account-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.avatar-wrap { position: relative; flex: 0 0 64px; }
.avatar-wrap .avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; flex: 0 0 64px; }
.avatar-eye {
  position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px;
  border-radius: 50%; border: 2px solid var(--panel); background: var(--navy); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.avatar-eye svg { width: 14px; height: 14px; }
.avatar-eye:hover { background: var(--gold); color: var(--navy); }
.account-name { font-size: 1rem; font-weight: 600; }
.account-email { font-size: 0.86rem; color: var(--text-secondary); }

@media (max-width: 820px) { .settings-grid { grid-template-columns: 1fr; } }

/* ============================================================
   STAKEHOLDER LENS
   ============================================================ */
.view-head--row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.view-head--row .topbar-label { display: block; margin-bottom: 4px; }
.view-head--row h1 { margin: 0; }
.btn-dark {
  flex: 0 0 auto; padding: 10px 18px; border: none; border-radius: var(--radius-sm);
  background: var(--feature-dark); color: #fff; font-family: inherit;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer;
}
.btn-dark:hover { filter: brightness(1.15); }

.draft-card { margin-bottom: 18px; }
.draft-input {
  width: 100%; resize: vertical; border: none; background: transparent;
  color: var(--text); font-family: inherit; font-size: 1rem; line-height: 1.55; padding: 0;
}
.draft-input:focus { outline: none; }
.draft-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.draft-actions .form-msg { margin: 0; }

.lens-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.lens-card {
  background: var(--panel); border: 1px solid var(--border); border-top: 3px solid var(--navy);
  border-radius: var(--radius); padding: 18px;
}
.lens-card--gold { border-top-color: var(--gold); }
.lens-label { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 10px; }
.lens-card--gold .lens-label { color: var(--gold-hover); }
.lens-verdict { font-size: 0.92rem; line-height: 1.5; color: var(--text); margin: 0 0 12px; }
.verdict { font-weight: 700; }
.verdict--yes { color: #1F8A53; }
.verdict--no { color: #C0392B; }
.verdict--neutral { color: var(--text-secondary); }
.lens-note { font-size: 0.84rem; font-style: italic; color: var(--text-muted); margin: 0; line-height: 1.5; }
.lens-card { position: relative; }
.lens-empty { color: var(--text-muted); font-style: italic; font-weight: 400; }
.lens-del {
  position: absolute; top: 10px; right: 10px; width: 24px; height: 24px;
  border: none; background: none; cursor: pointer; border-radius: 6px;
  font-size: 1.1rem; line-height: 1; color: var(--text-muted); opacity: 0; transition: opacity .15s;
}
.lens-card:hover .lens-del { opacity: 1; }
.lens-del:hover { background: rgba(192,57,43,0.10); color: #C0392B; }

/* Ledger delete + modal (Impact logging) */
.ledger-row { position: relative; }
.ledger-del {
  position: absolute; top: 10px; right: 4px; width: 26px; height: 26px;
  border: none; background: none; cursor: pointer; border-radius: 6px;
  font-size: 1.2rem; line-height: 1; color: var(--text-muted); opacity: 0; transition: opacity .15s;
}
.ledger-row:hover .ledger-del { opacity: 1; }
.ledger-del:hover { background: rgba(192,57,43,0.10); color: #C0392B; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,31,61,0.55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  padding: 28px; width: 100%; max-width: 480px; box-shadow: 0 24px 60px rgba(15,31,61,0.25);
  max-height: 90vh; overflow-y: auto;
}
.modal-title { font-size: 1.3rem; color: var(--text); margin: 0 0 4px; }
.modal-sub { font-size: 0.9rem; color: var(--text-secondary); margin: 0 0 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ============================================================
   CONTEXT DOCUMENT
   ============================================================ */
.ctx-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.ctx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ctx-val { font-size: 1.05rem; font-weight: 600; color: var(--text); margin-top: 2px; }
.ctx-rule { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.ctx-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ctx-chip {
  display: inline-block; padding: 7px 14px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: 0.86rem; font-weight: 500; color: var(--text);
}
.ctx-chip--empty { color: var(--text-muted); font-weight: 400; font-style: italic; }
.ctx-priorities { margin: 8px 0 0; padding-left: 20px; }
.ctx-priorities li { font-size: 0.95rem; color: var(--text); line-height: 1.7; }
.ctx-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
@media (max-width: 720px) { .ctx-grid { grid-template-columns: 1fr; } }

/* ============================================================
   IMPACT LAYER
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--navy);
  border-radius: var(--radius); padding: 18px;
}
.stat-card--gold { border-left-color: var(--gold); }
.stat-big { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text); margin: 4px 0 4px; }
.stat-card .stat-sub { font-size: 0.84rem; color: var(--text-muted); margin: 0; }

.ledger-card .card-label { margin-bottom: 4px; }
.ledger-row { display: flex; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.ledger-row:last-child { border-bottom: none; padding-bottom: 0; }
.ledger-date { flex: 0 0 56px; display: flex; gap: 8px; align-items: baseline; color: var(--text-muted); }
.lr-mon { font-size: 0.82rem; }
.lr-day { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); }
.ledger-title { font-size: 0.95rem; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.ledger-sub { font-size: 0.86rem; color: var(--text-secondary); line-height: 1.5; }

/* ============================================================
   CALIBRATION INTAKE (required, multi-step)
   ============================================================ */
.intake-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.intake-card {
  width: 100%; max-width: 640px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
}
.intake-head { padding: 26px 36px 18px; border-bottom: 1px solid var(--border); }
.intake-head .brand-mark { font-size: 1.15rem; margin-bottom: 16px; }
.intake-logo { height: 44px; width: auto; max-width: 230px; object-fit: contain; display: block; margin-bottom: 16px; }
.intake-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.intake-cancel { background: none; border: none; cursor: pointer; color: var(--text-secondary);
  font: inherit; font-size: 0.86rem; font-weight: 600; padding: 8px 4px; white-space: nowrap; }
.intake-cancel:hover { color: var(--gold-hover); }
.intake-progress { height: 5px; background: var(--panel-3); border-radius: 999px; overflow: hidden; }
.intake-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); transition: width 0.3s ease; }
.intake-step-label { margin: 8px 0 0; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }

.intake-body { padding: 30px 36px; min-height: 280px; }
.intake-body h1 { font-size: 1.5rem; margin: 0 0 8px; font-weight: 600; letter-spacing: -0.01em; }
.intake-lead { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.55; margin: 0 0 22px; }
.intake-q { font-weight: 600; font-size: 0.95rem; margin: 22px 0 14px; }

.intake-callout {
  border: 1px solid var(--border); border-left: 3px solid var(--gold);
  background: var(--panel-2); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 4px;
}
.intake-callout p { margin: 0 0 10px; font-size: 0.88rem; line-height: 1.55; color: var(--text-secondary); }
.intake-callout p:last-child { margin-bottom: 0; }
.intake-callout strong { color: var(--text); }
.intake-callout em { color: var(--gold-hover); font-style: normal; font-weight: 600; }
.intake-callout-foot { border-top: 1px solid var(--border); padding-top: 10px; font-size: 0.82rem !important; color: var(--text-muted) !important; }
.ta { resize: vertical; line-height: 1.5; }

.choice-grid { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex; flex-direction: column; gap: 3px; text-align: left; cursor: pointer;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); font-family: inherit; transition: all 0.15s;
}
.choice:hover { border-color: var(--border-strong); background: var(--panel-2); }
.choice.selected { border-color: var(--gold); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--accent-soft); }
.choice-title { font-weight: 600; font-size: 1rem; color: var(--text); }
.choice-sub { font-size: 0.86rem; color: var(--text-secondary); }

.review-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.review-row { display: flex; gap: 16px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.review-row:last-child { border-bottom: none; }
.review-row:nth-child(odd) { background: var(--panel-2); }
.review-k { flex: 0 0 130px; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.review-v { flex: 1; font-size: 0.9rem; color: var(--text); }

.intake-foot { display: flex; align-items: center; gap: 14px; padding: 18px 36px; border-top: 1px solid var(--border); }
.intake-foot .form-msg { flex: 1; margin: 0; }

/* Pill tabs */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 26px; }
.tab {
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text-secondary); font-weight: 600;
  font-size: 0.9rem; cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.tab:hover { background: var(--panel-2); }
.tab.active { background: var(--feature-dark); color: #fff; border-color: var(--feature-dark); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.welcome h1 { font-size: 1.5rem; margin: 0 0 6px; font-weight: 600; letter-spacing: -0.01em; }
.welcome .lead { color: var(--text-secondary); font-size: 0.95rem; max-width: 660px; line-height: 1.55; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--accent-soft); color: var(--gold-hover); border: 1px solid var(--border-gold); }

/* Surface card that wraps the briefing content */
.surface { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }

.q-group { display: none; }
.q-group.active { display: block; }
.section-label { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.16em; color: var(--text-muted); margin: 0 0 10px; }
.question-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.question-card {
  text-align: left; padding: 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--panel); color: var(--text); cursor: pointer;
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
  display: flex; flex-direction: column; gap: 5px;
}
.question-card:hover { transform: translateY(-1px); border-color: var(--border-gold); box-shadow: var(--shadow-sm); }
.card-title { font-weight: 600; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text); }
.card-prompt { color: var(--text-secondary); font-size: 0.84rem; line-height: 1.45; }

/* Working session panel */
.chat { margin-top: 18px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.messages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; max-height: 58vh; overflow-y: auto; padding-right: 4px; scroll-behavior: smooth; }
.messages:empty { display: none; }

/* Conversation mode: collapse the welcome + prompt cards so the thread has room
   and the composer stays put. No more scrolling up and down to act. */
.surface.in-conversation .welcome,
.surface.in-conversation .tabs,
.surface.in-conversation .suggested-questions { display: none; }
.surface.in-conversation .chat { margin-top: 0; }
.message { padding: 11px 13px; border-radius: 6px; font-size: 0.88rem; line-height: 1.55; white-space: pre-wrap; background: var(--panel); border-left: 3px solid var(--border-strong); }
.message-user { border-left-color: var(--navy); }
.message-assistant { border-left-color: var(--gold); }
.message-error { border-left-color: #C0392B; color: #C0392B; background: rgba(192,57,43,0.06); }

.composer { display: flex; gap: 8px; align-items: stretch; }
.input {
  flex: 1; resize: none; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text);
  font-family: inherit; font-size: 0.9rem; line-height: 1.5;
}
.input:focus { outline: none; border-color: var(--border-gold); box-shadow: 0 0 0 3px var(--accent-soft); }
.send-btn {
  padding: 10px 22px; border: none; border-radius: var(--radius-sm);
  background: var(--btn-primary); color: var(--on-btn);
  font-weight: 600; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; white-space: nowrap; font-family: inherit;
}
.send-btn:hover { filter: brightness(1.08); }
.send-btn:disabled { opacity: 0.6; cursor: default; }
.composer-hint { margin-top: 10px; font-size: 0.76rem; color: var(--text-muted); }

/* ============================================================
   FORMS (settings / personalization)
   ============================================================ */
.field { margin-bottom: 18px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text);
  font-family: inherit; font-size: 0.96rem;
}
.field input:disabled { opacity: 0.7; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--border-gold); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 6px; }
.form-msg { font-size: 0.88rem; margin: 10px 0 0; min-height: 1.2em; }
.form-msg.ok { color: #1F8A53; }
.form-msg.err { color: #C0392B; }

.btn-ghost { padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: transparent; color: var(--text); font-weight: 500; font-size: 0.86rem; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; }
.btn-ghost:hover { background: var(--panel-2); }
.btn-ghost svg { width: 17px; height: 17px; }
.btn-primary { width: auto; display: inline-block; }

.avatar-edit { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; }
.avatar-lg {
  width: 84px; height: 84px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--plum));
  background-size: cover; background-position: center;
  display: inline-flex; align-items: center; justify-content: center;
  color: #1A1206; font-weight: 700; font-size: 1.6rem; flex: 0 0 84px;
}

.placeholder { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.placeholder .ph-icon { font-size: 2.4rem; margin-bottom: 12px; opacity: 0.6; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  .content { padding: 24px 18px; }
  .app-actions { top: 16px; right: 16px; }
  .view-head h1, .welcome h1 { font-size: 1.7rem; }
  .field-row { grid-template-columns: 1fr; }
}
