/* ============================================================================
   TitleVault Pro V2 — modern design system
   Bright modern SaaS by default + switchable "look" themes via [data-theme].
   Reuses V1 class names so every existing view is restyled automatically.
   ========================================================================== */

/* ---------- theme tokens (default = Aurora, bright modern SaaS) ---------- */
:root {
  /* surfaces */
  --bg: #f5f6fb;
  --bg-2: #eceef6;
  --card: #ffffff;
  --card-2: #fafbff;
  --border: #e9ecf4;
  --border-strong: #d9deea;

  /* sidebar */
  --side-bg: #ffffff;
  --side-bg-2: #ffffff;
  --side-fg: #515b72;
  --side-fg-dim: #9aa3b8;
  --side-active-bg: var(--accent-soft);
  --side-active-fg: var(--accent);
  --side-border: #edf0f7;
  --side-brand: #131a2c;

  /* text */
  --text: #1c2333;
  --heading: #0e1525;
  --muted: #6c7589;
  --faint: #9aa3b6;

  /* brand accent (overridable per-org by applyBranding) */
  --accent: #5b5bf2;
  --accent-2: #8a5cf6;
  --accent-dark: #4646d8;
  --accent-soft: #eeeefe;
  --on-accent: #ffffff;

  /* status */
  --green: #18915e;  --green-soft: #e3f6ec;
  --red: #d6453f;    --red-soft: #fdeaea;
  --amber: #b9791b;  --amber-soft: #fbf0db;
  --info: #2f74d0;   --info-soft: #e7f0fc;
  --violet: #7a52e1; --violet-soft: #efe9fc;

  /* shape + depth */
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --pill: 999px;
  --shadow-sm: 0 1px 2px rgba(20, 28, 56, .05);
  --shadow: 0 1px 2px rgba(20, 28, 56, .04), 0 6px 22px rgba(20, 28, 56, .06);
  --shadow-lg: 0 12px 40px rgba(20, 28, 56, .14);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  --topbar-h: 60px;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---------- look templates ---------- */
[data-theme="slate"] {
  --bg: #f1f4f9; --bg-2: #e6ebf3; --card: #ffffff; --card-2: #f8fafc;
  --border: #e3e8f0; --border-strong: #cfd6e3;
  --side-bg: #1f2738; --side-bg-2: #19202e; --side-fg: #aeb8cd; --side-fg-dim: #707b93;
  --side-active-bg: rgba(122,150,255,.16); --side-active-fg: #c7d3ff;
  --side-border: rgba(255,255,255,.07); --side-brand: #ffffff;
  --text: #1d2535; --heading: #0f1726; --muted: #647088;
  --accent: #3f6fe6; --accent-2: #4f8bf0; --accent-dark: #2f57c4; --accent-soft: #e9f0fd;
}
[data-theme="emerald"] {
  --bg: #f3f8f5; --bg-2: #e7f1eb; --card: #ffffff; --card-2: #f7fcf9;
  --border: #e0ece5; --border-strong: #cadcd1;
  --side-bg: #0f2a22; --side-bg-2: #0a201a; --side-fg: #a7c6ba; --side-fg-dim: #6f988a;
  --side-active-bg: rgba(46,196,134,.16); --side-active-fg: #7ef0c0; --side-border: rgba(255,255,255,.08); --side-brand: #ffffff;
  --text: #16231d; --heading: #0c1812; --muted: #5d7268;
  --accent: #119968; --accent-2: #2bbd83; --accent-dark: #0c7a52; --accent-soft: #e1f6ec;
}
[data-theme="navy"] {
  --bg: #f3f5f9; --bg-2: #e7ebf2; --card: #ffffff; --card-2: #f9fafd;
  --border: #e2e7f0; --border-strong: #d0d8e6;
  --side-bg: #1e2d4e; --side-bg-2: #16223c; --side-fg: #c6d0e4; --side-fg-dim: #7d8cab;
  --side-active-bg: rgba(243,201,105,.14); --side-active-fg: #f3c969; --side-border: rgba(255,255,255,.08); --side-brand: #ffffff;
  --text: #1c2434; --heading: #16223c; --muted: #69748c;
  --accent: #3b6fe0; --accent-2: #5b8def; --accent-dark: #2c59c0; --accent-soft: #e7eefc; --on-accent: #ffffff;
}
[data-theme="navygold"] {
  --bg: #f3f5f9; --bg-2: #e7ebf2; --card: #ffffff; --card-2: #f9fafd;
  --border: #e2e7f0; --border-strong: #d0d8e6;
  --side-bg: #1e2d4e; --side-bg-2: #16223c; --side-fg: #c6d0e4; --side-fg-dim: #7d8cab;
  --side-active-bg: rgba(243,201,105,.18); --side-active-fg: #f3c969; --side-border: rgba(255,255,255,.08); --side-brand: #ffffff;
  --text: #1c2434; --heading: #16223c; --muted: #69748c;
  --accent: #d9a431; --accent-2: #f3c969; --accent-dark: #b8841f; --accent-soft: #faf2dc; --on-accent: #16223c;
}
[data-theme="sunset"] {
  --bg: #fbf6f3; --bg-2: #f5ece5; --card: #ffffff; --card-2: #fdf9f6;
  --border: #f0e6df; --border-strong: #e2d2c6;
  --side-bg: #2a1d2e; --side-bg-2: #221726; --side-fg: #d6bcc8; --side-fg-dim: #9c8090;
  --side-active-bg: rgba(255,138,101,.18); --side-active-fg: #ffb59a; --side-border: rgba(255,255,255,.08); --side-brand: #ffffff;
  --text: #2a1f22; --heading: #1d1316; --muted: #7a6168;
  --accent: #e9663f; --accent-2: #f59b53; --accent-dark: #c84f2c; --accent-soft: #fdeae2;
}
[data-theme="midnight"] {
  --bg: #0d1019; --bg-2: #151a27; --card: #161b29; --card-2: #1b2030;
  --border: #262d40; --border-strong: #333c54;
  --side-bg: #12151f; --side-bg-2: #0d1019; --side-fg: #aab3c9; --side-fg-dim: #6b748d;
  --side-active-bg: rgba(124,124,255,.18); --side-active-fg: #b9bbff; --side-border: rgba(255,255,255,.06); --side-brand: #ffffff;
  --text: #dfe4ef; --heading: #f3f5fb; --muted: #8d97ad; --faint: #67718a;
  --accent: #6f6ff5; --accent-2: #9a6cf8; --accent-dark: #5a5ae6; --accent-soft: #20243a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 2px 6px rgba(0,0,0,.35), 0 10px 30px rgba(0,0,0,.4);
  --shadow-lg: 0 18px 50px rgba(0,0,0,.6);
}

/* ---------- base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02','cv03','cv04','ss01'; letter-spacing: -.005em;
  transition: background .35s var(--ease), color .35s var(--ease);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); }
h1, h2, h3 { color: var(--heading); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 32%, transparent); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--muted) 50%, transparent); background-clip: content-box; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px; background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
  color: var(--side-fg); flex-shrink: 0; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--side-border);
  transition: background .35s var(--ease);
}
.sidebar .brand { padding: 20px 18px 16px; display: flex; align-items: center; gap: 11px; }
.sidebar .brand img { width: 34px; height: 34px; border-radius: 9px; }
.sidebar .brand .word { font-size: 17px; font-weight: 750; color: var(--side-brand); letter-spacing: -.3px; line-height: 1.1; }
.sidebar .brand .word span { color: var(--accent); }
[data-theme="navy"] .sidebar .brand .word span,
[data-theme="navygold"] .sidebar .brand .word span,
[data-theme="slate"] .sidebar .brand .word span,
[data-theme="emerald"] .sidebar .brand .word span,
[data-theme="sunset"] .sidebar .brand .word span,
[data-theme="midnight"] .sidebar .brand .word span { color: var(--side-active-fg); }
.sidebar .brand .tag { font-size: 10px; color: var(--side-fg-dim); letter-spacing: .9px; text-transform: uppercase; margin-top: 3px; font-weight: 600; }
.sidebar nav { flex: 1; padding: 8px 12px; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin-bottom: 2px;
  color: var(--side-fg); font-weight: 550; border-radius: 10px; position: relative;
  transition: background .15s var(--ease), color .15s var(--ease), transform .08s var(--ease); font-size: 13.5px;
}
.sidebar nav a svg { width: 17px; height: 17px; opacity: .7; flex-shrink: 0; }
.sidebar nav a:hover { background: color-mix(in srgb, var(--side-fg) 9%, transparent); color: var(--side-brand); text-decoration: none; }
.sidebar nav a.active { background: var(--side-active-bg); color: var(--side-active-fg); font-weight: 650; }
.sidebar nav a.active svg { opacity: 1; }
.sidebar nav a.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--side-active-fg); }
.sidebar nav .nav-group { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--side-fg-dim); font-weight: 700; padding: 14px 12px 5px; }
.sidebar nav .nav-group:first-child { padding-top: 4px; }

.sidebar .userbox { padding: 12px 14px; border-top: 1px solid var(--side-border); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.sidebar .userbox .avatar { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.sidebar .userbox .uwrap { flex: 1; min-width: 0; }
.sidebar .userbox .uname { color: var(--side-brand); font-weight: 650; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .userbox .urole { color: var(--side-fg-dim); text-transform: capitalize; font-size: 11px; }
.sidebar .userbox button { margin: 0; background: none; border: none; color: var(--side-fg-dim); padding: 7px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s, color .15s; }
.sidebar .userbox button svg { width: 16px; height: 16px; pointer-events: none; }
.sidebar .userbox button:hover { background: color-mix(in srgb, var(--side-fg) 12%, transparent); color: var(--side-brand); }

.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.main { flex: 1; padding: 26px 34px 48px; max-width: 1600px; width: 100%; margin-inline: auto; animation: viewIn .32s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .main, .modal { animation: none !important; } * { transition: none !important; } }

/* ---------- global topbar (V2) ---------- */
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 14px; padding: 0 34px;
  background: color-mix(in srgb, var(--card) 86%, transparent); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(1.4) blur(10px);
}
.topbar .gsearch { position: relative; flex: 1; max-width: 460px; }
/* search-box magnifier — applies in the topbar AND anywhere else a .gsearch is used (e.g. Contacts) */
.gsearch { position: relative; }
.gsearch > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.topbar .gsearch input { padding: 9px 12px 9px 36px; border-radius: var(--pill); background: var(--bg); border: 1.5px solid transparent; font-size: 13px; }
.topbar .gsearch input:focus { background: var(--card); border-color: var(--accent); box-shadow: var(--ring); }
.topbar .gsearch kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 10px; color: var(--faint); border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 5px; font-family: inherit; pointer-events: none; }
.topbar .spacer { flex: 1; }
.topbar .tb-btn { background: var(--bg); border: 1px solid var(--border); color: var(--muted); width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; transition: all .15s var(--ease); position: relative; }
.topbar .tb-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.topbar .tb-btn svg { width: 18px; height: 18px; pointer-events: none; }

.gsearch-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; z-index: 80; max-height: 60vh; overflow-y: auto; }
.gsearch-results .gs-group { font-size: 10px; letter-spacing: .8px; text-transform: uppercase; color: var(--faint); font-weight: 700; padding: 10px 14px 4px; }
.gsearch-results a { display: flex; align-items: center; gap: 10px; padding: 9px 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.gsearch-results a:last-child { border-bottom: none; }
.gsearch-results a:hover { background: var(--accent-soft); text-decoration: none; }
.gsearch-results a svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--muted); }
.gsearch-results .gs-sub { color: var(--muted); font-size: 12px; margin-left: auto; }
/* oversized decorative icon (e.g. empty states) */
.svg-xl svg { width: 42px; height: 42px; }
.gsearch-results .empty { padding: 18px; }

/* theme menu */
.theme-menu { position: absolute; top: calc(100% + 8px); right: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 8px; z-index: 90; width: 232px; animation: pop .14s var(--ease); }
.theme-menu .tm-head { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; padding: 6px 8px 8px; }
.theme-opt { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; cursor: pointer; transition: background .12s; }
.theme-opt:hover { background: var(--bg); }
.theme-opt.active { background: var(--accent-soft); }
.theme-opt .swatch { width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.theme-opt .tm-name { font-weight: 600; font-size: 13px; }
.theme-opt .tm-check { margin-left: auto; color: var(--accent); opacity: 0; }
.theme-opt.active .tm-check { opacity: 1; }

.impersonation-bar { background: linear-gradient(90deg, #4b2f86, #6a44b8); color: #efe9ff; padding: 9px 34px; font-size: 13px; display: flex; align-items: center; gap: 12px; }
.impersonation-bar.warn { background: linear-gradient(90deg, #8a2c2c, #a93b3b); color: #fbe7e7; }
.demo-bar { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: var(--on-accent); padding: 9px 34px; font-size: 13px; display: flex; align-items: center; gap: 8px; justify-content: center; text-align: center; }
.demo-bar a { color: var(--on-accent); text-decoration: underline; font-weight: 700; }
@media (max-width: 768px) { .demo-bar { padding: 9px 14px; } }
.impersonation-bar a { color: #fff; text-decoration: underline; }
.impersonation-bar button { margin-left: auto; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); color: #fff; padding: 5px 14px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.impersonation-bar button:hover { background: rgba(255,255,255,.28); }

/* ---------- generic ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 24px; letter-spacing: -.4px; font-weight: 750; }
.page-head .sub, .page-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; font-weight: 450; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px; margin-bottom: 18px; transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease); }
.card h2 { font-size: 12.5px; margin-bottom: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; font-weight: 700; }
.card.hover:hover, .card.lift:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.mt { margin-top: 12px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 84%, #000)); color: var(--on-accent); border: none; padding: 9px 18px; border-radius: 10px; font-weight: 600; font-size: 13px; letter-spacing: -.01em; transition: filter .15s var(--ease), transform .08s var(--ease), box-shadow .15s var(--ease); box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 40%, transparent), 0 4px 14px color-mix(in srgb, var(--accent) 26%, transparent); }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.lg svg { width: 18px; height: 18px; }
.btn:hover { filter: brightness(1.07); text-decoration: none; box-shadow: 0 2px 4px color-mix(in srgb, var(--accent) 44%, transparent), 0 8px 22px color-mix(in srgb, var(--accent) 32%, transparent); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--card); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: var(--bg); border-color: var(--accent); color: var(--accent); filter: none; }
.btn.danger { background: var(--card); color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 32%, var(--border)); box-shadow: none; }
.btn.danger:hover { background: var(--red-soft); filter: none; }
.btn.gold { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--on-accent); }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: none; border: none; }
.btn.ghost:hover { background: var(--accent-soft); filter: none; }
.btn.sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn.lg { padding: 12px 24px; font-size: 14.5px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea { font: inherit; padding: 9px 12px; border: 1.5px solid var(--border-strong); border-radius: 10px; background: var(--card); color: var(--text); width: 100%; transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--faint); }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 980px) { .grid3, .grid4 { grid-template-columns: 1fr 1fr; } }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 11px 12px; border-bottom: 1px solid var(--border); font-weight: 700; }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s var(--ease); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--accent-soft); }
/* Right-aligned action buttons in a table row: wrap to the next line instead of clipping/overflowing the card. */
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: var(--pill); font-size: 11.5px; font-weight: 650; white-space: nowrap; letter-spacing: .1px; }
.badge.Open { background: var(--info-soft); color: var(--info); }
.badge.s-TitleSearch { background: var(--amber-soft); color: var(--amber); }
.badge.s-CommitmentIssued { background: var(--violet-soft); color: var(--violet); }
.badge.s-ClearedtoClose { background: var(--green-soft); color: var(--green); }
.badge.s-Closed { background: var(--bg-2); color: var(--muted); }
.badge.s-Cancelled { background: var(--red-soft); color: var(--red); }
.badge.dep { background: var(--green-soft); color: var(--green); }
.badge.dis { background: var(--red-soft); color: var(--red); }
.badge.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

.inv-tpl-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; }
.inv-tpl-bar label { font-weight: 650; color: var(--navy); font-size: 13px; }
.inv-tpl-bar select { width: auto; flex: 1; min-width: 200px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: box-shadow .2s var(--ease), transform .2s var(--ease); }
.stat:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: .9; }
.stat .num { font-size: 27px; font-weight: 760; color: var(--heading); letter-spacing: -.8px; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 500; }
.stat.alert::before { background: linear-gradient(90deg, #e87070, var(--red)); }
.stat.alert .num { color: var(--red); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; flex-wrap: wrap; }
.tabs button { background: none; border: none; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 13px; border-radius: 8px 8px 0 0; transition: color .15s, background .15s; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--text); background: var(--bg); }
.tabs button[data-mode] { font-size: 13px; }

/* ---------- plans / pricing ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 18px; }
.plan-card { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.plan-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.plan-card.current { border-color: var(--accent); box-shadow: var(--ring), var(--shadow); }
.plan-name { font-weight: 700; color: var(--heading); font-size: 15px; }
.plan-price { font-size: 32px; font-weight: 780; color: var(--heading); margin: 8px 0 2px; letter-spacing: -1.2px; }
.plan-price span { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.plan-blurb { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.plan-feat { list-style: none; margin: 0 0 18px; flex: 1; }
.plan-feat li { padding: 6px 0 6px 26px; position: relative; font-size: 13px; color: var(--text); }
.plan-feat li::before { content: '✓'; position: absolute; left: 2px; color: var(--green); font-weight: 700; }

/* ---------- charts ---------- */
.chart-wrap { position: relative; }
.chart { width: 100%; display: block; }
.chart-bar { fill: var(--accent); opacity: .85; transition: opacity .12s; }
.chart-bar:hover { opacity: 1; }
.chart-labels { display: flex; margin-top: 4px; }
.chart-labels span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.chart-max { position: absolute; top: 0; right: 0; font-size: 11px; color: var(--muted); background: color-mix(in srgb, var(--card) 85%, transparent); padding: 1px 6px; border-radius: 5px; }

/* ---------- tickets ---------- */
.ticket-thread { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px; }
.ticket-msg { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; max-width: 85%; align-self: flex-start; font-size: 13.5px; }
.ticket-msg.platform { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 24%, var(--border)); align-self: flex-end; }
.ticket-msg .meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }

/* ---------- branding ---------- */
.logo-preview { width: 110px; height: 72px; border: 1.5px dashed var(--border-strong); border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--bg); flex-shrink: 0; overflow: hidden; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sidebar .brand img.org-logo { border-radius: 8px; background: #fff; padding: 2px; object-fit: contain; }

/* ---------- rich text editor ---------- */
.rte-toolbar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-bottom: none; border-radius: 10px 10px 0 0; }
.rte-toolbar button { background: var(--card); border: 1px solid var(--border); border-radius: 7px; padding: 5px 10px; font-size: 13px; min-width: 34px; color: var(--text); }
.rte-toolbar button:hover { background: var(--accent-soft); border-color: var(--accent); }
.rte-toolbar .sep { width: 1px; height: 22px; background: var(--border-strong); margin: 0 4px; }
.rte-toolbar select { width: auto; max-width: 190px; padding: 5px 8px; font-size: 13px; font-weight: 600; color: var(--accent-dark); border-color: var(--accent); background: var(--accent-soft); }
.rte { border: 1px solid var(--border); border-radius: 0; min-height: 280px; max-height: 46vh; overflow-y: auto; padding: 28px 34px; background: #fff; color: #1c2333; font-family: Georgia, 'Times New Roman', serif; font-size: 14px; line-height: 1.55; }
.rte:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); position: relative; z-index: 1; }
.rte h1 { font-size: 19px; } .rte h3 { font-size: 15px; }
.rte img { max-width: 100%; }
.rte-html { min-height: 340px; max-height: 52vh; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; line-height: 1.5; border-radius: 0 0 10px 10px; }
.rte-preview { min-height: 340px; max-height: 52vh; overflow-y: auto; border-radius: 0 0 10px 10px; margin: 0; max-width: none; }
.rte-pv { background: var(--bg); border: 1px solid var(--border); }
.rte-pv .pv-host { padding: 16px 0 20px; gap: 22px; }
mark.merged { background: #fff3cd; border-radius: 3px; padding: 0 2px; }
/* template page header/footer mini-editors */
.hf-region { border: 1px solid var(--border); background: var(--bg); }
.hf-region:first-of-type { border-bottom: none; }
.hf-region summary { cursor: pointer; padding: 7px 12px; font-size: 12px; font-weight: 600; color: var(--muted); user-select: none; }
.rte-hf { min-height: 70px; max-height: 22vh; }
details.hf-region:last-of-type .rte { border-radius: 0; }
.rte-hf:empty::before, .rte:empty::before { content: ''; }
.rte-hf[data-ph]:empty::before { content: attr(data-ph); color: var(--muted); font-style: italic; }
/* page break — visible divider on screen, real page break in print/PDF */
.page-break { text-align: center; color: var(--muted); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; border-top: 2px dashed var(--border-strong); margin: 18px 0; padding-top: 4px; user-select: none; }
@media print { .page-break { border: none; color: transparent; height: 0; margin: 0; padding: 0; page-break-after: always; break-after: page; } }
/* repeating header/footer bands (template wrapper + preview) */
.tv-doc-hdr { padding-bottom: 12px; border-bottom: 1px solid #ccc; margin-bottom: 14px; }
.tv-doc-ftr { padding-top: 10px; border-top: 1px solid #ccc; margin-top: 14px; font-size: 11px; color: #555; }
.tv-doc-hdr img, .tv-doc-ftr img, .doc-paper img { max-width: 100%; }

/* ---------- 2FA ---------- */
.tfa-secret { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 18px; letter-spacing: 2px; background: var(--bg); border: 1.5px dashed var(--border-strong); border-radius: 10px; padding: 12px 16px; text-align: center; user-select: all; }
.backup-codes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.backup-codes span { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 15px; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 8px 4px; text-align: center; user-select: all; }
@media (max-width: 700px) { .backup-codes { grid-template-columns: repeat(2, 1fr); } }

.fineprint { padding: 10px 16px 14px; font-size: 10px; color: var(--side-fg-dim); text-align: center; letter-spacing: .3px; user-select: none; }

/* ---------- owner dashboard ---------- */
.mix-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.mix-label { width: 120px; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.mix-bar { flex: 1; height: 14px; background: var(--bg-2); border-radius: 7px; overflow: hidden; }
.mix-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 7px; min-width: 6px; }
.mix-count { width: 36px; text-align: right; font-weight: 700; color: var(--heading); }
ul.roadmap { list-style: none; margin: 0; padding: 0; }
ul.roadmap li { padding: 9px 0 9px 26px; position: relative; border-bottom: 1px solid var(--border); font-size: 13.5px; }
ul.roadmap li:last-child { border-bottom: none; }
ul.roadmap li::before { content: ''; position: absolute; left: 4px; top: 14px; width: 9px; height: 9px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-2), var(--accent)); }

/* ---------- danger zone ---------- */
.danger-zone { margin: 14px 0; border: 1px solid color-mix(in srgb, var(--red) 26%, var(--border)); border-radius: 11px; padding: 12px 16px; background: var(--red-soft); }
.danger-zone summary { color: var(--red); font-weight: 600; font-size: 13px; cursor: pointer; }
.danger-zone[open] summary { margin-bottom: 6px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background:
  radial-gradient(1100px 600px at 78% -12%, color-mix(in srgb, var(--accent) 60%, #1a2034) 0%, transparent 55%),
  radial-gradient(900px 520px at -8% 112%, color-mix(in srgb, var(--accent-2) 55%, #141a2c) 0%, transparent 52%),
  linear-gradient(160deg, #161d33 0%, #0d1322 100%); position: relative; overflow: hidden; padding: 20px; }
.login-wrap::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.10) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(180deg, transparent, #000 35%, #000 70%, transparent); }
.login-card { position: relative; background: rgba(255,255,255,.99); color: #1c2333; border-radius: 22px; padding: 42px 40px 34px; width: 410px; box-shadow: 0 30px 80px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.1); animation: pop .35s var(--ease); }
.login-logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 26px; }
.login-logo img { width: 62px; height: 62px; margin-bottom: 14px; border-radius: 15px; filter: drop-shadow(0 8px 18px rgba(22,34,60,.35)); }
.login-logo h1 { font-size: 26px; color: #0e1525; letter-spacing: -.5px; }
.login-logo h1 span { color: var(--accent); }
.login-logo .sub { color: #6c7589; font-size: 13px; margin-top: 5px; }
.login-card label { color: #6c7589; }
.login-card input { background: #fff; border-color: #e2e6ef; color: #1c2333; }
.login-card .btn { width: 100%; padding: 12px; font-size: 14px; border-radius: 11px; margin-top: 4px; }
.login-foot { text-align: center; margin-top: 22px; font-size: 12px; color: #8d97ad; }
.login-foot a { color: var(--accent); }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10,15,28,.5); backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; padding: 44px 16px; z-index: 100; overflow-y: auto; animation: fadeIn .15s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 28px; width: 100%; max-width: 640px; box-shadow: var(--shadow-lg); animation: pop .2s var(--ease); }
.modal h2 { font-size: 18px; margin-bottom: 18px; color: var(--heading); }
.modal.wide { max-width: 920px; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- tasks / notes ---------- */
.task-row { display: flex; align-items: center; gap: 11px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: none; }
.task-row input[type=checkbox] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--green); }
.task-row .done { text-decoration: line-through; color: var(--muted); }
.task-row .due { font-size: 12px; color: var(--amber); white-space: nowrap; }
.task-row .task-due { width: 138px; flex-shrink: 0; padding: 4px 6px; font-size: 12px; }
.task-row .del { visibility: hidden; }
.task-row:hover .del { visibility: visible; }
.note { border-bottom: 1px solid var(--border); padding: 12px 4px; }
.note:last-child { border-bottom: none; }
.note .meta { font-size: 12px; color: var(--muted); margin-bottom: 3px; }

.progress { height: 7px; background: var(--bg-2); border-radius: 4px; overflow: hidden; width: 90px; display: inline-block; vertical-align: middle; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .4s var(--ease); }

.toast { position: fixed; bottom: 26px; right: 26px; background: var(--heading); color: #fff; padding: 13px 22px; border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 200; animation: fadeup .22s var(--ease); font-weight: 550; max-width: 380px; }
.toast.err { background: var(--red); }
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }

.empty { text-align: center; color: var(--muted); padding: 38px 10px; }
.empty svg { width: 44px; height: 44px; opacity: .3; margin-bottom: 10px; }

.userbox #notifyBtn.muted-bell { opacity: .4; position: relative; }
.userbox #notifyBtn.muted-bell::after { content: ''; position: absolute; left: 3px; right: 3px; top: 50%; height: 2px; background: currentColor; transform: rotate(-45deg); border-radius: 2px; }

/* ---------- settlement editor ---------- */
.settle-table input { padding: 5px 8px; font-size: 13px; }
.settle-table td { padding: 5px 7px; }
.settle-section td { background: var(--bg-2); font-weight: 700; color: var(--heading); font-size: 13px; }
.settle-totals td { font-weight: 700; border-top: 2px solid var(--border-strong); }

/* ---------- print ---------- */
@media print {
  .sidebar, .topbar, .page-head .btn, .no-print, .impersonation-bar, .mobile-topbar { display: none !important; }
  .main { padding: 0; max-width: none; animation: none; }
  .card { border: none; box-shadow: none; padding: 0; }
  body { background: #fff; }
}
.doc-paper { background: #fff; color: #1c2333; padding: 48px 56px; max-width: 820px; margin: 0 auto; border: 1px solid var(--border); border-radius: 6px; line-height: 1.55; font-family: Georgia, 'Times New Roman', serif; font-size: 14px; box-shadow: var(--shadow); }
.doc-paper h1 { font-size: 19px; margin-bottom: 10px; }
.doc-paper h3 { margin: 18px 0 8px; font-size: 15px; }
.doc-paper p, .doc-paper ol { margin-bottom: 10px; }
.doc-paper ol { padding-left: 22px; }
.doc-paper hr { border: none; border-top: 1px solid #999; margin: 14px 0; }
/* combined documents: each source doc is its own .doc-page — show as a separate sheet on screen, real page break in print */
.doc-paper .doc-page { padding-bottom: 40px; margin-bottom: 40px; border-bottom: 2px dashed var(--border-strong); }
.doc-paper .doc-page:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
@media print { .doc-paper { border: none; padding: 0; max-width: none; box-shadow: none; } .doc-paper .doc-page { border-bottom: none; margin: 0; padding: 0; } }
/* Word-style paginated on-screen preview (printing uses the hidden raw .doc-paper instead) */
.print-only { display: none; }
.pv-host { display: flex; flex-direction: column; align-items: center; gap: 28px; padding: 6px 0 24px; }
.pv-page { position: relative; width: 816px; height: 1056px; background: #fff; color: #1c2333; border-radius: 2px; box-shadow: 0 6px 26px rgba(16,26,50,.18); font-family: Georgia, 'Times New Roman', serif; font-size: 14px; line-height: 1.55; overflow: hidden; }
.pv-inner { position: absolute; inset: 0; padding: 72px; display: flex; flex-direction: column; }
.pv-content { flex: 1 1 auto; overflow: hidden; }
.pv-content > :first-child { margin-top: 0; }
.pv-hdr { flex: 0 0 auto; }
.pv-ftr { flex: 0 0 auto; }
.pv-page img { max-width: 100%; }
.pv-page h1 { font-size: 19px; margin-bottom: 10px; } .pv-page h3 { font-size: 15px; margin: 18px 0 8px; }
.pv-page p, .pv-page ol { margin-bottom: 10px; } .pv-page ol { padding-left: 22px; }
.pv-page hr { border: none; border-top: 1px solid #999; margin: 14px 0; }
.pv-page table { border-collapse: collapse; }
.pv-pagenum { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); background: rgba(20,34,60,.88); color: #fff; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; font-size: 14px; font-weight: 600; padding: 7px 18px; border-radius: 999px; display: flex; align-items: center; gap: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.22); white-space: nowrap; }
.pv-check { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; background: #2f6fed; border-radius: 50%; font-size: 11px; }
@media print { .print-only { display: block !important; } }

/* ---------- support guides ---------- */
.guide-intro { margin-bottom: 14px; }
.guide-intro h2 { margin-bottom: 4px; }
.guides { display: flex; flex-direction: column; gap: 10px; }
details.guide { background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden; }
details.guide summary { cursor: pointer; padding: 15px 18px; font-weight: 600; color: var(--heading); list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
details.guide summary::-webkit-details-marker { display: none; }
details.guide summary::after { content: '+'; color: var(--accent); font-size: 20px; font-weight: 400; line-height: 1; flex-shrink: 0; }
details.guide[open] summary::after { content: '\2013'; }
details.guide[open] summary { border-bottom: 1px solid var(--border); }
details.guide summary:hover { background: var(--bg); }
.guide-body { padding: 15px 18px 18px; color: var(--text); line-height: 1.55; }
.guide-body p { margin: 6px 0; }
.guide-body ol, .guide-body ul { margin: 8px 0 8px 20px; }
.guide-body li { margin: 4px 0; }
.guide-body code, .chips code { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; background: var(--accent-soft); color: var(--accent-dark); border: 1px solid var(--border); padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ---------- changelog ---------- */
.changelog { display: flex; flex-direction: column; gap: 12px; }
.cl-entry { margin-bottom: 0; }
.cl-head { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.cl-ver { font-weight: 700; font-size: 16px; color: var(--heading); }
.cl-date { margin-left: auto; color: var(--muted); font-size: 12px; }
.cl-list { margin: 4px 0 0 20px; line-height: 1.55; }
.cl-list li { margin: 6px 0; }
.cl-list strong { color: var(--heading); }

/* ---------- platform usage ---------- */
.section-head { margin: 24px 0 12px; font-size: 16px; color: var(--heading); font-weight: 700; }
.usage-table { margin-top: 6px; }
.usage-table th.right, .usage-table td.right { text-align: right; }
.usage-table td .badge { font-size: 10px; }

input.locked, input.locked:focus { background: var(--bg-2); color: var(--muted); border-style: dashed; cursor: not-allowed; -webkit-text-fill-color: var(--muted); opacity: 1; box-shadow: none; }

.impersonation-bar .imp-switch { display: inline-flex; align-items: center; gap: 6px; margin: 0 auto 0 18px; font-size: 12px; opacity: .95; }
.impersonation-bar .imp-switch select { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 7px; padding: 3px 8px; font-size: 12px; max-width: 230px; width: auto; }
.impersonation-bar .imp-switch select option { color: #1c2434; }

/* ---------- message board ---------- */
#broadcastBar:empty { display: none; }
.broadcast { display: flex; align-items: flex-start; gap: 12px; padding: 12px 18px; border-bottom: 1px solid rgba(0,0,0,.06); font-size: 13px; line-height: 1.45; }
.broadcast .bc-text { flex: 1; }
.broadcast .bc-x { background: none; border: none; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .5; padding: 0 4px; }
.broadcast .bc-x:hover { opacity: 1; }
.broadcast.bc-info { background: var(--info-soft); color: var(--info); }
.broadcast.bc-warn { background: var(--amber-soft); color: var(--amber); }
.broadcast.bc-crit { background: var(--red-soft); color: var(--red); }
.bc-orglist { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 14px; max-height: 200px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.bc-orgopt { font-weight: 400; display: flex; align-items: center; gap: 6px; }
.bc-orgopt input { width: 15px; height: 15px; }

/* ============================================================================
   V2 NEW MODULES
   ========================================================================== */

/* contacts / CRM */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.contact-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s var(--ease); cursor: pointer; }
.contact-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.contact-card .ct-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.contact-card .ct-av { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; flex-shrink: 0; font-size: 15px; }
.contact-card .ct-name { font-weight: 700; color: var(--heading); font-size: 14.5px; }
.contact-card .ct-co { font-size: 12.5px; color: var(--muted); }
.contact-card .ct-meta { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.contact-card .ct-meta span { display: flex; align-items: center; gap: 7px; }
.type-pill { display: inline-block; padding: 2px 10px; border-radius: var(--pill); font-size: 11px; font-weight: 650; background: var(--accent-soft); color: var(--accent-dark); }

/* timeline (consumer portal + order milestones) */
.timeline { position: relative; margin: 8px 0 8px 6px; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 2px; background: var(--border-strong); }
.tl-step { position: relative; padding: 0 0 22px 0; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step::before { content: ''; position: absolute; left: -25px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--card); border: 2px solid var(--border-strong); z-index: 1; }
.tl-step.done::before { background: var(--green); border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.tl-step.current::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 4px var(--accent-soft); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 12%, transparent); } }
.tl-step .tl-title { font-weight: 650; color: var(--heading); font-size: 14px; }
.tl-step.done .tl-title { color: var(--text); }
.tl-step:not(.done):not(.current) .tl-title { color: var(--muted); }
.tl-step .tl-when { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tl-step .tl-desc { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* workflow / milestone progress */
.milestone-track { display: flex; gap: 6px; margin: 4px 0 16px; flex-wrap: wrap; }
.ms-pill { flex: 1; min-width: 84px; text-align: center; font-size: 11px; font-weight: 600; padding: 8px 6px; border-radius: 9px; background: var(--bg-2); color: var(--muted); position: relative; transition: all .2s var(--ease); }
.ms-pill.done { background: var(--green-soft); color: var(--green); }
.ms-pill.current { background: var(--accent-soft); color: var(--accent-dark); box-shadow: inset 0 0 0 1.5px var(--accent); }

/* calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 6px 0; }
.cal-cell { background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; min-height: 92px; padding: 7px 8px; display: flex; flex-direction: column; gap: 4px; transition: border-color .15s; }
.cal-cell.dim { background: var(--bg); opacity: .55; }
.cal-cell.today { border-color: var(--accent); box-shadow: var(--ring); }
.cal-cell .cal-num { font-size: 12px; font-weight: 650; color: var(--muted); }
.cal-cell.today .cal-num { color: var(--accent); }
.cal-event { font-size: 11px; padding: 3px 7px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.closing { background: var(--green-soft); color: var(--green); }
.cal-event.task { background: var(--amber-soft); color: var(--amber); }
.cal-event:hover { filter: brightness(.97); }

/* commitment / policy schedules */
.sched-block { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.sched-head { background: var(--bg-2); padding: 11px 16px; font-weight: 700; color: var(--heading); font-size: 13px; display: flex; align-items: center; justify-content: space-between; }
.sched-body { padding: 14px 16px; }
.exc-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.exc-row:last-child { border-bottom: none; }
.exc-row .exc-num { font-weight: 700; color: var(--accent); flex-shrink: 0; width: 24px; }
.exc-row .del { visibility: hidden; }
.exc-row:hover .del { visibility: visible; }

/* segmented control */
.segmented { display: inline-flex; background: var(--bg-2); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { background: none; border: none; padding: 6px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); transition: all .15s var(--ease); }
.segmented button.active { background: var(--card); color: var(--accent); box-shadow: var(--shadow-sm); }

/* public consumer portal */
.portal-body { min-height: 100vh; background: var(--bg); padding: 0; }
.portal-hero { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; padding: 40px 24px 64px; text-align: center; }
.portal-hero img { height: 48px; margin-bottom: 16px; border-radius: 10px; background: #fff; padding: 4px; }
.portal-hero h1 { color: #fff; font-size: 26px; letter-spacing: -.5px; }
.portal-hero .sub { opacity: .9; margin-top: 6px; font-size: 14px; }
.portal-wrap { max-width: 760px; margin: -44px auto 40px; padding: 0 18px; }
.portal-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 26px; margin-bottom: 18px; }
.portal-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 18px 40px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { color: var(--heading); font-weight: 600; text-align: right; }

/* ---------- mobile ---------- */
.mobile-topbar { display: none; }
.nav-overlay { display: none; }
@media (max-width: 768px) {
  .topbar { padding: 0 14px; gap: 8px; position: static; backdrop-filter: none; }
  .topbar .gsearch { max-width: none; }
  .topbar .gsearch kbd { display: none; }
  .mobile-topbar { display: flex; align-items: center; gap: 12px; padding: 11px 16px; background: linear-gradient(180deg, var(--side-bg), var(--side-bg-2)); color: var(--side-brand); position: sticky; top: 0; z-index: 60; border-bottom: 1px solid var(--side-border); }
  .nav-toggle { background: none; border: none; color: var(--side-brand); padding: 4px; display: flex; align-items: center; border-radius: 8px; }
  .nav-toggle:hover { background: color-mix(in srgb, var(--side-fg) 14%, transparent); }
  .nav-toggle svg { width: 24px; height: 24px; pointer-events: none; }
  .mtb-title { font-weight: 700; font-size: 16px; letter-spacing: -.2px; }
  .mtb-title span { color: var(--accent); }

  .sidebar { position: fixed; left: 0; top: 0; height: 100dvh; z-index: 110; transform: translateX(-100%); transition: transform .24s var(--ease); box-shadow: 0 0 50px rgba(0,0,0,.5); }
  .layout.nav-open .sidebar { transform: translateX(0); }
  .nav-overlay { display: block; position: fixed; inset: 0; background: rgba(10,15,28,.55); z-index: 105; opacity: 0; pointer-events: none; transition: opacity .24s; }
  .layout.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }

  .main { padding: 16px 14px 40px; }
  .page-head h1 { font-size: 20px; }
  .grid2 { grid-template-columns: 1fr; }
  .card:has(table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* let wide tables scroll horizontally instead of crushing columns (e.g. "Free Trial" wrapping) */
  .card:has(table) > table { width: max-content; min-width: 100%; }
  .card:has(table) > table td, .card:has(table) > table th { white-space: nowrap; }
  .card:has(table) > table td .small.muted { white-space: normal; }
  .impersonation-bar { padding: 10px 14px; flex-wrap: wrap; }
  .impersonation-bar button { margin-left: 0; }
  .impersonation-bar .imp-switch { margin: 0; }
  .modal-bg { padding: 16px 10px; }
  .modal { padding: 20px; }
  .cal-cell { min-height: 64px; }
  .cal-event { font-size: 9px; }
}

/* compact density */
body.compact { font-size: 13px; }
body.compact .card { padding: 16px; margin-bottom: 13px; }
body.compact table th, body.compact table td { padding: 7px 10px; }
body.compact .stat { padding: 14px; }
body.compact .stat .num { font-size: 23px; }
body.compact .page-head { margin-bottom: 14px; }
body.compact .field { margin-bottom: 9px; }
body.compact .sidebar nav a { padding-top: 8px; padding-bottom: 8px; }

/* ------------------------------------------------------------------ Welcome tour (coach marks) */
.tour-veil{position:fixed;inset:0;z-index:9998}
.tour-veil svg{position:absolute;inset:0;width:100%;height:100%}
.tour-veil .tour-dim{fill:rgba(2,6,23,.62)}
.tour-ring{position:fixed;z-index:9999;border-radius:12px;pointer-events:none;
  box-shadow:0 0 0 3px var(--accent),0 0 0 8px color-mix(in srgb,var(--accent) 30%,transparent);
  transition:top .26s cubic-bezier(.4,0,.2,1),left .26s cubic-bezier(.4,0,.2,1),width .26s,height .26s}
.tour-pop{position:fixed;z-index:10000;width:330px;max-width:calc(100vw - 24px);background:var(--card);color:var(--text);
  border-radius:14px;box-shadow:0 22px 55px rgba(2,6,23,.38);padding:16px 16px 8px;
  transition:top .26s cubic-bezier(.4,0,.2,1),left .26s cubic-bezier(.4,0,.2,1)}
.tour-pop .tour-step{font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--accent)}
.tour-pop h4{margin:5px 0 6px;font-size:16px;font-weight:700}
.tour-pop p{margin:0;color:var(--muted);font-size:13.5px;line-height:1.55}
.tour-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:14px}
.tour-dots{display:flex;gap:5px}
.tour-dots i{display:block;width:6px;height:6px;border-radius:50%;background:var(--border)}
.tour-dots i.on{background:var(--accent);width:16px;border-radius:3px}
.tour-btns{display:flex;gap:6px}
.tour-btn{border:1px solid var(--border);background:transparent;color:var(--text);padding:7px 12px;border-radius:9px;
  font:inherit;font-size:13px;font-weight:600;cursor:pointer}
.tour-btn.primary{background:var(--accent);color:var(--on-accent);border-color:transparent}
.tour-never{display:block;width:100%;margin-top:6px;padding:6px 0;border:0;background:transparent;color:var(--muted);
  font:inherit;font-size:12px;cursor:pointer;text-align:center}
.tour-never:hover{color:var(--text);text-decoration:underline}
.tour-x{position:absolute;top:8px;right:8px;border:0;background:transparent;color:var(--muted);font-size:19px;line-height:1;
  padding:2px 6px;border-radius:7px;cursor:pointer}
.tour-x:hover{color:var(--text)}
.tour-beak{position:absolute;width:14px;height:14px;background:var(--card);transform:rotate(45deg)}
@media (max-width:640px){.tour-pop{width:auto;left:12px!important;right:12px}.tour-beak{display:none!important}}
