/* Nexograd Salon POS – Owner Panel */
:root {
    color-scheme: light;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --page: #f6f5f3;
    --surface: #fcfcfb;
    --surface-2: #f0efec;
    --surface-3: #e7e5e0;
    --ink: #0b0b0b;
    --ink-2: #52514e;
    --muted: #7a7873;
    --line: #e1e0d9;
    --axis: #c3c2b7;
    --border: rgba(11, 11, 11, 0.1);
    --brand: #a3195b;
    --brand-ink: #ffffff;
    --brand-soft: #f9e8f0;
    --side: #1d1630;
    --side-ink: #d9d3e6;
    --side-active: #2f2547;
    --good: #006300;
    --good-bg: #e3f3e3;
    --bad: #b42323;
    --bad-bg: #fbe7e7;
    --warn: #8a5a00;
    --warn-bg: #fdf1d6;
    --info: #1c5cab;
    --info-bg: #e3eefb;
    /* chart series (validated reference palette, light) */
    --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
    --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
    --s-prev: #b5b3ac;
    --seq-100: #cde2fb; --seq-200: #9ec5f4; --seq-300: #6da7ec; --seq-400: #3987e5;
    --seq-500: #256abf; --seq-600: #184f95; --seq-700: #0d366b;
    --r: 12px;
    --shadow: 0 1px 2px rgba(20, 14, 40, 0.05), 0 4px 16px rgba(20, 14, 40, 0.04);
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --page: #0f0f0e;
    --surface: #1a1a19;
    --surface-2: #242422;
    --surface-3: #2e2e2b;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #8f8d86;
    --line: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --brand: #e0559a;
    --brand-ink: #1a0b12;
    --brand-soft: #3a1a2a;
    --side: #141020;
    --side-active: #2a2140;
    --good: #0ca30c; --good-bg: #10301a;
    --bad: #ff7676; --bad-bg: #3a1717;
    --warn: #fab219; --warn-bg: #3a2c0e;
    --info: #86b6ef; --info-bg: #142640;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --s8: #e66767;
    --s-prev: #5a5955;
    --seq-100: #104281; --seq-200: #184f95; --seq-300: #1c5cab; --seq-400: #2a78d6;
    --seq-500: #5598e7; --seq-600: #86b6ef; --seq-700: #b7d3f6;
    --shadow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--page); color: var(--ink); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
a { color: var(--brand); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.neg { color: var(--bad); }
.pos { color: var(--good); }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.num, td.r { font-variant-numeric: tabular-nums; }

/* ───────── buttons & inputs ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 9px; padding: 8px 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand); padding-left: 6px; padding-right: 6px; }
.btn.link { border: 0; background: none; color: var(--brand); font-weight: 500; padding: 6px 0; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.sm .ic { width: 15px; height: 15px; }
.btn.block { width: 100%; padding: 11px; }
.btn.wa { background: #e8f8ee; color: #0b6b33; border-color: #bfe8cf; }
:root[data-theme="dark"] .btn.wa { background: #10301d; color: #6fd99a; border-color: #1d5233; }
.btn.wa.done { opacity: 0.55; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.sel { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--ink); cursor: pointer; max-width: 240px; }
.sel span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel.static { cursor: default; }
select.sel { padding-right: 28px; }
input, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible, tr.click:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
label { display: grid; gap: 5px; font-weight: 600; font-size: 13px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { font: inherit; font-weight: 600; font-size: 13px; border: 0; background: transparent; color: var(--ink-2); padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

/* ───────── login ───────── */
.login-page { background: radial-gradient(1200px 600px at 10% -10%, #3b2363 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #6b1240 0%, transparent 55%), #17112a; }
.login { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 18px; padding: 24px; }
.login-card { width: min(420px, 100%); background: var(--surface); border-radius: 18px; padding: 30px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); display: grid; gap: 14px; }
.login-card h1 { font-size: 24px; margin-top: 6px; }
.login-card form { display: grid; gap: 14px; }
.login-foot { color: #cfc6e2; text-align: center; max-width: 420px; margin: 0; }
.form-err { color: var(--bad); font-weight: 600; min-height: 1em; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { display: block; font-size: 15px; }
.brand span { display: block; font-size: 12px; opacity: 0.7; }
.brand-ic { width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--brand); color: #fff; stroke-width: 2.2; }
.brand.big .brand-ic { width: 42px; height: 42px; padding: 9px; }
.boot { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--muted); }
.spin { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── shell ───────── */
#app { display: flex; min-height: 100vh; }
.side { width: 232px; flex: none; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; align-self: flex-start; }
#app { background: linear-gradient(90deg, var(--side) 232px, transparent 232px); }
.side .brand { color: #fff; padding: 0 6px 18px; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--side-ink); text-decoration: none; font-weight: 600; position: relative; }
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav a.on { background: var(--side-active); color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #f06aa8; }
.side-foot { margin-top: auto; display: grid; gap: 10px; border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 14px; }
.me { display: flex; gap: 10px; align-items: center; min-width: 0; }
.me b, .me span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.me b { color: #fff; font-size: 13px; }
.me span { font-size: 12px; opacity: 0.7; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #5b3d8c; color: #fff; font-weight: 700; flex: none; }
.avatar.big { width: 52px; height: 52px; font-size: 20px; }
.side-btns { display: flex; gap: 4px; }
.side .icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 26px; background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top-title { display: flex; align-items: baseline; gap: 10px; flex: 1; min-width: 180px; }
.top-title h1 { font-size: 21px; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.menu-btn { display: none; }
.dd { position: relative; }
.dd.dim .sel { opacity: 0.5; }
.dd-menu[hidden] { display: none; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16); padding: 6px; min-width: 230px; z-index: 40; display: grid; }
.dd-item { display: flex; align-items: center; gap: 8px; font: inherit; font-weight: 500; text-align: left; border: 0; background: transparent; color: var(--ink); padding: 8px 10px; border-radius: 8px; cursor: pointer; grid-template-columns: none; }
.dd-item:hover { background: var(--surface-2); }
.dd-item .chk { visibility: hidden; width: 16px; height: 16px; stroke-width: 2.6; }
.dd-item.on { font-weight: 700; }
.dd-item.on .chk { visibility: visible; }
.dd-item input { margin: 0; accent-color: var(--brand); }
.dd-custom { border-top: 1px solid var(--line); margin-top: 6px; padding: 10px 6px 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dd-custom button { grid-column: span 2; }
.dd-custom input { padding: 6px 8px; }
.page { padding: 22px 26px 60px; display: grid; gap: 18px; align-content: start; transition: opacity 0.15s; outline: none; }
.page.loading, .loading { opacity: 0.55; pointer-events: none; }

/* ───────── cards & grid ───────── */
.card, .card-like:not(:empty) { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 0; flex-wrap: wrap; }
.card-h h3 { font-size: 15px; }
.card-sub { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-b { padding: 14px 18px 18px; min-width: 0; }
section.card > .toolbar { padding: 16px 18px 0; }
section.card > #seg-text, section.card > #list, section.card > .pager { padding-left: 18px; padding-right: 18px; }
section.card > #list { padding-bottom: 4px; }
.grid { display: grid; gap: 18px; min-width: 0; }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.g-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-1-1-1 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.tight { gap: 14px; }
.sec-h { font-size: 16px; margin-top: 4px; }
.mini-h { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 16px 0 8px; display: flex; align-items: center; gap: 6px; }
.mini-h:first-child { margin-top: 0; }
.mini-h .ic { width: 14px; height: 14px; }

/* ───────── KPI ───────── */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; display: grid; gap: 4px; align-content: start; }
.kpi.warn { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.kpi-top { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 600; font-size: 13px; }
.kpi-value { font-size: 24px; font-weight: 750; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 22px; }
.kpi-sub { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); display: inline-flex; cursor: help; }
.hint .ic { width: 15px; height: 15px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-size: 12px; padding: 2px 7px 2px 5px; border-radius: 99px; }
.delta .ic { width: 13px; height: 13px; stroke-width: 2.4; }
.delta.good { color: var(--good); background: var(--good-bg); }
.delta.bad { color: var(--bad); background: var(--bad-bg); }
.delta.flat { color: var(--ink-2); background: var(--surface-2); }

/* today strip */
.today-strip { display: flex; flex-wrap: wrap; gap: 0; background: linear-gradient(120deg, #2a1d47, #4a1a3d); color: #fff; border-radius: var(--r); overflow: hidden; }
.today-strip > div { padding: 14px 20px; display: grid; gap: 2px; }
.ts-hello { flex: 1 1 240px; }
.ts-hello b { font-size: 17px; }
.ts-hello span { opacity: 0.75; font-size: 13px; }
.ts-item { border-left: 1px solid rgba(255, 255, 255, 0.12); min-width: 140px; }
.ts-item span { font-size: 12px; opacity: 0.75; }
.ts-item b { font-size: 19px; }
.ts-item em { font-style: normal; font-size: 12px; opacity: 0.7; }

.mini-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.mini-stats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 0; }
.mini-stats > div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; min-width: 0; }
.mini-stats span { font-size: 12px; color: var(--ink-2); }
.mini-stats b { font-size: 16px; }
.mini-stats em { font-style: normal; font-size: 12px; color: var(--muted); }

/* ───────── charts ───────── */
.chart-box { width: 100%; }
.chart-box svg { display: block; overflow: visible; }
.grid line.grid, svg .grid { stroke: var(--line); stroke-width: 1; }
svg .axis { stroke: var(--axis); stroke-width: 1; }
svg .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg .line-dim { stroke-width: 2; }
svg .area { opacity: 0.1; }
svg .dot { stroke: var(--surface); stroke-width: 2; }
svg .cross { stroke: var(--axis); stroke-width: 1; }
svg .hit { cursor: default; }
svg .hit:hover { fill: var(--surface-2); fill-opacity: 0.5; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12.5px; color: var(--ink-2); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); font-size: 12.5px; max-width: 300px; display: none; }
.tip-h { font-weight: 700; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-row .tl { flex: 1; color: var(--ink-2); }
.tip-row b { font-variant-numeric: tabular-nums; }
.barlist { display: grid; gap: 7px; }
.barlist.mt { margin-top: 16px; }
.bl-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 10px; }
.bl-label { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-sub { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); }
.bl-track { height: 12px; }
.bl-bar { height: 12px; border-radius: 0 4px 4px 0; min-width: 2px; }
.bl-val { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px; text-align: right; min-width: 54px; }
.sharebar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; }
.sb-seg { min-width: 3px; }
.sb-legend { display: grid; gap: 6px; margin-top: 10px; }
.sb-lg { display: grid; grid-template-columns: 12px 1fr auto 38px; align-items: center; gap: 8px; font-size: 13px; }
.sb-lg b { font-variant-numeric: tabular-nums; }
.sb-lg .muted { text-align: right; font-size: 12px; }
.heat { display: grid; gap: 3px; font-size: 11px; color: var(--muted); }
.heat-h { text-align: center; }
.heat-d { display: flex; align-items: center; }
.heat-c { height: 22px; border-radius: 4px; }
.heat-scale { display: flex; align-items: center; gap: 3px; justify-content: flex-end; margin-top: 10px; font-size: 11px; color: var(--muted); }
.heat-scale i { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }
.heat-scale span { margin: 0 4px; }
.spark { fill: none; }
.spark polyline { fill: none; stroke-width: 2; stroke-linejoin: round; }
.spark-wide svg { width: 100%; height: 60px; }

/* ───────── tables ───────── */
.tbl-wrap { overflow-x: auto; margin: 0 -2px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; position: sticky; top: 0; background: var(--surface); }
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover, .tbl th.active { color: var(--ink); }
.tbl th .sort-ic { width: 13px; height: 13px; vertical-align: -2px; margin-left: 2px; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl tfoot td { border-top: 2px solid var(--line); border-bottom: 0; background: var(--surface-2); }
.tbl td.clip { max-width: 260px; }
.clip-txt, td.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
td.clip { display: table-cell; }
.more { margin-top: 8px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.search { position: relative; flex: 1 1 260px; display: flex; }
.search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; padding-left: 34px; height: 36px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0 16px; flex-wrap: wrap; }
.card-b > .pager { padding-bottom: 0; }
.chg { font-weight: 700; font-size: 12.5px; }
.chg.pos { color: var(--good); }
.chg.neg { color: var(--bad); }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; text-transform: capitalize; white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.neutral { background: var(--surface-2); color: var(--ink-2); }
.prog { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; flex: 1; min-width: 60px; }
.prog > div { height: 100%; background: var(--s3); border-radius: 99px; }
.prog-row { display: flex; align-items: center; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface-2); border-radius: 99px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; }
.shift { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); }
.shift input { width: 52px; padding: 4px 6px; }

/* states */
.empty, .empty-sm { text-align: center; color: var(--muted); }
.empty { padding: 60px 20px; display: grid; justify-items: center; gap: 8px; background: var(--surface); border-radius: var(--r); border: 1px solid var(--border); }
.empty-ic { width: 36px; height: 36px; color: var(--brand); }
.empty.error .empty-ic { color: var(--bad); }
.empty p { max-width: 520px; margin: 0 0 8px; }
.empty-sm { padding: 18px 8px; font-size: 13px; }
.skel-wrap { display: grid; gap: 18px; }
.skel-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.skel { height: 96px; border-radius: var(--r); background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skel-block { height: 220px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 10px; background: var(--info-bg); color: var(--ink); font-size: 13.5px; }
.notice .ic { color: var(--info); margin-top: 1px; }
.notice.warn { background: var(--warn-bg); }
.notice.warn .ic { color: var(--warn); }
.notice.bad { background: var(--bad-bg); }
.notice.bad .ic { color: var(--bad); }

/* ───────── opportunities ───────── */
.opps { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.opp { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; display: flex; gap: 14px; box-shadow: var(--shadow); }
.opp-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--info-bg); color: var(--info); }
.opp.hot .opp-ic { background: var(--brand-soft); color: var(--brand); }
.opp.warm .opp-ic { background: var(--warn-bg); color: var(--warn); }
.opp-ic .ic { width: 21px; height: 21px; }
.opp-b { display: grid; gap: 4px; align-content: start; min-width: 0; }
.opp-b h3 { font-size: 14.5px; }
.opp-big { font-size: 19px; font-weight: 750; }
.opp-b p { margin: 0 0 6px; color: var(--ink-2); font-size: 13px; }
.opp-b .btn { justify-self: start; }
.two-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.li:last-child { border-bottom: 0; }
.li b { font-variant-numeric: tabular-nums; }

/* customer segments */
.segs { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.seg-tile { font: inherit; text-align: left; border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: var(--r); padding: 11px 13px; cursor: pointer; display: grid; gap: 1px; position: relative; overflow: hidden; }
.seg-tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--surface-3); }
.seg-tile.good::before { background: var(--good); }
.seg-tile.info::before { background: var(--info); }
.seg-tile.warn::before { background: #e0a000; }
.seg-tile.bad::before { background: var(--bad); }
.seg-tile span { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.seg-tile b { font-size: 21px; }
.seg-tile em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.seg-tile:hover { background: var(--surface-2); }
.seg-tile.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }

/* finance */
.aging { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.ag { background: var(--surface-2); border-radius: 10px; padding: 9px 11px; display: grid; }
.ag span { font-size: 12px; color: var(--ink-2); }
.ag.warn { background: var(--warn-bg); }
.ag.bad { background: var(--bad-bg); }

/* ───────── drawer ───────── */
.drawer-wrap { position: fixed; inset: 0; z-index: 60; }
.drawer-bg { position: absolute; inset: 0; background: rgba(10, 6, 20, 0.4); opacity: 0; transition: opacity 0.2s; }
.drawer { position: absolute; right: 0; top: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); display: flex; flex-direction: column; transform: translateX(30px); opacity: 0; transition: transform 0.22s, opacity 0.22s; box-shadow: -12px 0 40px rgba(0, 0, 0, 0.2); outline: none; }
.drawer.wide { width: min(860px, 100%); }
.drawer-wrap.open .drawer { transform: none; opacity: 1; }
.drawer-wrap.open .drawer-bg { opacity: 1; }
.drawer-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-h h2 { font-size: 18px; }
.drawer-b { padding: 18px 20px 40px; overflow-y: auto; display: grid; gap: 12px; align-content: start; }
.drawer-tools { display: grid; gap: 8px; }
.drawer-tools textarea { width: 100%; resize: vertical; font-weight: 400; }
.tpl { font-weight: 600; }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kv > div { display: grid; gap: 1px; }
.kv span { font-size: 12px; color: var(--muted); }
.kv em { font-style: normal; font-size: 12px; color: var(--ink-2); }
.totals { display: grid; gap: 4px; margin-left: auto; width: min(320px, 100%); }
.totals.left { margin-left: 0; width: 100%; }
.totals > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.totals span em { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); }
.totals b { font-variant-numeric: tabular-nums; }
.totals .big { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; font-size: 16px; }
.profile-h { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.profile-h > div:nth-child(2) { flex: 1; min-width: 180px; }
.pkg { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.pkg-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pkg-s { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr auto; gap: 10px; align-items: center; font-size: 13px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); background: #1d1630; color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; opacity: 0; transition: 0.25s; z-index: 120; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #8f1d1d; }
.toast.good { background: #0d5a23; }

/* ───────── responsive ───────── */
@media (max-width: 1200px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g-1-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
    .g-2-1, .g-1-2, .g-1-1, .g-1-1-1 { grid-template-columns: minmax(0, 1fr); }
    #app { background: none; }
    .side { position: fixed; left: 0; z-index: 50; transform: translateX(-100%); transition: transform 0.2s; }
    body.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(10, 6, 20, 0.45); }
    .menu-btn { display: inline-flex; }
    .top { padding: 10px 14px; }
    .page { padding: 16px 14px 60px; }
}
@media (max-width: 600px) {
    .kpi-value { font-size: 20px; }
    .mini-stats.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ts-item { min-width: 50%; border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.12); }
    .filters { width: 100%; flex-wrap: nowrap; }
    .filters .dd, .filters > .sel { flex: 1 1 0; min-width: 0; }
    .filters .dd .sel { width: 100%; }
    .filters .sel { max-width: none; }
    .dd-menu { left: 0; right: auto; }
    #range-dd .dd-menu { right: 0; left: auto; }
    .aging { grid-template-columns: repeat(2, 1fr); }
    .two-lists, .kv { grid-template-columns: 1fr; }
    .skel-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media print {
    .side, .top .filters, .menu-btn, .card-actions, .toolbar, .pager, .btn { display: none !important; }
    .page { padding: 0; }
    .card, .kpi { box-shadow: none; break-inside: avoid; }
}

.tbl td.nowrap { white-space: nowrap; }
.barlist.wrap .bl-label { white-space: normal; overflow: visible; }
.barlist.wrap .bl-row { grid-template-columns: minmax(120px, 50%) 1fr auto; }

/* ───────── phones: every table row becomes a card ───────── */
@media (max-width: 640px) {
    .tbl-wrap { overflow: visible; margin: 0; }
    .tbl.cards, .tbl.cards tbody, .tbl.cards tfoot { display: block; }
    .tbl.cards thead { display: none; }
    .tbl.cards tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: var(--surface); }
    .tbl.cards tr.click:active td, .tbl.cards tr.click:hover td { background: none; }
    .tbl.cards tr.click:hover { background: var(--surface-2); }
    .tbl.cards td { display: block; border: 0 !important; padding: 0; text-align: left !important; min-width: 0; background: none !important; max-width: none; }
    .tbl.cards td::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 1px; }
    .tbl.cards td.td-main { grid-column: 1 / -1; font-size: 15px; }
    .tbl.cards td.td-main::before, .tbl.cards td.td-act::before { display: none; }
    .tbl.cards td.td-act { grid-column: 1 / -1; }
    .tbl.cards td.td-act .btn { width: 100%; }
    .tbl.cards td.td-empty { display: none; }
    .tbl.cards td.clip, .tbl.cards td.clip .clip-txt { white-space: normal; overflow: visible; grid-column: 1 / -1; }
    .tbl.cards td.nowrap { white-space: normal; }
    .tbl.cards tfoot tr { background: var(--surface-2); border-color: transparent; }
    .tbl.cards .prog-row { max-width: 220px; }
    /* tables inside drawers stay as real tables (bill lines) */
    .tbl.lines td, .tbl.lines th { padding: 7px 6px; }
    .toolbar .seg { order: 3; }
    .toolbar > .sel, .toolbar > .btn { flex: 1 1 140px; }
    .pager { justify-content: center; }
    .card-h { padding: 14px 14px 0; }
    .card-b { padding: 12px 14px 14px; }
    section.card > .toolbar { padding: 14px 14px 0; }
    section.card > #seg-text, section.card > #list, section.card > .pager { padding-left: 14px; padding-right: 14px; }
    .card-actions { width: 100%; }
    .shift { flex-wrap: wrap; }
    .kpis { gap: 10px; }
    .kpi { padding: 12px; }
    .bl-row { grid-template-columns: minmax(84px, 42%) 1fr auto; gap: 8px; }
    .opp { padding: 14px; gap: 12px; }
    .opps { grid-template-columns: minmax(0, 1fr); }
    .segs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .seg-tile { padding: 9px 10px; }
    .seg-tile b { font-size: 18px; }
    .heat { gap: 2px; grid-template-columns: 30px repeat(var(--hc, 12), minmax(0, 1fr)) !important; }
    .heat-c { height: 18px; border-radius: 3px; }
    .heat-h { font-size: 9px; }
    .drawer-h { padding: 14px 16px; }
    .drawer-b { padding: 14px 16px 40px; }
    .pkg-s { grid-template-columns: 1fr auto; }
    .pkg-s .prog { grid-column: 1 / -1; order: 3; }
    .top-title h1 { font-size: 18px; }
    .page { gap: 14px; }
    .grid { gap: 14px; }
}

@supports (padding: env(safe-area-inset-top)) {
    .top { padding-top: max(10px, env(safe-area-inset-top)); }
    .side { padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(18px, env(safe-area-inset-bottom)); }
    .page { padding-bottom: max(60px, env(safe-area-inset-bottom)); }
}
