:root {
  --moss: #1F4D3A;
  --moss-deep: #163A2B;
  --moss-soft: #E3ECE5;
  --lime: #C8E65A;
  --paper: #F7F5EF;
  --card: #FFFFFF;
  --ink: #1A1F1C;
  --muted: #5E6862;
  --line: #E2DED3;
  --line-strong: #CFCABC;
  --danger: #A8322D;
  --danger-soft: #F8E3E1;
  --radius: 12px;
  --display: "Fraunces", Georgia, serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --shadow: 0 1px 2px rgba(22, 58, 43, .06), 0 4px 16px rgba(22, 58, 43, .06);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--moss); }
h1, h2, h3 { font-family: var(--display); font-weight: 650; letter-spacing: -.01em; margin: 0; line-height: 1.15; }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; border-radius: 6px; }
.boot { padding: 40vh 0; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.hidden { display: none !important; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--moss-deep); }
.login-card { width: 100%; max-width: 380px; background: var(--paper); border-radius: 18px; padding: 32px 28px; }
.login-card img { width: 56px; margin-bottom: 18px; }
.login-card h1 { font-size: 26px; margin-bottom: 4px; }
.login-card p { margin: 0 0 22px; color: var(--muted); }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--moss-deep); color: #E4EBE2; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; color: #E4EBE2; text-decoration: none; }
.brand img { width: 26px; filter: brightness(0) invert(.92) sepia(.1); }
.brand b { font-family: var(--display); font-size: 19px; font-weight: 600; }
.brand span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; opacity: .6; display: block; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: #DCE5DE; text-decoration: none; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.07); }
.nav a.active { background: var(--lime); color: var(--moss-deep); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .count { margin-left: auto; font-size: 12px; background: rgba(255,255,255,.14); border-radius: 99px; padding: 0 8px; }
.nav a.active .count { background: rgba(22,58,43,.15); }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,.12); font-size: 13px; color: #B9C7BE; }
.side-foot button { background: none; border: 0; color: #E4EBE2; padding: 0; cursor: pointer; text-decoration: underline; font: inherit; }
main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumb a { color: var(--muted); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; overflow-x: auto; gap: 2px; }
  .brand { padding: 0 8px 0 2px; }
  .brand span, .brand b { display: none; }
  .nav { display: flex; gap: 2px; }
  .nav a { padding: 8px 10px; white-space: nowrap; }
  .nav .count { display: none; }
  .side-foot { display: none; }
  main { padding-top: 20px; }
  h1 { font-size: 25px; }
}

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; font: 600 14px/1 var(--body); padding: 10px 15px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--moss); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--moss); border-color: var(--moss); color: #fff; }
.btn.primary:hover { background: var(--moss-deep); }
.btn.lime { background: var(--lime); border-color: var(--lime); color: var(--moss-deep); }
.btn.danger { color: var(--danger); border-color: #E5BFBB; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(31,77,58,.07); }
.btn.sm { padding: 7px 10px; font-size: 13px; border-radius: 8px; }
.btn svg { width: 16px; height: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

label.f { display: block; margin-bottom: 14px; }
label.f > span, .f-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
label.f > small, .hint { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=url], input[type=number], input[type=search], select, textarea {
  width: 100%; font: 400 15px/1.4 var(--body); color: var(--ink); background: var(--card);
  border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 11px;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--moss); outline-offset: -1px; border-color: var(--moss); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--moss); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel h2 { margin-bottom: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--display); font-size: 32px; font-weight: 650; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.hi { background: var(--moss); color: #fff; border-color: var(--moss); }
.stat.hi span { color: #D4E2D8; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- tables ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; background: #FBFAF6; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover { background: #FAF9F4; }
td .title { font-weight: 600; }
td .sub { color: var(--muted); font-size: 13px; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-family: var(--display); font-size: 19px; margin-bottom: 4px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.list-plain a { text-decoration: none; color: inherit; }
.list-plain a:hover .title { text-decoration: underline; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; background: #EEECE5; color: #4A524D; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .75; }
.pill.open, .pill.placed { background: #DDEFD9; color: #1F5A33; }
.pill.draft { background: #EEECE5; color: #5E6862; }
.pill.closed, .pill.rejected { background: #F1E5E3; color: #8A3A33; }
.pill.new { background: #F2F7D6; color: #4F6312; }
.pill.screening { background: #E2EDF6; color: #2E5878; }
.pill.shortlisted { background: #E8E3F5; color: #4F3F86; }
.pill.interview { background: #FCEBD5; color: #8A5413; }
.pill.submitted { background: #DDEEEC; color: #1E6158; }
.pill.offered { background: #FBE3EC; color: #8D3159; }

.stars { display: inline-flex; gap: 1px; }
.stars button { background: none; border: 0; padding: 1px; cursor: pointer; color: #D3CEC0; font-size: 20px; line-height: 1; }
.stars button.on { color: #D49A1E; }
.stars.ro { font-size: 14px; color: #D49A1E; letter-spacing: 1px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--moss); border-bottom-color: var(--moss); }
.tabs a .count { font-size: 12px; background: var(--moss-soft); color: var(--moss); border-radius: 99px; padding: 1px 7px; margin-left: 4px; }

.savebar { position: sticky; top: 0; z-index: 15; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; background: rgba(247,245,239,.94); backdrop-filter: blur(6px); padding: 12px 0; margin: -12px 0 8px; }
.savebar .state { font-size: 13px; color: var(--muted); }
.savebar .state.dirty { color: #8A5413; font-weight: 600; }
@media (max-width: 860px) { .savebar { top: 56px; } }

.linkbox { display: flex; gap: 8px; align-items: center; background: var(--moss-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.linkbox a { word-break: break-all; font-weight: 600; }
.linkbox .grow { flex: 1; min-width: 200px; }

/* ---------- form builder ---------- */
.builder { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .builder { grid-template-columns: 1fr; } }
.q-card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--moss); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.q-card.locked { border-left-color: var(--line-strong); background: #FBFAF6; }
.q-top { display: grid; grid-template-columns: 1fr 190px; gap: 10px; margin-bottom: 10px; }
@media (max-width: 560px) { .q-top { grid-template-columns: 1fr; } }
.q-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.q-num { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.locked-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.preview { position: sticky; top: 72px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; max-height: calc(100vh - 100px); overflow: auto; box-shadow: var(--shadow); }
.preview .pf { margin-bottom: 14px; }
.preview .pf b { display: block; font-size: 14px; margin-bottom: 4px; }
.preview .pf b i { color: var(--danger); font-style: normal; }
.preview .pf .opt { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 3px 0; }
.preview .fake { border: 1px solid var(--line-strong); border-radius: 8px; height: 36px; background: #FBFAF6; }
.preview .fake.tall { height: 72px; }

/* ---------- poster ---------- */
.poster-grid { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .poster-grid { grid-template-columns: 1fr; } }
.slides { display: flex; flex-wrap: wrap; gap: 16px; }
.slide { flex: 1 1 300px; max-width: 460px; }
.slide canvas { width: 100%; height: auto; border-radius: 10px; display: block; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.slide .row { margin-top: 10px; }
.warn { background: #FCF1DD; color: #6B4510; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }
.warn ul { margin: 0; padding-left: 18px; }

/* ---------- board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.col { background: #EFEDE5; border-radius: var(--radius); padding: 10px; min-height: 220px; }
.col.over { background: var(--moss-soft); outline: 2px dashed var(--moss); }
.col h3 { font-family: var(--body); font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; margin: 2px 4px 10px; }
.kcard { background: var(--card); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; border: 1px solid var(--line); text-decoration: none; display: block; color: inherit; }
.kcard:active { cursor: grabbing; }
.kcard .title { font-weight: 600; font-size: 14px; }
.kcard .sub { font-size: 12.5px; color: var(--muted); }

/* ---------- candidate ---------- */
.cand { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cand { grid-template-columns: 1fr; } }
.cand-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.contact { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 14px; margin: 0; }
.contact dt { color: var(--muted); }
.contact dd { margin: 0; word-break: break-word; }
.answers dt { font-weight: 600; font-size: 14px; margin-top: 14px; }
.answers dt:first-child { margin-top: 0; }
.answers dd { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; }
.cv-frame { width: 100%; height: 78vh; min-height: 520px; border: 1px solid var(--line); border-radius: 10px; background: #F0EEE7; }
.timeline { list-style: none; margin: 14px 0 0; padding: 0; }
.timeline li { padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.timeline .who { font-size: 12.5px; color: var(--muted); }
.timeline .note { white-space: pre-wrap; margin-top: 3px; }
.stickycv { position: sticky; top: 16px; }
.filters { display: grid; grid-template-columns: minmax(180px, 2fr) minmax(160px, 1.3fr) minmax(140px, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 700px) { .filters { grid-template-columns: 1fr; } }

/* ---------- toast & dialog ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.2); font-size: 14px; max-width: 360px; animation: pop .18s ease-out; }
.toast.err { background: var(--danger); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.error-box { background: var(--danger-soft); color: var(--danger); border-radius: 9px; padding: 9px 12px; font-size: 14px; margin-bottom: 12px; }
