:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #6b7683;
  --line: #e2e8ef;
  --brand: #1d4e89;
  --brand-dark: #163b68;
  --accent: #f0b429;
  --danger: #c0392b;
  --ok: #1e8449;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.topbar {
  background: var(--brand);
  color: #fff;
  padding: 0 20px;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 22px;
  box-shadow: var(--shadow);
}
.topbar .brand { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.topbar nav { display: flex; align-items: center; gap: 18px; margin-left: 8px; flex: 1; }
.topbar nav a { color: #dbe6f3; font-weight: 500; }
.topbar nav a.active, .topbar nav a:hover { color: #fff; text-decoration: none; }
.topbar .right { display: flex; align-items: center; gap: 14px; color: #cdddef; }
.topbar .right a { color: #fff; }

.container { max-width: 1200px; margin: 22px auto; padding: 0 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; }
.sub { color: var(--muted); font-size: 13px; }

/* Panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.panel .panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; }
.panel .panel-body { padding: 18px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand); color: #fff; border: none; border-radius: 7px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.secondary { background: #eef2f7; color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { background: #e3e9f1; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #a5342a; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.ok { background: var(--ok); }

/* Forms */
label.fld { display: block; margin-bottom: 14px; }
label.fld .lab { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=tel], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #cfe0f3; border-color: var(--brand); }
textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 20px; }
.checkbox { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.checkbox input { width: auto; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 10px; }
table { border-collapse: collapse; width: 100%; background: #fff; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { background: #eef2f7; font-weight: 700; position: sticky; top: 0; color: #33414f; }
tbody tr:hover { background: #f7fafd; }
td.actions { display: flex; gap: 6px; }
.sensitive-tag { color: var(--danger); font-size: 10px; font-weight: 700; margin-left: 4px; vertical-align: super; }

/* Badges & flashes */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge.admin { background: #fdeccb; color: #8a5a00; }
.badge.role { background: #e5edf7; color: var(--brand); }
.badge.on { background: #d5f0df; color: var(--ok); }
.badge.off { background: #f2d7d4; color: var(--danger); }

.flash { padding: 11px 16px; border-radius: 8px; margin-bottom: 12px; font-weight: 500; }
.flash.info { background: #e5edf7; color: var(--brand-dark); }
.flash.success { background: #d5f0df; color: #14683a; }
.flash.error { background: #fbe0dd; color: #8f2c22; }
.flash.warn { background: #fdf1cf; color: #7a5a00; }

/* Login */
.login-wrap { max-width: 380px; margin: 8vh auto; }
.login-wrap .logo { text-align: center; margin-bottom: 18px; }
.login-wrap .logo .mark { font-size: 22px; font-weight: 800; color: var(--brand); }

.searchbar { display: flex; gap: 8px; }
.searchbar input { max-width: 280px; }
.muted-note { color: var(--muted); font-size: 12px; margin-top: 6px; }
.warn-banner { background: #fdf1cf; color: #7a5a00; padding: 10px 16px; text-align: center; font-size: 13px; font-weight: 600; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

/* Import page */
.panel.pad { padding: 18px; }
.panel.pad h2 { font-size: 16px; }
.field { margin-bottom: 14px; }
.field > label:not(.checkbox) { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; }
.field input[type=file] { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.tips { margin: 6px 0 0 18px; font-size: 13px; line-height: 1.6; }
.tips li { margin-bottom: 4px; }
table.mini { width: auto; border: 1px solid var(--line); border-radius: 8px; }
table.mini th, table.mini td { font-size: 12px; white-space: nowrap; }

/* Inline (double-click) cell editing */
td.editable { cursor: cell; }
td.editable:hover { background: #eef6ff; box-shadow: inset 0 0 0 1px #bcd6f2; }
td.editing { padding: 2px 4px; background: #fff; }
td.editing .cell-editor {
  width: 100%; min-width: 90px; box-sizing: border-box;
  padding: 5px 7px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--brand); border-radius: 5px; background: #fff; color: var(--ink);
}
td.editing textarea.cell-editor { min-height: 48px; }
td.saving { opacity: 0.6; }
td.saved-ok { animation: cellok 1.2s ease; }
td.saved-err { animation: cellerr 1.2s ease; }
@keyframes cellok  { 0% { background: #c9f2d4; } 100% { background: transparent; } }
@keyframes cellerr { 0%,60% { background: #f7c9c4; } 100% { background: transparent; } }

/* Sortable column headers */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #e3e9f1; }
.sort-caret { color: var(--brand); font-size: 11px; font-weight: 700; }

/* ---- Dashboard ---- */
.dash-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  flex-wrap: wrap; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.dash-hero h1 { margin: 0; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #94a3b8; margin: 20px 0 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.stat { position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px 18px 16px; text-decoration: none; box-shadow: var(--shadow);
  display: block; overflow: hidden; transition: transform .08s ease, box-shadow .08s ease; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #cbd5e1; }
.stat:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15,23,42,.10); text-decoration: none; }
.stat-top { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.stat-num { font-size: 34px; font-weight: 800; color: var(--ink); line-height: 1; }
.stat-lbl { margin-top: 6px; font-size: 13px; color: #64748b; }
.stat.info::before  { background: var(--brand); }
.stat.info  .stat-num { color: var(--brand); }
.stat.danger::before { background: var(--danger); }
.stat.danger .stat-num { color: var(--danger); }
.stat.warn::before  { background: #d98a00; }
.stat.warn  .stat-num { color: #b3730a; }
.stat.ok::before    { background: var(--ok); }
.stat.muted::before { background: #cbd5e1; }
.stat.muted .stat-num { color: #64748b; }
.panel-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13px; }

/* ---- Filter tabs / pills ---- */
.filter-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.filter-tabs .tab { padding: 6px 14px; border: 1px solid var(--line); border-radius: 20px; font-size: 13px; text-decoration: none; color: var(--ink); background: #fff; }
.filter-tabs .tab:hover { background: #eef2f7; text-decoration: none; }
.filter-tabs .tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; background: #eef2f7; color: #33414f; white-space: nowrap; }
.pill.danger { background: #f7d4cf; color: #8a2c20; }
.pill.warn { background: #fdeccb; color: #8a5a00; }
.row-terminated td { opacity: 0.55; }
.row-terminated td.actions { opacity: 1; }

/* ---- Employee detail ---- */
.detail-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 820px) { .detail-cols { grid-template-columns: 1fr; } }
.detail-side { display: flex; flex-direction: column; gap: 18px; }
table.kv { width: 100%; }
table.kv th { text-align: left; width: 42%; color: #64748b; font-weight: 600; vertical-align: top; padding: 7px 12px 7px 0; border-bottom: 1px solid var(--line); white-space: normal; }
table.kv td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.inline-upload { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.file-list, .note-list { list-style: none; padding: 0; margin: 0; }
.file-list li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.file-list .muted, .note-list .muted { color: #94a3b8; }
.note-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.note-form textarea { min-height: 60px; }
.note-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.note-meta { font-size: 12px; color: #64748b; margin-bottom: 3px; }
.note-body { white-space: pre-wrap; }
.linkbtn { background: none; border: none; color: var(--brand); cursor: pointer; font-size: 12px; padding: 0 2px; text-decoration: underline; }
.linkbtn.danger { color: var(--danger); }
.auth-wrap { min-height: 60vh; }

/* ---- Actions column pinned to the left ---- */
th.actions-col, td.actions-col { position: sticky; left: 0; z-index: 1; }
thead th.actions-col { z-index: 3; background: #eef2f7; }
td.actions-col { background: #fff; box-shadow: 1px 0 0 var(--line); }
tbody tr:hover td.actions-col { background: #f7fafd; }
tr.row-terminated td.actions-col { background: #fff; }
td.actions-col.actions { display: flex; gap: 6px; align-items: center; }

/* ---- Collapsible Actions column ---- */
.col-toggle { background: none; border: none; cursor: pointer; font: inherit; font-weight: 700;
  color: #33414f; display: inline-flex; align-items: center; gap: 6px; padding: 0; }
.col-toggle .chev { color: var(--brand); font-size: 14px; line-height: 1; transition: transform .15s ease; }
table.actions-collapsed .col-toggle .chev { transform: rotate(180deg); }
table.actions-collapsed .col-toggle .lbl { display: none; }
table.actions-collapsed td.actions-col > * { display: none; }
table.actions-collapsed th.actions-col,
table.actions-collapsed td.actions-col { width: 32px; min-width: 32px; max-width: 32px;
  padding-left: 4px; padding-right: 4px; text-align: center; }
table.actions-collapsed td.actions-col.actions { display: table-cell; }

/* ---- Public applicant pages ---- */
.public-wrap { max-width: 640px; margin: 30px auto; }
.public-head { text-align: center; margin-bottom: 18px; }
.public-head h1 { margin: 0 0 6px; }
.public-foot { text-align: center; margin-top: 16px; font-size: 13px; }
.public-foot a { color: #94a3b8; }

/* ---- Availability grid (scheduling) ---- */
.grid-scroll { overflow-x: auto; }
.avail-grid { border-collapse: collapse; width: 100%; user-select: none; }
.avail-grid th, .avail-grid td { border: 1px solid var(--line); text-align: center; }
.avail-grid thead th { padding: 6px 8px; background: #f7fafd; font-weight: 600; white-space: nowrap; }
.avail-grid thead th .dow { font-size: 12px; color: #64748b; }
.avail-grid thead th .dom { font-size: 13px; }
.avail-grid th.time-col { background: #f7fafd; font-weight: 500; font-size: 12px; color: #64748b;
  padding: 0 10px; white-space: nowrap; text-align: right; }
.avail-grid td.slot { height: 30px; min-width: 46px; cursor: pointer; background: #fff; }
.avail-grid td.slot:hover { background: #eef6ff; }
.avail-grid td.slot.on { background: var(--brand); }

/* ---- Nav dropdowns ---- */
.navdrop { position: relative; display: flex; align-items: center; }
.navdrop-btn { background: none; border: none; color: #dbe6f3; font: inherit; font-weight: 500;
  cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 5px; line-height: 1; }
.navdrop-btn:hover, .navdrop.open .navdrop-btn { color: #fff; }
.navdrop-menu { display: none; position: absolute; top: 100%; left: 0; margin-top: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 26px rgba(15,23,42,.18); min-width: 190px; padding: 6px 0; z-index: 60; }
/* high-specificity so the topbar's light link color doesn't bleed into the menu */
.topbar nav .navdrop-menu a { display: block; padding: 9px 16px; color: var(--ink);
  font-weight: 500; white-space: nowrap; }
.topbar nav .navdrop-menu a:hover { background: #eef2f7; color: var(--ink); text-decoration: none; }
/* click-only: the menu shows when JS adds .open (no hover race) */
.navdrop.open .navdrop-menu { display: block; }

/* ---- Applicant hiring panel: link boxes + interviewer checklist ---- */
.linkbox { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.copyfield { width: 100%; font-size: 12px; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 6px; background: #f7fafd; color: #33414f; }
.checklist { display: flex; flex-direction: column; gap: 6px; max-height: 190px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; }
.checklist .checkbox { margin: 0; font-weight: 500; }

/* ---- Onboarding: embedded readable PDFs ---- */
.pdfview { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.pdfview > summary { font-weight: 600; cursor: pointer; }
.pdfview iframe { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 6px; margin-top: 8px; }

/* ---- Onboarding kiosk PIN ---- */
.pinbox { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.pinbox .pin { font-size: 22px; font-weight: 700; letter-spacing: 3px; color: #1e3a5f;
  background: #eef2f7; padding: 2px 10px; border-radius: 6px; }
.pill.ok { background: #d7f0e0; color: #1e7d47; }

/* ---- Rendered policy markdown ---- */
.policy-body h1, .policy-body h2, .policy-body h3, .policy-body h4 { margin: 10px 0 4px; line-height: 1.25; }
.policy-body h1 { font-size: 18px; } .policy-body h2 { font-size: 16px; } .policy-body h3 { font-size: 14px; }
.policy-body p { margin: 6px 0; } .policy-body ul, .policy-body ol { margin: 6px 0 6px 20px; }
.policy-body li { margin: 2px 0; } .policy-body a { color: var(--brand); }
.policy-body code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.policy-body blockquote { border-left: 3px solid var(--line); margin: 8px 0; padding: 2px 12px; color: #5b6b7b; }
