﻿/* mandm-comply design system â€” hand-built, no build step. Themeable per firm via --brand. */
:root {
  --brand: #102c4c;
  --p-50: color-mix(in srgb, var(--brand) 9%, white);
  --p-100: color-mix(in srgb, var(--brand) 18%, white);
  --p-200: color-mix(in srgb, var(--brand) 32%, white);
  --p-500: color-mix(in srgb, var(--brand) 88%, white);
  --p-600: var(--brand);
  --p-700: color-mix(in srgb, var(--brand) 82%, black);
  --p-glow: color-mix(in srgb, var(--brand) 35%, transparent);

  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #f8fafc; --surface-3: #f1f5f9;
  --border: #e6eaf1; --border-strong: #d5dbe6;
  --text: #0f172a; --text-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --green: #059669; --green-bg: #ecfdf5; --amber: #b45309; --amber-bg: #fffbeb; --red: #dc2626; --red-bg: #fef2f2;
  --blue: #2563eb; --blue-bg: #eff6ff; --violet: #7c3aed; --violet-bg: #f5f3ff; --cyan: #0e7490; --cyan-bg: #ecfeff;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px;
  --sh-1: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.05);
  --sh-2: 0 1px 2px rgba(15,23,42,.04), 0 4px 12px -2px rgba(15,23,42,.07), 0 10px 24px -8px rgba(15,23,42,.05);
  --sh-3: 0 24px 60px -12px rgba(15,23,42,.28);
  --sidebar-w: 248px; --topbar-h: 58px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Plus Jakarta Sans', var(--font);
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
}
[data-theme="dark"] {
  --bg: #0b1120; --surface: #111a2e; --surface-2: #0f172a; --surface-3: #1a2540;
  --border: #1f2b45; --border-strong: #2b3a5c;
  --text: #f1f5f9; --text-2: #cbd5e1; --muted: #94a3b8; --faint: #64748b;
  --p-50: color-mix(in srgb, var(--brand) 16%, #0f172a); --p-100: color-mix(in srgb, var(--brand) 26%, #0f172a);
  --p-200: color-mix(in srgb, var(--brand) 40%, #0f172a); --p-700: color-mix(in srgb, var(--brand) 45%, white);
  /* the default navy brand would vanish on the dark surface, so primary actions are lifted towards a mid blue */
  --p-500: color-mix(in srgb, var(--brand) 40%, #7db3f0); --p-600: color-mix(in srgb, var(--brand) 55%, #5b9be6);
  --green-bg: #052e22; --amber-bg: #3a2406; --red-bg: #3b0d0d; --blue-bg: #0c2347; --violet-bg: #24124a; --cyan-bg: #06303a;
  --green: #34d399; --amber: #fbbf24; --red: #f87171; --blue: #60a5fa; --violet: #a78bfa; --cyan: #22d3ee;
  --sh-1: 0 1px 2px rgba(0,0,0,.4); --sh-2: 0 6px 20px -4px rgba(0,0,0,.5); --sh-3: 0 24px 60px -12px rgba(0,0,0,.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text-2); line-height: 1.55;
  font-feature-settings: "cv02","cv03","cv04","cv11","ss01"; font-variant-numeric: tabular-nums; letter-spacing: -.003em; }
h1,h2,h3,h4 { font-family: var(--font-head); color: var(--text); margin: 0; letter-spacing: -.02em; line-height: 1.25; }
h1 { font-size: 1.55rem; font-weight: 700; } h2 { font-size: 1.15rem; font-weight: 650; } h3 { font-size: 1rem; font-weight: 650; } h4 { font-size: .9rem; font-weight: 600; }
p { margin: 0 0 .75rem; } a { color: var(--p-600); text-decoration: none; } a:hover { color: var(--p-700); }
[data-theme="dark"] a { color: var(--p-500); }
img, svg { vertical-align: middle; } hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
::selection { background: var(--p-100); color: var(--p-700); }
*:focus-visible { outline: 2px solid var(--p-500); outline-offset: 2px; border-radius: 4px; }
* { scrollbar-width: thin; scrollbar-color: rgba(148,163,184,.45) transparent; }
[x-cloak] { display: none !important; }
svg.lucide { width: 1.15em; height: 1.15em; stroke-width: 1.6; flex-shrink: 0; }

/* ------------------------------------------------------------ shell */
.shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 50; transition: width .2s ease, transform .25s ease; }
.sidebar-brand { height: var(--topbar-h); display: flex; align-items: center; gap: .7rem; padding: 0 1rem; border-bottom: 1px solid var(--border); flex-shrink: 0; overflow: hidden; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--p-600); color: #fff; display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 800; font-size: 15px; flex-shrink: 0; box-shadow: 0 4px 12px -2px var(--p-glow); }
.brand-text { min-width: 0; line-height: 1.2; } .brand-text strong { display: block; color: var(--text); font-family: var(--font-head); font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem .7rem 1rem; }
.nav-section { font-size: .68rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); padding: 1rem .65rem .4rem; white-space: nowrap; }
.nav-item { display: flex; align-items: center; gap: .7rem; padding: .42rem .55rem; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: .93rem;
  transition: background .15s, color .15s; white-space: nowrap; position: relative; margin-bottom: 1px; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex-shrink: 0; transition: all .15s; }
.nav-item.active { background: var(--p-50); color: var(--p-700); font-weight: 600; }
.nav-item.active .nav-icon { background: linear-gradient(135deg, var(--p-500), var(--p-700)); color: #fff; box-shadow: 0 4px 10px -2px var(--p-glow); }
.nav-item .lock { margin-left: auto; color: var(--faint); font-size: .8rem; }
.nav-item .count { margin-left: auto; background: var(--red); color: #fff; font-size: .68rem; font-weight: 700; padding: 0 .4rem; border-radius: 99px; line-height: 1.5; }
.sidebar-foot { border-top: 1px solid var(--border); padding: .6rem .7rem; }
.usage { padding: .6rem .65rem .2rem; font-size: .75rem; color: var(--muted); }
body.nav-collapsed { --sidebar-w: 68px; }
body.nav-collapsed .nav-label, body.nav-collapsed .nav-section, body.nav-collapsed .brand-text, body.nav-collapsed .lock, body.nav-collapsed .usage, body.nav-collapsed .nav-item .count { display: none; }
body.nav-collapsed .nav-item { justify-content: center; padding: .42rem 0; }
.main { margin-left: var(--sidebar-w); transition: margin .2s ease; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar-h); display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(14px) saturate(160%); border-bottom: 1px solid var(--border); }
.search-trigger { display: flex; align-items: center; gap: .6rem; width: min(420px, 40vw); height: 36px; padding: 0 .75rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--faint); cursor: pointer; font: inherit; font-size: .9rem; }
.search-trigger:hover { border-color: var(--border-strong); } .search-trigger kbd { margin-left: auto; }
kbd { font-family: var(--mono); font-size: .7rem; background: var(--surface); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 .35rem; color: var(--muted); }
.content { padding: 1.5rem; max-width: 1560px; width: 100%; margin: 0 auto; flex: 1; animation: rise .25s ease; } /* no fill-mode: a retained transform would trap position:fixed modals */
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.35rem; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: .25rem 0 0; font-size: .95rem; }
.page-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.crumbs { font-size: .8rem; color: var(--faint); margin-bottom: .35rem; display: flex; gap: .4rem; align-items: center; } .crumbs a { color: var(--muted); }
.banner { display: flex; align-items: center; gap: .6rem; padding: .55rem 1.5rem; font-size: .88rem; font-weight: 500; }
.banner-info { background: var(--blue-bg); color: var(--blue); } .banner-warning { background: var(--amber-bg); color: var(--amber); }
.banner-danger { background: var(--red-bg); color: var(--red); } .banner-success { background: var(--green-bg); color: var(--green); }
.banner-impersonate { background: repeating-linear-gradient(135deg, #7c2d12, #7c2d12 14px, #9a3412 14px, #9a3412 28px); color: #ffedd5; }
.banner a { color: inherit; text-decoration: underline; margin-left: auto; }

/* ------------------------------------------------------------ cards & grid */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem .75rem; padding: .95rem 1.15rem; border-bottom: 1px solid var(--border); }
.card-head > * { min-width: 0; }
.card-head h3 { display: flex; align-items: center; gap: .5rem; } .card-head .sub { font-size: .82rem; color: var(--muted); font-weight: 400; }
.card-body { padding: 1.15rem; } .card-foot { padding: .8rem 1.15rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-hover { transition: transform .15s, box-shadow .2s, border-color .2s; } .card-hover:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--border-strong); }
.grid { display: grid; gap: 1.1rem; } .cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); } .cols-5 { grid-template-columns: repeat(5, minmax(0,1fr)); } .cols-6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
.cols-2-1 { grid-template-columns: minmax(0,2fr) minmax(0,1fr); } .cols-1-2 { grid-template-columns: minmax(0,1fr) minmax(0,2fr); } .cols-3-1 { grid-template-columns: minmax(0,3fr) minmax(0,1fr); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-all { grid-column: 1 / -1; }
.stat { position: relative; overflow: hidden; padding: 1.1rem 1.15rem; display: block; color: inherit; }
.stat::after { content: ""; position: absolute; right: -18px; top: -18px; width: 110px; height: 110px; opacity: .5;
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px); background-size: 10px 10px; mask-image: radial-gradient(circle at top right, #000, transparent 70%); }
.stat-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; margin-bottom: .8rem; font-size: 1.15rem;
  background: linear-gradient(135deg, var(--c1, var(--p-500)), var(--c2, var(--p-700))); box-shadow: 0 8px 18px -6px var(--c1, var(--p-glow)); }
.stat-label { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-family: var(--font-head); font-size: 1.9rem; font-weight: 750; color: var(--text); line-height: 1.15; letter-spacing: -.03em; }
.stat-foot { font-size: .8rem; color: var(--muted); margin-top: .25rem; display: flex; align-items: center; gap: .35rem; }
.tone-red { --c1: #f43f5e; --c2: #be123c; } .tone-amber { --c1: #f59e0b; --c2: #b45309; } .tone-green { --c1: #10b981; --c2: #047857; }
.tone-blue { --c1: #38bdf8; --c2: #2563eb; } .tone-violet { --c1: #a78bfa; --c2: #6d28d9; } .tone-slate { --c1: #64748b; --c2: #334155; } .tone-cyan { --c1: #22d3ee; --c2: #0e7490; }

/* ------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; height: 38px; padding: 0 1rem; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .9rem; letter-spacing: .005em; cursor: pointer; white-space: nowrap; text-decoration: none; line-height: 1;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn:active { transform: translateY(1px); } .btn:disabled, .btn.is-loading { opacity: .6; pointer-events: none; }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--p-600) 28%, transparent); }
/* primary: the logo's navy (or the firm's own colour), flat and solid */
.btn-primary { background: var(--p-600); border-color: var(--p-600); color: #fff !important; box-shadow: 0 1px 2px rgba(15, 23, 42, .18); }
.btn-primary:hover { background: color-mix(in srgb, var(--p-600) 84%, white); border-color: color-mix(in srgb, var(--p-600) 84%, white); box-shadow: 0 6px 16px -8px var(--p-glow); }
.btn-primary:active { background: color-mix(in srgb, var(--p-600) 88%, black); }
/* secondary: white with a navy outline */
.btn-secondary { background: var(--surface); border-color: color-mix(in srgb, var(--p-600) 26%, var(--border-strong)); color: var(--p-700) !important; }
.btn-secondary:hover { background: var(--p-50); border-color: var(--p-600); }
.btn-ghost { background: transparent; color: var(--muted) !important; } .btn-ghost:hover { background: var(--p-50); color: var(--p-700) !important; }
.btn-danger { background: #b91c1c; border-color: #b91c1c; color: #fff !important; } .btn-danger:hover { background: #991b1b; border-color: #991b1b; }
.btn-success { background: #0e7a52; border-color: #0e7a52; color: #fff !important; } .btn-success:hover { background: #0b6645; border-color: #0b6645; }
.btn-soft { background: var(--p-50); border-color: color-mix(in srgb, var(--p-600) 14%, transparent); color: var(--p-700) !important; }
.btn-soft:hover { background: var(--p-100); border-color: color-mix(in srgb, var(--p-600) 30%, transparent); }
[data-theme="dark"] .btn-secondary { color: var(--text) !important; border-color: var(--border-strong); } [data-theme="dark"] .btn-secondary:hover { background: var(--surface-2); }
[data-theme="dark"] .btn-soft, [data-theme="dark"] .btn-ghost:hover { color: var(--p-700) !important; }
.btn-sm { height: 32px; padding: 0 .75rem; font-size: .83rem; border-radius: 7px; } .btn-lg { height: 46px; padding: 0 1.4rem; font-size: 1rem; border-radius: 9px; }
.btn-icon { width: 38px; padding: 0; } .btn-icon.btn-sm { width: 32px; } .btn-block { width: 100%; }
.is-loading::after { content: ""; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ badges, chips, avatars */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; line-height: 1.5; background: var(--surface-3); color: var(--muted); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--green-bg); color: var(--green); } .badge-red { background: var(--red-bg); color: var(--red); } .badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue { background: var(--blue-bg); color: var(--blue); } .badge-violet { background: var(--violet-bg); color: var(--violet); } .badge-cyan { background: var(--cyan-bg); color: var(--cyan); }
.badge-primary { background: var(--p-50); color: var(--p-700); } .badge-slate, .badge-gray { background: var(--surface-3); color: var(--muted); }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border: 1px solid var(--border); border-radius: 8px; font-size: .8rem; background: var(--surface); color: var(--text-2); }
.auth-pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem; font-weight: 700; letter-spacing: .02em; padding: .1rem .5rem; border-radius: 6px;
  color: var(--ac, var(--muted)); background: color-mix(in srgb, var(--ac, #64748b) 12%, transparent); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: .78rem; flex-shrink: 0; background: var(--ac, var(--p-600)); }
.avatar-sm { width: 24px; height: 24px; font-size: .62rem; } .avatar-lg { width: 52px; height: 52px; font-size: 1.05rem; } .avatar-sq { border-radius: 10px; }
.avatar-stack { display: inline-flex; } .avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--surface); } .avatar-stack .avatar:first-child { margin-left: 0; }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
/* grid / flex children may shrink below their content; wide tables scroll inside their card instead of widening the page */
.grid > *, .stack > *, .main, .content { min-width: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: .65rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; } .table tbody tr { transition: background .12s; } .table tbody tr:hover { background: var(--surface-2); }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; } .table-compact td { padding: .42rem .8rem; } .table-compact th { padding: .5rem .8rem; }
.table tfoot td { font-weight: 700; color: var(--text); background: var(--surface-2); border-top: 1px solid var(--border-strong); }
.row-link { cursor: pointer; } .cell-main { font-weight: 600; color: var(--text); display: block; } .cell-sub { font-size: .8rem; color: var(--muted); }
.urg { border-left: 3px solid transparent; } .urg-danger { border-left-color: #ef4444; } .urg-warning { border-left-color: #f59e0b; } .urg-notice { border-left-color: #38bdf8; } .urg-ok { border-left-color: #10b981; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1.15rem; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--border); }

/* ------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; } .form-grid .field { margin-bottom: 0; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0,1fr)); } .form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); } .form-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.label { font-size: .8rem; font-weight: 600; color: var(--text-2); } .label .req { color: var(--red); } .help { font-size: .78rem; color: var(--muted); }
.input, .select, .textarea { width: 100%; height: 38px; padding: 0 .75rem; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: .92rem; transition: border-color .15s, box-shadow .15s; }
.textarea { height: auto; min-height: 90px; padding: .6rem .75rem; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 2rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .6rem center; }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--p-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--p-500) 20%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--faint); } .input-sm { height: 32px; font-size: .85rem; border-radius: 8px; }
.input-group { position: relative; } .input-group > svg, .input-group > i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; } .input-group .input { padding-left: 2.2rem; }
.check { display: inline-flex; align-items: center; gap: .55rem; font-size: .9rem; cursor: pointer; } .check input { width: 16px; height: 16px; accent-color: var(--p-600); }
.switch { position: relative; display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .9rem; }
.switch input { position: absolute; opacity: 0; } .switch .track { width: 38px; height: 22px; border-radius: 99px; background: var(--border-strong); transition: background .2s; position: relative; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + .track { background: var(--p-600); } .switch input:checked + .track::after { transform: translateX(16px); } .switch input:focus-visible + .track { outline: 2px solid var(--p-500); outline-offset: 2px; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; padding: .85rem 1.15rem; border-bottom: 1px solid var(--border); } .filters .input, .filters .select { width: auto; min-width: 150px; height: 34px; font-size: .86rem; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--r-lg); padding: 2.2rem 1rem; text-align: center; color: var(--muted); background: var(--surface-2); transition: all .2s; cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--p-500); background: var(--p-50); color: var(--p-700); } .dropzone .big { font-size: 2rem; color: var(--p-500); margin-bottom: .5rem; }

/* ------------------------------------------------------------ tabs, alerts, empty, progress */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: .45rem; padding: .65rem .9rem; font-weight: 600; font-size: .9rem; color: var(--muted); border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; font-family: inherit; }
.tab:hover { color: var(--text); } .tab.active { color: var(--p-700); border-bottom-color: var(--p-600); } .tab .badge { font-size: .68rem; padding: 0 .4rem; }
.segmented { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; max-width: 100%; overflow-x: auto; scrollbar-width: none; } .segmented > * { flex-shrink: 0; } .segmented a, .segmented button { padding: .3rem .75rem; border-radius: 7px; font-size: .84rem; font-weight: 600; color: var(--muted); border: 0; background: none; cursor: pointer; font-family: inherit; }
.segmented .active { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.alert { display: flex; gap: .7rem; padding: .8rem 1rem; border-radius: var(--r-md); font-size: .9rem; border: 1px solid; margin-bottom: 1rem; align-items: flex-start; }
.alert-info { background: var(--blue-bg); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 25%, transparent); } .alert-warning { background: var(--amber-bg); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 25%, transparent); }
.alert-danger { background: var(--red-bg); color: var(--red); border-color: color-mix(in srgb, var(--red) 25%, transparent); } .alert-success { background: var(--green-bg); color: var(--green); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); } .empty .ico { width: 56px; height: 56px; border-radius: 16px; background: var(--p-50); color: var(--p-600); display: grid; place-items: center; font-size: 1.5rem; margin: 0 auto 1rem; }
.empty h3 { margin-bottom: .3rem; } .empty p { max-width: 420px; margin: 0 auto 1rem; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; } .progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--p-500), var(--p-700)); transition: width .4s; }
.progress.green > span { background: #10b981; } .progress.amber > span { background: #f59e0b; } .progress.red > span { background: #ef4444; }
.ring { --v: 0; --size: 84px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--rc, var(--p-600)) calc(var(--v) * 1%), var(--surface-3) 0); position: relative; flex-shrink: 0; }
.ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); } .ring > span { position: relative; font-family: var(--font-head); font-weight: 750; font-size: 1.2rem; color: var(--text); }
.dl { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: .55rem 1rem; font-size: .9rem; margin: 0; } .dl dt { color: var(--muted); } .dl dd { margin: 0; color: var(--text); font-weight: 500; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; } .timeline li { position: relative; padding: 0 0 1.1rem 1.6rem; font-size: .88rem; } .timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--p-500); box-shadow: 0 0 0 3px var(--p-50); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 1px; background: var(--border); } .timeline li:last-child::after { display: none; } .timeline time { display: block; font-size: .76rem; color: var(--faint); }
.list { list-style: none; margin: 0; padding: 0; } .list > li, .list > a { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.15rem; border-bottom: 1px solid var(--border); color: inherit; } .list > :last-child { border-bottom: 0; } .list > a:hover { background: var(--surface-2); }

/* ------------------------------------------------------------ overlays */
.dropdown { position: relative; } .menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--sh-2); padding: .35rem; z-index: 60; }
.menu.left { right: auto; left: 0; } .menu a, .menu button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .65rem; border-radius: 8px; color: var(--text-2); font: inherit; font-size: .9rem; background: none; border: 0; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-3); color: var(--text); } .menu .sep { height: 1px; background: var(--border); margin: .3rem 0; } .menu .danger { color: var(--red); } .menu-head { padding: .55rem .65rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(15,23,42,.55); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-3); width: 100%; max-width: 540px; max-height: 90vh; display: flex; flex-direction: column; animation: pop .18s ease; border: 1px solid var(--border); }
.modal.wide { max-width: 800px; } .modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--border); } .modal-body { padding: 1.3rem; overflow-y: auto; } .modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.3rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } }
.toasts { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 200; display: flex; flex-direction: column; gap: .6rem; width: min(380px, calc(100vw - 2rem)); }
.toast { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem .9rem; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--tc, var(--p-600)); border-radius: 12px; box-shadow: var(--sh-2); font-size: .9rem; color: var(--text); animation: slide .25s ease; }
.toast-success { --tc: #10b981; } .toast-danger, .toast-error { --tc: #ef4444; } .toast-warning { --tc: #f59e0b; } .toast-info { --tc: #3b82f6; } .toast button { margin-left: auto; background: none; border: 0; color: var(--faint); cursor: pointer; padding: 0; }
@keyframes slide { from { opacity: 0; transform: translateX(24px); } }
.cmdk { position: fixed; inset: 0; z-index: 150; background: rgba(15,23,42,.5); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
.cmdk-panel { width: min(640px, 92vw); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--sh-3); overflow: hidden; animation: pop .15s ease; }
.cmdk-input { display: flex; align-items: center; gap: .7rem; padding: 0 1.1rem; border-bottom: 1px solid var(--border); } .cmdk-input input { flex: 1; height: 54px; border: 0; background: none; font: inherit; font-size: 1.05rem; color: var(--text); outline: none; }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: .4rem; } .cmdk-group { font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); padding: .6rem .7rem .3rem; }
.cmdk-item { display: flex; align-items: center; gap: .75rem; padding: .55rem .7rem; border-radius: 9px; color: var(--text-2); cursor: pointer; } .cmdk-item.sel { background: var(--p-50); color: var(--p-700); } .cmdk-item small { margin-left: auto; color: var(--faint); }
.cmdk-foot { display: flex; gap: 1rem; padding: .55rem 1rem; border-top: 1px solid var(--border); font-size: .75rem; color: var(--faint); background: var(--surface-2); }

/* ------------------------------------------------------------ calendar, kanban */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); border-top: 1px solid var(--border); }
.cal-dow { padding: .5rem; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: center; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 118px; padding: .4rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: .78rem; overflow: hidden; } .cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: var(--surface-2); opacity: .55; } .cal-day.weekend { background: var(--surface-2); } .cal-day.holiday { background: var(--amber-bg); }
.cal-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-weight: 600; color: var(--text-2); margin-bottom: .2rem; } .cal-day.today .cal-num { background: var(--p-600); color: #fff; }
.cal-ev { display: block; padding: .12rem .4rem; margin-bottom: 2px; border-radius: 5px; font-size: .72rem; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ac, var(--p-700));
  background: color-mix(in srgb, var(--ac, var(--p-600)) 13%, transparent); border-left: 2px solid var(--ac, var(--p-600)); } .cal-ev.done { opacity: .5; text-decoration: line-through; } .cal-ev.late { --ac: #dc2626; }
.cal-more { font-size: .7rem; color: var(--muted); padding-left: .3rem; } .cal-hol { font-size: .66rem; color: var(--amber); font-weight: 600; float: right; max-width: 70%; text-align: right; line-height: 1.2; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 1rem; overflow-x: auto; padding-bottom: .5rem; align-items: start; }
.kan-col { background: var(--surface-3); border-radius: var(--r-lg); padding: .6rem; min-height: 200px; } .kan-col.over { outline: 2px dashed var(--p-500); }
.kan-head { display: flex; align-items: center; justify-content: space-between; padding: .3rem .4rem .6rem; font-weight: 650; font-size: .85rem; color: var(--text); }
.kan-card { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: .7rem .8rem; margin-bottom: .55rem; box-shadow: var(--sh-1); cursor: grab; font-size: .86rem; display: block; color: inherit; } .kan-card:hover { border-color: var(--border-strong); box-shadow: var(--sh-2); } .kan-card.dragging { opacity: .4; }

/* ------------------------------------------------------------ utilities */
.flex { display: flex; } .inline-flex { display: inline-flex; } .col { flex-direction: column; } .wrap { flex-wrap: wrap; } .items-center { align-items: center; } .items-start { align-items: flex-start; } .items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; } .justify-center { justify-content: center; } .flex-1 { flex: 1; min-width: 0; } .shrink-0 { flex-shrink: 0; } .ml-auto { margin-left: auto; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; }
.stack > * + * { margin-top: 1.1rem; } .stack-sm > * + * { margin-top: .5rem; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; } .mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; } .mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: .75rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.p-0 { padding: 0; } .p-3 { padding: .75rem; } .p-4 { padding: 1rem; } .p-6 { padding: 1.5rem; }
.text-xs { font-size: .76rem; } .text-sm { font-size: .86rem; } .text-base { font-size: 1rem; } .text-lg { font-size: 1.15rem; } .text-xl { font-size: 1.4rem; } .text-2xl { font-size: 1.8rem; }
.text-muted { color: var(--muted); } .text-faint { color: var(--faint); } .text-strong { color: var(--text); } .text-primary { color: var(--p-600); } .text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); } .text-blue { color: var(--blue); }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; } .font-bold { font-weight: 700; } .mono { font-family: var(--mono); font-size: .92em; } .upper { text-transform: uppercase; letter-spacing: .08em; }
.center { text-align: center; } .right { text-align: right; } .nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .w-full { width: 100%; } .hidden { display: none; } .relative { position: relative; } .block { display: block; } .pre { white-space: pre-wrap; word-break: break-word; }
.divide > * + * { border-top: 1px solid var(--border); } .rounded { border-radius: var(--r-md); } .bg-soft { background: var(--surface-2); } .border { border: 1px solid var(--border); } .scroll-y { overflow-y: auto; } .mh-400 { max-height: 400px; } .mh-600 { max-height: 600px; }
.chart-box { position: relative; height: 260px; } .chart-box.sm { height: 180px; } .chart-box.lg { height: 340px; }

/* ------------------------------------------------------------ touch devices: no zoom-on-focus
   iPhone Safari zooms into any field whose text is under 16px and stays zoomed. 16px on phones/touch screens prevents it
   without disabling pinch-zoom (which would hurt accessibility). */
@media (max-width: 900px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  select, textarea, .input, .select, .textarea, .input-sm { font-size: 16px !important; }
  .input, .select { height: 42px; } .input-sm { height: 38px; }
}

/* ------------------------------------------------------------ dashboard: first-client card */
.setup-card { background: linear-gradient(135deg, var(--p-50), var(--surface)); border-color: var(--p-200); }
.setup-card-body { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1rem 1.25rem; align-items: center; padding: 1.25rem 1.5rem; }
.setup-card-icon { margin: 0 !important; } .setup-card-text h3 { margin-bottom: .25rem; }
.setup-card-actions { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 900px) {
  .setup-card-body { grid-template-columns: auto minmax(0, 1fr); padding: 1.1rem; }
  .setup-card-actions { grid-column: 1 / -1; justify-content: stretch; }
  .setup-card-actions .btn { flex: 1 1 180px; justify-content: center; }
}
@media (max-width: 480px) {
  .setup-card-body { grid-template-columns: 1fr; gap: .75rem; }
  .setup-card-icon { width: 40px; height: 40px; }
  .setup-card-actions .btn { flex-basis: 100%; }
}

/* ------------------------------------------------------------ firm logos */
.firm-logo { height: var(--s, 32px); width: auto; max-width: calc(var(--s, 32px) * 1.5); object-fit: contain; flex-shrink: 0; border-radius: 6px; background: #fff; padding: 2px; }
.firm-logo.wide { max-width: calc(var(--s, 32px) * 5); padding: 3px 6px; }
.logo-preview { min-width: 160px; height: 72px; padding: 8px 14px; display: grid; place-items: center; border: 1px dashed var(--border-strong); border-radius: var(--r-md);
  background: #fff linear-gradient(45deg, #f1f5f9 25%, transparent 25%, transparent 75%, #f1f5f9 75%) 0 0 / 12px 12px; }
.logo-preview img { max-height: 56px; max-width: 220px; object-fit: contain; }

/* ------------------------------------------------------------ photo quick-action tiles */
.ptiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .85rem; }
.ptile { position: relative; isolation: isolate; overflow: hidden; min-height: 132px; border-radius: var(--r-lg); padding: .9rem 1rem; display: flex; flex-direction: column; justify-content: flex-end;
  color: #fff; background: #102c4c; box-shadow: var(--sh-1); transition: transform .18s, box-shadow .2s; }
.ptile::before { content: ""; position: absolute; inset: 0; z-index: -2; background: var(--img) center / cover; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.ptile::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(16,44,76,.35) 0%, rgba(11,32,56,.9) 78%); }
.ptile:hover { transform: translateY(-2px); box-shadow: var(--sh-2); color: #fff; } .ptile:hover::before { transform: scale(1.06); }
.ptile-ico { position: absolute; top: .8rem; left: .9rem; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); backdrop-filter: blur(4px); }
.ptile-ico svg { width: 17px; height: 17px; }
.ptile-badge { position: absolute; top: .9rem; right: .9rem; font-size: .7rem; font-weight: 700; padding: .1rem .55rem; border-radius: 99px; background: #fff; color: #102c4c; }
.ptile-text { min-width: 0; padding-right: 1.4rem; } .ptile-text strong { display: block; font-family: var(--font-head); font-size: .95rem; line-height: 1.25; color: #fff; }
.ptile-text span { display: block; font-size: .76rem; color: #c9d6e8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: .1rem; }
.ptile-go { position: absolute; right: .9rem; bottom: .95rem; width: 16px !important; height: 16px !important; opacity: .85; transition: transform .2s; } .ptile:hover .ptile-go { transform: translateX(3px); }
@media (max-width: 1500px) { .ptiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .ptiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ptile { min-height: 112px; } }

/* ------------------------------------------------------------ auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.1fr); }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 3rem clamp(1.5rem, 7vw, 6rem); background: var(--surface); }
.auth-form .inner { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-art { position: relative; overflow: hidden; color: #e2e8f0; padding: 4rem; display: flex; flex-direction: column; justify-content: flex-end;
  background: linear-gradient(170deg, rgba(16, 44, 76, .55) 0%, rgba(11, 32, 56, .94) 62%), url('../img/site/bg-glass.webp') center / cover, #102c4c; }
.auth-art::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 30%, #000 20%, transparent 75%); }
.brand-logo { display: inline-block; } .brand-logo img { height: 48px; width: auto; display: block; } .brand-logo .on-dark, [data-theme="dark"] .brand-logo .on-light { display: none; } [data-theme="dark"] .brand-logo .on-dark { display: block; }
.auth-art > * { position: relative; } .auth-art h2 { color: #fff; font-size: 2.1rem; line-height: 1.15; max-width: 480px; margin-bottom: 1rem; } .auth-art p { color: #b4c2d6; max-width: 460px; font-size: 1.02rem; }

/* ------------------------------------------------------------ platform (superuser) console
   Light by default (same tokens as the workspace); the dark amber shell is the console's dark mode. */
[data-theme="dark"] body.platform { --bg: #070b16; --surface: #0e1526; --surface-2: #0b1120; --surface-3: #162036; --border: #1b2740; --border-strong: #2a3957; --text: #f1f5f9; --text-2: #cbd5e1; --muted: #8b9ab4; --faint: #5b6b88;
  --brand: #f59e0b; --p-50: #2a1f08; --p-100: #3a2a0a; --p-200: #5a400d; --p-500: #fbbf24; --p-600: #f59e0b; --p-700: #fcd34d; --p-glow: rgba(245,158,11,.35);
  --green-bg: #052e22; --amber-bg: #3a2406; --red-bg: #3b0d0d; --blue-bg: #0c2347; --violet-bg: #24124a; --cyan-bg: #06303a; --green: #34d399; --amber: #fbbf24; --red: #f87171; --blue: #60a5fa; --violet: #a78bfa; --cyan: #22d3ee;
  --sh-1: 0 1px 2px rgba(0,0,0,.4); --sh-2: 0 6px 20px -4px rgba(0,0,0,.55); color-scheme: dark; }
[data-theme="dark"] body.platform .btn-primary { color: #1c1300 !important; } [data-theme="dark"] body.platform .nav-item.active { color: #fcd34d; }
[data-theme="dark"] body.platform .nav-item.active .nav-icon { color: #1c1300; } [data-theme="dark"] body.platform a { color: #fbbf24; }
[data-theme="dark"] body.platform .logo-mark { color: #1c1300; }
.brand-mark-img { flex-shrink: 0; width: 34px; height: 32px; } .brand-mark-img.on-dark, [data-theme="dark"] .brand-mark-img.on-light { display: none; } [data-theme="dark"] .brand-mark-img.on-dark { display: block; }

/* ------------------------------------------------------------ responsive */
.only-mobile { display: none; }
@media (max-width: 1180px) { .cols-4, .cols-5, .cols-6 { grid-template-columns: repeat(2, minmax(0,1fr)); } .cols-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } .cols-2-1, .cols-1-2, .cols-3-1 { grid-template-columns: minmax(0, 1fr); } .span-3 { grid-column: span 2; } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); width: 264px !important; box-shadow: var(--sh-3); } body.nav-open .sidebar { transform: none; } .main { margin-left: 0 !important; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 45; }
  .only-mobile { display: inline-flex; } .hide-mobile { display: none !important; } .content { padding: 1rem; } .topbar { padding: 0 1rem; }
  .cols-2, .cols-3, .form-grid, .form-grid.three, .form-grid.four { grid-template-columns: minmax(0, 1fr); } .span-2, .span-3 { grid-column: auto; } .auth { grid-template-columns: 1fr; } .auth-art { display: none; }
  .cal-day { min-height: 74px; } .cal-ev { font-size: 0; padding: 0; height: 5px; margin-bottom: 2px; border-left: 0; background: var(--ac, var(--p-600)); }
  .modal-backdrop { align-items: flex-end; padding: 0; } .modal { border-radius: var(--r-xl) var(--r-xl) 0 0; max-width: none; }
}
@media (max-width: 560px) { .cols-4, .cols-5, .cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } h1 { font-size: 1.3rem; } .stat-value { font-size: 1.5rem; } }
@media print { .sidebar, .topbar, .page-actions, .toasts, .banner { display: none !important; } .main { margin: 0; } .card { box-shadow: none; break-inside: avoid; } body { background: #fff; } }
