/* SpinMinds CallDesk dashboard. Brand spectrum from spinminds.com. */
@font-face { font-family: 'Inter'; font-weight: 100 900; font-display: swap; src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 300 700; font-display: swap; src: url('/fonts/space-grotesk-latin-wght-normal.woff2') format('woff2'); }

:root {
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e5e8f3;
  --bg: #f6f7fd;
  --card: #ffffff;

  --purple: #7b2d8e;
  --pink: #ec268f;
  --red: #e03a3c;
  --orange: #f47b20;
  --yellow: #f2c500;
  --green: #3cb54a;
  --blue: #29abe2;

  /* readable text/accent variants of the brand colours */
  --purple-ink: #5f1f70;
  --blue-ink: #0b6fa0;
  --green-ink: #1f7a2e;
  --red-ink: #b3252a;
  --orange-ink: #a8500a;
  --pink-ink: #b0156a;

  --out: #29abe2;
  --in: #3cb54a;
  --miss: #e03a3c;
  --rej: #f47b20;

  --grad: linear-gradient(120deg, var(--purple), var(--pink) 50%, var(--orange));
  --spectrum: linear-gradient(90deg, var(--purple), var(--pink), var(--red), var(--orange), var(--yellow), var(--green), var(--blue));
  --r: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(76, 29, 149, 0.18);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 100% -80px, rgba(236, 38, 143, 0.09), transparent 70%),
    radial-gradient(800px 420px at 0% -60px, rgba(41, 171, 226, 0.1), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}
body::before { content: ''; position: fixed; inset: 0 0 auto 0; height: 4px; background: var(--spectrum); z-index: 100; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; }
a { color: var(--purple); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.ico { width: 18px; height: 18px; flex: none; }
.ico.big { width: 40px; height: 40px; }
:focus-visible { outline: 3px solid rgba(123, 45, 142, 0.45); outline-offset: 2px; border-radius: 8px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 26px 16px 18px; background: rgba(255, 255, 255, 0.86); backdrop-filter: blur(10px);
  border-right: 1px solid var(--line);
}
.brand { display: block; padding: 0 10px 22px; }
.brand img { height: 34px; width: auto; display: block; }
.brand small { display: block; margin-top: 8px; font-family: var(--display); font-weight: 600; letter-spacing: 0.14em; font-size: 11px; text-transform: uppercase; color: var(--purple); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--ink-2); font-weight: 600; font-size: 14.5px; text-decoration: none; transition: background 0.15s, color 0.15s;
}
.nav a .ico { width: 20px; height: 20px; color: var(--muted); }
.nav a:hover { background: #f0f1fb; }
.nav a.active { background: var(--grad); color: #fff; box-shadow: 0 10px 20px -10px rgba(236, 38, 143, 0.7); }
.nav a.active .ico { color: #fff; }
.nav .badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 700; text-align: center; background: var(--red); color: #fff; }
.nav a.active .badge { background: #fff; color: var(--red-ink); }
.side-foot { margin-top: auto; padding: 12px; border-radius: 14px; background: #f3f4fc; display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-family: var(--display); font-weight: 700; font-size: 14px; background: var(--grad); flex: none; }
.side-foot .who { min-width: 0; line-height: 1.25; }
.side-foot .who strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who span { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.icon-btn { margin-left: auto; width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: #e6e8f7; color: var(--ink); }
.main { min-width: 0; padding: 30px clamp(16px, 3vw, 40px) 60px; max-width: 1480px; width: 100%; }
.topbar { display: none; }

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(26px, 3.2vw, 36px); font-weight: 700; line-height: 1.1; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.page-head > * { min-width: 0; max-width: 100%; }
.toolbar { min-width: 0; max-width: 100%; }
.seg { max-width: 100%; }
.crumb { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--muted); }

/* ---------- buttons, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer;
  text-decoration: none; transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}
.btn:hover { text-decoration: none; background: #f6f6fd; }
.btn:active { transform: translateY(1px); }
.btn.primary { border: 0; color: #fff; background: var(--grad); box-shadow: 0 10px 22px -10px rgba(236, 38, 143, 0.75); }
.btn.primary:hover { background: var(--grad); filter: brightness(1.06); }
.btn.danger { border: 0; background: var(--red); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 34px; padding: 5px 12px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
input[type='text'], input[type='email'], input[type='password'], input[type='tel'], input[type='date'], input[type='number'], input[type='search'], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 4px rgba(123, 45, 142, 0.14); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font-weight: 600; font-size: 14px; }
.check input { accent-color: var(--purple); width: 16px; height: 16px; }
.check:has(input:checked) { border-color: var(--purple); background: #f8eefb; }

/* ---------- cards, tiles ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }
.card h2 { font-size: 18px; font-weight: 700; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
@media (min-width: 1160px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { position: relative; padding: 16px 18px 16px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; --c: var(--purple); --tint: #f4e9f7; }
.tile::after { content: ''; position: absolute; right: -26px; top: -26px; width: 86px; height: 86px; border-radius: 50%; background: var(--tint); opacity: 0.9; }
.tile .t-ico { position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--c); margin-bottom: 12px; }
.tile .t-num { position: relative; z-index: 1; font-family: var(--display); font-size: 32px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.tile .t-num small { font-size: 16px; font-weight: 600; color: var(--muted); }
.tile .t-label { position: relative; z-index: 1; margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tile .t-sub { position: relative; z-index: 1; margin-top: 2px; font-size: 12px; color: var(--muted); }
.tile.blue { --c: var(--blue); --tint: #e1f4fc; }
.tile.green { --c: var(--green); --tint: #e3f6e6; }
.tile.red { --c: var(--red); --tint: #fde6e6; }
.tile.orange { --c: var(--orange); --tint: #feeadb; }
.tile.pink { --c: var(--pink); --tint: #fde3f1; }
.tile.purple { --c: var(--purple); --tint: #f4e9f7; }
.tile.yellow { --c: #e0b300; --tint: #fdf4cc; }
.tile.alert { border-color: #f5b5b6; }
.tile.alert .t-num { color: var(--red-ink); }

/* ---------- chips, badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; background: #eef0f8; color: var(--ink-2); }
.chip .ico { width: 14px; height: 14px; }
.chip.dir-out { background: #dff3fb; color: var(--blue-ink); }
.chip.dir-in { background: #e0f5e4; color: var(--green-ink); }
.chip.dir-miss { background: #fde4e4; color: var(--red-ink); }
.chip.dir-rej { background: #feeadb; color: var(--orange-ink); }
.chip.ch-sim { background: #f1e6f5; color: var(--purple-ink); }
.chip.ch-wa { background: #dcf7e3; color: #12703a; }
.chip.ok { background: #e0f5e4; color: var(--green-ink); }
.chip.warning { background: #feeadb; color: var(--orange-ink); }
.chip.critical { background: #fde4e4; color: var(--red-ink); }
.chip.unknown { background: #eceef6; color: var(--muted); }
.chip.solid-critical { background: var(--red); color: #fff; }
.chip.solid-warning { background: var(--orange); color: #fff; }
.chip.solid-ok { background: var(--green); color: #fff; }
.pill-link { display: inline-flex; align-items: center; gap: 6px; }

.banner { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 14px; border: 1px solid; font-size: 14.5px; }
.banner .ico { margin-top: 2px; width: 20px; height: 20px; }
.banner.bad { background: #fff1f1; border-color: #f5b5b6; color: #7f1d20; }
.banner.warn { background: #fff7ea; border-color: #f8cf9e; color: #7a3d06; }
.banner.info { background: #eef7fd; border-color: #b7defa; color: #0a4a6b; }
.banner.good { background: #eefaf0; border-color: #b8e5bf; color: #166127; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; padding: 12px 14px; font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 700; background: #f8f9fe; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th.num, table.t td.num { text-align: right; }
table.t td { padding: 13px 14px; border-bottom: 1px solid #eef0f8; vertical-align: middle; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover { background: #fbfaff; }
.rep-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.rep-cell .avatar { width: 34px; height: 34px; border-radius: 11px; font-size: 13px; }
.rep-cell strong { line-height: 1.2; }
.rep-cell .chip { margin-left: 6px; vertical-align: 1px; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; min-width: 236px; }
.rep-cell span:not(.chip) { display: block; font-size: 12px; color: var(--muted); }
.tabnum { font-variant-numeric: tabular-nums; }
.zero { color: #b6bccd; }
.bar { width: 86px; height: 7px; border-radius: 999px; background: #e9ecf6; overflow: hidden; margin-top: 5px; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--green); }
.bar.warn > i { background: var(--orange); }
.bar.bad > i { background: var(--red); }
.sync { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; box-shadow: 0 0 0 3px rgba(60, 181, 74, 0.18); }
.dot.warning { background: var(--orange); box-shadow: 0 0 0 3px rgba(244, 123, 32, 0.2); }
.dot.critical { background: var(--red); box-shadow: 0 0 0 3px rgba(224, 58, 60, 0.2); }
.dot.unknown { background: #b6bccd; box-shadow: none; }
.row-link { color: inherit; font-weight: 700; }
.totals-row td { background: #f8f9fe; font-weight: 700; }

/* ---------- date toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.seg { display: inline-flex; padding: 4px; border-radius: 14px; background: #eceefa; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 13px; border-radius: 10px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.seg button:hover { background: rgba(255, 255, 255, 0.7); }
.seg button.on { background: #fff; color: var(--purple-ink); box-shadow: 0 2px 8px -2px rgba(76, 29, 149, 0.3); }
.date-pair { display: inline-flex; align-items: center; gap: 8px; }
.date-pair input { width: 150px; }

/* ---------- hourly chart ---------- */
.chart { position: relative; padding-top: 6px; }
.chart-plot { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 5px; align-items: end; height: 220px; border-bottom: 1.5px solid var(--line); background-image: linear-gradient(to top, transparent calc(25% - 1px), #eef0f8 calc(25% - 1px), #eef0f8 25%, transparent 25%), linear-gradient(to top, transparent calc(50% - 1px), #eef0f8 calc(50% - 1px), #eef0f8 50%, transparent 50%), linear-gradient(to top, transparent calc(75% - 1px), #eef0f8 calc(75% - 1px), #eef0f8 75%, transparent 75%); }
.hcol { position: relative; display: flex; flex-direction: column-reverse; height: 100%; justify-content: flex-start; border-radius: 6px 6px 0 0; cursor: default; }
.hcol .seg-bar { width: 100%; min-height: 0; }
.hcol .seg-bar:last-child { border-radius: 6px 6px 0 0; }
.hcol:hover { background: rgba(123, 45, 142, 0.07); }
.hcol .tip { position: absolute; bottom: calc(var(--h, 0%) + 8px); left: 50%; transform: translateX(-50%); z-index: 5; background: var(--ink); color: #fff; padding: 8px 11px; border-radius: 10px; font-size: 12px; line-height: 1.5; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.1s; box-shadow: 0 10px 24px -8px rgba(15, 23, 42, 0.5); }
.hcol:hover .tip, .hcol:focus .tip { opacity: 1; }
.hcol:nth-child(-n + 3) .tip { left: 0; transform: none; }
.hcol:nth-last-child(-n + 3) .tip { left: auto; right: 0; transform: none; }
.chart-axis { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 5px; margin-top: 6px; font-size: 11.5px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.chart-axis span { overflow: visible; }
.chart-ymax { position: absolute; left: 0; top: 0; font-size: 11px; color: var(--muted); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }

/* ---------- compliance ---------- */
.health-banner { display: flex; align-items: center; gap: 18px; padding: 20px 24px; border-radius: var(--r); color: #fff; margin-bottom: 20px; flex-wrap: wrap; }
.health-banner.critical { background: linear-gradient(120deg, #b3252a, #e03a3c 55%, #f47b20); box-shadow: 0 18px 34px -18px rgba(224, 58, 60, 0.8); }
.health-banner.warning { background: linear-gradient(120deg, #d9650f, #f47b20 55%, #f2c500); box-shadow: 0 18px 34px -18px rgba(244, 123, 32, 0.8); }
.health-banner.ok { background: linear-gradient(120deg, #1f7a2e, #3cb54a 55%, #29abe2); box-shadow: 0 18px 34px -18px rgba(60, 181, 74, 0.8); }
.health-banner .big { font-family: var(--display); font-size: clamp(26px, 3vw, 36px); font-weight: 700; line-height: 1.1; }
.health-banner p { margin: 4px 0 0; opacity: 0.92; }
.health-banner .counts { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.health-banner .count { background: rgba(255, 255, 255, 0.2); border-radius: 14px; padding: 8px 14px; text-align: center; min-width: 84px; }
.health-banner .count strong { display: block; font-family: var(--display); font-size: 24px; line-height: 1.1; }
.health-banner .count span { font-size: 12px; font-weight: 600; opacity: 0.95; }
.rep-health { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 16px; }
.hcard { padding: 0; overflow: hidden; border-left: 6px solid var(--green); }
.hcard.warning { border-left-color: var(--orange); }
.hcard.critical { border-left-color: var(--red); }
.hcard-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 12px; }
.hcard-head h3 { font-size: 18px; line-height: 1.2; }
.hcard-head .sub { font-size: 13px; color: var(--muted); }
.hcard-head .chip { margin-left: auto; }
.dots { display: flex; gap: 6px; padding: 0 18px 12px; }
.dots .dot { width: 12px; height: 12px; }
.issues { list-style: none; margin: 0; padding: 0 12px 6px; display: flex; flex-direction: column; gap: 8px; }
.issue { display: flex; gap: 11px; padding: 11px 12px; border-radius: 12px; font-size: 14px; line-height: 1.4; }
.issue .ico { margin-top: 1px; width: 19px; height: 19px; }
.issue strong { display: block; font-size: 13px; letter-spacing: 0.01em; margin-bottom: 1px; }
.issue.critical { background: #fff0f0; color: #7f1d20; }
.issue.critical .ico { color: var(--red); }
.issue.warning { background: #fff6e9; color: #7a3d06; }
.issue.warning .ico { color: var(--orange); }
.all-good { margin: 0 12px 12px; padding: 12px 14px; border-radius: 12px; background: #eefaf0; color: var(--green-ink); display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 14px; }
.hcard-foot { padding: 10px 18px 14px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.hcard-foot span { display: inline-flex; align-items: center; gap: 5px; }
.hcard-foot .ico { width: 14px; height: 14px; }
.hcard .issues + .hcard-foot, .hcard .all-good + .hcard-foot { margin-top: 4px; }

/* ---------- call detail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.call-hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.call-hero .avatar { width: 56px; height: 56px; border-radius: 18px; font-size: 20px; }
.call-hero h1 { font-size: clamp(24px, 3vw, 32px); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.audio-card { background: linear-gradient(135deg, #f7ecfa, #fdeaf4 55%, #fff1e6); border: 1px solid #f0d7ea; }
audio { width: 100%; height: 44px; margin-top: 8px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.sum-block { padding: 12px 0; border-top: 1px solid #eef0f8; }
.sum-block:first-child { border-top: 0; padding-top: 0; }
.sum-block h4 { font-family: var(--font); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.sum-block ul { margin: 4px 0 0; padding-left: 18px; }
.transcript { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.7; background: #fbfbff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; max-height: 420px; overflow: auto; }
.sentiment { text-transform: capitalize; }
.sentiment.positive { background: #e0f5e4; color: var(--green-ink); }
.sentiment.negative { background: #fde4e4; color: var(--red-ink); }
.sentiment.mixed { background: #feeadb; color: var(--orange-ink); }

/* ---------- number timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; }
.timeline::before { content: ''; position: absolute; left: 19px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: linear-gradient(var(--purple), var(--pink), var(--orange), var(--blue)); opacity: 0.35; }
.tl-item { position: relative; display: grid; grid-template-columns: 32px 1fr; gap: 14px; padding: 9px 0; }
.tl-dot { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--out); border: 3px solid var(--bg); }
.tl-dot.in { background: var(--in); } .tl-dot.miss { background: var(--miss); } .tl-dot.rej { background: var(--rej); }
.tl-dot .ico { width: 15px; height: 15px; }
.tl-body { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px; box-shadow: var(--shadow); }
.tl-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.tl-top time { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------- filters / pager ---------- */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.filters .wide { grid-column: span 2; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- empty / loading ---------- */
.empty { text-align: center; padding: 48px 20px; }
.empty .ico { color: #c4c8dd; margin-bottom: 10px; }
.empty h3 { font-size: 18px; margin-bottom: 4px; }
.loading { display: flex; align-items: center; gap: 12px; padding: 40px 20px; color: var(--muted); justify-content: center; font-weight: 600; }
.spinner { width: 20px; height: 20px; border: 3px solid #e3e5f3; border-top-color: var(--pink); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- modal + toast ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 20px; width: min(520px, calc(100vw - 24px)); box-shadow: 0 30px 80px -20px rgba(15, 23, 42, 0.5); background: #fff; color: var(--ink); }
dialog.modal.wide { width: min(680px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.modal-head h3 { font-size: 21px; }
.modal-body { padding: 18px 24px; display: flex; flex-direction: column; gap: 14px; max-height: min(70vh, 640px); overflow: auto; }
.modal-body h3 { font-size: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.form-error { color: var(--red-ink); font-size: 13.5px; font-weight: 600; min-height: 18px; }
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 14px; font-weight: 600; box-shadow: 0 16px 36px -12px rgba(15, 23, 42, 0.6); animation: toast-in 0.2s ease-out; max-width: min(420px, calc(100vw - 36px)); }
.toast.ok .ico { color: #6be07a; }
.toast.err { background: #7f1d20; }
.toast.out { opacity: 0; transition: opacity 0.35s; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- login ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.login-art { position: relative; overflow: hidden; padding: 48px clamp(28px, 5vw, 72px); color: #fff; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(135deg, #5f1f70 0%, #7b2d8e 28%, #ec268f 68%, #f47b20 100%); }
.login-art::before, .login-art::after { content: ''; position: absolute; border-radius: 50%; filter: blur(2px); }
.login-art::before { width: 520px; height: 520px; right: -160px; top: -140px; background: radial-gradient(circle at 30% 30%, rgba(41, 171, 226, 0.55), transparent 65%); }
.login-art::after { width: 460px; height: 460px; left: -140px; bottom: -160px; background: radial-gradient(circle at 60% 40%, rgba(242, 197, 0, 0.5), transparent 65%); }
.login-art > * { position: relative; z-index: 1; }
.login-logo { background: #fff; display: inline-flex; padding: 12px 18px; border-radius: 16px; width: fit-content; box-shadow: 0 16px 36px -16px rgba(0, 0, 0, 0.5); }
.login-logo img { height: 38px; display: block; }
.login-art h1 { font-size: clamp(34px, 4.4vw, 58px); line-height: 1.05; max-width: 14ch; font-weight: 700; margin: 36px 0 16px; }
.login-art p.lead { font-size: 18px; max-width: 42ch; opacity: 0.95; margin: 0; }
.feat { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; }
.feat li { display: flex; gap: 14px; align-items: center; font-weight: 600; }
.feat .f-ico { width: 40px; height: 40px; border-radius: 13px; background: rgba(255, 255, 255, 0.2); display: grid; place-items: center; flex: none; }
.login-foot { font-size: 13px; opacity: 0.85; }
.login-form-wrap { display: grid; place-items: center; padding: 32px 22px; }
.login-card { width: min(420px, 100%); }
.login-card h2 { font-size: 30px; margin-bottom: 6px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.login-card .btn.primary { min-height: 48px; font-size: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-2, .detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { display: block; }
  .side { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; position: sticky; top: 0; z-index: 40; background: rgba(246, 247, 253, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); margin-top: 4px; }
  .topbar img { height: 28px; display: block; }
  .main { padding: 18px 16px 104px; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px; border-radius: 12px; color: var(--muted); font-size: 11.5px; font-weight: 700; text-decoration: none; position: relative; }
  .bottom-nav a .ico { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--purple-ink); background: #f6e9f9; }
  .bottom-nav .badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; line-height: 17px; text-align: center; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px 24px 30px; }
  .login-art h1 { margin: 22px 0 10px; font-size: 34px; }
  .login-art .feat, .login-art .login-foot { display: none; }
  .health-banner .counts { margin-left: 0; width: 100%; }
  .health-banner .count { flex: 1; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .filters .wide, .filters .full { grid-column: 1 / -1; }
  .date-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; width: 100%; }
  .date-pair input { width: 100%; min-width: 0; padding-left: 8px; padding-right: 6px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
}
@media (min-width: 861px) { .bottom-nav { display: none; } }
@media (max-width: 760px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px; }
  .tile .t-num { font-size: 26px; }
  .chart-plot { height: 170px; gap: 3px; }
  .chart-axis { gap: 3px; font-size: 10px; }
  .chart-axis span:not(.show) { visibility: hidden; }
  /* tables become stacked cards */
  table.rt, table.rt tbody, table.rt tr, table.rt td { display: block; width: 100%; }
  table.rt thead { display: none; }
  table.rt tr { margin: 10px; width: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
  table.rt td { padding: 6px 0; border: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  table.rt td::before { content: attr(data-label); font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 700; text-align: left; flex: none; }
  table.rt td.first { display: block; text-align: left; padding-bottom: 8px; border-bottom: 1px dashed var(--line); margin-bottom: 4px; }
  table.rt td.first::before { display: none; }
  table.rt td.num { text-align: right; }
  table.rt tbody tr:hover { background: #fff; }
  table.rt tr.totals-row { background: #f8f9fe; }
  .page-head .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
