:root {
  --bg: #f5f6f3;
  --card: #ffffff;
  --ink: #17201b;
  --muted: #5d6862;
  --line: #e2e6e1;
  --line-strong: #c9d0c9;
  --green: #1b5e20;
  --green-600: #2e7d32;
  --green-50: #eef5ee;
  --gold: #c9952b;
  --gold-50: #faf3e3;
  --danger: #a33a2c;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 1px 2px rgba(23, 32, 27, 0.04), 0 8px 24px rgba(23, 32, 27, 0.05);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
a { color: var(--green-600); }

.topbar { position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 12px 28px; display: flex; align-items: center; gap: 16px; }
.logo { height: 36px; width: auto; display: block; }
.brand-sep { width: 1px; height: 28px; background: var(--line); }
.brand-text { line-height: 1.25; }
.brand-text b { display: block; font-weight: 600; font-size: 14px; }
.brand-text span { font-size: 12.5px; color: var(--muted); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.save-state { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; background: var(--bg); white-space: nowrap; }
.save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.save-state.ok::before { background: var(--green-600); }
.save-state.busy::before { background: var(--gold); }
.save-state.err { color: var(--danger); }
.save-state.err::before { background: var(--danger); }

.btn { appearance: none; border: 1px solid var(--green); background: var(--green); color: #fff; font: 500 14px var(--sans); padding: 11px 20px; border-radius: 8px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { background: #154a19; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { border-color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--green-600); padding-left: 8px; padding-right: 8px; }
.btn.ghost:hover { background: var(--green-50); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .4; cursor: default; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, #fff 0%, var(--bg) 100%); }
.login-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 36px; box-shadow: var(--shadow); }
.login-card .logo { height: 44px; margin-bottom: 26px; }
.login-card h1 { font-family: var(--serif); font-weight: 600; font-size: 27px; line-height: 1.2; margin: 0 0 8px; }
.login-card p { color: var(--muted); margin: 0 0 24px; font-size: 14.5px; }
.login-card label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 16px; padding: 12px; }
.login-error { color: var(--danger); font-size: 13.5px; margin-top: 12px; min-height: 1.2em; }
.kicker { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 600; }

input[type="text"], input[type="password"], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 10px 12px; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(46, 125, 50, .14); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }

.shell { max-width: 1240px; margin: 0 auto; padding: 28px 28px 120px; display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 36px; align-items: start; }
.stepper { position: sticky; top: 84px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 14px; box-shadow: var(--shadow); }
.stepper-head { padding: 0 8px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.stepper-head .pct { font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.stepper-head .pct small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.bar { height: 6px; background: var(--bg); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--green-600), var(--green)); width: 0; transition: width .35s; }
.steps { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 300px); overflow-y: auto; }
.steps button { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 11px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; line-height: 1.3; color: var(--ink); }
.steps button:hover { background: var(--bg); }
.steps button.active { background: var(--green-50); color: var(--green); font-weight: 600; }
.steps .badge { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; border: 1.5px solid var(--line-strong); color: var(--muted); background: #fff; }
.steps button.active .badge { border-color: var(--green); background: var(--green); color: #fff; }
.steps .badge.part { border-color: var(--gold); color: var(--gold); }
.steps .badge.done { border-color: var(--green-600); background: var(--green-600); color: #fff; }

.panel { min-width: 0; }
.step-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.step-meta .kicker { margin: 0; }
.tag { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px; padding: 2px 9px; }
.panel h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(26px, 3vw, 34px); line-height: 1.2; margin: 0 0 10px; letter-spacing: -.005em; }
.panel .lead { color: var(--muted); font-size: 15.5px; max-width: 720px; margin: 0 0 22px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 28px 24px; box-shadow: var(--shadow); }
.field { padding: 22px 0 2px; }
.field + .field { border-top: 1px solid #eef0ec; }
.field > label, .field > .label { display: block; font-weight: 500; margin-bottom: 9px; max-width: 780px; }
.fhint { display: block; font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 2px; }

.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-size: 14.5px; background: #fff; transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--line-strong); }
.choice input { margin-top: 3px; accent-color: var(--green-600); }
.choice.on { border-color: var(--green-600); background: var(--green-50); }
.other-input { margin-top: 8px; max-width: 520px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
table.grid th { background: #f8f9f7; text-align: left; font-weight: 600; font-size: 12px; color: #4b5650; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: bottom; }
table.grid td { border-bottom: 1px solid #eef0ec; padding: 4px; vertical-align: middle; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tbody td:first-child input { min-width: 170px; }
table.grid td.rowlabel { padding: 10px; font-weight: 500; font-size: 13.5px; background: #fafbf9; min-width: 190px; }
table.grid td.rowlabel input { font-weight: 500; }
table.grid input, table.grid select { min-width: 110px; border-color: transparent; background: #f8f9f7; padding: 8px 9px; border-radius: 6px; }
table.grid input:hover, table.grid select:hover { background: #f1f3f0; }
table.grid input:focus, table.grid select:focus { background: #fff; border-color: var(--green-600); }
table.grid th.act, table.grid td.act { width: 38px; text-align: center; padding: 0 4px; }
.row-del { all: unset; cursor: pointer; width: 26px; height: 26px; border-radius: 6px; display: inline-grid; place-items: center; color: var(--muted); font-size: 16px; }
.row-del:hover { background: #fbecea; color: var(--danger); }
.add-row { margin-top: 8px; }

.navbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.navbar-inner { max-width: 1240px; margin: 0 auto; padding: 12px 28px; display: flex; align-items: center; gap: 12px; }
.navbar .pos { margin: 0 auto; font-size: 13px; color: var(--muted); }

.hints { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 22px 0 26px; }
.hint { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font-size: 13.5px; color: #3f4a44; }
.hint b { display: block; font-size: 12px; font-weight: 600; color: var(--green); margin-bottom: 3px; }
.overview { list-style: none; padding: 0; margin: 0; }
.overview li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #eef0ec; font-size: 14.5px; }
.overview li:last-child { border-bottom: none; }
.overview .st { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.overview .st.done { color: var(--green-600); font-weight: 600; }
.submitted-note { background: var(--green-50); color: var(--green); border-radius: 10px; padding: 12px 16px; font-size: 14px; margin-top: 16px; }

.ro { white-space: pre-wrap; background: #f8f9f7; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 40px; }
.ro.empty { color: #a3aaa5; font-style: italic; }
.admin-section { margin-bottom: 26px; }
.admin-section h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; margin: 0 0 10px; }

footer.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 0 24px 100px; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; gap: 18px; padding: 18px 16px 120px; }
  .stepper { position: static; padding: 14px; }
  .steps { display: none; }
  .stepper-head { border: none; margin: 0; padding: 0; }
  .card { padding: 4px 18px 20px; }
  .topbar-inner { padding: 10px 16px; }
  .brand-sep, .brand-text span { display: none; }
  .navbar-inner { padding: 10px 16px; }
  .navbar .pos { display: none; }
  .navbar .btn { flex: 1; justify-content: center; }
  .brand-text b { font-size: 13px; }
  .save-state { font-size: 11.5px; padding: 5px 10px; }
  .logo { height: 30px; }
}

@media print {
  .topbar, .stepper, .navbar, .no-print, .add-row, .row-del { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .shell { display: block; padding: 0; }
  .card { border: none; box-shadow: none; padding: 0; }
  .admin-section { break-inside: auto; }
  .field { break-inside: avoid; }
}
