/* SFS Dashboard — main stylesheet */
/* Brand: #af2b51 | Font: DM Sans */

:root {
  --brand: #af2b51;
  --brand-light: #f9e8ed;
  --brand-dark: #8a2040;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e8eaed;
  --border-light: #f0f2f4;
  --text: #1a1d23;
  --text-2: #5a6272;
  --text-3: #9aa0ad;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --sidebar-w: 220px;
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ── App shell ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}

.nav-links {
  list-style: none;
  padding: 12px 10px;
  flex: 1;
}

.nav-links li + li { margin-top: 2px; }

.nav-section-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-3);
  text-transform: uppercase;
  padding: 12px 10px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 400;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 500;
}

.nav-link svg { flex-shrink: 0; opacity: 0.8; }

.sidebar-footer {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--border-light);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-3); text-transform: capitalize; }

.footer-link {
  display: block;
  font-size: 12px;
  color: var(--text-3);
  padding: 3px 0;
  text-decoration: none;
}
.footer-link:hover { color: var(--text-2); text-decoration: none; }
.footer-link.logout:hover { color: var(--danger); }

/* ── Main content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  max-width: calc(100vw - var(--sidebar-w));
}

/* ── Flash messages ── */
.flash-container { margin-bottom: 16px; }
.flash {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-bottom: 6px;
}
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }
.flash-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.flash-info { background: var(--brand-light); color: var(--brand-dark); border: 1px solid #f4b8c8; }

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title { font-size: 20px; font-weight: 600; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-sm { padding: 14px 16px; }
.card-title { font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* ── Stat tiles ── */
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 600; color: var(--text); line-height: 1.1; }
.stat-delta { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ── Presence grid ── */
.presence-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.presence-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 400;
}

.presence-chip.working { background: var(--success-bg); border-color: #bbf7d0; color: var(--success); }
.presence-chip.annual_leave { background: var(--brand-light); border-color: #f4b8c8; color: var(--brand-dark); }
.presence-chip.absent { background: var(--danger-bg); border-color: #fecaca; color: var(--danger); }
.presence-chip.bank_holiday { background: #faf5ff; border-color: #e9d5ff; color: #7c3aed; }

.presence-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.presence-mgr-action {
  font-size: 11px;
  cursor: pointer;
  margin-left: 4px;
  opacity: 0.6;
}
.presence-mgr-action:hover { opacity: 1; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s, border-color 0.1s;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-danger { border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.1s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 150, 190, 0.12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

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

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 500;
}
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-blue { background: var(--brand-light); color: var(--brand-dark); }
.badge-orange { background: var(--warning-bg); color: var(--warning); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-gray { background: var(--border-light); color: var(--text-2); }
.badge-purple { background: #faf5ff; color: #7c3aed; }

/* ── Task items ── */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.1s;
}
.task-item:hover { border-color: var(--brand); }
.task-item.done { opacity: 0.5; }
.task-check { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border); flex-shrink: 0; margin-top: 2px; cursor: pointer; }
.task-check.checked { background: var(--brand); border-color: var(--brand); }
.task-title { font-size: 13.5px; font-weight: 500; }
.task-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ── Notice items ── */
.notice-item {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
}
.notice-item.pinned { border-left: 3px solid var(--brand); }
.notice-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.notice-body { font-size: 13.5px; color: var(--text-2); line-height: 1.65; white-space: pre-wrap; }
.notice-meta { font-size: 12px; color: var(--text-3); margin-top: 10px; display: flex; align-items: center; gap: 10px; }

/* ── Review cards ── */
.review-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.review-stars { color: #f59e0b; font-size: 15px; letter-spacing: 2px; margin-bottom: 6px; }
.review-body { font-size: 13.5px; color: var(--text-2); line-height: 1.65; font-style: italic; margin-bottom: 10px; }
.review-meta { font-size: 12px; color: var(--text-3); margin-bottom: 10px; }

.comment-list { border-top: 1px solid var(--border-light); padding-top: 10px; }
.comment-item { padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.comment-item:last-child { border-bottom: none; }
.comment-author { font-weight: 500; color: var(--text); margin-right: 6px; }
.comment-body { color: var(--text-2); }
.comment-date { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
}

.login-logo { text-align: center; margin-bottom: 24px; }
.login-title { font-size: 18px; font-weight: 600; text-align: center; margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: var(--text-3); text-align: center; margin-bottom: 24px; }

/* ── Rota calendar ── */
.cal-grid { width: 100%; border-collapse: separate; border-spacing: 4px; }
.cal-grid th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); padding: 4px 0; text-align: center; }
.cal-day {
  width: 40px; height: 40px;
  text-align: center;
  vertical-align: middle;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: default;
}
.cal-day.today { background: var(--brand-light); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.cal-day.bank-holiday { background: #faf5ff; color: #7c3aed; }
.cal-day.past { color: var(--text-3); }

/* ── Misc ── */
.divider { border: none; border-top: 1px solid var(--border-light); margin: 20px 0; }
.empty-state { text-align: center; padding: 32px; color: var(--text-3); font-size: 13.5px; }
.empty-state svg { margin-bottom: 10px; opacity: 0.4; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.justify-between { justify-content: space-between; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; padding: 16px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
