/* ===========================================================
   Interview Tracker — design system
   A calm, pipeline-first interface for HR teams. The signature
   element is the stage stepper used throughout the app to show
   where a candidate sits in the process.
   =========================================================== */

:root {
  /* --- Color tokens --- */
  --ink: #1A2420;
  --paper: #F6F4EE;
  --surface: #FFFFFF;
  --primary: #2C5F4F;
  --primary-dark: #1E443A;
  --primary-light: #E4EEE8;
  --accent: #C0922E;
  --accent-light: #F6ECD6;
  --line: #E1DCCF;
  --line-strong: #CFC8B6;
  --muted: #6B6F69;
  --danger: #A14A42;
  --danger-light: #F3E2DF;

  /* --- Stage colors (functional, muted, distinct) --- */
  --stage-applied: #6B7280;
  --stage-applied-bg: #EEF0F2;
  --stage-screening: #3B6EA5;
  --stage-screening-bg: #E8F0F8;
  --stage-interviewing: #A6790E;
  --stage-interviewing-bg: #FBF1DC;
  --stage-offer: #7C5CBF;
  --stage-offer-bg: #EFE9F8;
  --stage-hired: #2C5F4F;
  --stage-hired-bg: #E4EEE8;
  --stage-rejected: #A14A42;
  --stage-rejected-bg: #F3E2DF;
  --stage-onhold: #8A8275;
  --stage-onhold-bg: #EEEBE4;

  /* --- Type --- */
  --font-display: "Space Grotesk", "Inter", -apple-system, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  /* --- Layout --- */
  --sidebar-w: 232px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 2px rgba(26, 36, 32, 0.06), 0 1px 1px rgba(26, 36, 32, 0.04);
}

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

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

p { margin: 0 0 0.6em; }

code, .mono { font-family: var(--font-mono); font-size: 0.92em; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- App shell ---------- */

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--ink);
  color: #DCE7E1;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 22px;
  letter-spacing: -0.01em;
}

.sidebar__brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--accent);
  flex-shrink: 0;
  position: relative;
}
.sidebar__brand-mark::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 3px;
  background: var(--ink);
  opacity: 0.85;
}

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: #C7D6CD;
  font-size: 0.91rem;
  font-weight: 500;
  text-decoration: none;
}
.sidebar__link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar__link.is-active { background: var(--primary); color: #fff; }
.sidebar__link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.9; }

.sidebar__spacer { flex: 1; }

.sidebar__user {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 14px;
  font-size: 0.85rem;
}
.sidebar__user-name { color: #fff; font-weight: 600; }
.sidebar__user-role {
  display: inline-block;
  margin-top: 2px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.sidebar__logout {
  margin-top: 10px;
  display: inline-block;
  font-size: 0.82rem;
  color: #C7D6CD;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}
.sidebar__logout:hover { color: #fff; text-decoration: underline; }

.main { flex: 1; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 32px 0;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar__title { display: flex; flex-direction: column; gap: 4px; }
.topbar__eyebrow {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
}

.content { padding: 20px 32px 60px; }

/* ---------- Buttons ---------- */

.btn {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--paper); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-light); }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; padding: 7px 10px; }
.btn-ghost:hover { background: var(--line); color: var(--ink); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 5px 11px; font-size: 0.79rem; }

/* ---------- Cards / stats ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
@media (max-width: 980px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

.dashboard-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
@media (max-width: 980px) { .dashboard-grid { grid-template-columns: 1fr; } }

.stat-card {
  padding: 18px 18px 16px;
}
.stat-card__label {
  font-size: 0.76rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.stat-card__value {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  margin-top: 6px;
  color: var(--ink);
}
.stat-card__hint { font-size: 0.79rem; color: var(--muted); margin-top: 4px; }

.panel { padding: 20px 22px; margin-bottom: 18px; }
.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

/* ---------- Pipeline stepper (signature element) ---------- */

.stepper {
  display: flex;
  align-items: flex-start;
  margin: 6px 0 4px;
}
.stepper__step {
  flex: 1;
  position: relative;
  text-align: center;
}
.stepper__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 9px;
  left: calc(50% + 16px);
  right: calc(-50% + 16px);
  height: 2px;
  background: var(--line-strong);
}
.stepper__step.is-done:not(:last-child)::after { background: var(--primary); }
.stepper__dot {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--line-strong);
  margin: 0 auto 8px;
  position: relative;
  z-index: 1;
}
.stepper__step.is-done .stepper__dot { background: var(--primary); border-color: var(--primary); }
.stepper__step.is-current .stepper__dot {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.stepper__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}
.stepper__step.is-done .stepper__label,
.stepper__step.is-current .stepper__label { color: var(--ink); }

.exit-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.86rem;
  margin: 6px 0 4px;
}
.exit-banner.rejected { background: var(--stage-rejected-bg); color: var(--stage-rejected); }
.exit-banner.onhold { background: var(--stage-onhold-bg); color: var(--stage-onhold); }

/* ---------- Badges / pills ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-Applied { background: var(--stage-applied-bg); color: var(--stage-applied); }
.badge-Screening { background: var(--stage-screening-bg); color: var(--stage-screening); }
.badge-Interviewing { background: var(--stage-interviewing-bg); color: var(--stage-interviewing); }
.badge-Offer { background: var(--stage-offer-bg); color: var(--stage-offer); }
.badge-Hired { background: var(--stage-hired-bg); color: var(--stage-hired); }
.badge-Rejected { background: var(--stage-rejected-bg); color: var(--stage-rejected); }
.badge-OnHold, .badge-On\ Hold { background: var(--stage-onhold-bg); color: var(--stage-onhold); }

.badge-status-Scheduled { background: var(--stage-screening-bg); color: var(--stage-screening); }
.badge-status-Completed { background: var(--stage-hired-bg); color: var(--stage-hired); }
.badge-status-Cancelled { background: var(--stage-onhold-bg); color: var(--stage-onhold); }
.badge-status-No-show { background: var(--stage-rejected-bg); color: var(--stage-rejected); }
.badge-status-Rescheduled { background: var(--stage-interviewing-bg); color: var(--stage-interviewing); }

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  padding: 0 14px 10px;
  border-bottom: 1px solid var(--line);
}
tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.89rem;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr.is-clickable { cursor: pointer; }
tbody tr.is-clickable:hover { background: var(--primary-light); }
.cell-muted { color: var(--muted); }

/* ---------- Forms ---------- */

label {
  display: block;
  font-size: 0.81rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--ink);
}
.field { margin-bottom: 14px; }
.field-hint { font-size: 0.76rem; color: var(--muted); margin-top: 4px; }

input[type="text"], input[type="email"], input[type="tel"],
input[type="password"], input[type="datetime-local"], input[type="date"],
input[type="number"], select, textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.file-drop {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  background: var(--paper);
}
.file-drop:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Filters / toolbar ---------- */

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar input[type="text"] { width: 240px; }
.toolbar select { width: auto; min-width: 150px; }
.chip-group { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 0.79rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(26, 36, 32, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 50;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.modal__close {
  background: none; border: none; cursor: pointer; font-size: 1.3rem;
  color: var(--muted); line-height: 1; padding: 4px;
}
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- Misc ---------- */

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}
.empty-state h3 { color: var(--ink); margin-bottom: 6px; }
.empty-state .btn { margin-top: 14px; }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  margin-bottom: 14px;
}
.alert-error { background: var(--danger-light); color: var(--danger); }
.alert-success { background: var(--primary-light); color: var(--primary-dark); }

.activity-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-item__time { color: var(--muted); font-family: var(--font-mono); font-size: 0.74rem; white-space: nowrap; }

.rating-stars { color: var(--accent); letter-spacing: 1px; }

.skeleton {
  background: linear-gradient(90deg, var(--line) 25%, var(--paper) 37%, var(--line) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; padding: 14px 16px; }
  .sidebar__nav { flex-direction: row; overflow-x: auto; }
  .sidebar__user, .sidebar__spacer, .sidebar__brand span { display: none; }
  .topbar, .content { padding-left: 18px; padding-right: 18px; }
}
