:root {
  --bg: #F3F5F7;
  --card: #FFFFFF;
  --ink: #0F1B2D;
  --muted: #4A5565;
  --line: #E2E7ED;
  --line2: #EEF1F4;
  --teal: #0F766E;
  --teal-d: #115E59;
  --teal-bg: #ECFDF5;
  --teal-line: #6EE7B7;
  --amber: #B45309;
  --amber-bg: #FFFBEB;
  --amber-line: #FCD34D;
  --red: #B91C1C;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1220; --card: #131C2E; --ink: #E8EDF5; --muted: #9AA7BA; --line: #243049; --line2: #1B2640;
    --teal: #2DD4BF; --teal-d: #5EEAD4; --teal-bg: #0E2A2A; --teal-line: #14524E;
    --amber: #FBBF24; --amber-bg: #2A2110; --amber-line: #6B4E12; --red: #F87171;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 'IBM Plex Sans', system-ui, sans-serif; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }

.brand { font-weight: 700; font-size: 17px; color: var(--ink); display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand svg { width: 24px; height: 24px; }
.sp { flex: 1; }
.who { font-size: 13px; color: var(--muted); }
.layout { display: block; min-height: 100vh; }
.side { display: none; }
.main { max-width: 1040px; margin: 0 auto; padding: 0 16px calc(76px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; gap: 10px; height: 56px; }
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(52px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.bottom a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--muted); font-size: 10px; line-height: 1.1; text-decoration: none; }
.bottom a svg { width: 20px; height: 20px; }
.bottom a.on { color: var(--teal); font-weight: 600; }
@media (min-width: 900px) {
  .layout { display: grid; grid-template-columns: 232px 1fr; }
  .side { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; padding: 16px 12px; background: var(--card); border-right: 1px solid var(--line); }
  .side .brand { padding: 4px 12px 0; }
  .side nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
  .side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; }
  .side nav a svg { width: 20px; height: 20px; }
  .side nav a:hover { background: var(--line2); }
  .side nav a.on { background: var(--teal-bg); color: var(--teal); }
  .side .who { padding: 0 12px; }
  .side .linkbtn { text-align: left; padding: 8px 12px; }
  .top, .bottom { display: none; }
  .main { padding: 24px 32px 48px; max-width: 1100px; margin: 0; }
}
.page { padding-bottom: 8px; }
.strong { font-weight: 600; }
.pad { padding: 14px; }
.amber { color: var(--amber); }
.crumb { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.between { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; margin: 12px 0 0; }
.toggle { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; white-space: nowrap; padding: 8px 0; }
.stabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin: 14px 0 10px; }
.stab { padding: 8px 0; color: var(--muted); font-weight: 500; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.stab.on { color: var(--teal); border-color: var(--teal); }
.pills { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; }
.pill.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.act { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: 0 12px; min-height: 36px; font-size: 13px; font-weight: 600; color: var(--teal); }
.act.main { background: var(--teal); border-color: var(--teal); color: #fff; }
.act.ghost { color: var(--muted); }
.act:disabled { opacity: .5; cursor: not-allowed; }
.fileline { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.fileline .linkbtn { padding: 2px 0; text-align: left; font-weight: 500; }
.banner.ok { border-color: var(--teal-line); background: var(--teal-bg); color: var(--teal); }
.linkbtn { background: none; border: 0; padding: 8px 4px; color: var(--teal); font-size: 14px; }

h1 { font-size: 26px; margin: 8px 0 2px; font-weight: 700; }
h2.sec { margin: 24px 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sub { color: var(--muted); font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line2); color: inherit; }
.row:last-child { border-bottom: 0; }
a.row:hover { background: var(--line2); text-decoration: none; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 500; }
.row .s { font-size: 12px; color: var(--muted); }
.chev { color: var(--muted); }

.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.ready { display: flex; align-items: center; gap: 16px; padding: 16px; }
.ring { --p: 0; width: 76px; height: 76px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--teal) calc(var(--p) * 1%), var(--line) 0);
  display: grid; place-items: center; }
.ring span { width: 58px; height: 58px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-weight: 700; font-size: 18px; }

.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; width: 84px; }
.bar i { display: block; height: 100%; background: var(--teal); }
.bar.warn i { background: var(--amber); }
.count { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--muted); text-align: right; min-width: 40px; }

.chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.teal { color: var(--teal); border-color: var(--teal-line); background: var(--teal-bg); }
.chip.amber { color: var(--amber); border-color: var(--amber-line); background: var(--amber-bg); }


.item { border-bottom: 1px solid var(--line2); }
.item:last-child { border-bottom: 0; }
.item > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; }
.item > summary .grow { flex: 1; min-width: 0; }
.t { font-weight: 500; }
.s { font-size: 12px; color: var(--muted); }
.item .chip { display: none; }
@media (min-width: 600px) { .item .chip { display: inline-block; } }
.item > summary::-webkit-details-marker { display: none; }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; color: #fff; font-size: 13px; line-height: 1; }
.dot.present, .dot.generated { background: var(--teal); border-color: var(--teal); }
.dot.na { background: var(--muted); border-color: var(--muted); }
.item .body { padding: 0 14px 14px 46px; display: grid; gap: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--card); padding: 8px 14px; font-size: 13px; font-weight: 500; border-right: 1px solid var(--line); min-height: 40px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--teal); color: #fff; }
textarea, input[type=number] { width: 100%; font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
textarea { min-height: 64px; resize: vertical; }
.meta { font-size: 12px; color: var(--muted); }

.banner { border: 1px solid var(--amber-line); background: var(--amber-bg); color: var(--amber); border-radius: var(--radius); padding: 12px 14px; font-size: 14px; }
.login { max-width: 360px; margin: 18vh auto 0; text-align: center; padding: 0 16px; }
.login .logo { width: 56px; height: 56px; margin: 0 auto 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--teal); color: #fff; font-weight: 600; text-decoration: none; }
.btn:hover { background: var(--teal-d); text-decoration: none; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.spin { padding: 40px; text-align: center; color: var(--muted); }
.years { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.years label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.years input { width: 96px; }

.linkbtn.danger { color: var(--red); padding: 0; font-size: 12px; }
select { font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; max-width: 55%; min-height: 40px; }
a.act { display: inline-flex; align-items: center; text-decoration: none; }

.sec2 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.step { background: none; border: 0; padding: 0; text-align: left; display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.step i { display: block; height: 6px; border-radius: 3px; background: var(--line); }
.step.done { color: var(--ink); }
.step.done i { background: var(--teal); }
.step:disabled { cursor: default; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 6px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.tile span { font-size: 11px; color: var(--muted); }
.tile b { font-family: 'IBM Plex Mono', monospace; font-size: 15px; font-weight: 500; }
.tile em { font-size: 11px; color: var(--teal); font-style: normal; }
.drow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line2); font-size: 14px; }
.drow > span:nth-child(n+2) { text-align: right; font-family: 'IBM Plex Mono', monospace; }
.drow.head { font-size: 12px; color: var(--muted); font-family: inherit; padding: 6px 14px; }
.drow.tot { font-weight: 600; border-bottom: 0; }
.drow input { text-align: right; padding: 6px 8px; min-height: 36px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 14px 14px; }
.note { padding: 8px 0; border-bottom: 1px solid var(--line2); }
.card textarea + label, .card label.sub { display: block; margin: 10px 0 4px; }
input[type=date], input[type=number] { font: inherit; }

.gdlg { width: min(720px, 94vw); max-height: 92vh; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); padding: 20px; }
.gdlg::backdrop { background: rgba(15, 27, 45, .5); }
.gfields { display: grid; gap: 8px; margin: 12px 0; }
.gfields input, .gfields textarea { width: 100%; margin-top: 4px; font: inherit; background: var(--card); color: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.gpaper { font-family: 'IBM Plex Serif', Georgia, serif; font-size: 13px; background: #fff; color: #111; border: 1px solid var(--line); border-radius: 10px; padding: 18px 22px; margin: 10px 0; max-height: 46vh; overflow: auto; }
.gpaper p { margin: 0 0 10px; }
.gd-title { text-align: center; font-weight: 700; margin: 2px 0; }
.gd-tbl { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: 12.5px; }
.gd-tbl th, .gd-tbl td { padding: 5px 4px; text-align: right; border-bottom: 1px solid #ddd; }
.gd-tbl th:first-child, .gd-tbl td:first-child { text-align: left; }
.gd-tbl tfoot td { font-weight: 700; border-bottom: 0; }
.gd-sig { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 26px; }
.gd-sig > div { border-top: 1px solid #111; padding-top: 4px; font-size: 12px; }

.big { font-family: 'IBM Plex Mono', monospace; font-size: 28px; font-weight: 500; margin: 2px 0; }
.drow4 { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line2); font-size: 13px; }
.drow4 > span:nth-child(n+2) { text-align: right; font-family: 'IBM Plex Mono', monospace; }
.drow4.head { font-size: 12px; color: var(--muted); font-family: inherit; }
.drow4 input { text-align: right; padding: 6px 8px; min-height: 34px; width: 100%; }
.years label input { display: block; }

.mapwrap { overflow-x: auto; margin: 12px 0; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.mapwrap svg { display: block; min-width: 900px; width: 100%; height: auto; }
.mapwrap a { cursor: pointer; }
.mapwrap a:hover rect { stroke: var(--teal); }
.mapwrap a text { pointer-events: none; }
