/* =========================
   GOV UI (Tight / No Fluff)
   - Sections fit content
   - No forced tall boxes
   ========================= */
:root{
  --blue:#0b3a75;
  --cyan:#1177bb;

  --bg:#f8fbff;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#d9e2ef;

  --r:14px;
  --gap:10px;
  --pad:12px;
  --head:10px;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family:"Cairo", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}
.wrap{max-width:1440px;margin:auto;padding:12px}

/* Card */
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--r);
  overflow:hidden;
}
.head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: var(--head) var(--pad);
  border-bottom:1px solid var(--border);
  background:#fff;
}
.hTitle{
  display:flex; align-items:center; gap:10px;
  font-weight:900;
  color:var(--blue);
  font-size:15px;
  line-height:1.1;
}
.meta{
  font-size:12px;
  color:var(--muted);
  font-weight:800;
}
.pill{
  display:inline-flex; align-items:center; gap:8px;
  padding:3px 10px;
  border-radius:999px;
  border:1px solid rgba(17,119,187,.25);
  color:var(--cyan);
  background:#fff;
  font-size:11px;
  font-weight:900;
}
.icon{width:18px;height:18px;display:inline-block}
.icon svg{width:100%;height:100%;color:var(--cyan)}
.icon.blue svg{color:var(--blue)}

/* Layouts */
.top{
  display:grid;
  grid-template-columns: 2fr 2.2fr 340px;
  gap:var(--gap);
  align-items:start; /* important: no stretching */
}
.kpiGrid{
  margin-top:var(--gap);
  display:grid;
  grid-template-columns: 1.25fr 1.25fr 1.15fr 1fr 1fr 1fr 1fr 1.35fr 1fr 1fr;
  gap:var(--gap);
  align-items:start;
}

/* Regions */
.regions{
  padding: var(--pad);
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:8px;
}
.regionBtn{
  border:1px solid rgba(11,58,117,.20);
  background:#fff;
  color:var(--blue);
  padding:10px 10px;
  border-radius:12px;
  font-weight:900;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  cursor:pointer;
  line-height:1.1;
}
.regionBtn .dot{width:8px;height:8px;border-radius:999px;background:var(--cyan)}
.regionBtn.active{background:var(--blue); color:#fff; border-color:var(--blue)}

/* Status */
.statusGrid{
  padding: var(--pad);
  display:grid;
  grid-template-columns: repeat(6, 1fr);
  gap:8px;
}
.status{
  border:1px solid rgba(11,58,117,.14);
  border-radius:12px;
  padding:10px 8px;
  background:#fff;
  text-align:center;
}
.status .k{
  font-size:12px;
  font-weight:900;
  color:var(--muted);
  display:flex;
  gap:6px;
  justify-content:center;
  align-items:center;
  line-height:1.1;
}
.status .v{
  margin-top:6px;
  font-size:18px;
  font-weight:900;
  color:var(--blue);
  font-variant-numeric:tabular-nums;
  line-height:1.1;
}
.status.emph{border-color: rgba(17,119,187,.35)}
.status.emph .v{color:var(--cyan)}

/* Date */
.dateBody{
  padding: var(--pad);
  display:flex;
  flex-direction:column;
  gap:10px;
}

.field{display:flex; justify-content: center; /* Centers horizontally along the main axis */
  align-items: center; gap:6px}
label{font-size:12px; font-weight:900; color:var(--muted)}
input[type="date"]{
  width:100%;
  padding:10px 10px;
  border:1px solid var(--border);
  border-radius:12px;
  font-family:inherit;
  background:#fff;
}
input[type="range"]{
  -webkit-appearance:none;
  width:100%;
  height:4px;
  background:var(--border);
  border-radius:999px;
  outline:none;
}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none;
  width:16px;height:16px;border-radius:50%;
  background:var(--cyan);
  border:3px solid #fff;
  box-shadow:0 0 0 2px rgba(17,119,187,.22);
}
input[type="range"]::-moz-range-thumb{
  width:16px;height:16px;border-radius:50%;
  background:var(--cyan);
  border:3px solid #fff;
}

/* KPI headers */
.kHead{
  padding:8px 10px;
  background:var(--blue);
  color:#fff;
  font-weight:900;
  border-radius:12px;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:8px;
  font-size:12.5px;
  line-height:1.1;
}
.kHead.alt{background:var(--cyan); color:#062c3f}
.kCell{
  background:#fff;
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.kCell .val{
  font-size:18px;
  font-weight:900;
  color:var(--blue);
  line-height:1.1;
}
.kCell .lbl{
  font-size:12px;
  font-weight:900;
  color:var(--muted);
  line-height:1.15;
}
.kCell select{
  width:100%;
  padding:10px 10px;
  border:1px solid var(--border);
  border-radius:12px;
  font-family:inherit;
  background:#fff;
}

/* Tools compact */
.toolsRow{display:flex; align-items:center; justify-content:space-between; gap:8px}
.toolset{display:flex; gap:8px}
.toolbtn{
  width:34px;height:34px;
  border:1px solid var(--border);
  border-radius:12px;
  display:grid; place-items:center;
  background:#fff;
  cursor:pointer;
}
.toolbtn svg{width:18px;height:18px;color:var(--blue)}

/* Charts area: content-fit */
.chartsTop{
  margin-top:var(--gap);
  display:grid;
  grid-template-columns: 1fr 1fr 1fr 1.25fr;
  gap:var(--gap);
  direction:ltr; /* match screenshot order */
  align-items:start;
}
.chartCard{background:#fff;border:1px solid var(--border);border-radius:var(--r);overflow:hidden}
.cHead{
  padding: var(--head) var(--pad);
  border-bottom:1px solid var(--border);
  background:#fff;
  direction:rtl;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  font-weight:900;
  color:var(--blue);
  font-size:14px;
  line-height:1.1;
}
.cBody{
  padding: 10px 12px 12px;
  direction:rtl;
}
.chartBox{
  height: 210px; /* tight but consistent */
}
.chartBox.small{height: 200px;}
.chartBox.tall{height: 280px;}
canvas{width:100% !important; height:100% !important}

/* Subareas: tight list with sticky-ish rhythm */
.sublist{max-height: 250px; overflow:auto}
.subrow{
  display:grid;
  grid-template-columns: 1fr 90px;
  gap:10px;
  align-items:center;
  font-size:12.8px;
}
.subrow .n{font-weight:900;color:var(--text);line-height:1.2}
.subrow .v{text-align:left;font-weight:900;color:var(--blue);font-variant-numeric:tabular-nums}
.meter{
  grid-column:1/-1;
  height:10px;
  border:1px solid var(--border);
  border-radius:999px;
  overflow:hidden;
  background:#fff;
  margin:6px 0 10px;
}
.meter span{display:block;height:100%;background:var(--cyan);width:50%}

/* Bottom */
.bottom{
  margin-top:var(--gap);
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:var(--gap);
  align-items:start;
}

/* Hover minimal (gov) */
.card:hover,.chartCard:hover{border-color:rgba(17,119,187,.35)}
.regionBtn:focus-visible,.toolbtn:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid rgba(17,119,187,.25);outline-offset:2px}

/* Responsive */
@media (max-width: 1280px){
  .top{grid-template-columns: 1fr}
  .kpiGrid{grid-template-columns: 1fr 1fr}
  .chartsTop{grid-template-columns: 1fr; direction:rtl}
  .bottom{grid-template-columns: 1fr}
  .chartBox,.chartBox.small{height: 240px}
  .chartBox.tall{height: 300px}
}
