:root {
  --ink: #14241c;
  --ink-soft: #3c5248;
  --muted: #66786f;
  --line: #e3dcd1;
  --paper: #f4f0e8;
  --card: #fffcf7;
  --green: #0e6b45;
  --green-deep: #0b3d2c;
  --green-mid: #16875a;
  --green-soft: #e7f5ee;
  --saffron: #e07a2f;
  --saffron-deep: #9a4b12;
  --saffron-soft: #fff1e4;
  --danger: #8f2d2d;
  --danger-soft: #fdecec;
  --shadow: 0 18px 50px rgba(20, 36, 28, 0.08);
  --sans: "Outfit", "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(1000px 420px at 110% -10%, rgba(224, 122, 47, 0.16), transparent 55%),
    radial-gradient(800px 380px at -10% 0%, rgba(14, 107, 69, 0.12), transparent 50%),
    var(--paper);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green); }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
.skip {
  position: absolute; left: 12px; top: -40px; background: white; padding: 8px 12px; z-index: 5;
}
.skip:focus { top: 12px; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 30;
  max-width: min(420px, calc(100vw - 32px));
  background: var(--green-deep); color: white;
  padding: 14px 16px; border-radius: 14px;
  box-shadow: var(--shadow);
}
.toast.bad { background: var(--danger); }

.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--green-deep);
  color: #f6f1e8;
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh;
  z-index: 2;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px; text-decoration: none; color: inherit; }
.brand img { width: 42px; height: 42px; border-radius: 12px; }
.brand small { display: block; letter-spacing: 0.16em; font-size: 10px; color: #f0a05a; font-weight: 700; }
.brand strong { font-family: var(--serif); font-size: 26px; font-weight: 560; letter-spacing: -0.03em; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  color: rgba(246, 241, 232, 0.78);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 550;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a.active, .nav a:hover { background: rgba(255, 255, 255, 0.08); color: white; }
.nav a.active { box-shadow: inset 3px 0 0 var(--saffron); }
.sidebar .who { margin-top: auto; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); }
.sidebar .who span { display: block; color: rgba(246, 241, 232, 0.7); font-size: 13px; }
.sidebar .who button {
  margin-top: 10px; width: 100%;
  background: transparent; color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px; padding: 8px;
}

.main { padding: 28px 32px 64px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 22px; }
.page-head h1 { font-family: var(--serif); font-size: 40px; font-weight: 560; letter-spacing: -0.03em; line-height: 1.05; }
.lede { color: var(--ink-soft); max-width: 62ch; margin-top: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid-4, .grid-3, .grid-2 { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 26px; }

.card {
  background: var(--card);
  border: 1px solid rgba(227, 220, 209, 0.9);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}
.stat .label { color: var(--muted); font-size: 13px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; }
.stat strong { display: block; margin-top: 8px; font-family: var(--serif); font-size: 36px; font-weight: 560; letter-spacing: -0.03em; }
.stat em { font-style: normal; color: var(--saffron-deep); font-weight: 650; }

.btn {
  border: 0; border-radius: 12px; padding: 11px 16px;
  background: var(--green); color: white; font-weight: 650;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { background: var(--green-mid); }
.btn.secondary { background: white; color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { border-color: var(--green); background: white; }
.btn.saffron { background: var(--saffron); color: #2a1608; }
.btn.saffron:hover { background: #c96a22; }
.btn.ghost { background: transparent; color: var(--green-deep); border: 1px solid transparent; padding-inline: 8px; }
.btn.danger { background: white; color: var(--danger); border: 1px solid #f0c8c8; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.small { padding: 7px 10px; font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field span, .label { font-size: 13px; font-weight: 650; color: var(--ink-soft); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], select, textarea {
  width: 100%;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(14, 107, 69, 0.12); }
.search { max-width: 320px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 3px 9px;
  font-size: 12px; font-weight: 700;
  background: var(--green-soft); color: var(--green-deep);
}
.badge.wait { background: var(--saffron-soft); color: var(--saffron-deep); }
.badge.closed { background: #eeeae4; color: var(--muted); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: white; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: #faf7f2; position: sticky; top: 0; }
tr.incomplete td { background: #fff8f1; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f3faf6; }
.person { font-weight: 650; }
.sub { color: var(--muted); font-size: 13px; }

.score {
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eeeae4;
}
.score-high { background: var(--green-soft); color: var(--green-deep); }
.score-mid { background: var(--saffron-soft); color: var(--saffron-deep); }
.score-low { background: var(--danger-soft); color: var(--danger); }

.meter { height: 8px; background: #ece6dc; border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #7dcea0); }
.bar { height: 8px; background: #ece6dc; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--saffron); }

.layers { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.layer-col { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 12px; min-width: 0; }
.layer-col h3 { font-size: 14px; margin-bottom: 8px; }
.layer-col .count { font-family: var(--serif); font-size: 28px; }
.scroll-list { max-height: 360px; overflow: auto; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.mini {
  border-top: 3px solid var(--green);
  background: var(--paper);
  border-radius: 10px;
  padding: 8px;
}
.mini.saffron { border-top-color: var(--saffron); }
.mini strong { display: block; font-size: 14px; }
.mini span { color: var(--muted); font-size: 12px; }

.drop {
  border: 1.5px dashed #c9bfb1;
  border-radius: 16px;
  padding: 18px;
  background: #fffaf4;
}
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label {
  display: flex; gap: 8px; align-items: center;
  background: white; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 10px; font-size: 14px;
}
details.group { border: 1px solid var(--line); border-radius: 14px; background: white; padding: 0 12px; }
details.group + details.group { margin-top: 8px; }
details.group summary { cursor: pointer; padding: 12px 0; font-weight: 650; }
.reviewer-line { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--paper); border-radius: 999px; padding: 4px 8px; font-size: 12px; color: var(--ink-soft); }

.callout { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.callout.attention, .card.attention { background: var(--saffron-soft); border-color: #f0d2b8; }
.rules { display: grid; gap: 10px; }
.rules article { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.rules h3 { font-size: 15px; margin-bottom: 4px; }
.rules p { color: var(--ink-soft); font-size: 14px; }

.drawer-back { position: fixed; inset: 0; background: rgba(20, 36, 28, 0.35); z-index: 20; display: flex; justify-content: flex-end; }
.drawer { width: min(560px, 100%); height: 100%; background: var(--paper); overflow: auto; padding: 22px; box-shadow: var(--shadow); }
.q-row { margin-top: 12px; }
.q-row .top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 6px; }

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}
.login-hero {
  background:
    radial-gradient(500px 280px at 20% 80%, rgba(224, 122, 47, 0.35), transparent 60%),
    var(--green-deep);
  color: #f6f1e8;
  padding: 48px;
  display: flex; flex-direction: column; justify-content: flex-start; gap: 48px;
}
.login-hero h1 { font-family: var(--serif); font-size: clamp(42px, 5vw, 68px); font-weight: 560; letter-spacing: -0.035em; line-height: 0.98; max-width: 10ch; }
.login-hero p { max-width: 36ch; color: rgba(246, 241, 232, 0.82); font-size: 18px; }
.login-panel { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: min(440px, 100%); }
.login-card h2 { font-family: var(--serif); font-size: 32px; font-weight: 560; margin: 8px 0 6px; }

.survey-body { background:
  radial-gradient(700px 300px at 100% 0%, rgba(224, 122, 47, 0.18), transparent 50%),
  radial-gradient(600px 280px at 0% 100%, rgba(14, 107, 69, 0.12), transparent 50%),
  var(--paper);
}
.survey-shell { width: min(760px, calc(100% - 28px)); margin: 28px auto 48px; }
.survey-card { background: var(--card); border-radius: 24px; padding: 28px 28px 22px; box-shadow: var(--shadow); border: 1px solid rgba(227, 220, 209, 0.8); }
.survey-card header { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.survey-card header img { width: 48px; height: 48px; border-radius: 14px; }
.kicker { letter-spacing: 0.14em; text-transform: uppercase; font-size: 11px; font-weight: 750; color: var(--saffron-deep); }
.survey-card h1 { font-family: var(--serif); font-size: 36px; font-weight: 560; letter-spacing: -0.03em; line-height: 1.05; }
.scale-legend { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; margin: 16px 0; }
.question { padding: 16px 0; border-top: 1px solid var(--line); }
.question legend { padding: 0; font-weight: 600; }
.q-no { color: var(--saffron-deep); font-variant-numeric: tabular-nums; margin-right: 8px; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.scale-opt { position: relative; }
.scale-opt input { position: absolute; opacity: 0; inset: 0; }
.scale-opt span {
  display: grid; place-items: center;
  height: 52px; border-radius: 14px;
  border: 1.5px solid var(--line); background: white;
  font-weight: 700; font-size: 18px;
}
.scale-opt:hover span { border-color: var(--saffron); }
.scale-opt input:focus-visible + span { outline: 3px solid var(--saffron); outline-offset: 2px; }
.scale-opt input:checked + span { background: var(--green); color: white; border-color: var(--green); }
.no-answer {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 10px; padding: 8px 12px; border-radius: 12px;
  border: 1.5px solid var(--line); color: var(--ink-soft); font-size: 14px;
}
.no-answer input { width: 16px; height: 16px; accent-color: var(--saffron-deep); }
.no-answer:has(input:checked) { border-color: var(--saffron); background: var(--saffron-soft); color: var(--saffron-deep); font-weight: 650; }
.question.missing legend { color: var(--danger); }
.survey-foot {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
}
.hidden-fields { position: absolute; left: -9999px; height: 0; overflow: hidden; }

.empty { padding: 28px; text-align: center; color: var(--ink-soft); }
.muted { color: var(--muted); }
.warn { background: var(--saffron-soft); border-radius: 12px; padding: 10px 12px; color: var(--saffron-deep); }

:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }

@media (max-width: 1100px) {
  .grid-4, .grid-6, .layers { grid-template-columns: repeat(3, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell, .login { display: block; }
  .sidebar { position: relative; height: auto; }
  .nav { flex-direction: row; overflow: auto; }
  .sidebar .who { margin-top: 12px; }
  .main { padding: 20px 16px 48px; }
  .page-head, .callout, .survey-foot, .grid-2 { display: block; }
  .page-head h1 { font-size: 32px; }
  .login-hero { min-height: 280px; padding: 28px 20px; }
  .grid-4, .grid-6, .layers { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
