/* ═══════════════════════════════════════════════════════════════
   HR SCHEDULER — DESIGN SYSTEM
   Font: DM Sans (body) + DM Mono (data/code)
   Theme: Clean professional with teal accent, warm neutrals
═══════════════════════════════════════════════════════════════ */

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

:root {
  --teal:        #0f6e56;
  --teal-light:  #e1f5ee;
  --teal-mid:    #1d9e75;
  --teal-dark:   #085041;
  --ink:         #111827;
  --ink-2:       #374151;
  --ink-3:       #6b7280;
  --ink-4:       #9ca3af;
  --surface:     #ffffff;
  --surface-2:   #f9fafb;
  --surface-3:   #f3f4f6;
  --border:      #e5e7eb;
  --border-mid:  #d1d5db;
  --amber:       #b45309;
  --amber-light: #fef3c7;
  --red:         #b91c1c;
  --red-light:   #fee2e2;
  --blue:        #1d4ed8;
  --blue-light:  #dbeafe;
  --font:        'DM Sans', sans-serif;
  --mono:        'DM Mono', monospace;
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:      0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg:   0 12px 40px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);
  --transition:  180ms ease;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface-2);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Loading screen ─────────────────────────────────────────── */
#loading-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  z-index: 1000;
}
.loader-wrap { text-align: center; }
.loader-mark {
  display: flex; gap: 8px; justify-content: center; margin-bottom: 16px;
}
.loader-mark span {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--teal);
  animation: bounce 0.9s ease-in-out infinite;
}
.loader-mark span:nth-child(2) { animation-delay: .15s; }
.loader-mark span:nth-child(3) { animation-delay: .30s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: .5; }
  40%           { transform: scale(1.0); opacity: 1; }
}
.loader-text { color: var(--ink-3); font-size: 13px; letter-spacing: .02em; }

/* ── Layout shell ───────────────────────────────────────────── */
#app { min-height: 100vh; }

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* ── Top bar ─────────────────────────────────────────────────── */
.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 15px; color: var(--ink);
  text-decoration: none;
}
.topbar-brand .brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--teal);
  display: flex; align-items: center; justify-content: center;
}
.topbar-brand .brand-mark svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px; color: var(--ink-2);
  cursor: default;
}
.user-chip img {
  width: 24px; height: 24px; border-radius: 50%;
  object-fit: cover;
}
.user-chip .role-badge {
  font-size: 11px; font-weight: 500;
  padding: 1px 6px; border-radius: 10px;
  background: var(--teal-light); color: var(--teal-dark);
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex; flex-direction: column;
  gap: 4px;
}
.sidebar-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-4);
  padding: 8px 10px 4px;
  margin-top: 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px; color: var(--ink-2);
  text-decoration: none; cursor: pointer; border: none;
  background: transparent; width: 100%; text-align: left;
  transition: background var(--transition), color var(--transition);
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; }
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item.active { background: var(--teal-light); color: var(--teal-dark); font-weight: 500; }
.nav-item.active svg { stroke: var(--teal); }
.nav-item.danger:hover { background: var(--red-light); color: var(--red); }

/* ── Main content ─────────────────────────────────────────────── */
.main-content {
  padding: 28px 32px;
  overflow-y: auto;
}
.page-header {
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px; font-weight: 600; color: var(--ink); line-height: 1.2;
}
.page-subtitle { font-size: 14px; color: var(--ink-3); margin-top: 4px; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 14px; font-weight: 600; color: var(--ink);
  margin-bottom: 16px;
}

/* ── Stat cards ───────────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.stat-value {
  font-size: 28px; font-weight: 600; color: var(--ink);
  line-height: 1; margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 12px; color: var(--ink-3); }
.stat-card.accent { background: var(--teal); border-color: var(--teal); }
.stat-card.accent .stat-value { color: #fff; }
.stat-card.accent .stat-label { color: rgba(255,255,255,.75); }

/* ── Tables ───────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}
thead tr {
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 500; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-3);
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-2);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }
.td-name { font-weight: 500; color: var(--ink); }
.td-mono { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }

/* ── Status badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 500;
  white-space: nowrap;
}
.badge-pending   { background: #fef9c3; color: #854d0e; }
.badge-booked    { background: var(--teal-light); color: var(--teal-dark); }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-cancelled { background: var(--red-light); color: var(--red); }
.badge-open      { background: var(--blue-light); color: var(--blue); }
.badge-tie       { background: var(--amber-light); color: var(--amber); }
.badge-resolved  { background: #dcfce7; color: #166534; }
.badge-intern    { background: #f0fdf4; color: #15803d; }
.badge-contract  { background: #eff6ff; color: #1d4ed8; }
.badge-permanent { background: #faf5ff; color: #7e22ce; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13.5px; font-weight: 500;
  cursor: pointer; border: none; text-decoration: none;
  transition: all var(--transition); white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-secondary { background: var(--surface); color: var(--ink-2); border: 1px solid var(--border-mid); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: #fecaca; }
.btn-ghost { background: transparent; color: var(--ink-3); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--ink-2); margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; color: var(--ink);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15,110,86,.12);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 24px;
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg);
  animation: slide-up .2s ease;
  max-height: calc(100vh - 48px); overflow-y: auto;
}
@keyframes slide-up {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--ink-3); padding: 4px; border-radius: 4px;
  display: flex; align-items: center;
}
.modal-close:hover { background: var(--surface-3); color: var(--ink); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ── Agenda viewer ───────────────────────────────────────────── */
.agenda-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 13.5px;
}
.agenda-section { margin-bottom: 16px; }
.agenda-section:last-child { margin-bottom: 0; }
.agenda-section-heading {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--teal-dark);
  margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.agenda-duration { font-size: 11px; color: var(--ink-4); font-weight: 400; text-transform: none; letter-spacing: 0; }
.agenda-items { list-style: none; }
.agenda-items li {
  padding: 4px 0 4px 16px;
  position: relative; color: var(--ink-2);
}
.agenda-items li::before {
  content: "–"; position: absolute; left: 0; color: var(--ink-4);
}
.agenda-closing {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--ink-3); font-style: italic;
}
.agenda-copy-btn { margin-top: 12px; }

/* ── Slot picker ─────────────────────────────────────────────── */
.slot-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px; margin-top: 12px;
}
.slot-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer; text-align: center;
  transition: all var(--transition);
  background: var(--surface);
}
.slot-card:hover { border-color: var(--teal-mid); background: var(--teal-light); }
.slot-card.selected { border-color: var(--teal); background: var(--teal-light); }
.slot-card.booked { border-color: var(--border); background: var(--surface-3); cursor: not-allowed; opacity: .6; }
.slot-date { font-size: 13px; font-weight: 600; color: var(--ink); }
.slot-time { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ── Vote bars ───────────────────────────────────────────────── */
.vote-bar-wrap { margin: 8px 0; }
.vote-bar-label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--ink-2); margin-bottom: 4px;
}
.vote-bar-track {
  height: 8px; background: var(--surface-3);
  border-radius: 4px; overflow: hidden;
}
.vote-bar-fill {
  height: 100%; background: var(--teal);
  border-radius: 4px;
  transition: width .4s ease;
}

/* ── Calendar availability chips ────────────────────────────── */
.avail-grid {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.avail-chip {
  padding: 6px 12px; border-radius: 20px;
  border: 1px solid var(--border-mid);
  font-size: 12px; color: var(--ink-2);
  cursor: pointer; background: var(--surface);
  transition: all var(--transition);
}
.avail-chip:hover { border-color: var(--teal); background: var(--teal-light); color: var(--teal-dark); }
.avail-chip.selected { border-color: var(--teal); background: var(--teal); color: #fff; }

/* ── Timeline (schedule view) ───────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 1px; }
.timeline-month { margin-bottom: 24px; }
.timeline-month-label {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-4);
  margin-bottom: 10px; padding-left: 4px;
}
.timeline-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  transition: box-shadow var(--transition);
}
.timeline-item:hover { box-shadow: var(--shadow-sm); }
.timeline-date {
  flex-shrink: 0; width: 48px; text-align: center;
  font-size: 11px; color: var(--ink-4); line-height: 1.3;
  padding-top: 2px;
}
.timeline-date strong { display: block; font-size: 18px; font-weight: 600; color: var(--ink); }
.timeline-info { flex: 1; min-width: 0; }
.timeline-label { font-size: 14px; font-weight: 500; color: var(--ink); }
.timeline-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.timeline-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }

/* ── Login page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 40px 36px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-mark {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--teal);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.login-mark svg { width: 28px; height: 28px; fill: none; stroke: #fff; stroke-width: 2; }
.login-title { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.login-subtitle { font-size: 14px; color: var(--ink-3); margin-bottom: 28px; }
.login-btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 20px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font-family: var(--font); font-size: 14px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: all var(--transition);
}
.login-btn-google:hover { background: var(--surface-3); border-color: var(--border); }
.login-btn-google svg { width: 18px; height: 18px; }
.login-footer { font-size: 12px; color: var(--ink-4); margin-top: 24px; line-height: 1.6; }

/* ── Tabs ─────────────────────────────────────────────────────── */
.tab-bar {
  display: flex; gap: 2px;
  background: var(--surface-3);
  padding: 3px; border-radius: var(--radius-sm);
  margin-bottom: 20px; width: fit-content;
}
.tab {
  padding: 6px 14px; border-radius: 6px;
  font-size: 13px; font-weight: 500; color: var(--ink-3);
  cursor: pointer; border: none; background: none;
  transition: all var(--transition); white-space: nowrap;
}
.tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.tab:hover:not(.active) { color: var(--ink); }

/* ── Empty states ─────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--ink-3);
}
.empty-state svg {
  width: 36px; height: 36px; stroke: var(--border-mid);
  fill: none; margin-bottom: 12px;
}
.empty-state p { font-size: 14px; }

/* ── Toast notifications ─────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 1000;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease;
  max-width: 320px;
}
@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
.toast-success { background: var(--teal); color: #fff; }
.toast-error   { background: var(--red);  color: #fff; }
.toast-info    { background: var(--ink);  color: #fff; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
}
