:root {
  --ground: #EDF1F0;
  --surface: #FFFFFF;
  --surface-2: #F5F8F7;
  --surface-3: #E6ECEB;
  --ink: #10282B;
  --ink-2: #48605F;
  --ink-3: #7D9291;
  --line: #D9E2E0;
  --line-2: #C6D2D0;
  --accent: #E9A21B;
  --accent-2: #F6C75E;
  --accent-ink: #2B1D00;
  --teal: #0F6E68;
  --teal-soft: #D6EBE8;
  --brand-ink: #0E2427;
  --side: #0E2427;
  --side-ink: #CFE0DD;
  --good: #1B9466;
  --bad: #C2413A;
  --warn: #BD7415;
  --st-pending: #6F7C90;
  --st-progress: #2B78D0;
  --st-hold: #C27616;
  --st-done: #1B9466;
  --st-cancel: #B8443D;
  --st-incomplete: #8A5AD0;
  --shadow-rgb: 16 40 43;
  --card-shadow: 0 1px 0 rgb(255 255 255 / .8) inset, 0 1px 2px rgb(var(--shadow-rgb) / .06), 0 8px 22px -10px rgb(var(--shadow-rgb) / .22);
  --lift-shadow: 0 1px 0 rgb(255 255 255 / .9) inset, 0 2px 4px rgb(var(--shadow-rgb) / .06), 0 26px 44px -18px rgb(var(--shadow-rgb) / .38);
  --glare: rgb(255 255 255 / .55);
  --radius: 16px;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #091416; --surface: #10201F; --surface-2: #142826; --surface-3: #1B3331;
    --ink: #E3EEEC; --ink-2: #A3B8B5; --ink-3: #6E8683; --line: #20393A; --line-2: #2C4847;
    --accent: #F2B33A; --accent-2: #F7CB6D; --accent-ink: #231700; --teal: #3DB4A8; --teal-soft: #123B38;
    --brand-ink: #06100F; --side: #060F10; --side-ink: #B8CCC9;
    --good: #39C28C; --bad: #EE6C63; --warn: #E7A23F;
    --st-pending: #95A2B5; --st-progress: #5AA0F0; --st-hold: #E7A23F; --st-done: #39C28C; --st-cancel: #EE6C63; --st-incomplete: #B38CF0;
    --shadow-rgb: 0 0 0;
    --card-shadow: 0 1px 0 rgb(255 255 255 / .04) inset, 0 1px 2px rgb(0 0 0 / .3), 0 10px 24px -12px rgb(0 0 0 / .7);
    --lift-shadow: 0 1px 0 rgb(255 255 255 / .06) inset, 0 2px 6px rgb(0 0 0 / .35), 0 30px 50px -20px rgb(0 0 0 / .85);
    --glare: rgb(255 255 255 / .09);
  }
}
:root[data-theme="dark"] {
  --ground: #091416; --surface: #10201F; --surface-2: #142826; --surface-3: #1B3331;
  --ink: #E3EEEC; --ink-2: #A3B8B5; --ink-3: #6E8683; --line: #20393A; --line-2: #2C4847;
  --accent: #F2B33A; --accent-2: #F7CB6D; --accent-ink: #231700; --teal: #3DB4A8; --teal-soft: #123B38;
  --brand-ink: #06100F; --side: #060F10; --side-ink: #B8CCC9;
  --good: #39C28C; --bad: #EE6C63; --warn: #E7A23F;
  --st-pending: #95A2B5; --st-progress: #5AA0F0; --st-hold: #E7A23F; --st-done: #39C28C; --st-cancel: #EE6C63; --st-incomplete: #B38CF0;
  --shadow-rgb: 0 0 0;
  --card-shadow: 0 1px 0 rgb(255 255 255 / .04) inset, 0 1px 2px rgb(0 0 0 / .3), 0 10px 24px -12px rgb(0 0 0 / .7);
  --lift-shadow: 0 1px 0 rgb(255 255 255 / .06) inset, 0 2px 6px rgb(0 0 0 / .35), 0 30px 50px -20px rgb(0 0 0 / .85);
  --glare: rgb(255 255 255 / .09);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
#app { min-height: 100%; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.15; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); font-weight: 700; }
h2 { font-size: 1.12rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--teal); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.small { font-size: .82rem; }
.block { display: block; }
.good { color: var(--good) !important; }
.bad { color: var(--bad) !important; }
.warn { color: var(--warn) !important; }
.num { font-variant-numeric: tabular-nums; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.strong { font-weight: 650; }
.mono { font-family: var(--font-mono); letter-spacing: .02em; }
.eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 650; color: var(--ink-3); }
.prose { white-space: pre-wrap; max-width: 68ch; color: var(--ink-2); }
.span-2 { grid-column: span 2; }
body.modal-open { overflow: hidden; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: clamp(198px, 17vw, 248px) 1fr; min-height: var(--app-vh, 100vh); }
.side { position: sticky; z-index: 35; top: 0; height: var(--app-vh, 100vh); overflow-y: auto; overscroll-behavior: contain; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 20px 14px; gap: 18px;
  background-image: radial-gradient(120% 60% at 0% 0%, rgb(233 162 27 / .12), transparent 60%), radial-gradient(90% 50% at 100% 100%, rgb(61 180 168 / .12), transparent 60%); }
.side-brand { display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 4px 6px; cursor: pointer; text-align: left; color: inherit; }
.side-brand strong { display: block; font-family: var(--font-display); font-size: 1.05rem; color: #fff; line-height: 1.15; }
.side-brand small { color: var(--side-ink); opacity: .7; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; }
.side-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.side-link { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: var(--side-ink); text-decoration: none; font-weight: 550; transition: background .18s, color .18s, transform .18s; }
.side-link:hover { background: rgb(255 255 255 / .06); color: #fff; transform: translateX(2px); }
.side-link.on { background: linear-gradient(90deg, rgb(233 162 27 / .2), rgb(233 162 27 / .04)); color: #fff; }
.side-link.on::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.side-link.on .ic { color: var(--accent); }
.badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 750; display: inline-grid; place-items: center; }
.side-out { flex: none; display: flex; gap: 10px; align-items: center; background: none; border: 1px solid rgb(255 255 255 / .1); color: var(--side-ink); padding: 9px 12px; border-radius: 11px; cursor: pointer; }
.side-out:hover { background: rgb(255 255 255 / .06); color: #fff; }
.topbar, .bottom-nav { display: none; }
.main { min-width: 0; padding: 18px clamp(14px, 2.4vw, 30px) 44px; }
.page { max-width: 1320px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; animation: rise .38s cubic-bezier(.2,.8,.2,1) backwards; }
.page-narrow { max-width: 820px; }
@keyframes rise { from { transform: translateY(8px); opacity: .6; } to { transform: none; opacity: 1; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-2); margin-top: 3px; }
.page-actions, .btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-col { display: flex; flex-direction: column; gap: 8px; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; background: none; border: 0; padding: 0; color: var(--ink-2); cursor: pointer; font-weight: 550; font-size: .88rem; align-self: flex-start; }
.back:hover { color: var(--teal); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 0 rgb(255 255 255 / .6) inset, 0 1px 2px rgb(var(--shadow-rgb) / .08); transition: transform .15s, box-shadow .15s, background .15s, border-color .15s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 1px 0 rgb(255 255 255 / .6) inset, 0 6px 14px -6px rgb(var(--shadow-rgb) / .35); border-color: var(--ink-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-color: color-mix(in srgb, var(--accent) 70%, #000); color: var(--accent-ink);
  box-shadow: 0 1px 0 rgb(255 255 255 / .45) inset, 0 -2px 0 rgb(0 0 0 / .1) inset, 0 4px 10px -4px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-primary:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent) 60%, #000); box-shadow: 0 1px 0 rgb(255 255 255 / .45) inset, 0 -2px 0 rgb(0 0 0 / .1) inset, 0 10px 18px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); border-color: transparent; box-shadow: none; color: var(--ink); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: .82rem; border-radius: 9px; gap: 6px; }
.btn-icon { padding: 0; width: 40px; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; min-height: 46px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s, transform .15s; text-decoration: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); transform: translateY(-1px); }
.icon-btn.danger:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.linkish { background: none; border: 0; padding: 0; min-height: 28px; color: var(--teal); font-weight: 600; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.linkish:hover { text-decoration: underline; }
.spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- chips / pills ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .8rem; color: var(--ink-2); text-decoration: none; font-weight: 550; max-width: 100%; }
a.chip:hover { border-color: var(--teal); color: var(--teal); }
.chip-good { color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.pill { --c: var(--st-pending); display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; font-size: .78rem; font-weight: 650; white-space: nowrap;
  color: color-mix(in srgb, var(--c) 82%, var(--ink)); background: color-mix(in srgb, var(--c) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.pill-sm { font-size: .72rem; padding: 2px 8px 2px 7px; }
.st-pending { --c: var(--st-pending); } .st-progress { --c: var(--st-progress); } .st-hold { --c: var(--st-hold); }
.st-done { --c: var(--st-done); } .st-cancel { --c: var(--st-cancel); } .st-incomplete { --c: var(--st-incomplete); } .st-none { --c: var(--ink-3); }

.status-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.sp { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 11px; border: 1.5px solid var(--line-2); background: var(--surface); font-weight: 650; font-size: .85rem; cursor: pointer; color: var(--ink-2); transition: all .18s; }
.sp i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); opacity: .55; transition: all .18s; }
.sp:hover:not(:disabled) { border-color: var(--c); color: var(--ink); transform: translateY(-1px); }
.sp.on { background: var(--c); border-color: var(--c); color: #fff; box-shadow: 0 8px 16px -8px var(--c), 0 -2px 0 rgb(0 0 0 / .12) inset; }
.sp.on i { background: #fff; opacity: 1; box-shadow: 0 0 0 3px rgb(255 255 255 / .3); }
.sp:disabled { opacity: .45; cursor: default; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 3px; padding: 11px 13px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--card-shadow); min-width: 0; text-align: left; }
.stat-label { font-size: .76rem; color: var(--ink-3); font-weight: 650; text-transform: uppercase; letter-spacing: .07em; }
.stat-value { font-family: var(--font-display); font-size: clamp(1.15rem, .95rem + .6vw, 1.5rem); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-foot { font-size: .8rem; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.stat-good .stat-value { color: var(--good); } .stat-bad .stat-value { color: var(--bad); } .stat-warn .stat-value { color: var(--warn); }
.stat-btn { cursor: pointer; font: inherit; color: inherit; transition: transform .18s, box-shadow .18s; }
.stat-btn:hover { transform: translateY(-2px); box-shadow: var(--lift-shadow); }

/* ---------- sections / tabs / toolbar ---------- */
.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-actions { display: flex; gap: 8px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--card-shadow); min-width: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.two-col > .section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; background: none; border: 0; border-bottom: 2.5px solid transparent; color: var(--ink-2); font-weight: 600; cursor: pointer; white-space: nowrap; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.tab b { font-size: .72rem; background: var(--surface-3); color: var(--ink-2); border-radius: 999px; padding: 1px 7px; font-weight: 700; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.tab.on b { background: var(--accent); color: var(--accent-ink); }
.tab-body { display: flex; flex-direction: column; gap: 12px; animation: rise .3s ease backwards; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 11px; flex: 1 1 260px; max-width: 420px; color: var(--ink-3); }
.search > input:not([type="checkbox"]):not([type="file"]) { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; color: var(--ink); min-height: 0; padding: 0; box-shadow: none; }
.search:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
.seg { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 11px; gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 6px 10px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: .85rem; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(var(--shadow-rgb) / .15); }
.seg-block { display: flex; width: 100%; }
.seg-block button { flex: 1; justify-content: center; padding: 9px; }
.select-sm { width: auto; max-width: 100%; min-width: 0; min-height: 40px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 10px; }

/* ---------- 4x4 grid & 3D cards ---------- */
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
/* secondary records (sub-clients, tasks, assignments, documents): smaller cards, more per row */
.grid4.grid-compact { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.perspective { perspective: 1200px; }
.c3-wrap { perspective: 900px; min-width: 0; }
.c3 { --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 0%; position: relative; height: 100%; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--card-shadow);
  transform: rotateX(var(--rx)) rotateY(var(--ry)); transform-style: preserve-3d; transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, border-color .25s; overflow: hidden; }
.c3[role="button"] { cursor: pointer; }
.c3:hover { box-shadow: var(--lift-shadow); border-color: var(--line-2); transform: translateY(-6px) rotateX(var(--rx)) rotateY(var(--ry)); }
.c3-glare { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(380px circle at var(--mx) var(--my), var(--glare), transparent 45%); opacity: 0; transition: opacity .3s; z-index: 2; border-radius: inherit; }
.c3:hover .c3-glare { opacity: 1; }

.client-card { display: flex; flex-direction: column; }
.cc-cover { height: 62px; padding: 8px 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 6px;
  background:
    radial-gradient(circle at 18% 120%, hsl(calc(var(--h) * 1deg) 55% 60% / .55), transparent 55%),
    repeating-linear-gradient(135deg, rgb(255 255 255 / .06) 0 2px, transparent 2px 12px),
    linear-gradient(135deg, hsl(calc(var(--h) * 1deg) 42% 30%), hsl(calc(var(--h) * 1deg + 40deg) 45% 22%)); }
.cc-cover .pill { background: rgb(255 255 255 / .92); color: color-mix(in srgb, var(--c) 80%, #10282b); border-color: transparent; }
.cc-code { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgb(255 255 255 / .85); background: rgb(0 0 0 / .18); padding: 3px 8px; border-radius: 999px; backdrop-filter: blur(4px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.cc-avatar { margin: -30px auto 0; transform: translateZ(40px); position: relative; z-index: 1; }
.cc-body { padding: 6px 14px 12px; display: flex; flex-direction: column; gap: 6px; text-align: center; transform: translateZ(18px); }
.cc-body h3 { font-size: 1rem; line-height: 1.25; overflow-wrap: anywhere; hyphens: none; }
.cc-line { display: inline-flex; justify-content: center; gap: 5px; align-items: center; color: var(--ink-2); font-size: .83rem; margin-top: -4px; }
.cc-status { display: flex; flex-direction: column; gap: 5px; font-size: .76rem; color: var(--ink-3); }
.cc-fin { display: grid; grid-template-columns: repeat(3, 1fr); margin: 2px 0 0; background: var(--surface-2); border-radius: 12px; border: 1px solid var(--line); }
.cc-fin div { padding: 5px 4px; min-width: 0; }
.cc-fin div + div { border-left: 1px solid var(--line); }
.cc-fin dt { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 700; }
.cc-fin dd { margin: 0; font-weight: 700; font-size: .76rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-actions { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 12px; border-top: 1px dashed var(--line-2); background: var(--surface-2); transform: translateZ(10px); }

.client-card.cc-compact { display: flex; flex-direction: column; gap: 6px; padding: 10px 11px 11px 14px; border-radius: 15px; }
.cc-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(hsl(calc(var(--h) * 1deg) 45% 42%), hsl(calc(var(--h) * 1deg + 40deg) 45% 30%)); }
/* the photo floats so a long client name keeps the full width of the card and never gets cut */
.cc-row { display: block; min-width: 0; transform: translateZ(16px); }
.cc-row::after { content: ""; display: block; clear: both; }
.cc-row > .avatar { float: left; margin: 1px 8px 2px 0; }
.cc-row > .cc-dot { float: right; margin: 6px 0 4px 6px; }
.cc-id { display: block; min-width: 0; line-height: 1.25; }
.cc-compact h3 { font-size: .9rem; line-height: 1.25; overflow-wrap: anywhere; hyphens: none; }
.cc-compact .cc-line { display: flex; justify-content: flex-start; font-size: .73rem; margin: 0; overflow-wrap: anywhere; }
.cc-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--ink-3)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--ink-3)) 20%, transparent); }
.cc-mini { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; font-size: .73rem; color: var(--ink-3); }
.cc-mini span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-mini b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cc-compact .bar { height: 5px; }
.cc-pay { display: inline-flex; align-items: center; justify-content: center; gap: 5px; margin-top: 1px; padding: 5px 8px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2); font: inherit; font-size: .74rem; font-weight: 650; cursor: pointer; min-height: 30px; }
.cc-pay:active { transform: scale(.97); }

.stack { display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.stack span { background: var(--c); min-width: 4px; }
.stack-empty { opacity: .6; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--teal); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.bar-good span { background: linear-gradient(90deg, var(--good), color-mix(in srgb, var(--good) 70%, #fff)); }
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; }
.ring circle { transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.ring span { font-weight: 750; font-size: .82rem; font-variant-numeric: tabular-nums; }

.task-card, .ptask-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.task-card.compact, .ptask-card.compact { padding: 10px 11px 11px; gap: 6px; border-radius: 15px; }
.task-card.compact .eyebrow, .ptask-card.compact .cat-chip { font-size: .64rem; }
.task-card.compact h3, .ptask-card.compact h3 { font-size: .91rem; line-height: 1.3; overflow-wrap: anywhere; }
.task-card.compact .tc-money strong { font-size: .98rem; }
.task-card.compact .tc-money span, .task-card.compact .tc-foot, .ptask-card.compact .tc-foot, .ptask-card.compact .pt-status { font-size: .72rem; }
.task-card.compact .tc-client { font-size: .74rem; }
.ptask-card.compact .pt-desc { display: none; }
.ptask-card.compact .pt-status { padding-top: 6px; }
.task-card.compact .bar, .ptask-card.compact .bar { height: 5px; }
.assign-card.compact .ac-path strong { font-size: .8rem; }
.assign-card.compact .ac-path span { font-size: .72rem; }
.task-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--c); }
.tc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.tc-top .eyebrow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-card h3, .ptask-card h3 { font-size: 1.02rem; transform: translateZ(20px); overflow-wrap: anywhere; }
.tc-client { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--ink-2); font-weight: 550; background: none; border: 0; padding: 0; min-width: 0; text-align: left; overflow-wrap: anywhere; }
.tc-client.big { font-size: .95rem; cursor: pointer; }
.tc-money { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.tc-money strong { font-family: var(--font-display); font-size: 1.15rem; }
.tc-money span { font-size: .8rem; font-weight: 650; }
.tc-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .78rem; color: var(--ink-2); margin-top: auto; flex-wrap: wrap; }
.tc-foot > span { display: inline-flex; align-items: center; gap: 5px; }
.tc-counts { display: inline-flex; gap: 10px; }
.tc-counts span { display: inline-flex; align-items: center; gap: 3px; }
.pt-band { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--cat); }
.cat-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; min-width: 0; overflow: hidden; }
.cat-chip i { width: 9px; height: 9px; border-radius: 3px; background: var(--cat); flex: none; }
.pri { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); }
.pri-urgent { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.pri-high { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pt-desc { font-size: .84rem; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pt-progress { display: flex; align-items: center; gap: 8px; font-size: .74rem; color: var(--ink-3); }
.pt-progress .bar { flex: 1; }
.pt-status { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; color: var(--ink-3); padding-top: 10px; border-top: 1px dashed var(--line); }
.people-stack { display: inline-flex; align-items: center; }
.people-stack .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.people-stack .avatar:first-child { margin-left: 0; }
.people-stack .more { margin-left: 4px; font-size: .74rem; font-weight: 700; color: var(--ink-2); }
.person-card { padding: 14px 12px 11px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.person-card h3 { margin-top: 6px; }
.person-links { display: flex; gap: 2px; margin-top: 8px; }

.avatar { --h: 180; position: relative; display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; flex: none; font-weight: 700; color: #fff; font-family: var(--font-display);
  background: linear-gradient(145deg, hsl(calc(var(--h) * 1deg) 50% 48%), hsl(calc(var(--h) * 1deg + 35deg) 55% 32%)); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-ring { box-shadow: 0 0 0 4px var(--surface), 0 10px 20px -6px rgb(var(--shadow-rgb) / .45); }

/* ---------- documents ---------- */
.docs, .voices, .subtasks { display: flex; flex-direction: column; gap: 14px; }
.dropzone { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: var(--surface-2); color: var(--ink-2); transition: all .2s; }
.dropzone strong { display: block; color: var(--ink); font-weight: 600; }
.dropzone span { font-size: .8rem; }
.dropzone.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); transform: scale(1.01); }
.uploading { display: flex; flex-wrap: wrap; gap: 6px; }
.note { display: flex; gap: 8px; align-items: flex-start; font-size: .84rem; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); padding: 10px 12px; border-radius: 11px; }
.modal-body > .note { margin-bottom: 14px; }
.note .ic { margin-top: 2px; flex: none; }
.grid-compact .ftile { aspect-ratio: 16 / 10; }
.doc-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--card-shadow); transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s; min-width: 0; }
.doc-card:hover { transform: translateY(-5px) rotateX(3deg); box-shadow: var(--lift-shadow); }
.doc-open { border: 0; padding: 0; background: none; cursor: zoom-in; display: block; width: 100%; }
.ftile { --fc: var(--ink-3); aspect-ratio: 4 / 3; display: grid; place-items: center; background: linear-gradient(160deg, color-mix(in srgb, var(--fc) 14%, var(--surface-2)), color-mix(in srgb, var(--fc) 26%, var(--surface-2))); position: relative; overflow: hidden; }
.ftile.big { width: 200px; max-width: 100%; border-radius: 16px; }
.ftile-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.doc-card:hover .ftile-img img { transform: scale(1.05); }
.ftile-sheet { width: 44%; aspect-ratio: 3 / 4; border-radius: 6px 16px 6px 6px; background: var(--surface); box-shadow: 0 12px 20px -10px rgb(var(--shadow-rgb) / .45), 0 1px 0 var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--fc); transform: rotate(-4deg); transition: transform .3s; }
.doc-card:hover .ftile-sheet { transform: rotate(0deg) translateY(-3px) scale(1.04); }
.ftile-sheet b { font-size: .7rem; letter-spacing: .08em; background: var(--fc); color: #fff; padding: 1px 6px; border-radius: 4px; }
.fk-pdf { --fc: #D0453C; } .fk-word { --fc: #2E6FD0; } .fk-sheet { --fc: #1F8F55; } .fk-slides { --fc: #D0621E; }
.fk-audio { --fc: #7B5CD6; } .fk-video { --fc: #C2418A; } .fk-text { --fc: #5B6B7C; } .fk-archive { --fc: #9A7B2F; }
.doc-meta { padding: 10px 12px 2px; min-width: 0; }
.doc-meta strong { display: block; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta span { font-size: .74rem; color: var(--ink-3); }
.doc-actions { display: flex; justify-content: space-between; padding: 4px 6px 6px; }

.preview { min-height: 200px; }
.preview-wait { display: flex; gap: 10px; align-items: center; color: var(--ink-2); padding: 40px; justify-content: center; }
.preview-img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: 10px; }
.preview-audio { width: 100%; }
.preview-video { width: 100%; max-height: 70vh; border-radius: 10px; background: #000; }
.preview-frame { width: 100%; height: 70vh; border: 0; border-radius: 10px; background: #fff; }
.pdf-pages { display: flex; flex-direction: column; gap: 12px; }
.pdf-pages canvas { border-radius: 6px; box-shadow: 0 4px 16px rgb(var(--shadow-rgb) / .2); background: #fff; }
.docx-view { background: #fff; color: #1a1a1a; padding: clamp(18px, 4vw, 48px); border-radius: 10px; box-shadow: 0 4px 16px rgb(var(--shadow-rgb) / .15); max-width: 800px; margin: 0 auto; line-height: 1.6; overflow-x: auto; }
.docx-view table { border-collapse: collapse; } .docx-view td, .docx-view th { border: 1px solid #ccc; padding: 4px 8px; }
.docx-view img { max-width: 100%; }
.preview-text { white-space: pre-wrap; font-family: var(--font-mono); font-size: .82rem; background: var(--surface-2); padding: 16px; border-radius: 10px; max-height: 70vh; overflow: auto; margin: 0; }
.preview-none { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px; text-align: center; color: var(--ink-2); }

/* ---------- voice ---------- */
.voice-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.recorder { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--bad) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--bad) 25%, var(--line)); flex-wrap: wrap; animation: rise .25s ease backwards; }
.recorder-denied { background: var(--surface-2); border-color: var(--line); }
.recorder-denied > div { flex: 1 1 220px; }
.recorder-denied strong { display: block; } .recorder-denied span { font-size: .82rem; color: var(--ink-2); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bad); }
.rec-dot.live { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--bad) 20%, transparent); } }
.rec-time { font-variant-numeric: tabular-nums; font-family: var(--font-mono); min-width: 44px; }
.rec-wave { flex: 1 1 160px; height: 40px; width: 100%; min-width: 0; color: var(--bad); }
.voice-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.voice-row { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--card-shadow); min-width: 0; }
.play { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: linear-gradient(160deg, #8C70E0, #6247C4); color: #fff; box-shadow: 0 6px 14px -6px #6247C4; transition: transform .15s; }
.play:hover { transform: scale(1.07); }
.play.on { background: linear-gradient(160deg, var(--accent-2), var(--accent)); color: var(--accent-ink); }
.voice-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.voice-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.voice-top strong { font-size: .88rem; }
.voice-track { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; cursor: pointer; }
.voice-track span { display: block; height: 100%; background: #7B5CD6; border-radius: inherit; }
.voice-dur { font-family: var(--font-mono); font-size: .78rem; color: var(--ink-2); min-width: 36px; text-align: right; }

/* ---------- subtasks ---------- */
.subtasks ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.subtasks li { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 6px; border-radius: 10px; transition: background .15s; }
.subtasks li:hover { background: var(--surface-2); }
.subtasks label { flex: 1; display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 0; }
.subtasks input[type="checkbox"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tick { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; transition: all .18s; background: var(--surface); }
.subtasks input:checked + .tick { background: var(--good); border-color: var(--good); color: #fff; transform: scale(1.06); }
.subtasks input:focus-visible + .tick { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.subtasks li.done .st-text { text-decoration: line-through; color: var(--ink-3); }
.st-text { overflow-wrap: anywhere; }
.subtasks-meter { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--ink-2); }
.subtasks-meter .bar { flex: 1; }
.subtask-add { display: flex; gap: 8px; }
.subtask-add input { flex: 1; min-width: 0; }

/* ---------- forms ---------- */
input:not([type="checkbox"]):not([type="file"]), select, textarea { width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: .8rem; font-weight: 650; color: var(--ink-2); }
.field-hint { font-size: .76rem; color: var(--ink-3); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-block { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.photo-input { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.photo-input > div { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.login-box { margin-top: 18px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.login-box-head { display: flex; gap: 8px; align-items: center; color: var(--teal); }
.mini-fin { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 8px 12px; }
.mini-fin b { color: var(--ink); font-variant-numeric: tabular-nums; }
.receipt-row { margin-top: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--teal); }
.form-err { display: flex; gap: 6px; align-items: center; color: var(--bad); font-size: .85rem; font-weight: 550; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.swatch { width: 34px; height: 34px; border-radius: 10px; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; transition: transform .15s; }
.swatch.on { box-shadow: 0 0 0 2.5px var(--ink); transform: scale(1.08); }
.people-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.person-chip { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 3px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-size: .84rem; font-weight: 550; transition: all .15s; }
.person-chip:hover { border-color: var(--teal); }
.person-chip.on { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); }
.person-chip.add { padding-left: 10px; color: var(--teal); border-style: dashed; }
.people-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.people-list li { display: flex; align-items: center; gap: 10px; }

/* ---------- modal ---------- */
/* a dialog is capped by the visible area: the head and foot never move out of reach, the body scrolls */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgb(6 16 17 / .55); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; overflow: hidden; animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(640px, 100%); max-height: 100%; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border-radius: 20px; border: 1px solid var(--line); box-shadow: 0 40px 80px -30px rgb(0 0 0 / .55); animation: pop .28s cubic-bezier(.2,.9,.3,1.2) both; }
.modal-wide { width: min(980px, 100%); }
.modal-small { width: min(440px, 100%); }
@keyframes pop { from { transform: translateY(14px) scale(.97); opacity: 0; } }
.modal-head { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.modal-head h2 { font-size: 1.2rem; overflow-wrap: anywhere; }
.modal-x { border: 0; background: var(--surface-3); width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); flex: none; }
.modal-body { flex: 1 1 auto; min-height: 0; padding: 6px 20px 20px; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot { flex: none; display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 20px 20px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--card-shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 700; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th.r { text-align: right; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.table .clickable { cursor: pointer; }
.row-pending { background: color-mix(in srgb, var(--warn) 6%, transparent); }
.cell-person { display: flex; align-items: center; gap: 10px; }
.cell-status { display: flex; flex-direction: column; gap: 6px; min-width: 130px; }
.ledger tr.credit td:nth-child(2) { color: var(--ink-2); }

/* ---------- profile & detail ---------- */
.profile { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--card-shadow); position: relative; overflow: hidden; }
.profile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 58px; background: linear-gradient(120deg, var(--brand-ink), color-mix(in srgb, var(--teal) 60%, var(--brand-ink))); opacity: .96; }
.profile::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 58px; background: repeating-linear-gradient(135deg, rgb(255 255 255 / .05) 0 2px, transparent 2px 14px); }
.profile-main { position: relative; z-index: 1; display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; min-width: 0; flex: 1 1 420px; padding-top: 10px; }
.profile-id { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 260px; padding-top: 42px; }
.contact-row { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-notes { font-size: .88rem; color: var(--ink-2); max-width: 68ch; }
.profile-side { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; justify-content: space-between; }
.profile-side .btn-row .btn:not(.btn-ghost) { background: var(--surface); }
.access { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin-top: 44px; }
.access strong { font-size: 1.1rem; }
.fin-strip { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px; border-radius: 18px; background: linear-gradient(135deg, var(--surface), var(--surface-2)); border: 1px solid var(--line); box-shadow: var(--card-shadow); }
.fin-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(134px, 1fr)); gap: 8px; flex: 1 1 520px; }
.fin-figs .stat { box-shadow: none; background: var(--surface); }
.fin-side { display: flex; align-items: center; gap: 16px; }
.task-hero { --c: var(--st-pending); display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; padding: 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--card-shadow); position: relative; overflow: hidden; }
.task-hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--c); transition: background .3s; }
.task-hero-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.task-hero-side { display: flex; flex-direction: column; gap: 10px; padding: 13px; border-radius: 15px; background: var(--surface-2); border: 1px solid var(--line); }
.status-block { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0; }
.kv dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 700; }
.kv dd { margin: 2px 0 0; font-weight: 650; }

/* ---------- statement ---------- */
.statement { display: flex; flex-direction: column; gap: 16px; }
.stmt-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 18px; border-radius: 14px; background: var(--brand-ink); color: #fff; }
.stmt-head .eyebrow { color: var(--accent); }
.stmt-head h3 { font-size: 1.3rem; }
.stmt-head .muted { color: rgb(255 255 255 / .7); }
.stmt-client { display: flex; gap: 10px; align-items: center; }
.stmt-client > div { display: flex; flex-direction: column; }
.stmt-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stmt-sum div { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; }
.stmt-sum span { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 700; }
.stmt-sum b { font-family: var(--font-display); font-size: 1.25rem; font-variant-numeric: tabular-nums; }

/* ---------- dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.chart-wrap { overflow-x: auto; }
.chart { width: 100%; height: auto; display: block; min-width: 320px; }
.chart-t { fill: var(--ink-3); font-size: 11px; font-family: var(--font-body); }
.chart-v { fill: var(--ink-2); font-size: 10.5px; font-weight: 700; font-family: var(--font-body); }
.pipeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pipeline li { display: block; }
.pipe-row { display: grid; grid-template-columns: 110px 1fr 32px 14px; align-items: center; gap: 12px; width: calc(100% + 12px); background: none; border: 0; padding: 4px 6px; margin: -4px -6px; border-radius: 10px; font: inherit; color: inherit; text-align: left; cursor: pointer; box-sizing: border-box; }
.pipe-row .ic { color: var(--ink-3); }
.pipe-bar { height: 12px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.pipe-bar span { display: block; height: 100%; background: var(--c); border-radius: inherit; transition: width .7s cubic-bezier(.2,.8,.2,1); min-width: 0; }
.pipeline b { text-align: right; }
.owing, .due-list, .recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.owing li { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.owing li:last-child, .due-list li:last-child, .recent li:last-child { border-bottom: 0; }
.owing-who { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; min-width: 0; }
.owing-who strong { display: block; overflow-wrap: anywhere; }
.owing-fig { display: flex; flex-direction: column; gap: 5px; text-align: right; }
.due-list li { border-bottom: 1px solid var(--line); }
.due-list button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 4px; background: none; border: 0; cursor: pointer; text-align: left; border-radius: 10px; }
.due-list button:hover { background: var(--surface-2); }
.due-date { flex: none; width: 46px; height: 48px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .66rem; text-transform: uppercase; color: var(--ink-3); font-weight: 700; line-height: 1; gap: 2px; }
.due-date b { font-family: var(--font-display); font-size: 1.15rem; color: var(--ink); }
.due-date.soon { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }
.due-date.late { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); }
.due-date.late b { color: var(--bad); }
.due-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.due-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.cat-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-filter { --cat: var(--ink-3); display: inline-flex; align-items: center; gap: 2px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; font-size: .86rem; color: var(--ink-2); cursor: pointer; padding: 0; transition: all .18s; }
button.cat-filter { padding: 7px 14px; gap: 6px; }
.cat-filter > button:first-child { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; padding: 7px 12px 7px 12px; cursor: pointer; color: inherit; font-weight: inherit; }
.cat-filter i { width: 10px; height: 10px; border-radius: 3px; background: var(--cat); }
.cat-filter b { font-size: .72rem; background: var(--surface-3); border-radius: 999px; padding: 0 7px; }
.cat-filter:hover { border-color: var(--cat); color: var(--ink); }
.cat-filter.on { background: color-mix(in srgb, var(--cat) 14%, var(--surface)); border-color: var(--cat); color: var(--ink); box-shadow: 0 6px 14px -8px var(--cat); }
.cat-filter.add { border-style: dashed; color: var(--teal); }
.cat-mini { border: 0; background: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; color: var(--ink-2); margin-right: 3px; }
.cat-mini:hover { background: var(--surface-3); color: var(--ink); }

/* ---------- empty / pager / toast ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 26px 18px; border-radius: var(--radius); border: 1.5px dashed var(--line-2); background: var(--surface-2); }
.empty-ic { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--surface); color: var(--teal); box-shadow: var(--card-shadow); margin-bottom: 6px; transform: rotate(-6deg); }
.empty p { color: var(--ink-2); max-width: 44ch; font-size: .9rem; }
.empty .btn { margin-top: 8px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: .85rem; color: var(--ink-2); }
.toasts { position: fixed; z-index: 80; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92%, 440px); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: center; padding: 11px 16px; border-radius: 13px; background: var(--brand-ink); color: #fff; font-weight: 550; font-size: .9rem; box-shadow: 0 16px 34px -12px rgb(0 0 0 / .5); animation: pop .3s cubic-bezier(.2,.9,.3,1.2) both; }
.toast .ic { color: var(--accent); flex: none; }
.toast-err { background: var(--bad); }
.toast-err .ic { color: #fff; }

/* ---------- login / splash / portal ---------- */
.splash { min-height: var(--app-vh, 100vh); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; color: var(--ink-2); }
.splash p { max-width: 46ch; }
.login { min-height: var(--app-vh, 100vh); display: grid; grid-template-columns: 1.1fr 1fr; background: var(--ground); }
.login-art { position: relative; overflow: hidden; background: var(--side); display: grid; place-items: center; perspective: 1000px;
  background-image: radial-gradient(70% 60% at 30% 20%, rgb(233 162 27 / .22), transparent 60%), radial-gradient(60% 60% at 80% 90%, rgb(61 180 168 / .2), transparent 60%); }
.login-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; width: min(440px, 76%); transform: rotateX(52deg) rotateZ(-38deg); transform-style: preserve-3d; }
.login-tiles span { aspect-ratio: 1; border-radius: 16px; background: linear-gradient(145deg, rgb(255 255 255 / .1), rgb(255 255 255 / .02)); border: 1px solid rgb(255 255 255 / .1); box-shadow: 0 24px 30px -12px rgb(0 0 0 / .5);
  animation: float 6s ease-in-out infinite; animation-delay: calc(var(--i) * -0.37s); }
.login-tiles span:nth-child(3n+1) { background: linear-gradient(145deg, rgb(233 162 27 / .75), rgb(233 162 27 / .3)); }
.login-tiles span:nth-child(5n+2) { background: linear-gradient(145deg, rgb(61 180 168 / .6), rgb(61 180 168 / .18)); }
@keyframes float { 50% { transform: translateZ(26px); } }
.login-card { align-self: center; justify-self: center; width: min(420px, 100%); padding: 32px clamp(16px, 4vw, 36px); display: flex; flex-direction: column; gap: 22px; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand strong { display: block; font-family: var(--font-display); font-size: 1.25rem; }
.login-brand span { font-size: .8rem; color: var(--ink-3); letter-spacing: .05em; text-transform: uppercase; }
.login-form { display: flex; flex-direction: column; gap: 14px; animation: rise .3s ease backwards; }
.login-form h1 { font-size: 1.8rem; }
.login-form input { min-height: 48px; font-size: 1.05rem; }
.portal { min-height: var(--app-vh, 100vh); }
.portal-bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 10px clamp(16px, 3vw, 40px); background: var(--side); color: #fff; }
.portal-bar .btn-ghost { color: var(--side-ink); }
.portal-bar .btn-ghost:hover { background: rgb(255 255 255 / .08); color: #fff; }
.portal-brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: inherit; cursor: pointer; text-align: left; }
.portal-brand strong { display: block; font-family: var(--font-display); }
.portal-brand small { color: var(--side-ink); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; }

.sheet-back { position: fixed; inset: 0; z-index: 45; background: rgb(0 0 0 / .35); display: flex; align-items: flex-end; animation: fade .2s both; }
.sheet { width: 100%; max-height: 92%; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border-radius: 20px 20px 0 0; padding: 14px 14px calc(84px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 4px; animation: rise .25s ease both; }
.sheet-link { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; text-decoration: none; color: var(--ink); font-weight: 600; background: none; border: 0; text-align: left; cursor: pointer; }
.sheet-link:hover { background: var(--surface-2); }


/* ================= staff, assignments, conversation, notifications ================= */
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.side-me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgb(255 255 255 / .05); border: 1px solid rgb(255 255 255 / .07); }
.side-me strong { display: block; color: #fff; font-size: .9rem; line-height: 1.2; }
.side-me small { color: var(--side-ink); opacity: .75; font-size: .76rem; }
.topbar { align-items: center; gap: 4px; }
.topbar-out { color: var(--side-ink); }
.topbar-out:hover { background: rgb(255 255 255 / .08); color: #fff; }
.linkless { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }

.bell-wrap { position: relative; }
.bell { position: relative; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer; transition: transform .15s, background .15s; }
.bell-dark { background: rgb(255 255 255 / .06); border-color: rgb(255 255 255 / .1); color: var(--side-ink); }
.bell:hover { transform: translateY(-1px); color: #fff; }
.bell.has svg { animation: ring 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes ring { 0%, 86%, 100% { transform: rotate(0); } 89% { transform: rotate(14deg); } 93% { transform: rotate(-12deg); } 96% { transform: rotate(6deg); } }
.bell .badge { position: absolute; top: -5px; right: -6px; margin: 0; box-shadow: 0 0 0 2px var(--side); }
.bell-back { position: fixed; inset: 0; z-index: 55; }
.bell-panel { position: absolute; z-index: 60; top: 48px; left: 0; width: min(380px, calc(var(--app-vw, 100vw) - 32px)); max-height: min(70dvh, 560px); max-height: min(calc(var(--app-vh, 100dvh) * .7), 560px); display: flex; flex-direction: column; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 60px -20px rgb(0 0 0 / .5); animation: pop .22s cubic-bezier(.2,.9,.3,1.2) both; overflow: hidden; }
.topbar .bell-panel { left: auto; right: 0; position: fixed; top: calc(60px + env(safe-area-inset-top, 0px)); right: 16px; }
.bell-panel header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.bell-panel header strong { font-family: var(--font-display); font-size: 1.05rem; }
.bell-panel ul { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.notif { width: 100%; display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 12px; border: 0; background: none; text-align: left; cursor: pointer; color: var(--ink-2); position: relative; }
.notif:hover { background: var(--surface-2); }
.notif.unread { color: var(--ink); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.notif-body { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: .86rem; line-height: 1.35; }
.notif-body small { color: var(--ink-3); }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: none; }
.notif-ic { --nc: var(--teal); flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: var(--nc); background: color-mix(in srgb, var(--nc) 14%, var(--surface)); }
.n-completed .notif-ic, .notif-ic.n-completed { --nc: var(--good); }
.n-incomplete .notif-ic, .notif-ic.n-incomplete { --nc: var(--st-incomplete); }
.n-message .notif-ic, .notif-ic.n-message { --nc: #7B5CD6; }
.n-assigned .notif-ic, .notif-ic.n-assigned { --nc: var(--accent); }
.n-unassigned .notif-ic { --nc: var(--bad); }
.notif-empty { padding: 30px; text-align: center; color: var(--ink-3); }
.recent li.is-new { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent); border-radius: 10px; }
.recent li { align-items: flex-start; }
.recent .linkless span.block { font-size: .88rem; }

/* staff cards */
.staff-card.is-off { filter: grayscale(.85); opacity: .78; }
.workload { display: flex; align-items: center; gap: 8px; font-size: .72rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.workload .bar { flex: 1; }
.perm-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; height: 100%; }
.toggle:hover { border-color: var(--line-2); }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { flex: none; width: 40px; height: 24px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; transition: background .2s; margin-top: 1px; }
.toggle-track span { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgb(0 0 0 / .25); transition: transform .22s cubic-bezier(.2,.9,.3,1.3); }
.toggle input:checked + .toggle-track { background: var(--teal); border-color: var(--teal); }
.toggle input:checked + .toggle-track span { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-track { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.toggle-text { display: flex; flex-direction: column; gap: 2px; }
.toggle-text strong { font-size: .88rem; }
.toggle-text small { font-size: .76rem; color: var(--ink-3); }

/* assignment modal steps */
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.step { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 5px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .78rem; font-weight: 650; color: var(--ink-3); transition: all .2s; }
.step b { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: .7rem; }
.step.done { color: var(--ink); border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.step.done b { background: var(--good); color: #fff; }
.modal-body > .note:last-child { margin: 14px 0 0; }

/* assignment cards */
.assign-card { padding-top: 14px; }
.assign-card.compact { padding-top: 11px; }
.ac-people { display: flex; align-items: flex-start; min-width: 0; transform: translateZ(26px); }
.ac-people .avatar + .avatar { margin-left: -14px; }
.ac-path { display: flex; flex-direction: column; margin-left: 10px; min-width: 0; flex: 1; line-height: 1.25; }
.ac-path strong { font-size: .88rem; overflow-wrap: anywhere; }
.ac-path span { display: inline-flex; align-items: flex-start; gap: 2px; font-size: .8rem; color: var(--ink-2); overflow-wrap: anywhere; }
.unread-badge { position: absolute; top: 12px; right: 12px; z-index: 3; display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 999px; background: #7B5CD6; color: #fff; font-size: .72rem; font-weight: 750; box-shadow: 0 6px 12px -4px #7B5CD6; animation: pulse-v 2s ease-in-out infinite; }
@keyframes pulse-v { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, #7B5CD6 20%, transparent); } }
.assignee { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 650; color: var(--ink-2); }

/* assignment strip on admin task page */
.assign-strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; border-radius: 18px; background: linear-gradient(120deg, var(--surface), color-mix(in srgb, var(--teal) 7%, var(--surface))); border: 1px solid var(--line); box-shadow: var(--card-shadow); }
.assign-strip .eyebrow { display: block; }
.assign-name { display: inline-flex; gap: 8px; align-items: center; font-family: var(--font-display); font-size: 1.1rem; cursor: pointer; }
.assign-name:hover { color: var(--teal); }
.assign-empty-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-3); }

/* staff brief */
.path-chip { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 650; color: var(--ink-2); }
.brief-clients { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.brief-client { display: flex; gap: 16px; padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--card-shadow); min-width: 0; transition: transform .25s, box-shadow .25s; }
.brief-client:hover { transform: translateY(-3px); box-shadow: var(--lift-shadow); }
.brief-client-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.brief-client-body h3 { font-size: 1.15rem; overflow-wrap: anywhere; }
.brief-note { display: flex; gap: 6px; align-items: flex-start; font-size: .84rem; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 9%, var(--surface)); color: var(--ink); }
.brief-note .ic { color: var(--warn); margin-top: 2px; flex: none; }
.instructions { padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); display: flex; flex-direction: column; gap: 4px; }
.instructions .eyebrow { color: color-mix(in srgb, var(--accent) 60%, var(--ink)); }
.prev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.prev-grid > div { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; position: relative; }
.timeline li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; position: relative; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 5px; top: 24px; bottom: -6px; width: 2px; background: var(--line); }
.timeline.panel li { padding: 10px 0; }
.tl-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--c); margin-top: 5px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.tl-body { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; background: none; border: 0; padding: 0; text-align: left; color: inherit; font: inherit; }
button.tl-body { cursor: pointer; }
button.tl-body:hover strong { color: var(--teal); }
.earlier { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.earlier li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.earlier li:last-child { border-bottom: 0; }
.earlier-voices { display: flex; flex-direction: column; gap: 8px; }

/* conversation */
.thread { display: flex; flex-direction: column; gap: 12px; }
.thread-scroll { display: flex; flex-direction: column; gap: 12px; max-height: 560px; overflow-y: auto; padding: 14px; border-radius: 16px; background:
  radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 0) 0 0 / 18px 18px, var(--surface-2); border: 1px solid var(--line); }
.thread-empty { text-align: center; color: var(--ink-3); padding: 28px 12px; font-size: .9rem; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: min(560px, 88%); animation: rise .25s ease both; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-bubble { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 16px 16px 16px 4px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 6px 14px -10px rgb(var(--shadow-rgb) / .45); min-width: 0; }
.msg.mine .msg-bubble { border-radius: 16px 16px 4px 16px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.msg-head { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; font-size: .76rem; color: var(--ink-3); }
.msg-head b { color: var(--ink); font-size: .8rem; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; }
.msg-read { align-self: flex-end; font-size: .68rem; color: var(--ink-3); margin-top: -4px; }
.msg-files { display: flex; flex-direction: column; gap: 6px; }
.msg-file { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; text-align: left; color: inherit; min-width: 0; }
.msg-file .ftile { width: 54px; flex: none; border-radius: 8px; }
.msg-file .ftile-sheet b { display: none; }
.msg-file span { display: flex; flex-direction: column; min-width: 0; }
.msg-file strong { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-file small { color: var(--ink-3); font-size: .72rem; }
.vbubble { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.vbubble .play { width: 36px; height: 36px; }
.vwave { flex: 1; display: flex; align-items: center; gap: 2px; height: 30px; cursor: pointer; }
.vwave span { flex: 1; min-width: 2px; border-radius: 2px; background: color-mix(in srgb, #7B5CD6 30%, var(--line-2)); transition: background .2s; }
.vwave span.on { background: #7B5CD6; }
.thread-event { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; font-size: .78rem; color: var(--ink-2); }
.te-line { flex: 1 1 20px; height: 1px; background: var(--line-2); }
.te-body { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.te-note { flex-basis: 100%; text-align: center; font-style: italic; color: var(--ink-2); }
.composer { display: flex; flex-direction: column; gap: 8px; }
.composer-files { display: flex; flex-wrap: wrap; gap: 6px; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; padding: 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--card-shadow); }
.composer-row:focus-within { border-color: var(--teal); }
.composer-row textarea:not([type="checkbox"]) { flex: 1; border: 0; box-shadow: none; min-height: 40px; max-height: 140px; resize: none; padding: 9px 6px; background: transparent; }
.composer-attach { width: 40px; height: 40px; flex: none; }

@media (max-width: 920px) {
  .brief-clients, .prev-grid { grid-template-columns: 1fr; }
  .perm-list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .brief-client { flex-direction: column; }
  .msg { max-width: 94%; }
  .vbubble { min-width: 180px; }
  .assign-strip .grow { flex-basis: calc(100% - 64px); }
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .grid4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .voice-list { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { display: flex; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; padding: 10px 16px; background: var(--side); color: #fff; }
  .topbar .side-brand strong { font-size: 1rem; }
  .bottom-nav { display: flex; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 30px -18px rgb(var(--shadow-rgb) / .4); }
  .bottom-nav a, .bottom-nav button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: .68rem; font-weight: 650; color: var(--ink-3); text-decoration: none; background: none; border: 0; border-radius: 12px; cursor: pointer; }
  .bottom-nav .on { color: var(--teal); background: var(--teal-soft); }
  .bottom-nav .badge { position: absolute; top: 2px; right: calc(50% - 22px); margin: 0; height: 17px; min-width: 17px; font-size: .64rem; }
  .main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); padding-top: 20px; }
  .portal-main { padding-bottom: 60px; }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stats, .stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid, .two-col { grid-template-columns: 1fr; }
  .fin-side { width: 100%; justify-content: space-between; }
  .fin-side .btn-col { flex-direction: row; flex-wrap: wrap; }
  .span-2.panel { grid-column: auto; }
  .task-hero { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { height: 190px; }
  .login-tiles { width: 300px; gap: 10px; }
}
@media (max-width: 560px) {
  body { font-size: 14.5px; }
  /* the client/staff hero keeps its prominence but gives back vertical space on phones */
  .profile .avatar { width: 74px !important; height: 74px !important; font-size: 27px !important; }
  .profile .chip { font-size: .76rem; padding: 3px 9px; }
  .profile-notes { font-size: .82rem; }
  .access { padding: 7px 11px; }
  .grid4:not(.grid-compact).perspective:has(.client-card) { grid-template-columns: 1fr; }
  .grid4 { gap: 10px; }
  .grid4.grid-compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .form-grid .span-2, .mini-fin.span-2 { grid-column: auto; }
  .stats-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-5 .stat-label { font-size: .62rem; }
  .stats-5 .stat-foot { font-size: .66rem; gap: 2px; }
  .stat { padding: 9px 11px; gap: 2px; }
  .stat-label { font-size: .68rem; letter-spacing: .05em; }
  .stat-value { font-size: 1.12rem; }
  .stat-foot { font-size: .72rem; }
  .toolbar { gap: 8px; }
  .search { flex-basis: 100%; min-height: 38px; }
  .profile { padding: 16px; }
  .profile-side { align-items: stretch; width: 100%; }
  .access { align-items: flex-start; margin-top: 0; }
  .profile-id { padding-top: 0; }
  .profile-main { padding-top: 8px; }
  .fin-side { width: 100%; justify-content: space-between; }
  .btn-col { flex-direction: row; flex-wrap: wrap; }
  .stmt-sum { grid-template-columns: 1fr; }
  .owing li { grid-template-columns: minmax(0, 1fr) auto; }
  .owing-fig { grid-column: 1 / -1; order: 3; }
  .page-head .page-actions { width: 100%; }
  .dropzone { flex-direction: column; text-align: center; }
  .doc-actions { padding: 2px; }
  .icon-btn { width: 30px; height: 30px; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { border-radius: 20px 20px 0 0; max-height: 100%; }
  .modal-foot { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .pipe-row { grid-template-columns: 96px 1fr 26px 12px; }
  .kv { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .c3:hover, .doc-card:hover { transform: none; }
}

/* ================= installed app (PWA), safe areas, touch & orientation ================= */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }
.is-standalone body { overscroll-behavior-y: none; }
.is-standalone .side-nav, .is-standalone .bottom-nav, .is-standalone .topbar, .is-standalone .tabs, .is-standalone .btn { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.shell, .login, .portal, .splash { min-height: 100dvh; min-height: var(--app-vh, 100dvh); }
.side { height: 100dvh; height: var(--app-vh, 100dvh); padding-top: calc(20px + env(safe-area-inset-top, 0px)); padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); padding-left: calc(14px + env(safe-area-inset-left, 0px)); }
.main { padding-right: max(clamp(14px, 2.4vw, 30px), env(safe-area-inset-right, 0px)); }
.portal-bar { top: 0; padding-top: calc(10px + env(safe-area-inset-top, 0px)); padding-left: max(clamp(16px, 3vw, 40px), env(safe-area-inset-left, 0px)); padding-right: max(clamp(16px, 3vw, 40px), env(safe-area-inset-right, 0px)); }
.portal-actions { display: flex; align-items: center; gap: 4px; }
.portal-icon { color: var(--side-ink); }
.portal-icon:hover, .portal-icon.on { background: rgb(255 255 255 / .1); color: #fff; }
.splash { padding: calc(24px + env(safe-area-inset-top, 0px)) 24px calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--ground); }
.splash .btn { text-decoration: none; }
.modal-back { padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.modal { max-height: 100%; }

/* install banner, bars and guide */
.install-banner { display: flex; align-items: center; gap: 12px; max-width: 1320px; margin: 0 auto 18px; padding: 12px 12px 12px 14px; border-radius: 18px;
  background: linear-gradient(120deg, var(--brand-ink), color-mix(in srgb, var(--teal) 55%, var(--brand-ink))); color: #fff; box-shadow: 0 16px 30px -18px rgb(0 0 0 / .55); animation: rise .35s ease both; }
.install-banner img { border-radius: 12px; flex: none; box-shadow: 0 6px 14px rgb(0 0 0 / .35); }
.install-banner strong { display: block; font-family: var(--font-display); font-size: 1rem; }
.install-banner span { font-size: .84rem; color: rgb(255 255 255 / .78); }
.install-banner .icon-btn { color: rgb(255 255 255 / .75); }
.install-banner .icon-btn:hover { background: rgb(255 255 255 / .12); color: #fff; }
.net-bar, .update-bar { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 24px)); display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 10px 14px; border-radius: 14px; font-size: .88rem; font-weight: 550; box-shadow: 0 16px 34px -12px rgb(0 0 0 / .45); animation: pop .3s ease both; }
.net-bar { top: calc(10px + env(safe-area-inset-top, 0px)); background: var(--warn); color: #221400; }
.update-bar { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.update-bar .ic { color: var(--teal); }
.install-guide { display: flex; flex-direction: column; gap: 16px; }
.install-guide h3 { font-size: 1.05rem; }
.install-hero { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 16px; background: linear-gradient(120deg, var(--brand-ink), color-mix(in srgb, var(--teal) 50%, var(--brand-ink))); color: #fff; }
.install-hero img { border-radius: 16px; flex: none; }
.install-hero strong { display: block; font-family: var(--font-display); font-size: 1.1rem; }
.install-hero span { font-size: .84rem; color: rgb(255 255 255 / .75); }
.install-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.install-steps li { counter-increment: step; display: grid; grid-template-columns: 28px 40px 1fr; gap: 10px; align-items: center; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); line-height: 1.45; }
.install-steps li::before { content: counter(step); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 750; font-size: .85rem; }
.step-glyph { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: #0A84FF; }
.install-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 14px; border: 1px dashed var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; text-align: left; }
.install-link:hover { border-color: var(--teal); }
.install-link img { border-radius: 8px; }
.install-link span { flex: 1; display: flex; flex-direction: column; }
.install-link small { color: var(--ink-3); font-size: .78rem; }
.check.remember { font-size: .86rem; color: var(--ink-2); }

/* app & devices */
.app-status { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.app-status img { border-radius: 14px; box-shadow: var(--card-shadow); }
.pref-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.toggle.is-disabled { opacity: .6; cursor: not-allowed; }
.theme-seg { align-self: flex-start; }
.device-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.device-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.device-list li:last-child { border-bottom: 0; }
.device-list strong { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.device-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--teal); flex: none; }
.device-list li.current .device-ic { background: var(--teal-soft); }
.sys-kv { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

@media (max-width: 920px) {
  .topbar { top: 0; padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
  .main { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .bottom-nav { padding-left: max(6px, env(safe-area-inset-left, 0px)); padding-right: max(6px, env(safe-area-inset-right, 0px)); }
  .toasts { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
  .update-bar { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .install-banner { padding: 10px; }
  .login-card { padding-top: calc(28px + env(safe-area-inset-top, 0px)); }
  .login-art { padding-top: env(safe-area-inset-top, 0px); }
}
@media (max-width: 560px) {
  /* 16px inputs stop iOS Safari zooming into fields */
  input:not([type="checkbox"]):not([type="file"]), select, textarea { font-size: 16px; }
  .install-banner span { display: none; }
  .install-steps li { grid-template-columns: 24px 36px 1fr; padding: 10px; gap: 8px; }
  .step-glyph { width: 36px; height: 36px; }
  .hide-xs { display: none; }
  .modal { padding-bottom: env(safe-area-inset-bottom, 0px); }
}

/* phones in landscape: short screens */
@media (orientation: landscape) and (max-height: 500px) {
  .bottom-nav a span, .bottom-nav button span { display: none; }
  .bottom-nav a, .bottom-nav button { padding: 8px 2px; }
  .main { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); padding-top: 12px; }
  .toasts { bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 6px; }
  .topbar .mark { width: 28px; height: 28px; }
  .login { grid-template-columns: 1fr 1.2fr; }
  .login-art { height: auto; }
  .login-tiles { width: 220px; }
  .login-card { padding-top: 16px; padding-bottom: 16px; gap: 12px; }
  .login-form h1 { font-size: 1.4rem; }
  .login-form .muted { display: none; }
  .modal-back { padding: 6px; align-items: center; }
  .modal { max-height: 100%; border-radius: 16px; }
  .modal-head { padding: 12px 16px 8px; }
  .modal-foot { padding: 10px 16px; }
  .page-head h1 { font-size: 1.5rem; }
  .profile-id { padding-top: 0; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (display-mode: standalone) and (max-width: 920px) {
  .install-banner { display: none; }
}

/* ================= tappable records & touch feedback ================= */
.record-link { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: var(--teal); font-weight: 650; cursor: pointer; text-align: left; display: inline-flex; align-items: center; gap: 3px; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--teal) 35%, transparent); text-underline-offset: 3px; min-height: 28px; }
.record-link .ic { flex: none; }
h3 .record-link { font-weight: inherit; color: inherit; text-decoration: none; }
h3 .record-link .ic { color: var(--teal); }
.chip-btn { cursor: pointer; font: inherit; font-size: .8rem; min-height: 32px; }
.chip-btn .ic { flex: none; }
.row-btn { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; padding: 6px 8px; margin: -6px -8px; width: calc(100% + 16px); border-radius: 12px; font: inherit; color: inherit; text-align: left; cursor: pointer; min-width: 0; }
.row-btn > .ic { color: var(--ink-3); flex: none; }
.earlier li .row-btn, .people-list li .row-btn { margin: 0; width: auto; padding: 4px 6px; }
.people-list li .row-btn { flex: 1; }
.recent li:has(> .row-btn) { align-items: center; }
.assign-name { background: none; border: 0; padding: 0; color: inherit; text-align: left; }
.assign-name .ic { color: var(--ink-3); }
button.doc-meta { display: block; width: 100%; background: none; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.dropzone[role="button"] { cursor: pointer; }
.cat-chip-btn { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: .75rem; }
.chart-col { cursor: pointer; outline: none; }
.chart-col:focus-visible rect:last-of-type, .chart-col:hover rect:nth-of-type(2) { opacity: 1; filter: brightness(1.08); }
.table .clickable td:last-child .row-chev { margin-left: 6px; color: var(--ink-3); vertical-align: -1px; }
.select-inline { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; padding: 0 4px 0 10px; border: 1px solid var(--line-2); border-radius: 11px; background: var(--surface); color: var(--ink-2); min-height: 40px; }
.select-inline select { border: 0; background: transparent; min-height: 38px; padding: 0 6px; font: inherit; color: var(--ink); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.show-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .hide-touch { display: none; }
  .show-touch { display: inline; }
}
/* hover lifts only where there is a real pointer — on phones they stick after a tap */
@media (hover: none) {
  .stat-btn:hover, .btn:hover:not(:disabled), .icon-btn:hover, .c3:hover, .doc-card:hover, .brief-client:hover, .side-link:hover, .sp:hover:not(:disabled), .bell:hover { transform: none; }
  .c3:hover .c3-glare { opacity: 0; }
  .stat-btn:hover, .c3:hover, .doc-card:hover, .brief-client:hover { box-shadow: var(--card-shadow); }
  .table tbody tr:hover { background: transparent; }
}
/* pressed feedback for every tappable thing */
.stat-btn:active, .c3[role="button"]:active, .row-btn:active, .pipe-row:active, .due-list button:active, .owing-who:active,
.notif:active, .sheet-link:active, .record-link:active, .chip-btn:active, a.chip:active, .table .clickable:active, button.doc-meta:active,
.tl-body:is(button):active, .linkless:active, .bottom-nav a:active, .bottom-nav button:active, .dropzone[role="button"]:active {
  transform: scale(.98); transition: transform .06s;
}
.row-btn:active, .pipe-row:active, .table .clickable:active, .notif:active, .sheet-link:active, .linkless:active { background: var(--surface-2); }
@media (hover: hover) {
  .row-btn:hover, .pipe-row:hover { background: var(--surface-2); }
  .record-link:hover { text-decoration-color: currentColor; }
  .chip-btn:hover { border-color: var(--teal); color: var(--teal); }
}
/* wide tables inside dialogs scroll sideways instead of stretching the dialog past the phone screen */
.modal, .modal-body, .statement, .statement > * { min-width: 0; }
.modal-body > * { max-width: 100%; }
.owing-fig.linkless { text-align: right; width: 100%; }
[data-results] { scroll-margin-top: calc(76px + env(safe-area-inset-top, 0px)); }
.page > div[data-results]:empty { display: block; height: 0; margin-top: -14px; }
.results-flash { animation: resultsFlash .9s ease-out; border-radius: var(--radius); }
@keyframes resultsFlash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--teal) 45%, transparent); } 40% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--teal) 22%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.pay-detail { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pay-amount { font-family: var(--font-display); font-size: 1.7rem; }
.kv-list { grid-template-columns: 1fr !important; }
.kv-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv-list > div:last-child { border-bottom: 0; }
.kv-list dd { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.row-open { font-weight: 600; color: var(--ink-3); text-decoration: none; }

/* ================= reports ================= */
.report-types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.report-type { display: flex; align-items: flex-start; gap: 12px; text-align: left; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--card-shadow); font: inherit; color: inherit; cursor: pointer; min-width: 0; transition: border-color .15s, box-shadow .15s, transform .15s; }
.report-type > .ic { margin-left: auto; color: var(--teal); flex: none; }
.report-type-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--teal) 12%, transparent); color: var(--teal); flex: none; }
.report-type-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.report-type-text small { color: var(--ink-3); font-size: .78rem; line-height: 1.35; }
.report-type.on { border-color: var(--teal); box-shadow: 0 0 0 2px color-mix(in srgb, var(--teal) 30%, transparent), var(--card-shadow); }
.report-type.on .report-type-ic { background: var(--teal); color: #fff; }
@media (hover: hover) { .report-type:hover { transform: translateY(-2px); box-shadow: var(--lift-shadow); } }
.report-type:active { transform: scale(.98); }
.report-form { align-items: end; }
.report-form select, .report-form input[type=date] { width: 100%; }
.date-wrap { display: flex; align-items: center; gap: 4px; }
.date-wrap input { flex: 1; min-width: 0; }
.report-check { min-height: 44px; }
.report-include { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.include-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.include-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: .82rem; font-weight: 600; cursor: pointer; min-height: 36px; user-select: none; }
.include-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.include-chip.on { background: color-mix(in srgb, var(--teal) 12%, var(--surface)); border-color: var(--teal); color: var(--teal); }
.include-chip:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: 2px; }
.include-chip:active { transform: scale(.97); }
.report-bar { position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--lift-shadow); }
.report-bar-info { display: flex; flex-direction: column; min-width: 0; }
.report-bar-info strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rp-criteria { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.rp-criteria div { display: flex; gap: 6px; font-size: .82rem; }
.rp-criteria dt { color: var(--ink-3); font-weight: 650; } .rp-criteria dd { margin: 0; font-weight: 650; }
.rp-h { margin: 10px 0 0; padding-bottom: 6px; border-bottom: 2px solid var(--teal); color: var(--teal); font-size: 1.05rem; }
.rp-h2 { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 8px; }
.rp-h2 span { color: var(--ink-3); font-size: .8rem; }
.rp-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.rp-stats div { display: flex; flex-direction: column; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.rp-stats span { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; }
.rp-stats b { font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-stats .tone-good b { color: var(--good); } .rp-stats .tone-bad b { color: var(--bad); } .rp-stats .tone-warn b { color: var(--warn); }
.rp-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; margin: 0; }
.rp-kv div { display: flex; flex-direction: column; min-width: 0; }
.rp-kv dt { font-size: .7rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.rp-kv dd { margin: 0; overflow-wrap: anywhere; }
.rp-text p { margin: 4px 0 0; white-space: pre-wrap; }
.rp-table h4 { margin: 0 0 6px; font-size: .9rem; }
.table-compact th, .table-compact td { padding: 6px 8px; font-size: .8rem; white-space: nowrap; }
@media (max-width: 1100px) { .report-types { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .report-types { grid-template-columns: 1fr; gap: 8px; }
  .report-type { padding: 11px 12px; }
  .report-type-text small { display: none; }
  .report-type.on .report-type-text small { display: block; }
  .report-bar { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .report-bar .btn span { white-space: nowrap; }
}
@media (max-width: 760px) {
  .report-types.compact { display: flex; overflow-x: auto; gap: 8px; margin-inline: -16px; padding: 2px 16px 6px; scroll-snap-type: x proximity; scroll-padding-inline: 16px; scrollbar-width: none; }
  .report-types.compact::-webkit-scrollbar { display: none; }
  .report-types.compact .report-type { flex: none; align-items: center; padding: 8px 12px 8px 8px; scroll-snap-align: start; border-radius: 999px; }
  .report-types.compact .report-type-ic { width: 30px; height: 30px; border-radius: 99px; }
  .report-types.compact .report-type-text small, .report-types.compact .report-type > .ic:last-child { display: none; }
  .report-types.compact .report-type-text strong { white-space: nowrap; font-size: .88rem; }
}

/* ================= To-Do (projects, tasks, reminders, location) ================= */
.todo-projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 10px; }
.todo-project { display: flex; flex-direction: column; gap: 6px; align-items: stretch; text-align: left; padding: 13px 15px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--card-shadow); font: inherit; color: inherit; cursor: pointer; min-width: 0; border-left: 4px solid var(--cat); transition: transform .15s, box-shadow .15s, border-color .15s; }
.todo-project strong { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-project.on { border-color: var(--cat); box-shadow: 0 0 0 2px color-mix(in srgb, var(--cat) 35%, transparent), var(--card-shadow); }
.tp-top { display: inline-flex; align-items: center; gap: 6px; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--ink-3); }
.tp-top i { width: 8px; height: 8px; border-radius: 3px; background: var(--cat); flex: none; }
.tp-top em { font-style: normal; margin-left: auto; color: var(--warn); }
.tp-counts { font-size: .8rem; color: var(--ink-2); }
@media (hover: hover) { .todo-project:hover { transform: translateY(-2px); box-shadow: var(--lift-shadow); } }
.todo-project:active { transform: scale(.985); }

.todo-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: .82rem; font-weight: 600; cursor: pointer; min-height: 36px; }
.filter-chip b { background: var(--surface-3); border-radius: 99px; padding: 1px 7px; font-size: .74rem; }
.filter-chip.on { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.filter-chip.on b { background: rgb(255 255 255 / .18); color: #fff; }
.filter-chip:active { transform: scale(.97); }

.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.todo-item { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--card-shadow); border-left: 4px solid var(--c, var(--ink-3)); min-width: 0; }
.todo-item.st-pending { --c: var(--st-pending); } .todo-item.st-progress { --c: var(--st-progress); } .todo-item.st-done { --c: var(--good); }
.todo-item.is-late { --c: var(--bad); }
.todo-check { width: 30px; height: 30px; flex: none; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface-2); color: transparent; display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.todo-check.on { background: var(--good); border-color: var(--good); color: #fff; }
.todo-check:active { transform: scale(.92); }
.todo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; background: none; border: 0; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.todo-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-item.st-done .todo-title { text-decoration: line-through; color: var(--ink-3); }
.todo-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .76rem; color: var(--ink-3); align-items: center; }
.todo-meta span { display: inline-flex; align-items: center; gap: 4px; }
.todo-meta .bad { color: var(--bad); font-weight: 650; } .todo-meta .warn { color: var(--warn); font-weight: 650; }
.chip-mini { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 99px; background: color-mix(in srgb, var(--cat) 12%, transparent); color: var(--ink-2); font-weight: 650; }
.chip-mini i { width: 7px; height: 7px; border-radius: 2px; background: var(--cat); }
.todo-side { display: flex; align-items: center; gap: 6px; flex: none; color: var(--ink-3); }
.chip-project { border-color: var(--cat); }
.chip-project i { width: 8px; height: 8px; border-radius: 3px; background: var(--cat); }
.chip-project .icon-btn { width: 22px; height: 22px; margin-left: 2px; }

.geo-bar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--line-2); }
.geo-bar.compact { background: var(--surface); border-style: solid; }
.geo-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--teal) 14%, transparent); color: var(--teal); flex: none; }
.loc-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; align-items: start; }
.loc-name { display: inline-flex; align-items: center; gap: 6px; font-size: 1.05rem; margin: 2px 0 8px; }
.loc-form { margin-top: 12px; }
.colour-row { display: flex; gap: 8px; flex-wrap: wrap; }
.colour-dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: 0 0 0 1px var(--line) inset; }
.colour-dot.on { border-color: var(--ink); transform: scale(1.06); }
.snooze-row { align-items: center; gap: 6px; flex-wrap: wrap; }
.reminder-pop { display: flex; gap: 14px; align-items: flex-start; }
.reminder-pop p { margin: 4px 0 0; }
.reminder-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-ink, var(--accent)); }
.reminder-ic.location { background: color-mix(in srgb, var(--teal) 16%, transparent); color: var(--teal); }
@media (max-width: 760px) {
  .loc-grid { grid-template-columns: 1fr; }
  .todo-item { padding: 10px; gap: 8px; }
  .todo-side .pill { display: none; }
  .todo-projects { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) { .todo-projects { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .todo-filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 2px 16px 6px; scroll-padding-inline: 16px; scrollbar-width: none; }
  .todo-filters::-webkit-scrollbar { display: none; }
  .todo-filters .filter-chip { flex: none; }
}

/* ================= X Memories ================= */
.memory-filters { align-items: end; }
.memory-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.memory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(246px, 1fr)); gap: 11px; }
.memory-card { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--cat); box-shadow: var(--card-shadow); font: inherit; color: inherit; cursor: pointer; min-width: 0; transition: transform .15s, box-shadow .15s; }
.mc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mc-cat { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--ink-3); }
.mc-top .pill { flex: none; white-space: normal; text-align: right; }
.mc-cat i { width: 8px; height: 8px; border-radius: 3px; background: var(--cat); flex: none; }
.mc-name { font-family: var(--font-display); font-size: 1.05rem; }
.mc-desc { font-size: .84rem; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mc-counts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .78rem; color: var(--ink-3); }
.mc-counts span { display: inline-flex; align-items: center; gap: 4px; }
.mc-counts .warn { color: var(--warn); font-weight: 650; }
.mc-money { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .84rem; font-weight: 650; }
.mc-money .bad { color: var(--bad); }
.mc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
@media (hover: hover) { .memory-card:hover { transform: translateY(-3px); box-shadow: var(--lift-shadow); } }
.memory-card:active { transform: scale(.985); }

.memory-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.memory-person { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--card-shadow); border-left: 4px solid var(--ink-3); min-width: 0; color: var(--ink-3); }
.memory-person.is-open { border-left-color: var(--warn); }
.mp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; background: none; border: 0; padding: 0; text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.mp-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mp-line { font-size: .84rem; color: var(--ink-2); display: inline-flex; gap: 5px; align-items: flex-start; overflow-wrap: anywhere; }
.mp-line.warn { color: var(--warn); }
.mp-line.money { color: var(--ink); font-weight: 650; }
.mp-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .76rem; color: var(--ink-3); }
.mp-meta span { display: inline-flex; align-items: center; gap: 4px; }

.memory-hero .cat-chip i { background: var(--cat); }
.memory-timeline .tl-dot { display: grid; place-items: center; color: #fff; }
.tl-dot.mem-created { background: var(--teal); } .tl-dot.mem-person { background: #2f6fed; }
.tl-dot.mem-financial { background: var(--accent); } .tl-dot.mem-note { background: var(--ink-3); }
.tl-dot.mem-document { background: #7a4fd0; } .tl-dot.mem-voice { background: #c2185b; }
.tl-dot.mem-status { background: var(--warn); } .tl-dot.mem-updated { background: var(--ink-3); } .tl-dot.mem-event { background: var(--good); }
.memory-timeline li { align-items: flex-start; }
.memory-timeline .money { color: var(--ink); font-weight: 650; display: inline-flex; gap: 4px; align-items: center; }
.record-detail { display: flex; flex-direction: column; gap: 16px; }
.rd-head { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 760px) {
  .memory-grid { grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); }
  .memory-chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 2px 16px 6px; scroll-padding-inline: 16px; scrollbar-width: none; }
  .memory-chips::-webkit-scrollbar { display: none; }
  .memory-chips .filter-chip, .memory-chips .linkish { flex: none; }
}
@media (max-width: 480px) { .memory-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  /* search and filter panels stay two-up on phones so they do not fill the screen */
  .memory-filters, .todo-filters-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .memory-filters .span-2 { grid-column: 1 / -1; }
  .memory-filters .field-label { font-size: .72rem; }
  .memory-filters .field { gap: 4px; }
}

/* While a dialog is open, no container behind it may create a containing block for it —
   otherwise a fixed dialog would be measured against a long page instead of the window. */
body.modal-open .page, body.modal-open .tab-body, body.modal-open .main, body.modal-open .shell { animation: none; transform: none; filter: none; perspective: none; }

/* ================= screen size (in-app zoom) ================= */
.zoomer { display: flex; align-items: center; gap: 8px; min-width: 0; }
.zoomer-label { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 650; color: var(--ink-2); }
.zoomer-btns { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); }
.zoom-btn, .zoom-now { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; border-radius: 999px; display: inline-grid; place-items: center; transition: background .15s, color .15s; }
.zoom-btn { width: 30px; height: 30px; color: var(--ink-2); }
.zoom-now { min-width: 52px; height: 30px; padding: 0 8px; font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.zoom-btn:hover:not(:disabled), .zoom-now:hover { background: var(--surface-3); color: var(--ink); }
.zoom-btn:active:not(:disabled), .zoom-now:active { transform: scale(.94); }
.zoom-btn:disabled { opacity: .4; cursor: default; }

/* in the dark sidebar */
.side .zoomer { flex: none; justify-content: space-between; padding: 2px 2px 0; }
.side .zoomer-label { white-space: nowrap; font-size: .72rem; }
.side .zoomer-label { color: var(--side-ink); }
.side .zoomer-btns { background: rgb(255 255 255 / .06); border-color: rgb(255 255 255 / .12); }
.side .zoom-btn { color: var(--side-ink); }
.side .zoom-now { color: #fff; }
.side .zoom-btn:hover:not(:disabled), .side .zoom-now:hover { background: rgb(255 255 255 / .12); color: #fff; }

/* in the top bar and the client portal bar */
.zoomer-bar .zoomer-btns { background: rgb(255 255 255 / .1); border-color: rgb(255 255 255 / .16); }
.zoomer-bar .zoom-btn { color: rgb(255 255 255 / .8); width: 28px; height: 28px; }
.zoomer-bar .zoom-now { color: #fff; min-width: 46px; height: 28px; }
.zoomer-bar .zoom-btn:hover:not(:disabled), .zoomer-bar .zoom-now:hover { background: rgb(255 255 255 / .18); color: #fff; }

/* in the phone "More" sheet */
.zoomer-sheet { justify-content: space-between; padding: 10px 14px; margin-top: 4px; border-top: 1px dashed var(--line-2); }
.zoomer-sheet .zoomer-label { font-size: .95rem; font-weight: 600; color: var(--ink); }
.zoomer-sheet .zoom-btn { width: 36px; height: 36px; }
.zoomer-sheet .zoom-now { height: 36px; min-width: 58px; font-size: .85rem; }

/* on the App & devices page */
.zoomer-panel { flex-wrap: wrap; gap: 10px; margin: 10px 0 6px; }
.zoomer-panel .zoomer-label { font-size: .85rem; }
.zoomer-panel .zoom-btn { width: 38px; height: 38px; }
.zoomer-panel .zoom-now { height: 38px; min-width: 64px; font-size: .9rem; }
@media (max-width: 420px) {
  .zoomer-bar .zoom-now { min-width: 0; padding: 0 6px; font-size: .72rem; }
}

/* very small screens: rows keep to the panel, nothing bleeds past the edge */
@media (max-width: 560px) {
  .row-btn { width: 100%; margin: 0; padding: 6px 2px; }
  .toolbar > * { min-width: 0; max-width: 100%; }
}
@media (max-width: 400px) {
  /* the row itself is the button, so the little chevron can go when space is tight */
  .recent .row-btn > .ic, .owing .row-btn > .ic { display: none; }
}



/* ---- the same breakpoints, applied to the in-app zoom's effective size ---- */
html[data-bp-w~="920"] .brief-clients, html[data-bp-w~="920"] .prev-grid { grid-template-columns: 1fr; }
html[data-bp-w~="920"] .perm-list { grid-template-columns: 1fr; }
html[data-bp-w~="560"] .brief-client { flex-direction: column; }
html[data-bp-w~="560"] .msg { max-width: 94%; }
html[data-bp-w~="560"] .vbubble { min-width: 180px; }
html[data-bp-w~="560"] .assign-strip .grow { flex-basis: calc(100% - 64px); }
html[data-bp-w~="1180"] .grid4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
html[data-bp-w~="1180"] .stats-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
html[data-bp-w~="1180"] .voice-list { grid-template-columns: 1fr; }
html[data-bp-w~="920"] .shell { grid-template-columns: 1fr; }
html[data-bp-w~="920"] .side { display: none; }
html[data-bp-w~="920"] .topbar { display: flex; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; padding: 10px 16px; background: var(--side); color: #fff; }
html[data-bp-w~="920"] .topbar .side-brand strong { font-size: 1rem; }
html[data-bp-w~="920"] .bottom-nav { display: flex; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 30px -18px rgb(var(--shadow-rgb) / .4); }
html[data-bp-w~="920"] .bottom-nav a, html[data-bp-w~="920"] .bottom-nav button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: .68rem; font-weight: 650; color: var(--ink-3); text-decoration: none; background: none; border: 0; border-radius: 12px; cursor: pointer; }
html[data-bp-w~="920"] .bottom-nav .on { color: var(--teal); background: var(--teal-soft); }
html[data-bp-w~="920"] .bottom-nav .badge { position: absolute; top: 2px; right: calc(50% - 22px); margin: 0; height: 17px; min-width: 17px; font-size: .64rem; }
html[data-bp-w~="920"] .main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); padding-top: 20px; }
html[data-bp-w~="920"] .portal-main { padding-bottom: 60px; }
html[data-bp-w~="920"] .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
html[data-bp-w~="920"] .stats, html[data-bp-w~="920"] .stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html[data-bp-w~="920"] .dash-grid, html[data-bp-w~="920"] .two-col { grid-template-columns: 1fr; }
html[data-bp-w~="920"] .fin-side { width: 100%; justify-content: space-between; }
html[data-bp-w~="920"] .fin-side .btn-col { flex-direction: row; flex-wrap: wrap; }
html[data-bp-w~="920"] .span-2.panel { grid-column: auto; }
html[data-bp-w~="920"] .task-hero { grid-template-columns: 1fr; }
html[data-bp-w~="920"] .login { grid-template-columns: 1fr; }
html[data-bp-w~="920"] .login-art { height: 190px; }
html[data-bp-w~="920"] .login-tiles { width: 300px; gap: 10px; }
html[data-bp-w~="560"] body { font-size: 14.5px; }
html[data-bp-w~="560"] /* the client/staff hero keeps its prominence but gives back vertical space on phones */
  .profile .avatar { width: 74px !important; height: 74px !important; font-size: 27px !important; }
html[data-bp-w~="560"] .profile .chip { font-size: .76rem; padding: 3px 9px; }
html[data-bp-w~="560"] .profile-notes { font-size: .82rem; }
html[data-bp-w~="560"] .access { padding: 7px 11px; }
html[data-bp-w~="560"] .grid4:not(.grid-compact).perspective:has(.client-card) { grid-template-columns: 1fr; }
html[data-bp-w~="560"] .grid4 { gap: 10px; }
html[data-bp-w~="560"] .grid4.grid-compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
html[data-bp-w~="560"] .form-grid, html[data-bp-w~="560"] .form-grid-3 { grid-template-columns: 1fr; }
html[data-bp-w~="560"] .form-grid .span-2, html[data-bp-w~="560"] .mini-fin.span-2 { grid-column: auto; }
html[data-bp-w~="560"] .stats-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
html[data-bp-w~="560"] .stats-5 .stat-label { font-size: .62rem; }
html[data-bp-w~="560"] .stats-5 .stat-foot { font-size: .66rem; gap: 2px; }
html[data-bp-w~="560"] .stat { padding: 9px 11px; gap: 2px; }
html[data-bp-w~="560"] .stat-label { font-size: .68rem; letter-spacing: .05em; }
html[data-bp-w~="560"] .stat-value { font-size: 1.12rem; }
html[data-bp-w~="560"] .stat-foot { font-size: .72rem; }
html[data-bp-w~="560"] .toolbar { gap: 8px; }
html[data-bp-w~="560"] .search { flex-basis: 100%; min-height: 38px; }
html[data-bp-w~="560"] .profile { padding: 16px; }
html[data-bp-w~="560"] .profile-side { align-items: stretch; width: 100%; }
html[data-bp-w~="560"] .access { align-items: flex-start; margin-top: 0; }
html[data-bp-w~="560"] .profile-id { padding-top: 0; }
html[data-bp-w~="560"] .profile-main { padding-top: 8px; }
html[data-bp-w~="560"] .fin-side { width: 100%; justify-content: space-between; }
html[data-bp-w~="560"] .btn-col { flex-direction: row; flex-wrap: wrap; }
html[data-bp-w~="560"] .stmt-sum { grid-template-columns: 1fr; }
html[data-bp-w~="560"] .owing li { grid-template-columns: minmax(0, 1fr) auto; }
html[data-bp-w~="560"] .owing-fig { grid-column: 1 / -1; order: 3; }
html[data-bp-w~="560"] .page-head .page-actions { width: 100%; }
html[data-bp-w~="560"] .dropzone { flex-direction: column; text-align: center; }
html[data-bp-w~="560"] .doc-actions { padding: 2px; }
html[data-bp-w~="560"] .icon-btn { width: 30px; height: 30px; }
html[data-bp-w~="560"] .modal-back { padding: 0; align-items: flex-end; }
html[data-bp-w~="560"] .modal { border-radius: 20px 20px 0 0; max-height: 100%; }
html[data-bp-w~="560"] .modal-foot { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
html[data-bp-w~="560"] .pipe-row { grid-template-columns: 96px 1fr 26px 12px; }
html[data-bp-w~="560"] .kv { grid-template-columns: 1fr 1fr; }
html[data-bp-w~="920"] .topbar { top: 0; padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
html[data-bp-w~="920"] .main { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
html[data-bp-w~="920"] .bottom-nav { padding-left: max(6px, env(safe-area-inset-left, 0px)); padding-right: max(6px, env(safe-area-inset-right, 0px)); }
html[data-bp-w~="920"] .toasts { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
html[data-bp-w~="920"] .update-bar { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
html[data-bp-w~="920"] .install-banner { padding: 10px; }
html[data-bp-w~="920"] .login-card { padding-top: calc(28px + env(safe-area-inset-top, 0px)); }
html[data-bp-w~="920"] .login-art { padding-top: env(safe-area-inset-top, 0px); }
html[data-bp-w~="560"] /* 16px inputs stop iOS Safari zooming into fields */
  input:not([type="checkbox"]):not([type="file"]), html[data-bp-w~="560"] select, html[data-bp-w~="560"] textarea { font-size: 16px; }
html[data-bp-w~="560"] .install-banner span { display: none; }
html[data-bp-w~="560"] .install-steps li { grid-template-columns: 24px 36px 1fr; padding: 10px; gap: 8px; }
html[data-bp-w~="560"] .step-glyph { width: 36px; height: 36px; }
html[data-bp-w~="560"] .hide-xs { display: none; }
html[data-bp-w~="560"] .modal { padding-bottom: env(safe-area-inset-bottom, 0px); }
html[data-bp-h~="500"] .bottom-nav a span, html[data-bp-h~="500"] .bottom-nav button span { display: none; }
html[data-bp-h~="500"] .bottom-nav a, html[data-bp-h~="500"] .bottom-nav button { padding: 8px 2px; }
html[data-bp-h~="500"] .main { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); padding-top: 12px; }
html[data-bp-h~="500"] .toasts { bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
html[data-bp-h~="500"] .topbar { padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 6px; }
html[data-bp-h~="500"] .topbar .mark { width: 28px; height: 28px; }
html[data-bp-h~="500"] .login { grid-template-columns: 1fr 1.2fr; }
html[data-bp-h~="500"] .login-art { height: auto; }
html[data-bp-h~="500"] .login-tiles { width: 220px; }
html[data-bp-h~="500"] .login-card { padding-top: 16px; padding-bottom: 16px; gap: 12px; }
html[data-bp-h~="500"] .login-form h1 { font-size: 1.4rem; }
html[data-bp-h~="500"] .login-form .muted { display: none; }
html[data-bp-h~="500"] .modal-back { padding: 6px; align-items: center; }
html[data-bp-h~="500"] .modal { max-height: 100%; border-radius: 16px; }
html[data-bp-h~="500"] .modal-head { padding: 12px 16px 8px; }
html[data-bp-h~="500"] .modal-foot { padding: 10px 16px; }
html[data-bp-h~="500"] .page-head h1 { font-size: 1.5rem; }
html[data-bp-h~="500"] .profile-id { padding-top: 0; }
html[data-bp-h~="500"] .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
html[data-bp-h~="500"] .grid4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
html[data-bp-w~="1100"] .report-types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html[data-bp-w~="760"] .report-types { grid-template-columns: 1fr; gap: 8px; }
html[data-bp-w~="760"] .report-type { padding: 11px 12px; }
html[data-bp-w~="760"] .report-type-text small { display: none; }
html[data-bp-w~="760"] .report-type.on .report-type-text small { display: block; }
html[data-bp-w~="760"] .report-bar { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
html[data-bp-w~="760"] .report-bar .btn span { white-space: nowrap; }
html[data-bp-w~="760"] .report-types.compact { display: flex; overflow-x: auto; gap: 8px; margin-inline: -16px; padding: 2px 16px 6px; scroll-snap-type: x proximity; scroll-padding-inline: 16px; scrollbar-width: none; }
html[data-bp-w~="760"] .report-types.compact::-webkit-scrollbar { display: none; }
html[data-bp-w~="760"] .report-types.compact .report-type { flex: none; align-items: center; padding: 8px 12px 8px 8px; scroll-snap-align: start; border-radius: 999px; }
html[data-bp-w~="760"] .report-types.compact .report-type-ic { width: 30px; height: 30px; border-radius: 99px; }
html[data-bp-w~="760"] .report-types.compact .report-type-text small, html[data-bp-w~="760"] .report-types.compact .report-type > .ic:last-child { display: none; }
html[data-bp-w~="760"] .report-types.compact .report-type-text strong { white-space: nowrap; font-size: .88rem; }
html[data-bp-w~="760"] .loc-grid { grid-template-columns: 1fr; }
html[data-bp-w~="760"] .todo-item { padding: 10px; gap: 8px; }
html[data-bp-w~="760"] .todo-side .pill { display: none; }
html[data-bp-w~="760"] .todo-projects { grid-template-columns: 1fr 1fr; }
html[data-bp-w~="420"] .todo-projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html[data-bp-w~="760"] .todo-filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 2px 16px 6px; scroll-padding-inline: 16px; scrollbar-width: none; }
html[data-bp-w~="760"] .todo-filters::-webkit-scrollbar { display: none; }
html[data-bp-w~="760"] .todo-filters .filter-chip { flex: none; }
html[data-bp-w~="760"] .memory-grid { grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); }
html[data-bp-w~="760"] .memory-chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 2px 16px 6px; scroll-padding-inline: 16px; scrollbar-width: none; }
html[data-bp-w~="760"] .memory-chips::-webkit-scrollbar { display: none; }
html[data-bp-w~="760"] .memory-chips .filter-chip, html[data-bp-w~="760"] .memory-chips .linkish { flex: none; }
html[data-bp-w~="480"] .memory-grid { grid-template-columns: 1fr; }
html[data-bp-w~="560"] /* search and filter panels stay two-up on phones so they do not fill the screen */
  .memory-filters, html[data-bp-w~="560"] .todo-filters-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
html[data-bp-w~="560"] .memory-filters .span-2 { grid-column: 1 / -1; }
html[data-bp-w~="560"] .memory-filters .field-label { font-size: .72rem; }
html[data-bp-w~="560"] .memory-filters .field { gap: 4px; }
html[data-bp-w~="420"] .zoomer-bar .zoom-now { min-width: 0; padding: 0 6px; font-size: .72rem; }
html[data-bp-w~="560"] .row-btn { width: 100%; margin: 0; padding: 6px 2px; }
html[data-bp-w~="560"] .toolbar > * { min-width: 0; max-width: 100%; }
html[data-bp-w~="400"] /* the row itself is the button, html[data-bp-w~="400"] so the little chevron can go when space is tight */
  .recent .row-btn > .ic, html[data-bp-w~="400"] .owing .row-btn > .ic { display: none; }
