:root {
  --deep: #0f3d3a; --deep-2: #17524d; --ground: #e8f0ed; --paper: #fbfdfc; --ink: #12302c; --soft: #52706a;
  --line: #c5d5d0; --coin: #f2b632; --coin-dark: #a87400; --red: #b92c22; --plus: #12725f;
  --display: "Bricolage Grotesque", system-ui, sans-serif; --body: "Instrument Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 16px/1.5 var(--body); font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; margin: 0; }
h2 { font-size: 1.5rem; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--coin-dark); outline-offset: 2px; }
.btn { border: 0; border-radius: 999px; background: var(--deep); color: #fff; padding: .6rem 1.15rem; font-weight: 600; cursor: pointer; min-height: 44px; }
.btn.ghost { background: transparent; color: var(--deep); box-shadow: inset 0 0 0 1.5px var(--deep); }
.btn.danger { background: var(--red); }
.btn.full { width: 100%; }
.link { background: none; border: 0; padding: .5rem 0; color: var(--deep); text-decoration: underline; cursor: pointer; font-weight: 500; min-height: 44px; }
.link.quiet { color: var(--soft); font-size: .9rem; }
label.f { display: block; margin-bottom: .9rem; font-weight: 500; font-size: .94rem; }
label.f input, label.f select, .cell-select { display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem; background: #fff; border: 1.5px solid var(--line); border-radius: 8px; min-height: 44px; }
.hint { color: var(--soft); font-size: .88rem; margin: .2rem 0 0; }
.error { color: var(--red); font-weight: 500; margin: 0 0 .8rem; }

.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: var(--deep); color: #fff; padding: clamp(2rem, 6vw, 5rem); display: flex; flex-direction: column; justify-content: space-between; gap: 2.5rem; }
.auth-side h1 { font-size: clamp(2.6rem, 6.5vw, 5rem); max-width: 11ch; }
.auth-side p { max-width: 34ch; color: #cfe2dd; font-size: 1.1rem; margin: 1rem 0 0; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.25rem; display: flex; align-items: center; gap: .5rem; }
.brand svg { width: 22px; height: 22px; }
.auth-form { padding: clamp(2rem, 6vw, 5rem); display: flex; flex-direction: column; justify-content: center; max-width: 520px; width: 100%; }
.auth-form h2 { margin-bottom: 1.3rem; }

.top { background: var(--deep); color: #fff; }
.bar { max-width: 1040px; margin: auto; padding: .7rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.bar .right { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.switch { background: var(--deep-2); color: #fff; border: 0; border-radius: 8px; padding: .5rem; min-height: 44px; max-width: 45vw; }
.top .link { color: #cfe2dd; }
.tabs { max-width: 1040px; margin: auto; padding: 0 1.25rem; display: flex; gap: 1.5rem; }
.tabs button { background: none; border: 0; color: #cfe2dd; padding: .75rem 0; border-bottom: 3px solid transparent; cursor: pointer; font-weight: 500; min-height: 44px; }
.tabs button[aria-current=page] { color: #fff; border-color: var(--coin); }

.hero { background: var(--deep); color: #fff; padding: 1.5rem 0 2.2rem; }
.wrap { max-width: 1040px; margin: auto; padding: 0 1.25rem; }
.hero .lead { color: #cfe2dd; font-size: 1.15rem; margin: 0; }
.hero h1 { font-size: clamp(3rem, 11vw, 6.6rem); letter-spacing: -.02em; margin: .1rem 0 .6rem; }
.hero .sub { font-size: 1.1rem; margin: 0; max-width: 60ch; }
.trail { display: block; width: 100%; height: auto; margin: 1.5rem 0 .5rem; }
.trail-note { color: #cfe2dd; font-size: .9rem; margin: 0; }
.whatif { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem 2.5rem; margin-top: 1.6rem; padding-top: 1.3rem; border-top: 1px solid var(--deep-2); }
.whatif label { display: block; font-weight: 500; }
.whatif output { float: right; font-weight: 600; color: var(--coin); }
.whatif input { width: 100%; margin-top: .5rem; accent-color: var(--coin); height: 28px; }

main { max-width: 1040px; margin: auto; padding: 1.8rem 1.25rem 4rem; }
.figures { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; margin-bottom: 2.3rem; }
.figures div > span { display: block; color: var(--soft); font-size: .92rem; }
.figures strong { font: 700 clamp(1.3rem, 2.8vw, 1.8rem)/1.2 var(--display); display: block; overflow-wrap: anywhere; }
.figures small { color: var(--soft); font-size: .86rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
section { margin-bottom: 2.4rem; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .9rem; flex-wrap: wrap; }
.head .acts { display: flex; gap: .5rem; flex-wrap: wrap; }
.meter { margin-bottom: .8rem; }
.meter p { display: flex; justify-content: space-between; gap: 1rem; margin: 0 0 .25rem; }
.track { height: 10px; background: #d3e1dc; border-radius: 5px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--deep-2); border-radius: 5px; }
.split { display: flex; height: 18px; border-radius: 9px; overflow: hidden; gap: 2px; margin-bottom: .6rem; }
.split i { display: block; background: var(--deep-2); }
.split i:nth-child(2) { background: var(--coin); }
.split i:nth-child(3) { background: var(--soft); }
.list { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .main { min-width: 0; flex: 1; }
.list .main b { font-weight: 600; display: block; overflow-wrap: anywhere; }
.list .main span { color: var(--soft); font-size: .88rem; }
.amt { font-weight: 600; white-space: nowrap; text-align: right; }
.amt.in { color: var(--plus); }
.x { background: none; border: 0; color: var(--soft); cursor: pointer; width: 44px; height: 44px; font-size: 1.2rem; margin-right: -.6rem; }
.empty { background: var(--paper); border: 1.5px dashed var(--line); border-radius: 10px; padding: 1.5rem; }
.empty p { margin: 0 0 .9rem; max-width: 46ch; }
.warn { background: #fdf0cf; border-radius: 8px; padding: .7rem .9rem; margin: 0 0 1.5rem; }

dialog { border: 0; border-radius: 14px; padding: 1.5rem; width: min(480px, calc(100vw - 2rem)); color: var(--ink); max-height: 90vh; }
dialog.wide { width: min(980px, calc(100vw - 2rem)); }
dialog::backdrop { background: rgb(15 61 58 / .6); }
dialog h2 { margin-bottom: 1rem; }
.dialog-acts { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.seg { display: flex; gap: .4rem; margin: .3rem 0 .9rem; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 44px; border: 1.5px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 500; }
.seg input:checked + span { background: var(--deep); color: #fff; border-color: var(--deep); }
.seg input:focus-visible + span { outline: 3px solid var(--coin-dark); outline-offset: 2px; }
.table-wrap { overflow: auto; max-height: 48vh; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: .4rem .55rem; text-align: left; border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; background: var(--ground); font-weight: 600; z-index: 1; }
td.desc { min-width: 220px; }
.cell-select { margin: 0; min-width: 170px; padding: .35rem; }
.mapgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; }
#toast { position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .6rem 1.1rem; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
#toast.on { opacity: 1; }
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; min-height: 0; }
  .figures { grid-template-columns: 1fr 1fr; }
  .two, .whatif { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
