/* HeRAMS oPt public dashboard - soft HeRAMS palette */
:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #3f4652;
  --ink-2: #6b7280;
  --ink-3: #9aa1ad;
  --line: #e6e9ef;
  --brand: #4b70c0;
  --brand-2: #7596ca;
  --brand-soft: #dce5f0;
  --brand-softer: #eef2f9;
  --accent: #fea920;
  --accent-soft: #fff0d8;
  --good: #66799d;
  --partial: #feca77;
  --bad: #d18e8f;
  --destroyed: #c9737b;
  --closed: #96a3b4;
  --na: #e6e6e6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 41, 55, .04), 0 4px 16px rgba(31, 41, 55, .05);
  --side: 248px;
  font-family: 'Source Sans 3', 'Source Sans Pro', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
button { font: inherit; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side); flex: 0 0 var(--side); background: #fff; border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.brand img { width: 34px; height: 38px; object-fit: contain; }
.brand .t1 { font-weight: 700; font-size: 17px; color: var(--ink); letter-spacing: .2px; }
.brand .t2 { font-size: 12px; color: var(--ink-2); }
.nav { padding: 10px 10px 16px; flex: 1; }
.nav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-3); padding: 14px 10px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--ink);
  text-decoration: none; font-size: 14px; margin: 1px 0;
}
.nav a:hover { background: var(--brand-softer); }
.nav a.active { background: var(--brand-soft); color: #2f4f86; font-weight: 600; }
.nav a .ico { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; }
.nav a .ico img { width: 20px; height: 20px; object-fit: contain; }
.nav a .ico svg { width: 18px; height: 18px; stroke: var(--brand-2); }
.side-foot { padding: 14px 18px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.side-foot img { width: 120px; display: block; margin-bottom: 10px; opacity: .95; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 18px 28px 6px; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 24px; font-weight: 700; color: var(--ink); letter-spacing: .2px; }
.topbar .sub { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.topbar .grow { flex: 1; }
.asof { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.chip b { color: var(--ink); font-weight: 600; }
.chip.preview { background: var(--accent-soft); border-color: #f5d9a8; color: #8a5a00; }
.menu-btn { display: none; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 10px; cursor: pointer; }

/* ---------- filters ---------- */
.filters {
  position: sticky; top: 0; z-index: 500; background: rgba(244, 246, 250, .94); backdrop-filter: blur(6px);
  padding: 10px 28px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid transparent;
}
.filters.stuck { border-bottom-color: var(--line); }
.ms { position: relative; }
.ms > button {
  display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 11px; cursor: pointer; min-width: 150px; max-width: 230px; color: var(--ink); text-align: left;
}
.ms > button .lbl { font-size: 11px; color: var(--ink-3); display: block; line-height: 1.1; }
.ms > button .val { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.ms > button .txt { flex: 1; min-width: 0; }
.ms > button.on { border-color: #b9c8e4; background: var(--brand-softer); }
.ms > button::after { content: ''; width: 7px; height: 7px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(45deg) translateY(-2px); }
.ms .pop {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 1000; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(31, 41, 55, .12); width: 290px; max-height: 360px; overflow: hidden; flex-direction: column;
}
.ms.open .pop { display: flex; }
.ms .pop input[type=search] { margin: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; outline: none; }
.ms .pop .opts { overflow-y: auto; padding: 0 6px 6px; }
.ms .pop label { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.ms .pop label:hover { background: var(--brand-softer); }
.ms .pop label.sub { padding-left: 28px; }
.ms .pop label .n { margin-left: auto; color: var(--ink-3); font-size: 12px; }
.ms .pop .acts { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding: 8px 10px; }
.ms .pop .acts button { background: none; border: 0; color: var(--brand); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.reset { background: none; border: 0; color: var(--brand); cursor: pointer; font-size: 13px; padding: 6px 8px; }
.fcount { font-size: 13px; color: var(--ink-2); margin-left: auto; }
.fcount b { color: var(--ink); }

/* ---------- content ---------- */
.page { padding: 8px 28px 28px; display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; position: relative; }
.card h3 { margin: 0 0 2px; font-size: 15px; font-weight: 600; color: var(--ink); }
.card .hint { color: var(--ink-2); font-size: 12px; margin: 0 0 8px; }
.card .chart { width: 100%; height: 300px; }
.card .chart.tall { height: 360px; }
.card .chart.short { height: 240px; }
.c12 { grid-column: span 12; } .c8 { grid-column: span 8; } .c7 { grid-column: span 7; } .c6 { grid-column: span 6; }
.c5 { grid-column: span 5; } .c4 { grid-column: span 4; } .c3 { grid-column: span 3; }
.card-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.card-head .grow { flex: 1; min-width: 160px; }

.kpis { grid-column: span 12; display: grid; grid-template-columns: 1.15fr repeat(4, 1fr); gap: 16px; }
.kpi { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .k-l { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.kpi .k-v { font-size: 30px; font-weight: 700; color: var(--ink); line-height: 1.1; margin-top: 4px; }
.kpi .k-p { font-size: 13px; color: var(--ink-2); margin-left: 6px; font-weight: 600; }
.kpi .k-d { font-size: 12px; color: var(--ink-3); margin-top: 6px; line-height: 1.35; }
.kpi .bar { height: 6px; border-radius: 6px; background: #eef0f4; margin-top: 10px; overflow: hidden; }
.kpi .bar i { display: block; height: 100%; border-radius: 6px; }
.kpi.total { background: linear-gradient(135deg, #4b70c0, #7596ca); color: #fff; }
.kpi.total .k-l, .kpi.total .k-d { color: rgba(255, 255, 255, .85); }
.kpi.total .k-v { color: #fff; font-size: 36px; }
.kpi .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }

.info-card { display: flex; flex-direction: column; gap: 10px; }
.since { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.since div { background: var(--brand-softer); border-radius: 10px; padding: 10px 12px; }
.since b { display: block; font-size: 15px; color: var(--ink); }
.since span { font-size: 12px; color: var(--ink-2); }

.seg { display: inline-flex; background: #f1f3f7; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); font-weight: 600; }

select.pick { font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; background: #fff; color: var(--ink); max-width: 100%; }
.range { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.range select { font: inherit; font-size: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; background: #fff; }
.cf-note { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.cf-note span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 10px; border-radius: 3px; display: inline-block; background: #8ea0bf; }
.sw.cf { background: repeating-linear-gradient(135deg, #c6d0e2 0 3px, #eef1f7 3px 6px); border: 1px solid #c6d0e2; }
.sw.nr { background: #eceef2; border: 1px dashed #c3c8d2; }

.map { width: 100%; height: 380px; border-radius: 10px; overflow: hidden; background: #eef1f6; }
.map.tall { height: 460px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0, 0, 0, .08); }

.barriers { display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }
.brow { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; }
.brow .bi { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }
.brow .bi img { width: 20px; height: 20px; object-fit: contain; }
.brow .bt { font-size: 13px; color: var(--ink); line-height: 1.25; }
.brow .bb { height: 7px; background: #f0f2f6; border-radius: 6px; margin-top: 4px; overflow: hidden; }
.brow .bb i { display: block; height: 100%; border-radius: 6px; }
.brow .bn { font-size: 13px; font-weight: 600; color: var(--ink); text-align: right; min-width: 48px; }
.brow .bn small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11px; }
.empty { color: var(--ink-3); font-size: 13px; padding: 30px 0; text-align: center; }

.svc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.svc-table td { padding: 5px 6px; border-bottom: 1px solid #f1f3f6; vertical-align: middle; }
.svc-table tr { cursor: pointer; }
.svc-table tr:hover td { background: var(--brand-softer); }
.svc-table tr.on td { background: var(--brand-soft); }
.svc-table .nm { width: 42%; }
.svc-table .lv { color: var(--ink-3); font-size: 11px; white-space: nowrap; }
.stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: #f0f2f6; }
.stack i { display: block; height: 100%; }
.svc-table .pc { text-align: right; width: 54px; font-weight: 600; }

.bed-kpis { grid-column: span 12; display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }

.disclaimer { margin: 0 28px 24px; background: #fff; border-radius: var(--radius); padding: 14px 18px; font-size: 12px; color: var(--ink-2); box-shadow: var(--shadow); }
.disclaimer b { color: var(--ink); }
.loading { padding: 80px; text-align: center; color: var(--ink-2); grid-column: span 12; }
.err { grid-column: span 12; background: #fff4f2; color: #8a3b33; border-radius: var(--radius); padding: 16px 18px; }

.leaflet-popup-content { font-family: inherit; font-size: 13px; margin: 10px 12px; }
.leaflet-popup-content b { font-size: 14px; }
.pp-row { color: var(--ink-2); }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpis .kpi.total { grid-column: span 3; }
  .c4, .c5, .c3 { grid-column: span 6; }
  .c7, .c8 { grid-column: span 12; }
  .bed-kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 2000; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .15); }
  .app.menu .sidebar { transform: none; }
  .menu-btn { display: inline-block; }
  .c6, .c4, .c5, .c3 { grid-column: span 12; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpis .kpi.total { grid-column: span 2; }
  .bed-kpis { grid-template-columns: repeat(2, 1fr); }
  .topbar, .filters, .page { padding-left: 16px; padding-right: 16px; }
  .disclaimer { margin: 0 16px 16px; }
  .ms > button { min-width: 130px; }
  .filters { position: static; }
}
.svc-scroll { max-height: 600px; overflow-y: auto; margin-right: -6px; padding-right: 6px; }

/* HeRAMS icons (assets folder / infographic) */
.nav a .ico { width: 26px; height: 26px; flex: 0 0 26px; }
.nav a .ico img { width: 22px; height: 22px; }
.card h3 { display: flex; align-items: center; gap: 8px; }
.card h3 .h3i { width: 24px; height: 24px; flex: 0 0 24px; }
.svc-table .ti { width: 20px; height: 20px; vertical-align: middle; margin-right: 8px; }
.kpi .kpi-ic { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; opacity: .9; }
.brand .t1 { color: #4f4e4e; }
.card h3 img.ti, .card h3 img { width: 24px; height: 24px; flex: 0 0 24px; margin: 0; }
