/* Stayora CRM (/crm) — visual system matches the HV Technologies / AOne CRM:
   Inter, html 80%, #f7f7f8 page + rail, white cards (1px #e5e7eb, 10px radius), lucide icons, html.dark theme.
   Breakpoints: 1280 (KPI 2 cols) / 1024 (sidebar off-canvas, 1-col grids) / 640 (tables → cards). */
:root {
  --bg: #f9fafb; --rail: #f7f7f8; --rail-line: #e9e9ec; --bar: #007100; --green-bg: #f0fdf4; --green: #16a34a; --card: #ffffff; --line: #e5e7eb; --line-soft: #f1f2f4;
  --text: #111827; --text-2: #374151; --muted: #6b7280; --faint: #9ca3af; --hover: #efeff1; --track: #f3f4f6;
  --primary: #111827; --primary-fg: #ffffff; --accent: #10b981; --danger: #dc2626; --focus: #2563eb;
  --shadow: 0 1px 2px rgba(16, 16, 20, .04); --shadow-active: 0 1px 2px rgba(16, 16, 20, .06), 0 0 0 1px rgba(16, 16, 20, .04);
  --hdr: rgba(255, 255, 255, .72); --hdr-line: rgba(16, 16, 20, .08); --input: #ffffff;
  --blue-bg: #eff6ff; --blue: #2563eb; --emerald-bg: #ecfdf5; --emerald: #059669; --amber-bg: #fffbeb; --amber: #d97706;
  --violet-bg: #f5f3ff; --violet: #7c3aed; --red-bg: #fef2f2; --red: #dc2626; --cyan-bg: #ecfeff; --cyan: #0891b2;
  --fob: #14372e; --fob-cut: #f9fafb;
  --side: 16rem; --ease: cubic-bezier(.2, .7, .2, 1);
}
html.dark {
  --bg: #16181c; --rail: #17191d; --rail-line: #2b3038; --bar: #4ade80; --green-bg: rgba(34, 197, 94, .15); --green: #4ade80; --card: #212429; --line: #363c45; --line-soft: #2b2f35;
  --text: #f3f4f6; --text-2: #d1d5db; --muted: #9ca3af; --faint: #6b7280; --hover: #262a30; --track: #2b2f35;
  --primary: #f3f4f6; --primary-fg: #111827; --hdr: rgba(22, 24, 28, .8); --hdr-line: rgba(255, 255, 255, .08); --input: #1b1e22;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-active: 0 1px 2px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 255, 255, .06);
  --blue-bg: rgba(37, 99, 235, .15); --blue: #60a5fa; --emerald-bg: rgba(16, 185, 129, .15); --emerald: #34d399; --amber-bg: rgba(217, 119, 6, .15); --amber: #fbbf24;
  --violet-bg: rgba(124, 58, 237, .18); --violet: #a78bfa; --red-bg: rgba(220, 38, 38, .15); --red: #f87171; --cyan-bg: rgba(8, 145, 178, .18); --cyan: #22d3ee;
  --fob: #c89a4b; --fob-cut: #272b31;
  color-scheme: dark;
}
html { font-size: 80%; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 400 1rem/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code { font-family: ui-monospace, Menlo, monospace; background: var(--track); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
.ic { width: 18px; height: 18px; flex: 0 0 auto; }
.num { font-variant-numeric: tabular-nums; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; height: 2.5rem; padding: 0 1rem; border-radius: 8px; border: 1px solid transparent;
  font-weight: 500; font-size: .9375rem; text-decoration: none; cursor: pointer; white-space: nowrap; background: var(--card); color: var(--text); transition: background-color .15s, opacity .15s; }
.btn .ic { width: 16px; height: 16px; }
.btn--primary { background: var(--primary); color: var(--primary-fg); }
.btn--primary:hover { opacity: .9; }
.btn--ghost { border-color: var(--line); background: var(--card); }
.btn--ghost:hover { background: var(--hover); }
.btn--success { background: var(--accent); color: #fff; }
.btn--success:hover { background: #059669; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #b91c1c; }
.btn--sm { height: 2.125rem; padding: 0 .75rem; font-size: .875rem; }
.btn--block { width: 100%; height: 2.75rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.hbtn { width: 2.25rem; height: 2.25rem; display: inline-grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; position: relative; }
.hbtn:hover { background: var(--hover); color: var(--text); }
.hbtn .dot { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--text); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: .9375rem; }
.linkbtn--danger { color: var(--danger); margin-top: 1.25rem; }

/* Logo box */
.logo-box { width: 2rem; height: 2rem; border-radius: 10px; background: var(--bg); box-shadow: inset 0 0 0 1px rgba(16, 16, 20, .08); display: grid; place-items: center; flex: 0 0 auto; }
.logo-box svg { width: 16px; height: 21px; }

/* Fields */
.fld { display: grid; gap: .375rem; min-width: 0; }
.fld > span { font-weight: 500; font-size: .875rem; color: var(--text-2); }
.fld small { font-weight: 400; color: var(--muted); }
.fld input, .fld select, .fld textarea { width: 100%; height: 2.5rem; padding: 0 .75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--input); font-size: .9375rem; }
.fld textarea { height: auto; padding: .6rem .75rem; resize: vertical; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.fld--wide { grid-column: 1 / -1; }
.sel { height: 2.25rem; padding: 0 .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--input); font-size: .875rem; }
.alert { background: var(--red-bg); color: var(--red); border-radius: 8px; padding: .6rem .8rem; font-weight: 500; font-size: .875rem; }
.alert--ok { background: var(--emerald-bg); color: var(--emerald); }
.check { display: inline-flex; gap: .5rem; align-items: center; font-size: .875rem; cursor: pointer; color: var(--text-2); }
.check input { width: 15px; height: 15px; accent-color: var(--primary); }

/* ───────── Login ───────── */
/* Split-screen login — same layout as the sibling CRMs (PlayArena / Drivora / SolaraX). px sizes (html is 80%). */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; background: var(--bg); }
.auth-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 40px 52px; color: #f4efe2;
  background: linear-gradient(160deg, rgba(8, 24, 20, .95) 0%, rgba(14, 42, 35, .88) 55%, rgba(29, 74, 62, .74) 100%), url(https://images.unsplash.com/photo-1510798831971-661eb04b3739?w=1400&q=70&auto=format&fit=crop) center / cover; }
.auth-brand::after { content: ""; position: absolute; right: -180px; bottom: -180px; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(236, 210, 154, .2), transparent 65%); pointer-events: none; }
.auth-logo { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-size: 23px; font-weight: 700; letter-spacing: -.01em; width: fit-content; }
.auth-mark { width: 40px; height: 40px; border-radius: 10px; background: #14372e; border: 1px solid rgba(236, 210, 154, .35); display: grid; place-items: center; }
.auth-mark svg { width: 20px; height: 27px; --fob: #c89a4b; --fob-cut: #14372e; }
.auth-logo small { margin-left: 6px; padding: 2px 8px; border: 1px solid rgba(255, 255, 255, .3); border-radius: 99px; font-size: 11px; font-weight: 600; letter-spacing: .08em; vertical-align: 3px; color: rgba(255, 255, 255, .8); }
.auth-pitch { position: relative; z-index: 1; }
.auth-pitch h1 { font-size: clamp(32px, 3.4vw, 48px); font-weight: 800; line-height: 1.08; letter-spacing: -.02em; max-width: 16ch; margin: 0; }
.auth-pitch h1 em { font-style: normal; color: #ecd29a; }
.auth-pitch p { color: rgba(244, 239, 226, .75); font-size: 16px; max-width: 44ch; margin: 16px 0 0; }
.auth-points { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 12px; max-width: 420px; }
.auth-points li { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(4px); }
.auth-points b { display: block; font-weight: 600; font-size: 15px; }
.auth-points small { color: rgba(244, 239, 226, .65); font-size: 13px; }
.auth-ico { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: rgba(236, 210, 154, .14); color: #ecd29a; }
.auth-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-legal { position: relative; z-index: 1; margin: 0; font-size: 13px; color: rgba(244, 239, 226, .5); }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth-form { width: min(390px, 100%); display: flex; flex-direction: column; gap: 16px; animation: auth-in .5s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes auth-in { from { opacity: 0; transform: translateY(12px); } }
.auth-form h2 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.auth-sub { margin: -8px 0 4px; color: var(--muted); font-size: 15px; }
.auth-form .alert { font-size: 14px; padding: 10px 12px; border-radius: 10px; }
.auth-field { display: flex; flex-direction: column; gap: 7px; font-size: 14px; font-weight: 600; color: var(--text); }
.auth-field input { height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--input); color: var(--text); font-size: 15px; font-weight: 400; transition: border-color .15s, box-shadow .15s; }
.auth-field input::placeholder { color: var(--faint); }
.auth-field input:focus { outline: none; border-color: #14372e; box-shadow: 0 0 0 4px rgba(20, 55, 46, .15); }
html.dark .auth-field input:focus { border-color: #ecd29a; box-shadow: 0 0 0 4px rgba(236, 210, 154, .15); }
.auth-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.auth-link { background: none; border: 0; padding: 0; color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.auth-link:hover { color: var(--text); }
.auth-pw { position: relative; display: block; }
.auth-pw input { width: 100%; padding-right: 48px; }
.auth-eye { position: absolute; right: 5px; top: 5px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.auth-eye:hover { background: var(--hover); color: var(--text); }
.auth-eye .ic { width: 18px; height: 18px; }
.auth-check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; width: fit-content; }
.auth-check input { width: 16px; height: 16px; accent-color: #14372e; }
.auth-submit { height: 48px; margin-top: 4px; border: 0; border-radius: 10px; background: #14372e; color: #f4efe2; font-size: 16px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: background-color .15s; }
.auth-submit:hover { background: #1d4a3e; }
html.dark .auth-submit { background: #2a6b57; } html.dark .auth-submit:hover { background: #327d66; }
.auth-submit[disabled] { opacity: .8; cursor: wait; }
.auth-back { align-self: center; color: var(--muted); font-size: 14px; text-decoration: none; }
.auth-back:hover { color: var(--text); }
.auth-back--btn { background: none; border: 0; cursor: pointer; padding: 0; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 24px 22px 28px; gap: 18px; }
  .auth-pitch h1 { font-size: 27px; }
  .auth-pitch p, .auth-points, .auth-legal { display: none; }
  .auth-panel { place-items: start center; padding: 32px 20px 48px; }
}
@media (prefers-reduced-motion: reduce) { .auth-form { animation: none; } }
.demo { border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px; background: var(--card); font-size: 14px; display: grid; gap: 4px; }
.demo__t { font-size: .6875rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ───────── Shell ───────── */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .25s var(--ease); }
.app.is-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.app.is-collapsed .side { visibility: hidden; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--rail); border-right: 1px solid var(--rail-line); padding: .75rem .625rem 0; display: flex; flex-direction: column; scrollbar-width: thin; }
.brandcard { display: flex; align-items: center; gap: .75rem; height: 3rem; padding: 0 .625rem; margin-bottom: .5rem; border-radius: 14px; background: var(--card); border: 1px solid rgba(229, 231, 235, .8); text-decoration: none; box-shadow: var(--shadow); flex: 0 0 auto; }
.brandcard__txt { display: grid; line-height: 16px; min-width: 0; }
.brandcard strong { font-size: 13px; font-weight: 600; color: var(--text); }
.brandcard small { font-size: 11px; color: var(--muted); }
.side__nav { display: grid; gap: 2px; padding-bottom: 1rem; }
.side__label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; padding: 1rem .625rem .25rem; }
.side__label:first-child { padding-top: .5rem; }
.nrow { display: flex; align-items: center; gap: .625rem; height: 2.25rem; padding: 0 .625rem; border-radius: 10px; font-size: 13px; font-weight: 500; color: #4b5563; text-decoration: none; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
html.dark .nrow { color: #b8bec8; }
.nrow .ic { color: var(--muted); }
.nrow:hover { background: #ececef; color: var(--text); }
html.dark .nrow:hover { background: #1d2025; }
.nrow.is-active .ic { color: var(--text); }
.nrow.is-active { background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--shadow-active); }
.nrow .chev { margin-left: auto; width: 14px; height: 14px; transition: transform .2s var(--ease); color: var(--faint); }
.nrow[aria-expanded="true"] .chev { transform: rotate(90deg); }
.nrow__count { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--track); color: var(--text-2); border-radius: 999px; padding: 0 .45rem; line-height: 1.4rem; }
.nkids { display: grid; gap: 2px; margin: 2px 0 2px 19px; padding: 0 0 .25rem .625rem; border-left: 1px solid rgba(229, 231, 235, .8); }
html.dark .nkids { border-left-color: var(--rail-line); }
.nkids .nrow { height: 2rem; font-size: 12.5px; }
.side__ver { margin: auto -.625rem 0; padding: .45rem .75rem; border-top: 1px solid var(--rail-line); font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: .4rem; position: sticky; bottom: 0; background: var(--rail); }
.side__ver b { color: var(--text); font-weight: 600; }
.side__mode { margin-left: auto; font-size: 10.5px; font-weight: 600; color: var(--amber); background: var(--amber-bg); border-radius: 999px; padding: 0 .45rem; cursor: help; }
.side__scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 39; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; height: 3.5rem; flex: 0 0 auto; display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem; background: var(--hdr);
  -webkit-backdrop-filter: blur(14px) saturate(180%); backdrop-filter: blur(14px) saturate(180%); border-bottom: 1px solid var(--hdr-line); }
.top__title { font-size: 1.125rem; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.top__right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.top .hbtn .ic { width: 20px; height: 20px; }
.app.is-focus { grid-template-columns: 0 minmax(0, 1fr); }
.app.is-focus .side { visibility: hidden; }
.hbtn[aria-pressed="true"] { background: var(--hover); color: var(--text); }
.me { display: flex; align-items: center; gap: .5rem; height: 2.25rem; padding: 0 .75rem 0 .25rem; border: 0; background: none; border-radius: 10px; cursor: pointer; color: var(--text-2); }
.me:hover { background: var(--hover); }
.me__av { width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--track); color: var(--muted); display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line); }
.me__av .ic { width: 14px; height: 14px; }
.me__name { font-size: .875rem; font-weight: 500; }
.pop-wrap { position: relative; }
.pop { position: absolute; right: 0; top: calc(100% + 6px); width: 320px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 16, 20, .12); z-index: 50; padding: .5rem; animation: rise .2s var(--ease) both; }
.pop--menu { width: 240px; }
.pop__head { display: flex; justify-content: space-between; align-items: center; padding: .4rem .5rem .6rem; font-weight: 600; font-size: .9375rem; }
.pop__who { padding: .5rem .6rem .7rem; border-bottom: 1px solid var(--line); margin-bottom: .35rem; display: grid; }
.pop__who span { color: var(--muted); font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; }
.pop a, .pop > button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem .6rem; border: 0; background: none; border-radius: 8px; text-decoration: none; font-size: .875rem; cursor: pointer; text-align: left; }
.pop a:hover, .pop > button:hover { background: var(--hover); }
.pop .ic { width: 16px; height: 16px; color: var(--muted); }
.note { display: flex; gap: .6rem; padding: .55rem .6rem; border-radius: 8px; cursor: pointer; }
.note:hover { background: var(--hover); }
.note__ic { width: 2rem; height: 2rem; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; }
.note strong { display: block; font-size: .875rem; font-weight: 500; }
.note span { font-size: .75rem; color: var(--muted); }
.pop__check { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: 8px; font-size: .875rem; cursor: pointer; }
.pop__check:hover { background: var(--hover); }
.pop__check input { width: 15px; height: 15px; accent-color: var(--primary); }
.ctip { position: fixed; z-index: 95; pointer-events: none; transform: translate(12px, -130%); background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: .35rem .6rem; font-size: .8125rem; font-weight: 500; white-space: nowrap; box-shadow: 0 12px 32px -12px rgba(16, 16, 20, .28), 0 2px 8px -2px rgba(16, 16, 20, .08); }
.view { padding: 1.5rem 1.5rem 6rem; outline: none; display: grid; gap: 1.5rem; align-content: start; animation: rise .3s var(--ease) both; }

/* ───────── Cards / common ───────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 1rem; min-width: 0; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.card__title { font-size: .875rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.card__sub { font-size: .75rem; color: var(--muted); }
.card__link { font-size: .8125rem; color: var(--muted); text-decoration: none; }
.card__link:hover { color: var(--text); }
.empty { color: var(--muted); font-size: .875rem; padding: .5rem 0; }
.empty-chart { height: 280px; display: grid; place-content: center; justify-items: center; gap: .35rem; text-align: center; color: var(--muted); }
.empty-chart .ic { width: 40px; height: 40px; color: #d1d5db; stroke-width: 1.5; }
.empty-chart strong { color: var(--text-2); font-weight: 500; font-size: .9375rem; }
.empty-chart span { font-size: .8125rem; }
.badge { display: inline-flex; align-items: center; font-size: .75rem; font-weight: 500; padding: .1rem .55rem; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.badge--confirmed { background: var(--blue-bg); color: var(--blue); }
.badge--checked_in { background: var(--emerald-bg); color: var(--emerald); }
.badge--checked_out { background: var(--track); color: var(--muted); }
.badge--cancelled { background: var(--red-bg); color: var(--red); }
.badge--no_show { background: var(--amber-bg); color: var(--amber); }
.av { flex: 0 0 2.25rem; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--track); color: var(--text-2); display: grid; place-items: center; font-weight: 600; font-size: .8125rem; }
.av--sm { flex-basis: 2rem; width: 2rem; height: 2rem; font-size: .75rem; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: .75rem; padding: .6rem .4rem; border-top: 1px solid var(--line-soft); cursor: pointer; border-radius: 8px; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--hover); }
.row__main { display: grid; min-width: 0; flex: 1; }
.row__main strong { font-size: .9375rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__main span { font-size: .8125rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__side { display: grid; justify-items: end; gap: .2rem; font-size: .8125rem; color: var(--muted); }

/* ───────── Dashboard ───────── */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.kpi-wrap { position: relative; display: flex; min-width: 0; animation: rise .4s var(--ease) both; }
.kpi-wrap:nth-child(2) { animation-delay: 40ms; } .kpi-wrap:nth-child(3) { animation-delay: 80ms; } .kpi-wrap:nth-child(4) { animation-delay: 120ms; }
.kpi { flex: 1; display: flex; flex-direction: column; justify-content: center; text-decoration: none; transition: border-color .15s, box-shadow .2s, transform .2s var(--ease); }
.kpi:hover { border-color: #d1d5db; transform: translateY(-2px); box-shadow: 0 6px 20px -8px rgba(16, 16, 20, .18), 0 2px 6px -2px rgba(16, 16, 20, .06); }
html.dark .kpi:hover { border-color: #4b5563; }
.kpi__top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.kpi__title { font-size: .75rem; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__chip { padding: .375rem; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; }
.kpi__chip .ic { width: 1.25rem; height: 1.25rem; }
.kpi__value { font-size: 1.5rem; line-height: 2rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__hint { font-size: 11px; color: var(--muted); margin-top: .125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid #d1d5db; background: var(--card); color: var(--muted); display: none; place-items: center; cursor: pointer; padding: 0; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.kpi__x .ic { width: 12px; height: 12px; }
.kpi-wrap:hover .kpi__x, .kpi__x:focus-visible { display: grid; }
.kpi__x:hover { background: var(--hover); color: var(--text); }
.t-blue { background: var(--blue-bg); color: var(--blue); } .t-emerald { background: var(--emerald-bg); color: var(--emerald); }
.t-amber { background: var(--amber-bg); color: var(--amber); } .t-violet { background: var(--violet-bg); color: var(--violet); }
.t-red { background: var(--red-bg); color: var(--red); } .t-cyan { background: var(--cyan-bg); color: var(--cyan); }
.t-green { background: var(--green-bg); color: var(--green); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
/* Breakdown cards (AOne "Sales by Stage" / "Leads by Source") */
.bkc { padding: 1.5rem; }
.bkc__title { display: flex; align-items: center; gap: .5rem; font-size: 1.125rem; font-weight: 600; margin-bottom: 1rem; }
.bkc__title > span:first-child { display: grid; }
.bkc__title .ic { width: 1.25rem; height: 1.25rem; }
.bkc__title .card__link { margin-left: auto; font-weight: 500; }
.bkc__empty { font-size: .875rem; color: var(--muted); text-align: center; padding: 1.5rem 0; }
.bkc__none { display: grid; justify-items: center; gap: .5rem; padding: 1.5rem 0; color: var(--muted); font-size: .875rem; }
.bkc__none .ic { width: 3rem; height: 3rem; color: #d1d5db; stroke-width: 1.5; }
html.dark .bkc__none .ic { color: #4b5563; }
.pill { font-size: .875rem; font-weight: 500; padding: .125rem .5rem; border-radius: 999px; background: var(--green-bg); color: var(--green); }
.bk { list-style: none; margin: 0; padding: 0; display: grid; gap: .625rem; }
.bk li { display: grid; grid-template-columns: 1fr auto; gap: .125rem .75rem; font-size: .875rem; }
.bk li > span:first-child { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk__v { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.bk__track { grid-column: 1 / -1; height: .375rem; border-radius: 999px; background: var(--track); overflow: hidden; }
.bk__track span { display: block; height: 100%; border-radius: 999px; background: var(--bar); animation: growx .8s var(--ease) both; transform-origin: left; }
@keyframes growx { from { transform: scaleX(0); } to { transform: none; } }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: -.5rem; }
.sec-head h2 { font-size: 1.125rem; font-weight: 600; }
.sec-head p { font-size: .75rem; color: var(--muted); margin-top: .125rem; }
.sec-head label { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: var(--text-2); }
.sel-wrap { position: relative; display: inline-flex; }
.sel-wrap .sel { appearance: none; -webkit-appearance: none; min-width: 11.25rem; height: 2.75rem; padding: 0 2.5rem 0 .875rem; border-radius: 10px; border-color: var(--line); font-size: .875rem; color: var(--text); cursor: pointer; box-shadow: 0 1px 2px rgba(16, 16, 20, .04); }
.sel-wrap .ic { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.chart { border-radius: 14px; padding: 1rem; }
.chart .card__title { font-size: .875rem; }
.chart .card__sub { margin-top: .125rem; }
.chart__box { height: 280px; position: relative; }
.chart svg { display: block; overflow: visible; }
.chart text { fill: #475569; font-size: 12px; font-family: inherit; }
html.dark .chart text { fill: #aeb5c2; }
.chart text.cat { fill: var(--text-2); }
.chart .grid { stroke: #e5e7eb; stroke-dasharray: 3 3; }
.chart .axis { stroke: #e2e8f0; }
html.dark .chart .grid, html.dark .chart .axis { stroke: #363c45; }
.chart [data-tip] { cursor: default; }
.chart path[fill="#8b5cf6"], .chart .hit + circle { transition: opacity .15s; }
.chart svg circle[data-tip]:hover { opacity: .85; }
.donut { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1.5rem; align-items: center; height: 280px; max-width: 520px; margin: 0 auto; }
.donut svg { width: 200px; height: 200px; }
.donut__c1 { font-size: 20px !important; font-weight: 700; fill: var(--text) !important; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; font-size: .8125rem; min-width: 0; }
.legend li { display: grid; grid-template-columns: 10px 1fr auto; gap: .5rem; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.legend b { font-weight: 600; font-variant-numeric: tabular-nums; }
.occ { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: .5rem; align-items: end; height: 280px; }
.occ__col { display: grid; justify-items: center; gap: .3rem; height: 100%; grid-template-rows: auto 1fr auto; }
.occ__val { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.occ__bar { width: 100%; max-width: 30px; background: var(--track); border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.occ__bar span { width: 100%; background: #2563eb; border-radius: 6px 6px 0 0; animation: grow .8s var(--ease) both; transform-origin: bottom; }
.occ__col.is-mid .occ__bar span { background: #10b981; } .occ__col.is-high .occ__bar span { background: #f59e0b; }
.occ__day { font-size: 11px; text-align: center; color: var(--muted); line-height: 1.3; }
@keyframes grow { from { transform: scaleY(0); } to { transform: none; } }

/* ───────── Calendar ───────── */
.cal-bar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.cal-bar__nav { display: flex; align-items: center; gap: .25rem; }
.cal-bar__title { font-size: 1.25rem; font-weight: 600; margin-right: auto; }
.seg { display: inline-flex; background: var(--track); border-radius: 8px; padding: 3px; }
.seg button { border: 0; background: none; height: 2rem; padding: 0 .8rem; border-radius: 6px; font-weight: 500; font-size: .875rem; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow-active); }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.month { padding: 0; overflow: hidden; }
.month__dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); font-size: .75rem; color: var(--muted); font-weight: 500; }
.month__dow span { padding: .5rem .6rem; }
.month__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mc { min-height: 112px; padding: .45rem; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); cursor: pointer; display: flex; flex-direction: column; gap: .25rem; min-width: 0; transition: background-color .15s; }
.mc:nth-child(7n) { border-right: 0; }
.mc:hover { background: var(--hover); }
.mc--blank { background: var(--bg); cursor: default; }
.mc.is-past .mc__n { color: var(--faint); }
.mc.is-sel { box-shadow: inset 0 0 0 2px var(--focus); }
.mc__top { display: flex; justify-content: space-between; align-items: center; gap: .25rem; }
.mc__n { font-weight: 600; font-size: .875rem; min-width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 999px; }
.mc.is-today .mc__n { background: var(--primary); color: var(--primary-fg); }
.mc__occ { font-size: 11px; padding: 0 .4rem; border-radius: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lv-0 { background: var(--track); color: var(--muted); } .lv-1 { background: var(--blue-bg); color: var(--blue); } .lv-2 { background: var(--emerald-bg); color: var(--emerald); }
.lv-3 { background: var(--amber-bg); color: var(--amber); } .lv-4 { background: var(--red-bg); color: var(--red); }
.mc__chips { display: grid; gap: 3px; min-width: 0; }
.chip { display: block; width: 100%; text-align: left; border: 0; border-radius: 5px; padding: 1px 6px; font-size: .75rem; font-weight: 500; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--blue-bg); color: var(--blue); }
.chip--checked_in { background: var(--emerald-bg); color: var(--emerald); }
.mc__more, .mc__dep { font-size: .6875rem; color: var(--muted); }
.mc__dep { margin-top: auto; }
.tl-wrap { overflow-x: auto; padding: 0; }
.tl-table { border-collapse: collapse; width: 100%; min-width: 820px; }
.tl-table th, .tl-table td { padding: .4rem; border-bottom: 1px solid var(--line-soft); text-align: center; }
.tl-table thead th { font-weight: 600; font-size: .9375rem; line-height: 1.2; }
.tl-table thead th small { display: block; font-size: .6875rem; font-weight: 500; color: var(--muted); }
.tl-table thead th.is-we { background: var(--bg); }
.tl-table thead th.is-today { color: var(--blue); }
.tl-table tbody th { text-align: left; font-weight: 500; font-size: .875rem; white-space: nowrap; padding-left: 1rem; }
.tl-table tbody th small { display: block; font-size: .75rem; color: var(--muted); font-weight: 400; }
.tl { width: 100%; min-width: 42px; height: 2.4rem; border: 0; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: .875rem; font-variant-numeric: tabular-nums; }
.tl small { font-weight: 400; opacity: .7; }
.tl.is-sel { outline: 2px solid var(--focus); outline-offset: 1px; }
.dayp { position: sticky; top: 4.5rem; }
.dayp h4 { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1rem 0 .25rem; }
.dayp__sum { font-size: .8125rem; color: var(--muted); margin-top: -.4rem; }

/* ───────── Bookings list ───────── */
.filters { display: grid; gap: .75rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.fchip { display: inline-flex; align-items: center; gap: .35rem; height: 2rem; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 0 .75rem; font-weight: 500; font-size: .8125rem; cursor: pointer; color: var(--text-2); }
.fchip b { font-weight: 600; color: var(--muted); font-size: .75rem; }
.fchip.is-on { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.fchip.is-on b { color: inherit; opacity: .7; }
.filters__row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.search { position: relative; flex: 1 1 260px; max-width: 360px; }
.search .ic { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.search input { width: 100%; height: 2.25rem; padding: 0 .75rem 0 2.2rem; border: 1px solid var(--line); border-radius: 8px; background: var(--input); font-size: .875rem; }
.search input:focus { outline: none; border-color: var(--focus); }
.filters__row .spacer { flex: 1; }
.count { font-size: .8125rem; color: var(--muted); margin-bottom: -.75rem; }
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 500; padding: .7rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg); }
.sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.sort.is-on { color: var(--text); font-weight: 600; }
.table td { padding: .65rem .8rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background-color .12s; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.who { display: flex; align-items: center; gap: .6rem; }
.pager__btns { display: flex; gap: .4rem; }
.table strong { display: block; font-weight: 500; white-space: nowrap; }
.sub { display: block; font-size: .75rem; color: var(--muted); }
.code { font-family: ui-monospace, Menlo, monospace; font-size: .8125rem; }
.nowrap { white-space: nowrap; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: .75rem; font-size: .8125rem; color: var(--muted); }

/* ───────── Drawer ───────── */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer__scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); animation: fade .2s both; }
.drawer__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: var(--card); border-left: 1px solid var(--line); overflow-y: auto; padding: 1.25rem 1.5rem 2rem; outline: none;
  box-shadow: -20px 0 50px rgba(0, 0, 0, .12); animation: slide .3s var(--ease) both; }
@keyframes slide { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dr__head { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.dr__code { font-size: .8125rem; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.dr__head h2 { font-size: 1.5rem; font-weight: 600; margin: .15rem 0 .5rem; }
.dr__src { font-size: .8125rem; color: var(--muted); margin-left: .4rem; }
.dr__contact, .dr__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.dr__actions { padding: .75rem; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.dr__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; margin: 1rem 0 0; }
.dr__grid div { padding: .6rem 0; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.dr__grid .wide { grid-column: 1 / -1; }
.dr__grid dt { font-size: .75rem; color: var(--muted); }
.dr__grid dd { margin: .1rem 0 0; font-weight: 500; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }
.dr__bill { margin-top: 1.25rem; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .85rem 1rem; font-size: .875rem; }
.dr__bill h3 { font-size: .875rem; font-weight: 600; margin-bottom: .5rem; }
.dr__bill p { display: flex; justify-content: space-between; gap: .6rem; padding: .15rem 0; font-variant-numeric: tabular-nums; }
.dr__bill p span:first-child { color: var(--muted); }
.dr__bill .is-total { border-top: 1px solid var(--line); margin-top: .4rem; padding-top: .5rem; font-weight: 700; font-size: 1rem; }
.dr__bill .is-total span:first-child { color: var(--text); }
.dr__notes { margin-top: 1.25rem; display: grid; gap: .5rem; justify-items: start; }
.dr__notes .fld { width: 100%; }
.dr__log { margin-top: 1.25rem; font-size: .75rem; color: var(--muted); display: grid; gap: .2rem; }

/* ───────── Modals / toast ───────── */
.modal { border: 1px solid var(--line); padding: 0; border-radius: 14px; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--card); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
.modal[open] { animation: rise .25s var(--ease) both; }
.modal::backdrop { background: rgba(0, 0, 0, .4); }
.modal--sm { width: min(420px, calc(100vw - 24px)); }
.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal__head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal__head h2, .modal--sm h2 { font-size: 1.125rem; font-weight: 600; }
.modal__body { padding: 1.1rem 1.25rem; overflow-y: auto; display: grid; gap: .9rem; }
.modal__foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .85rem 1.25rem; border-top: 1px solid var(--line); background: var(--bg); border-radius: 0 0 14px 14px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem .9rem; }
.quote { background: var(--emerald-bg); color: var(--emerald); border-radius: 8px; padding: .6rem .8rem; font-size: .875rem; font-weight: 500; }
.quote.is-bad { background: var(--red-bg); color: var(--red); }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 90; background: #111827; color: #fff; padding: .7rem 1rem; border-radius: 10px; font-weight: 500; font-size: .9375rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: rise .25s var(--ease) both; max-width: calc(100vw - 32px); }
.toast--bad { background: var(--danger); }

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

/* ───────── Responsive ───────── */
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1024px) {
  .app, .app.is-collapsed { grid-template-columns: minmax(0, 1fr); }
  .app.is-collapsed .side { visibility: visible; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 17rem; z-index: 40; transform: translateX(-100%); transition: transform .25s var(--ease); }
  .side.is-open { transform: none; }
  .grid-2, .cal-layout { grid-template-columns: 1fr; }
  .dayp { position: static; }
}
@media (max-width: 640px) {
  .view { padding: 1rem; gap: 1rem; }
  .top { padding: 0 .75rem 0 .5rem; }
  .me__name, #refreshBtn, #focusBtn { display: none; }
  .top__right { gap: .25rem; }
  .me { padding-right: .25rem; }
  .kpis { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .kpi__value { font-size: 1.3rem; }
  .donut { grid-template-columns: 1fr; height: auto; justify-items: center; gap: 1rem; }
  .donut svg { width: 170px; height: 170px; }
  .bkc { padding: 1rem; }
  .occ { gap: 2px; }
  .occ__val { font-size: 9px; }
  .mc { min-height: 56px; padding: .25rem; }
  .mc__chips, .mc__dep, .mc__more { display: none; }
  .mc__top { flex-direction: column; align-items: flex-start; }
  .mc__occ { font-size: 10px; padding: 0 .25rem; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: .75rem .9rem; border-bottom: 1px solid var(--line); }
  .table td { border: 0; padding: .15rem 0; display: flex; justify-content: space-between; gap: .75rem; }
  .table td::before { content: attr(data-label); font-size: .75rem; color: var(--muted); }
  .table td:first-child::before { content: none; }
  .table td:first-child { padding-bottom: .5rem; }
  .grid2, .dr__grid { grid-template-columns: 1fr; }
  .drawer__panel { padding: 1rem 1rem 1.5rem; }
  .pop { width: min(320px, calc(100vw - 24px)); right: -60px; }
}
html.dark .brandcard { border-color: var(--line); }
html.dark .logo-box { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }

/* ───────── Module screens (crm/js/modules/*, crm/js/lib/*) — the guide's shared list / form / record UI ───────── */
.view--mod { gap: 1rem; }
.sumtiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: .75rem; }
.stile { display: grid; gap: .125rem; padding: .75rem 1rem; }
.stile > span { font-size: .6875rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: .35rem; }
.stile > span .ic { width: 14px; height: 14px; }
.stile b { font-size: 1.375rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stile small { font-size: 11px; color: var(--muted); }
.stile--wide { max-width: 22rem; background: var(--green-bg); border-color: transparent; }
.t-ok { color: var(--emerald); } .t-warn { color: var(--amber); }
.catchips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .35rem; }

/* list screen */
.lv { display: grid; gap: .6rem; }
.lv[data-collapsed] { display: none; }
.lv__filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .75rem; }
.lv__filters .sel-wrap .sel { min-width: 9.5rem; height: 2.5rem; }
.lv__bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.lv__bar .spacer, .rec__bar .spacer, .neditor__bar .spacer { flex: 1; }
.chiprow { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.chiprow__l { font-size: .8125rem; color: var(--muted); margin-right: .15rem; }
.colchip, .tchip { border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 999px; font-size: .75rem; font-weight: 500; padding: .15rem .6rem; cursor: pointer; }
.colchip.is-on { background: var(--track); color: var(--text); border-color: transparent; }
.tchip.is-on { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.hbtn--box { border: 1px solid var(--line); background: var(--card); }
.hbtn--box.is-on { color: var(--text); background: var(--track); }
.hbtn--sm { width: 1.875rem; height: 1.875rem; }
.hbtn--sm .ic { width: 16px; height: 16px; }
.hbtn[disabled] { opacity: .35; cursor: not-allowed; }
.seg--views button { display: inline-flex; align-items: center; gap: .3rem; }
.seg--views .ic { width: 14px; height: 14px; }
.seg--tabs { flex-wrap: wrap; }
.cnt { display: inline-block; min-width: 1.2rem; padding: 0 .3rem; border-radius: 999px; background: var(--primary); color: var(--primary-fg); font-size: 11px; line-height: 1.2rem; text-align: center; }
.groupby { display: flex; align-items: center; gap: .4rem; font-size: .8125rem; color: var(--muted); }
.table--list td, .table--list th { white-space: nowrap; }
.table--list td .clip, .clip { display: inline-block; max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.table .ck { width: 2.25rem; padding-right: 0; }
.table .act { width: 1%; text-align: right; white-space: nowrap; }
.table tr.is-sel td { background: var(--blue-bg); }
.sort__i { opacity: .35; font-size: .7rem; }
.rowlink { color: inherit; text-decoration: none; }
.rowlink:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.table.mini { font-size: .8125rem; }
.table.mini td, .table.mini th { padding: .45rem .6rem; }
.center { text-align: center; } .right { text-align: right; } .pad { padding: .75rem 1rem 0; } .small { font-size: .75rem; }
.is-late { color: var(--red); font-weight: 600; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: .8125rem; }
.pager { padding: .25rem .25rem 0; }
.pager__btns { align-items: center; }
.pager__n { min-width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 8px; background: var(--primary); color: var(--primary-fg); font-weight: 600; }
.rows { display: flex; align-items: center; gap: .4rem; margin-left: .5rem; }
.rows .sel { min-width: 5rem; }
.pill-s { display: inline-flex; align-items: center; font-size: .75rem; font-weight: 500; padding: .1rem .55rem; border-radius: 999px; white-space: nowrap; background: var(--track); color: var(--text-2); }
.pill-s--green { background: var(--emerald-bg); color: var(--emerald); } .pill-s--blue { background: var(--blue-bg); color: var(--blue); }
.pill-s--amber { background: var(--amber-bg); color: var(--amber); } .pill-s--red { background: var(--red-bg); color: var(--red); }
.rec__badges { display: flex; gap: .35rem; flex-wrap: wrap; }
.tagrow { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.tag { display: inline-flex; font-size: .6875rem; font-weight: 500; padding: .05rem .5rem; border-radius: 6px; background: var(--track); color: var(--text-2); white-space: nowrap; }

/* cards (grid / list views) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; }
.cards--list { grid-template-columns: 1fr; }
.rcard { display: grid; gap: .4rem; cursor: pointer; transition: border-color .15s, box-shadow .2s; align-content: start; }
.rcard:hover { border-color: #d1d5db; box-shadow: 0 6px 20px -8px rgba(16, 16, 20, .18); }
.rcard.is-sel { border-color: var(--blue); }
.rcard__top { display: flex; justify-content: space-between; align-items: center; margin: -.25rem -.25rem 0; }
.rc { display: flex; gap: .6rem; align-items: center; min-width: 0; }
.rc__main { display: grid; min-width: 0; }
.rc__main strong, .rc__t { font-weight: 600; font-size: .9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc__main span { font-size: .8125rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc__row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; justify-content: space-between; font-size: .8125rem; }
.rc__id { font-size: .75rem; color: var(--muted); display: flex; align-items: center; gap: .3rem; }
.rc__id .ic { width: 13px; height: 13px; }

/* kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(15rem, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; align-items: start; }
.lane { background: var(--track); border-radius: 12px; padding: .5rem; min-height: 14rem; display: grid; gap: .5rem; align-content: start; transition: box-shadow .15s; }
.lane.is-over { box-shadow: inset 0 0 0 2px var(--blue); }
.lane__head { display: flex; align-items: baseline; gap: .4rem; padding: .25rem .35rem; font-weight: 600; font-size: .875rem; }
.lane__head b { font-weight: 500; color: var(--muted); font-size: .75rem; }
.lane__head small { margin-left: auto; color: var(--muted); font-size: .75rem; font-weight: 500; }
.lane__body { display: grid; gap: .5rem; }
.lane__empty { border: 1px dashed var(--line); border-radius: 8px; padding: .75rem; text-align: center; font-size: .75rem; color: var(--faint); }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; display: grid; gap: .3rem; cursor: grab; box-shadow: var(--shadow); }
.kcard.is-drag { opacity: .5; }
.kcard__foot { display: flex; justify-content: flex-end; margin: -.2rem -.3rem -.3rem; }

.empty-state { display: grid; justify-items: center; gap: .5rem; padding: 3rem 1rem; text-align: center; color: var(--muted); font-size: .875rem; }
.empty-state > .ic { width: 2.5rem; height: 2.5rem; color: #d1d5db; stroke-width: 1.5; }
html.dark .empty-state > .ic { color: #4b5563; }
.empty-state strong { color: var(--text); font-weight: 600; font-size: .9375rem; }

/* ⋮ row menu */
.rowmenu { position: fixed; z-index: 70; min-width: 12.5rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px -12px rgba(16, 16, 20, .28), 0 2px 8px -2px rgba(16, 16, 20, .08); padding: .35rem; animation: rise .15s var(--ease) both; }
.rowmenu button { display: flex; align-items: center; gap: .55rem; width: 100%; border: 0; background: none; padding: .5rem .6rem; border-radius: 8px; font-size: .875rem; cursor: pointer; text-align: left; color: var(--text); }
.rowmenu button:hover { background: var(--hover); }
.rowmenu .ic { width: 15px; height: 15px; color: var(--muted); }
.rowmenu .is-danger { color: var(--red); border-top: 1px solid var(--line-soft); border-radius: 0 0 8px 8px; margin-top: .25rem; }
.rowmenu .is-danger .ic { color: var(--red); }

/* forms + dialogs */
.modal__wrap { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal--wide { width: min(760px, calc(100vw - 24px)); }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem .9rem; }
.fsec { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-top: .4rem; padding-top: .6rem; border-top: 1px solid var(--line-soft); }
.req { color: var(--red); font-weight: 600; }
.fld__help { font-size: .75rem; color: var(--muted); }
.fld input[readonly] { background: var(--track); color: var(--muted); }
.sel-wrap--fld { display: flex; }
.sel-wrap--fld select { width: 100%; height: 2.5rem; padding: 0 2.25rem 0 .75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--input); font-size: .9375rem; appearance: none; -webkit-appearance: none; }
.sel-wrap--fld select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.tagpick { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.tagopt { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: .2rem .7rem; font-size: .8125rem; cursor: pointer; color: var(--text-2); }
.tagopt.is-on { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.tagnew { border: 1px dashed var(--line); border-radius: 999px; padding: .2rem .7rem; font-size: .8125rem; width: 7rem; background: transparent; }
.info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; margin: 0; }
.info div { padding: .55rem 0; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.info .wide { grid-column: 1 / -1; }
.info dt { font-size: .6875rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.info dd { margin: .15rem 0 0; font-weight: 500; overflow-wrap: anywhere; }
.info--page { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.drop { display: flex; align-items: center; gap: .6rem; justify-content: center; border: 1px dashed var(--line); border-radius: 10px; padding: 1.25rem; cursor: pointer; color: var(--muted); }
.imp__row { font-size: .8125rem; padding: .2rem 0; } .imp__row.is-bad { color: var(--red); }

/* record page */
.rec { display: grid; gap: 1rem; max-width: 64rem; width: 100%; margin: 0 auto; }
.rec__bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.rec__main { display: grid; gap: .75rem; }
.rec__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.rec__head h2 { font-size: 1.375rem; font-weight: 600; letter-spacing: -.01em; }
.rec__sub { font-size: .8125rem; color: var(--muted); }
.rec__meta { font-size: .75rem; color: var(--muted); }
.rec__note { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .75rem; background: var(--input); resize: vertical; margin-bottom: .5rem; }
.notes { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .5rem; }
.notes li { background: var(--bg); border: 1px solid var(--line-soft); border-radius: 8px; padding: .6rem .75rem; }
.notes p { white-space: pre-wrap; }
.notes small, .alog small { color: var(--muted); font-size: .75rem; }
.alog { list-style: none; margin: 0; padding: 0; display: grid; }
.alog li { display: grid; grid-template-columns: .75rem 1fr; gap: .6rem; padding: .5rem 0; border-top: 1px solid var(--line-soft); }
.alog li:first-child { border-top: 0; }
.alog__dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--emerald); margin-top: .45rem; }
.alog__d { font-size: .75rem; color: var(--muted); } .alog__d s { opacity: .7; }
.subtasks { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .25rem; }
.subtasks li { display: flex; justify-content: space-between; align-items: center; }
.subtasks .done { text-decoration: line-through; color: var(--muted); }
.inline-add { display: flex; gap: .5rem; }
.inline-add input { flex: 1; height: 2.125rem; border: 1px solid var(--line); border-radius: 8px; padding: 0 .7rem; background: var(--input); }
.card__head.pad { padding: .75rem 1rem; margin: 0; }
.sec-title { font-size: 1.125rem; font-weight: 600; }
.dfield { display: flex; align-items: center; gap: .4rem; font-size: .8125rem; color: var(--muted); }
.dfield .sel { height: 2.5rem; }
.sel--num { width: 5.5rem; }

/* notes */
.notesapp { display: grid; grid-template-columns: 17rem minmax(0, 1fr); padding: 0; min-height: calc(100vh - 9rem); overflow: hidden; }
.ntree { border-right: 1px solid var(--line); padding: .75rem .5rem; overflow-y: auto; background: var(--bg); }
.ntree__top { display: flex; gap: .4rem; margin-bottom: .5rem; }
.ntree__top .search { flex: 1; max-width: none; }
.ntree ul { list-style: none; margin: 0; padding: 0; }
.ntree__h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; padding: .75rem .5rem .25rem; }
.ntree__i { display: flex; gap: .45rem; align-items: center; padding: .35rem .5rem; border-radius: 8px; text-decoration: none; font-size: .8125rem; color: var(--text-2); }
.ntree__i:hover { background: var(--hover); }
.ntree__i.is-on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--shadow-active); }
.ntree__t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ntree__i small { font-size: 10px; color: var(--faint); }
.neditor { padding: 1rem 1.5rem; display: flex; flex-direction: column; gap: .75rem; min-width: 0; }
.neditor__bar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .8125rem; }
.neditor__title { display: flex; align-items: center; gap: .5rem; }
.neditor__title input { flex: 1; font-size: 1.75rem; font-weight: 700; border: 0; background: none; outline: none; letter-spacing: -.01em; min-width: 0; }
.nicon { font-size: 1.5rem; border: 0; background: none; cursor: pointer; border-radius: 8px; padding: .15rem .3rem; }
.nicon:hover { background: var(--hover); }
.neditor textarea { flex: 1; min-height: 22rem; border: 0; outline: none; resize: none; background: none; font: inherit; font-size: .9375rem; line-height: 1.7; }
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.hist li { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; border-bottom: 1px solid var(--line-soft); padding-bottom: .5rem; }

/* billing */
.inved { display: grid; gap: 1rem; max-width: 64rem; margin: 0 auto; width: 100%; }
.lines input, .lines select { width: 100%; height: 2.125rem; border: 1px solid var(--line); border-radius: 6px; padding: 0 .5rem; background: var(--input); font-size: .8125rem; }
.lines td { vertical-align: top; }
.lines td:nth-child(n+2):nth-child(-n+5) { width: 6.5rem; }
.lines .sub-in { margin-top: .3rem; height: 1.875rem; color: var(--muted); }
.totals { display: grid; justify-content: end; gap: .25rem; margin-top: .75rem; font-size: .875rem; }
.totals p { display: flex; justify-content: space-between; gap: 3rem; min-width: 16rem; font-variant-numeric: tabular-nums; }
.totals p span { color: var(--muted); }
.totals .is-total { border-top: 1px solid var(--line); padding-top: .35rem; font-size: 1rem; }
.totals .is-total span { color: var(--text); font-weight: 600; }
.invdoc { max-width: 52rem; width: 100%; margin: 0 auto; padding: 2rem; display: grid; gap: 1.25rem; }
.invdoc__head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.invdoc__brand { display: flex; gap: .75rem; align-items: center; }
.invdoc__brand strong { display: block; font-size: 1.125rem; }
.invdoc__brand small { color: var(--muted); font-size: .75rem; line-height: 1.4; }
.invdoc__title { text-align: right; display: grid; justify-items: end; gap: .2rem; }
.invdoc__title h2 { font-size: 1.5rem; letter-spacing: .08em; }
.invdoc__meta { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .875rem; }
.invdoc__meta dl { display: grid; grid-template-columns: auto auto; gap: .2rem 1rem; margin: 0; }
.invdoc__meta dl div { display: contents; } .invdoc__meta dt { color: var(--muted); } .invdoc__meta dd { margin: 0; text-align: right; }
.invdoc__lines th { background: var(--bg); }
.invdoc__note { font-size: .8125rem; display: grid; gap: .2rem; }
.totals--doc { margin-top: 0; }
.slips { display: grid; gap: 1rem; }
.slip { border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.25rem; display: grid; gap: .75rem; break-inside: avoid; }
.slip header { display: flex; justify-content: space-between; align-items: center; }
.slip .is-total td { border-top: 1px solid var(--line); }

/* admin */
.nlist { list-style: none; margin: 0; padding: 0; }
.nlist li { display: flex; gap: .75rem; align-items: center; padding: .7rem .5rem; border-top: 1px solid var(--line-soft); }
.nlist li:first-child { border-top: 0; }
.nlist li.is-unread { background: var(--blue-bg); border-radius: 8px; }
.nlist a { flex: 1; display: grid; text-decoration: none; min-width: 0; }
.nlist a strong { font-size: .875rem; font-weight: 600; } .nlist a span { font-size: .8125rem; color: var(--text-2); } .nlist a small { font-size: .75rem; color: var(--muted); }
.pop__all { display: block; text-align: center; font-size: .8125rem; font-weight: 500; padding: .55rem; border-top: 1px solid var(--line); margin-top: .35rem; }
.narrow { max-width: 40rem; width: 100%; margin: 0 auto; display: grid; gap: 1rem; }
.narrow--wide { max-width: 56rem; }
.prof__head { display: grid; justify-items: center; gap: .25rem; }
.av--xl { width: 4.5rem; height: 4.5rem; flex-basis: 4.5rem; font-size: 1.5rem; background: var(--primary); color: var(--primary-fg); }
.masters { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.masters__nav { display: grid; gap: 2px; padding: .5rem; position: sticky; top: 4.5rem; }
.masters section { display: grid; gap: .75rem; }
.nrow.is-parent { color: var(--text); font-weight: 600; }
.nkids .nrow .ic { width: 16px; height: 16px; }

@media print {
  .side, .top, .noprint, .toast, .rowmenu, .side__scrim { display: none !important; }
  .app { display: block; } .view { padding: 0; }
  .card { box-shadow: none; border: 0; }
  body.print-dialog .app { display: none; }
  body.print-dialog dialog[open] { position: static; border: 0; box-shadow: none; max-height: none; width: 100%; }
  body.print-dialog .modal__head, body.print-dialog .modal__foot { display: none; }
}
@media (max-width: 1024px) {
  .info--page { grid-template-columns: 1fr 1fr; }
  .masters { grid-template-columns: 1fr; } .masters__nav { position: static; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
  .notesapp { grid-template-columns: 1fr; } .ntree { border-right: 0; border-bottom: 1px solid var(--line); max-height: 16rem; }
}
@media (max-width: 640px) {
  .fgrid, .info, .info--page { grid-template-columns: 1fr; }
  .fgrid > .fld, .fgrid > .fsec { grid-column: auto; }
  .lv__filters .sel-wrap, .lv__filters .sel-wrap .sel { width: 100%; }
  .lv__bar .search { flex-basis: 100%; max-width: none; }
  .seg--views button { padding: 0 .5rem; font-size: 0; gap: 0; } .seg--views .ic { width: 16px; height: 16px; }
  .table--list thead { display: none; }
  .table--list, .table--list tbody, .table--list tr, .table--list td { display: block; white-space: normal; }
  .table--list tr { padding: .75rem .9rem; border-bottom: 1px solid var(--line); position: relative; }
  .table--list td { border: 0; padding: .15rem 0; display: flex; justify-content: space-between; gap: .75rem; }
  .table--list td::before { content: attr(data-label); font-size: .75rem; color: var(--muted); }
  .table--list td.ck { display: none; }
  .table--list td.act { position: absolute; top: .45rem; right: .4rem; }
  .table--list td.act::before { content: none; }
  .table--list td:nth-child(2) { padding-right: 2.5rem; }
  .invdoc { padding: 1rem; } .invdoc__head { flex-direction: column; } .invdoc__title { text-align: left; justify-items: start; }
  .rec__head { flex-direction: column; }
  .pager { flex-wrap: wrap; }
  .totals p { min-width: 0; gap: 1.5rem; }
}
.table--list .tagrow { flex-wrap: nowrap; }
