/* ============================================================
   TalentOS — Main Stylesheet
   ============================================================ */

:root {
  --ink:       #0f0e0d;
  --paper:     #f5f2ed;
  --warm-mid:  #e8e2d8;
  --accent:    #c84b2f;
  --accent2:   #2a6b5c;
  --muted:     #7a7268;
  --white:     #ffffff;
  --sidebar-w: 220px;

  --status-active:    #2a6b5c;
  --status-planned:   #2d5fa6;
  --status-hold:      #a06b20;
  --status-done:      #555;
  --status-cancelled: #9b2828;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --r: 8px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 28px 24px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo-icon { font-size: 1.4rem; color: var(--accent); }
.logo-text  { font-family: 'DM Serif Display', serif; font-size: 1.2rem; letter-spacing: .02em; }

.nav-links { list-style: none; padding: 16px 0; flex: 1; }
.nav-links li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 24px;
  color: rgba(245,242,237,.65);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: all .18s;
}
.nav-links li a:hover  { color: var(--paper); background: rgba(255,255,255,.06); }
.nav-links li a.active { color: var(--paper); background: rgba(200,75,47,.18); border-right: 3px solid var(--accent); }
.nav-icon { font-size: .85rem; opacity: .7; }

.sidebar-footer {
  padding: 16px 24px;
  font-size: .72rem;
  color: rgba(245,242,237,.3);
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ── Main layout ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 36px 0;
}
.page-title { font-family: 'DM Serif Display', serif; font-size: 1.75rem; font-weight: 400; }
.topbar-date { font-size: .8rem; color: var(--muted); }

.content-body { padding: 28px 36px 40px; }

/* ── Cards & Grid ────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--r);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--accent);
}
.stat-card.green { border-color: var(--accent2); }
.stat-card.blue  { border-color: #2d5fa6; }
.stat-card.amber { border-color: #a06b20; }

.stat-value { font-size: 2rem; font-weight: 600; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-family: 'DM Serif Display', serif; font-size: 1.15rem; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  border-bottom: 2px solid var(--warm-mid);
  font-weight: 600;
}
tbody tr { border-bottom: 1px solid var(--warm-mid); transition: background .12s; }
tbody tr:hover { background: #faf8f4; }
tbody td { padding: 12px 14px; vertical-align: middle; }
tbody tr:last-child { border-bottom: none; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
}
.badge-active    { background: #d4ede7; color: var(--status-active); }
.badge-planned   { background: #d6e4f7; color: var(--status-planned); }
.badge-on_hold   { background: #fdefd7; color: var(--status-hold); }
.badge-completed { background: #e5e5e5; color: var(--status-done); }
.badge-cancelled { background: #fddcdc; color: var(--status-cancelled); }
.badge-inactive  { background: #e5e5e5; color: var(--status-done); }
.badge-on_leave  { background: #fdefd7; color: var(--status-hold); }
.badge-pending   { background: #fdefd7; color: var(--status-hold); }
.badge-high      { background: #fddcdc; color: var(--status-cancelled); }
.badge-critical  { background: #fddcdc; color: #6b0000; }
.badge-medium    { background: #fdefd7; color: var(--status-hold); }
.badge-low       { background: #e5e5e5; color: var(--status-done); }
.badge-expert        { background: #d4ede7; color: var(--accent2); }
.badge-intermediate  { background: #d6e4f7; color: var(--status-planned); }
.badge-beginner      { background: #e5e5e5; color: var(--muted); }
.badge-ft  { background: #d4ede7; color: var(--accent2); }
.badge-hr  { background: #d6e4f7; color: var(--status-planned); }
.badge-ic  { background: #fdefd7; color: var(--status-hold); }
.badge-withdrawn { background: #ede8f5; color: #6b4fa8; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .15s;
  font-family: inherit;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #a83a22; }
.btn-secondary { background: var(--warm-mid); color: var(--ink); }
.btn-secondary:hover { background: #d8d1c5; }
.btn-success   { background: var(--accent2); color: #fff; }
.btn-success:hover { background: #1f5245; }
.btn-sm { padding: 5px 10px; font-size: .75rem; }
.btn-danger { background: #fddcdc; color: var(--status-cancelled); }
.btn-danger:hover { background: #f5c2c2; }

/* ── Forms ───────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
input, select, textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--warm-mid);
  border-radius: 6px;
  font-size: .875rem;
  font-family: inherit;
  background: var(--paper);
  color: var(--ink);
  transition: border .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--white);
}
textarea { resize: vertical; min-height: 80px; }

/* ── Flash messages ──────────────────────────────────────── */
.flash { padding: 12px 18px; border-radius: 6px; margin-bottom: 20px; font-size: .875rem; font-weight: 500; }
.flash-success { background: #d4ede7; color: var(--accent2); border-left: 4px solid var(--accent2); }
.flash-error   { background: #fddcdc; color: var(--status-cancelled); border-left: 4px solid var(--status-cancelled); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,14,13,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  backdrop-filter: blur(2px);
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--white);
  border-radius: var(--r);
  padding: 32px 36px;
  max-width: 640px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-md);
}
.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; font-size: 1rem;
  cursor: pointer; color: var(--muted);
}
.modal h2 { font-family: 'DM Serif Display', serif; margin-bottom: 24px; font-size: 1.3rem; }

/* ── Calendar (weekly) ───────────────────────────────────── */
.cal-nav {
  display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
}
.cal-nav h2 { font-family: 'DM Serif Display', serif; font-size: 1.25rem; }

/* 7-column week grid */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  border: 1.5px solid var(--warm-mid);
  border-radius: var(--r);
  overflow: hidden;
}

/* Day headers */
.week-day-header {
  background: var(--paper);
  border-bottom: 2px solid var(--warm-mid);
  border-right: 1px solid var(--warm-mid);
  padding: 8px 6px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.week-day-header:last-child { border-right: none; }
.week-day-header.today  { background: #fff8f6; }
.week-day-header.weekend { background: #f8f6f2; }

.week-day-name {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
}
.week-day-num {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
}
.today-num {
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  padding: 1px 7px;
}

/* Day event columns */
.week-day-col {
  min-height: 120px;
  padding: 6px 5px;
  border-right: 1px solid var(--warm-mid);
  vertical-align: top;
  background: var(--white);
}
.week-day-col:last-child { border-right: none; }
.week-day-col.today   { background: #fffaf9; }
.week-day-col.weekend { background: #faf9f7; }

.week-empty {
  color: var(--warm-mid);
  font-size: .75rem;
  text-align: center;
  margin-top: 12px;
}

/* Shared event pill */
.cal-event {
  border-radius: 3px;
  padding: 3px 6px;
  margin-bottom: 3px;
  font-size: .69rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.cal-event.vacation    { background:#d4ede7; color: var(--accent2); }
.cal-event.sick        { background:#fddcdc; color: var(--status-cancelled); }
.cal-event.training    { background:#d6e4f7; color: var(--status-planned); }
.cal-event.remote      { background:#fdefd7; color: var(--status-hold); }
.cal-event.unavailable { background:#e5e5e5; color: var(--muted); }
.cal-event.available   { background:#d4ede7; color: var(--accent2); }
.cal-event.assignment  { background:#0f0e0d; color: #fff; }

/* ── Allocation bar ──────────────────────────────────────── */
.alloc-bar-wrap { background: var(--warm-mid); border-radius: 20px; height: 8px; min-width: 80px; }
.alloc-bar { height: 8px; border-radius: 20px; background: var(--accent2); }
.alloc-bar.over { background: var(--accent); }

/* ── Dashboard 2-col ─────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

/* ── Filter panel ─────────────────────────────────────────── */
.filter-panel {
  padding: 14px 20px 16px;
  margin-bottom: 4px;
}
.filter-panel-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.filter-title { font-size: .875rem; font-weight: 600; }

/* Horizontal single-row layout */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

/* Legacy grid layout (kept for potential reuse) */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 12px;
  align-items: end;
}
.filter-search { grid-column: span 2; }

.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.filter-summary {
  font-size: .78rem;
  color: var(--muted);
  margin: 6px 0 0;
}

/* ── Sortable column headers ──────────────────────────────── */
.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.sort-link:hover { color: var(--accent); }
.sort-link.sort-active { color: var(--accent); }
.sort-icon { font-size: .68rem; opacity: .4; }
.sort-icon.sort-active { opacity: 1; color: var(--accent); }

.end-date-warning {
  display: inline-block;
  color: #c0392b;
  background: #fdecea;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: .78rem;
  font-weight: 600;
}
.end-date-past {
  display: inline-block;
  color: #ffffff;
  background: #c0392b;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: .78rem;
  font-weight: 600;
}

/* Staff request status badges */
.badge-sr-open      { background: #d6e4f7; color: var(--status-planned); }
.badge-sr-in_review { background: #fdefd7; color: var(--status-hold); }
.badge-sr-filled    { background: #d4ede7; color: var(--accent2); }
.badge-sr-cancelled { background: #e5e5e5; color: var(--muted); }
.badge-amber        { background: #fdefd7; color: var(--status-hold); }

/* Expand toggle button */
.expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .65rem;
  color: var(--muted);
  padding: 2px 4px;
  border-radius: 3px;
  transition: color .15s;
}
.expand-btn:hover { color: var(--accent); }

/* Candidate sub-table */
.candidate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  margin-top: 6px;
  background: #faf9f7;
  border-radius: 6px;
  overflow: hidden;
}
.candidate-table thead th {
  font-size: .68rem;
  padding: 7px 10px;
  background: var(--warm-mid);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  border: none;
}
.candidate-table tbody tr { border-bottom: 1px solid var(--warm-mid); }
.candidate-table tbody tr:last-child { border-bottom: none; }
.candidate-table tbody td { padding: 8px 10px; vertical-align: middle; }

/* ── Misc ────────────────────────────────────────────────── */
.text-muted  { color: var(--muted); }
.text-small  { font-size: .78rem; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.flex  { display: flex; }
.gap-8 { gap: 8px; }
.skills-list { display: flex; flex-wrap: wrap; gap: 6px; }
.empty-state { text-align: center; color: var(--muted); padding: 40px; font-size: .9rem; }
