/* Staffcopilot — operations app styles.
   System font stack only; no external fonts/CDN assets. */

:root {
  --color-primary: #2563eb;
  --color-primary-ink: #1d4ed8;
  --color-on-primary: #ffffff;
  --color-accent: #059669;
  --color-accent-ink: #047857;
  --color-background: #f8fafc;
  --color-surface: #ffffff;
  --color-foreground: #0f172a;
  --color-muted-text: #475569;
  --color-muted: #f1f5fd;
  --color-border: #e2e8f0;
  --color-destructive: #dc2626;
  --color-destructive-ink: #b91c1c;
  --color-warning-bg: #fef3c7;
  --color-warning-ink: #92400e;
  --color-ring: #2563eb;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 10px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 24px rgba(15, 23, 42, 0.12);

  --sidebar-width: 248px;
  --topbar-height: 56px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-foreground);
  background: var(--color-background);
  line-height: 1.5;
  font-size: 16px;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 var(--space-md); color: var(--color-foreground); }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 600; margin-top: var(--space-xl); }
p { margin: 0 0 var(--space-md); color: var(--color-muted-text); }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Focus visibility everywhere (a11y requirement, never remove) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: var(--space-sm) var(--space-md);
  z-index: 100;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-secondary, .btn-danger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 44px;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: 2px solid transparent;
  transition: background-color var(--transition-base), border-color var(--transition-base), transform var(--transition-fast);
  cursor: pointer;
}
.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.btn-primary:hover { background: var(--color-primary-ink); }
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border-color: var(--color-border);
}
.btn-secondary:hover { border-color: var(--color-primary); background: var(--color-muted); }
.btn-danger {
  background: var(--color-surface);
  color: var(--color-destructive);
  border-color: var(--color-border);
}
.btn-danger:hover { border-color: var(--color-destructive); background: #fef2f2; }
.btn-primary:active, .btn-secondary:active, .btn-danger:active { transform: translateY(1px); }

.inline-form { display: inline-block; margin: 0; }

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

.topbar {
  display: none;
  align-items: center;
  gap: var(--space-md);
  height: var(--topbar-height);
  padding: 0 var(--space-md);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-wordmark { font-weight: 700; color: var(--color-foreground); font-size: 1.05rem; flex: 1; }
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-foreground);
}
.nav-toggle:hover { background: var(--color-muted); }

.dev-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-warning-ink);
  background: var(--color-warning-bg);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
}

.app-body { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: var(--space-lg) var(--space-md);
  gap: var(--space-lg);
}
.sidebar-header { padding: 0 var(--space-sm); }
.sidebar-wordmark { display: block; font-size: 1.15rem; font-weight: 700; color: var(--color-foreground); }
.sidebar-wordmark:hover { text-decoration: none; }
.sidebar-company { font-size: 0.85rem; color: var(--color-muted-text); margin: var(--space-xs) 0 0; }

.sidebar-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-xs); flex: 1; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.65rem var(--space-sm);
  border-radius: var(--radius-sm);
  color: var(--color-muted-text);
  font-weight: 500;
  min-height: 44px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.sidebar-nav a:hover { background: var(--color-muted); color: var(--color-foreground); text-decoration: none; }
.sidebar-nav a[aria-current="page"] {
  background: var(--color-muted);
  color: var(--color-primary-ink);
  font-weight: 700;
}

.sidebar-footer {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.sidebar-profile, .sidebar-logout {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.6rem var(--space-sm);
  border-radius: var(--radius-sm);
  color: var(--color-muted-text);
  font: inherit;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  min-height: 44px;
}
.sidebar-profile:hover, .sidebar-logout:hover { background: var(--color-muted); color: var(--color-foreground); text-decoration: none; }

.nav-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 15;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: var(--space-xl) var(--space-2xl);
}

.messages { list-style: none; margin: 0 0 var(--space-lg); padding: 0; display: flex; flex-direction: column; gap: var(--space-sm); }
.message {
  padding: 0.75rem var(--space-md);
  border-radius: var(--radius-sm);
  font-weight: 500;
  border: 1px solid transparent;
}
.message-success { background: #ecfdf5; color: var(--color-accent-ink); border-color: #a7f3d0; }
.message-error { background: #fef2f2; color: var(--color-destructive-ink); border-color: #fecaca; }
.message-warning { background: var(--color-warning-bg); color: var(--color-warning-ink); border-color: #fde68a; }
.message-info { background: var(--color-muted); color: var(--color-primary-ink); border-color: var(--color-border); }

/* ---------- Cards / stats ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-label { font-size: 0.85rem; color: var(--color-muted-text); font-weight: 600; margin-bottom: var(--space-xs); }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--color-foreground); }
.stat-card .stat-hint { font-size: 0.8rem; color: var(--color-muted-text); margin-top: var(--space-xs); }

.dashboard-columns { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--space-lg); align-items: start; }
.dashboard-columns .card { margin-bottom: var(--space-lg); }

.list-plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-sm); }
.list-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--color-border);
}
.list-row:last-child { border-bottom: none; }
.list-row-title { font-weight: 600; color: var(--color-foreground); }
.list-row-meta { font-size: 0.85rem; color: var(--color-muted-text); }

.empty-state {
  text-align: center;
  color: var(--color-muted-text);
  padding: var(--space-xl) var(--space-md);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
}

/* ---------- Forms ---------- */
.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 560px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.field { display: flex; flex-direction: column; gap: var(--space-xs); }
.field label { font-weight: 600; font-size: 0.9rem; color: var(--color-foreground); }
.field input[type="text"],
.field input[type="password"],
.field input[type="search"],
.field input[type="date"],
.field input[type="datetime-local"],
.field input[type="number"],
.field select,
.field textarea,
input[type="text"], input[type="password"], input[type="search"],
input[type="date"], input[type="datetime-local"], input[type="number"],
select, textarea {
  font: inherit;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-foreground);
  min-height: 44px;
  width: 100%;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.field-error { color: var(--color-destructive-ink); font-size: 0.85rem; margin: 0; }
.form-error-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--color-destructive-ink);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
}
.form-error-banner p { color: inherit; margin: 0; }
.help-text { font-size: 0.8rem; color: var(--color-muted-text); }

.search-form { display: flex; gap: var(--space-sm); margin-bottom: var(--space-md); max-width: 420px; }
.search-form input { flex: 1; }

.filter-bar { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: end; margin-bottom: var(--space-lg); }
.filter-bar .field { min-width: 160px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.data-table th, .data-table td { text-align: left; padding: 0.75rem var(--space-md); border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.data-table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-muted-text); background: var(--color-muted); }
.data-table tr:last-child td { border-bottom: none; }
.data-table td .btn-secondary, .data-table td .btn-danger { padding: 0.4rem 0.8rem; min-height: 36px; font-size: 0.85rem; margin-right: var(--space-xs); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--color-muted);
  color: var(--color-muted-text);
}
.badge-success { background: #ecfdf5; color: var(--color-accent-ink); }
.badge-muted { background: var(--color-muted); color: var(--color-muted-text); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning-ink); }
.badge-danger { background: #fef2f2; color: var(--color-destructive-ink); }
.badge-info { background: #eff6ff; color: var(--color-primary-ink); }

.alert-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: var(--color-accent-ink);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}
.alert-success code, .invite-link code {
  display: block;
  margin-top: var(--space-xs);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  word-break: break-all;
  font-size: 0.85rem;
}

/* ---------- Auth (login / setup) ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  background: linear-gradient(180deg, var(--color-background) 0%, var(--color-muted) 100%);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-xl);
  box-shadow: var(--shadow-lg);
}
.auth-wordmark { text-align: center; font-size: 1.4rem; margin-bottom: var(--space-xs); }
.auth-subtitle { text-align: center; margin-bottom: var(--space-xl); }
.auth-card form { display: flex; flex-direction: column; gap: var(--space-md); }
.auth-card .btn-primary { justify-content: center; margin-top: var(--space-sm); }

/* ---------- Calendar ---------- */
.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.calendar-nav { display: flex; gap: var(--space-sm); align-items: center; }
.calendar-nav .btn-secondary { padding: 0.6rem 0.9rem; }
.calendar-range { font-weight: 700; min-width: 160px; }
.calendar-view-toggle { display: flex; gap: var(--space-xs); }
.calendar-view-toggle .btn-secondary.is-active {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
}

/* Stable per-employee colors: pk % 8. Text/border pairs kept at AA
   contrast against var(--color-surface). Unassigned gets a dedicated
   neutral gray, never reusing emp-color-0. */
.emp-color-0 { --emp-bg: #dbeafe; --emp-border: #2563eb; --emp-ink: #1e3a8a; }
.emp-color-1 { --emp-bg: #dcfce7; --emp-border: #16a34a; --emp-ink: #14532d; }
.emp-color-2 { --emp-bg: #fef3c7; --emp-border: #d97706; --emp-ink: #78350f; }
.emp-color-3 { --emp-bg: #fee2e2; --emp-border: #dc2626; --emp-ink: #7f1d1d; }
.emp-color-4 { --emp-bg: #ede9fe; --emp-border: #7c3aed; --emp-ink: #4c1d95; }
.emp-color-5 { --emp-bg: #cffafe; --emp-border: #0891b2; --emp-ink: #164e63; }
.emp-color-6 { --emp-bg: #fce7f3; --emp-border: #db2777; --emp-ink: #831843; }
.emp-color-7 { --emp-bg: #ffedd5; --emp-border: #ea580c; --emp-ink: #7c2d12; }
.emp-color-unassigned { --emp-bg: #e2e8f0; --emp-border: #64748b; --emp-ink: #334155; }

/* ----- Week: time grid ----- */
.cal-week-scroll { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.cal-week-grid { display: flex; min-width: 760px; }
.cal-week-axis { width: 56px; flex-shrink: 0; }
.cal-week-axis-spacer { height: 48px; border-bottom: 1px solid var(--color-border); }
.cal-hour-row {
  height: 60px;
  border-bottom: 1px dashed var(--color-border);
  position: relative;
}
.cal-hour-label {
  position: absolute;
  top: -0.6em;
  right: 6px;
  font-size: 0.72rem;
  color: var(--color-muted-text);
  background: var(--color-surface);
  padding: 0 2px;
}
.cal-day-col { flex: 1; min-width: 100px; border-left: 1px solid var(--color-border); }
.cal-day-col.is-today { background: #f8fbff; }
.cal-day-header {
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.8rem;
}
.cal-day-name { font-weight: 700; text-transform: uppercase; color: var(--color-muted-text); }
.cal-day-num { color: var(--color-foreground); }
.cal-day-body { position: relative; }
.cal-hour-gridline { height: 60px; border-bottom: 1px dashed var(--color-border); }
.cal-event {
  /* Deliberately no fixed minimum box height here: calendar_utils's
     MIN_VISUAL_SPAN_HOURS already guarantees an equivalent floor
     (18px at 60px/hour) on `height` everywhere except right at the
     grid's bottom edge, where it is deliberately clamped shorter
     instead (so the box never reads past 24:00). A fixed CSS floor
     would override that deliberate shortening and spill the box past
     its day column - the inline `max-height: calc(100% - top%)` in the
     template is what keeps the rendered box inside the lane it was
     actually computed for. */
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  background: var(--emp-bg);
  border-left: 3px solid var(--emp-border);
  color: var(--emp-ink);
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  font-size: 0.72rem;
  line-height: 1.25;
  box-sizing: border-box;
}
.cal-event:hover, .cal-event:focus-visible { filter: brightness(0.96); text-decoration: none; }
.cal-event-time { font-weight: 700; }
.cal-event-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event-employee {
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.85;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event-continues-before { border-top: 2px dotted var(--emp-border); }
.cal-event-continues-after { border-bottom: 2px dotted var(--emp-border); }
.cal-event-dst { box-shadow: inset 0 0 0 1px var(--color-warning-ink); }
.cal-event-dst-note {
  font-size: 0.62rem;
  font-style: italic;
  color: var(--color-warning-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile day-agenda fallback: hidden by default (desktop/tablet show the
   time grid); swapped in under 480px where the grid still scrolls but an
   agenda list is the primary, fully usable surface. */
.cal-agenda { display: none; }
.cal-agenda-day { margin-bottom: var(--space-md); }
.cal-agenda-day h3 { font-size: 0.95rem; margin: 0 0 var(--space-xs); }
.cal-agenda-day.is-today h3 { color: var(--color-primary-ink); }
.cal-agenda-item {
  display: flex;
  gap: var(--space-sm);
  background: var(--emp-bg);
  border-left: 3px solid var(--emp-border);
  color: var(--emp-ink);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  margin-bottom: var(--space-xs);
  font-size: 0.9rem;
}
.cal-agenda-item:hover, .cal-agenda-item:focus-visible { text-decoration: none; filter: brightness(0.96); }
.cal-agenda-time { font-weight: 700; white-space: nowrap; }
.cal-agenda-continuation { font-weight: 400; font-style: italic; }
.cal-agenda-employee { display: block; font-size: 0.8rem; font-weight: 600; opacity: 0.85; }
.cal-agenda-dst-note {
  display: block;
  font-size: 0.72rem;
  font-style: italic;
  color: var(--color-warning-ink);
}
.cal-agenda-empty { font-size: 0.85rem; color: #94a3b8; }

/* ----- Month ----- */
/* Wrapper enables horizontal scroll on narrow screens (same pattern as
   .cal-week-scroll) so 7 columns never get crushed below a usable width
   - the inner grid gets a min-width, the wrapper scrolls instead of the
   whole page overflowing. */
.cal-month-scroll { overflow-x: auto; }
.cal-month { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); overflow: hidden; min-width: 640px; }
.cal-month-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-muted-text);
  border-bottom: 1px solid var(--color-border);
}
.cal-month-weekday-row span { padding: var(--space-xs) var(--space-sm); }
.cal-month-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-month-cell {
  min-height: 110px;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-month-week .cal-month-cell:last-child { border-right: none; }
.cal-month-cell.is-outside { background: var(--color-background); color: #94a3b8; }
.cal-month-cell.is-outside .cal-month-daynum { color: #94a3b8; }
.cal-month-cell.is-today { background: #f8fbff; box-shadow: inset 0 0 0 2px var(--color-primary); }
.cal-month-daynum { font-weight: 700; font-size: 0.85rem; }
.cal-month-pills { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; max-height: 110px; }
.cal-pill {
  display: block;
  background: var(--emp-bg);
  border-left: 3px solid var(--emp-border);
  color: var(--emp-ink);
  border-radius: var(--radius-sm);
  padding: 1px 4px;
  font-size: 0.72rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-pill:hover, .cal-pill:focus-visible { text-decoration: none; filter: brightness(0.96); }
.cal-pill-time { font-weight: 700; }
.cal-pill-employee { font-weight: 600; opacity: 0.85; }

/* ----- Year: 12 mini months ----- */
.cal-year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
}
.cal-year-month {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
}
.cal-year-month-title {
  display: block;
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-xs);
  text-transform: capitalize;
}
.cal-mini-weekday-row, .cal-mini-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}
.cal-mini-weekday-row span {
  text-align: center;
  font-size: 0.65rem;
  color: var(--color-muted-text);
}
.cal-mini-day {
  text-align: center;
  font-size: 0.72rem;
  padding: 3px 0;
  border-radius: var(--radius-sm);
  color: var(--color-foreground);
}
.cal-mini-day:hover, .cal-mini-day:focus-visible { background: var(--color-muted); text-decoration: none; }
.cal-mini-day.is-outside { color: #cbd5e1; }
.cal-mini-day.is-today { background: var(--color-primary); color: var(--color-on-primary); font-weight: 700; }
.cal-mini-day.has-jobs:not(.is-today) { box-shadow: inset 0 -2px 0 var(--color-accent); }

/* ---------- Attendance clock ---------- */
.clock-card { display: flex; flex-direction: column; gap: var(--space-md); align-items: flex-start; }
.clock-status-value { font-size: 1.4rem; font-weight: 700; }
.clock-actions { display: flex; gap: var(--space-sm); flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .dashboard-columns { grid-template-columns: 1fr; }
  .main-content { padding: var(--space-lg); }
}

@media (max-width: 900px) {
  .topbar { display: flex; }
  .app-body { position: relative; }
  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: min(280px, 82vw);
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    z-index: 20;
    box-shadow: var(--shadow-lg);
  }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .app-shell.nav-open .nav-scrim { display: block; }
  .cal-year-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

@media (max-width: 480px) {
  .main-content { padding: var(--space-md); }
  .form-card { padding: var(--space-lg); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 1.3rem; }

  /* Below 480px the 7-column time grid still works (horizontal scroll
     inside .cal-week-scroll), but a single stacked day-agenda is the
     more usable primary surface - show it instead of the grid. */
  .cal-week-scroll { display: none; }
  .cal-agenda { display: block; }
  /* The agenda is the PRIMARY surface here, not just a scroll fallback -
     its flex-row layout (time + title + employee + DST note) overflows
     a 375px card once any of those is long. Stack vertically and allow
     long unbroken text to break instead of pushing the card wider. */
  .cal-agenda-item { flex-direction: column; align-items: flex-start; gap: 2px; }
  .cal-agenda-time { white-space: normal; }
  .cal-agenda-title, .cal-agenda-employee { overflow-wrap: break-word; word-break: break-word; }
  .calendar-toolbar { flex-direction: column; align-items: stretch; }
  /* Back/today/forward + the date-range label can exceed 375px as a
     single row (two icon buttons + "Heute" + a wide range label) -
     wrap onto a second line instead of forcing horizontal overflow. */
  .calendar-nav { justify-content: space-between; flex-wrap: wrap; row-gap: var(--space-xs); }
  .calendar-range { min-width: 0; flex-basis: 100%; text-align: center; }
  .calendar-view-toggle { justify-content: stretch; }
  .calendar-view-toggle .btn-secondary { flex: 1; justify-content: center; }
  .cal-month-cell { min-height: 72px; }
  .cal-month-pills { max-height: 72px; }
  .cal-year-grid { grid-template-columns: 1fr; }
}
