/* =====================================================================
   HIRING TRACKER — UI matching Berkeley Accommodation (Helios Shell)
   Design tokens, layout, and components mirror the accommodation app.
   ===================================================================== */

/* ---------- Tokens -------------------------------------------------- */
:root {
  --paper:        #f4f5f7;
  --paper-raised: #ffffff;
  --ink:          #111827;
  --ink-soft:     #6b7280;
  --ink-faint:    #9ca3af;
  --line:         #e6e8eb;
  --line-soft:    #eef0f2;

  --blue:         #2e3092;
  --blue-dark:    #1f2166;
  --blue-bg:      #e8e9f8;

  --teal:         #0f8a7a;
  --teal-dark:    #0c7366;
  --teal-bg:      #d1fae5;

  --navy:         #0e2f3a;
  --navy-2:       #164555;

  --green:        #15803d;
  --green-bg:     #dcfce7;

  --yellow:       #fbaf3f;
  --amber:        #b45309;
  --amber-bg:     #fef3c7;

  --red:          #b91c1c;
  --red-bg:       #fee2e2;

  --gray:         #69737b;

  --font-display: "Poppins", "IBM Plex Sans", sans-serif;
  --font-body:    "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;

  --text-2xs: 10px;
  --text-xs:  11px;
  --text-sm:  13px;
  --text-base: 14px;
  --text-lg:  16px;
  --text-xl:  20px;
  --text-2xl: 24px;
  --text-stat: 28px;
}

/* ---------- Reset --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  font-size: var(--text-base);
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -0.01em;
}

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  line-height: 1.2;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
::selection { background: var(--teal); color: #fff; }

/* ---------- Helios Shell -------------------------------------------- */
.hx-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--paper);
}

.hx-header {
  background: #0b1220;
  color: #fff;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.hx-header-top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 22px 8px;
}

.hx-menu-btn {
  display: none;
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1px solid #2a3548;
  background: #151d2e;
  color: #fff;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.hx-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  background: #fff;
  border-radius: 8px;
  padding: 5px 11px;
  line-height: 0;
}
.hx-logo img {
  display: block;
  height: 38px;
  width: auto;
  object-fit: contain;
}

.hx-userbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.hx-welcome {
  font-size: var(--text-base);
  color: #d5dbe6;
  white-space: nowrap;
}
.hx-welcome em { color: #93c5fd; font-style: normal; }
.hx-role { color: #8fb8b0; font-size: var(--text-sm); }

.hx-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid #2a3548;
  background: #151d2e;
  color: #d5dbe6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}
.hx-icon:hover { background: var(--navy-2); color: #fff; }
.hx-icon svg { width: 15px; height: 15px; }
button.hx-icon { border: 1px solid #2a3548; }

/* Tab navigation */
.hx-tabs {
  display: flex;
  gap: 2px;
  padding: 0 18px;
  border-top: 1px solid #1a2332;
  overflow-x: auto;
  scrollbar-width: none;
}
.hx-tabs::-webkit-scrollbar { display: none; }

.hx-tab {
  color: #9aa4b2;
  padding: 11px 15px 10px;
  font-size: var(--text-base);
  font-weight: 600;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  letter-spacing: -0.01em;
  text-decoration: none;
  display: inline-block;
}
.hx-tab:hover { color: #fff; }
.hx-tab.active { color: #fff; border-bottom-color: #3b82f6; }

/* Page content */
.hx-page {
  padding: 20px 28px 48px;
  flex: 1;
  min-width: 0;
}

/* ---------- Auth (login) -------------------------------------------- */
body.is-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #0e2f3a 0%, #0b2530 100%);
  padding: 24px;
}
.app-content { width: 100%; }

.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  /* When inside app shell (change-password page): center in page */
  min-height: 40vh;
}
.auth-card {
  background: #fff;
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  padding: 40px 36px 32px;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.auth-card .auth-logo {
  display: block;
  width: min(280px, 100%);
  height: auto;
  object-fit: contain;
  margin: 0 0 18px;
}
.auth-eyebrow {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--teal-dark);
  font-weight: 600;
  margin-bottom: 8px;
}
.auth-card h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  color: var(--ink);
}
.auth-card .auth-copy {
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 22px;
}

/* ---------- Flash messages ------------------------------------------ */
.flash-stack { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: var(--text-base);
}
.flash-success { background: var(--green-bg); color: var(--green); border: 1px solid #86efac; }
.flash-error   { background: var(--red-bg);   color: var(--red);   border: 1px solid #fca5a5; }
.flash-warning { background: var(--amber-bg); color: var(--amber); border: 1px solid #fcd34d; }
.flash-info    { background: var(--blue-bg);  color: var(--blue);  border: 1px solid #c9cbea; }

/* ---------- Page header --------------------------------------------- */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.page-header-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.page-sub,
.page-header p,
.page-header .muted,
.page-header .section-lead {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  margin-top: 4px;
  line-height: 1.45;
  max-width: 78ch;
}
.page-header-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}

/* ---------- Section titles ------------------------------------------ */
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 18px 0 8px;
}
.section-lead {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  margin: 0 0 10px;
  line-height: 1.45;
  max-width: 72ch;
}

.form-section-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-soft);
  text-transform: uppercase;
  font-size: var(--text-xs);
  letter-spacing: .06em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  margin: 20px 0 14px;
}
.form-section-title:first-child { margin-top: 0; }

/* ---------- Buttons ------------------------------------------------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-base);
  letter-spacing: -0.01em;
  border-radius: 8px;
  border: 1px solid var(--teal);
  background: var(--teal);
  color: #fff;
  padding: 9px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { background: var(--teal-dark); border-color: var(--teal-dark); text-decoration: none; color: #fff; }
.btn:disabled { opacity: .6; cursor: default; }

.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }

.btn-ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--paper); border-color: var(--ink-soft); color: var(--ink); }

.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #991b1b; border-color: #991b1b; }

.btn-tiny {
  padding: 4px 10px;
  font-size: var(--text-sm);
  border-radius: 6px;
}
.btn-block { width: 100%; justify-content: center; }

/* Icon button */
.icon-btn {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 7px;
  cursor: pointer;
  color: var(--ink-soft);
  display: inline-flex;
  position: relative;
}
.icon-btn:hover { background: var(--teal-bg); color: var(--teal-dark); border-color: #99e6c8; }
.icon-btn svg { width: 14px; height: 14px; }

/* ---------- Stat tiles ---------------------------------------------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
.stat-tile {
  background: var(--blue-bg);
  border: 1px solid #c9cbea;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--blue);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
  margin-top: 4px;
  font-weight: 600;
}
.stat-tile.good { background: var(--green-bg); border-color: #86efac; }
.stat-tile.good .stat-value { color: var(--green); }
.stat-tile.warn { background: var(--amber-bg); border-color: #f6d98a; }
.stat-tile.warn .stat-value { color: var(--amber); }
.stat-tile.bad  { background: var(--red-bg);   border-color: #f5c2c2; }
.stat-tile.bad  .stat-value { color: var(--red); }

.gap-short   { color: var(--red) !important; }
.gap-surplus { color: var(--green) !important; }

/* ---------- Department grid ----------------------------------------- */
.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}
.dept-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
  transition: border-color .12s, box-shadow .12s;
}
.dept-card:hover {
  border-color: #99e6c8;
  box-shadow: 0 4px 14px rgba(15,138,122,.10);
  text-decoration: none;
}
.dept-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dept-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.dept-count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--teal-bg);
  color: var(--teal-dark);
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}
.dept-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  column-gap: 14px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}
.dept-stats > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
  padding: 3px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
}
.dept-stats > div:last-child { border-bottom: 0; }
.dept-stats dt { color: var(--ink-soft); margin: 0; }
.dept-stats dd { margin: 0; font-weight: 600; color: var(--ink); font-family: var(--font-mono); }

/* ---------- Compare / forecast grid --------------------------------- */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
.compare-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.compare-card .name {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 6px;
}
.compare-card dl {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
}
.compare-card dl > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.compare-card dt { color: var(--ink-soft); margin: 0; font-weight: 400; }
.compare-card dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.meta-cell { color: var(--ink-soft); font-size: var(--text-sm); }

/* ---------- Meter --------------------------------------------------- */
.meter {
  height: 8px;
  background: var(--line-soft);
  border-radius: 99px;
  overflow: hidden;
  margin: 6px 0 4px;
}
.meter-fill { height: 100%; border-radius: 99px; background: var(--teal); }
.meter-caption { font-size: var(--text-sm); color: var(--ink-soft); }
.meter-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 110px;
}
.meter-inline .meter { flex: 1; margin: 0; height: 6px; }
.inline-input {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: var(--text-sm);
  font-family: var(--font-body);
  min-width: 200px;
}

/* ---------- Configuration lists ------------------------------------ */
.add-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.add-bar input[type=text],
.add-bar select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: var(--text-sm);
  font-family: var(--font-body);
  background: #fff;
}
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-soft);
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
  font-weight: 500;
}
.config-list {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
}
.config-head,
.config-item {
  display: grid;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  min-width: 640px;
}
.config-head {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 700;
  color: var(--ink-soft);
  background: #f8fffc;
  border-bottom: 1px solid var(--line);
}
.config-item {
  border-bottom: 1px solid var(--line-soft);
}
.config-item:last-of-type { border-bottom: 0; }
.config-item input[type=text] {
  width: 100%;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: var(--text-sm);
}
.config-job-types .config-head,
.config-job-types .config-item {
  grid-template-columns: 1.3fr 0.7fr 0.6fr 0.7fr 1.4fr 1.2fr auto;
}
.config-projects .config-head,
.config-projects .config-item,
.config-camps .config-head,
.config-camps .config-item {
  grid-template-columns: 1.6fr 1fr auto;
  min-width: 480px;
}

/* ---------- Cards --------------------------------------------------- */
.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
  margin-bottom: 12px;
}
/* Compact card — requirements numeric inputs, dept targets, etc. */
.card-compact {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 10px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.card-compact .card-head { margin-bottom: 8px; }
.card-head h3 {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0;
  margin: 0;
}
.card-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  color: var(--ink-soft);
}
.card-meta { font-size: var(--text-xs); color: var(--ink-faint); white-space: nowrap; }

/* ---------- Chart cards -------------------------------------------- */
.chart-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.chart-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.chart-card-stack { /* full-width chart card */ }
.chart-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--ink);
}

/* Dashboard-specific two-column analytics layout */
.dash-analytics {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 12px;
  margin-bottom: 20px;
}
.dash-chart-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dash-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 20px;
}

/* ---------- Tables -------------------------------------------------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
  margin-bottom: 12px;
}
.table-wrap-tall { max-height: 70vh; overflow-y: auto; }
.table-wrap:has(> .data-table:not(.table-wide)) {
  width: fit-content;
  max-width: 100%;
}
.data-table {
  width: max-content;
  border-collapse: collapse;
  background: var(--paper-raised);
  font-size: var(--text-sm);
  table-layout: auto;
}
.data-table.table-wide {
  width: 100%;
  min-width: 100%;
}
/* Compact tables: label + Edit stay adjacent; no stretched middle gap */
.data-table:not(.table-wide) th:first-child,
.data-table:not(.table-wide) td:first-child {
  width: 1%;
  white-space: nowrap;
  position: static;
  background: inherit;
}
.data-table:not(.table-wide) tr:hover td:first-child { background: #f8fafc; }
.data-table:not(.table-wide) th.row-actions,
.data-table:not(.table-wide) td.row-actions {
  width: 1%;
  padding-left: 0;
  padding-right: 8px;
}
.data-table .col-notes {
  white-space: normal;
  min-width: 120px;
  max-width: 280px;
}
.data-table .col-text {
  white-space: normal;
  min-width: 120px;
  max-width: 260px;
}
.table-wide .col-fill { width: 99%; }
.data-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ink-soft);
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: #f8fffc;
  white-space: nowrap;
  font-weight: 700;
}
.data-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--text-sm);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tfoot th,
.data-table tfoot td {
  background: #f8fffc;
  font-weight: 700;
  border-top: 1px solid var(--line);
  padding: 7px 10px;
  font-size: 12px;
}
.data-table th.num,
.data-table td.num,
.data-table tfoot th.num { text-align: right; }
.data-table tr:hover td { background: #f8fafc; }
.data-table tr.is-editing td {
  background: #f0fdfa;
}
.data-table tr.is-editing:hover td {
  background: #e6f7f3;
}
.row-edit-form {
  max-width: 720px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.row-edit-form h3 {
  font-size: var(--text-base);
  margin-bottom: 10px;
}
.row-edit-form .form-grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  margin-bottom: 12px;
}
.data-table td.row-actions a.btn,
.data-table td.row-actions a.btn:hover {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}
.data-table th.row-actions,
.data-table td.row-actions {
  text-align: left;
  white-space: nowrap;
  width: 1%;
  padding-right: 4px;
}
.data-table tr.is-editing input[type=number],
.data-table tr.is-editing input[type=text] {
  width: 100%;
  min-width: 64px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: var(--text-sm);
  font-family: var(--font-body);
}
.data-table th a { color: var(--ink-soft); text-decoration: none; }
.data-table th a:hover { color: var(--teal-dark); }
.data-table td a { color: var(--teal-dark); font-weight: 600; }
.data-table td a:hover { text-decoration: underline; }

.sticky-col,
.data-table th:first-child,
.data-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--paper-raised);
  z-index: 1;
}
.data-table tr:hover td.sticky-col,
.data-table tr:hover td:first-child { background: #f8fafc; }
.sticky-col-2 { position: sticky; left: 180px; background: var(--paper-raised); z-index: 1; }
.data-table th.sticky-col,
.data-table th:first-child { background: #f8fffc; }

.sort-link { color: inherit; text-decoration: none; }
.sort-link:hover { color: var(--teal-dark); }
.sort-link.sort { color: var(--blue); font-weight: 700; }

.empty-row td {
  text-align: center;
  color: var(--ink-faint);
  padding: 36px 20px;
}

.row-actions { display: flex; gap: 5px; align-items: center; white-space: nowrap; }
.remarks-cell { max-width: 220px; white-space: normal; font-size: var(--text-sm); color: var(--ink-soft); }

/* ---------- Pagination --------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.pagination .btn-tiny { min-width: 80px; justify-content: center; }

/* ---------- Status pills / stamps ----------------------------------- */
.status-pill {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .01em;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-good    { background: var(--green-bg); color: var(--green); }
.status-short   { background: var(--red-bg);   color: var(--red); }
.status-warn    { background: var(--amber-bg); color: var(--amber); }
.status-info    { background: var(--blue-bg);  color: var(--blue); }
.status-neutral { background: var(--line-soft); color: var(--gray); }
.status-off     { background: var(--line-soft); color: var(--gray); }

/* ---------- Department sub-nav (Pipeline) ----------------------- */
.dept-subnav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 0 0 10px;
  margin: -4px 0 12px;
  border-bottom: 1px solid var(--line);
}
.dept-subnav-tab {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.dept-subnav-tab:hover { background: var(--line-soft); color: var(--ink); }
.dept-subnav-tab.active {
  background: var(--teal);
  color: #fff;
}

/* ---------- Filter bar --------------------------------------------- */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-bar select,
.filter-bar input[type=text],
.filter-bar input[type=search],
.filter-bar input[type=date] {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  color: var(--ink);
}
.filter-bar select:focus,
.filter-bar input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15,138,122,.15);
}
.filter-bar .filter-search { flex: 1 1 260px; min-width: 180px; }
.filter-count { font-size: var(--text-sm); color: var(--ink-soft); margin-left: auto; }

/* ---------- Forms --------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.form-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.record-form .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
/* Tight numeric grid — requirements, forecast, camp beds */
.req-grid-notes {
  grid-template-columns: 1fr 2fr;
}
.field { display: flex; flex-direction: column; }
.field-wide { grid-column: 1 / -1; }

.field label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.field input:not([type=checkbox]),
.field select,
.field textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--ink);
  line-height: 1.4;
}
/* Compact numeric input — smaller height for dense grids */
.req-grid .field input[type=number] {
  padding: 5px 8px;
  font-size: var(--text-sm);
  border-radius: 5px;
}
.req-grid .field input[type=text],
.req-grid .field select {
  padding: 5px 8px;
  font-size: var(--text-sm);
  border-radius: 5px;
}
.req-grid .field label {
  font-size: 10px;
  margin-bottom: 3px;
  color: var(--ink-faint);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15,138,122,.12);
}
.field textarea { resize: vertical; min-height: 70px; }
.field-hint { font-size: var(--text-xs); color: var(--ink-faint); margin-top: 3px; }
.readonly-value {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: var(--text-base);
  color: var(--ink-soft);
  min-height: 34px;
}
.req-grid .readonly-value {
  padding: 5px 8px;
  font-size: var(--text-sm);
  min-height: 28px;
  border-radius: 5px;
}
.field-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}
.field-checkbox label {
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  font-size: var(--text-base);
  margin-bottom: 0;
}

.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.form-actions-inline {
  margin-top: 8px;
  padding-top: 0;
  border-top: 0;
}
.auth-card .field { margin-bottom: 12px; }
.auth-card .field:last-of-type { margin-bottom: 18px; }

.narrow-form { max-width: 520px; }
.narrow-form .field { margin-bottom: 12px; }
.record-form { max-width: 960px; }

/* Inline small form (e.g. forecast cell) */
.inline-form { display: inline; }

/* Sticky form action bar at bottom */
.sticky-actions {
  position: sticky;
  bottom: 0;
  background: var(--paper);
  padding: 14px 0;
  border-top: 1px solid var(--line);
  margin-top: 24px;
  z-index: 10;
}

/* ---------- Forecast month picker ---------------------------------- */
.month-pills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.month-pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
}
.month-pill:hover { border-color: #99e6c8; color: var(--teal-dark); background: var(--teal-bg); }
.month-pill.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.month-switch { display: inline-flex; align-items: center; gap: 8px; }
.month-switch label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  color: var(--ink-soft);
}
.month-switch select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: var(--text-sm);
  font-family: var(--font-body);
  color: var(--ink);
}

/* ---------- Manpower forecast -------------------------------------- */
.formula-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.formula-chip {
  background: var(--blue-bg);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.formula-chip-result {
  background: var(--teal-bg);
  color: var(--teal-dark);
}
.formula-op {
  color: var(--ink-faint);
  font-weight: 700;
  font-size: 14px;
}
.formula-note {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-soft);
}
.month-pills-forecast {
  gap: 8px;
  margin-bottom: 16px;
}
.month-pills-forecast .month-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 14px;
  border-radius: 12px;
  line-height: 1.2;
}
.month-pills-forecast .pill-month {
  font-size: 13px;
  font-weight: 600;
  color: inherit;
}
.month-pills-forecast .pill-gap {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.month-pills-forecast .month-pill.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.month-pills-forecast .month-pill.active .pill-gap.gap-short { color: #fca5a5; }
.month-pills-forecast .month-pill.active .pill-gap.gap-surplus { color: #86efac; }
.mp-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 8px;
}
.mp-stats .stat-tile {
  padding: 14px 16px;
  border-radius: 10px;
}
.mp-stats .stat-value { font-size: 28px; }
.stat-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.mp-stat-need { background: var(--blue-bg); border-color: #c9cbea; }
.mp-stat-need .stat-value { color: var(--blue); }
.mp-stat-in { background: #eef2ff; border-color: #c7d2fe; }
.mp-stat-in .stat-value { color: #4338ca; }
.mp-stat-out { background: #f1f5f9; border-color: #d8dee9; }
.mp-stat-out .stat-value { color: #334155; }
.mp-stat-gap.ok { background: var(--line-soft); border-color: var(--line); }
.mp-stat-gap.ok .stat-value { color: var(--ink); }
.th-hint {
  display: block;
  font-size: 10px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-faint);
  margin-top: 2px;
}
.mp-table th {
  vertical-align: bottom;
  white-space: nowrap;
}
.mp-dept { font-weight: 600; }
.mp-readonly span {
  display: inline-block;
  min-width: 3ch;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.mp-gap { font-weight: 700; font-size: 15px; }
.stat-tile.ok { background: var(--line-soft); border-color: var(--line); }
.stat-tile.ok .stat-value { color: var(--ink); }

.mp-derived a {
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  border-bottom: 1px dotted currentColor;
}
.mp-derived a:hover { color: var(--blue-dark); }

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}
.workflow-step {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.workflow-step:hover { border-color: var(--blue); }
.workflow-step.active {
  border-color: var(--blue);
  background: var(--blue-bg);
}
.workflow-n {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.workflow-step.active .workflow-n { background: var(--blue); }
.workflow-body strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}
.workflow-body em {
  font-style: normal;
  font-size: 11px;
  color: var(--ink-soft);
}

@media (max-width: 900px) {
  .mp-stats { grid-template-columns: 1fr 1fr; }
  .formula-note { margin-left: 0; width: 100%; }
  .workflow-strip { grid-template-columns: 1fr 1fr; }
}

/* Compact table used for repeating numeric forms */
.form-table th:first-child,
.form-table td:first-child {
  position: static;
  width: 1%;
  white-space: nowrap;
}
.form-table input:not([type=checkbox]),
.form-table select {
  width: 100%;
  min-width: 64px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: var(--text-sm);
  font-family: var(--font-body);
  background: #fff;
  color: var(--ink);
}
.form-table input:focus,
.form-table select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(15,138,122,.12);
}
.form-table .col-num { width: 96px; min-width: 88px; }
.form-table .col-xs { width: 80px; min-width: 72px; }
.form-table .col-action { width: 76px; min-width: 76px; text-align: right; }

/* ---------- Toolbar (row of actions above table) ------------------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0 8px;
}
.toolbar .section-title { margin: 0; }
.cell-clip {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Pills / badges ----------------------------------------- */
.pill {
  background: var(--teal-bg);
  color: var(--teal-dark);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.pill-meta { color: var(--ink-soft); font-size: var(--text-sm); }

.role-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.role-admin  { background: var(--teal-bg);  color: var(--teal-dark); }
.role-editor { background: var(--blue-bg);  color: var(--blue); }
.role-viewer { background: var(--line-soft); color: var(--gray); }

/* ---------- User chip (old sidebar footer) ------------------------- */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  margin-bottom: 8px;
}
.link-muted {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.link-muted:hover { color: var(--teal-dark); }

/* ---------- Error pages -------------------------------------------- */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
}
.error-page h1 {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 700;
  letter-spacing: -0.05em;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 12px;
}
.error-page h2 { font-size: var(--text-xl); color: var(--ink); margin-bottom: 8px; }
.error-page p { font-size: var(--text-base); max-width: 400px; }

/* ---------- Code / mono -------------------------------------------- */
code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--teal-bg);
  color: var(--teal-dark);
  padding: 1px 5px;
  border-radius: 4px;
}
.muted { color: var(--ink-soft); }
.category { font-size: var(--text-sm); color: var(--ink-soft); }

/* ---------- Requirements table overrides --------------------------- */
.col { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Responsive ---------------------------------------------- */
@media (max-width: 1200px) {
  .hx-page { padding: 18px 18px 36px; }
  .dash-analytics { grid-template-columns: 1fr; }
  .dash-bottom { grid-template-columns: 1fr; }
  .hx-welcome .hx-role { display: none; }
  .record-form .form-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .hx-menu-btn { display: inline-flex; }
  .hx-header-top { padding: 8px 14px; }
  .hx-tabs {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    flex-direction: column;
    gap: 0;
    padding: 8px 10px 14px;
    background: #0b1220;
    border-top: 1px solid #1a2332;
    z-index: 51;
    max-height: min(70vh, 500px);
    overflow-y: auto;
  }
  .hx-tabs.open { display: flex; }
  .hx-tab {
    padding: 12px 14px;
    min-height: 44px;
    border-bottom: 1px solid #1a2332;
    border-left: 3px solid transparent;
    border-bottom-width: 0;
  }
  .hx-tab.active {
    background: #151d2e;
    border-left-color: #3b82f6;
  }
  .hx-welcome { display: none; }
  .form-grid,
  .form-grid-3,
  .record-form .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: 1; }
  .compare-grid { grid-template-columns: 1fr 1fr; }
  .chart-row { grid-template-columns: 1fr; }
  .dash-analytics { grid-template-columns: 1fr; }
  .dash-bottom { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .hx-page { padding: 14px 12px 32px; }
  .dept-grid { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; }
  .page-header { align-items: stretch; }
  .page-header h1 { font-size: 20px; }
  .auth-card { padding: 28px 18px 24px; }
  .auth-card h1 { font-size: 22px; }
  .data-table th, .data-table td { padding: 6px 8px; }
}
