:root {
  color-scheme: light;
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #f1f3f0;
  --ink: #17201d;
  --ink-2: #3c4743;
  --muted: #6b7672;
  --line: #e1e5e1;
  --line-2: #cfd5d0;
  --accent: #0f5c4d;
  --accent-ink: #0b4a3e;
  --accent-soft: #e5f1ec;
  --amber: #8a5300;
  --amber-soft: #fdf3e1;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .05), 0 4px 16px rgba(20, 30, 25, .05);
  --topbar-h: 56px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Noto Sans Gurmukhi", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
main:focus { outline: none; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; height: var(--topbar-h);
  padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 650; letter-spacing: -.01em; min-width: 0; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); flex: none; position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 7px 8px 7px 8px; border: 2px solid #fff; border-radius: 2px; border-top-right-radius: 5px; }
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 999px; flex: none; }
.topnav a { text-decoration: none; color: var(--ink-2); font-size: 13px; font-weight: 550; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.topnav a.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }

/* ---------- hero ---------- */
.hero { padding: 36px 0 8px; }
.eyebrow { font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; }
.hero h1 { font-size: clamp(26px, 5vw, 40px); line-height: 1.12; letter-spacing: -.025em; margin: 0; max-width: 22ch; font-weight: 700; }
.hero p.lede { color: var(--ink-2); font-size: 16px; max-width: 62ch; margin: 12px 0 0; }

.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 24px 0 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 12px; }
.stat .n { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat .sub { font-size: 11.5px; color: var(--ink-2); margin-top: 6px; }

/* ---------- toolbar ---------- */
.toolbar { position: sticky; top: var(--topbar-h); z-index: 10; background: var(--bg); padding: 14px 0 10px; display: flex; flex-direction: column; gap: 10px; }
.search { position: relative; }
.search input {
  width: 100%; height: 44px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface);
  padding: 0 40px 0 40px; font: inherit; font-size: 16px; color: var(--ink);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.search svg { position: absolute; left: 13px; top: 13px; width: 18px; height: 18px; color: var(--muted); }
.search .clear { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; border: 0; background: none; border-radius: 8px; color: var(--muted); cursor: pointer; display: none; font-size: 18px; }
.search.has-value .clear { display: block; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; font-weight: 550; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.chip .c { color: var(--muted); font-weight: 500; margin-left: 4px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-pressed="true"] .c { color: rgba(255,255,255,.65); }
.chip-sep { flex: none; width: 1px; background: var(--line-2); margin: 4px 4px; }
.result-count { font-size: 13px; color: var(--muted); }

/* ---------- doc grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; padding: 4px 0 48px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  text-decoration: none; color: inherit; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s, border-color .15s;
}
.card:hover { box-shadow: var(--shadow); border-color: var(--line-2); transform: translateY(-1px); }
.card .thumb { aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; border-bottom: 1px solid var(--line); position: relative; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.card .thumb .pg { position: absolute; right: 8px; bottom: 8px; background: rgba(23,32,29,.78); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .state { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.card .variant { font-size: 13px; color: var(--muted); margin-top: -4px; }
.card .owner { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 4px; }

.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag.accent { background: var(--accent-soft); color: var(--accent-ink); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.lang { background: #eef0f8; color: #3a4378; }

.empty-state { text-align: center; color: var(--muted); padding: 48px 16px; }

/* ---------- unified table ---------- */
.table-intro { padding: 28px 0 0; }
.table-intro h1 { font-size: 26px; letter-spacing: -.02em; margin: 0; }
.table-intro p { color: var(--ink-2); margin: 6px 0 0; max-width: 70ch; }
.utable-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; margin: 4px 0 48px; }
table.utable { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.utable th, .utable td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.utable thead th { position: sticky; top: 0; background: var(--surface-2); font-size: 11.5px; font-weight: 650; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; cursor: pointer; user-select: none; }
.utable thead th[aria-sort="ascending"]::after { content: " ↑"; }
.utable thead th[aria-sort="descending"]::after { content: " ↓"; }
.utable tbody tr { cursor: pointer; }
.utable tbody tr:hover { background: #fafbf9; }
.utable td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.utable td.nowrap { white-space: nowrap; }
.utable td .muted { color: var(--muted); font-size: 12px; }
.utable .mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------- detail ---------- */
.detail-head { padding: 18px 0 12px; display: flex; flex-direction: column; gap: 10px; }
.crumbs { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.back { text-decoration: none; font-size: 14px; font-weight: 550; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.pager { display: flex; gap: 6px; }
.pager a { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); text-decoration: none; color: var(--ink); font-size: 16px; }
.pager a[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.detail-head h1 { font-size: clamp(22px, 4vw, 30px); letter-spacing: -.02em; margin: 0; line-height: 1.15; }
.detail-head .sub { color: var(--muted); font-size: 14px; margin-top: -4px; }
.detail-head .tags { display: flex; flex-wrap: wrap; gap: 6px; }

.seg { display: none; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; padding-bottom: 48px; }
.pane-source {
  position: sticky; top: calc(var(--topbar-h) + 12px);
  max-height: calc(100vh - var(--topbar-h) - 24px); overflow: auto;
  background: #e9ece8; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.pane-source .src-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; font-size: 13px; color: var(--ink-2); }
.pane-source .src-bar a { font-weight: 600; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; background: var(--surface); border: 1px solid var(--line-2); padding: 5px 10px; border-radius: 8px; color: var(--ink); white-space: nowrap; }
.page-img { background: #fff; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.12); margin-bottom: 12px; overflow: hidden; }
.page-img a { display: block; cursor: zoom-in; }
.page-img img { width: 100%; height: auto; }
.page-img .pl { font-size: 11px; color: var(--muted); padding: 4px 8px; background: #fafafa; border-top: 1px solid var(--line); }

.pane-data { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.cert-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.cert-tabs::-webkit-scrollbar { display: none; }

.summary { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.summary .title-native { font-size: 13px; color: var(--muted); white-space: pre-line; margin: 0 0 12px; }
.summary dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin: 0; }
.summary dt { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.summary dd { margin: 2px 0 0; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.summary dd.big { font-size: 17px; }
.summary .full { grid-column: 1 / -1; }

.sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sec > summary { list-style: none; cursor: pointer; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 650; font-size: 14.5px; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary .cnt { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 6px; }
.sec > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; margin-right: 4px; flex: none; }
.sec[open] > summary::after { transform: rotate(-135deg); }
.sec > .sec-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 14px; }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 0; }
.kv > div { min-width: 0; }
.kv > div.full { grid-column: 1 / -1; }
.kv dt { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.kv dd { margin: 1px 0 0; overflow-wrap: anywhere; white-space: pre-line; }

.sub-h { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin: 2px 0 -6px; }

.box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.box-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.box-h .t { font-weight: 650; }
.box-h .meta { font-size: 12.5px; color: var(--muted); }

.idlist { display: flex; flex-wrap: wrap; gap: 6px; }
.idpill { display: inline-flex; flex-direction: column; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 4px 9px; min-width: 0; max-width: 100%; }
.idpill .k { font-size: 10.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.idpill .v { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }

.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini th, .mini td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.mini th { font-size: 11px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
.mini td.num, .mini th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mini tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }

.notes-list { margin: 0; padding-left: 18px; }
.notes-list li { margin: 2px 0; }

.ann { font-size: 13px; }
.ann li { margin-bottom: 6px; }
.ann code { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; color: var(--ink-2); overflow-wrap: anywhere; }
.ann .state { font-size: 11px; font-weight: 650; color: var(--amber); background: var(--amber-soft); padding: 1px 6px; border-radius: 4px; margin: 0 4px; }

.raw-json { position: relative; }
.raw-json pre { margin: 0; background: #f7f8f6; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; font-family: var(--mono); font-size: 12px; line-height: 1.5; max-height: 520px; overflow: auto; white-space: pre; }
.raw-json .copy { position: absolute; top: 8px; right: 8px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 7px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.j-k { color: #7a3e9d; } .j-s { color: #0f6b3e; } .j-n { color: #b35c00; } .j-l { color: #8a8f8c; }

.muted { color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .seg {
    display: flex; position: sticky; top: var(--topbar-h); z-index: 9; background: var(--bg);
    padding: 8px 0 10px; margin: 0;
  }
  .seg-inner { display: flex; width: 100%; background: var(--surface-2); padding: 3px; border-radius: 10px; }
  .seg button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; }
  .seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split[data-view="data"] .pane-source { display: none; }
  .split[data-view="source"] .pane-data { display: none; }
  .pane-source { position: static; max-height: none; padding: 8px; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .brand-text { font-size: 14px; }
  .topnav a { padding: 6px 10px; font-size: 12.5px; }
  .hero { padding-top: 24px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 12px; }
  .stat .n { font-size: 22px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card .body { padding: 10px 11px 12px; }
  .card .state { font-size: 14px; }
  .card .owner { display: none; }
  .summary dl { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .kv { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; }
  .sec > summary { padding: 12px 14px; }
  .sec > .sec-body { padding: 0 14px 14px; }

  /* table → cards */
  .utable-wrap { background: none; border: 0; overflow: visible; }
  table.utable, .utable tbody, .utable tr, .utable td { display: block; width: 100%; }
  .utable thead { display: none; }
  .utable tbody tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 10px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .utable td { border: 0; padding: 0; text-align: left !important; white-space: normal !important; }
  .utable td::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .utable td.span2 { grid-column: 1 / -1; }
}
@media (max-width: 440px) {
  .brand-text { display: none; }
}
