/* Ruble ISP CRM: clean admin look (white sidebar, gradient stat cards), works on phones */
:root {
  color-scheme: light;
  --page: #f3f6fb;
  --card: #ffffff;
  --card-2: #f6f8fc;
  --side: #ffffff;
  --ink: #1d2939;
  --ink-2: #475467;
  --muted: #8a94a6;
  --line: #e7ecf4;
  --grid: #e3e8f1;
  --base: #c9d2e0;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 22px rgba(16, 24, 40, .06);
  --shadow-lg: 0 18px 50px rgba(16, 24, 40, .18);
  --primary: #3b6cf6; --primary-2: #2f5be0; --primary-soft: #eaf0ff;
  --s1: #3b6cf6;           /* chart series 1 (blue) */
  --s1b: #a8c0fb;          /* chart series 2 (light blue) */
  --s2: #f2665a;           /* chart line (coral) */
  --s3: #1fbf8f;           /* green */
  --good: #12b76a; --good-ink: #067647; --good-bg: #e6f8ef;
  --warn: #f7a823; --warn-ink: #93590a; --warn-bg: #fff5e0;
  --bad: #f04438;  --bad-ink: #c0251b;  --bad-bg: #feeceb;
  --info-bg: #eaf0ff; --info-ink: #2f5be0;
  --accent: #3b6cf6;
  --g-blue: linear-gradient(135deg, #5b8cff 0%, #3463ea 100%);
  --g-coral: linear-gradient(135deg, #ff8f6b 0%, #f2545b 100%);
  --g-green: linear-gradient(135deg, #3ad6a2 0%, #12b886 100%);
  --g-amber: linear-gradient(135deg, #ffcf5a 0%, #f7a51e 100%);
  --g-violet: linear-gradient(135deg, #9b8afb 0%, #6a4fe6 100%);
  --hero: var(--g-blue);
  --radius: 16px;
  --side-w: 256px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d1320; --card: #151d2c; --card-2: #1b2536; --side: #121a28; --ink: #eef2f8; --ink-2: #c3cbd9;
    --muted: #8691a6; --line: #253046; --grid: #243047; --base: #33405a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 22px rgba(0, 0, 0, .25);
    --primary-soft: #1d2b4d; --s1: #5b8cff; --s1b: #34508f; --s2: #ff7a6e;
    --good-ink: #6ee7a8; --good-bg: #10301f; --warn-ink: #ffd27a; --warn-bg: #3a2c0b;
    --bad-ink: #ff9a92; --bad-bg: #3a1716; --info-bg: #1d2b4d; --info-ink: #9db8ff;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d1320; --card: #151d2c; --card-2: #1b2536; --side: #121a28; --ink: #eef2f8; --ink-2: #c3cbd9;
  --muted: #8691a6; --line: #253046; --grid: #243047; --base: #33405a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 22px rgba(0, 0, 0, .25);
  --primary-soft: #1d2b4d; --s1: #5b8cff; --s1b: #34508f; --s2: #ff7a6e;
  --good-ink: #6ee7a8; --good-bg: #10301f; --warn-ink: #ffd27a; --warn-bg: #3a2c0b;
  --bad-ink: #ff9a92; --bad-bg: #3a1716; --info-bg: #1d2b4d; --info-ink: #9db8ff;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--info-ink); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
/* line icons (inline SVG, 24x24 grid) */
.ic, .icon-btn svg, .logo svg, .search-ic, .nav svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex: none; vertical-align: -3px; }

/* ---------- app shell: sidebar + top bar ---------- */
.app { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 40; transition: transform .22s ease, width .2s ease; }
.shell { margin-left: var(--side-w); min-width: 0; transition: margin .2s ease; }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; min-width: 0; }
.logo { width: 42px; height: 42px; border-radius: 13px; background: var(--g-blue); color: #fff; display: grid; place-items: center;
  flex: none; box-shadow: 0 8px 18px rgba(59, 108, 246, .35); }
.logo svg { width: 24px; height: 24px; stroke-width: 2.4; }
.brand-text { min-width: 0; }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: .1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { flex: 1; overflow-y: auto; padding: 4px 14px 16px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.nav-label { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted);
  padding: 16px 12px 6px; }
.tab { border: 0; background: transparent; padding: 10px 12px; border-radius: 11px; cursor: pointer; white-space: nowrap;
  font-weight: 700; font-size: 14.5px; color: var(--ink-2); display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; }
.tab svg { width: 20px; height: 20px; color: var(--muted); }
.tab:hover { background: var(--card-2); color: var(--ink); }
.tab:hover svg { color: var(--ink-2); }
.tab.on { background: var(--primary-soft); color: var(--primary); }
.tab.on svg { color: var(--primary); }
.tab .t-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.tab .badge { background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; font-weight: 800; }
.side-foot { padding: 12px 20px 18px; }
.demo-badge { display: inline-block; background: var(--warn-bg); color: var(--warn-ink); font-weight: 800; font-size: 11px;
  letter-spacing: .8px; text-transform: uppercase; padding: 5px 10px; border-radius: 99px; }
.side-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, .4); z-index: 39; }

/* desktop: the menu button folds the sidebar to icons only */
body.side-mini { --side-w: 80px; }
body.side-mini .brand { padding: 20px 19px 16px; }
body.side-mini .brand-text, body.side-mini .nav-label, body.side-mini .tab .t-name, body.side-mini .tab .badge,
body.side-mini .side-foot { display: none; }
body.side-mini .tab { justify-content: center; padding: 12px; }

.topbar { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 24px;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  min-height: 68px; }
.menu-btn { width: 40px; height: 40px; border-radius: 12px; }
.global-search { position: relative; flex: 1; min-width: 200px; max-width: 460px; }
.search-ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.topbar .global-search input { width: 100%; border: 1px solid transparent; border-radius: 12px; padding: 10px 14px 10px 42px;
  background: var(--card-2); }
.topbar .global-search input:focus { background: var(--card); border-color: var(--primary); outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); }
.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--card); color: var(--ink);
  border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 60; overflow: hidden; border: 1px solid var(--line); }
.search-results button { display: flex; width: 100%; text-align: left; gap: 10px; align-items: center; padding: 10px 14px;
  background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.search-results button:hover, .search-results button:focus { background: var(--card-2); outline: none; }
.month-picker { display: flex; align-items: center; gap: 6px; }
.month-picker input { font-weight: 700; }
.top-actions { display: flex; gap: 8px; margin-left: auto; }

main { max-width: 1400px; margin: 0 auto; padding: 22px 24px 80px; outline: none; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.crumb svg { width: 14px; height: 14px; }
.crumb b { color: var(--ink-2); font-weight: 700; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.2px; }
.page-head .sub { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.page-head .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- buttons & inputs ---------- */
.btn { border-radius: 11px; padding: 9px 16px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center;
  gap: 7px; background: var(--card); color: var(--ink); border: 1px solid var(--line); text-decoration: none; white-space: nowrap;
  font-size: 14px; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; }
.btn:hover { border-color: var(--base); background: var(--card-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn .ic { width: 17px; height: 17px; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 30%, transparent); }
.btn.primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn.pay { background: var(--good); color: #fff; border-color: var(--good); box-shadow: 0 6px 16px rgba(18, 183, 106, .28); }
.btn.pay:hover { background: #0ea25d; border-color: #0ea25d; }
.btn.white { background: #fff; color: var(--primary); border-color: #fff; }
.btn.danger, .btn.reject { color: var(--bad-ink); }
.btn.danger:hover, .btn.reject:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--card-2); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; gap: 5px; }
.btn.sm .ic { width: 15px; height: 15px; }
.btn.xs { padding: 3px 9px; font-size: 12.5px; border-radius: 8px; gap: 4px; }
.btn.xs .ic { width: 14px; height: 14px; }
.icon-btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; width: 36px; height: 36px;
  cursor: pointer; display: inline-grid; place-items: center; text-decoration: none; color: var(--ink-2); flex: none; }
.icon-btn:hover { border-color: var(--base); color: var(--ink); background: var(--card-2); }
.icon-btn.light { background: rgba(255, 255, 255, .2); border-color: transparent; color: #fff; }
.icon-btn.light:hover { background: rgba(255, 255, 255, .3); }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 6px 13px; cursor: pointer;
  font-weight: 700; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.chip:hover { border-color: var(--base); }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip.light { background: rgba(255, 255, 255, .2); border-color: transparent; color: #fff; }
input:not([type]), input[type=text], input[type=search], input[type=number], input[type=date], input[type=month], input[type=tel],
input[type=password], select, textarea {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 12px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
textarea { resize: vertical; min-height: 70px; width: 100%; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; max-width: 340px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- cards & grid ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line);
  padding: 18px 20px; min-width: 0; }
.card h3 { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.card h3 .muted { font-weight: 600; font-size: 12.5px; margin-left: auto; }
.grid { display: grid; gap: 18px; }
.grid.kpis { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-bottom: 18px; }
.grid.hero { grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; }
.grid.kpis.k3 { grid-template-columns: repeat(3, 1fr); }
.grid.kpis.k5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1180px) { .grid.kpis.k3 { grid-template-columns: repeat(2, 1fr); } .grid.kpis.k5 { grid-template-columns: repeat(3, 1fr); } }
.grid.two { grid-template-columns: 2fr 1fr; }
.grid.half { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.mt { margin-top: 18px; }
@media (max-width: 1180px) { .grid.hero { grid-template-columns: repeat(2, 1fr); } }
.grid > * { min-width: 0; }
@media (max-width: 1180px) { .grid.two, .grid.half, .grid.three { grid-template-columns: 1fr; } }

/* stat cards: white with a soft icon disc, or solid gradient ("solid") like the top row of the dashboard */
.kpi { position: relative; overflow: hidden; padding: 18px 18px 16px; }
.kpi .k-top { display: flex; align-items: center; gap: 12px; }
.kpi .k-emoji { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; flex: none;
  background: color-mix(in srgb, var(--kc, #3b6cf6) 13%, transparent); color: var(--kc, #3b6cf6); }
.kpi .k-emoji .ic { width: 22px; height: 22px; }
.kpi .k-label { font-size: 13px; color: var(--muted); font-weight: 700; }
.kpi .k-value { font-size: 26px; font-weight: 800; margin-top: 10px; letter-spacing: -.3px; line-height: 1.2; }
.kpi .k-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.kpi.clickable { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.kpi.clickable:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(16, 24, 40, .1); }
.kpi.solid { border: 0; color: #fff; background: var(--kg, var(--g-blue)); box-shadow: 0 12px 28px color-mix(in srgb, var(--kc) 35%, transparent);
  padding: 20px 20px 18px; }
.kpi.solid::before, .kpi.solid::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .13);
  pointer-events: none; }
.kpi.solid::before { width: 170px; height: 170px; right: -52px; bottom: -78px; }
.kpi.solid::after { width: 110px; height: 110px; right: 46px; bottom: -86px; background: rgba(255, 255, 255, .09); }
.kpi.solid .k-top { justify-content: space-between; }
.kpi.solid .k-emoji { background: rgba(255, 255, 255, .22); color: #fff; order: 2; width: 48px; height: 48px; }
.kpi.solid .k-label { color: rgba(255, 255, 255, .92); font-size: 14px; }
.kpi.solid .k-value { font-size: 32px; margin-top: 6px; }
.kpi.solid .k-sub { color: rgba(255, 255, 255, .88); position: relative; z-index: 1; }
.kpi.solid .muted { color: rgba(255, 255, 255, .8) !important; }

.progress { height: 8px; background: var(--card-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; background: var(--pc, var(--good)); border-radius: 99px; }
.progress.stack { display: flex; gap: 2px; background: transparent; }
.progress.stack > span { border-radius: 2px; }
.progress.stack > span:first-child { border-radius: 99px 2px 2px 99px; }
.progress.stack > span:last-child { border-radius: 2px 99px 99px 2px; }
.kpi.solid .progress.stack > span { box-shadow: 0 0 0 1px rgba(255, 255, 255, .5); }

.alerts { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.alert { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 700; font-size: 14px; flex: 1 1 440px; }
.alert .btn { flex: none; }
.alert .grow { min-width: 0; }
.alert .a-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--ac, var(--primary)) 14%, transparent); color: var(--ac, var(--primary)); }
.alert .a-ic .ic { width: 19px; height: 19px; }
.alert.warn { --ac: var(--warn); }
.alert.bad { --ac: var(--bad); }
.alert.info { --ac: var(--primary); }
.alert.good { --ac: var(--good); background: var(--good-bg); border-color: transparent; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted);
  font-weight: 800; padding: 11px 12px; background: var(--card-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
th.sort { cursor: pointer; user-select: none; }
th.sort:hover { color: var(--ink); }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.row-link { cursor: pointer; }
tbody tr:hover { background: color-mix(in srgb, var(--primary) 4%, transparent); }
tfoot td { font-weight: 800; background: var(--card-2); }
.cell-name b { display: block; font-weight: 700; white-space: nowrap; }
.cell-name small { color: var(--muted); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.empty .big { font-size: 34px; display: block; margin-bottom: 6px; }

.pager { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; margin-top: 14px;
  color: var(--muted); font-size: 13.5px; font-weight: 600; }
.pager .btns { display: flex; gap: 6px; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: 12.5px;
  font-weight: 700; white-space: nowrap; background: var(--card-2); color: var(--ink-2); border: 1px solid var(--line); }
.pill.good { background: var(--good-bg); color: var(--good-ink); border-color: transparent; }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.pill.bad { background: var(--bad-bg); color: var(--bad-ink); border-color: transparent; }
.pill.info { background: var(--info-bg); color: var(--info-ink); border-color: transparent; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--dc, #999); flex: none; }
.zone-tag { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.m-pill { --mc: #64748b; background: color-mix(in srgb, var(--mc) 12%, transparent); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--mc) 30%, transparent); }
.m-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mc); }
.due { font-weight: 800; color: var(--bad-ink); }
.due.zero { color: var(--good-ink); font-weight: 700; }
.due.adv { color: var(--info-ink); }
.months { display: inline-block; min-width: 22px; text-align: center; border-radius: 7px; font-size: 12px; font-weight: 800;
  padding: 0 5px; margin-left: 6px; background: var(--warn-bg); color: var(--warn-ink); }
.months.hot { background: var(--bad); color: #fff; }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-l { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 4 5; }
.chart .base-l { stroke: var(--base); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .ln { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .pt { stroke: var(--card); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover, .chart .hit:focus, .chart .hit.on { fill: color-mix(in srgb, var(--primary) 6%, transparent); outline: none; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; font-size: 13px; font-weight: 700;
  color: var(--ink-2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: 0; }
.tip { position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 9px 12px; font-size: 13px; z-index: 5; min-width: 160px; }
.tip .t-title { color: var(--muted); font-size: 12px; margin-bottom: 4px; font-weight: 700; }
.tip .t-row { display: flex; align-items: center; gap: 8px; }
.tip .t-row i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.tip .t-row b { font-variant-numeric: tabular-nums; }
.tip .t-row span { color: var(--muted); }

.hbars { display: grid; gap: 11px; }
.hb { display: grid; grid-template-columns: minmax(90px, 150px) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-weight: 700; }
.hb-track { height: 10px; background: var(--card-2); border-radius: 99px; overflow: hidden; }
.hb-fill { height: 100%; border-radius: 99px; background: var(--s1); min-width: 3px; }
.hb-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.hb-val small { display: block; font-weight: 600; color: var(--muted); font-size: 11.5px; }

/* donut (SVG ring with a label in the middle) */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { position: relative; flex: none; }
.donut svg { display: block; transform: rotate(-90deg); }
.donut circle { fill: none; }
.donut .d-mid { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.15; }
.donut .d-mid b { font-size: 22px; font-weight: 800; display: block; }
.donut .d-mid small { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.d-legend { display: grid; gap: 8px; flex: 1; min-width: 160px; font-size: 13.5px; }
.d-legend > div { display: flex; align-items: center; gap: 8px; }
.d-legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.d-legend small { color: var(--muted); font-weight: 700; min-width: 36px; text-align: right; }

.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--card-2) 0); display: grid; place-items: center; }
.ring > div { width: 90px; height: 90px; border-radius: 50%; background: var(--card); display: grid; place-items: center;
  text-align: center; font-weight: 800; font-size: 22px; line-height: 1.1; }
.ring small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; }

/* ---------- list rows (dashboard side lists) ---------- */
.list { display: grid; }
.list > * { min-width: 0; }
.li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer;
  border-radius: 8px; }
.li:last-child { border-bottom: 0; }
.li:hover { background: var(--card-2); }
.li .grow { min-width: 0; }
.li .grow b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .grow small { color: var(--muted); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff;
  background: var(--ac, var(--primary)); flex: none; font-size: 13.5px; }
.avatar.lg { width: 58px; height: 58px; font-size: 20px; box-shadow: 0 0 0 4px rgba(255, 255, 255, .3); }

/* ---------- zone / package cards ---------- */
.ent { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 12px; }
.ent::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--ec, var(--primary)); }
.ent .e-head { display: flex; align-items: flex-start; gap: 12px; }
.ent .e-emoji { font-size: 22px; line-height: 1; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  flex: none; background: color-mix(in srgb, var(--ec, var(--primary)) 13%, transparent); }
.ent h4 { font-size: 17px; font-weight: 800; }
.ent .e-sub { color: var(--muted); font-size: 13px; }
.ent .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ent .stat { background: var(--card-2); border-radius: 12px; padding: 8px 10px; }
.ent .stat small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; font-weight: 800; }
.ent .stat b { font-size: 15.5px; font-variant-numeric: tabular-nums; }
.ent .e-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.inactive { opacity: .6; }

/* ---------- drawer (client card) ---------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(780px, 100vw); background: var(--page); z-index: 50;
  transform: translateX(105%); transition: transform .22s ease; box-shadow: -10px 0 40px rgba(16, 24, 40, .18);
  overflow-y: auto; overscroll-behavior: contain; }
.drawer.open { transform: none; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, .4); z-index: 45; }
.d-head { background: var(--hero); color: #fff; padding: 20px 22px 18px; position: sticky; top: 0; z-index: 2; overflow: hidden; }
.d-head::after { content: ""; position: absolute; width: 240px; height: 240px; border-radius: 50%; right: -70px; top: -120px;
  background: rgba(255, 255, 255, .1); pointer-events: none; }
.d-head .row1 { display: flex; gap: 14px; align-items: center; position: relative; z-index: 1; }
.d-head h2 { font-size: 22px; font-weight: 800; }
.d-head .meta { opacity: .92; font-size: 13.5px; }
.d-head .close { margin-left: auto; align-self: flex-start; }
.d-head .contact { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; position: relative; z-index: 1; }
.d-head .contact a, .d-head .contact button { background: rgba(255, 255, 255, .96); color: #1d2939; border: 0;
  border-radius: 10px; padding: 7px 12px; font-weight: 700; text-decoration: none; cursor: pointer; font-size: 13.5px; }
.d-body { padding: 18px 20px 60px; display: grid; gap: 16px; }
.bal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 640px) { .bal-grid { grid-template-columns: repeat(2, 1fr); } }
.bal { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; box-shadow: var(--shadow); }
.bal small { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; font-weight: 800; }
.bal b { font-size: 20px; font-variant-numeric: tabular-nums; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.months-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; }
@media (max-width: 640px) { .months-grid { grid-template-columns: repeat(6, 1fr); } }
.mg { border-radius: 10px; padding: 6px 2px; text-align: center; font-size: 11.5px; font-weight: 800; border: 1px solid var(--line);
  background: var(--card); }
.mg .e { display: block; font-size: 16px; line-height: 1.3; }
.mg.paid { background: var(--good-bg); border-color: transparent; color: var(--good-ink); }
.mg.partial { background: var(--warn-bg); border-color: transparent; color: var(--warn-ink); }
.mg.unpaid { background: var(--bad-bg); border-color: transparent; color: var(--bad-ink); }
.mg.none { color: var(--muted); }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 70; display: grid; place-items: center;
  padding: 16px; overflow-y: auto; backdrop-filter: blur(2px); }
.modal { background: var(--card); border-radius: 20px; width: min(560px, 100%); box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { width: min(780px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 18px; font-weight: 800; flex: 1; }
.modal-body { padding: 18px 20px 20px; overflow-y: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field > span .req { color: var(--bad); }
.field .hint { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: flex; align-items: center; gap: 6px; padding: 7px 11px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 13.5px; cursor: pointer; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.methods { display: flex; flex-wrap: wrap; gap: 8px; }
.methods label { --mc: #64748b; border: 2px solid var(--line); border-radius: 12px; padding: 9px 13px; cursor: pointer;
  font-weight: 800; display: flex; align-items: center; gap: 6px; }
.methods input { position: absolute; opacity: 0; pointer-events: none; }
.methods label:has(input:checked) { border-color: var(--mc); background: color-mix(in srgb, var(--mc) 12%, transparent); }
.methods label:has(input:focus-visible) { outline: 2px solid var(--primary); }
.pay-client { display: flex; gap: 12px; align-items: center; background: var(--card-2); border-radius: 14px; padding: 12px; }
.pay-client .grow b { display: block; }
.quick-amounts { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- receipt ---------- */
.receipt { border: 2px dashed var(--line); border-radius: 14px; padding: 18px 20px; background: #fff; color: #14151a; }
.receipt .r-head { display: flex; justify-content: space-between; gap: 10px; border-bottom: 2px solid #14151a; padding-bottom: 10px; }
.receipt .r-head h2 { font-size: 20px; }
.receipt .r-title { text-align: center; letter-spacing: 3px; font-weight: 800; margin: 12px 0; font-size: 13px; }
.receipt table td { border: 0; padding: 4px 0; font-size: 14px; }
.receipt table td:first-child { color: #555; width: 42%; }
.receipt tbody tr:hover { background: none; }
.receipt .r-amount { font-size: 28px; font-weight: 800; text-align: center; margin: 10px 0 2px; }
.receipt .r-words { text-align: center; font-style: italic; color: #555; font-size: 13px; margin-bottom: 10px; }
.receipt .r-foot { display: flex; justify-content: space-between; margin-top: 26px; font-size: 12.5px; color: #555; }
.receipt .r-foot span { border-top: 1px solid #999; padding-top: 4px; min-width: 120px; text-align: center; }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; }
.toast { background: #1d2939; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg);
  font-weight: 700; max-width: min(520px, 92vw); animation: pop .18s ease; }
.toast.err { background: #c0251b; }
.toast.ok::before { content: "✅ "; }
.toast.err::before { content: "⚠️ "; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; background: var(--page); display: grid; place-items: center; z-index: 100; padding: 16px; }
.login-card { display: grid; grid-template-columns: 1fr 1fr; width: min(860px, 100%); background: var(--card); border-radius: 24px;
  overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.login-art { background: var(--g-blue); color: #fff; padding: 40px 34px; position: relative; overflow: hidden; display: flex;
  flex-direction: column; justify-content: flex-end; min-height: 360px; }
.login-art::before, .login-art::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.login-art::before { width: 300px; height: 300px; right: -90px; top: -90px; }
.login-art::after { width: 200px; height: 200px; left: -60px; bottom: -80px; }
.login-art .logo { background: rgba(255, 255, 255, .2); box-shadow: none; width: 56px; height: 56px; border-radius: 16px; margin-bottom: auto; position: relative; z-index: 1; }
.login-art .logo svg { width: 30px; height: 30px; }
.login-art h2 { font-size: 28px; font-weight: 800; position: relative; z-index: 1; }
.login-art p { margin: 6px 0 0; opacity: .9; position: relative; z-index: 1; }
.login form { padding: 40px 34px; display: grid; gap: 14px; align-content: center; }
.login form h3 { font-size: 22px; font-weight: 800; }
.login form input { padding: 12px 14px; }
.login form .btn { justify-content: center; padding: 12px; }
@media (max-width: 680px) {
  .login-card { grid-template-columns: 1fr; }
  .login-art { min-height: 0; padding: 26px 24px; flex-direction: row; align-items: center; gap: 14px; }
  .login-art .logo { margin: 0; }
  .login-art h2 { font-size: 22px; }
  .login form { padding: 26px 24px 30px; }
}

.loading { opacity: .55; transition: opacity .15s; }
.spinner { text-align: center; padding: 60px 0; color: var(--muted); font-size: 15px; }

/* ---------- top bar: notifications + my account ---------- */
.top-user { display: flex; align-items: center; gap: 8px; }
.top-actions + .top-user { margin-left: 0; }
body.role-customer .top-user, body.role-service .top-user { margin-left: auto; }
.pop-wrap { position: relative; }
.bell-btn { position: relative; width: 40px; height: 40px; border-radius: 12px; }
.bell-btn svg { width: 20px; height: 20px; }
.bell-count { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; border-radius: 99px; padding: 0 5px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--card); }
.me-btn { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); background: var(--card); border-radius: 99px;
  padding: 3px 12px 3px 3px; cursor: pointer; max-width: 220px; }
.me-btn:hover { border-color: var(--base); }
.me-btn .avatar { width: 32px; height: 32px; font-size: 12px; }
.me-btn .who { text-align: left; line-height: 1.15; min-width: 0; }
.me-btn .who b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-btn .who small { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 65; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-lg); width: min(380px, calc(100vw - 24px)); overflow: hidden; }
.pop-head { display: flex; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px solid var(--line); font-weight: 800; }
.pop-head .btn { margin-left: auto; }
.pop-list { max-height: min(420px, 60vh); overflow-y: auto; }
.note { display: flex; gap: 11px; padding: 11px 16px; border-bottom: 1px solid var(--line); cursor: pointer; width: 100%;
  background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.note:hover { background: var(--card-2); }
.note .n-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex: none; }
.note.read .n-dot { background: transparent; }
.note.read { color: var(--ink-2); }
.note small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.me-pop { width: 250px; }
.me-pop .pop-head { flex-direction: column; align-items: flex-start; gap: 0; }
.me-pop .pop-head small { color: var(--muted); font-weight: 700; }
.me-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 16px; border: 0; background: none;
  cursor: pointer; font-weight: 700; text-align: left; }
.me-pop button:hover { background: var(--card-2); }

/* the menu only shows each role its own pages; these hide the buttons a role cannot use */
body.role-customer .global-search, body.role-customer .month-picker, body.role-customer .top-actions { display: none; }
body:not(.can-money) [data-act="pay"], body:not(.can-money) .top-actions .btn.pay { display: none !important; }
body:not(.can-sell) [data-act="new-client"], body:not(.can-sell) [data-act="import-clients"],
body:not(.can-sell) [data-dact="edit"], body:not(.can-sell) [data-dact="charge"], body:not(.can-sell) [data-dact="service"],
body:not(.can-sell) [data-dact="login"], body:not(.can-sell) [data-rsvc] { display: none !important; }
body:not(.can-field) [data-dact="status"] { display: none !important; }
body:not(.is-admin) [data-act="gen-bills"], body:not(.is-admin) .btn.danger, body:not(.is-admin) [data-bedit],
body:not(.is-admin) [data-pdel], body:not(.is-admin) [data-cdel] { display: none !important; }
body.role-sales .top-actions .btn.pay, body.role-service .top-actions { display: none; }

/* ---------- tasks ---------- */
.task { display: grid; grid-template-columns: auto 1fr auto; gap: 12px 14px; align-items: center; padding: 14px 16px;
  border-bottom: 1px solid var(--line); cursor: pointer; }
.task:last-child { border-bottom: 0; }
.task:hover { background: var(--card-2); }
.task .t-check { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--tc, var(--primary)) 13%, transparent); color: var(--tc, var(--primary)); }
.task .t-main { min-width: 0; }
.task .t-main b { display: block; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task .t-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12.5px; color: var(--muted); margin-top: 3px; align-items: center; }
.task .t-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.t-meta .ic { width: 14px; height: 14px; vertical-align: -2px; }
.t-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.task.done b { text-decoration: line-through; color: var(--muted); }
.late { color: var(--bad-ink) !important; font-weight: 800; }
.history { display: grid; gap: 10px; max-height: 280px; overflow-y: auto; padding: 2px; }
.history .h { background: var(--card-2); border-radius: 12px; padding: 9px 12px; font-size: 13.5px; }
.history .h small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 700; margin-bottom: 2px; }
.history .h.sys { background: transparent; border: 1px dashed var(--line); color: var(--ink-2); }
@media (max-width: 640px) { .task { grid-template-columns: auto 1fr; } .task .t-side { grid-column: 2; flex-direction: row; align-items: center; } }

/* ---------- online payments (claims) ---------- */
.claims { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.claim { display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.claim::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--mc, var(--primary)); }
.claim .c-top { display: flex; align-items: center; gap: 12px; }
.claim .c-amt { font-size: 26px; font-weight: 800; margin-left: auto; white-space: nowrap; }
.claim dl { display: grid; grid-template-columns: 95px 1fr; gap: 5px 10px; margin: 0; font-size: 13.5px; }
.claim dt { color: var(--muted); font-weight: 700; }
.claim dd { margin: 0; overflow-wrap: anywhere; }
.claim .c-actions { display: flex; gap: 8px; }
.claim .c-actions .btn { flex: 1; justify-content: center; }
.trx { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: .5px; }

/* ---------- team & activity ---------- */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-bottom: 18px; }
.person { cursor: pointer; padding: 16px; }
.person.on { outline: 2px solid var(--primary); }
.person .p-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.person .p-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.person .p-stats div { background: var(--card-2); border-radius: 10px; padding: 6px 8px; }
.person .p-stats small { display: block; color: var(--muted); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; }
.person .p-stats b { font-size: 14.5px; }
.role-pill { --rc: #64748b; background: color-mix(in srgb, var(--rc) 12%, transparent); color: var(--rc); border: 0; }

/* ---------- customer portal ---------- */
.wallets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.wallet { --mc: #64748b; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; background: var(--card);
  display: flex; flex-direction: column; gap: 2px; text-align: left; }
.wallet b { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.wallet b::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--mc); }
.wallet small { color: var(--muted); font-weight: 700; }
.wallet.on { border-color: var(--mc); background: color-mix(in srgb, var(--mc) 9%, var(--card)); }
.steps { display: grid; gap: 12px; counter-reset: step; margin: 0; padding: 0; list-style: none; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps li::before { counter-increment: step; content: counter(step); width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--primary-soft); color: var(--primary); font-weight: 800; display: grid; place-items: center; font-size: 13.5px; }
.big-num { font-size: 22px; font-weight: 800; letter-spacing: .5px; }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.plan { display: flex; flex-direction: column; gap: 10px; position: relative; }
.plan.current { outline: 2px solid var(--primary); }
.plan .p-speed { font-size: 30px; font-weight: 800; line-height: 1; }
.plan .p-speed small { font-size: 15px; color: var(--muted); }
.plan .p-price { font-size: 20px; font-weight: 800; color: var(--primary); }
.plan ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13.5px; }
.plan .btn { justify-content: center; margin-top: auto; }
.help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.help-card { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.help-card .k-emoji { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--kc) 13%, transparent); color: var(--kc); }
.help-card .k-emoji .ic { width: 24px; height: 24px; }
.help-card b { display: block; font-size: 16px; }
.help-card small { color: var(--muted); font-weight: 700; }

/* ---------- login / sign-up ---------- */
.login-tabs { display: flex; gap: 6px; background: var(--card-2); border-radius: 12px; padding: 4px; }
.login-tabs button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 8px 6px; font-weight: 800; cursor: pointer;
  color: var(--ink-2); font-size: 13.5px; }
.login-tabs button.on { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.login form label { display: grid; gap: 5px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.demo-code { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; font-weight: 700; }
.linkish { background: none; border: 0; color: var(--primary); font-weight: 700; cursor: pointer; padding: 0; justify-self: start; }

@media (max-width: 1279px) { .month-picker #m-today { display: none; } }

/* ---------- tablet & phone: sidebar slides in from the left ---------- */
@media (max-width: 1023px) {
  body, body.side-mini { --side-w: 270px; }
  .sidebar { transform: translateX(-102%); box-shadow: var(--shadow-lg); }
  body.side-open .sidebar { transform: none; }
  body.side-mini .brand-text, body.side-mini .nav-label, body.side-mini .tab .t-name, body.side-mini .side-foot { display: revert; }
  body.side-mini .tab { justify-content: flex-start; padding: 10px 12px; }
  .shell { margin-left: 0; }
}
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; padding: 10px 14px; }
  .menu-btn { order: 0; }
  .top-user { order: 0; margin-left: auto; }
  .global-search { order: 1; flex: 1 1 100%; max-width: none; }
  .month-picker { order: 2; }
  .top-actions { order: 3; }
  .me-btn { padding: 3px; }
  .me-btn .who { display: none; }
}
@media (max-width: 720px) {
  .topbar { position: static; }
  .month-picker { width: 100%; }
  .month-picker input { flex: 1; }
  .month-picker #m-today { display: none; }
  .top-actions { width: 100%; margin-left: 0; }
  .top-actions .btn { flex: 1; justify-content: center; }
  main { padding: 16px 14px 80px; }
  .page-head h1 { font-size: 21px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .grid { gap: 14px; }
  .grid.kpis, .grid.kpis.k5 { grid-template-columns: repeat(2, 1fr); }
  .kpi { padding: 14px; }
  .kpi .k-emoji { width: 38px; height: 38px; }
  .kpi .k-value { font-size: 20px; }
  .kpi.solid .k-value { font-size: 23px; }
  .kpi.solid .k-emoji { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; }
  .kpi.solid .k-emoji .ic { width: 18px; height: 18px; }
  .kpi.solid .k-label { padding-right: 30px; font-size: 13px; }
  .page-head .actions .btn { flex: 1 1 auto; justify-content: center; }
  .kpi .k-label { font-size: 12px; }
  .card { padding: 16px; }
  .hb { grid-template-columns: minmax(70px, 110px) 1fr auto; }
  .kv { grid-template-columns: 110px 1fr; }
}
@media (max-width: 359px) {
  .grid.kpis, .grid.kpis.k3, .grid.kpis.k5, .grid.hero { grid-template-columns: 1fr; }
}

/* ---------- print (receipts & reports) ---------- */
#print-area { display: none; }
@media print {
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block; }
  body.printing .receipt { border: 0; }
  body:not(.printing) .sidebar, body:not(.printing) .topbar, body:not(.printing) .no-print,
  body:not(.printing) .drawer, body:not(.printing) .toasts { display: none !important; }
  .shell { margin-left: 0 !important; }
  .card { box-shadow: none; }
}
