:root {
  --ink: #17201d;
  --muted: #6d7773;
  --line: #e6e9e5;
  --paper: #f6f7f3;
  --white: #fff;
  --green: #1f6b52;
  --green-dark: #174e3d;
  --mint: #dff2e8;
  --mint-soft: #eef8f2;
  --lime: #d9f478;
  --amber: #f2b950;
  --red: #c85c54;
  --blue: #5279b7;
  --shadow: 0 18px 45px rgba(29, 52, 43, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "DM Sans", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, .brand { font-family: "Manrope", sans-serif; }

.shell { min-height: 100vh; }
.topbar { height: 74px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 5vw; position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 21px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--green); transform: rotate(-3deg); }
.top-actions, .hero-actions, .row, .filters { display: flex; align-items: center; gap: 12px; }
.role-switch { background: var(--paper); padding: 5px; border-radius: 12px; display: flex; gap: 3px; }
.role-switch button { border: 0; background: transparent; color: var(--muted); padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.role-switch button.active { background: white; color: var(--green); box-shadow: 0 2px 9px rgba(0,0,0,.07); }
.icon-btn { width: 40px; height: 40px; border: 1px solid var(--line); background: white; border-radius: 11px; display: grid; place-items: center; position: relative; }
.dot { width: 7px; height: 7px; background: var(--red); border: 2px solid white; border-radius: 50%; position: absolute; right: 8px; top: 7px; }
.avatar { width: 39px; height: 39px; border-radius: 50%; background: var(--mint); color: var(--green-dark); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.logout-btn { margin-top: auto; border: 0; background: transparent; color: var(--muted); border-radius: 11px; padding: 12px; display: flex; align-items: center; gap: 12px; font-weight: 600; }
.logout-btn:hover { color: var(--red); background: #fae7e5; }
.logout-btn svg { width: 19px; height: 19px; }

.layout { display: grid; grid-template-columns: 236px 1fr; min-height: calc(100vh - 74px); }
.sidebar { padding: 28px 20px; border-right: 1px solid var(--line); background: #fafbf8; display: flex; flex-direction: column; }
.nav-label { color: #9aa29e; text-transform: uppercase; font-size: 10px; letter-spacing: .13em; font-weight: 700; margin: 5px 12px 10px; }
.nav { display: grid; gap: 5px; }
.nav button { border: 0; background: transparent; text-align: left; color: var(--muted); border-radius: 11px; padding: 12px; display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 14px; }
.nav button:hover, .nav button.active { color: var(--green-dark); background: var(--mint-soft); }
.nav button.active { box-shadow: inset 3px 0 var(--green); }
.nav svg { width: 19px; height: 19px; }
.sidebar-card { margin-top: auto; background: var(--green-dark); color: white; border-radius: 16px; padding: 18px; overflow: hidden; position: relative; }
.sidebar-card:after { content:""; position:absolute; width:95px; height:95px; background:rgba(217,244,120,.13); border-radius:50%; right:-30px; top:-30px; }
.sidebar-card p { color: #cee0d9; font-size: 12px; line-height: 1.5; }

.main { padding: 38px 4vw 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; color: var(--green); font-weight: 700; font-size: 11px; margin-bottom: 8px; }
.page-head h1 { margin-bottom: 7px; font-size: clamp(25px, 3vw, 36px); letter-spacing: -.04em; }
.page-head p { color: var(--muted); margin: 0; }
.btn { border: 0; border-radius: 11px; padding: 11px 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { color: white; background: var(--green); box-shadow: 0 8px 20px rgba(31,107,82,.2); }
.btn-primary:hover { background: var(--green-dark); transform: translateY(-1px); }
.btn-light { color: var(--ink); background: white; border: 1px solid var(--line); }
.btn-small { padding: 8px 11px; font-size: 12px; border-radius: 8px; }
.full { grid-column: 1 / -1; }
.notice { background: #fff0d4; color: #725218; border: 1px solid #f1d49c; padding: 12px 15px; border-radius: 12px; margin-bottom: 20px; font-size: 12px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 15px; margin-bottom: 24px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 19px; min-height: 120px; position: relative; overflow: hidden; }
.stat-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--mint-soft); color: var(--green); margin-bottom: 15px; }
.stat strong { font-family: "Manrope"; font-size: 27px; display: block; letter-spacing: -.03em; }
.stat span { color: var(--muted); font-size: 12px; }
.stat-trend { position: absolute; right: 15px; bottom: 17px; color: var(--green); background: var(--mint-soft); border-radius: 20px; padding: 5px 8px; font-size: 10px; font-weight: 700; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .75fr); gap: 20px; }
.card { background: white; border: 1px solid var(--line); border-radius: 17px; padding: 21px; box-shadow: 0 2px 0 rgba(28,40,35,.01); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 17px; }
.card-head h2 { font-size: 16px; margin: 0; }
.link { border: 0; background: transparent; color: var(--green); font-weight: 700; font-size: 12px; }
.mission-list, .activity-list, .candidate-list { display: grid; gap: 10px; }
.mission { border: 1px solid var(--line); border-radius: 13px; padding: 16px; display: grid; grid-template-columns: 1fr auto; gap: 14px; transition: .2s ease; }
.mission:hover { border-color: #bdd4ca; transform: translateY(-1px); box-shadow: 0 10px 25px rgba(29,52,43,.06); }
.mission h3 { font-size: 14px; margin: 0 0 8px; }
.mission-actions { display: grid; justify-items: end; align-content: start; gap: 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 11px; }
.meta span { display: flex; align-items: center; gap: 5px; }
.badge { display: inline-flex; align-items: center; width: fit-content; height: fit-content; padding: 5px 9px; border-radius: 20px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.badge.green { color: var(--green-dark); background: var(--mint); }
.badge.amber { color: #825d17; background: #fff0d4; }
.badge.blue { color: #375a8e; background: #e8eef9; }
.badge.gray { color: #66706c; background: #eff1ef; }
.badge.red { color: #923e38; background: #fae7e5; }

.progress-wrap { margin-bottom: 20px; }
.progress-label { display:flex; justify-content:space-between; font-size:12px; margin-bottom:8px; }
.progress { height: 7px; background: #edf0ec; border-radius: 20px; overflow: hidden; }
.progress span { height:100%; background: var(--green); display:block; border-radius:inherit; }
.checklist { display:grid; gap:12px; }
.check { display:flex; align-items:center; gap:10px; color:var(--muted); font-size:12px; }
.check i { width:22px; height:22px; border-radius:50%; display:grid; place-items:center; background:var(--mint); color:var(--green); font-style:normal; }
.activity { display:grid; grid-template-columns: 34px 1fr; gap:10px; align-items:start; }
.activity-icon { width:31px; height:31px; border-radius:9px; background:var(--paper); display:grid; place-items:center; color:var(--green); }
.activity p { font-size:12px; line-height:1.45; margin:0; }
.activity time { color:#9aa29e; font-size:10px; }

.toolbar { display:flex; justify-content:space-between; gap:14px; margin-bottom:18px; }
.search { background:white; border:1px solid var(--line); border-radius:11px; display:flex; align-items:center; gap:9px; padding:0 12px; flex:1; max-width:440px; }
.search input { width:100%; border:0; outline:0; background:transparent; padding:11px 0; font-size:13px; }
.select { border:1px solid var(--line); background:white; border-radius:11px; padding:10px 12px; color:var(--muted); font-size:12px; outline:0; }
.table-wrap { overflow:auto; background:white; border:1px solid var(--line); border-radius:16px; }
table { border-collapse:collapse; width:100%; min-width:760px; }
th { text-align:left; color:#8b9490; text-transform:uppercase; letter-spacing:.08em; font-size:9px; padding:14px 17px; background:#fafbf9; }
td { border-top:1px solid var(--line); padding:15px 17px; font-size:12px; }
.person { display:flex; align-items:center; gap:10px; }
.person strong { display:block; font-size:12px; }
.person span { color:var(--muted); font-size:10px; }
.anon-avatar { width:35px; height:35px; border-radius:10px; background:var(--mint-soft); color:var(--green); display:grid; place-items:center; font-weight:700; }
.kebab { border:0; background:transparent; font-size:18px; color:var(--muted); }

.kanban { display:grid; grid-template-columns:repeat(3,minmax(230px,1fr)); gap:15px; overflow:auto; padding-bottom:8px; }
.column { background:#eef0ec; border-radius:15px; padding:13px; min-height:350px; }
.column-head { display:flex; justify-content:space-between; align-items:center; padding:3px 3px 12px; font-weight:700; font-size:12px; }
.count { width:21px; height:21px; display:grid; place-items:center; border-radius:6px; background:white; color:var(--muted); font-size:10px; }
.candidate { background:white; border:1px solid var(--line); border-radius:12px; padding:14px; margin-bottom:10px; }
.candidate-top { display:flex; justify-content:space-between; gap:8px; margin-bottom:12px; }
.candidate h3 { margin:0 0 2px; font-size:13px; }
.candidate p { margin:0; color:var(--muted); font-size:10px; }
.score { color:var(--green); font-weight:800; font-size:12px; }
.tags { display:flex; gap:5px; flex-wrap:wrap; margin-bottom:12px; }
.tag { padding:4px 7px; border-radius:6px; background:var(--paper); font-size:9px; color:var(--muted); }
.candidate-foot { display:flex; align-items:center; justify-content:space-between; border-top:1px solid var(--line); padding-top:10px; }
.candidate-foot span { font-size:9px; color:var(--muted); }
.proposal-summary, .muted-block { color: var(--muted); font-size: 12px; line-height: 1.6; }
.action-line { border: 1px solid var(--line); background: white; border-radius: 11px; padding: 12px; display: flex; align-items: center; gap: 10px; text-align: left; color: var(--ink); }
.action-line span { width: 26px; height: 26px; display: grid; place-items: center; color: var(--green); background: var(--mint-soft); border-radius: 8px; font-weight: 800; }

.load-more { text-align:center; padding:16px 0 4px; }
.empty { text-align:center; padding:55px 20px; color:var(--muted); }
.empty-icon { width:54px; height:54px; border-radius:16px; margin:0 auto 14px; background:var(--mint-soft); color:var(--green); display:grid; place-items:center; }
.modal-backdrop { position:fixed; inset:0; background:rgba(15,27,22,.45); z-index:50; display:grid; place-items:center; padding:20px; backdrop-filter:blur(3px); }
.modal { width:min(560px,100%); max-height:90vh; overflow:auto; background:white; border-radius:20px; padding:25px; box-shadow:var(--shadow); animation:pop .2s ease; }
@keyframes pop { from { opacity:0; transform:translateY(10px) scale(.98); } }
.modal-head { display:flex; justify-content:space-between; align-items:start; margin-bottom:20px; }
.modal-head h2 { margin:0 0 4px; font-size:20px; }
.modal-head p { margin:0; color:var(--muted); font-size:12px; }
.close { border:0; background:var(--paper); width:34px; height:34px; border-radius:9px; font-size:20px; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.field { display:grid; gap:6px; }
.field.full { grid-column:1/-1; }
.field label { font-size:11px; font-weight:700; }
.field input, .field select, .field textarea { border:1px solid var(--line); border-radius:10px; padding:11px 12px; outline:0; background:white; font-size:12px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color:var(--green); box-shadow:0 0 0 3px var(--mint-soft); }
.field textarea { resize:vertical; min-height:85px; }
.document-box { display: flex; align-items: center; justify-content: space-between; gap: 15px; background: var(--paper); border: 1px dashed #cbd2cd; border-radius: 12px; padding: 16px; }
.document-box p { color: var(--muted); font-size: 11px; margin: 4px 0 0; }
.modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }
#toast-root { position:fixed; right:22px; bottom:22px; z-index:100; display:grid; gap:8px; }
.toast { background:var(--ink); color:white; padding:12px 16px; border-radius:11px; box-shadow:var(--shadow); font-size:12px; animation:slide .25s ease; }
.toast-error { background: #8d3933; }
@keyframes slide { from { transform:translateX(20px); opacity:0; } }
.mobile-nav { display:none; }

/* ── Candidate / document modals ── */
.profile-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 4px; }
.detail-row { display: grid; gap: 4px; }
.detail-row.full { grid-column: 1 / -1; }
.detail-row label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; }
.detail-row span { font-size: 13px; }
.section-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin: 20px 0 10px; border-top: 1px solid var(--line); padding-top: 16px; }
.doc-list { display: grid; gap: 8px; margin-bottom: 4px; }
.doc-link { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--paper); border-radius: 10px; color: var(--green); font-size: 12px; font-weight: 600; text-decoration: none; border: 1px solid var(--line); transition: .15s; }
.doc-link:hover { background: var(--mint-soft); border-color: #bdd4ca; }
.doc-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.doc-link-muted { color: var(--muted); }
.note-preview { font-size: 11px; color: var(--muted); }
.notes-cell { max-width: 180px; }

.loading-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 20px; background: var(--paper); }
.loading-screen p { color: var(--muted); font-size: 12px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--mint); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, .8fr) minmax(480px, 1.2fr); background: white; }
.auth-aside { background: var(--green-dark); color: white; padding: 7vh 7vw; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-aside:after { content: ""; position: absolute; width: 430px; height: 430px; border: 80px solid rgba(217,244,120,.08); border-radius: 50%; right: -220px; bottom: -180px; }
.brand-inverse { color: white; position: relative; z-index: 1; }
.brand-inverse .brand-mark { background: var(--lime); color: var(--green-dark); }
.auth-aside h1 { font-size: clamp(34px, 4.2vw, 64px); line-height: 1.08; letter-spacing: -.055em; margin-bottom: 24px; }
.auth-aside p { color: #c7d9d2; line-height: 1.7; max-width: 510px; }
.auth-aside small { color: #9db8ae; position: relative; z-index: 1; }
.auth-panel { display: grid; place-items: center; padding: 40px 6vw; background: var(--paper); }
.auth-card { width: min(480px, 100%); background: white; border: 1px solid var(--line); border-radius: 22px; padding: clamp(25px, 5vw, 45px); box-shadow: var(--shadow); }
.auth-card h2 { font-size: 29px; margin-bottom: 8px; }
.auth-card > p { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.auth-form { gap: 13px; }
.auth-link { display: block; margin: 14px auto 0; }
.auth-switch { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 20px; text-align: center; color: var(--muted); font-size: 12px; }
.legal-footer { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.legal-footer .link { font-size: 11px; color: var(--muted); }
.sidebar-legal { flex-direction: column; align-items: flex-start; gap: 4px; margin: 14px 4px; }
.legal-body h2 { font-size: 15px; margin: 22px 0 8px; }
.legal-body h2:first-child { margin-top: 0; }
.legal-body p { color: var(--muted); font-size: 13px; line-height: 1.7; margin-bottom: 4px; }

@media (max-width: 980px) {
  .stats { grid-template-columns:repeat(2,1fr); }
  .grid-2 { grid-template-columns:1fr; }
  .role-switch { display:none; }
}
@media (max-width: 720px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { min-height: 235px; padding: 28px 24px; }
  .auth-aside h1 { font-size: 32px; margin: 18px 0 10px; }
  .auth-aside p { font-size: 12px; margin: 0; }
  .auth-aside small { display: none; }
  .auth-panel { padding: 22px 16px; align-items: start; }
  .auth-card { padding: 24px 20px; }
  .topbar { padding:0 16px; }
  .layout { display:block; }
  .sidebar { display:none; }
  .main { padding:25px 16px 90px; }
  .top-actions .btn { display:none; }
  .page-head { align-items:center; }
  .page-head p { font-size:12px; }
  .stats { grid-template-columns:1fr 1fr; gap:10px; }
  .stat { min-height:105px; padding:15px; }
  .stat-icon { margin-bottom:10px; }
  .toolbar { flex-wrap:wrap; }
  .search { max-width:none; flex-basis:100%; }
  .filters { width:100%; }
  .filters .select { flex:1; min-width:0; }
  .form-grid { grid-template-columns:1fr; }
  .field.full { grid-column:auto; }
  .full { grid-column: auto; }
  .mobile-nav { display:flex; position:fixed; z-index:30; bottom:0; left:0; right:0; background:rgba(255,255,255,.96); border-top:1px solid var(--line); justify-content:space-around; padding:8px 5px calc(8px + env(safe-area-inset-bottom)); backdrop-filter:blur(12px); }
  .mobile-nav button { border:0; background:transparent; color:var(--muted); display:grid; justify-items:center; gap:3px; font-size:9px; }
  .mobile-nav button.active { color:var(--green); }
  .mobile-nav svg { width:19px; height:19px; }
}
@media (max-width: 430px) {
  .stats { grid-template-columns:1fr; }
  .stat { min-height:auto; }
  .page-head h1 { font-size:25px; }
  .page-head .btn span { display:none; }
}
