/* =====================================================================
   K Patel CPA – Sales Reporting & USA Tax Management System
   One stylesheet for every page (CPA portal, client portal, login).
   ===================================================================== */

/* ---------------------------------------------------------------------
   BRAND TOKENS — change the firm's colours and fonts here, in one place.
   --------------------------------------------------------------------- */
:root {
  --brand-navy:        #0B2545;   /* sidebar, headings, logo           */
  --brand-navy-2:      #13315C;   /* primary buttons, links            */
  --brand-navy-3:      #1D4B85;   /* hover / active shades             */
  --brand-navy-tint:   #E8EEF6;   /* selected rows, soft highlights    */
  --brand-gold:        #C9A227;   /* accent – use sparingly            */
  --brand-gold-dark:   #8A6D10;   /* gold text on white (AA contrast)  */
  --brand-gold-tint:   #F7F0D9;   /* soft gold background              */
  --font-body:    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: Georgia, "Times New Roman", serif;
}
/* --------------------------- end brand tokens ------------------------ */

:root {
  color-scheme: light;
  /* Neutrals */
  --bg:        #F5F7FA;
  --surface:   #FFFFFF;
  --surface-2: #F9FAFC;
  --line:      #DDE3EA;
  --line-2:    #EDF1F5;
  --ink:       #17202C;
  --ink-2:     #435064;
  --muted:     #657186;
  /* Status colours (always paired with an icon + text) */
  --ok:      #1E7B4F;  --ok-bg:      #E6F4EC;
  --warn:    #9A5B00;  --warn-bg:    #FDF2DC;
  --bad:     #B42318;  --bad-bg:     #FCE8E6;
  --info:    #1F5FBF;  --info-bg:    #E7EFFB;
  --neutral: #5B6677;  --neutral-bg: #EEF1F5;
  --violet:  #6B4BB8;  --violet-bg:  #F0EBFA;
  /* Chart series (validated for colour-blind separation) */
  --s1: #1F5FBF; --s2: #C98500; --s3: #1BAF7A; --s4: #8A5CC7; --s5: #E3643A;
  /* Shape */
  --r-lg: 12px; --r-md: 8px; --r-sm: 6px;
  --shadow-1: 0 1px 2px rgba(11, 37, 69, .06);
  --shadow-2: 0 10px 30px rgba(11, 37, 69, .16);
  --focus: 0 0 0 2px #fff, 0 0 0 4px var(--info);
  --sidebar-w: 248px;
  --topbar-h: 60px;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--brand-navy); margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--brand-navy-2); text-underline-offset: 2px; }
a:hover { color: var(--brand-navy-3); }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.num, .money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
img, svg { max-width: 100%; }
code { font-size: .85em; background: var(--line-2); padding: 1px 5px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================ CPA SHELL */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(90deg, var(--brand-navy) var(--sidebar-w), transparent var(--sidebar-w)); }
@media (max-width: 960px) { .shell { background: none; } }
.sidebar {
  background: var(--brand-navy); color: #C9D4E4;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px 14px; color: #fff; text-decoration: none; }
.sidebar .brand img { height: 30px; width: auto; }
.sidebar .brand span { font-size: .78rem; color: #9FB0C8; line-height: 1.2; }
.nav { padding: 6px 10px 24px; }
.nav-group { margin-top: 14px; }
.nav-group-title { padding: 6px 12px; font-size: .78rem; color: #8EA0BA; letter-spacing: .02em; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 1px 0;
  color: #D7E0EC; text-decoration: none; border-radius: var(--r-sm); font-size: .93rem;
  position: relative;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.10); color: #fff; font-weight: 600; }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; background: var(--brand-gold); border-radius: 0 3px 3px 0;
}
.nav a .count { margin-left: auto; background: var(--brand-gold); color: var(--brand-navy); font-size: .72rem; font-weight: 700; padding: 0 7px; border-radius: 999px; }
.sidebar :focus-visible { box-shadow: 0 0 0 2px var(--brand-gold); }
.sidebar-foot { margin-top: auto; padding: 14px 20px 20px; font-size: .78rem; color: #8EA0BA; border-top: 1px solid rgba(255,255,255,.08); }

.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar .page-title-sm { font-family: var(--font-heading); color: var(--brand-navy); font-size: 1.05rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar .spacer { flex: 1; }
.menu-btn { display: inline-grid; margin-left: -8px; }
.shell, .sidebar { transition: grid-template-columns .2s ease, background .2s ease; }

/* collapsed sidebar (desktop): the menu button folds it to an icon rail; app.js remembers the choice */
@media (min-width: 961px) {
  html.sb-collapsed:not(.is-mobile) { --sidebar-w: 68px; }
  html.sb-collapsed:not(.is-mobile) .sidebar { overflow-x: hidden; }
  html.sb-collapsed:not(.is-mobile) .sidebar .brand { padding: 18px 0 14px; justify-content: center; }
  html.sb-collapsed:not(.is-mobile) .sidebar .brand img { width: 30px; height: 30px; object-fit: cover; object-position: left center; }
  html.sb-collapsed:not(.is-mobile) .nav { padding: 6px 8px 24px; }
  html.sb-collapsed:not(.is-mobile) .nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.08); }
  html.sb-collapsed:not(.is-mobile) .nav-group:first-child { border-top: 0; padding-top: 0; }
  html.sb-collapsed:not(.is-mobile) .nav-group-title, html.sb-collapsed:not(.is-mobile) .nav a span:not(.count), html.sb-collapsed:not(.is-mobile) .sidebar-foot { display: none; }
  html.sb-collapsed:not(.is-mobile) .nav a { justify-content: center; padding: 11px 0; }
  html.sb-collapsed:not(.is-mobile) .nav a svg { width: 20px; height: 20px; }
  html.sb-collapsed:not(.is-mobile) .nav a[aria-current="page"]::before { left: -8px; }
  html.sb-collapsed:not(.is-mobile) .nav a .count { position: absolute; top: 4px; right: 6px; padding: 0 5px; font-size: .62rem; line-height: 15px; }
}
.content { padding: 24px; max-width: 1440px; width: 100%; margin: 0 auto; }

.demo-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600;
  color: var(--brand-gold-dark); background: var(--brand-gold-tint); border: 1px solid #E8D79C;
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
.demo-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-gold); }

/* bell + user menu */
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--line-2); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--bad); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; border-radius: 9px; text-align: center;
}
.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 3px 12px 3px 3px; cursor: pointer; color: var(--ink); font: inherit; font-size: .9rem;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-navy-tint); color: var(--brand-navy);
  display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none;
}
.user-btn .name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-2); min-width: 240px; padding: 6px; z-index: 50;
}
.dropdown .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.dropdown .who strong { display: block; }
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer;
}
.dropdown a:hover, .dropdown button:hover { background: var(--line-2); }
.dropdown svg { width: 16px; height: 16px; color: var(--muted); }

/* drawer (CPA on small screens) */
.scrim { position: fixed; inset: 0; background: rgba(11,37,69,.45); z-index: 60; }
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(86vw, 300px); z-index: 70; transform: translateX(-100%); transition: transform .2s ease; }
  .shell.drawer-open .sidebar { transform: none; box-shadow: var(--shadow-2); }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 12px; }
  .content { padding: 16px; }
  .user-btn .name { display: none; }
  .user-btn { padding: 3px; }
}
.topbar .brand-sm { display: none; height: 26px; width: auto; }
@media (max-width: 520px) { .topbar .page-title-sm { display: none; } .topbar .brand-sm { display: block; } }

/* ========================================================= CLIENT SHELL */
.ctop {
  background: var(--brand-navy); color: #fff; position: sticky; top: 0; z-index: 30;
}
.ctop-inner { max-width: 1120px; margin: 0 auto; height: 60px; padding: 0 20px; display: flex; align-items: center; gap: 16px; }
.ctop .brand img { height: 28px; display: block; }
.ctop .client-name { font-size: .85rem; color: #B7C4D8; border-left: 1px solid rgba(255,255,255,.18); padding-left: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ctop nav { display: flex; gap: 2px; margin-left: 12px; }
.ctop nav a { color: #D7E0EC; text-decoration: none; padding: 8px 12px; border-radius: var(--r-sm); font-size: .93rem; white-space: nowrap; }
.ctop nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.ctop nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -2px 0 var(--brand-gold); border-radius: 0; }
.ctop .spacer { flex: 1; }
.ctop .icon-btn { color: #fff; }
.ctop .icon-btn:hover { background: rgba(255,255,255,.1); }
.ctop .user-btn { background: transparent; border-color: rgba(255,255,255,.25); color: #fff; }
.ctop .avatar { background: var(--brand-gold); color: var(--brand-navy); }
.ctop :focus-visible { box-shadow: 0 0 0 2px var(--brand-gold); }
.ctop .demo-pill { background: rgba(201,162,39,.16); color: #F1DE9C; border-color: rgba(201,162,39,.5); }
.content.client { max-width: 1120px; padding: 28px 20px 40px; }

/* ===================================================== APP-STYLE LAYOUT
   html.is-mobile is set by app.js on phones/tablets (server + browser check)
   and on any screen 760px or narrower. It gives both portals a native-app feel:
   compact top bar, bottom tab bar, safe-area padding, no tap flash. */
.tabbar { display: none; }
.is-mobile body { -webkit-tap-highlight-color: transparent; }
.is-mobile a, .is-mobile button { touch-action: manipulation; }

/* client portal */
.is-mobile .ctop nav, .is-mobile .ctop .user-menu, .is-mobile .ctop .client-name { display: none; }
.is-mobile .ctop { padding-top: env(safe-area-inset-top); }
.is-mobile .ctop-inner { padding: 0 8px 0 16px; height: 56px; }
.is-mobile .content.client { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }

/* CPA portal: sidebar becomes a slide-in menu opened from the "More" tab */
.is-mobile .shell { grid-template-columns: minmax(0, 1fr); background: none; }
.is-mobile .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(86vw, 300px); z-index: 70; transform: translateX(-100%); transition: transform .22s cubic-bezier(.2,.8,.2,1); padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.is-mobile .shell.drawer-open .sidebar { transform: none; box-shadow: var(--shadow-2); }
.is-mobile .topbar { height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0 16px; gap: 8px; }
.is-mobile .topbar .menu-btn, .is-mobile .topbar [data-bell], .is-mobile .topbar .brand-sm { display: none; }
.is-mobile .topbar .page-title-sm { display: block; font-size: 1.1rem; }
.is-mobile .topbar .user-btn { padding: 3px; }
.is-mobile .topbar .user-btn .name, .is-mobile .topbar .user-btn .chev { display: none; }
.is-mobile .content { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }

/* bottom tab bar (both portals) */
.is-mobile .tabbar {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: rgba(255,255,255,.92); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line); padding: 4px 4px env(safe-area-inset-bottom);
  box-shadow: 0 -4px 16px rgba(11,37,69,.06); -webkit-user-select: none; user-select: none;
}
.tabbar a, .tabbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; padding: 0;
  color: var(--muted); text-decoration: none; font: 600 .7rem/1.1 var(--font-body); letter-spacing: .01em;
  position: relative; background: none; border: 0; cursor: pointer; transition: color .15s;
}
.tabbar svg { width: 24px; height: 24px; padding: 2px 16px; box-sizing: content-box; border-radius: 999px; transition: background-color .2s, transform .12s; }
.tabbar span:not(.tb-dot) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar a:active svg, .tabbar button:active svg { transform: scale(.9); }
.tabbar [aria-current="page"] { color: var(--brand-navy); }
.tabbar [aria-current="page"] svg { background: var(--brand-navy-tint); color: var(--brand-navy); stroke-width: 2.1; }
.tabbar .tb-dot { position: absolute; top: 6px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }
.tabbar :focus-visible { box-shadow: inset 0 0 0 2px var(--info); border-radius: var(--r-md); }
body.has-actionbar .tabbar { display: none !important; }

/* toasts sit above the tab bar */
.is-mobile .toast-host { left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); max-width: none; }

/* ===================================================== SEARCHABLE SELECT
   app.js swaps every select.input / table filter select for this (select2-style). */
.ss { position: relative; display: block; width: 100%; min-width: 0; }
.ss-native { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; pointer-events: none; }
.ss-btn { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; }
.ss-btn .ss-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-btn .ss-ph { color: var(--muted); }
.ss-btn .ss-chev { width: 14px; height: 14px; flex: none; color: var(--muted); transition: transform .15s; }
.ss-open .ss-btn { border-color: var(--info); box-shadow: 0 0 0 3px rgba(31,95,191,.18); }
.ss-open .ss-chev { transform: rotate(180deg); }
.ss-btn:disabled { cursor: default; background: var(--surface-2); color: var(--ink-2); }
.ss-filter .ss-btn { min-height: 0; }
.ss-drop {
  position: fixed; z-index: 200; display: flex; flex-direction: column; max-width: min(440px, calc(100vw - 16px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-2); overflow: hidden;
  animation: ss-in .12s ease-out;
}
@keyframes ss-in { from { opacity: 0; transform: translateY(-4px); } }
.ss-search { position: relative; padding: 8px; border-bottom: 1px solid var(--line-2); flex: none; }
.ss-search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.ss-q { width: 100%; height: 36px; padding: 6px 10px 6px 30px; border: 1px solid #C9D2DD; border-radius: var(--r-sm); font: inherit; font-size: .92rem; color: var(--ink); background: #fff; }
.ss-q:focus { outline: none; border-color: var(--info); box-shadow: 0 0 0 3px rgba(31,95,191,.15); }
.ss-list { list-style: none; margin: 0; padding: 4px; overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 0; position: relative; }
.ss-opt { padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: .92rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-opt.ss-hi { background: var(--line-2); }
.ss-opt[aria-selected="true"] { background: var(--brand-navy-tint); color: var(--brand-navy); font-weight: 600; }
.ss-opt[aria-selected="true"]::after { content: "¹3"; float: right; margin-left: 10px; color: var(--brand-navy-2); }
.ss-opt.ss-ph { color: var(--muted); }
.ss-opt.ss-dis { color: #A9B3C1; cursor: default; }
.ss-group { padding: 8px 10px 4px; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ss-none { padding: 14px 10px; color: var(--muted); font-size: .9rem; text-align: center; }
/* phones: options open as a bottom sheet */
.ss-back { position: fixed; inset: 0; z-index: 199; background: rgba(11,37,69,.45); animation: ss-fade .15s ease-out; }
@keyframes ss-fade { from { opacity: 0; } }
.ss-drop.ss-sheet {
  left: 0; right: 0; bottom: 0; top: auto; max-width: none; max-height: 78vh; border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom); animation: ss-up .2s cubic-bezier(.2,.8,.2,1);
}
@keyframes ss-up { from { transform: translateY(100%); } }
.ss-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 4px 16px; font-size: 1rem; color: var(--brand-navy); }
.ss-sheet-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line); }
.ss-sheet .ss-q { height: 44px; font-size: 1rem; }
.ss-sheet .ss-opt { padding: 13px 12px; font-size: 1rem; white-space: normal; }

/* ============================================================ PAGE BITS */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; margin-bottom: 20px; }
.page-head .titles { flex: 1 1 320px; min-width: 0; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: .88rem; color: var(--muted); text-decoration: none; margin-bottom: 6px; }
.back-link svg { width: 16px; height: 16px; }
.back-link:hover { color: var(--brand-navy-2); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; }
.panel + .panel, .panel + .grid, .grid + .panel, .grid + .grid { margin-top: 20px; }
.panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.panel-head h2 { flex: 1 1 auto; }
.panel-head .muted { font-size: .85rem; }
.panel-body { padding: 18px 20px; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: 12px 20px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

.grid { display: grid; gap: 20px; align-items: start; }
.grid > .panel, .grid > .grid { margin-top: 0; }
.user-btn .chev { width: 16px; height: 16px; color: var(--muted); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main-side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } .content { padding: 16px; } h1 { font-size: 1.35rem; } .panel-head, .panel-body { padding-left: 16px; padding-right: 16px; } }

.stack > * + * { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }

/* definition list (profile views) */
.dl { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 10px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: .9rem; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } .dl dd { margin-bottom: 10px; } }

/* ============================================================== BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .92rem;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { background: var(--line-2); color: var(--ink); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand-navy-2); border-color: var(--brand-navy-2); color: #fff; }
.btn-primary:hover { background: var(--brand-navy-3); border-color: var(--brand-navy-3); color: #fff; }
.btn-danger { color: var(--bad); border-color: #EFC2BD; }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger-solid:hover { background: #8F1C13; color: #fff; }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-success:hover { background: #165E3C; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--brand-navy-2); }
.btn-ghost:hover { background: var(--brand-navy-tint); color: var(--brand-navy-2); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
.btn-lg { min-height: 50px; padding: 12px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-primary.loading::after, .btn-success.loading::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand-navy-2); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ================================================================ FORMS */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-section { font-family: var(--font-heading); color: var(--brand-navy); font-size: 1rem; margin: 8px 0 -2px; grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--line-2); }
.form-section:first-child { border-top: 0; padding-top: 0; }
/* Owner | Manager side by side on the client form */
.contact-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.contact-box { margin: 0; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 6px 16px 16px; background: var(--surface-2); display: grid; gap: 12px; min-width: 0; }
.contact-box legend { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; font-family: var(--font-heading); color: var(--brand-navy); font-weight: 600; }
@media (max-width: 760px) { .contact-split { grid-template-columns: minmax(0, 1fr); } }
/* Entry screen section picker (settings + client form) */
.section-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.section-pick { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface); }
.section-pick > span { display: flex; flex-direction: column; gap: 2px; }
.section-pick:has(input:checked) { border-color: var(--brand-navy-2); background: var(--surface-2); }
.section-pick:has(input:disabled) { opacity: .7; cursor: default; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .label { font-weight: 600; font-size: .88rem; color: var(--ink-2); }
.field .req { color: var(--bad); margin-left: 2px; }
.field .help { font-size: .8rem; color: var(--muted); }
.field .err { font-size: .82rem; color: var(--bad); display: flex; gap: 4px; align-items: flex-start; }
.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid #C9D2DD; border-radius: var(--r-sm);
  background: #fff; color: var(--ink); font: inherit; font-size: .95rem;
}
textarea.input { min-height: 84px; resize: vertical; line-height: 1.45; }
select.input { padding-right: 30px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23657186' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.input:hover { border-color: #A9B6C6; }
.input:focus { outline: none; border-color: var(--info); box-shadow: 0 0 0 3px rgba(31,95,191,.18); }
.input[aria-invalid="true"] { border-color: var(--bad); background: #FFFAFA; }
.input:disabled, .input[readonly] { background: var(--surface-2); color: var(--ink-2); }
.input.money-in { text-align: right; font-variant-numeric: tabular-nums; }
.check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: .93rem; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand-navy-2); flex: none; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .field { flex: 1 1 160px; max-width: 240px; }
.filters .field.grow { max-width: 360px; flex-basis: 220px; }
@media (max-width: 640px) { .filters .field, .filters .field.grow { max-width: none; flex-basis: calc(50% - 5px); } .filters .field.grow { flex-basis: 100%; } }
.search-input { position: relative; }
.search-input svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-input .input { padding-left: 32px; }

/* checkbox dropdown (report generator client filter) */
.multi { position: relative; }
.multi summary { list-style: none; cursor: pointer; display: flex; align-items: center; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23657186' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.multi summary::-webkit-details-marker { display: none; }
.multi-list { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; min-width: 220px; max-height: 260px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: 8px; display: grid; gap: 6px; }

/* =============================================================== BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; line-height: 1.5; white-space: nowrap; border: 1px solid transparent;
}
.badge svg { width: 13px; height: 13px; flex: none; }
.b-ok      { background: var(--ok-bg);      color: var(--ok);      border-color: #BFE3CF; }
.b-warn    { background: var(--warn-bg);    color: var(--warn);    border-color: #F1D59E; }
.b-bad     { background: var(--bad-bg);     color: var(--bad);     border-color: #F3C3BE; }
.b-info    { background: var(--info-bg);    color: var(--info);    border-color: #C3D5F2; }
.b-neutral { background: var(--neutral-bg); color: var(--neutral); border-color: #D9DFE7; }
.b-violet  { background: var(--violet-bg);  color: var(--violet);  border-color: #D8CCF0; }
.b-navy    { background: var(--brand-navy-tint); color: var(--brand-navy); border-color: #C9D6E8; }
.tag { display: inline-block; font-size: .75rem; padding: 1px 7px; border-radius: 4px; background: var(--line-2); color: var(--ink-2); font-weight: 600; }

/* =============================================================== ALERTS */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid; font-size: .92rem; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert p:last-child, .alert ul:last-child { margin-bottom: 0; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert-info { background: var(--info-bg); border-color: #C3D5F2; color: #18447F; }
.alert-warn { background: var(--warn-bg); border-color: #F1D59E; color: #6E4100; }
.alert-bad  { background: var(--bad-bg);  border-color: #F3C3BE; color: #8F1C13; }
.alert-ok   { background: var(--ok-bg);   border-color: #BFE3CF; color: #165E3C; }
.alert-gold { background: var(--brand-gold-tint); border-color: #E8D79C; color: #5E4A0A; }
.attribution { font-size: .8rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* =============================================================== TABLES */
.tbl-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line-2); }
.tbl-tools .search-input { flex: 1 1 220px; max-width: 340px; }
.tbl-tools .count { margin-left: auto; color: var(--muted); font-size: .85rem; }
/* grid toolbar: filter toggle, column chooser, export */
.tbl-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tbl-actions .btn[aria-pressed="true"] { background: var(--brand-navy-tint); border-color: #C9D6E8; color: var(--brand-navy); }
.tbl-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 2px; border-radius: 999px; background: var(--brand-navy-2); color: #fff; font-size: .72rem; font-weight: 700; }
.tbl-menu { position: relative; }
.tbl-menu > summary { list-style: none; }
.tbl-menu > summary::-webkit-details-marker { display: none; }
.tbl-menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 210px; max-height: 340px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: 6px;
}
.tbl-menu-list label { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; font-size: .88rem; white-space: nowrap; }
.tbl-menu-list button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none;
  font: inherit; font-size: .88rem; color: var(--ink); border-radius: var(--r-sm); cursor: pointer; white-space: nowrap;
}
.tbl-menu-list label:hover, .tbl-menu-list button:hover { background: var(--line-2); }
.tbl-menu-list svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.tbl-menu-list .sep { border-top: 1px solid var(--line-2); margin: 6px 0; }
.tbl tr.tbl-filter-row th { position: static; padding: 6px 8px; background: var(--surface); }
.tbl .tbl-filter {
  width: 100%; min-width: 80px; font: inherit; font-size: .82rem; font-weight: 400; padding: 5px 8px; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
}
.tbl .tbl-filter:focus { outline: none; box-shadow: var(--focus); }
.tbl tr.tbl-empty-row td { text-align: center; color: var(--muted); padding: 24px 12px; }

/* tax updates: automatic sync panel */
.auto-sync { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: flex-start; justify-content: space-between; }
.auto-sync-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.auto-sync-form select.input { width: auto; min-width: 130px; }

/* import wizard (choose file → match columns → review) */
.wiz-steps { display: flex; gap: 8px; list-style: none; margin: 0 0 18px; padding: 0; counter-reset: none; flex-wrap: wrap; }
.wiz-steps li { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); font-weight: 600; }
.wiz-steps li + li::before { content: ""; width: 24px; height: 1px; background: var(--line); margin-right: 2px; }
.wiz-steps li span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); font-size: .8rem; background: var(--surface); }
.wiz-steps li.on { color: var(--brand-navy); }
.wiz-steps li.on span { background: var(--brand-navy-2); border-color: var(--brand-navy-2); color: #fff; }
.wiz-steps li.done span { background: var(--ok-bg); border-color: #BFE3CF; color: var(--ok); }
.wiz-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 36px 20px; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--r-lg); background: var(--surface-2); color: var(--ink);
}
.dropzone svg { width: 30px; height: 30px; color: var(--brand-navy-2); }
.dropzone:hover, .dropzone.over { border-color: var(--brand-navy-2); background: var(--brand-navy-tint); }
.map-tbl td { vertical-align: top; }
.map-tbl select.input { min-width: 180px; }
.wiz-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.wiz-sum > div { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface-2); }
.wiz-sum b { display: block; font-size: 1.35rem; font-family: var(--font-heading); color: var(--brand-navy); }
.wiz-sum span { font-size: .8rem; color: var(--muted); }
.wiz-sum .bad b { color: var(--bad); }
.wiz-apply { margin-top: 14px; display: grid; gap: 10px; }
.wiz-apply .check { align-items: flex-start; }
@media (max-width: 640px) {
  .wiz-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wiz-steps li + li::before { width: 10px; }
  .map-tbl thead { display: none; }
  .map-tbl, .map-tbl tbody, .map-tbl tr, .map-tbl td { display: block; width: 100%; }
  .map-tbl tr { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .tbl.map-tbl td { border: 0; padding: 3px 0; }
}

/* touch screens: every control at least thumb-sized (~44px), checkboxes easy to hit */
@media (pointer: coarse) {
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  .input, select.input, textarea.input { font-size: 1rem; min-height: 44px; }   /* under 16px makes iPhones zoom the page on tap */
  .tbl-menu-list label, .tbl-menu-list button { min-height: 44px; }
  .tbl .tbl-filter { min-height: 40px; font-size: 1rem; }   /* 16px+ stops iOS zooming into the box */
  .back-link, .auth-links a { display: inline-flex; align-items: center; min-height: 44px; }
}
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; padding: 10px 12px;
  border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0;
}
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th .sort-ind { display: inline-block; width: 10px; margin-left: 3px; color: var(--brand-navy-2); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover td { background: #F6F9FD; }
.tbl tbody tr.row-flag td { background: #FFF8F7; }
.tbl tbody tr.row-flag td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl .cell-main { font-weight: 600; color: var(--ink); }
.tbl td.col-wide { min-width: 220px; }
@media (max-width: 760px) { .tbl td.col-wide { min-width: 0; } }
.tbl .cell-sub { font-size: .8rem; color: var(--muted); }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--ink-2); border-bottom: 3px double var(--brand-gold); background: var(--surface-2); }
.tbl.dense td, .tbl.dense th { padding: 7px 10px; }
.tbl .actions { white-space: nowrap; text-align: right; }
.tbl .actions .btn + .btn { margin-left: 4px; }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-top: 1px solid var(--line-2); justify-content: flex-end; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }

/* stacked "card" rows on phones */
@media (max-width: 760px) {
  table.tbl.stackable thead { display: none; }
  table.tbl.stackable, .tbl.stackable tbody, .tbl.stackable tr, .tbl.stackable td, .tbl.stackable tfoot { display: block; width: 100%; }
  .tbl.stackable tbody tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .tbl.stackable td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl.stackable td::before { content: attr(data-label); color: var(--muted); font-size: .82rem; text-align: left; flex: none; max-width: 45%; }
  /* label on the left, the whole value (every line of it) on the right - a name + email or a city + "2 stores" tag stay together */
  .tbl.stackable td > .cell-val { min-width: 0; text-align: right; overflow-wrap: anywhere; }
  .tbl.stackable td:has(> .cell-val:empty) { display: none; }
  .tbl.stackable td.cell-first { display: block; text-align: left; font-size: 1rem; padding-bottom: 6px; }
  .tbl.stackable td.cell-first::before { display: none; }
  .tbl.stackable td.actions { justify-content: flex-end; padding-top: 8px; }
  .tbl.stackable td.actions::before { display: none; }
  .tbl.stackable td:empty { display: none; }
  .tbl.stackable tfoot tr { padding: 12px 16px; display: block; }
  .tbl.stackable tfoot td { display: flex; justify-content: space-between; border: 0; background: none; padding: 3px 0; }
  .tbl.stackable tfoot td::before { content: attr(data-label); color: var(--muted); font-weight: 600; }
  .tbl.stackable tfoot td:empty { display: none; }
  .tbl.stackable tfoot { border-bottom: 3px double var(--brand-gold); background: var(--surface-2); }
  .tbl.stackable tbody tr.row-flag { box-shadow: inset 3px 0 0 var(--bad); }
  .tbl.stackable tbody tr.row-flag td { background: transparent; box-shadow: none; }
  /* phones: the filter boxes show as a two-column grid above the cards */
  table.tbl.stackable thead.has-filters { display: block; }
  .tbl.stackable thead.has-filters tr.tbl-head-row { display: none; }
  .tbl.stackable thead.has-filters tr.tbl-filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .tbl.stackable thead.has-filters tr.tbl-filter-row th { display: block; padding: 0; border: 0; }
  .tbl.stackable thead.has-filters tr.tbl-filter-row th::before { content: attr(data-label); display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
  .tbl.stackable thead.has-filters tr.tbl-filter-row th:empty { display: none; }
  .tbl.stackable tr.tbl-empty-row td { display: block; text-align: center; }
  .tbl-tools { padding: 12px 16px; }
  .tbl-tools .count { margin-left: 0; }
  .tbl-actions { width: 100%; }
}

/* ================================================================= TABS */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: 0; padding: 10px 14px; font: inherit; font-weight: 600; font-size: .92rem; color: var(--muted);
  cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--brand-navy); border-bottom-color: var(--brand-navy-2); }
.tab .tab-count { background: var(--line-2); color: var(--ink-2); font-size: .74rem; padding: 0 7px; border-radius: 999px; }
.tab[aria-selected="true"] .tab-count { background: var(--brand-navy-2); color: #fff; }
.panel .tabs { padding: 0 12px; margin-bottom: 0; }

/* month picker */
.month-picker { display: inline-flex; align-items: center; border: 1px solid #C9D2DD; border-radius: var(--r-sm); background: #fff; overflow: hidden; }
.month-picker button { border: 0; background: transparent; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.month-picker button:hover:not(:disabled) { background: var(--line-2); }
.month-picker button:disabled { opacity: .35; cursor: default; }
.month-picker button svg { width: 16px; height: 16px; }
.month-picker select { border: 0; font: inherit; font-weight: 600; padding: 0 4px; height: 38px; background: transparent; color: var(--ink); cursor: pointer; }
.month-picker select:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--info); }

/* ================================================================= KPIs */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.figure { padding: 14px 18px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); margin: 0 -1px -1px 0; }
.figure .label { font-size: .82rem; color: var(--muted); }
.figure .value { font-family: var(--font-heading); font-size: 1.55rem; color: var(--brand-navy); font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.figure .value.sm { font-size: 1.25rem; }
.figure .note { font-size: .78rem; color: var(--muted); }
.figure .note.bad { color: var(--bad); font-weight: 600; }
.figure a { text-decoration: none; color: inherit; }

/* collection progress (dashboard hero) */
.collect { padding: 22px 24px; }
.collect-top { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; justify-content: space-between; }
.collect .big { font-family: var(--font-heading); font-size: 2.6rem; color: var(--brand-navy); line-height: 1; font-variant-numeric: tabular-nums; }
.collect .big small { font-size: 1.1rem; color: var(--muted); font-family: var(--font-body); margin-left: 6px; }
.collect .due { color: var(--ink-2); font-size: .92rem; }
.stackbar { display: flex; height: 16px; border-radius: 4px; overflow: hidden; margin: 16px 0 6px; background: var(--line-2); gap: 2px; }
.stackbar span { display: block; height: 100%; min-width: 2px; }
.stackbar-rule { border-bottom: 3px double var(--brand-gold); margin-bottom: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .85rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend b { color: var(--ink); font-variant-numeric: tabular-nums; margin-left: 4px; }

/* =============================================================== CHARTS */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text, .chart text { font: 11px var(--font-body); fill: var(--muted); }
.chart .grid line { stroke: var(--line-2); }
.chart .baseline { stroke: var(--line); }
.chart .val-label { fill: var(--ink-2); font-weight: 600; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--brand-navy); color: #fff; font-size: .8rem; padding: 7px 10px;
  border-radius: 6px; box-shadow: var(--shadow-2); white-space: nowrap; z-index: 5; transform: translate(-50%, calc(-100% - 10px)); line-height: 1.45;
}
.chart-tip b { font-variant-numeric: tabular-nums; }
.chart-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.chart-legend { margin-bottom: 8px; }
.chart-empty { padding: 40px 0; text-align: center; color: var(--muted); font-size: .9rem; }

/* ========================================================== TOAST/MODAL */
.toast-host { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; background: var(--brand-navy); color: #fff; padding: 12px 14px; border-radius: var(--r-md);
  box-shadow: var(--shadow-2); font-size: .92rem; animation: toast-in .18s ease-out;
}
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.ok svg { color: #7FD8A8; } .toast.bad { background: #7A1A12; } .toast.warn svg { color: #F5C66B; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 760px) { .toast-host { left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); max-width: none; } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(11,37,69,.5); z-index: 150; display: grid; place-items: center; padding: 20px; }
.modal {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); width: 100%; max-width: 540px; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; animation: modal-in .16s ease-out;
}
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.99); } }
@media (max-width: 640px) {
  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal { max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92vh; }
  .modal-foot .btn { flex: 1; }
}

/* ======================================================== EMPTY/LOADING */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .empty-icon { width: 44px; height: 44px; margin: 0 auto 10px; display: grid; place-items: center; background: var(--line-2); border-radius: 50%; color: var(--ink-2); }
.empty .empty-icon svg { width: 22px; height: 22px; }
.empty h3 { color: var(--ink); font-family: var(--font-body); font-size: 1rem; margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }
.skeleton { padding: 18px 20px; }
.sk { height: 12px; border-radius: 4px; background: linear-gradient(90deg, #EDF1F5 25%, #F6F8FB 37%, #EDF1F5 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; margin-bottom: 12px; }
.sk.w60 { width: 60%; } .sk.w40 { width: 40%; } .sk.w80 { width: 80%; } .sk.h30 { height: 30px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.page-error { max-width: 520px; margin: 60px auto; text-align: center; }

/* ============================================================= TIMELINE */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 24px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: -6px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--brand-navy-2); }
.timeline li.ok::after { border-color: var(--ok); background: var(--ok); }
.timeline li.bad::after { border-color: var(--bad); }
.timeline .t-when { font-size: .8rem; color: var(--muted); }
.timeline .t-text { font-size: .92rem; }
.timeline .t-note { font-size: .88rem; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 6px 10px; margin-top: 4px; }

/* ============================================================ DOCUMENTS */
.dropzone {
  display: block;
  border: 2px dashed #B9C5D4; border-radius: var(--r-md); padding: 22px; text-align: center; color: var(--ink-2); background: var(--surface-2);
  cursor: pointer; transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand-navy-2); background: var(--brand-navy-tint); }
.dropzone svg { width: 28px; height: 28px; color: var(--brand-navy-2); }
.dropzone strong { display: block; color: var(--brand-navy); margin: 6px 0 2px; }
.doc-list { list-style: none; margin: 12px 0 0; padding: 0; }
.doc-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.doc-list li:last-child { border-bottom: 0; }
.doc-list .doc-ic { width: 36px; height: 36px; border-radius: var(--r-sm); background: var(--brand-navy-tint); color: var(--brand-navy-2); display: grid; place-items: center; flex: none; }
.doc-list .doc-ic svg { width: 18px; height: 18px; }
.doc-list .doc-main { flex: 1; min-width: 0; }
.doc-list .doc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.doc-list .doc-meta { font-size: .8rem; color: var(--muted); }

/* ============================================================ LEDGER */
.ledger { margin: 0; }
.ledger .l-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: .93rem; }
.ledger .l-row dt { color: var(--ink-2); }
.ledger .l-row dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.ledger .l-row.minus dd::before { content: "− "; color: var(--muted); font-weight: 400; }
.ledger .l-row.total { border-top: 1px solid var(--ink-2); margin-top: 4px; padding-top: 8px; }
.ledger .l-row.total dt { font-weight: 700; color: var(--brand-navy); }
.ledger .l-row.total dd { font-family: var(--font-heading); font-size: 1.3rem; color: var(--brand-navy); border-bottom: 3px double var(--brand-gold); padding-bottom: 1px; }
.ledger .l-row.sub { padding-left: 12px; font-size: .88rem; }
.ledger .l-row.sub dt { color: var(--muted); }

/* ========================================================== ENTRY SCREEN */
.entry-head { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.entry-head .field { flex: 0 1 260px; }
.entry-status { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 14px 0 18px; font-size: .9rem; color: var(--ink-2); }
.entry-table td { padding: 6px 4px; }
.entry-table th { padding: 8px 4px; white-space: normal; line-height: 1.25; }
.entry-table td:first-child, .entry-table th:first-child { padding-left: 18px; }
.entry-table td:last-child, .entry-table th:last-child { padding-right: 18px; }
.entry-table .input.money-in { min-width: 78px; min-height: 38px; padding: 6px 7px; font-size: .9rem; }
.entry-table .cat-name { font-weight: 600; }
.entry-table .cat-tax { font-size: .76rem; color: var(--muted); }
.entry-table .net-cell { font-weight: 700; text-align: right; color: var(--brand-navy); padding-right: 10px; }
.entry-table tr.has-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.entry-table tfoot td { text-align: right; }
.entry-table tfoot td:first-child { text-align: left; }
.cat-cards { display: none; }
.cat-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; background: var(--surface); }
.cat-card + .cat-card { margin-top: 12px; }
.cat-card.has-warn { border-left: 4px solid var(--warn); }
.cat-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 10px; }
.cat-card-head .cat-name { font-weight: 700; font-size: 1.02rem; }
.cat-card-head .net { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand-navy); }
.cat-card-head .net small { font-weight: 400; color: var(--muted); font-size: .78rem; margin-right: 4px; }
.cat-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.cat-fields .field > label { font-size: .8rem; font-weight: 600; }
.cat-fields .input { min-height: 46px; font-size: 1rem; }
.cat-fields .full { grid-column: 1 / -1; }
.warn-inline { font-size: .84rem; color: #6E4100; display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; }
.warn-inline svg { width: 15px; height: 15px; color: var(--warn); flex: none; margin-top: 2px; }
.tax-layers td { padding: 8px 10px; }
.tax-layers .input.money-in { max-width: 160px; margin-left: auto; }
.estimate-label { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 600; color: var(--brand-gold-dark); background: var(--brand-gold-tint); border-radius: 4px; padding: 1px 6px; }
.side-sticky { position: sticky; top: calc(var(--topbar-h) + 16px); }
.actionbar { display: none; }
.warn-list { list-style: none; padding: 0; margin: 0; }
.warn-list li { display: flex; gap: 8px; align-items: flex-start; font-size: .88rem; padding: 7px 0; border-top: 1px solid var(--line-2); color: var(--ink-2); }
.warn-list li svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--warn); }
.warn-list li.bad svg { color: var(--bad); }
.warn-list li.ok svg { color: var(--ok); }

@media (max-width: 1100px) { .side-sticky { position: static; } }
@media (max-width: 860px) {
  .entry-table-wrap { display: none; }
  .cat-cards { display: block; }
  .entry-actions-side { display: none; }
  .actionbar {
    display: flex; gap: 10px; align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: var(--surface); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 18px rgba(11,37,69,.08);
  }
  .actionbar .ab-total { flex: 1; min-width: 0; line-height: 1.2; }
  .actionbar .ab-total small { display: block; color: var(--muted); font-size: .75rem; }
  .actionbar .ab-total b { font-family: var(--font-heading); font-size: 1.15rem; color: var(--brand-navy); font-variant-numeric: tabular-nums; }
  .actionbar .btn { min-height: 48px; padding: 10px 14px; }
  body.has-actionbar .content { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
}

/* ======================================================== CLIENT CARDS */
.hello { margin-bottom: 20px; }
.hello h1 { font-size: 1.7rem; }
.period-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-1); }
.period-card .pc-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.period-card .pc-loc { font-size: .85rem; color: var(--muted); }
.period-card .pc-month { font-family: var(--font-heading); font-size: 1.4rem; color: var(--brand-navy); }
.period-card .pc-due { font-size: .9rem; color: var(--ink-2); }
.period-card .pc-due.urgent { color: var(--bad); font-weight: 600; }
.period-card .btn { margin-top: 4px; }
.period-card.done { background: linear-gradient(0deg, var(--surface), var(--surface)); border-color: #BFE3CF; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain > li { border-bottom: 1px solid var(--line-2); }
.list-plain > li:last-child { border-bottom: 0; }
.list-link { display: flex; align-items: center; gap: 12px; padding: 13px 20px; text-decoration: none; color: var(--ink); min-height: 56px; }
.list-link:hover { background: var(--surface-2); color: var(--ink); }
.list-link .ll-main { flex: 1; min-width: 0; }
.list-link .ll-title { font-weight: 600; display: block; }
.list-link .ll-sub { font-size: .82rem; color: var(--muted); }
.list-link .chev { width: 18px; height: 18px; color: var(--muted); flex: none; }
@media (max-width: 760px) { .list-link { padding: 12px 16px; } }

/* notifications */
.notif { display: flex; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: #F7FAFE; }
.notif .n-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); color: var(--ink-2); flex: none; }
.notif .n-ic svg { width: 18px; height: 18px; }
.notif.unread .n-ic { background: var(--brand-navy-tint); color: var(--brand-navy-2); }
.notif .n-main { flex: 1; min-width: 0; }
.notif .n-title { font-weight: 600; }
.notif.unread .n-title::after { content: "New"; margin-left: 8px; font-size: .7rem; color: var(--info); background: var(--info-bg); padding: 1px 6px; border-radius: 4px; vertical-align: 2px; }
.notif .n-msg { color: var(--ink-2); font-size: .9rem; }
.notif .n-when { color: var(--muted); font-size: .8rem; }
@media (max-width: 760px) { .notif { padding: 14px 16px; } }

/* permission matrix */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.matrix th:first-child { background: var(--surface-2); }
.matrix td.mod { background: var(--surface-2); font-weight: 700; color: var(--brand-navy); text-align: left; }
.matrix input { width: 18px; height: 18px; accent-color: var(--brand-navy-2); }

/* compare (old vs new) */
.compare { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.compare .old { color: var(--muted); text-decoration: line-through; }
.compare .new { font-weight: 700; color: var(--ink); }
.compare svg { width: 14px; height: 14px; color: var(--muted); }
.delta-up { color: var(--bad); font-weight: 600; }
.delta-down { color: var(--ok); font-weight: 600; }

/* split list/detail (tax updates, tax states) */
.split { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }
.pick-list { list-style: none; margin: 0; padding: 6px; max-height: 70vh; overflow-y: auto; }
.pick-list button { width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: var(--r-sm); cursor: pointer; font: inherit; color: var(--ink); display: flex; flex-direction: column; gap: 2px; }
.pick-list button:hover { background: var(--line-2); }
.pick-list button[aria-current="true"] { background: var(--brand-navy-tint); box-shadow: inset 3px 0 0 var(--brand-navy-2); }
.pick-list .pl-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-weight: 600; }
.pick-list .pl-sub { font-size: .8rem; color: var(--muted); }

/* code / template editor */
.pick-list .pl-group { padding: 12px 12px 4px; font-size: .75rem; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.pick-list .pl-group .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.pick-list .pl-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* template editor */
.tpl-top { grid-template-columns: minmax(0,1fr) minmax(0,2fr); }
@media (max-width: 640px) { .tpl-top { grid-template-columns: minmax(0,1fr); } }
.rte-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 5px 12px; font: inherit; font-size: .82rem; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-selected="true"] { background: var(--brand-navy-tint); color: var(--brand-navy); font-weight: 600; }
.rte-wrap { border: 1px solid #C9D2DD; border-radius: var(--r-sm); background: #fff; overflow: hidden; }
.rte-wrap:focus-within { border-color: var(--info); box-shadow: 0 0 0 3px rgba(31,95,191,.18); }
.rte-wrap .code-area { border: 0; border-radius: 0; box-shadow: none !important; }
.rte-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line-2); background: var(--surface-2); position: sticky; top: 0; }
.rte-btn { min-width: 32px; height: 32px; padding: 0 7px; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; color: var(--ink-2); font: 600 .95rem/1 var(--font-body); display: inline-grid; place-items: center; }
.rte-btn:hover { background: var(--line-2); color: var(--ink); }
.rte-btn svg { width: 16px; height: 16px; }
.rte-pill { font-size: .72rem; background: var(--brand-navy); color: #fff; padding: 3px 7px; border-radius: 4px; }
.rte-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.rte { min-height: 260px; max-height: 60vh; overflow-y: auto; padding: 14px 16px; font: 14px/1.5 Arial, Helvetica, sans-serif; color: #1f2937; outline: none; }
.rte p { margin: 0 0 10px; }
.rte a { color: inherit; }
.placeholder-chips button { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-body); font-size: .8rem; padding: 4px 9px; border-radius: 999px; background: var(--brand-navy-tint); border-color: #CCD8EA; color: var(--brand-navy); }
.placeholder-chips button svg { width: 12px; height: 12px; }
.placeholder-chips button:hover { background: #DCE6F3; }
@media (pointer: coarse) { .rte-btn { min-width: 40px; height: 40px; } .placeholder-chips button { padding: 8px 12px; } }
.code-area { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; min-height: 220px; }
.placeholder-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.placeholder-chips button { border: 1px solid #CCD8EA; cursor: pointer; }

/* ============================================================ AUTH PAGES
   Same look as the firm's PromptPayPro login: deep navy-to-sky gradient, soft glows,
   a perspective floor grid, a rising chart and a calculator, with a white sign-in card. */
body.auth { --au-navy: #1F3448; --au-deep: #15263A; --au-sky: #9CC6EA; --au-line: #D3DFE9; --au-muted: #5B7488; --au-focus: #4682B4;
  --au-serif: "IBM Plex Serif", Georgia, "Times New Roman", serif; background: var(--au-navy); min-height: 100vh; overflow-x: hidden; }
.auth-page { position: relative; min-height: 100vh; overflow: hidden; isolation: isolate;
  background: linear-gradient(104deg, #14253A 0%, #1F3448 36%, #2E5070 55%, #7C9FBE 74%, #C9DCEC 88%, #E6EFF7 100%); }
.auth-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.auth-glow { position: absolute; border-radius: 50%; filter: blur(10px); }
.auth-glow.a { width: 760px; height: 760px; left: 22%; top: -18%; background: radial-gradient(closest-side, rgba(125,182,230,.28), rgba(125,182,230,0)); }
.auth-glow.b { width: 620px; height: 620px; left: -12%; bottom: -28%; background: radial-gradient(closest-side, rgba(70,130,180,.3), rgba(70,130,180,0)); }
.auth-floor { position: absolute; left: -10%; right: 20%; bottom: 0; height: 46%; perspective: 520px; perspective-origin: 50% 0;
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 95%); mask-image: linear-gradient(to top, #000 10%, transparent 95%); opacity: .55; }
.auth-floor i { position: absolute; left: 0; right: 0; top: 0; height: 200%; transform-origin: 50% 0; transform: rotateX(62deg);
  background-image: linear-gradient(rgba(156,198,234,.16) 1px, transparent 1px), linear-gradient(90deg, rgba(156,198,234,.16) 1px, transparent 1px); background-size: 64px 64px; }
.auth-art { position: absolute; left: 27%; top: 16%; width: 36%; height: 64%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.5) 25%, #000 55%, #000 92%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.5) 25%, #000 55%, #000 92%, transparent 100%); }
.auth-art svg, .auth-desk svg { position: absolute; display: block; }
.auth-art svg { inset: 0; width: 100%; height: 100%; }
.auth-desk { position: absolute; left: 50%; top: 48%; width: 260px; height: 240px; transform: rotate(-14deg); filter: drop-shadow(0 24px 30px rgba(5,15,30,.45)); }
.auth-desk svg { inset: 0; width: 100%; height: 100%; }
.auth-pen { position: absolute; left: 31%; top: 61%; width: 300px; transform: rotate(-20deg); transform-origin: 70% 60%; filter: drop-shadow(0 14px 14px rgba(5,15,30,.45)); }
.auth-pen svg { display: block; width: 100%; height: auto; overflow: visible; }
.auth-waves { position: absolute; left: 0; bottom: 0; width: 200%; height: 140px; animation: au-waves 48s linear infinite; }
.auth-waves svg { width: 100%; height: 100%; display: block; }
.auth-wrap { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  grid-template-areas: "brand form" "address form"; grid-template-rows: 1fr auto; align-items: center;
  max-width: 1280px; margin: 0 auto; padding: 40px 48px; column-gap: 40px; row-gap: 24px; }
.auth-brand { grid-area: brand; color: #fff; align-self: start; padding-top: 2vh; }
.auth-form-side { grid-area: form; }
.auth-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 9vh; animation: au-rise .7s cubic-bezier(.2,.7,.2,1) both; }
.auth-mono { flex: none; width: 54px; height: 54px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-family: var(--au-serif); font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em;
  color: #fff; background: linear-gradient(150deg, #243E56, #172A3D); border: 1px solid rgba(156,198,234,.35); box-shadow: 0 8px 22px rgba(5,15,30,.35), inset 0 1px 0 rgba(255,255,255,.08); }
.auth-mono span { color: #8FC0EA; }
.auth-firm { display: flex; flex-direction: column; line-height: 1.25; }
.auth-firm strong { font-family: var(--au-serif); font-size: 1.35rem; font-weight: 600; color: #fff; }
.auth-firm span { font-size: .9rem; color: #C9D8E4; }
.auth-brand h1 { animation: au-rise .7s .08s cubic-bezier(.2,.7,.2,1) both; }
.auth-address { grid-area: address; align-self: end; font-style: normal; display: flex; flex-direction: column; gap: 4px; max-width: 560px; padding: 16px 20px; border-radius: 12px;
  background: rgba(15,30,46,.38); border: 1px solid rgba(156,198,234,.25); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: #C9D8E4; font-size: .86rem; animation: au-rise .7s .24s cubic-bezier(.2,.7,.2,1) both; }
.auth-address strong { font-family: var(--au-serif); color: #fff; font-size: 1rem; }
.auth-address a { color: #fff; text-decoration: none; }
.auth-address a:hover { text-decoration: underline; }
.auth-card { animation: au-rise .7s .12s cubic-bezier(.2,.7,.2,1) both; }
/* moving background, as on the firm's PromptPayPro login */
.auth-glow.a { animation: au-breathe 9s ease-in-out infinite alternate; }
.auth-glow.b { animation: au-breathe 12s ease-in-out infinite alternate; }
.auth-floor i { animation: au-floor 6s linear infinite; }
.auth-desk { animation: au-float 7s ease-in-out infinite; }
.auth-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: au-draw 2.2s .3s ease-out forwards; }
.auth-dot-halo { transform-box: fill-box; transform-origin: center; animation: au-pulse 2.4s ease-in-out infinite; }
@keyframes au-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes au-breathe { from { opacity: .65; transform: scale(.94); } to { opacity: 1; transform: scale(1.06); } }
@keyframes au-floor { from { transform: rotateX(62deg) translateY(0); } to { transform: rotateX(62deg) translateY(64px); } }
@keyframes au-waves { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes au-float { 0%, 100% { transform: rotate(-14deg) translateY(0); } 50% { transform: rotate(-11deg) translateY(-12px); } }
@keyframes au-draw { to { stroke-dashoffset: 0; } }
@keyframes au-pulse { 0%, 100% { transform: scale(.7); opacity: .55; } 50% { transform: scale(1.15); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .auth-page *, .auth-page *::before { animation: none !important; }
  .auth-line { stroke-dashoffset: 0; }
}
.auth-brand h1 { font-family: var(--au-serif); color: #fff; font-size: clamp(2.2rem, 4.6vw, 4rem); line-height: 1.08; letter-spacing: .02em; font-weight: 600; margin: 0; max-width: 560px; }
.auth-brand h1 span { display: block; color: #BFD9F2; }
.auth-form-side { display: flex; justify-content: flex-end; }
.auth-card { width: 100%; max-width: 432px; background: #fff; border-radius: 18px; padding: 40px 38px 30px; box-shadow: 0 30px 70px rgba(10,25,45,.32), 0 2px 6px rgba(10,25,45,.12); color: var(--au-navy); }
.auth-card h2 { font-family: var(--au-serif); color: var(--au-navy); font-size: 1.75rem; line-height: 1.2; font-weight: 600; margin: 0 0 6px; }
.auth-card .lead { color: var(--au-muted); margin: 0 0 26px; }
.auth-card .field { margin-bottom: 18px; }
.auth-card .field > label { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 600; color: #334B60; }
.auth-card .req { color: #C0392B; }
.auth-card .input { min-height: 50px; border-radius: 10px; border-color: var(--au-line); }
.auth-card .input:focus { border-color: var(--au-focus); box-shadow: 0 0 0 3px rgba(70,130,180,.18); }
.auth-card .has-ic { position: relative; }
.auth-card .has-ic > .ic-l { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #7D93A6; pointer-events: none; }
.auth-card .has-ic .input { padding-left: 42px; }
.auth-card .has-ic .input.with-eye { padding-right: 46px; }
.auth-card .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 8px; color: #7D93A6; cursor: pointer; border-radius: 8px; }
.auth-card .eye:hover { color: var(--au-navy); }
.auth-card .btn-lg { width: 100%; margin-top: 6px; min-height: 50px; border-radius: 10px; background: var(--au-navy); border-color: var(--au-navy); box-shadow: 0 8px 18px rgba(21,38,58,.25); font-weight: 600; }
.auth-card .btn-lg:hover { background: var(--au-deep); }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: -4px 0 20px; font-size: .92rem; }
.auth-row a, .auth-links a { color: #3D6E99; font-weight: 600; text-decoration: none; }
.auth-row a:hover, .auth-links a:hover { text-decoration: underline; }
.auth-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 24px; padding-top: 18px; border-top: 1px solid #E4ECF3; color: var(--au-muted); font-size: .86rem; }
.auth-note svg { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.auth-links { margin-top: 18px; display: flex; justify-content: space-between; font-size: .9rem; flex-wrap: wrap; gap: 8px; }
.role-pick { display: grid; gap: 10px; margin-bottom: 18px; }
.role-pick button {
  display: flex; gap: 12px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md);
  padding: 12px 14px; cursor: pointer; font: inherit; color: var(--ink); min-height: 64px;
}
.role-pick button:hover { border-color: var(--brand-navy-2); background: var(--brand-navy-tint); }
.role-pick .rp-main { flex: 1; }
.role-pick .rp-main strong { display: block; }
.role-pick .rp-main span { font-size: .82rem; color: var(--muted); }
.role-pick svg { width: 18px; height: 18px; color: var(--muted); }
.pw-rules { list-style: none; padding: 0; margin: -4px 0 14px; font-size: .82rem; color: var(--muted); display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.pw-rules li::before { content: "○ "; }
.pw-rules li.ok { color: var(--ok); }
.pw-rules li.ok::before { content: "✓ "; }
.divider-text { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; margin: 18px 0; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
@media (max-width: 960px) {
  .auth-wrap { grid-template-columns: minmax(0, 1fr); grid-template-areas: "brand" "form" "address"; grid-template-rows: auto; padding: 28px 16px 40px; gap: 24px; align-items: start; }
  .auth-brand { padding-top: 12px; text-align: center; }
  .auth-logo { justify-content: center; margin-bottom: 20px; text-align: left; }
  .auth-address { max-width: none; align-self: stretch; }
  .auth-brand h1 { font-size: 2rem; margin: 0 auto; }
  .auth-form-side { justify-content: center; }
  .auth-card { padding: 28px 22px 22px; }
  .auth-art { left: -10%; width: 120%; top: 6%; height: 40%; opacity: .55; }
  .auth-desk, .auth-pen { display: none; }
  .auth-page { background: linear-gradient(170deg, #14253A 0%, #1F3448 40%, #2E5070 70%, #7C9FBE 100%); }
}

/* ============================================================ MOCKUP GALLERY */
.gallery { max-width: 1120px; margin: 0 auto; padding: 32px 20px 60px; }
.gallery-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 28px; }
.gallery-head img { height: 40px; }
.gallery h2 { margin: 28px 0 12px; }
.g-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
.g-list a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-decoration: none; color: var(--ink); height: 100%; }
.g-list a:hover { border-color: var(--brand-navy-2); box-shadow: var(--shadow-1); }
.g-list strong { color: var(--brand-navy); display: block; }
.g-list span { font-size: .86rem; color: var(--muted); }
.g-list .as { font-size: .75rem; color: var(--brand-gold-dark); margin-top: 4px; display: block; }

/* print */
@media print {
  .sidebar, .topbar, .ctop, .tabbar, .actionbar, .page-actions, .toast-host { display: none !important; }
  .shell { display: block; } body { background: #fff; } .panel { box-shadow: none; }
}
.auth-card .auth-title { margin-bottom: 24px; }

/* ------------------------------------------------- "i" help window */
.auth-card { position: relative; }
.auth-help { position: absolute; top: 12px; right: 12px; color: var(--muted); }
.modal.help-modal { max-width: min(1240px, calc(100vw - 40px)); width: 100%; height: 92vh; }
.help-modal .modal-body { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 0; overflow: hidden; }
.help-modal .tabs { margin: 0; padding: 0 16px; flex: none; overflow-x: auto; }
.help-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 20px; flex: none; border-bottom: 1px solid var(--line-2); }
.help-body { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); flex: 1; min-height: 0; }
.help-shot-pane { overflow: auto; background: var(--line-2); padding: 18px; }
.help-shot { position: relative; box-shadow: 0 2px 10px rgba(11,37,69,.18); }
.help-shot img { display: block; width: 100%; height: auto; }
.help-shot.zoom { width: var(--shot-w); }
.help-pin, .help-num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: var(--brand-gold); color: var(--brand-navy); font-size: .78rem; font-weight: 700; line-height: 1;
}
.help-pin { position: absolute; transform: translate(-50%, -50%); border: 2px solid #fff; padding: 0; cursor: pointer; box-shadow: 0 1px 4px rgba(11,37,69,.45); box-sizing: content-box; }
.help-pin:hover, .help-pin.on { background: var(--brand-navy); color: #fff; z-index: 2; }
.help-box { position: absolute; border: 2px solid var(--brand-gold); border-radius: 6px; background: rgba(201,162,39,.14); pointer-events: none; }
.help-guide { overflow-y: auto; padding: 16px 20px 24px; border-left: 1px solid var(--line-2); }
.help-intro { margin: 0 0 12px; color: var(--ink-2); }
.help-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.help-item { display: flex; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: var(--r-md, 8px); background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.help-item:hover { background: var(--surface-2); }
.help-item.on { background: var(--brand-gold-tint); }
.help-item.on .help-num { background: var(--brand-navy); color: #fff; }
.help-text { display: grid; gap: 2px; min-width: 0; }
.help-text span { color: var(--ink-2); font-size: .9rem; }
.help-tips { margin-top: 14px; padding: 12px 14px; background: var(--info-bg); border-radius: var(--r-md, 8px); font-size: .9rem; }
.help-tips ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
@media (max-width: 640px) { .modal.help-modal { max-width: 100vw; } }
@media (max-width: 860px) {
  .help-tools { padding: 8px 16px; }
  .help-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: 46% minmax(0, 1fr); }
  .help-shot-pane { padding: 10px; }
  .help-guide { border-left: 0; border-top: 1px solid var(--line-2); padding: 12px 14px 20px; }
}
@media print { .help-pin, .help-box { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
