:root {
  --bg: #f6f4ef; --card: #fff; --ink: #1d2327; --muted: #667078; --line: #e4e0d6;
  --teal: #1f8c8e; --teal-soft: #e2f1f1; --red: #9d1f2c; --red-soft: #f7e6e8; --mid-soft: #eeece6;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Devanagari", Roboto, sans-serif;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
p { margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 0.9rem; margin: 0 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.shell { display: flex; min-height: 100vh; }
nav.side {
  width: 216px; flex: none; padding: 24px 14px; border-right: 1px solid var(--line); background: var(--card);
  position: sticky; top: 0; height: 100vh;
}
.brand { font-weight: 700; font-size: 1.05rem; padding: 0 10px 2px; }
.brand-sub { color: var(--muted); font-size: 0.8rem; padding: 0 10px 18px; }
nav.side a.item {
  display: block; padding: 9px 10px; border-radius: 9px; color: var(--ink); font-weight: 500; margin-bottom: 2px;
}
nav.side a.item:hover { background: var(--mid-soft); text-decoration: none; }
nav.side a.item.on { background: var(--teal-soft); color: #14696b; }
.fresh { position: absolute; bottom: 20px; left: 24px; right: 14px; font-size: 0.78rem; color: var(--muted); }
.fresh button { border: 0; background: none; color: var(--teal); padding: 0; font: inherit; cursor: pointer; }
main { flex: 1; min-width: 0; padding: 28px 32px 60px; max-width: 1080px; }

.grid { display: grid; gap: 14px; }
.grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 14px; }
.grid > .card { margin-top: 0; }
.kpi .k { color: var(--muted); font-size: 0.82rem; }
.kpi .v { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.kpi .d { font-size: 0.8rem; color: var(--muted); }

.chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.82rem; font-weight: 600;
  background: var(--mid-soft); color: #4a5258; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chip.high { background: var(--teal-soft); color: #14696b; }
.chip.low { background: var(--red-soft); color: var(--red); }
.chip.na { color: var(--muted); font-weight: 500; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 0.78rem; background: var(--mid-soft); color: #4a5258; }
.tag.kw { background: #fdf1d7; color: #7a5200; font-weight: 600; }

.tablewrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.78rem; padding: 6px 10px 8px 0; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.cap { min-width: 200px; }
.cap a { overflow-wrap: anywhere; color: var(--ink); font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
select, input, textarea, button { font: inherit; }
select, input[type=text], input[type=number], input[type=date], input[type=password] {
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--ink); min-height: 42px; max-width: 100%;
}
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 10px; border: 0; background: var(--teal); color: #fff;
  font-weight: 600; cursor: pointer; min-height: 44px;
}
.btn:hover { background: #18777a; text-decoration: none; }
.btn.ghost { background: none; color: var(--red); padding: 4px 8px; min-height: 0; font-weight: 500; font-size: 0.85rem; }
label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.field select, .field input { width: 100%; }
.note { padding: 10px 14px; border-radius: 10px; background: var(--teal-soft); color: #14696b; margin-bottom: 14px; }
.note.bad { background: var(--red-soft); color: var(--red); }
.verdict { font-size: 1.05rem; line-height: 1.55; }
.caption { white-space: pre-wrap; font-size: 0.95rem; line-height: 1.7; max-height: 320px; overflow: auto; }
.stage { text-transform: capitalize; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 0.92rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.bar { height: 6px; border-radius: 3px; background: var(--mid-soft); overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--teal); }
.bar.low i { background: var(--red); }
nav.bottom { display: none; }

@media (max-width: 820px) {
  nav.side { display: none; }
  main { padding: 18px 16px 90px; }
  .grid.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.k2 { grid-template-columns: 1fr; }
  nav.bottom {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 5;
  }
  nav.bottom a { flex: 1; text-align: center; padding: 8px 2px; font-size: 0.74rem; font-weight: 600; color: var(--muted); border-radius: 8px; }
  nav.bottom a.on { color: #14696b; background: var(--teal-soft); }
  .hide-sm { display: none; }
  td.cap { min-width: 0; }
  td, th { padding-right: 8px; }
  .filters select { flex: 1 1 46%; min-width: 0; }
  table.posts { table-layout: fixed; }
  table.posts th.n, table.posts td.n { width: 76px; }
  .kpi .v { font-size: 1.4rem; }
}
