:root{
  --bg: #f4f6f9;
  --panel: #ffffff;
  --card: #ffffff;
  --card-2: #f9fafb;
  --border: #e2e6ed;
  --text: #1a1d23;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --accent: #0C410F;
  --accent-2: #1a6b1f;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --shadow-soft: 0 2px 12px rgba(0,0,0,0.04);
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }

body{
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

a{ color: var(--accent); text-decoration: none; }
a:hover{ text-decoration: underline; }
a.button:hover{ text-decoration: none; }

.app{
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar{
  padding: 18px;
  border-right: 1px solid var(--border);
  background: var(--panel);
}

.brand{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-2);
}

.brand__logo{
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.brand__logo-img{
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: contain;
}

.brand__name{ font-weight: 700; letter-spacing: 0.2px; }
.brand__sub{ font-size: 12px; color: var(--muted); margin-top: 2px; }

.nav{
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav__link{
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--muted);
  font-weight: 500;
}
.nav__link:hover{
  background: var(--card-2);
  border-color: var(--border);
  color: var(--text);
  text-decoration: none;
}
.nav__link.is-active{
  background: #e8f5e9;
  border-color: #a5d6a7;
  color: var(--accent);
  font-weight: 600;
}
.nav__divider{
  height: 1px;
  background: var(--border);
  margin: 6px 12px;
}

.sidebar__footer{
  position: sticky;
  top: calc(100vh - 100px);
  margin-top: 26px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-2);
}

/* ---------- Main ---------- */
.main{
  padding: 18px 18px 28px;
}

.topbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.topbar__title{
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.topbar__subtitle{
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.content{
  margin-top: 14px;
}

/* ---------- Layout Helpers ---------- */
.grid{
  display: grid;
  gap: 12px;
}
.grid.cols-2{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5{ grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.cols-6{ grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* ---------- Cards ---------- */
.card{
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.card__title{
  font-weight: 700;
  margin: 0 0 8px;
}

.card__muted{
  color: var(--muted);
  font-size: 13px;
}

/* ---------- KPI ---------- */
.kpi{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.kpi__value{
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.kpi__label{
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Badges ---------- */
.badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.badge.good{ border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.badge.warn{ border-color: #fde68a; background: #fffbeb; color: #92400e; }
.badge.bad{ border-color: #fecaca; background: #fef2f2; color: #991b1b; }

/* ---------- Table ---------- */
.table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.table th, .table td{
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.table th{
  color: var(--muted);
  font-weight: 650;
  background: var(--card-2);
}

.table tr:last-child td{ border-bottom: none; }
.table td .muted{ color: var(--muted); }

.table th.sortable:hover{ color: var(--accent); background: #e8f5e9; }
.table th.sortable .sort-arrow{ font-size: 11px; }

/* ---------- Tabs ---------- */
.tabs{
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 14px;
}
.tabs a{
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tabs a:hover{ color: var(--text); }
.tabs a.active{
  color: var(--text);
  border-bottom-color: var(--accent);
}
.tabs .tab-count{
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
}

/* ---------- View toggle ---------- */
.view-toggle{
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.view-toggle a{
  padding: 5px 10px;
  font-size: 13px;
  text-decoration: none;
  color: var(--muted);
  background: var(--panel);
  border-right: 1px solid var(--border);
  transition: background .15s, color .15s;
}
.view-toggle a:last-child{ border-right: none; }
.view-toggle a:hover{ background: var(--card-2); }
.view-toggle a.active{
  background: var(--accent);
  color: #fff;
}

/* ---------- Employee cards grid ---------- */
.emp-cards{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.emp-card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  transition: box-shadow .15s;
}
.emp-card:hover{
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.emp-card__code{
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.emp-card__name{
  font-size: 15px;
  font-weight: 650;
  margin: 4px 0 8px;
}
.emp-card__detail{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.emp-card__footer{
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---------- Toolbar / Inputs ---------- */
.toolbar{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.input, .select{
  width: auto;
  min-width: 120px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  outline: none;
  font-size: 13px;
}

.toolbar .input[type="number"]{
  width: 120px;
}

.input::placeholder{ color: var(--muted-2); }

.input:focus, .select:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(40,190,227,0.12);
}

/* ---------- Buttons ---------- */
.button{
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.button:hover{ background: #09A1E0; border-color: #09A1E0; }

.button--ghost{
  background: transparent;
  color: var(--accent);
  border-color: var(--border);
}
.button--ghost:hover{
  background: #e8f5e9;
  border-color: var(--accent);
}

.small{ font-size: 12px; color: var(--muted); }
.muted{ color: var(--muted); }

hr.sep{
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

/* ---------- Form helpers ---------- */
.form-group{
  margin-bottom: 14px;
}

.label{
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.help-text{
  font-size: 12px;
  color: var(--muted-2);
  margin-top: 4px;
}

.error-text{
  font-size: 12px;
  color: var(--bad);
  margin-top: 4px;
}

.required{
  color: var(--bad);
  margin-left: 2px;
}

/* ---------- Mobile ---------- */
@media (max-width: 980px){
  .app{ grid-template-columns: 1fr; }
  .sidebar{ display: none; }
  .main{ padding: 14px; }
  .toolbar{ gap: 8px; }
  .input, .select{ min-width: 140px; }
}

/* ---------- Toolbar filter fixes ---------- */
.toolbar .input,
.toolbar .select,
.toolbar select,
.toolbar input,
.toolbar textarea {
  width: auto !important;
  max-width: 260px;
}

.toolbar input[type="date"].input,
.toolbar input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  color-scheme: light;
}

.toolbar input,
.toolbar select {
  height: 40px;
}

.toolbar label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  background: var(--card-2);
  border: 1px solid var(--border);
  font-size: 13px;
}

/* ---------- Kanban Board ---------- */
.kanban-layout{
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.kanban-pipeline{
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  min-width: 0;
}

.kanban-terminal{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 280px;
  flex-shrink: 0;
}

.kanban-divider{
  width: 1px;
  background: var(--border);
  align-self: stretch;
  flex-shrink: 0;
}

.kanban-col{
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
  min-height: 200px;
  box-shadow: var(--shadow-soft);
}

.kanban-col__header{
  padding: 10px 12px;
  font-weight: 700;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  background: var(--card-2);
}

.kanban-col__body{
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.kanban-card{
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 10px;
  transition: box-shadow 0.15s, border-color 0.15s;
  cursor: pointer;
}

.kanban-card:hover{
  border-color: #7dd8ed;
  box-shadow: 0 2px 8px rgba(40,190,227,0.08);
}

.kanban-card.is-expanded{
  border-color: #7dd8ed;
  background: #fafcff;
}

.kanban-card__summary{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.kanban-card__phone{
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.kanban-card__name{
  font-weight: 650;
  font-size: 13px;
  margin-bottom: 0;
}

.kanban-card__meta{
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.kanban-card__actions{
  margin-top: 8px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.kanban-btn{
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
}

.kanban-btn:hover{ background: #e2e8f0; color: var(--text); }
.kanban-btn.good{ border-color: #bbf7d0; color: var(--good); }
.kanban-btn.good:hover{ background: #f0fdf4; }
.kanban-btn.warn{ border-color: #fde68a; color: var(--warn); }
.kanban-btn.warn:hover{ background: #fffbeb; }
.kanban-btn.bad{ border-color: #fecaca; color: var(--bad); }
.kanban-btn.bad:hover{ background: #fef2f2; }

.kanban-col--submitted .kanban-col__header{ border-top: 3px solid var(--accent); border-radius: var(--radius) var(--radius) 0 0; }
.kanban-col--interview .kanban-col__header{ border-top: 3px solid var(--warn); border-radius: var(--radius) var(--radius) 0 0; }
.kanban-col--offered .kanban-col__header{ border-top: 3px solid var(--accent-2); border-radius: var(--radius) var(--radius) 0 0; }
.kanban-col--started .kanban-col__header{ border-top: 3px solid var(--good); border-radius: var(--radius) var(--radius) 0 0; }
.kanban-col--no_show .kanban-col__header{ border-top: 3px solid var(--muted-2); border-radius: var(--radius) var(--radius) 0 0; }
.kanban-col--rejected .kanban-col__header{ border-top: 3px solid var(--bad); border-radius: var(--radius) var(--radius) 0 0; }

.kanban-section-label{
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted-2);
  margin-bottom: 6px;
}

.kanban-empty{
  padding: 16px 8px;
  font-size: 12px;
  color: var(--muted-2);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

/* SortableJS drag states */
.kanban-card--ghost{
  opacity: 0.4;
  border: 1px dashed var(--accent);
  background: #e8f5e9;
}

.kanban-card--chosen{
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-color: var(--accent);
}

.kanban-card--drag{
  opacity: 0.9;
}

@media (max-width: 1200px){
  .kanban-layout{ flex-direction: column; }
  .kanban-pipeline{ grid-template-columns: repeat(2, 1fr); }
  .kanban-terminal{ width: 100%; }
  .kanban-divider{ display: none; }
}

@media (max-width: 980px){
  .kanban-pipeline{ grid-template-columns: 1fr; }
  .kanban-terminal{ grid-template-columns: 1fr; }
  .kanban-col{ max-height: none; }
}

/* ===== Toast Notifications ===== */
.toast-container{
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast{
  pointer-events: auto;
  min-width: 280px; max-width: 420px;
  padding: 12px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500; line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.3s ease-out;
}
.toast--success{ background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.toast--error{ background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.toast--warn{ background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.toast--info{ background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.toast.is-leaving{ animation: toastOut 0.3s ease-in forwards; }
@keyframes toastIn{ from{ opacity:0; transform:translateX(40px); } to{ opacity:1; transform:translateX(0); } }
@keyframes toastOut{ from{ opacity:1; transform:translateX(0); } to{ opacity:0; transform:translateX(40px); } }

/* ===== Pagination ===== */
.pagination{
  display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 14px 0;
}
.pagination .button{ min-width: 36px; text-align: center; }

/* ===========================================================
   Headcount — utilities & components
   =========================================================== */

/* Stack layout — replaces empty <div style="height:Npx"> spacers */
.stack-12 > * + * { margin-top: 12px; }
.stack-16 > * + * { margin-top: 16px; }

/* Row alignment helpers */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.row-end     { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* KPI size variants — standardize across screens */
.kpi__value--lg { font-size: 22px; }
.kpi__value--xl { font-size: 32px; }
.kpi--primary {
  border: 1px solid #bbf7d0;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 60%);
}
.kpi--alert {
  border: 1px solid #fde68a;
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 60%);
}

/* Small action button — for "needs action" CTAs in tables */
.btn-xs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--bad);
  background: var(--bad);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s;
}
.btn-xs:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(220,38,38,0.2); text-decoration: none; }
.btn-xs--ghost { background: transparent; color: var(--accent); border-color: var(--border); }
.btn-xs--ghost:hover { background: #e8f5e9; border-color: var(--accent); box-shadow: none; }

/* Editable input cue — used on plan-edit target column */
.input--editable {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 6px 8px;
  text-align: right;
  font-weight: 600;
  font-size: 14px;
  width: 90px;
  transition: border-color .15s, background .15s;
}
.input--editable:focus {
  background: #fff;
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(12,65,15,0.15);
}
.input--editable.is-dirty { background: #ecfccb; border-color: var(--good); }

/* Days-left badge — larger, more prominent on contract expiry */
.days-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid var(--border);
}
.days-badge .days-badge__num { font-size: 16px; }
.days-badge .days-badge__unit { font-size: 11px; font-weight: 500; opacity: .85; }
.days-badge--bad  { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.days-badge--warn { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.days-badge--ok   { border-color: var(--border); background: var(--card-2); color: var(--muted); }

/* Per-row action menu — used on contract expiry rows */
.action-menu { position: relative; display: inline-block; }
.action-menu__trigger {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.action-menu__trigger:hover { background: var(--card-2); color: var(--text); }
.action-menu__panel {
  display: none;
  position: absolute;
  right: 0;
  top: 32px;
  z-index: 50;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 6px;
}
.action-menu.is-open .action-menu__panel { display: block; }
.action-menu__item {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
}
.action-menu__item:hover { background: var(--card-2); text-decoration: none; }
.action-menu__item--danger { color: var(--bad); }
.action-menu__divider { height: 1px; background: var(--border); margin: 4px 2px; }

/* Dropdown — shared (used for Export ▾) */
.dropdown { position: relative; display: inline-block; }
.dropdown__panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 50;
  min-width: 160px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 6px;
}
.dropdown.is-open .dropdown__panel { display: block; }
.dropdown__item {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}
.dropdown__item:hover { background: var(--card-2); text-decoration: none; }
.dropdown__divider { height: 1px; background: var(--border); margin: 6px 4px; }
.dropdown__label {
  padding: 6px 10px 2px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Confirm dialog — replaces native confirm() */
.confirm-dialog::backdrop { background: rgba(0,0,0,0.4); }
.confirm-dialog {
  border: 0;
  padding: 0;
  border-radius: 12px;
  max-width: 460px;
  width: 92vw;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}
.confirm-dialog__body {
  padding: 22px 24px 8px;
}
.confirm-dialog__title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 8px;
}
.confirm-dialog__msg {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  white-space: pre-line;
}
.confirm-dialog__footer {
  padding: 16px 24px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Status pill that's clearly non-clickable vs CTA */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--muted);
  white-space: nowrap;
}
.status-pill--ok    { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.status-pill--info  { border-color: #bfdbfe; background: #eff6ff; color: #1e40af; }
.status-pill--warn  { border-color: #fde68a; background: #fffbeb; color: #92400e; }

/* Headcount footer total row — uses design-token, not hard-coded grey */
.table tfoot tr.total-row { font-weight: 700; background: var(--card-2); }
.table tfoot tr.total-row td { border-top: 2px solid var(--border); }

/* Period navigator center label — clickable to jump */
.period-nav__label {
  text-align: center;
  cursor: default;
  padding: 4px 12px;
  border-radius: 8px;
}
.period-nav__label--clickable { cursor: pointer; }
.period-nav__label--clickable:hover { background: var(--card-2); }

/* Unsaved changes indicator */
.unsaved-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warn);
  margin-right: 6px;
  vertical-align: middle;
  animation: unsavedPulse 1.6s ease-in-out infinite;
}
@keyframes unsavedPulse { 0%,100%{opacity:.6} 50%{opacity:1} }

/* Focus rings — system-wide accessibility */
.button:focus-visible,
.button--ghost:focus-visible,
.btn-xs:focus-visible,
.action-menu__trigger:focus-visible,
.dropdown__item:focus-visible,
.action-menu__item:focus-visible,
.nav__link:focus-visible,
a.badge:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.table th.sortable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Sortable header — aria-sort visual */
.table th.sortable[aria-sort="ascending"]  .sort-arrow::after { content: " ▲"; }
.table th.sortable[aria-sort="descending"] .sort-arrow::after { content: " ▼"; }

/* Mobile reflow — collapse KPI grids below 1100px */
@media (max-width: 1100px) {
  .grid.cols-6,
  .grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid.cols-6,
  .grid.cols-5,
  .grid.cols-4,
  .grid.cols-3 { grid-template-columns: 1fr; }
}

/* Filter collapse on mobile — for contract expiry */
.filters-card details { width: 100%; }
.filters-card summary {
  display: none;
  cursor: pointer;
  padding: 4px 0;
  font-weight: 600;
  color: var(--accent);
}
@media (max-width: 720px) {
  .filters-card summary { display: list-item; }
  .filters-card details:not([open]) form { display: none; }
}

/* ===========================================================
   Job Descriptions
   =========================================================== */

/* Status pills (used on list & detail) */
.jd-status{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.jd-status::before{
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted-2);
}
.jd-status--current  { color:#166534; border-color:#bbf7d0; background:#f0fdf4; }
.jd-status--current::before  { background:#16a34a; }
.jd-status--expiring { color:#92400e; border-color:#fde68a; background:#fffbeb; }
.jd-status--expiring::before { background:#d97706; }
.jd-status--expired  { color:#991b1b; border-color:#fecaca; background:#fef2f2; }
.jd-status--expired::before  { background:#dc2626; }
.jd-status--scheduled{ color:#1e40af; border-color:#bfdbfe; background:#eff6ff; }
.jd-status--scheduled::before{ background:#2563eb; }
.jd-status--missing  { color:#475569; }

/* List rows: clickable */
.jd-row{ cursor: pointer; }
.jd-row:hover td{ background:#f8fafc; }
.jd-row td.jd-row__title{ font-weight: 600; }
.jd-row__sub{ color: var(--muted); font-size: 12px; }

/* Detail page hero */
.jd-hero{
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}
.jd-hero__meta{ display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.jd-hero__actions{ display: flex; gap: 8px; flex-wrap: wrap; }
.jd-hero__rolecode{
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

/* Content grid (2 cols on wide screens) */
.jd-content-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.jd-section{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}
.jd-section__head{ display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.jd-section__icon{
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  background: #e8f5e9; color: var(--accent);
  font-size: 16px; font-weight: 700;
}
.jd-section__title{ font-weight: 700; font-size: 14px; }
.jd-section__body{ white-space: pre-wrap; line-height: 1.65; font-size: 13px; }
.jd-section--empty .jd-section__body{ color: var(--muted-2); font-style: italic; }

/* Version timeline */
.jd-timeline{ position: relative; padding-left: 22px; }
.jd-timeline::before{
  content: "";
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--border);
}
.jd-timeline__item{
  position: relative;
  padding: 10px 12px 14px;
  border-left: 3px solid transparent;
  margin-left: -22px;
  padding-left: 28px;
}
.jd-timeline__item::before{
  content: "";
  position: absolute;
  left: 2px; top: 16px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--muted-2);
}
.jd-timeline__item--latest{ border-left-color: var(--accent); background: #f0fdf4; border-radius: 8px; }
.jd-timeline__item--latest::before{ border-color: var(--accent); background: var(--accent); }
.jd-timeline__row{ display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.jd-timeline__version{ font-weight: 700; }
.jd-timeline__note{ color: var(--text); margin-top: 4px; font-size: 13px; }
.jd-timeline__author{ color: var(--muted); font-size: 12px; margin-top: 2px; }

/* Modal (replaces inline styles in jd_list) */
.jd-modal{
  position: fixed; inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
}
.jd-modal.is-open{ display: flex; }
.jd-modal__panel{
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  width: 600px;
  max-width: 92vw;
  max-height: 82vh;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.jd-modal__title{ font-size: 17px; font-weight: 700; margin: 0; }
.jd-modal__topbar{ display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.jd-modal__body{
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  max-height: 50vh;
}
.jd-modal__group{ margin-bottom: 6px; }
.jd-modal__group-head{
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 8px;
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.jd-modal__group-head a{ font-size: 12px; font-weight: 500; }
.jd-modal__check{
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.jd-modal__check:hover{ background: #f8fafc; }
.jd-modal__footer{ display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.jd-modal__count{ color: var(--muted); font-size: 13px; }

/* Form sections */
.jd-form-wrap{ max-width: 960px; }
.jd-form-section{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
}
.jd-form-section__title{
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 12px;
}
.jd-form-grid--2col{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.jd-form-grid--2col .form-group{ margin-bottom: 0; }
.jd-form-section input[type="text"],
.jd-form-section input[type="number"],
.jd-form-section input[type="date"],
.jd-form-section select,
.jd-form-section textarea{
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.jd-form-section textarea{ line-height: 1.55; resize: vertical; }
.jd-form-section input:focus,
.jd-form-section select:focus,
.jd-form-section textarea:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(12, 65, 15, 0.12);
}
.jd-charcount{
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 4px;
  text-align: right;
}
.jd-info-bar{
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* Sticky footer for form */
.jd-sticky-footer{
  position: sticky;
  bottom: 0;
  background: rgba(244,246,249,0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 12px 0;
  margin-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

/* Responsive */
@media (max-width: 980px){
  .jd-content-grid{ grid-template-columns: 1fr; }
  .jd-form-grid--2col{ grid-template-columns: 1fr; }
}

/* Print */
@media print{
  .sidebar, .topbar__right, .jd-sticky-footer, .jd-modal{ display: none !important; }
  .app{ grid-template-columns: 1fr; }
  .jd-content-grid{ grid-template-columns: 1fr; }
  .jd-section, .card{ box-shadow: none; border-color: #ddd; break-inside: avoid; }
  body{ background: #fff; }
}
