/* ── Design tokens ───────────────────────────────────────── */
:root {
  --primary:      #2563eb;
  --primary-dark: #1d4ed8;
  --primary-50:   #eff6ff;
  --primary-100:  #dbeafe;
  --ink:          #0f172a;
  --ink-2:        #1e293b;
  --muted:        #64748b;
  --muted-light:  #94a3b8;
  --surface:      #ffffff;
  --bg:           #f8fafc;
  --bg-2:         #f1f5f9;
  --line:         #e2e8f0;
  --sidebar-w:    260px;
  --morning:      #059669;
  --morning-bg:   #d1fae5;
  --morning-dk:   #065f46;
  --afternoon:    #2563eb;
  --afternoon-bg: #dbeafe;
  --afternoon-dk: #1e40af;
  --night:        #7c3aed;
  --night-bg:     #ede9fe;
  --night-dk:     #5b21b6;
  --off:          #dc2626;
  --off-bg:       #fee2e2;
  --off-dk:       #991b1b;
  --shadow-sm:    0 1px 2px rgba(15,23,42,.05);
  --shadow:       0 1px 3px rgba(15,23,42,.08), 0 6px 20px rgba(15,23,42,.06);
  --shadow-md:    0 4px 6px rgba(15,23,42,.07), 0 10px 30px rgba(15,23,42,.09);
  --r-sm:  8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 20px;
  font-family: 'Inter', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
p { margin: 0; }
.hidden { display: none !important; }

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1rem; }
.eyebrow {
  color: var(--primary);
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin: 0 0 .25rem;
}
.muted      { color: var(--muted); line-height: 1.55; }
.fine-print { color: var(--muted-light); font-size: .76rem; line-height: 1.5; margin: 18px 0 0; }

/* ── Cards ───────────────────────────────────────────────── */
.card, .table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: var(--r);
  padding: 10px 18px;
  font-weight: 700;
  font-size: .875rem;
  letter-spacing: -.01em;
  transition: background .14s, transform .1s, box-shadow .14s;
  white-space: nowrap;
}
.btn:active    { transform: translateY(1px); }
.btn-primary   { background: var(--primary); color: white; box-shadow: 0 2px 6px rgba(37,99,235,.3); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 14px rgba(37,99,235,.35); }
.btn-secondary { background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger    { color: white; background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-block     { width: 100%; }
.btn-small     { min-height: 36px; padding: 7px 12px; font-size: .8rem; }
.text-btn {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  font-size: .84rem;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  transition: background .12s;
}
.text-btn:hover { background: var(--primary-50); }
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  color: var(--muted);
  background: var(--surface);
  transition: background .12s, color .12s, border-color .12s;
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }

/* ── Forms ───────────────────────────────────────────────── */
.form-stack { display: grid; gap: 16px; margin-top: 28px; }
label {
  display: grid;
  gap: 6px;
  color: var(--ink-2);
  font-size: .84rem;
  font-weight: 600;
  letter-spacing: -.01em;
}
input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--r);
  outline: none;
  background: white;
  color: var(--ink);
  font-size: 16px; /* must be ≥16px — iOS Safari zooms on anything smaller */
  transition: border-color .15s, box-shadow .15s;
}
input:hover { border-color: #94a3b8; }
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }

/* ═══════════════════════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════════════════════ */
.login-shell {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 90% 50% at 50% -5%, rgba(37,99,235,.1) 0%, transparent 55%),
    var(--bg);
}
.login-card { width: min(100%, 420px); padding: 36px 30px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 24px;
  border-radius: var(--r-lg);
  color: white;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  box-shadow: 0 8px 20px rgba(37,99,235,.35);
}

/* ═══════════════════════════════════════════════════════════
   APP SHELL — sidebar + main-wrap layout
═══════════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  position: sticky;
  top: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 40;
  overflow: hidden;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; }
.sidebar-logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-100);
  color: var(--primary);
  flex-shrink: 0;
}
.sidebar-brand-name {
  display: block;
  font-size: .95rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.02em;
  line-height: 1.2;
}
.sidebar-brand-sub {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  color: var(--muted-light);
  letter-spacing: .01em;
}
.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--bg-2);
  color: var(--muted);
  flex-shrink: 0;
  transition: background .12s;
}
.sidebar-close-btn:hover { background: var(--line); }

.sidebar-body { flex: 1; padding: 16px 10px; overflow-y: auto; }
.sidebar-label {
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-light);
  padding: 0 8px;
  margin: 0 0 8px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--r);
  color: var(--muted);
  background: transparent;
  font-size: .875rem;
  font-weight: 600;
  text-align: left;
  transition: background .12s, color .12s;
}
.sidebar-item:hover { background: var(--bg-2); color: var(--ink-2); }
.sidebar-item.active {
  background: var(--primary-50);
  color: var(--primary);
}
.sidebar-item.active .sidebar-icon { color: var(--primary); }
.sidebar-icon { display: flex; align-items: center; flex-shrink: 0; color: var(--muted-light); }
.sidebar-item:hover .sidebar-icon { color: var(--muted); }

.sidebar-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-100);
  color: var(--primary);
  font-size: .85rem;
  font-weight: 800;
  flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-username {
  display: block;
  font-size: .84rem;
  font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-role {
  display: block;
  font-size: .68rem;
  color: var(--muted-light);
}
.sidebar-logout-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  flex-shrink: 0;
  transition: background .12s, color .12s, border-color .12s;
}
.sidebar-logout-btn:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

/* Mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Main wrap ───────────────────────────────────────────── */
.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 10px 20px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.02em;
}
.hamburger-btn { border: 0; background: transparent; }
.hamburger-btn:hover { background: var(--bg-2); }

/* ── Workspace sub-tabs ──────────────────────────────────── */
.workspace-tabs {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 0 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.workspace-tabs-inner {
  display: flex;
  gap: 2px;
  min-width: max-content;
}
.workspace-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color .12s, border-color .12s;
  margin-bottom: -1px;
}
.workspace-tab:hover { color: var(--ink-2); }
.workspace-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

/* ── Content ─────────────────────────────────────────────── */
.content {
  flex: 1;
  padding: 24px 20px 40px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}
.view        { display: none; }
.view.active { display: block; animation: viewIn .22s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(5px); } }

/* ── Dashboard stats ─────────────────────────────────────── */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 20px 0 0;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
}
.stat-card-btn {
  width: 100%;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s, transform .12s;
  position: relative;
}
.stat-card-btn:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card-btn:active { transform: translateY(0); }
.stat-card-arrow {
  margin-left: auto;
  color: var(--muted-light);
  font-size: 1.1rem;
  transition: color .15s, transform .15s;
}
.stat-card-btn:hover .stat-card-arrow { color: var(--primary); transform: translateX(3px); }
.stat-card-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
}
.stat-icon-blue   { background: var(--primary-100); color: var(--primary); }
.stat-icon-green  { background: #d1fae5; color: #059669; }
.stat-icon-purple { background: #ede9fe; color: #7c3aed; }
.stat-card-label  { font-size: .75rem; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.stat-card-value  { font-size: 1.4rem; font-weight: 800; color: var(--ink); letter-spacing: -.03em; }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 26px;
  background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
  overflow: hidden;
}
.hero-body h2 { font-size: 1.3rem; margin: 6px 0 8px; }
.hero-icon    { flex-shrink: 0; opacity: .95; }

/* ── Section title ───────────────────────────────────────── */
.section-title  { margin: 28px 0 14px; font-size: 1rem; font-weight: 700; }
.view-heading   { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.section-row    { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.roster-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shift-setting  { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ── Action grid ─────────────────────────────────────────── */
.action-grid { display: grid; gap: 10px; }
.action-card {
  display: grid;
  grid-template-columns: 46px 1fr;
  grid-template-rows: auto auto;
  column-gap: 13px;
  text-align: left;
  padding: 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  color: var(--ink);
  background: white;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.action-card:hover  { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.action-card:active { transform: translateY(0); }
.action-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: var(--primary);
  background: var(--primary-100);
}
.action-card strong { align-self: end; font-size: .9rem; }
.action-card small  { color: var(--muted); margin-top: 3px; font-size: .78rem; }

/* ── Form sections ───────────────────────────────────────── */
.form-section        { padding: 20px; margin-bottom: 12px; }
.form-section > h3   { margin-bottom: 18px; }
.form-grid           { display: grid; gap: 14px; }
.employee-inputs     { display: grid; gap: 8px; margin-top: 16px; }
.employee-row        { display: grid; grid-template-columns: 28px 1fr 38px; gap: 8px; align-items: center; }
.employee-number     { color: var(--muted-light); font-weight: 700; text-align: center; font-size: .8rem; }
.remove-employee {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--off);
  background: var(--off-bg);
  font-size: 1.1rem;
  font-weight: 700;
  transition: background .12s;
}
.remove-employee:hover { background: #fecaca; }
.generate-btn { min-height: 52px; margin: 8px 0 20px; font-size: .95rem; }

/* ── Notices ─────────────────────────────────────────────── */
.notice {
  padding: 14px 16px;
  margin: 10px 0;
  border-radius: var(--r);
  border: 1px solid #fde68a;
  color: #78350f;
  background: #fffbeb;
  line-height: 1.5;
  font-size: .875rem;
}
.notice.success { border-color: #86efac; color: #14532d; background: #f0fdf4; }
.notice.error   { border-color: #fca5a5; color: #7f1d1d; background: #fff1f2; }

/* ── Roster toolbar ──────────────────────────────────────── */
.roster-toolbar { align-items: flex-start; padding: 16px; margin-bottom: 12px; }
.roster-toolbar > div:first-child { display: grid; gap: 3px; }
.roster-toolbar strong { font-size: .95rem; }
.roster-toolbar small  { color: var(--muted); font-size: .78rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* ── Legend & tags ───────────────────────────────────────── */
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}
.shift-M   { color: var(--morning-dk);   background: var(--morning-bg); }
.shift-A   { color: var(--afternoon-dk); background: var(--afternoon-bg); }
.shift-N   { color: var(--night-dk);     background: var(--night-bg); }
.shift-OFF { color: var(--off-dk);       background: var(--off-bg); }

/* ── Calendar ────────────────────────────────────────────── */
.week-block  { margin: 16px 0 22px; }
.week-title  { margin: 0 2px 10px; font-size: .88rem; font-weight: 700; color: var(--muted); }
.calendar-grid { display: grid; gap: 8px; }
.day-card {
  overflow: hidden;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s;
}
.day-card:hover { box-shadow: var(--shadow); }
.day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 13px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink-2);
}
.day-head span:last-child { color: var(--muted); font-weight: 500; }
.day-shifts  { padding: 8px 12px 12px; }
.shift-line  { display: grid; grid-template-columns: 22px 1fr; gap: 7px; align-items: start; padding: 4px 0; font-size: .8rem; }
.shift-code  { font-weight: 900; font-size: .72rem; }
.shift-code.M   { color: var(--morning); }
.shift-code.A   { color: var(--afternoon); }
.shift-code.N   { color: var(--night); }
.shift-code.OFF { color: var(--off); }
.shift-names    { line-height: 1.4; color: #475569; }

/* ── Empty states ────────────────────────────────────────── */
.empty-state { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty-state span { display: block; margin-bottom: 14px; }
.empty-state h3   { color: var(--ink); margin-bottom: 6px; font-size: 1.1rem; }
.empty-state p    { font-size: .875rem; }

/* ── Employee table ──────────────────────────────────────── */
.table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: separate; border-spacing: 0; min-width: 850px; width: 100%; font-size: .75rem; }
th, td { padding: 9px 8px; text-align: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; background: var(--bg); color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
th:first-child, td:first-child { position: sticky; left: 0; z-index: 2; min-width: 130px; text-align: left; background: white; font-weight: 700; color: var(--ink-2); }
th:first-child { z-index: 3; background: var(--bg); }
td .tag { min-width: 36px; text-align: center; }

/* ── Summary ─────────────────────────────────────────────── */
.summary-grid { display: grid; gap: 10px; }
.summary-card { padding: 18px; }
.summary-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.status-dot.warn { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.15); }
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.stat { text-align: center; padding: 8px 3px; border-radius: var(--r-sm); background: var(--bg); }
.stat strong { display: block; font-size: 1.05rem; font-weight: 800; }
.stat small  { color: var(--muted); font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.warnings { margin: 12px 0 0; padding-left: 18px; color: #92400e; font-size: .78rem; line-height: 1.5; }

/* ── Saved rosters ───────────────────────────────────────── */
.saved-list   { display: grid; gap: 10px; }
.saved-card   { display: grid; gap: 12px; padding: 18px; }
.saved-meta   { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: .78rem; margin-top: 4px; }
.saved-actions { display: flex; gap: 8px; }

/* ── Shift settings ──────────────────────────────────────── */
.shift-setting { margin: 16px 0; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.shift-setting:last-of-type { border: 0; margin-bottom: 4px; }
.shift-setting .shift-fields { flex: 1; display: grid; gap: 8px; }
.time-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.danger-zone { margin-top: 16px; }

.delete-shift-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted-light);
  transition: background .12s, color .12s, border-color .12s;
}
.delete-shift-btn:hover:not(:disabled) { background: var(--off-bg); color: var(--off); border-color: #fca5a5; }
.delete-shift-btn:disabled { opacity: .3; cursor: not-allowed; }

.add-shift-row {
  padding: 16px 0 4px;
  margin-top: 12px;
  border-top: 2px dashed var(--line);
}
.add-shift-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.add-shift-fields {
  display: grid;
  grid-template-columns: 70px 1fr 1fr 1fr;
  gap: 8px;
}
@media (max-width: 600px) {
  .add-shift-fields { grid-template-columns: 1fr 1fr; }
}

/* ── User list ───────────────────────────────────────────── */
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.user-row:last-child { border-bottom: 0; }
.user-avatar-sm {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-100);
  color: var(--primary);
  font-size: .85rem;
  font-weight: 800;
  flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.user-name  { font-size: .88rem; font-weight: 700; color: var(--ink-2); }
.user-since { font-size: .75rem; color: var(--muted-light); }
.you-badge  {
  display: inline-block;
  background: var(--primary-100);
  color: var(--primary);
  font-size: .62rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  letter-spacing: .04em;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 4px;
}

/* ── Auth switch & link button ───────────────────────────── */
.auth-switch {
  margin: 16px 0 0;
  text-align: center;
  font-size: .82rem;
  color: var(--muted);
}
.link-btn {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0 2px;
}
.link-btn:hover { color: var(--primary-dark); }

/* ── Loading spinner ─────────────────────────────────────── */
.loading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  color: var(--muted);
  font-size: .875rem;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 14px);
  width: min(calc(100% - 28px), 400px);
  padding: 13px 18px;
  border-radius: var(--r);
  color: white;
  background: #1e293b;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  text-align: center;
  font-size: .875rem;
  font-weight: 500;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (min-width: 640px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .action-grid, .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .calendar-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .action-grid   { grid-template-columns: repeat(3, 1fr); }
  .summary-grid  { grid-template-columns: repeat(3, 1fr); }
  .calendar-grid { grid-template-columns: repeat(7, 1fr); gap: 6px; }
  .day-head   { display: grid; gap: 2px; padding: 9px 10px; font-size: .75rem; }
  .day-shifts { padding: 6px 9px 10px; }
  .shift-line { grid-template-columns: 18px 1fr; font-size: .7rem; }
  /* Hamburger hidden on desktop — sidebar always visible */
  .hamburger-btn { display: none; }
}

/* ── Mobile (< 900px) ────────────────────────────────────── */
@media (max-width: 899px) {

  /* Sidebar becomes a fixed drawer sliding in from the left */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(var(--sidebar-w), 80vw);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-110%);
    box-shadow: none;
    z-index: 50;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-md);
  }
  .sidebar-overlay { display: block; }
  .sidebar-close-btn { display: flex; }

  /* Main wrap takes full width since sidebar is out of flow */
  .main-wrap {
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    min-height: 100svh;
  }

  /* Comfortable padding on mobile */
  .content { padding: 16px 14px 48px; }
  .workspace-tabs { padding: 0 14px; }
  .topbar { padding-left: 14px; padding-right: 14px; }

  /* Stack roster toolbar buttons on mobile */
  .roster-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .button-row { justify-content: flex-start; }

  /* Larger tap targets for small screens */
  .sidebar-item { min-height: 48px; }
  .workspace-tab { padding: 13px 12px; }
  .btn-small { min-height: 40px; }

  /* Hide hero illustration on small screens to save space */
  .hero-icon { display: none; }

  /* Single column stat cards on narrow screens */
  .dashboard-stats { grid-template-columns: 1fr; }

  /* Summary stat grid: fewer columns */
  .stat-grid { grid-template-columns: repeat(3, 1fr); }

  /* Section row: allow wrapping */
  .section-row { flex-wrap: wrap; }

  /* Login card: tighter padding */
  .login-card { padding: 28px 20px; }
}

/* ═══════════════════════════════════════════════════════════
   PRINT
═══════════════════════════════════════════════════════════ */
@media print {
  body { background: white; }
  .sidebar, .sidebar-overlay, .topbar, .workspace-tabs,
  .roster-toolbar .button-row, .legend, #toast { display: none !important; }
  .app-shell { display: block; }
  .main-wrap { display: block; }
  .content { padding: 0; max-width: 100%; }
  .view { display: none !important; }
  #calendar-view, #calendar-content { display: block !important; }
  .roster-toolbar { box-shadow: none; border: 0; padding: 0 0 12px; }
  .calendar-grid  { grid-template-columns: repeat(7, 1fr); gap: 3px; }
  .day-card   { box-shadow: none; border-radius: 4px; }
  .day-head   { display: grid; padding: 5px; font-size: 8px; }
  .day-shifts { padding: 4px; }
  .shift-line { grid-template-columns: 12px 1fr; gap: 2px; padding: 2px 0; font-size: 6.5px; }
  .week-block { break-inside: avoid; margin: 6px 0 12px; }
}
