
/* ==========================================================================
   Daura Diphtheria ACS & Response Dashboard — CARE International
   ========================================================================== */
:root {
  --care: #e36f1e;
  --care-dark: #c25a12;
  --care-soft: #fdf0e6;
  --care-ring: rgba(227, 111, 30, 0.18);

  --ink: #17212b;
  --ink-2: #24313d;
  --muted: #68767f;
  --muted-2: #8b979f;
  --line: #e7e2db;
  --line-2: #f1eee9;
  --bg: #f6f4f1;
  --card: #ffffff;

  --navy: #101820;
  --navy-2: #18232d;

  --green: #1f7a58;
  --green-soft: #e7f4ed;
  --red: #bf3a2b;
  --red-soft: #fbeae7;
  --amber: #a86f16;
  --amber-soft: #fbf1dd;
  --blue: #2c6a9e;
  --blue-soft: #e9f1f8;
  --purple: #6847a8;
  --purple-soft: #f0ebf9;
  --burgundy: #8b2346;
  --burgundy-soft: #f8e9ee;
  --teal: #0e7288;
  --teal-soft: #e3f2f4;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 30px -24px rgba(16, 24, 40, 0.35);
  --shadow-lg: 0 24px 60px -20px rgba(16, 24, 40, 0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4, p { margin: 0; }
svg { display: block; }
::selection { background: var(--care-soft); color: var(--care-dark); }

/* ---------------------------------- shell -------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 254px;
  flex: 0 0 254px;
  background: linear-gradient(180deg, #121b24 0%, #0d141b 100%);
  color: #dbe2e8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px 14px;
  z-index: 60;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}
.care-card {
  background: #fff;
  border-radius: 11px;
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 6px 18px -10px rgba(0, 0, 0, 0.45);
}
.care-card img { width: 108px; height: auto; }
.care-card-sub {
  font-size: 9.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #8a949c;
  font-weight: 600;
}
.program-label { padding: 18px 8px 10px; }
.program-label span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #e9a06b;
  font-weight: 700;
}
.program-label small {
  display: block;
  font-size: 12px;
  color: #9aa7b1;
  margin-top: 4px;
  line-height: 1.35;
}
.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9.5px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: #b7c2cb;
  position: relative;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.nav-item svg { width: 18px; height: 18px; opacity: 0.9; }
.nav-item:hover { background: rgba(255, 255, 255, 0.055); color: #fff; }
.nav-item.active { background: rgba(227, 111, 30, 0.16); color: #fff; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--care);
}
.nav-item .nav-count {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(227, 111, 30, 0.22);
  color: #ffc79e;
  padding: 2px 7px;
  border-radius: 20px;
}
.nav-sep { height: 1px; background: rgba(255, 255, 255, 0.07); margin: 14px 8px; }
.sidebar-note {
  margin: 4px 8px auto;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: #9aa7b1;
  line-height: 1.5;
}
.sidebar-note strong { color: #e6edf2; font-weight: 600; display: block; margin-bottom: 3px; font-size: 11.5px; }
.sidebar-note .live-row { display: flex; align-items: center; gap: 7px; margin-top: 8px; color: #8fd2b5; font-weight: 600; font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; }
.sidebar-foot {
  padding: 14px 8px 2px;
  font-size: 10.5px;
  color: #6f7d88;
  line-height: 1.5;
}
.sidebar-foot b { color: #a9b5be; font-weight: 600; }

.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 14px 26px;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 74px;
}
.topbar-titles { min-width: 0; }
.crumb {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 7px;
}
.crumb .crumb-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--care); }
.topbar h1 {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.menu-btn { display: none; }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 650;
  color: var(--green);
  background: var(--green-soft);
  padding: 6px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); position: relative; }
.live-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--green);
  opacity: 0.5;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0% { transform: scale(0.7); opacity: 0.7; } 70% { transform: scale(1.6); opacity: 0; } 100% { opacity: 0; } }
.live-pill.flash { animation: flash 0.9s ease; }
@keyframes flash { 0% { background: #cdeadd; } 100% { background: var(--green-soft); } }

.updated { font-size: 11px; color: var(--muted-2); white-space: nowrap; display: none; }
@media (min-width: 1350px) { .updated { display: block; } }

.seg {
  display: inline-flex;
  background: #f0ede8;
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: 0;
  background: transparent;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.seg.hide { display: none; }

.content { padding: 22px 26px 46px; width: 100%; max-width: 1580px; margin: 0 auto; }

/* --------------------------------- buttons -------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 13px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: var(--ink-2);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--care-ring); outline-offset: 1px; }
.btn-primary { background: var(--care); color: #fff; box-shadow: 0 2px 6px -2px rgba(227, 111, 30, 0.55); }
.btn-primary:hover { background: var(--care-dark); }
.btn-outline { border-color: #dcd6cd; background: #fff; }
.btn-outline:hover { border-color: #bfb7ab; background: #fdfcfb; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f0ede8; color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #a62f22; }
.btn-sm { padding: 6px 10px; font-size: 11.5px; border-radius: 8px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; border: 1px solid var(--line); background: #fff; border-radius: 9px; color: var(--muted); }
.btn-icon:hover { color: var(--ink); border-color: #cfc7bc; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-link { background: none; border: 0; color: var(--care-dark); font-size: 11.5px; font-weight: 650; cursor: pointer; padding: 0; }
.btn-link:hover { text-decoration: underline; }

/* ---------------------------------- page ---------------------------------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.page-head p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.page-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--care-dark);
}
.eyebrow::before { content: ""; width: 14px; height: 2px; background: var(--care); border-radius: 2px; }

.lead {
  display: flex;
  align-items: center;
  gap: 18px;
  background: linear-gradient(100deg, #1b2733 0%, #243342 68%, #2d3d4e 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.lead::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(227, 111, 30, 0.34) 0%, rgba(227, 111, 30, 0) 68%);
}
.lead-main { flex: 1; min-width: 0; position: relative; z-index: 1; }
.lead h2 { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; margin-top: 6px; }
.lead p { font-size: 12.5px; color: #b8c4ce; margin-top: 4px; max-width: 720px; }
.lead-stats { display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.lead-chip {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 92px;
}
.lead-chip b { display: block; font-size: 17px; font-weight: 650; letter-spacing: -0.02em; }
.lead-chip span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: #9fb0bd; font-weight: 600; }
.lead-chip.accent b { color: #ffb27a; }

/* ---------------------------------- kpis ---------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpis.auto { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); }
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px 15px 13px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  min-width: 0;
  min-height: 118px;
  display: flex;
  flex-direction: column;
}
.kpi::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: var(--accent, var(--care));
  opacity: 0.9;
}
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.01em; line-height: 1.3; padding-top: 2px; }
.kpi-icon {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent-soft, var(--care-soft));
  color: var(--accent, var(--care));
  flex-shrink: 0;
}
.kpi-icon svg { width: 16px; height: 16px; }
.kpi-value {
  font-size: 28px;
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.kpi-value small { font-size: 12px; font-weight: 600; color: var(--muted-2); letter-spacing: 0; }
.kpi-sub { font-size: 10.5px; color: var(--muted-2); margin-top: 6px; line-height: 1.4; }
.kpi-sub b { color: var(--ink-2); font-weight: 650; }
.kpi-sub .warn { color: var(--red); font-weight: 650; }
.kpi-sub .ok { color: var(--green); font-weight: 650; }
.kpi.k-orange { --accent: var(--care); --accent-soft: var(--care-soft); }
.kpi.k-amber { --accent: var(--amber); --accent-soft: var(--amber-soft); }
.kpi.k-blue { --accent: var(--blue); --accent-soft: var(--blue-soft); }
.kpi.k-purple { --accent: var(--purple); --accent-soft: var(--purple-soft); }
.kpi.k-burgundy { --accent: var(--burgundy); --accent-soft: var(--burgundy-soft); }
.kpi.k-teal { --accent: var(--teal); --accent-soft: var(--teal-soft); }
.kpi.k-green { --accent: var(--green); --accent-soft: var(--green-soft); }
.kpi.k-red { --accent: var(--red); --accent-soft: var(--red-soft); }

/* --------------------------------- panels --------------------------------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; } .span-12 { grid-column: span 12; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 17px 0;
}
.panel-head h2 { font-size: 13.5px; font-weight: 650; letter-spacing: -0.005em; }
.panel-head p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.panel-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.panel-body { padding: 13px 17px 16px; flex: 1; min-width: 0; }
.panel-body.tight { padding: 8px 10px 10px; }
.panel-foot { border-top: 1px solid var(--line-2); padding: 10px 17px; display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--muted); }

.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }

/* --------------------------------- tables --------------------------------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
  color: var(--muted-2);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: #fff;
}
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover { background: #fbf8f4; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.mono { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.tbl .strong { font-weight: 600; color: var(--ink); }
.tbl .sub { display: block; font-size: 10.5px; color: var(--muted-2); margin-top: 1px; font-weight: 400; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-empty { padding: 34px 10px; text-align: center; color: var(--muted); font-size: 12.5px; }

.cell-person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--care-soft); color: var(--care-dark);
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em;
  flex-shrink: 0;
}
.avatar.sm { width: 26px; height: 26px; font-size: 9.5px; }
.avatar.blue { background: var(--blue-soft); color: var(--blue); }
.avatar.green { background: var(--green-soft); color: var(--green); }
.avatar.purple { background: var(--purple-soft); color: var(--purple); }
.person-name { font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-meta { font-size: 10.5px; color: var(--muted-2); margin-top: 1px; white-space: nowrap; }

/* --------------------------------- pills ---------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 8px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.5;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.pill-orange { background: var(--care-soft); color: var(--care-dark); }
.pill-amber { background: var(--amber-soft); color: var(--amber); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-purple { background: var(--purple-soft); color: var(--purple); }
.pill-burgundy { background: var(--burgundy-soft); color: var(--burgundy); }
.pill-teal { background: var(--teal-soft); color: var(--teal); }
.pill-gray { background: #f1f0ed; color: #6d787f; }
.pill-outline { background: #fff; border-color: var(--line); color: var(--muted); }
.pill-lg { font-size: 11px; padding: 4px 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 11px;
  background: #f6f3ef;
  color: #4d5a63;
  border: 1px solid #ece7e0;
}
.chip.symptom { background: #fff; border-color: #e9e3db; color: #44515a; }
.chip.symptom.severe { background: var(--red-soft); border-color: #f3d3ce; color: var(--red); }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }

/* --------------------------------- charts --------------------------------- */
.chart-wrap { width: 100%; }
.chart-svg { width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; gap: 13px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); margin-top: 6px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; }

.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut-svg { width: 168px; height: 168px; flex-shrink: 0; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.donut-legend .dl {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--muted);
}
.donut-legend .dl i { width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; }
.donut-legend .dl b { margin-left: auto; color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 112px 1fr 34px; align-items: center; gap: 10px; }
.bar-label { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; background: #f2efea; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #ee8a44, var(--care)); }
.bar-fill.blue { background: linear-gradient(90deg, #6ea8d4, var(--blue)); }
.bar-value { font-size: 11px; font-weight: 650; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.bar-row .bar-sub { grid-column: 2 / 4; margin-top: -6px; font-size: 9.5px; color: var(--muted-2); }

.age-chart { display: flex; flex-direction: column; gap: 7px; }
.age-row { display: grid; grid-template-columns: 26px 1fr 40px 1fr 26px; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted); position: relative; padding: 2px 0; }
.age-band { text-align: center; font-size: 9.5px; color: #68767f; font-weight: 600; white-space: nowrap; }
.age-side { display: flex; align-items: center; gap: 5px; }
.age-side.left { justify-content: flex-end; }
.age-bar { height: 7px; border-radius: 3px; background: var(--blue); }
.age-bar.f { background: var(--care); }
.age-val { font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.age-val.left { text-align: right; }
.age-axis { display: flex; justify-content: space-between; font-size: 9px; color: var(--muted-2); padding: 0 2px 4px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }

/* -------------------------------- progress -------------------------------- */
.progress-list { display: flex; flex-direction: column; gap: 13px; }
.progress-item .pl-top { display: flex; align-items: baseline; gap: 6px; margin-bottom: 5px; }
.progress-item .pl-label { font-size: 11.5px; color: var(--ink-2); font-weight: 550; }
.progress-item .pl-val { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.progress-track { height: 7px; background: #f1eee9; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--green); }
.progress-fill.orange { background: var(--care); }
.progress-fill.amber { background: #d79a2b; }
.progress-fill.red { background: var(--red); }
.progress-fill.blue { background: var(--blue); }
.progress-item .pl-sub { font-size: 10px; color: var(--muted-2); margin-top: 3px; }

/* --------------------------------- alerts --------------------------------- */
.alert-list { display: flex; flex-direction: column; }
.alert-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
  align-items: flex-start;
}
.alert-item:last-child { border-bottom: 0; }
.alert-ico {
  width: 27px; height: 27px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--red-soft); color: var(--red);
}
.alert-ico svg { width: 14px; height: 14px; }
.alert-item.medium .alert-ico { background: var(--amber-soft); color: var(--amber); }
.alert-item.info .alert-ico { background: var(--blue-soft); color: var(--blue); }
.alert-main { flex: 1; min-width: 0; }
.alert-title { font-size: 12px; font-weight: 650; color: var(--ink); display: flex; gap: 6px; align-items: center; }
.alert-detail { font-size: 11px; color: var(--muted); margin-top: 1px; line-height: 1.4; }
.alert-meta { font-size: 10px; color: var(--muted-2); white-space: nowrap; padding-top: 2px; text-transform: uppercase; letter-spacing: .04em; }
.alert-open { font-size: 10.5px; font-weight: 650; color: var(--care-dark); margin-left: 4px; white-space: nowrap; cursor: pointer; }
.alert-open:hover { text-decoration: underline; }

/* ------------------------------ isolation --------------------------------- */
.iso-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.iso-card { border: 1px solid var(--line); border-radius: 11px; padding: 12px; background: #fffdfb; }
.iso-card .iso-top { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.iso-card .iso-ico { width: 26px; height: 26px; border-radius: 7px; background: var(--burgundy-soft); color: var(--burgundy); display: grid; place-items: center; flex-shrink: 0; }
.iso-card .iso-ico svg { width: 14px; height: 14px; }
.iso-name { font-size: 11.5px; font-weight: 650; line-height: 1.3; color: var(--ink); }
.iso-loc { font-size: 9.5px; color: var(--muted-2); margin-top: 1px; }
.iso-numbers { display: flex; align-items: baseline; gap: 4px; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.iso-numbers b { font-size: 18px; font-weight: 680; color: var(--ink); letter-spacing: -0.02em; }
.iso-meter { height: 6px; border-radius: 3px; background: #f1eee9; overflow: hidden; }
.iso-meter i { display: block; height: 100%; border-radius: 3px; background: var(--burgundy); }
.iso-meter i.warn { background: #d79a2b; }
.iso-meter i.full { background: var(--red); }
.iso-meta { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--muted-2); margin-top: 4px; }

/* ------------------------------- toolbox ---------------------------------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.toolbar .grow { flex: 1; }
.search {
  position: relative;
  min-width: 220px;
  flex: 1;
  max-width: 340px;
}
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted-2); pointer-events: none; }
.search input { width: 100%; padding-left: 32px; }
input, select, textarea {
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  border: 1px solid #ddd7ce;
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  height: 36px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}
textarea { height: auto; min-height: 78px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--care); box-shadow: 0 0 0 3px var(--care-ring); }
input::placeholder { color: #a7b0b7; }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2368767f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; cursor: pointer; }
.filter-select { max-width: 190px; }
.toolbar-label { font-size: 10.5px; color: var(--muted-2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding-left: 2px; }
.spacer { flex: 1; }

.pager { display: flex; align-items: center; gap: 8px; padding: 12px 4px 0; font-size: 11.5px; color: var(--muted); }
.pager .pages { margin-left: auto; display: flex; gap: 4px; }
.pager button { min-width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line); background: #fff; font-size: 11.5px; cursor: pointer; color: var(--muted); }
.pager button.active { background: var(--care); color: #fff; border-color: var(--care); font-weight: 650; }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }

/* -------------------------------- drawer ---------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 20, 26, 0.42);
  backdrop-filter: blur(2px);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: 720px;
  max-width: 96vw;
  background: var(--bg);
  z-index: 90;
  box-shadow: -20px 0 60px -20px rgba(14, 20, 26, 0.4);
  transform: translateX(102%);
  transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drawer.show { transform: translateX(0); }
.drawer-head {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 16px 20px 14px;
  position: relative;
}
.drawer-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 30px; height: 30px;
  border: 0; background: #f4f1ec; border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: grid; place-items: center;
}
.drawer-close:hover { background: #ebe6df; color: var(--ink); }
.drawer-close svg { width: 15px; height: 15px; }
.drawer-identity { display: flex; gap: 12px; align-items: center; padding-right: 34px; }
.drawer-identity .avatar { width: 44px; height: 44px; font-size: 14px; border-radius: 12px; }
.drawer-name { font-size: 17px; font-weight: 650; letter-spacing: -0.015em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drawer-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.drawer-sub .dotsep { color: #c9c2b8; }
.drawer-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 14px; }
.drawer-tabs {
  display: flex;
  gap: 2px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
  flex-shrink: 0;
}
.drawer-tab {
  border: 0; background: none;
  font-size: 12px; font-weight: 600;
  color: var(--muted);
  padding: 10px 11px 9px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.drawer-tab.active { color: var(--ink); border-bottom-color: var(--care); }
.drawer-tab .count { font-size: 9.5px; background: #efece7; border-radius: 20px; padding: 1px 6px; margin-left: 4px; color: var(--muted); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 40px; }
.drawer-section { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; margin-bottom: 12px; }
.drawer-section h3 { font-size: 12px; font-weight: 650; letter-spacing: 0.01em; margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.drawer-section h3 svg { width: 14px; height: 14px; color: var(--muted); }
.dl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 18px; }
.dl-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dl-item .dt { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted-2); font-weight: 650; }
.dl-item .dd { font-size: 12px; color: var(--ink); margin-top: 2px; word-break: break-word; line-height: 1.4; }
.dl-item .dd.mono { font-family: var(--mono); font-size: 11px; }
.dl-item .dd.muted { color: var(--muted); }

.timeline { position: relative; padding-left: 25px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 15px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -25px; top: 1px;
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--care-soft); color: var(--care-dark);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}
.tl-dot svg { width: 9px; height: 9px; }
.tl-dot.blue { background: var(--blue-soft); color: var(--blue); }
.tl-dot.green { background: var(--green-soft); color: var(--green); }
.tl-dot.purple { background: var(--purple-soft); color: var(--purple); }
.tl-dot.burgundy { background: var(--burgundy-soft); color: var(--burgundy); }
.tl-dot.red { background: var(--red-soft); color: var(--red); }
.tl-dot.gray { background: #f0eeea; color: #7b868d; }
.tl-dot.amber { background: var(--amber-soft); color: var(--amber); }
.tl-dot.teal { background: var(--teal-soft); color: var(--teal); }
.tl-title { font-size: 12px; font-weight: 600; color: var(--ink); }
.tl-desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.tl-meta { font-size: 10px; color: var(--muted-2); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.tl-meta b { font-weight: 600; color: #7c8890; }

.contact-card { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; display: flex; gap: 10px; align-items: flex-start; }
.contact-card:last-child { margin-bottom: 0; }
.contact-main { flex: 1; min-width: 0; }
.contact-name { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.contact-meta { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.contact-side { text-align: right; flex-shrink: 0; font-size: 10px; color: var(--muted-2); }
.contact-side .pill { margin-bottom: 4px; }
.visit-dots { display: inline-flex; gap: 3px; margin-left: 4px; }
.visit-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); opacity: .8; }
.visit-dot.miss { background: #d8d3cc; }
.treatment-card { border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 12px; margin-bottom: 8px; }
.treatment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.treatment-date { font-size: 11px; font-weight: 650; color: var(--ink-2); }
.treatment-meta { font-size: 10.5px; color: var(--muted); margin-top: 6px; }
.mini-empty { padding: 18px 8px; text-align: center; font-size: 11.5px; color: var(--muted-2); }

/* --------------------------------- modal ---------------------------------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(14, 20, 26, 0.45);
  backdrop-filter: blur(3px);
  overflow-y: auto;
}
.modal {
  background: #fff;
  border-radius: 15px;
  width: 620px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.18s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal.wide { width: 760px; }
.modal-head { padding: 18px 20px 0; display: flex; gap: 12px; align-items: flex-start; }
.modal-head h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.modal-head p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.modal-close { margin-left: auto; border: 0; background: #f4f1ec; width: 28px; height: 28px; border-radius: 7px; cursor: pointer; color: var(--muted); display: grid; place-items: center; flex-shrink: 0; }
.modal-close svg { width: 14px; height: 14px; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; align-items: center; background: #fdfcfa; border-radius: 0 0 15px 15px; }
.modal-foot .spacer { flex: 1; }
.form-error { background: var(--red-soft); color: var(--red); border: 1px solid #f2d2cd; border-radius: 8px; padding: 8px 10px; font-size: 11.5px; margin-bottom: 10px; display: none; }
.form-error.show { display: block; }
.form-note { font-size: 10.5px; color: var(--muted-2); margin-top: 8px; line-height: 1.5; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 10.5px; font-weight: 650; color: var(--ink-2); letter-spacing: 0.01em; }
.field > label .req { color: var(--care); margin-left: 2px; }
.field .hint { font-size: 9.5px; color: var(--muted-2); }
.field input, .field select, .field textarea { width: 100%; }
.check-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.check-chip { position: relative; }
.check-chip input { position: absolute; opacity: 0; pointer-events: none; }
.check-chip span {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid #e2ddd5; border-radius: 8px;
  padding: 6px 9px; font-size: 11px; color: #4f5b64; cursor: pointer;
  background: #fff; transition: all 0.12s;
}
.check-chip input:checked + span { background: var(--care-soft); border-color: var(--care); color: var(--care-dark); font-weight: 600; }
.check-chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--care-ring); }

.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radio-card { position: relative; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card .rc {
  border: 1.5px solid #e2ddd5; border-radius: 10px; padding: 10px 12px; cursor: pointer; height: 100%;
  transition: all 0.12s; background: #fff;
}
.radio-card .rc strong { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: var(--ink); }
.radio-card .rc strong svg { width: 14px; height: 14px; color: var(--muted); }
.radio-card .rc span { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.radio-card input:checked + .rc { border-color: var(--care); background: var(--care-soft); }
.radio-card input:checked + .rc strong svg { color: var(--care-dark); }
.radio-card input:focus-visible + .rc { box-shadow: 0 0 0 3px var(--care-ring); }

.conditional { display: none; }
.conditional.show { display: block; }

/* --------------------------------- toasts --------------------------------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast {
  background: #18232d;
  color: #e8eef3;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 12px;
  box-shadow: 0 70px 40px -30px rgba(0,0,0,.4);
  display: flex;
  gap: 9px;
  align-items: flex-start;
  animation: toastIn 0.2s ease;
  border-left: 3px solid var(--care);
}
.toast.success { border-left-color: #43a97b; }
.toast.error { border-left-color: #e05949; }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; color: #ffb27a; }
.toast.success svg { color: #7fd4ab; }
.toast.error svg { color: #ff9c8f; }
.toast b { font-weight: 650; }
.toast .toast-sub { display: block; font-size: 10.5px; color: #a9b8c3; margin-top: 1px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --------------------------------- misc ----------------------------------- */
.empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
}
.empty .empty-ico {
  width: 42px; height: 42px; margin: 0 auto 10px;
  border-radius: 12px; background: var(--care-soft); color: var(--care);
  display: grid; place-items: center;
}
.empty .empty-ico svg { width: 20px; height: 20px; }
.empty h3 { font-size: 13px; color: var(--ink-2); font-weight: 650; margin-bottom: 3px; }
.empty p { font-size: 11.5px; max-width: 320px; margin: 0 auto; line-height: 1.5; }

.skeleton { background: linear-gradient(90deg, #f0ede8 25%, #f7f5f2 37%, #f0ede8 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite linear; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.sk-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px; }
.sk-kpi { height: 108px; border-radius: 13px; }
.sk-panel { height: 280px; border-radius: 14px; margin-bottom: 14px; }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--amber-soft); border: 1px solid #f0dfba;
  border-radius: 10px; padding: 11px 13px;
  font-size: 11.5px; color: #7a5a18; line-height: 1.5;
  margin-bottom: 12px;
}
.notice svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.notice b { font-weight: 650; }
.notice.info { background: var(--blue-soft); border-color: #d3e2ef; color: #315f82; }

.code-box {
  background: #1a242e;
  color: #dfe8ef;
  border-radius: 9px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}
.code-box code { flex: 1; min-width: 0; }
.code-box .btn-copy { background: rgba(255,255,255,.09); color: #cfdae2; border: 0; border-radius: 6px; padding: 5px 8px; font-size: 10px; font-weight: 600; cursor: pointer; flex-shrink: 0; }
.code-box .btn-copy:hover { background: rgba(255,255,255,.16); }

.steps { display: flex; flex-direction: column; gap: 11px; margin-top: 4px; }
.step { display: flex; gap: 10px; }
.step .n {
  width: 20px; height: 20px; border-radius: 50%; background: var(--care-soft); color: var(--care-dark);
  font-size: 10px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; margin-top: 1px;
}
.step .s-title { font-size: 11.5px; font-weight: 650; color: var(--ink); }
.step .s-body { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.55; }
.step code, .kbd { font-family: var(--mono); font-size: 10px; background: #f3f0eb; border: 1px solid #e7e1d8; border-radius: 4px; padding: 1px 4px; }

.kv-list { display: flex; flex-direction: column; gap: 8px; }
.kv { display: flex; gap: 10px; align-items: baseline; font-size: 11.5px; }
.kv .k { color: var(--muted); flex: 1; }
.kv .v { font-weight: 650; color: var(--ink-2); text-align: right; }
.kv .v.good { color: var(--green); }
.kv .v.bad { color: var(--red); }

.mapping-tbl { font-size: 11px; }
.mapping-tbl td { vertical-align: top; }
.mapping-tbl code { font-size: 10px; background: #f4f1ec; padding: 1px 4px; border-radius: 4px; }

.dq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.dq-item { border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 10px; }
.dq-item .dq-n { font-size: 18px; font-weight: 680; letter-spacing: -0.02em; }
.dq-item .dq-l { font-size: 10px; color: var(--muted); margin-top: 1px; line-height: 1.35; }
.dq-item.warn .dq-n { color: var(--amber); }
.dq-item.bad .dq-n { color: var(--red); }

.settings-card { max-width: 880px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.settings-section { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 16px; box-shadow: var(--shadow); }
.settings-section h3 { font-size: 12.5px; font-weight: 650; margin-bottom: 3px; }
.settings-section p.sub { font-size: 11px; color: var(--muted); margin-bottom: 12px; line-height: 1.5; }
.settings-section.full { grid-column: 1 / -1; }
.settings-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }

.team-row { display: flex; gap: 8px; margin-bottom: 6px; }
.team-row input { flex: 1; }
.team-row input.role { flex: 1.2; }

.brand-about { display: flex; gap: 14px; align-items: center; }
.brand-about img { width: 110px; height: auto; flex-shrink: 0; }
.brand-about p { font-size: 11.5px; color: var(--muted); line-height: 1.6; }

.export-card { border: 1px solid var(--line); border-radius: 11px; padding: 13px; display: flex; gap: 11px; align-items: flex-start; background: #fff; }
.export-card .ex-ico { width: 32px; height: 32px; border-radius: 9px; background: var(--green-soft); color: var(--green); display: grid; place-items: center; flex-shrink: 0; }
.export-card .ex-ico svg { width: 15px; height: 15px; }
.export-card h4 { font-size: 12px; font-weight: 650; }
.export-card p { font-size: 10.5px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.export-card .btn { margin-top: 9px; }

.indicator-guide { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.indicator-guide b { color: var(--ink-2); }

/* ------------------------------- responsive ------------------------------- */
@media (max-width: 1440px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .span-3, .span-4, .span-5 { grid-column: span 6; }
  .span-7, .span-8, .span-9 { grid-column: span 12; }
  .content { padding: 18px; }
  .topbar { padding: 12px 18px; }
}
@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar-sub { display: none; }
}
@media (max-width: 760px) {
  .hide-sm { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { gap: 8px; padding: 10px 12px; }
  .topbar .crumb { display: none; }
  .topbar h1 { font-size: 16px; white-space: normal; line-height: 1.2; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .updated { display: none; }
  #newCaseBtn { font-size: 11.5px; padding: 7px 10px; }
  .content { padding: 12px; }
  .lead { padding: 15px 16px; gap: 12px; }
  .lead h2 { font-size: 16px; }
  .lead-chip b { font-size: 15px; }
  .span-3, .span-4, .span-5, .span-6 { grid-column: span 12; }
  .lead { flex-direction: column; align-items: flex-start; }
  .lead-stats { width: 100%; }
  .lead-chip { flex: 1; min-width: 0; }
  .topbar-actions .live-pill, .topbar-actions .seg { display: none; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .dl-grid, .dl-grid.three { grid-template-columns: 1fr; }
  .donut-wrap { flex-direction: column; }
  .donut-svg { width: 150px; height: 150px; }
  .drawer { max-width: 100vw; }
  .radio-cards { grid-template-columns: 1fr; }
  .sk-kpis { grid-template-columns: repeat(2, 1fr); }
  .topbar h1 { font-size: 17px; }
  .topbar { min-height: 64px; }
}

@media print {
  .sidebar, .topbar, .toasts, .drawer, .overlay, .btn, .menu-btn { display: none !important; }
  body { background: #fff; font-size: 10pt; }
  .content { padding: 0; max-width: none; }
  .panel, .kpi, .settings-section { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .grid { display: block; }
  .panel { margin-bottom: 10px; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  a { text-decoration: none; }
}


/* ====================================================================== */
/* Refined visual layer — typography, surfaces, spacing (2026-11)          */
/* Purely presentational: no layout, data or behaviour is changed here.    */
/* ====================================================================== */
:root{
  --bg: #f4f2ee;
  --line: #e6e0d7;
  --line-2: #f1ede6;
  --muted: #66747e;
  --muted-2: #8a969e;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 14px 34px -26px rgba(16,24,40,.42);
  --shadow-lg: 0 30px 70px -28px rgba(16,24,40,.45);
}
body{
  background:
    radial-gradient(900px 430px at 10% -8%, #fff8ef 0%, rgba(255,248,239,0) 62%),
    radial-gradient(760px 400px at 96% -4%, #edf3f7 0%, rgba(237,243,247,0) 60%),
    var(--bg);
  background-attachment: fixed;
  font-size: 13.6px;
  letter-spacing: -0.002em;
}
h1, h2, h3 { letter-spacing: -0.02em; }
:focus-visible { outline: 2px solid rgba(227,111,30,.5); outline-offset: 2px; border-radius: 6px; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #dcd5c9; border: 3px solid transparent; border-radius: 10px; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #c9c0b1; background-clip: content-box; border: 3px solid transparent; }

/* ---- shell ---------------------------------------------------------- */
.sidebar{
  background: linear-gradient(184deg, #111b24 0%, #0c131a 58%, #0e1721 100%);
  border-right: 1px solid rgba(255,255,255,.05);
  padding: 18px 13px 16px;
}
.care-card{
  border-radius: 14px;
  background: linear-gradient(180deg,#fff,#fdfbf7);
  box-shadow: 0 14px 28px -20px rgba(0,0,0,.85), inset 0 1px 0 rgba(255,255,255,.9);
}
.program-label span { color: #f0a468; letter-spacing: .16em; }
.program-label small { color: #93a1ac; }
.nav-item{
  border-radius: 11px;
  padding: 10px 12px;
  font-weight: 520;
  transition: background .16s, color .16s, box-shadow .16s;
}
.nav-item.active{
  background: linear-gradient(90deg, rgba(227,111,30,.24), rgba(227,111,30,.05));
  box-shadow: inset 0 0 0 1px rgba(227,111,30,.20);
}
.nav-item.active::before { top: 9px; bottom: 9px; width: 3.5px; box-shadow: 0 0 12px rgba(227,111,30,.8); }

.topbar{
  background: rgba(255,255,255,.84);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid rgba(23,33,43,.07);
  padding: 14px 28px;
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset;
}
.topbar h1 { font-size: 21.5px; font-weight: 680; }
.crumb { color: #93a0a9; letter-spacing: .12em; }
.content { padding: 22px 28px 56px; }
.grid { gap: 16px; margin-bottom: 16px; }

/* ---- panels & cards ------------------------------------------------- */
.panel{
  border: 1px solid rgba(23,33,43,.075);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow .2s ease, border-color .2s ease;
}
.panel:hover { box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 20px 42px -30px rgba(16,24,40,.55); border-color: rgba(23,33,43,.11); }
.panel-head{
  padding: 15px 18px 12px;
  border-bottom: 1px solid var(--line-2);
  align-items: center;
}
.panel-head h2 { font-size: 13.8px; font-weight: 690; letter-spacing: -.015em; }
.panel-head p { font-size: 11.4px; color: var(--muted); margin-top: 3px; }
.panel-body { padding: 14px 18px 17px; }
.panel-body.tight { padding: 6px 8px 8px; }
.panel-foot { border-top: 1px solid var(--line-2); }

.page-head { margin-bottom: 18px; align-items: flex-end; }
.page-head h2 { font-size: 19px; font-weight: 690; }
.page-head p { font-size: 12.4px; color: var(--muted); max-width: 84ch; }
.eyebrow { letter-spacing: .14em; }

/* ---- tables --------------------------------------------------------- */
.tbl th{
  background: #faf8f4;
  font-size: 9.6px;
  letter-spacing: .095em;
  color: #78858e;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid #f3efe8; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fdfaf6; }
.tbl .sub, .tbl .person-meta { color: var(--muted-2); }
.table-wrap { border-radius: 10px; }

/* ---- controls ------------------------------------------------------- */
.btn { border-radius: 10px; font-weight: 640; letter-spacing: -.006em; }
.btn-primary{
  background: linear-gradient(180deg,#f0802d,#dd6413);
  box-shadow: 0 8px 18px -10px rgba(221,100,19,.75), inset 0 1px 0 rgba(255,255,255,.22);
}
.btn-primary:hover { background: linear-gradient(180deg,#f48b39,#d75c0b); }
.btn-outline{
  border-color: #ded7cb;
  background: linear-gradient(180deg,#fff,#fdfbf8);
  color: #24313d;
}
.btn-outline:hover { border-color: #cbbfae; background: #fff; box-shadow: 0 3px 10px -8px rgba(16,24,40,.6); }
.btn-ghost:hover { background: #f4f0ea; }
input, select, textarea { border-radius: 10px; }
input:focus, select:focus, textarea:focus { border-color: #e0b48c; box-shadow: 0 0 0 3px rgba(227,111,30,.14); }
.toolbar{
  border: 1px solid rgba(23,33,43,.07);
  border-radius: 15px;
  background: rgba(255,255,255,.9);
  padding: 10px 14px;
  box-shadow: var(--shadow);
}
.seg { background: #efeae2; }
.seg button.active { box-shadow: 0 2px 6px -3px rgba(16,24,40,.5); }
.live-pill { box-shadow: inset 0 0 0 1px rgba(31,122,88,.12); }
.pill { font-weight: 690; letter-spacing: .005em; }
.pill-outline { border-color: #e3ddd2; background: #fff; }

/* ---- hero banner ---------------------------------------------------- */
.lead{
  border-radius: 18px;
  background: linear-gradient(118deg, #141e28 0%, #1c2833 48%, #263542 100%);
  box-shadow: 0 26px 54px -38px rgba(16,24,40,.95), inset 0 1px 0 rgba(255,255,255,.06);
  padding: 20px 24px;
}
.lead h2 { font-size: 19.5px; font-weight: 680; }
.lead-chip { border-radius: 12px; background: rgba(255,255,255,.07); box-shadow: inset 0 1px 0 rgba(255,255,255,.07); }
.lead-chip b { font-size: 18px; font-weight: 700; }

/* ---- summary infographics ------------------------------------------ */
[data-figure]{
  border: 1px solid rgba(23,33,43,.075) !important;
  border-radius: 16px !important;
  background: linear-gradient(180deg,#fff 0%,#fffdfa 100%) !important;
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 16px 30px -28px rgba(16,24,40,.55);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
[data-figure]:hover{
  transform: translateY(-2px);
  border-color: rgba(23,33,43,.12) !important;
  box-shadow: 0 2px 4px rgba(16,24,40,.05), 0 24px 44px -30px rgba(16,24,40,.65);
}

/* ---- misc surfaces -------------------------------------------------- */
.dl-item { border-radius: 12px; }
.empty { padding: 40px 16px; }
.empty .empty-ico { border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(227,111,30,.12); }
.drawer, .modal { border-radius: 18px; }
.toast-item, .toast { border-radius: 12px; }
.settings-section { border-radius: var(--radius); }
.skeletons, .skeleton { border-radius: 12px; }

/* daily-import status chip in the Overview toolbar */
.daily-chip{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.3px;
  color: var(--muted);
  background: #f7fbf8;
  border: 1px solid #dcebe1;
  border-radius: 999px;
  padding: 6px 12px 6px 11px;
  white-space: nowrap;
}
.daily-chip b { color: #17614a; font-weight: 700; }
.daily-chip .dot{
  width: 7px; height: 7px; border-radius: 50%; background: #1f9d6f; position: relative; flex: none;
}
.daily-chip .dot::after{
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid rgba(31,157,111,.45); animation: dailyPulse 2.4s ease-out infinite;
}
@keyframes dailyPulse{
  0% { transform: scale(.7); opacity: .9; }
  70% { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce){ .daily-chip .dot::after{ animation: none; } }
@media (max-width: 900px){ .daily-chip{ display: none; } }


.preview-banner {
  position: relative; z-index: 70; display: flex; gap: 8px; align-items: center;
  background: linear-gradient(90deg, #fff3e6, #fde9d6);
  color: #7a4a12; font-size: 11.5px; line-height: 1.5;
  padding: 8px 18px; border-bottom: 1px solid #f0d6b6;
}
.preview-banner strong { color: #a35a12; white-space: nowrap; }
.preview-banner .pb-short { display: none; }
@media (max-width: 760px) {
  .preview-banner { font-size: 10.5px; padding: 6px 12px; align-items: baseline; }
  .preview-banner .pb-full { display: none; }
  .preview-banner .pb-short { display: inline; }
}

/* ==========================================================================
   Case map & GPS tracking
   ========================================================================== */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .map-layout { grid-template-columns: 1fr; } }
.map-box { height: 560px; border-radius: 0 0 12px 12px; overflow: hidden; background: #eef1f4; z-index: 1; }
@media (max-width: 760px) { .map-box { height: 420px; } }
.map-loading { height: 560px; padding: 14px; }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 16px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line-2); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.map-legend i.sq { border-radius: 3px; }
.map-results { display: flex; flex-direction: column; max-height: 623px; overflow-y: auto; }
.map-result { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; transition: background .12s; }
.map-result:hover { background: #fbf8f4; }
.map-result:last-child { border-bottom: 0; }
.map-result .btn { margin-left: auto; flex-shrink: 0; }

/* leaflet marker pins */
.gps-marker { background: transparent; border: 0; }
.gps-dot { width: 18px; height: 18px; border-radius: 50%; display: block; border: 3px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.4); }
.gps-dot.sm { width: 12px; height: 12px; border-width: 2px; flex-shrink: 0; }
.gps-sq { width: 14px; height: 14px; border-radius: 3px; display: block; border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.4); }
.gps-fac { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 800; border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.4); }

/* leaflet popups */
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: 0 12px 32px -12px rgba(16,24,40,.4); }
.leaflet-popup-content { margin: 14px 16px; line-height: 1.45; }
.map-pop { min-width: 230px; max-width: 300px; font-family: var(--font); }
.map-pop-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.map-pop-code { font-size: 10.5px; color: var(--muted-2); margin: 2px 0 10px; font-family: var(--mono); }
.map-pop-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 11.5px; margin-bottom: 12px; }
.map-pop-grid span { color: var(--muted-2); }
.map-pop-grid b { color: var(--ink-2); font-weight: 600; }
.map-pop-grid b.mono { font-family: var(--mono); font-size: 10.5px; }
.map-pop-actions { display: flex; gap: 8px; }

/* small check chips for layer toggles */
.check-chip.sm span { font-size: 11px; padding: 5px 9px; }
