:root {
  --ink: #1d2433; --muted: #5b6475; --line: #d9dde5; --bg: #f5f6f8; --card: #fff;
  --brand: #0e47a1; --brand-dark: #0a3478; --accent: #f4ad0d; --err: #b3261e; --ok: #1e7b45;
  --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; }
header.site { background: var(--brand); color: #fff; padding: 36px 0 32px; border-bottom: 4px solid var(--accent); }
header.site h1 { margin: 4px 0 8px; font-size: 1.9rem; line-height: 1.2; }
header.site .lead { margin: 0; opacity: .9; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 600; opacity: .85; }
main.wrap { padding-top: 28px; padding-bottom: 60px; }
footer.site { border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: .9rem; }

.intro, .step, .notice, .panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; margin-bottom: 20px; }
.intro ul { padding-left: 20px; }
.notice { border-left: 4px solid var(--accent); }
.error-summary { border-left-color: var(--err); }
.error-summary strong { color: var(--err); }

h2 { margin: 0 0 6px; font-size: 1.35rem; }
h2:focus { outline: none; }
.hint { color: var(--muted); font-size: .9rem; margin: 4px 0 10px; }
.field { margin: 18px 0; border: 0; padding: 0; }
fieldset.field { min-width: 0; }
label, legend { display: block; font-weight: 600; margin-bottom: 6px; }
legend { padding: 0; }
.req { color: var(--err); font-weight: 400; }
input[type=text], input[type=email], input[type=url], input[type=tel], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #b9c0cc; border-radius: 6px; font: inherit; background: #fff; color: inherit;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid rgba(14,71,161,.3); border-color: var(--brand); }
[aria-invalid="true"], fieldset.invalid { border-color: var(--err) !important; }
fieldset.invalid legend { color: var(--err); }
.error { color: var(--err); font-size: .9rem; margin: 6px 0 0; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.grid2 .field { margin: 12px 0; }
.checks label { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.checks.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.checks.inline { display: flex; gap: 22px; flex-wrap: wrap; }
.check { font-weight: 400 !important; display: flex !important; gap: 10px; align-items: flex-start; margin: 10px 0; }
.checks input, .check input { margin-top: 5px; flex: none; }
.card-option { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; }
.card-option:has(input:checked) { border-color: var(--brand); background: #eef3fb; }
.upload input[type=file] { display: block; padding: 10px; border: 1px dashed #b9c0cc; border-radius: 6px; width: 100%; background: #fafbfc; }
.hp { position: absolute; left: -9999px; }

.btn { font: inherit; font-weight: 600; padding: 11px 22px; border-radius: 6px; border: 1px solid #b9c0cc; background: #fff; color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.step-buttons { display: none; }

/* Step mode (only with JavaScript) */
.steps-nav { display: none; }
body.js .steps-nav { display: flex; list-style: none; padding: 0; margin: 0 0 18px; gap: 6px; counter-reset: s; flex-wrap: wrap; }
body.js .steps-nav li { counter-increment: s; flex: 1; min-width: 90px; font-size: .8rem; color: var(--muted); border-top: 4px solid var(--line); padding-top: 6px; }
body.js .steps-nav li::before { content: counter(s) ". "; }
body.js .steps-nav li.done { border-color: var(--ok); }
body.js .steps-nav li.current { border-color: var(--brand); color: var(--ink); font-weight: 600; }
body.js .step { display: none; }
body.js .step.active { display: block; }
body.js .step-buttons { display: flex; justify-content: space-between; }
body.js .step-buttons #next-btn { margin-left: auto; }
[hidden] { display: none !important; }

/* Admin */
table { width: 100%; border-collapse: collapse; background: #fff; font-size: .92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #eef1f5; font-weight: 600; }
.tag { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: #fdf1d0; color: #7a5800; margin: 1px 2px 1px 0; }
.tag.over { background: #fbe0de; color: var(--err); }
.tag.okk { background: #ddf1e5; color: var(--ok); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.toolbar select { width: auto; }
dl.detail { display: grid; grid-template-columns: 260px 1fr; gap: 6px 18px; margin: 0; }
dl.detail dt { font-weight: 600; color: var(--muted); }
dl.detail dd { margin: 0; white-space: pre-wrap; }
.wide { max-width: 1200px; }

@media (max-width: 640px) {
  .grid2, .checks.cols { grid-template-columns: 1fr; }
  dl.detail { grid-template-columns: 1fr; }
  header.site h1 { font-size: 1.5rem; }
  .intro, .step, .notice { padding: 18px; }
}
td:first-child a { white-space: nowrap; }

/* Save & resume */
.notice.ok { border-left-color: var(--ok); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.btn.ghost:hover { background: #eef3fb; }
body.js .step-buttons { gap: 10px; flex-wrap: wrap; align-items: center; }
.autosave-note { text-align: right; min-height: 1.4em; margin: 8px 0 0; }
.save-panel { background: var(--card); border: 2px solid var(--brand); border-radius: var(--radius); padding: 20px 24px; margin: 16px 0; }
.save-panel h3 { margin: 0 0 6px; font-size: 1.15rem; }
.save-panel label { margin-top: 12px; }
.save-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.save-msg { margin: 12px 0 0; font-weight: 600; }
.save-msg.ok { color: var(--ok); }
.save-msg.error { color: var(--err); }
.resend { margin: 12px 0; }
.resend summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.resend-body { padding: 10px 0 0; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 220px; }
.file-list { list-style: none; padding: 0; margin: 0 0 8px; }
.file-list li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 12px; background: #eef6f0; border: 1px solid #cfe5d6; border-radius: 6px; margin-bottom: 6px; }
.file-list li::before { content: "✓"; color: var(--ok); font-weight: 700; }
.fname { font-weight: 600; overflow-wrap: anywhere; }
.fsize { color: var(--muted); font-size: .85rem; }
.link-btn { background: none; border: 0; padding: 4px; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; margin-left: auto; }
.upload.invalid input[type=file] { border-color: var(--err); }
.upload.invalid .upload-status { color: var(--err); font-weight: 600; }
.upload-status:empty { display: none; }

/* Call criteria shown above the related questions */
.criterion { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 26px; }
.crit-text { margin: 0 0 10px; padding: 10px 14px; background: #f3f6fb; border-left: 3px solid var(--brand); border-radius: 0 6px 6px 0; font-size: .93rem; }
fieldset.yn { margin: 10px 0; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
fieldset.yn legend { float: left; margin: 0; min-width: 80px; }
fieldset.yn .error { flex-basis: 100%; }

/* Eligibility step: questions per criterion, then common questions */
.option-questions, .common-questions { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 6px; }
.option-questions h3, .common-questions h3 { margin: 16px 0 4px; font-size: 1.08rem; color: var(--brand); }
.common-questions .criterion:first-of-type { border-top: 0; margin-top: 8px; padding-top: 0; }

/* Live e-mail messages */
.live-msg { margin: 6px 0 0; font-size: .9rem; min-height: 0; }
.live-msg:empty { display: none; }
.live-msg.bad { color: var(--err); font-weight: 600; }
.live-msg.ok { color: var(--ok); font-weight: 600; }

/* Language switcher */
.site-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.langs { display: flex; gap: 4px; }
.langs a { color: #fff; text-decoration: none; font-size: .85rem; font-weight: 600; padding: 4px 9px; border: 1px solid rgba(255,255,255,.45); border-radius: 6px; min-width: 40px; text-align: center; }
.langs a:hover { background: rgba(255,255,255,.12); }
.langs a[aria-current="true"] { background: #fff; color: var(--brand); border-color: #fff; }
.check > span { flex: 1; }

/* Logo bar */
.brandbar{background:#fff;border-bottom:1px solid #e3e6ec}
.brandbar-in{display:flex;flex-wrap:wrap;align-items:center;gap:10px 20px;padding-top:12px;padding-bottom:12px}
.brand-pfd img{display:block;height:60px;width:auto}
.brand-ec{margin-left:auto}
.brand-ec img{display:block;height:52px;width:auto}
.langbar{background:#f3f5f8;border-bottom:1px solid #e3e6ec}
.langbar-in{display:flex;justify-content:flex-end;align-items:center;padding-top:5px;padding-bottom:5px}
.langs-dark{display:flex;gap:4px}
.langs-dark a{color:#1d2433;text-decoration:none;font-size:12.5px;font-weight:600;padding:3px 9px;border:1px solid transparent;border-radius:5px;min-width:36px;text-align:center;line-height:1.4}
.langs-dark a:hover{border-color:#0e47a1;color:#0e47a1;background:#fff}
.langs-dark a[aria-current=true]{background:#0e47a1;border-color:#0e47a1;color:#fff}
@media (max-width:560px){.brand-pfd img{height:46px}.brand-ec img{height:40px}}
.muted { color: #5b6473; }
table.users .btn + form .btn, .users form + form { margin-left: 4px; }
/* Admin: applications compared with seats */
.seat { display:inline-block; min-width:118px; padding:6px 10px; border-radius:8px; border-left:4px solid; line-height:1.25; font-size:.9rem; }
.seat strong { font-size:1.1rem; margin-right:3px; }
.seat span { display:block; font-size:.78rem; opacity:.85; }
.seat-low { background:#fff4dc; border-color:#d98e04; color:#6b4500; }
.seat-ok  { background:#e3f3e8; border-color:#2e8b57; color:#1d5c38; }
.seat-hot { background:#cfead9; border-color:#146c3c; color:#0f4a2a; font-weight:600; }
.seat-none { background:#f3f4f7; border-color:#c3c8d2; color:#6b7280; }
.seat-key { display:inline-block; width:18px; height:13px; border-radius:3px; vertical-align:-2px; margin-left:6px; border-left:4px solid; box-sizing:border-box; }
.seat-legend { line-height:1.9; }
/* Admin: search */
.search-box { flex: 1 1 280px; }
.search-box input { width: 100%; box-sizing: border-box; padding: 11px 14px; border: 1px solid #b9c0cc; border-radius: 6px; font: inherit; background: #fff; }
.search-box input:focus { outline: 3px solid rgba(244,173,13,.45); border-color: var(--brand); }
.result-count { margin: -4px 0 12px; }
.snip-row td { border-top: 0 !important; padding-top: 0 !important; font-size: .85rem; color: #4a5260; }
.snip-label { font-weight: 600; color: #2b3240; }
mark { background: #ffe58a; padding: 0 2px; border-radius: 2px; }
/* Admin: application page header */
.app-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; }
.app-head h1 { margin-bottom: 6px; }
.btn-light { background: #fff; color: var(--brand); border-color: #fff; text-decoration: none; white-space: nowrap; }
.btn-light:hover { background: #eef2fb; }

/* Application statuses */
.status { display:inline-block; padding:3px 10px; border-radius:99px; font-size:.8rem; font-weight:700; white-space:nowrap; border:1px solid transparent; }
.st-new { background:#eef1f6; color:#4a5260; border-color:#d9dee7; }
.st-review { background:#e4edfb; color:#1b4fa0; border-color:#c4d6f5; }
.st-ok { background:#e3f3e8; color:#1d5c38; border-color:#bfe2cb; }
.st-short { background:#fff1d1; color:#6b4500; border-color:#f3d998; }
.st-yes { background:#1d7a46; color:#fff; }
.st-reserve { background:#efe7fb; color:#5b2d9a; border-color:#dacbf3; }
.st-no { background:#fde7e7; color:#8b1d1d; border-color:#f4c5c5; }
.status-panel { display:grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px 32px; }
.status-panel .status-history { grid-column: 1 / -1; }
@media (max-width: 800px) { .status-panel { grid-template-columns: 1fr; } }
.status-form { display:flex; flex-direction:column; gap:6px; }
.status-form select, .status-form textarea { width:100%; box-sizing:border-box; }
.status-form .btn { align-self:flex-start; margin-top:4px; }
.status-note { margin:6px 0 0; color:#3a4250; font-size:.9rem; }
.status-history summary { cursor:pointer; font-weight:600; color:var(--brand); }
.status-history ul { margin:8px 0 0; padding-left:18px; } .status-history li { margin:6px 0; font-size:.9rem; }
.status-chips { display:flex; flex-wrap:wrap; gap:6px; margin:0 0 14px; }
.status-chips a { text-decoration:none; } .status-chips a.on .status { outline:2px solid var(--brand); outline-offset:1px; }
.status-chips .count { margin-left:4px; opacity:.8; font-weight:600; }
.bulk { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin: 0 0 10px; font-size:.92rem; }
.bulk select { width:auto; }

.dup-box { margin-top:8px; padding:12px 14px; background:#fff4dc; border-left:4px solid #d98e04; border-radius:6px; }
.dup-box .hint { margin:8px 0 0; }

.danger-zone summary { cursor:pointer; color:#8b1d1d; }
.danger-zone[open] { border-color:#f4c5c5; }
.btn.danger { background:#b3261e; border-color:#b3261e; color:#fff; }
.btn.danger:hover { background:#8f1e18; }

.head-actions { display:flex; gap:8px; flex-wrap:wrap; }
.send-panel summary { cursor:pointer; }

/* ---------- Admin: left menu (collapsed to icons by default) ---------- */
body.admin { --sb: 64px; padding-left: var(--sb); transition: padding-left .18s ease; }
body.admin.sb-open { --sb: 232px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sb); background: #0b2e6b; color: #dfe7f6; display: flex; flex-direction: column; z-index: 50; overflow: hidden; transition: width .18s ease; border-right: 3px solid var(--accent); }
.sidebar a, .sb-toggle { display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 19px; color: #dfe7f6; text-decoration: none; white-space: nowrap; font: 600 .93rem/1 inherit; font-family: inherit; }
.sb-toggle { background: none; border: 0; width: 100%; cursor: pointer; height: 60px; border-bottom: 1px solid rgba(255,255,255,.12); color: #fff; }
.sidebar svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar span { opacity: 0; transition: opacity .12s; }
body.sb-open .sidebar span, body.sb-mobile-open .sidebar span { opacity: 1; }
.sidebar a:hover, .sb-toggle:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar a[aria-current="page"] { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar a:focus-visible, .sb-toggle:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.sb-main { padding: 8px 0; flex: 1; overflow-y: auto; overflow-x: hidden; }
.sb-foot { border-top: 1px solid rgba(255,255,255,.12); padding: 8px 0; }
.sb-user { display: flex; align-items: center; gap: 12px; padding: 8px 14px 10px; white-space: nowrap; }
.sb-user strong { display: block; color: #fff; font-size: .9rem; } .sb-user small { font-size: .78rem; opacity: .8; }
.sb-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #0b2e6b; display: grid; place-items: center; font-weight: 800; flex: none; opacity: 1 !important; }
.sb-ver { margin: 4px 0 0; padding: 0 12px; font-size: .72rem; opacity: .55; white-space: nowrap; text-align: center; }
body.sb-open .sb-ver { text-align: left; padding-left: 20px; }
.sb-mobile { display: none; }
@media (max-width: 800px) {
  body.admin, body.admin.sb-open { --sb: 232px; padding-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 30px rgba(0,0,0,.25); }
  body.sb-mobile-open .sidebar { transform: none; }
  .sb-toggle { pointer-events: none; }
  .sb-mobile { display: grid; place-items: center; position: fixed; top: 10px; left: 10px; z-index: 40; width: 42px; height: 42px; border-radius: 10px; border: 0; background: #0b2e6b; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
  .sb-mobile svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .sb-scrim { position: fixed; inset: 0; background: rgba(10,20,40,.4); z-index: 45; }
  body.admin header.site .wrap { padding-left: 56px; }
}
