:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --ink: #1f2a22;
  --muted: #5f6b62;
  --line: #dcd8cc;
  --green: #2f6b3a;
  --green-ink: #ffffff;
  --green-soft: #e3efe2;
  --amber: #b26b00;
  --amber-soft: #fbefd9;
  --red: #b3261e;
  --red-soft: #fbe3e1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 42, 34, .06), 0 2px 8px rgba(31, 42, 34, .05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151a16; --surface: #1e2520; --ink: #e8ece6; --line: #334036;
    --muted: #a2ada4; --green: #6fbf7c; --green-ink: #0f1a11; --green-soft: #213528;
    --amber: #e3a54a; --amber-soft: #3a2e1b; --red: #f08b83; --red-soft: #3d2220;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.5; }
a { color: var(--green); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 650; color: var(--ink); text-decoration: none; }
.leaf { width: 18px; height: 18px; border-radius: 0 60% 0 60%; background: var(--green); display: inline-block; }
.nav { display: flex; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.nav a, .nav .link { padding: .4rem .65rem; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: .95rem; }
.nav a[aria-current="page"] { background: var(--green-soft); color: var(--green); font-weight: 600; }
.nav a:hover, .nav .link:hover { background: var(--bg); }
.menu-btn { display: none; margin-left: auto; }
@media (max-width: 760px) {
  .menu-btn { display: inline-flex; }
  .nav { display: none; width: 100%; flex-direction: column; }
  .nav.open { display: flex; }
}

.page { max-width: 880px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.grid .card + .card { margin-top: 0; }
.stack > * + * { margin-top: .75rem; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
input, select, textarea { width: 100%; font: inherit; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--green) 40%, transparent); outline-offset: 1px; }
.row { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.row > .narrow { flex: 0 0 130px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .75rem; margin: 0; }
legend { font-weight: 600; padding: 0 .25rem; }

button, .btn { font: inherit; cursor: pointer; border-radius: 8px; padding: .55rem 1rem; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none; }
button.primary, .btn.primary { background: var(--green); border-color: var(--green); color: var(--green-ink); font-weight: 600; }
button.link { border: 0; background: none; padding: 0; color: var(--green); text-decoration: underline; }
button:disabled { opacity: .6; cursor: default; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.checklist li:first-child { border-top: 0; }
.checklist .state { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; flex: none; }
.done .state { background: var(--green); color: var(--green-ink); }
.open .state { border: 2px solid var(--amber); }
.checklist .grow { flex: 1; }

.gate { font-size: 2rem; font-weight: 700; letter-spacing: .3rem; color: var(--green); }
.bar { height: 12px; background: var(--bg); border-radius: 6px; overflow: hidden; display: flex; border: 1px solid var(--line); }
.bar .approved { background: var(--green); }
.bar .pending { background: repeating-linear-gradient(45deg, var(--amber), var(--amber) 4px, var(--amber-soft) 4px, var(--amber-soft) 8px); }
.chip { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--bg); border: 1px solid var(--line); }
.chip.pending { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.chip.approved { background: var(--green-soft); color: var(--green); border-color: transparent; }
.chip.rejected { background: var(--red-soft); color: var(--red); border-color: transparent; }
.swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; vertical-align: -1px; margin-right: .3rem; border: 1px solid rgba(0,0,0,.15); }

table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .5rem .4rem; border-top: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-top: 0; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: .5rem 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }

.error { background: var(--red-soft); color: var(--red); padding: .6rem .8rem; border-radius: 8px; }
.notice { background: var(--amber-soft); color: var(--ink); padding: .6rem .8rem; border-radius: 8px; }
.contract { white-space: pre-wrap; max-height: 50vh; overflow: auto; background: var(--bg); padding: 1rem; border-radius: 8px; border: 1px solid var(--line); }
.signin { max-width: 420px; margin: 8vh auto 0; }
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; }
.tabs button[aria-selected="true"] { background: var(--green-soft); color: var(--green); border-color: transparent; font-weight: 600; }
.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: .6rem 1rem; border-radius: 8px; box-shadow: var(--shadow); max-width: calc(100% - 2rem); }
.skeleton { color: var(--muted); padding: 2rem 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
