:root {
  --primary: #7B61FF;
  --primary-light: #EEE9FF;
  --primary-dark: #5A3FD4;
  --sidebar-bg: #13111F;
  --sidebar-text: #A89EC9;
  --sidebar-hover: #1E1A31;
  --bg: #F7F7FA;
  --surface: #FFFFFF;
  --border: #E4E4EE;
  --text: #0D0B1F;
  --text-2: #5A5770;
  --text-3: #9896AE;
  --success: #22C55E;
  --success-light: #DCFCE7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 228px; min-width: 228px; background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  overflow-y: auto; z-index: 100;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.logo-mark {
  width: 30px; height: 30px; background: var(--primary);
  border-radius: 7px; display: flex; align-items: center;
  justify-content: center; font-weight: 800; font-size: 15px; color: #fff; flex-shrink: 0;
}

.logo-name { font-weight: 700; font-size: 14.5px; color: #fff; }
.logo-sub  { font-size: 10.5px; color: var(--sidebar-text); }

.sidebar-nav { padding: 10px 8px; flex: 1; }

.nav-section {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-3);
  padding: 14px 8px 5px;
}

.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 5px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: all 0.12s; margin-bottom: 1px;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { background: rgba(123,97,255,0.15); color: #C4B5FD; }
.nav-link svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-sublink {
  padding-left: 30px; font-size: 12px; font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block;
}
.nav-link-row { display: flex; align-items: center; gap: 2px; }
.nav-subnav-toggle {
  background: none; border: none; cursor: pointer; flex-shrink: 0;
  color: var(--sidebar-text); padding: 4px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.nav-subnav-toggle:hover { background: var(--sidebar-hover); color: #fff; }
.nav-subnav-toggle svg { width: 12px; height: 12px; transition: transform 0.15s; }
.nav-subnav-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.nav-sublinks.collapsed { display: none; }
.nav-badge {
  margin-left: auto; background: var(--primary); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 1;
  padding: 3px 6px; border-radius: 999px; min-width: 8px; text-align: center;
}

/* ── Main ── */
.main { margin-left: 228px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}

.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.page { padding: 22px 24px; flex: 1; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: none; text-decoration: none;
  transition: all 0.12s; white-space: nowrap; font-family: var(--font);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger-soft { background: var(--danger-light); color: var(--danger); border: 1px solid #FECACA; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Cards ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-body { padding: 20px; }
.card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 9px; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 100px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.badge-green  { background: var(--success-light); color: #166534; }
.badge-red    { background: var(--danger-light); color: #991B1B; }
.badge-yellow { background: var(--warning-light); color: #92400E; }
.badge-purple { background: var(--primary-light); color: var(--primary-dark); }
.badge-gray   { background: #F3F4F6; color: #374151; }
.badge-blue   { background: #EFF6FF; color: #1D4ED8; }
.badge-teal   { background: #F0FDFB; color: #0F766E; }

/* An editable badge -- e.g. the role picker on /admin/users -- keeps the
   badge's pill look but is a real <select>, so no separate "edit" control
   is needed per row. */
.badge-select {
  display: inline-flex; align-items: center;
  padding: 2px 22px 2px 8px; border-radius: 100px; border: none;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
  cursor: pointer; font-family: inherit;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}

/* ── Stat tiles ── */
.stat-tiles { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.stat-tile {
  flex: 1; min-width: 130px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; text-decoration: none;
  display: flex; flex-direction: column; gap: 3px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.stat-tile:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.stat-tile-accent { width: 26px; height: 3px; border-radius: 2px; margin-bottom: 3px; }
.stat-tile-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.15; }
.stat-tile-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.stat-tiles-subheading {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-3); margin-bottom: 8px;
}
.stat-tiles-sub { margin-bottom: 16px; }
.stat-tiles-sub .stat-tile { padding: 10px 14px; }
.stat-tiles-sub .stat-tile-value { font-size: 20px; }

/* ── Horizontal tab bar -- shared by the requisition detail tabs
   (Overview/All/Screening/Interviews/Offers) and the top-level Hiring page
   tabs (Positions/Offers): real links per tab (bookmarkable,
   server-rendered), just a plain top tab bar rather than a sidebar. */
.req-layout { display: flex; flex-direction: column; gap: 16px; }
.tab-bar { width: 100%; display: flex; flex-direction: row; overflow-x: auto; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-bar a {
  display: flex; align-items: center; gap: 6px; padding: 9px 14px; white-space: nowrap;
  color: var(--text-2); font-size: 13.5px; font-weight: 500; text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-bar a:hover { color: var(--text); }
.tab-bar a.active { color: var(--primary-dark); font-weight: 600; border-bottom-color: var(--primary); }
.tab-bar .tab-count {
  font-size: 11px; font-weight: 600; color: var(--text-3); background: var(--bg);
  border-radius: 10px; padding: 1px 7px; line-height: 1.4;
}
.tab-bar a.active .tab-count { color: var(--primary-dark); background: var(--primary-light); }
.tab-bar .tab-pending-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--danger, #e5484d); display: inline-block;
}
/* .req-layout's tab bar sits inside the flex column, so it shouldn't add
   its own bottom margin on top of the layout's gap. */
.req-layout .tab-bar { margin-bottom: 0; }
.req-main { flex: 1; min-width: 0; }

/* ── Screening tab: single-card triage queue ── */
.screening-shell { max-width: 640px; margin: 0 auto; }
.screening-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 26px; }
.screening-progress { font-size: 12px; color: var(--text-3); margin-bottom: 14px; }
.screening-name { font-size: 19px; font-weight: 700; }
.screening-sub { font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
.screening-resume-frame { width: 100%; height: 480px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 14px 0; }
.screening-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.screening-remark-box { display: none; margin-top: 10px; flex-direction: column; gap: 8px; }
.screening-remark-box textarea { font-size: 13px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; resize: vertical; color: var(--text); }
.screening-empty { text-align: center; padding: 60px 20px; color: var(--text-2); }

/* ── Interviews tab: kanban ── */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; align-items: flex-start; padding-bottom: 8px; }
.kanban-column { background: var(--bg); border-radius: var(--radius); padding: 12px; width: 260px; flex-shrink: 0; }
.kanban-column-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-3); margin-bottom: 10px; display: flex; justify-content: space-between; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
.kanban-card-name { font-size: 13px; font-weight: 600; }
.kanban-card-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.kanban-card-actions { display: flex; gap: 4px; margin-top: 8px; }
.kanban-card-actions form { display: inline; }

/* ── Table ── */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table-wrap.scrollable { overflow-x: auto; }
.table-toolbar { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.filter-dropdown { position: relative; }
.filter-dropdown summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--text-2); background: var(--surface);
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
}
.filter-dropdown summary::-webkit-details-marker { display: none; }
.filter-dropdown[open] summary { border-color: var(--primary); color: var(--text); }
.filter-dropdown:has(input:checked) summary { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-light); }
.filter-panel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 8px; min-width: 210px; max-height: 260px; overflow-y: auto;
}
.filter-panel label {
  display: flex; align-items: center; gap: 7px; padding: 5px 6px;
  border-radius: 4px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.filter-panel label:hover { background: var(--bg); }
.filter-panel-search {
  width: 100%; margin-bottom: 6px; padding: 5px 8px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 4px; font-size: 12.5px;
}

/* Filter dropdowns embedded directly in a table header cell */
.th-filter { position: relative; flex: none; }
.th-filter summary {
  padding: 9px 8px; border: none; border-radius: 0; background: none;
  color: var(--text-3); display: flex; align-items: center;
}
.th-filter summary:hover { color: var(--text); background: var(--border); }
.th-filter[open] summary { color: var(--primary-dark); background: var(--primary-light); }
.th-filter:has(input:checked) summary { color: var(--primary-dark); background: var(--primary-light); }
.th-filter .filter-panel { text-transform: none; letter-spacing: normal; font-weight: 400; font-size: 13px; }

/* Sortable column headers */
.th-sort {
  padding: 9px 14px; cursor: pointer; user-select: none; flex: 1;
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-3);
}
.th-sort:hover { color: var(--text); }
.sort-arrow { font-size: 9px; width: 8px; opacity: 0; }
.sort-arrow.asc, .sort-arrow.desc { opacity: 0.7; }
.sort-arrow.asc::after { content: '▲'; }
.sort-arrow.desc::after { content: '▼'; }
.filter-panel-dates { display: flex; flex-direction: column; gap: 8px; min-width: 170px; }
.filter-date-label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
.filter-date-label input { padding: 5px 7px; border: 1px solid var(--border); border-radius: 4px; font-size: 12.5px; }
.filter-panel-actions { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.filter-panel-actions .btn { width: 100%; justify-content: center; }

table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 0; text-align: left;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
/* A header with a sort/filter control gets its padding from that
   control's own box (.th-sort/.th-filter, below) so the click target
   fills the whole header cell -- but a PLAIN header (no such control)
   never got padding from anywhere, so its label sat flush against the
   cell edge with nothing separating it from the neighboring column. */
thead th:not(:has(.th-sort)):not(:has(.th-filter)) { padding: 9px 14px; }
.th-inner { display: flex; align-items: center; }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; cursor: pointer; }
tbody tr:hover { background: #FAFAFE; }
tbody tr.no-hover { cursor: default; }
tbody tr.no-hover:hover { background: transparent; }

/* ── Days-urgency marker (onboarding/offboarding date proximity) ── */
.days-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap;
}
.status-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.status-dot.red   { background: var(--danger); }
.status-dot.amber { background: var(--warning); }
.status-dot.green { background: var(--success); }
.status-dot.teal  { background: #0F766E; }

/* Gentle breathing ring on red (overdue/due-today) dots -- draws the eye
   without being a constant distraction. */
.status-dot.red {
  animation: dot-pulse 2.2s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50%      { box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
}

/* Nav badge: a brief shake burst every few seconds when something urgent
   (red-bucket) is waiting, instead of a constant wiggle. */
.nav-badge.urgent {
  animation: badge-shake 3.2s ease-in-out infinite;
}
@keyframes badge-shake {
  0%, 88%, 100% { transform: translateX(0); }
  90%  { transform: translateX(-2px); }
  92%  { transform: translateX(2px); }
  94%  { transform: translateX(-2px); }
  96%  { transform: translateX(1px); }
}

@media (prefers-reduced-motion: reduce) {
  .status-dot.red, .nav-badge.urgent { animation: none; }
}

/* ── Search bar ── */
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap svg { position: absolute; left: 10px; color: var(--text-3); width: 14px; height: 14px; }
.search-input {
  padding: 7px 10px 7px 30px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px;
  color: var(--text); background: var(--bg);
  outline: none; width: 260px; font-family: var(--font);
  transition: border-color 0.12s;
}
.search-input:focus { border-color: var(--primary); background: var(--surface); }
.search-input::placeholder { color: var(--text-3); }

/* ── Avatar ── */
.avatar {
  border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0; color: #fff;
}
.avatar-sm  { width: 30px; height: 30px; font-size: 11px; }
.avatar-md  { width: 38px; height: 38px; font-size: 14px; }
.avatar-lg  { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl  { width: 72px; height: 72px; font-size: 26px; }

.name-cell { display: flex; align-items: center; gap: 9px; }
.name-cell .nm { font-weight: 500; }
.name-cell .eid { font-size: 11.5px; color: var(--text-3); }

/* ── Forms ── */
.form-card { max-width: 860px; }

.form-section {
  margin-bottom: 18px; padding: 18px 20px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface);
}
.form-section-title {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-3); margin-bottom: 16px;
}
.section-icon {
  width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; line-height: 1;
}

.tint-purple { background: #F7F5FF; border-color: #E4DBFF; }
.tint-purple .form-section-title, .tint-purple .card-title { color: #6D28D9; }
.tint-purple.card .card-header { border-bottom-color: #E4DBFF; }
.section-icon.purple { background: #E4DBFF; }

.tint-blue { background: #F3F8FF; border-color: #D8E7FE; }
.tint-blue .form-section-title, .tint-blue .card-title { color: #1D4ED8; }
.tint-blue.card .card-header { border-bottom-color: #D8E7FE; }
.section-icon.blue { background: #D8E7FE; }

.tint-amber { background: #FFFBEB; border-color: #FDE8B8; }
.tint-amber .form-section-title, .tint-amber .card-title { color: #92400E; }
.tint-amber.card .card-header { border-bottom-color: #FDE8B8; }
.section-icon.amber { background: #FDE8B8; }

.tint-teal { background: #F0FDFB; border-color: #C9F1E8; }
.tint-teal .form-section-title, .tint-teal .card-title { color: #0F766E; }
.tint-teal.card .card-header { border-bottom-color: #C9F1E8; }
.section-icon.teal { background: #C9F1E8; }

.tint-green { background: #F3FBF4; border-color: #D3EFD9; }
.tint-green .form-section-title, .tint-green .card-title { color: #15803D; }
.tint-green.card .card-header { border-bottom-color: #D3EFD9; }
.section-icon.green { background: #D3EFD9; }

.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.col-span-2  { grid-column: span 2; }
.col-span-3  { grid-column: span 3; }
.col-span-4  { grid-column: span 4; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-2); }

input[type=text], input[type=email], input[type=tel],
input[type=date], input[type=number], input[type=url],
select, textarea {
  padding: 7px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px;
  color: var(--text); background: var(--surface);
  outline: none; font-family: var(--font);
  transition: border-color 0.12s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(123,97,255,0.1);
}
textarea { resize: vertical; min-height: 72px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.checkbox-row input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.checkbox-row label { font-size: 13px; color: var(--text); cursor: pointer; }

/* ── Searchable multi-select (e.g. Interviewers) -- a search box that
   filters a checkbox list live, with selected picks shown as removable
   chips, instead of a native <select multiple> nobody can search or see
   more than 4 rows of at once. */
.ms-select { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.ms-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px; border-bottom: 1px solid var(--border); }
.ms-chips:empty { display: none; }
.ms-chip {
  display: flex; align-items: center; gap: 5px; background: var(--primary-light); color: var(--primary-dark);
  font-size: 12px; font-weight: 500; padding: 3px 6px 3px 9px; border-radius: 999px;
}
.ms-chip-remove {
  border: none; background: none; cursor: pointer; color: var(--primary-dark); font-size: 14px;
  line-height: 1; padding: 0 2px; opacity: 0.65;
}
.ms-chip-remove:hover { opacity: 1; }
.ms-select .ms-search { border: none; border-radius: 0; }
.ms-select .ms-search:focus { box-shadow: none; }
.ms-select.open .ms-search { border-bottom: 1px solid var(--border); }
.ms-options { display: none; max-height: 220px; overflow-y: auto; padding: 4px; }
.ms-select.open .ms-options { display: block; }
.ms-option { display: flex; align-items: center; gap: 7px; padding: 6px 8px; font-size: 13px; font-weight: normal; cursor: pointer; border-radius: 4px; }
.ms-option:hover { background: var(--bg); }
.ms-option input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.ms-option-empty { padding: 10px 8px; font-size: 12.5px; color: var(--text-3); }

.form-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  padding-top: 16px; border-top: 1px solid var(--border); margin-top: 4px;
}

/* Two-up detail column that collapses to one under the mobile breakpoint */
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Profile ── */
.profile-header {
  display: flex; align-items: flex-start; gap: 18px;
  padding: 22px; margin-bottom: 18px;
}
.profile-info { flex: 1; }
.profile-name { font-size: 19px; font-weight: 700; margin-bottom: 2px; }
.profile-desig { font-size: 13.5px; color: var(--text-2); margin-bottom: 10px; }
.profile-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-actions { display: flex; gap: 7px; flex-shrink: 0; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-item { display: flex; flex-direction: column; gap: 2px; }
.info-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-3); }
.info-value { font-size: 13.5px; color: var(--text); font-weight: 500; }
.info-value a { color: var(--primary); text-decoration: none; }
.info-value a:hover { text-decoration: underline; }

.action-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.action-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px;
  text-decoration: none; display: flex; align-items: center; gap: 12px;
  transition: all 0.12s; box-shadow: var(--shadow);
}
.action-card:hover { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.action-icon { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.action-icon.green  { background: var(--success-light); }
.action-icon.yellow { background: var(--warning-light); }
.action-icon.purple { background: var(--primary-light); }
.action-icon.blue   { background: #EFF6FF; }
.action-card-title { font-size: 13px; font-weight: 600; color: var(--text); }
.action-card-sub   { font-size: 11.5px; color: var(--text-3); }

/* ── Progress bar ── */
.progress-bar { height: 6px; background: var(--bg); border-radius: 100px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; border-radius: 100px; background: var(--primary); transition: width 0.3s; }
.progress-fill.full { background: var(--success); }

/* ── Stages ── */
.stages-list { }
.stage-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 20px; border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.stage-row:last-child { border-bottom: none; }
.stage-row:hover { background: #FAFAFE; }
.stage-row.done { background: #F6FEF9; }

.stage-cb { width: 16px; height: 16px; cursor: pointer; accent-color: var(--success); flex-shrink: 0; margin-top: 3px; }
.stage-content { flex: 1; }
.stage-name { font-size: 13.5px; font-weight: 500; color: var(--text); margin-bottom: 3px; }
.stage-row.done .stage-name { color: var(--text-3); text-decoration: line-through; }
.stage-remark {
  width: 100%; border: 1px dashed transparent; background: transparent;
  font-size: 12.5px; color: var(--text-2); padding: 3px 6px;
  border-radius: var(--radius-sm); font-family: var(--font);
  transition: all 0.12s;
}
.stage-remark:hover { border-color: var(--border); }
.stage-remark:focus { border-color: var(--primary); background: var(--surface); outline: none; }
.stage-remark::placeholder { color: var(--text-3); font-style: italic; }
.stage-badge { flex-shrink: 0; margin-top: 3px; }

.stages-progress-bar { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.stages-progress-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.stages-progress-label { font-size: 13px; font-weight: 600; color: var(--text); }
.stages-progress-count { font-size: 12.5px; color: var(--text-3); }

/* ── Ref check form ── */
.rc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Breadcrumb ── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); margin-bottom: 14px; }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 52px 20px; color: var(--text-3); }
.empty-state h3 { font-size: 15px; margin-bottom: 6px; color: var(--text-2); }

/* ── Misc ── */
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-row { display: flex; align-items: center; gap: 8px; }
.text-muted { color: var(--text-3); font-size: 12.5px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
details > summary { cursor: pointer; user-select: none; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ── Audit log ── */
.audit-list { padding: 4px 0; }
.audit-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 20px; border-bottom: 1px solid var(--border);
}
.audit-row:last-child { border-bottom: none; }
.audit-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; margin-top: 5px;
}
.dot-green  { background: var(--success); }
.dot-blue   { background: var(--primary); }
.dot-purple { background: #A78BFA; }

.audit-body { flex: 1; font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.audit-field { font-weight: 600; color: var(--text); }
.audit-change { display: flex; align-items: center; gap: 5px; }
.audit-old    { color: var(--danger); text-decoration: line-through; font-size: 12.5px; }
.audit-arrow  { color: var(--text-3); font-size: 11px; }
.audit-new    { color: var(--success); font-size: 12.5px; font-weight: 500; }
.audit-note   { color: var(--text-3); font-style: italic; font-size: 12px; }

.audit-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.audit-by   { font-size: 11.5px; font-weight: 500; color: var(--primary); }
.audit-time { font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* ── Interview round cards ── */
.round-list { display: flex; flex-direction: column; gap: 10px; }
.round-card {
  display: flex; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.round-badge {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-light, #EDE9FE); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.round-body { flex: 1; min-width: 0; }
.round-title { font-weight: 700; color: var(--text); font-size: 13.5px; }
.round-meta { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }

/* ── Modal dialog ── */
dialog.modal {
  border: none; border-radius: var(--radius-sm); padding: 0;
  width: 100%; max-width: 420px; background: var(--surface);
  box-shadow: 0 12px 40px rgba(0,0,0,0.22);
}
dialog.modal::backdrop { background: rgba(0,0,0,0.45); }
dialog.modal .modal-header { padding: 16px 18px; border-bottom: 1px solid var(--border); }
dialog.modal .modal-body { padding: 16px 18px; }
dialog.modal .modal-footer { padding: 14px 18px; border-top: 1px solid var(--border); }
dialog.modal .field label { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-3); margin-bottom: 4px; }
dialog.modal .field input, dialog.modal .field select { width: 100%; padding: 7px 9px; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Update Policy ──────────────────────────────────────────── */
.policy-table { width: 100%; border-collapse: collapse; }
.policy-table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-3); padding: 10px 20px; border-bottom: 1px solid var(--border); text-align: left; }
.policy-table th.role-col { text-align: center; width: 130px; }
.policy-table td { padding: 9px 20px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text); }
.policy-table td.role-col { text-align: center; }
.policy-table tr:last-child td { border-bottom: none; }
.policy-group-header { background: var(--bg) !important; font-size: 11px !important; font-weight: 700 !important; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-3) !important; }
.policy-toggle { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer; border: none; transition: opacity 0.15s; }
.policy-toggle.open { background: var(--success-light); color: #166534; }
.policy-toggle.locked { background: var(--danger-light); color: var(--danger); }
.policy-toggle:hover { opacity: 0.75; }

/* ── Locked fields in edit form ─────────────────────────────── */
.field-locked input,
.field-locked select,
.field-locked textarea { opacity: 0.45; cursor: not-allowed; pointer-events: none; background: var(--bg) !important; }
.lock-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; background: var(--warning-light); color: var(--warning); padding: 1px 6px; border-radius: 3px; margin-left: 4px; }

/* ── Policy 3-state segment control ─────────────────────────── */
.policy-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.policy-seg-btn { padding: 4px 10px; font-size: 11.5px; font-weight: 500; border: none; background: var(--surface); color: var(--text-3); cursor: pointer; border-right: 1px solid var(--border); transition: all 0.1s; }
.policy-seg-btn:last-child { border-right: none; }
.policy-seg-btn:hover { background: var(--bg); color: var(--text); }
.policy-seg-btn.active-open { background: var(--success-light); color: #166534; }
.policy-seg-btn.active-approval { background: var(--warning-light); color: #92400E; }
.policy-seg-btn.active-locked { background: var(--danger-light); color: var(--danger); }

/* ── Approval badge on form fields ──────────────────────────── */
.approval-badge { background: var(--warning-light) !important; color: #92400E !important; }

/* ── Lookup admin UI ─────────────────────────────────────────── */
.lookup-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.lookup-list { list-style:none; margin:0; padding:0; }
.lookup-item { display:flex; align-items:center; justify-content:space-between; padding:7px 0; border-bottom:1px solid var(--border); font-size:13.5px; gap:8px; }
.lookup-item:last-child { border-bottom:none; }
.lookup-del { background:none; border:none; color:var(--text-3); cursor:pointer; font-size:16px; line-height:1; padding:0 2px; border-radius:3px; }
.lookup-del:hover { color:var(--danger); background:var(--danger-light); }
.lookup-add-form { display:flex; gap:8px; margin-top:12px; }
.lookup-add-form input[type=text] { flex:1; font-size:13px; padding:6px 10px; border:1px solid var(--border); border-radius:6px; background:var(--bg); color:var(--text); }
.lookup-add-form input[type=text]:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 2px rgba(99,102,241,.15); }
.btn-sm { font-size:12.5px; padding:5px 12px; }

.lookup-list-inline { display:flex; flex-wrap:wrap; gap:4px; padding-bottom:4px; }
.lookup-list-inline .lookup-item { border:1px solid var(--border); border-radius:20px; padding:3px 10px 3px 12px; font-size:12.5px; gap:4px; }
.lookup-list-inline .lookup-item:last-child { border-bottom:1px solid var(--border); }

.desig-dept-section { padding:12px 0 8px; border-bottom:1px solid var(--border); }
.desig-dept-section:last-child { border-bottom:none; }
.desig-dept-header { font-size:12px; font-weight:600; color:var(--text-2); text-transform:uppercase; letter-spacing:.05em; margin-bottom:8px; }

/* ══════════════════════════════════════════════════════════════
   Mobile
   ──────────────────────────────────────────────────────────────
   The desktop layout is a fixed 228px sidebar + margin-left main.
   Below 820px that becomes an off-canvas drawer (toggled by the
   hamburger in base.html), and the wide data tables re-flow into
   stacked cards -- see the .t-cards block further down.

   Deliberately NOT adapted: the employee add/edit form, the
   update-policy matrix, lookups and hikes. Those are desk work;
   they keep the desktop layout and scroll.
   ══════════════════════════════════════════════════════════════ */

/* Hamburger + scrim live in base.html but stay hidden on desktop. */
.nav-toggle { display: none; }
.nav-scrim  { display: none; }

@media (max-width: 820px) {
  body { -webkit-text-size-adjust: 100%; }

  /* ── Off-canvas sidebar ── */
  .sidebar {
    width: 250px; min-width: 250px;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.28);
  }
  .layout.nav-open .sidebar { transform: translateX(0); }
  .main { margin-left: 0; min-width: 0; }

  .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 90;
    background: rgba(0,0,0,0.45);
    opacity: 0; pointer-events: none; transition: opacity 0.18s ease;
  }
  .layout.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  body:has(.layout.nav-open) { overflow: hidden; }

  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; flex-shrink: 0; margin-left: -6px;
    background: none; border: none; border-radius: var(--radius-sm);
    color: var(--text-2); cursor: pointer;
  }
  .nav-toggle:hover { background: var(--bg); }

  /* ── Chrome ── */
  .topbar {
    padding: 8px 14px; height: auto; min-height: 52px;
    flex-wrap: wrap; gap: 8px;
  }
  .topbar-title { font-size: 14.5px; min-width: 0; flex: 1; }
  .topbar-actions { flex-wrap: wrap; gap: 6px; }
  .topbar-actions .btn { font-size: 12.5px; padding: 6px 11px; }
  .page { padding: 14px 12px; }

  /* ── Grids collapse to a single column ── */
  .form-grid, .form-grid-3, .form-grid-4,
  .info-grid, .rc-grid, .lookup-grid,
  .action-cards, .split-grid { grid-template-columns: 1fr; }
  .col-span-2, .col-span-3, .col-span-4 { grid-column: span 1; }

  .stat-tile { min-width: calc(50% - 10px); }
  .stat-tile-value { font-size: 22px; }

  .form-card { max-width: none; }
  .form-section { padding: 14px 14px; }
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; gap: 8px; flex-wrap: wrap; }

  .form-actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .form-actions .btn { justify-content: center; padding: 10px 13px; }

  /* 16px keeps iOS Safari from zooming the viewport on focus. The
     !important is load-bearing: several forms set font-size inline. */
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),
  select, textarea { font-size: 16px !important; }
  .field input, .field select, .field textarea { padding: 9px 10px; }

  .search-wrap { width: 100%; }
  .search-input { width: 100%; padding-left: 32px; }
  .toolbar-left { width: 100%; }
  .table-toolbar { padding: 12px; }

  /* Header-cell dropdowns hang off the right edge on a narrow screen. */
  .filter-panel { max-width: calc(100vw - 32px); }
  .th-filter .filter-panel { left: auto; right: 0; }

  dialog.modal { max-width: calc(100vw - 24px); }
  dialog.modal .modal-body { max-height: 70vh; overflow-y: auto; }

  /* ── Profile / detail ── */
  .profile-header { flex-direction: column; gap: 12px; padding: 16px; }
  .profile-actions { align-self: flex-start; }
  .avatar-xl { width: 56px; height: 56px; font-size: 20px; }

  .action-card { padding: 13px 14px; }

  .audit-row { flex-wrap: wrap; padding: 11px 14px; }
  .audit-meta {
    flex-direction: row; align-items: center; gap: 8px;
    width: 100%; padding-left: 20px; margin-top: 4px;
  }

  .stage-row { padding: 12px 14px; }
  .stages-progress-bar { padding: 14px; }

  /* Inline "add interview round" strips: the inputs carry hard-coded
     pixel widths inline, which have to be unwound to stack them. */
  .stacks-on-mobile { flex-direction: column; align-items: stretch !important; }
  .stacks-on-mobile > *,
  .stacks-on-mobile input, .stacks-on-mobile select, .stacks-on-mobile textarea {
    width: 100% !important; min-width: 0 !important; flex: none !important;
  }
  .stacks-on-mobile .btn { justify-content: center; }

  /* ── Tables → cards ──
     Applied per-table via .t-cards; each <td> carries data-label so the
     column heading survives the loss of the <thead>. Tables that keep a
     usable sort/filter header add .t-cards-head. */
  .t-cards, .t-cards tbody, .t-cards tr, .t-cards td { display: block; width: 100%; }
  .t-cards thead { display: none; }
  .t-cards tbody tr {
    padding: 12px 14px; border-bottom: 1px solid var(--border);
  }
  .t-cards tbody tr:last-child { border-bottom: none; }
  .t-cards tbody td {
    border: none; padding: 3px 0; font-size: 13px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    white-space: normal !important; overflow-wrap: anywhere; min-width: 0;
  }
  .t-cards tbody td::before {
    content: attr(data-label);
    flex: none; color: var(--text-3);
    font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.4px;
  }
  .t-cards tbody td:not([data-label])::before,
  .t-cards tbody td[data-label='']::before { content: none; }
  .t-cards td.cell-primary { display: block; padding: 0 0 8px; }
  .t-cards td.cell-primary::before { content: none; }
  .t-cards td.cell-actions {
    justify-content: flex-end; gap: 8px;
    padding-top: 10px; margin-top: 8px; border-top: 1px dashed var(--border);
  }
  .t-cards td.cell-wide { display: block; padding: 6px 0 2px; }
  .t-cards td.cell-wide::before { display: block; margin-bottom: 4px; }
  .t-cards td.cell-empty { display: block; text-align: center !important; padding: 32px 14px !important; }

  /* Sort/filter header kept as a wrapping chip strip. */
  .t-cards-head thead { display: block; background: var(--bg); border-bottom: 1px solid var(--border); }
  .t-cards-head thead tr { display: flex; flex-wrap: wrap; gap: 2px; padding: 8px 10px; border: none; }
  .t-cards-head thead th { display: block; width: auto; background: none; border: none; }
  /* Only columns that actually sort or filter earn a chip -- the rest of
     the headings are already repeated as the per-row data-labels. */
  .t-cards-head thead th:not(:has(.th-sort)):not(:has(.th-filter)) { display: none; }
  .t-cards-head .th-inner,
  .t-cards-head thead th > .th-sort {
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  }
  .t-cards-head .th-sort { padding: 4px 9px; flex: none; font-size: 10.5px; }
  .t-cards-head .th-filter summary { padding: 4px 7px; }
}

@media (max-width: 420px) {
  .topbar-actions .btn { flex: 1; justify-content: center; }
}
