:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: #cbd5e1;
  --brand: #0284c7;
  --brand-dark: #0369a1;
  --accent: #f59e0b;
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
.topbar {
  background: linear-gradient(135deg, #0c4a6e 0%, #0284c7 100%);
  color: #fff;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.topbar-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #fff;
}
.brand-title {
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.brand-sub {
  font-size: 0.74rem;
  color: #e0f2fe;
  display: block;
  font-weight: 500;
}
.lang-switch {
  display: flex;
  gap: 3px;
  background: rgba(255,255,255,0.16);
  padding: 3px;
  border-radius: 999px;
}
.lang-btn {
  border: none;
  background: transparent;
  color: #f0f9ff;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.lang-btn.active {
  background: #fff;
  color: #0c4a6e;
}
.container {
  max-width: 680px;
  margin: 12px auto 0;
  padding: 0 12px;
}
.tab-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tab-view[hidden] {
  display: none !important;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 15px 16px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15,23,42,0.05);
}
.section-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-dark);
  margin-bottom: 6px;
  display: block;
}
.chip-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin: 8px 0;
  scrollbar-width: none;
}
.chip {
  flex: none;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.chip.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.controls-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}
select, input[type="text"], input[type="number"] {
  width: 100%;
  padding: 10px 11px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  font-size: 0.88rem;
  background: #fff;
  color: var(--text);
}
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
}
.map-box {
  height: 195px;
  border-radius: 12px;
  overflow: hidden;
  background: #e2e8f0;
  margin-top: 8px;
  border: 1px solid var(--border);
}
.map-box.off {
  height: auto;
  padding: 12px;
  font-size: 0.8rem;
  color: var(--muted);
}
.status-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.status-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.status-pill.live { background: #dcfce7; color: #166534; }
.status-pill.cached { background: #fef9c3; color: #854d0e; }
.status-pill.fallback { background: #e2e8f0; color: #334155; }
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}
.stat-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
}
.stat-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}
.stat-big {
  font-size: 2rem;
  font-weight: 800;
  margin-top: 2px;
  line-height: 1.1;
}
.hi-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 800;
}
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 10px;
  text-align: center;
}
.metric-cell {
  background: #f8fafc;
  padding: 7px 4px;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
}
.metric-cell span {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
}
.metric-cell strong {
  font-size: 0.86rem;
  color: var(--text);
}
.deped-box {
  border: 2px solid #166534;
  border-radius: 12px;
  padding: 12px;
  margin-top: 6px;
}
.deped-badge {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.sim-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
@media (max-width: 560px) {
  .hero-grid, .sim-row, .controls-grid {
    grid-template-columns: 1fr;
  }
  .metrics-strip {
    grid-template-columns: repeat(3, 1fr);
  }
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 6px;
}
th, td {
  text-align: left;
  padding: 7px 6px;
  border-bottom: 1px solid #e2e8f0;
}
th {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--muted);
}
.mini-pill {
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.75rem;
}
textarea.advisory-box {
  width: 100%;
  min-height: 162px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  background: #f8fafc;
  color: #0f172a;
  margin: 8px 0;
  resize: vertical;
}
.copy-feedback {
  font-size: 0.8rem;
  font-weight: 700;
  color: #166534;
  margin-top: 6px;
}
details summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand-dark);
  margin-top: 8px;
}
.bottom-tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 1000;
  box-shadow: 0 -2px 8px rgba(15,23,42,0.06);
}
.bottom-tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 2px 10px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.bottom-tabs button span {
  font-size: 1.15rem;
}
.bottom-tabs button b {
  font-size: 0.68rem;
  font-weight: 600;
}
.bottom-tabs button.active {
  color: var(--brand);
}
.bottom-tabs button.active b {
  font-weight: 800;
}
@media print {
  body { padding: 0; background: #fff; color: #000; }
  .topbar, .bottom-tabs, .no-print { display: none !important; }
  .tab-view { display: flex !important; }
  .card { box-shadow: none; border: 1px solid #94a3b8; margin-bottom: 10px; }
}
