:root {
  --navy: #14213d;
  --ink: #1b2230;
  --muted: #5d6576;
  --line: #e2dfd6;
  --bg: #f5f3ee;
  --card: #ffffff;
  --acc: #1f5aa6;
  --acc-soft: #e6eef9;
  --good: #1d7a43;
  --good-soft: #e4f3ea;
  --warn: #9a5b00;
  --warn-soft: #fdf0d8;
  --bad: #b3261e;
  --bad-soft: #fbe6e4;
  --radius: 14px;
  --tabs-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8ebf1; --muted: #9aa3b5; --line: #2c3444; --bg: #0f141d; --card: #171e2b;
    --acc: #7fb0f5; --acc-soft: #1c2b44; --good: #6fd29a; --good-soft: #15301f;
    --warn: #f3c06b; --warn-soft: #3a2c12; --bad: #ff8a80; --bad-soft: #3d1a18;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 12px);
}
a { color: var(--acc); }
button { font: inherit; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10; background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 12px;
}
.top h1 { font-size: 18px; margin: 0; flex: 1; font-weight: 700; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back[hidden] { display: none; }
.top .back { background: none; border: 0; color: #fff; padding: 4px; margin-left: -6px; display: flex; cursor: pointer; }
.updated { font-size: 11.5px; opacity: .7; white-space: nowrap; }

/* Bottom tabs */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
}
.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600;
}
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--acc); }

main { max-width: 760px; margin: 0 auto; padding: 14px 16px; }

/* Install hint */
.install { max-width: 760px; margin: 12px auto 0; padding: 0 16px; }
.install .box { background: var(--acc-soft); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 10px; align-items: center; font-size: 13.5px; }
.install .box p { margin: 0; flex: 1; }
.install button { border: 0; background: var(--acc); color: #fff; border-radius: 10px; padding: 8px 12px; font-weight: 600; cursor: pointer; }
.install .x { background: none; color: var(--muted); padding: 4px 6px; }

/* Section headings */
.sec-h { display: flex; align-items: baseline; gap: 8px; margin: 22px 2px 10px; }
.sec-h h2 { font-size: 16px; margin: 0; flex: 1; }
.sec-h .n { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.empty { color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; font-size: 14px; }

/* Stat row */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-decoration: none; color: inherit; }
.stat b { display: block; font-size: 24px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); }

/* Tender card */
.card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; color: inherit; text-decoration: none;
}
.card:active { transform: scale(.995); }
.card .meta { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.agency { font-weight: 700; color: var(--ink); background: var(--acc-soft); padding: 2px 8px; border-radius: 999px; }
.card h3 { font-size: 14.5px; margin: 0 0 8px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 3px 8px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.chip.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); font-weight: 600; }
.chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); font-weight: 600; }
.chip.good { background: var(--good-soft); border-color: transparent; color: var(--good); font-weight: 600; }
.match { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.match b { color: var(--good); }

/* Filters */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.filters input, .filters select {
  width: 100%; font: inherit; font-size: 14px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); min-width: 0;
}
.filters .full { grid-column: 1 / -1; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); grid-column: 1 / -1; }
.toggle input { width: auto; }

/* Detail */
.d-head { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.d-head h2 { font-size: 17px; line-height: 1.35; margin: 8px 0 10px; }
.fields { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 12px; }
.fields .row { display: grid; grid-template-columns: 40% 1fr; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.fields .row:last-child { border-bottom: 0; }
.fields .k { color: var(--muted); }
.fields .v { word-break: break-word; }
.na { color: var(--muted); font-style: italic; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btn {
  flex: 1 1 140px; text-align: center; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--acc);
  background: var(--acc); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; font-size: 14px;
}
.btn.sec { background: var(--card); color: var(--acc); }
.co { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; display: flex; gap: 10px; align-items: flex-start; text-decoration: none; color: inherit; }
.co .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; }
.co .dot.layak { background: var(--good); } .co .dot.semak { background: var(--warn); } .co .dot.tidak_layak { background: var(--line); }
.co .nm { font-weight: 600; font-size: 14px; }
.co .rs { font-size: 12.5px; color: var(--muted); }
.co .g { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
details.more summary { cursor: pointer; color: var(--acc); font-weight: 600; font-size: 14px; margin: 8px 2px; }
.note { font-size: 13px; color: var(--muted); margin: 8px 2px; }
.warnbox { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; margin-top: 12px; white-space: pre-line; }
.loading { color: var(--muted); padding: 24px 4px; }
.codes { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
