/* ============================================================
   MERON ADMIN — v5  Light, mobile-first, system font
   ============================================================ */
:root {
  --c-bg:        #f0f3f9;
  --c-surface:   #ffffff;
  --c-surface2:  #f7f9fc;
  --c-surface3:  #eef1f8;
  --c-border:    #e4e9f4;
  --c-border2:   #d0d8ec;

  --c-text:      #0f1623;
  --c-text2:     #5a6480;
  --c-text3:     #9ba3bc;

  --c-blue:      #2563eb;
  --c-blue-dim:  #eff4ff;
  --c-blue-glow: rgba(37,99,235,0.18);

  --c-green:       #0d9e6a;
  --c-green-dim:   #edfaf4;
  --c-green-border:#b6e8d5;
  --c-green-text:  #0a7a52;

  --c-amber:       #c97c10;
  --c-amber-dim:   #fff8ec;
  --c-amber-border:#f5d9a0;

  --c-red:         #dc2626;
  --c-red-dim:     #fff1f2;
  --c-red-border:  #fecdd3;

  --c-purple:      #7c3aed;
  --c-purple-dim:  #f4f0ff;
  --c-purple-border:#ddd6fe;

  --c-weekend-bg:  #e2e8f0;   /* neutral weekend tint for Sat/Sun */
  --c-weekend-bd:  #64748b;

  --shadow-xs: 0 1px 2px rgba(15,22,40,0.05);
  --shadow-sm: 0 1px 4px rgba(15,22,40,0.06), 0 4px 12px rgba(15,22,40,0.05);
  --shadow:    0 2px 12px rgba(15,22,40,0.08);
  --shadow-lg: 0 4px 24px rgba(15,22,40,0.1), 0 16px 48px rgba(15,22,40,0.07);

  --r-xs: 6px;
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 18px;
  --r-xl: 22px;

  --t: 0.15s ease;
  --nav-h: 0px;
  --nav-safe-bottom: 0px;
  --visual-viewport-bottom: 0px;
}

@media (max-width: 900px) {
  :root {
    --nav-h: 62px;
    --nav-safe-bottom: env(safe-area-inset-bottom, 0px);
  }
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--c-bg);
  color: var(--c-text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: var(--nav-h);
}

button, input, select, textarea { font: inherit; color: inherit; }

/* ── APP SHELL ───────────────────────────────────────────── */
.app { max-width: 1560px; margin: 0 auto; padding: 14px; }

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.12), transparent 35%),
    linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  box-shadow: 0 24px 80px rgba(10,18,40,0.14);
  padding: 28px;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--c-blue-dim);
  color: var(--c-blue);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
}

.auth-title { font-size: 28px; line-height: 1.1; margin-bottom: 10px; }
.auth-copy,
.auth-help { color: var(--c-text2); }
.auth-copy { margin-bottom: 18px; }
.auth-help { font-size: 12px; margin-top: 14px; }
.auth-form { display: grid; gap: 12px; }
.auth-input { font-size: 16px; }
.auth-password-field { position: relative; }
.auth-password-field .auth-input { width: 100%; padding-right: 48px; }
.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--c-text2);
  cursor: pointer;
}
.auth-password-toggle:hover { background: var(--c-blue-dim); color: var(--c-blue); }
.auth-password-toggle:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 1px; }
.auth-password-toggle svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-password-toggle .auth-eye-hide { display: none; }
.auth-password-toggle[aria-pressed="true"] .auth-eye-show { display: none; }
.auth-password-toggle[aria-pressed="true"] .auth-eye-hide { display: block; }
.auth-submit { justify-content: center; }
.auth-alert {
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}
.auth-alert-danger {
  background: var(--c-red-dim);
  border: 1px solid var(--c-red-border);
  color: var(--c-red);
}
.auth-alert-success {
  background: var(--c-green-dim);
  border: 1px solid var(--c-green-border);
  color: var(--c-green);
}
.auth-reset { margin-top: 14px; color: var(--c-text2); font-size: 14px; }
.auth-reset summary { cursor: pointer; color: var(--c-blue); font-weight: 700; }
.auth-reset-form { margin-top: 12px; }
.auth-help-inline { margin-top: -4px; }

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  background: linear-gradient(135deg, #0f1f5c 0%, #1a4fd6 55%, #2a7fff 100%);
  border-radius: var(--r-xl);
  padding: 18px 22px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.topbar-account-actions { display:flex; align-items:center; gap:8px; }
.topbar-account-actions .topbar-logout { margin:0; }
.topbar::before {
  content: '';
  position: absolute; top: -60px; right: -60px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 65%);
  pointer-events: none;
}
.topbar h1 { font-size: 19px; font-weight: 700; color: #fff; letter-spacing: -0.3px; margin-bottom: 2px; position: relative; }
.topbar p  { font-size: 12px; color: rgba(255,255,255,0.65); margin-bottom: 14px; position: relative; }
.top-meta  { display: flex; flex-wrap: wrap; gap: 6px; position: relative; }
.pill { padding: 4px 11px; border-radius: 999px; background: rgba(255,255,255,0.13); border: 1px solid rgba(255,255,255,0.18); font-size: 11px; font-weight: 500; color: rgba(255,255,255,0.9); white-space: nowrap; }
.topbar-logout { margin: 0; }
.topbar-invoice-btn,
.topbar-logout-btn {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.25);
  color: #fff;
}
.topbar-invoice-btn:hover,
.topbar-logout-btn:hover {
  background: rgba(255,255,255,0.24);
  color: #fff;
}

/* ── TABS — desktop ─────────────────────────────────────── */
.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px; padding: 4px;
  margin: 0 0 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  position: static;
}
.tab-btn {
  border: none; background: transparent; color: var(--c-text2);
  border-radius: var(--r-lg); padding: 9px 6px; min-height: 40px;
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; transition: background var(--t), color var(--t);
  -webkit-tap-highlight-color: transparent;
}
.tab-btn:hover { background: var(--c-surface2); color: var(--c-text); }
.tab-btn.active { background: var(--c-blue); color: #fff; box-shadow: 0 2px 10px var(--c-blue-glow); }
.tab-icon { font-size: 16px; flex-shrink: 0; line-height: 1; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── PANELS ──────────────────────────────────────────────── */
.panel { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; min-width: 0; }
.panel-inner { padding: 16px; }

/* ── TYPOGRAPHY ──────────────────────────────────────────── */
.section-title    { font-size: 15px; font-weight: 700; color: var(--c-text); letter-spacing: -0.2px; margin-bottom: 2px; }
.section-subtitle { font-size: 12px; color: var(--c-text2); margin-bottom: 14px; }
.location-highlight {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin: 0 4px;
  border-radius: 999px;
  background: var(--c-blue-dim);
  border: 1px solid #c7d9fd;
  color: var(--c-blue);
  font-weight: 700;
  line-height: 1.2;
}

/* ── GRIDS ───────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 270px minmax(0,1fr); gap: 12px; align-items: start; }
.grid-2 > * { min-width: 0; }
.grid-2-equal { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#rotaMainGrid { grid-template-columns: minmax(0,1fr) 270px; }
.rota-grid-panel { order: 1; grid-column: 1; }
.rota-tasks-card { order: 2; grid-column: 2; grid-row: 1 / span 2; }
.rota-stats-panel .stats-row { margin-bottom: 0; }

.rota-grid-panel .table-wrap {
  position: relative;
  max-height: min(70vh, 760px);
  overflow-y: auto;
}

/* ── FORMS ───────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row { margin-bottom: 10px; }
.check-row {
  display: flex; align-items: center; gap: 10px;
  min-height: 41px; padding: 9px 12px;
  border: 1.5px solid var(--c-border); border-radius: var(--r-sm);
  background: var(--c-surface); box-shadow: var(--shadow-xs);
  color: var(--c-text); font-size: 14px; cursor: pointer;
}
.check-row input { width: 18px; height: 18px; flex: 0 0 auto; }
.label { display: block; margin-bottom: 5px; font-size: 11px; font-weight: 600; color: var(--c-text2); text-transform: uppercase; letter-spacing: 0.06em; }
.input, .select, .textarea {
  width: 100%; border: 1.5px solid var(--c-border); border-radius: var(--r-sm);
  padding: 9px 12px; background: var(--c-surface); outline: none;
  font-size: 14px; color: var(--c-text);
  transition: border-color var(--t), box-shadow var(--t);
  -webkit-appearance: none; box-shadow: var(--shadow-xs);
}
.textarea { min-height: 80px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--c-border2); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--c-blue); box-shadow: 0 0 0 3px var(--c-blue-dim); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  border: none; border-radius: var(--r-sm); padding: 9px 16px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all var(--t);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.is-loading { opacity: 1; }
.btn-spinner {
  display: none;
}
.btn-primary   { background: var(--c-blue); color: #fff; box-shadow: 0 2px 8px var(--c-blue-glow); }
.btn-primary:hover { background: #1d55d4; }
.btn-secondary { background: var(--c-blue-dim); color: var(--c-blue); border: 1.5px solid #c7d9fd; }
.btn-secondary:hover { background: #e4ecff; }
.btn-success   { background: var(--c-green-dim); color: var(--c-green-text); border: 1.5px solid var(--c-green-border); }
.btn-success:hover { background: #d8f5ec; }
.btn-danger    { background: var(--c-red-dim); color: var(--c-red); border: 1.5px solid var(--c-red-border); }
.btn-danger:hover { background: #ffe4e6; }
.btn-ghost     { background: var(--c-surface2); color: var(--c-text2); border: 1.5px solid var(--c-border); }
.btn-ghost:hover { background: var(--c-surface3); color: var(--c-text); }

/* ── LIST ITEMS ──────────────────────────────────────────── */
.list { display: grid; gap: 6px; }
.list-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border: 1.5px solid var(--c-border); border-radius: var(--r-sm);
  background: var(--c-surface); padding: 10px 12px;
  transition: border-color var(--t);
}
.list-item:hover { border-color: var(--c-border2); }
.item-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.item-sub   { color: var(--c-text2); font-size: 11px; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex-shrink: 0; }
.draft-team-main { flex: 1 1 auto; min-width: 0; }
.draft-team-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  padding: 12px 12px 11px;
}
.draft-team-actions { margin-left: auto; flex-wrap: nowrap; }
.draft-team-item .item-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
  font-size: 14px;
  line-height: 1.15;
}
.draft-team-item .item-title .item-sub,
.draft-team-item .draft-team-role {
  display: block !important;
  margin-left: 0 !important;
  font-size: 10px;
  font-weight: 600 !important;
  color: var(--c-text3);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.draft-team-item > .draft-team-main > .item-sub:last-child {
  font-size: 11px;
  line-height: 1.45;
  color: var(--c-text2);
  display: none;
}
.draft-team-item > .draft-team-main > .item-sub span {
  font-size: 15px;
  color: var(--c-text);
}
.draft-team-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.draft-team-actions .badge {
  min-width: 68px;
  justify-content: center;
  text-align: center;
}
.draft-team-actions .edit-hours-btn {
  min-width: 56px;
  padding: 6px 10px !important;
  font-size: 12px !important;
}

/* ── BADGES ──────────────────────────────────────────────── */
.badge { font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; letter-spacing: 0.03em; text-transform: uppercase; }
.badge-ok   { background: var(--c-green-dim);  color: var(--c-green-text); border: 1px solid var(--c-green-border); }
.badge-danger { background: var(--c-red-dim); color: var(--c-red); border: 1px solid var(--c-red-border); }
.badge-low  { background: var(--c-amber-dim);  color: var(--c-amber);      border: 1px solid var(--c-amber-border); }
.badge-off  { background: var(--c-surface3);   color: var(--c-text3);      border: 1px solid var(--c-border); }
.badge-info { background: var(--c-blue-dim);   color: var(--c-blue);       border: 1px solid #c7d9fd; }

/* ── STAT CARDS ──────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 14px; }
.stat-card { background: var(--c-surface); border: 1.5px solid var(--c-border); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow-xs); }
.stat-label { font-size: 10px; font-weight: 600; color: var(--c-text3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.stat-value { font-size: 20px; font-weight: 700; line-height: 1.1; color: var(--c-text); }
.stat-sub   { margin-top: 4px; font-size: 10px; color: var(--c-text3); }

/* ── TABLE / ROTA GRID ───────────────────────────────────── */
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: visible; padding: 0 16px 16px; -webkit-overflow-scrolling: touch; }
table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0 5px; }
#rotaTable { table-layout: fixed; }
.draft-grid-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.draft-grid-heading .section-subtitle { margin-bottom: 0; }
.draft-grid-add-btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 13px;
  white-space: nowrap;
}

#rotaTable th:first-child,
#rotaTable td.employee-cell { width: 144px; min-width: 144px; max-width: 144px; }

#rotaTable th:not(:first-child),
#rotaTable td.day-cell { width: 92px; min-width: 92px; max-width: 92px; }

#rotaTable thead th {
  position: sticky; top: 0; background: var(--c-surface); z-index: 2;
  text-align: center; font-size: 10px; font-weight: 600; color: var(--c-text3);
  padding: 8px 4px; border-bottom: 1px solid var(--c-border);
  letter-spacing: 0.05em; text-transform: uppercase;
}

#rotaTable th:not(:first-child) div:first-child {
  font-size: 11px;
  line-height: 1.15;
  font-weight: 700;
}

#rotaTable th:not(:first-child) div:last-child {
  font-size: 9px;
  line-height: 1.1;
}

/* Weekend column header highlight */
#rotaTable thead th.col-weekend {
  background: linear-gradient(180deg, #64748b 0%, #475569 100%);
  color: #ffffff;
  border-left: 0;
  border-right: 0;
  box-shadow: inset 0 -2px 0 rgba(15, 23, 42, 0.35);
  overflow: visible;
}

#rotaTable thead th.col-weekend::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 5px;
  background: #cbd5e1;
  pointer-events: none;
}

#rotaTable thead th.col-weekend + th.col-weekend,
#rotaTable thead th.col-weekend-start {
  border-left: 1px solid #334155;
}

#rotaTable thead th.col-weekend-end {
  border-right: 1px solid #334155;
}

#rotaTable thead th.col-weekend div:first-child,
#rotaTable thead th.col-weekend div:last-child {
  color: #ffffff;
  font-weight: 700;
}

#rotaTable thead th.previous-month-context {
  background: #f8fafc;
  color: #64748b;
}

#rotaTable thead th.previous-month-context-end,
#rotaTable td.previous-month-context-end {
  border-right: 2px solid #475569;
}

th:first-child, td:first-child { position: sticky; left: 0; background: var(--c-surface); z-index: 6; }
#rotaTable thead th:first-child { z-index: 8; }

#rotaTable th.draft-week-total-heading {
  min-width: 106px;
  width: 106px;
  max-width: 106px;
  background: #eef4ff;
  color: #244b78;
  border-left: 2px solid #ceddf1;
  text-align: center;
}
#rotaTable th.draft-week-total-heading span,
#rotaTable th.draft-week-total-heading small {
  display: block;
  font-size: 10px;
  line-height: 1.5;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
}
#rotaTable td.draft-week-total-cell {
  min-width: 106px;
  width: 106px;
  max-width: 106px;
  background: #f5f8fd;
  border-left: 2px solid #ceddf1;
  text-align: center;
}
#rotaTable td.draft-week-coverage-spacer {
  background: #f8fbff;
}
.draft-week-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 100%;
  padding: 8px 5px;
  color: #244b78;
}
.draft-week-total-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.draft-week-total strong { font-size: 15px; line-height: 1.1; white-space: nowrap; }
.draft-week-total span { font-size: 10px; line-height: 1.15; color: #62758c; }
.draft-week-total-holiday {
  color: var(--c-purple);
  background: var(--c-purple-dim);
  border: 1px solid var(--c-purple-border);
  border-radius: var(--r-xs);
  padding: 3px 5px;
}
.draft-week-total-holiday span { color: #9a6bdb; }
.draft-week-total-empty {
  color: #9aa7bd;
  font-size: 13px;
  line-height: 1;
}

.employee-cell {
  position: sticky;
  padding: 8px 10px; border-radius: var(--r-sm); border: 1.5px solid var(--c-border);
  font-weight: 600; font-size: 12px; background: var(--c-surface2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-shadow: var(--shadow-xs);
  z-index: 7;
}
.employee-cell-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 28px;
}

.previous-month-only-employee {
  background: #f8fafc;
  color: #64748b;
}

.previous-month-only-badge {
  display: block;
  margin-top: 4px;
  color: #94a3b8;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.employee-cell-edit {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 1px solid var(--c-border);
  border-radius: 7px;
  background: var(--c-surface);
  color: var(--c-blue);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}
.employee-cell-edit:hover { background: var(--c-blue-dim); border-color: var(--c-blue); }
.employee-cell-edit:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 1px; }
.employee-cell-edit svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.employee-modal-hours-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, .75fr);
  align-items: end;
  gap: 12px;
}
.employee-modal-hours-row .form-row { margin: 0; }
.employee-modal-balance {
  display: grid;
  gap: 8px;
  padding: 0;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  background: transparent;
  border: 0;
}
.employee-modal-balance .label { margin: 0; }
.employee-modal-balance-chip {
  width: auto;
  min-width: 104px;
  min-height: 40px;
  justify-self: start;
  padding: 8px 16px;
  font-size: 15px;
  text-align: center;
  justify-content: center;
}
#employeeModal .employee-modal-footer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 16px 22px 20px;
}
#employeeModal .employee-modal-secondary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}
#employeeModal .employee-modal-secondary-actions .employee-modal-email-btn { min-width: 190px; }
#employeeModal .employee-modal-secondary-actions #cancelEmployeeModalBtn { min-width: 110px; }
#employeeModal .employee-modal-footer .btn {
  min-height: 46px;
  justify-content: center;
  border-radius: 10px;
  font-weight: 700;
}
#employeeModal .employee-modal-footer svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#employeeModal .employee-modal-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
#employeeModal .employee-modal-header-row .modal-subtitle { margin-bottom: 0; }
#employeeModal .employee-modal-email-btn {
  background: var(--c-blue-dim);
  border-color: #bfd3ff;
}
#employeeModal .employee-modal-save-btn {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
  box-shadow: 0 8px 20px rgba(26, 79, 214, .22);
}
#employeeModal .employee-modal-remove-btn {
  flex: 0 0 auto;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--c-red-border);
  border-radius: 8px;
  background: var(--c-red-dim);
  color: var(--c-red);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
#employeeModal .employee-modal-remove-btn:hover {
  background: #fee2e2;
}
#employeeModal .employee-modal-remove-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (max-width: 520px) {
  #employeeModal .employee-modal-secondary-actions {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr);
    width: 100%;
  }
  #employeeModal .employee-modal-secondary-actions .employee-modal-email-btn,
  #employeeModal .employee-modal-secondary-actions #cancelEmployeeModalBtn {
    min-width: 0;
    width: 100%;
  }
}

/* Weekend day cell background */
.day-weekend {
  position: relative;
  z-index: 0;
  isolation: isolate;
  background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%) !important;
  border-left: 0;
  border-right: 0;
  box-shadow: inset 0 0 0 9999px rgba(15, 23, 42, 0.035);
}

.day-weekend::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -5px;
  bottom: -5px;
  background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
  pointer-events: none;
  z-index: 0;
}

.day-weekend + .day-weekend,
.day-weekend-start {
  border-left: 1px solid #64748b;
}

.day-weekend-end {
  border-right: 1px solid #64748b;
}

.day-weekend .shift-card,
.day-weekend .coverage-box {
  position: relative;
  z-index: 1;
  box-shadow: none;
}

.day-weekend .shift-card {
  border-color: #94a3b8;
}

.day-weekend .status-work {
  background: linear-gradient(180deg, #dcfce7 0%, #dbe4ee 100%);
}

.day-weekend .status-off {
  background: linear-gradient(180deg, #f1f5f9 0%, #cbd5e1 100%);
}

.day-weekend .status-availability {
  background: linear-gradient(180deg, #dbeafe 0%, #dbe4ee 100%);
}

.day-weekend .status-holiday {
  background: linear-gradient(180deg, #f3e8ff 0%, #dbe4ee 100%);
}

.day-weekend .status-sick {
  background: linear-gradient(180deg, #fee2e2 0%, #dbe4ee 100%);
}

.day-cell { padding: 3px; height: 68px; }

.day-cell.previous-month-context {
  background: #f8fafc;
}

.shift-card {
  width: 100%; height: 60px; min-height: 60px; max-height: 60px;
  overflow: hidden; border: 1.5px solid var(--c-border); border-radius: var(--r-sm);
  cursor: pointer; padding: 5px 4px; font-weight: 600;
  background: var(--c-surface2); text-align: center; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  -webkit-tap-highlight-color: transparent; transition: transform var(--t);
}
.shift-other-location-corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-top: 12px solid #f59e0b;
  border-left: 12px solid transparent;
  opacity: 0.95;
}
.shift-card:active { transform: scale(0.93); }

.previous-month-shift {
  opacity: 0.72;
  cursor: default;
  filter: grayscale(0.15);
}

.previous-month-only-placeholder {
  opacity: 0.5;
  cursor: default;
  border-style: dashed;
}

.previous-month-only-placeholder .shift-card-line {
  color: #94a3b8;
  font-size: 9px;
}

.shift-card small,
.shift-card-line { display: block; width: 100%; font-size: 10px; font-weight: 500; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--c-text2); }
.shift-card-status { display: block; width: 100%; font-size: 11px; font-weight: 700; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shift-probation-name { font-weight: 800; color: var(--c-text); text-transform: none; }

.shift-card-request .shift-card-status { font-size: 9px; }
.shift-card-request .shift-card-line   { font-size: 9px; }

.shift-actual-time {
  display: block;
  width: 100%;
  font-size: 10px !important;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--c-text2);
}

/* Shift themes */
.status-work         { background: var(--c-green-dim);   border-color: var(--c-green-border);  color: var(--c-green-text); }
.status-work .shift-card-line, .status-work .shift-card-status { color: var(--c-green-text); }
.status-work .shift-actual-time { color: var(--c-green-text) !important; }

.status-availability { background: var(--c-blue-dim);    border-color: #c7d9fd; color: var(--c-blue); }
.status-availability .shift-card-line { color: #4a80d4; }

.status-off          { background: var(--c-surface3);    border-color: var(--c-border); color: var(--c-text3); }
.status-holiday      { background: var(--c-purple-dim);  border-color: var(--c-purple-border); color: var(--c-purple); }
.status-holiday .shift-card-line { color: #9a6bdb; }
.status-sick         { background: var(--c-red-dim);     border-color: var(--c-red-border); color: var(--c-red); }
.status-sick .shift-card-line { color: #c84a4a; }

/* ── COVERAGE ROW ────────────────────────────────────────── */
.coverage-label-cell {
  padding: 2px 10px;
  background: var(--c-surface);
  text-align: center;
}

.coverage-row td {
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: var(--c-surface);
  box-shadow: none;
  padding-top: 2px;
  padding-bottom: 2px;
}

.coverage-row td.day-weekend {
  background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%) !important;
}

.coverage-row .previous-month-coverage {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
}

.coverage-row td:first-child {
  left: 0;
  z-index: 9;
}

.coverage-label-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  height: 18px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--c-border);
  background: var(--c-surface2);
  box-shadow: var(--shadow-xs);
  color: var(--c-text3);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}

/* Coverage box — same physical size as a shift card */
.coverage-box {
  width: 60px;
  min-width: 60px;
  max-width: none;
  height: 18px;
  min-height: 18px;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1px solid;
  font-weight: 700; font-size: 10px; line-height: 1;
  padding: 0 7px;
}
.coverage-ok  { background: #effcf6; border-color: #bdebd9; color: #18a06a; }
.coverage-low { background: #fff1f2; border-color: #fecdd3; color: #dc2626; }

/* ── MISC TABLE ──────────────────────────────────────────── */
.coverage-box { font-size: 10px; }

/* ── SETTINGS ────────────────────────────────────────────── */
.settings-group { border: 1.5px solid var(--c-border); border-radius: var(--r); padding: 14px; background: var(--c-surface2); }
.settings-group h3 { margin-bottom: 12px; font-size: 13px; font-weight: 600; }
.notification-log-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.notification-log-head h3 { margin-bottom:3px; }
.notification-log-summary { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:10px; }
.notification-log-list { display:grid; gap:7px; max-height:260px; overflow:auto; }
.notification-log-row { display:flex; justify-content:space-between; gap:12px; padding:10px 11px; border:1px solid var(--c-border); border-radius:10px; background:var(--c-surface); }
.notification-types-list { display:grid; gap:7px; margin-top:10px; }
.notification-type-row { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; padding:10px 11px; border:1px solid var(--c-border); border-radius:10px; background:var(--c-surface); }
.notification-type-row.is-disabled { opacity:.72; }
.notification-log-main { min-width:0; }
.notification-log-result { display:flex; flex-direction:column; align-items:flex-end; gap:4px; flex:0 0 auto; }
.notification-log-error { margin-top:5px; color:var(--c-danger); font-size:11px; overflow-wrap:anywhere; }
.admin-settings-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.admin-settings-grid #dashboardUsersGroup { grid-column:1 / -1; }
.admin-settings-grid #notificationTypesGroup { grid-column:1 / -1; }
.admin-settings-grid #notificationLogGroup { grid-column:1 / -1; }
@media (max-width: 640px) {
  .notification-log-head { align-items:flex-start; }
  .notification-log-row, .notification-type-row { align-items:flex-start; }
  .notification-log-row .item-title { font-size:12px; }
  .admin-settings-grid { grid-template-columns:1fr; }
  .admin-settings-grid #dashboardUsersGroup,
  .admin-settings-grid #notificationTypesGroup,
  .admin-settings-grid #notificationLogGroup { grid-column:auto; }
}

/* ── SEARCH ROW ──────────────────────────────────────────── */
.search-row { display: grid; grid-template-columns: 1.3fr 0.8fr auto; gap: 10px; margin-bottom: 12px; align-items: end; }

/* ── EMPLOYEE TOOLBAR ────────────────────────────────────── */
.employee-toolbar { display: grid; gap: 10px; margin-bottom: 12px; }
.employee-toolbar-main { display: grid; grid-template-columns: minmax(200px,1fr) auto; gap: 10px; align-items: center; }
.employee-toolbar-filters { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.employee-filter-group { display: flex; gap: 8px; flex-wrap: wrap; }
.employee-filter-group .select { min-width: 120px; }
.employee-master-summary { color: var(--c-text3); font-size: 12px; }
#employeeMasterTab > .panel + .panel,
.employee-section-card + .employee-section-card { margin-top: 12px; }
#holidayApprovalPanel {
  border-color: #d7e2f6;
  box-shadow: var(--shadow);
}
.holiday-approval-calendar {
  border: 1px solid var(--c-border);
  border-radius: 16px;
  background: var(--c-surface2);
  padding: 14px;
  margin: 0 0 14px;
}
.holiday-approval-calendar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.holiday-approval-calendar-title {
  font-weight: 800;
  color: var(--c-text);
}
.holiday-approval-calendar-hint {
  max-width: 360px;
  margin-top: 3px;
  color: var(--c-text2);
  font-size: 12px;
  line-height: 1.35;
}
.holiday-approval-calendar-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--c-text2);
  font-size: 11px;
  font-weight: 700;
}
.holiday-approval-calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}
.legend-dot.is-pending {
  background: #f59e0b;
}
.legend-dot.is-approved {
  background: #10b981;
}
.legend-dot.is-rejected {
  background: #94a3b8;
}
.holiday-approval-calendar-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--c-text);
  font-weight: 800;
  white-space: nowrap;
}
.holiday-approval-calendar-nav-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: var(--shadow-xs);
}
.holiday-approval-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.holiday-approval-calendar-dow {
  margin-bottom: 8px;
  color: var(--c-text2);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.holiday-approval-calendar-day {
  position: relative;
  min-height: 54px;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-surface);
  color: var(--c-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.holiday-approval-calendar-day.is-empty {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.holiday-approval-calendar-day.is-today {
  border-color: var(--c-blue);
}
.holiday-approval-calendar-day.is-occupied {
  background: #e5e7eb;
  border-color: #d1d5db;
  color: #6b7280;
}
.holiday-approval-calendar-day.is-occupied.has-pending {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}
.holiday-approval-calendar-day.is-occupied.has-availability {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}
.holiday-approval-calendar-day.is-occupied.has-approved {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}
.holiday-approval-calendar-day.is-occupied.has-pending.has-approved {
  background: linear-gradient(135deg, #fff7ed 0%, #fff7ed 50%, #ecfdf5 50%, #ecfdf5 100%);
  border-color: #fbbf24;
  color: #475569;
}
.holiday-approval-calendar-day.is-occupied.has-rejected {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #64748b;
}
.holiday-approval-calendar-day.is-selected-request {
  background: #9a3412;
  border-color: #7c2d12;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(154, 52, 18, .22), var(--shadow-xs);
}
.holiday-approval-calendar-day.is-selected-request.has-pending,
.holiday-approval-calendar-day.is-selected-request.has-approved,
.holiday-approval-calendar-day.is-selected-request.has-pending.has-approved {
  background: #9a3412;
  border-color: #7c2d12;
  color: #fff;
}
.holiday-approval-calendar-day.is-selected-request.has-availability {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .22), var(--shadow-xs);
}
.holiday-approval-calendar-day small {
  width: 100%;
  padding: 0 4px;
  color: inherit;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.holiday-approval-calendar-day .calendar-status-name {
  position: absolute;
  width: calc(50% - 4px);
  padding: 0 2px;
  font-size: 9px;
  line-height: 1.05;
  -webkit-line-clamp: 2;
}
.holiday-approval-calendar-day .calendar-status-name.is-pending-name {
  left: 4px;
  bottom: 6px;
  color: #9a3412;
}
.holiday-approval-calendar-day .calendar-status-name.is-approved-name {
  right: 4px;
  bottom: 6px;
  color: #047857;
}
.holiday-approval-calendar-day.is-selected-request .calendar-status-name {
  color: #fff;
}
.availability-request-cards {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: -4px 0 12px;
}
.availability-request-card {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 150px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: var(--c-blue-dim);
  color: var(--c-blue);
  padding: 6px 10px;
  box-shadow: var(--shadow-xs);
  text-align: left;
}
.availability-request-card.is-selected {
  border-color: #1d4ed8;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .22), var(--shadow-xs);
}
.availability-request-names {
  min-width: 0;
  max-width: 100%;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.availability-request-count {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #bfdbfe;
  color: #2563eb;
  font-size: 11px;
  font-weight: 900;
}
.availability-request-card.is-selected .availability-request-count {
  background: #fff;
  color: #1d4ed8;
}
.availability-request-unit {
  display: none;
}
.pending-request-cards {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: -4px 0 12px;
}
.pending-request-card {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 150px;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  padding: 6px 10px;
  box-shadow: var(--shadow-xs);
  text-align: left;
}
.pending-request-card.is-selected {
  border-color: #7c2d12;
  background: #9a3412;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(154, 52, 18, .22), var(--shadow-xs);
}
.pending-request-card.is-selected .pending-request-count {
  background: #fff;
  color: #7c2d12;
}
.pending-request-names {
  min-width: 0;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pending-request-date {
  color: currentColor;
  font-size: 10px;
  font-weight: 750;
  opacity: .78;
  white-space: nowrap;
}
.pending-request-count {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fed7aa;
  color: #9a3412;
  font-size: 11px;
  font-weight: 900;
}
.pending-request-unit {
  max-width: 100%;
  color: var(--c-text2);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.holiday-request-day-modal {
  max-width: 620px;
}
.employee-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.employee-page-info { min-width: 90px; text-align: center; font-size: 12px; color: var(--c-text2); }
#rotaTab,
#employeeMasterTab { position: relative; }
.tab-loading-overlay {
  display: none !important;
}
.tab-loading-card {
  width: min(100%, 360px);
  padding: 22px 20px;
  border-radius: 20px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(203, 213, 225, 0.95);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
  text-align: center;
}
.tab-loading-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  border-radius: 999px;
  border: 4px solid #dbeafe;
  border-top-color: #2563eb;
  animation: tab-loading-spin 0.8s linear infinite;
}
.tab-loading-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text);
}
.tab-loading-subtitle {
  margin-top: 6px;
  font-size: 12px;
  color: var(--c-text2);
}
@keyframes tab-loading-spin {
  to { transform: rotate(360deg); }
}

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-box { border: 1.5px dashed var(--c-border2); border-radius: var(--r); padding: 24px; text-align: center; color: var(--c-text3); font-size: 13px; background: var(--c-surface2); }

/* ── MODALS ──────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,18,40,0.45); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 500; }
.modal-backdrop.show { display: flex; }
.modal { width: 100%; max-width: 680px; max-height: calc(100vh - 32px); background: var(--c-surface); border: 1.5px solid var(--c-border); border-radius: var(--r-xl); box-shadow: 0 24px 80px rgba(10,18,40,0.25); overflow: hidden; display: flex; flex-direction: column; }
.modal-header { padding: 18px 20px 12px; border-bottom: 1px solid var(--c-border); flex: 0 0 auto; background: var(--c-surface2); }
.modal-title  { font-size: 18px; font-weight: 700; }
.modal-subtitle { margin: 3px 0 0; color: var(--c-text2); font-size: 12px; }
.shift-overlap-box {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid #fcd34d;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  line-height: 1.45;
}
.shift-overlap-box strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: #7c2d12;
}
.shift-overlap-line + .shift-overlap-line {
  margin-top: 4px;
}
.publish-recipient-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}
.publish-recipient-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  max-height: 360px;
  overflow: auto;
}
.publish-recipient-list.is-disabled {
  opacity: 0.55;
}
.publish-email-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  margin-bottom: 12px;
  cursor: pointer;
}
.publish-email-toggle input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: 0 0 auto;
}
.publish-email-toggle span {
  display: grid;
  gap: 3px;
}
.publish-email-toggle small {
  color: var(--c-text3);
  line-height: 1.35;
}
.publish-recipient-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface2);
}
.publish-recipient-item.is-disabled {
  opacity: 0.58;
}
.publish-recipient-name {
  font-weight: 700;
  color: var(--c-text);
}
.publish-recipient-email {
  margin-top: 2px;
  font-size: 12px;
  color: var(--c-text2);
  overflow-wrap: anywhere;
}
.modal-body   { padding: 16px 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-footer { display: flex; justify-content: space-between; gap: 10px; padding: 12px 20px 16px; flex-wrap: wrap; border-top: 1px solid var(--c-border); background: var(--c-surface2); flex: 0 0 auto; }
.modal-footer-right { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-review-modal { max-width: 920px; }
.ai-review-summary {
  padding: 14px 16px;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  background: linear-gradient(135deg, rgba(14,116,144,0.08), rgba(15,118,110,0.05));
  color: var(--c-text);
}
.ai-review-summary strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}
.ai-review-ai-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(15,23,42,0.08);
}
.ai-review-ai-head {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--c-text);
}
.ai-review-ai-copy {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--c-text);
  max-width: 72ch;
}
.ai-review-ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.ai-review-ai-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(8,145,178,0.16);
  background: rgba(255,255,255,0.86);
  font-size: 11px;
  font-weight: 700;
  color: #155e75;
}
.ai-review-sections {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
.ai-review-section {
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--c-surface);
}
.ai-review-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface2);
}
.ai-review-section-title {
  font-size: 14px;
  font-weight: 700;
}
.ai-review-count {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-text2);
}
.ai-review-items {
  display: grid;
  gap: 10px;
  padding: 14px;
}
.ai-review-item {
  padding: 12px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border);
  background: #fff;
}
.ai-review-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
}
.ai-review-item-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--c-text2);
}
.ai-review-item-reason {
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-text);
}
.ai-review-item-critical {
  border-color: rgba(220,38,38,0.22);
  background: #fff7f7;
}
.ai-review-item-warning {
  border-color: rgba(217,119,6,0.22);
  background: #fffaf0;
}
.ai-review-item-suggestion {
  border-color: rgba(8,145,178,0.18);
  background: #f7fcff;
}
.ai-review-item-positive {
  border-color: rgba(22,163,74,0.18);
  background: #f7fff9;
}

/* ── MISC ────────────────────────────────────────────────── */
.hidden { display: none !important; }
.small  { font-size: 12px; color: var(--c-text2); }
.muted  { color: var(--c-text2); font-size: 13px; }

/* ── TOAST ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  top: calc(16px + env(safe-area-inset-top, 0px));
  transform: translate(-50%, -18px) scale(0.98);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.78)),
    rgba(255, 255, 255, 0.82);
  color: #101827;
  padding: 14px 48px 14px 46px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    0 24px 70px rgba(15, 23, 42, 0.18),
    0 8px 22px rgba(37, 99, 235, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  z-index: 10000;
  width: min(460px, calc(100vw - 28px));
  min-height: 58px;
  text-align: left;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  backdrop-filter: blur(22px) saturate(1.28);
  -webkit-backdrop-filter: blur(22px) saturate(1.28);
  transition: opacity 220ms ease, transform 220ms cubic-bezier(.2,.8,.2,1);
}
.toast::before {
  content: "✓";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 22px;
  height: 22px;
  transform: translateY(-50%);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(22, 163, 74, 0.24);
}
.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}
.toast-message {
  width: 100%;
  padding-right: 4px;
}
.toast-close {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.62);
  color: #475569;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  font-weight: 800;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}
.toast-close:hover {
  background: rgba(203, 213, 225, 0.9);
  color: #0f172a;
  transform: scale(1.04);
}

/* ── SHIFT STATES ────────────────────────────────────────── */
.shift-card:disabled { opacity: 1; cursor: default; pointer-events: none; }
.shift-card.is-saving { opacity: 0.7; box-shadow: inset 0 0 0 2px #93c5fd; }
.shift-card-saved { position: absolute; right: 4px; bottom: 3px; padding: 1px 5px; border-radius: 999px; background: #dcfce7; color: #166534; border: 1px solid #86efac; font-size: 9px; font-weight: 800; line-height: 1.2; }
.day-cell-locked { opacity: 0.72; }
.shift-card[data-locked="true"] { opacity: 0.52; filter: grayscale(0.18) saturate(0.68); box-shadow: none; }
.shift-card[data-locked="true"] .shift-card-status,
.shift-card[data-locked="true"] .shift-card-line { opacity: 0.88; }

/* ── ATTENDANCE ──────────────────────────────────────────── */
.attendance-list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.attendance-list-note { font-size: 11px; color: #3b5fa8; padding: 7px 12px; border-radius: var(--r-sm); background: var(--c-blue-dim); border: 1px solid #c7d9fd; }
.attendance-list { display: block; }
.attendance-list-shell { border: 1.5px solid var(--c-border); border-radius: var(--r-lg); overflow: hidden; background: var(--c-surface); box-shadow: var(--shadow-sm); }
.attendance-list-body { display: flex; flex-direction: column; }
.attendance-list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--c-border); transition: background var(--t); }
.attendance-list-row:nth-child(even) { background: var(--c-surface2); }
.attendance-list-row:hover { background: var(--c-blue-dim); }
.attendance-list-row:last-child { border-bottom: 0; }
.attendance-row-main { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.attendance-cell { min-width: 0; }
.attendance-cell-person { display: flex; flex-direction: column; gap: 2px; min-width: 160px; padding-left: 10px; position: relative; }
.attendance-cell-person::before { content: ''; position: absolute; left: 0; top: 3px; bottom: 3px; width: 2px; border-radius: 999px; background: var(--c-blue); }
.attendance-person-name { font-weight: 600; font-size: 13px; }
.attendance-person-meta { color: var(--c-text2); font-size: 11px; }
.attendance-metrics { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap; }
.attendance-metric-chip { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 80px; padding: 7px 10px; border-radius: var(--r-sm); background: var(--c-surface2); border: 1.5px solid var(--c-border); }
.attendance-metric-chip strong { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; color: var(--c-text); }
.attendance-metric-chip-payable { background: var(--c-green-dim); border-color: var(--c-green-border); }
.attendance-metric-chip-payable strong { color: var(--c-green-text); }
.attendance-metric-chip-payable-pending { background: var(--c-red-dim); border-color: var(--c-red-border); }
.attendance-metric-chip-payable-pending strong { color: var(--c-red); }
.attendance-metric-label { color: var(--c-text3); font-size: 9px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.shift-card-attended { border-color: #93c5fd !important; }
.shift-attended-mark { position: absolute; top: 4px; right: 5px; color: var(--c-blue); font-size: 10px; font-weight: 700; }
.attendance-cell-actions { display: flex; justify-content: flex-end; flex: 0 0 auto; }
.attendance-stats-btn { min-width: 110px; white-space: nowrap; border-radius: var(--r-sm); padding: 8px 12px; font-size: 12px; font-weight: 600; background: var(--c-blue-dim); color: var(--c-blue); border: 1.5px solid #c7d9fd; cursor: pointer; transition: all var(--t); -webkit-tap-highlight-color: transparent; }
.attendance-stats-btn:hover { background: #e0ebff; }
.attendance-stats-btn:active { transform: scale(0.96); }
#attendanceDetailModal .modal { max-width: 1240px; }
#attendanceDetailModal .modal-header { position: sticky; top: 0; z-index: 3; }
#attendanceDetailModal .modal-body { position: relative; display: flex; flex-direction: column; overflow: hidden; min-height: 0; padding: 16px; }
#attendanceDetailModal .attendance-detail-filter-row { margin-bottom: 12px; max-width: 280px; }
#attendanceDetailModal .table-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 0; }
#attendanceDetailModal table { min-width: 1180px; table-layout: fixed; }
#attendanceDetailModal .attendance-detail-loading-overlay {
  display: none !important;
}
#attendanceDetailModal .attendance-detail-loading-card {
  width: min(100%, 340px);
  padding: 20px 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.97);
  border: 1px solid rgba(203, 213, 225, 0.95);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
  text-align: center;
}
#attendanceDetailModal .attendance-detail-loading-spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 12px;
  border-radius: 999px;
  border: 4px solid #dbeafe;
  border-top-color: #2563eb;
  animation: tab-loading-spin 0.8s linear infinite;
}
#attendanceDetailModal .attendance-detail-loading-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
}
#attendanceDetailModal .attendance-detail-loading-subtitle {
  margin-top: 6px;
  font-size: 12px;
  color: var(--c-text2);
}
#attendanceDetailModal thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--c-surface2);
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-text3);
}
#attendanceDetailModal tbody td { padding: 12px 10px; vertical-align: top; }
.attendance-detail-row td {
  border-bottom: 1px solid rgba(199, 217, 253, 0.45);
  vertical-align: middle;
}
.attendance-detail-row.is-correction-request td,
.attendance-detail-row.is-pending td {
  background: rgba(254, 242, 242, 0.72);
  border-bottom-color: rgba(248, 113, 113, 0.38);
}
.attendance-detail-row.is-correction-request .attendance-detail-date-badge,
.attendance-detail-row.is-pending .attendance-detail-date-badge {
  background: #fee2e2;
  border-color: #fca5a5;
}
.attendance-detail-row.is-correction-request .attendance-detail-date-main,
.attendance-detail-row.is-correction-request .attendance-detail-date-sub,
.attendance-detail-row.is-pending .attendance-detail-date-main,
.attendance-detail-row.is-pending .attendance-detail-date-sub {
  color: #b91c1c;
}
.attendance-detail-row.is-correction-request .attendance-detail-request-cell .attendance-detail-text,
.attendance-detail-row.is-pending .attendance-detail-request-cell .attendance-detail-text {
  color: #b91c1c;
  font-weight: 650;
}
.attendance-detail-date-cell { width: 126px; }
.attendance-detail-planned-cell { width: 136px; }
.attendance-detail-time-cell { width: 86px; }
.attendance-detail-hours-cell { width: 86px; }
.attendance-detail-request-cell { width: 240px; }
.attendance-detail-reason-cell { width: 180px; }
.attendance-detail-date-badge { display: inline-flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 106px; padding: 8px 10px; border-radius: 14px; background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%); border: 1px solid #bfdbfe; }
.attendance-detail-date-top { display: flex; align-items: center; justify-content: flex-start; gap: 6px; }
.attendance-detail-date-main { font-weight: 650; font-size: 13px; letter-spacing: 0; color: #1d4ed8; }
.attendance-detail-date-sub { font-size: 10px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: #3b82f6; }
.attendance-detail-date-sub.is-weekday { padding: 0; border-radius: 0; background: transparent; border: 0; line-height: 1; }
.attendance-detail-date-meta { display: flex; flex-direction: column; gap: 3px; }
.attendance-detail-time-stack { display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: nowrap; padding: 0; min-height: 38px; }
.attendance-detail-time-separator { font-size: 10px; font-weight: 700; color: var(--c-text3); text-transform: uppercase; letter-spacing: 0.08em; }
.attendance-detail-time-pill,
.attendance-detail-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid #dbe2ea;
  background: #fff;
  color: var(--c-text);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0;
}
.attendance-detail-time-pill.is-empty { color: var(--c-text3); background: var(--c-surface2); }
.attendance-detail-status-pill { min-width: 76px; background: #f8fafc; color: var(--c-text2); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.attendance-detail-hours-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 14px;
  background: #eff6ff;
  border: 1px solid #cfe0ff;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
}
.attendance-detail-hours-pill.is-scheduled { background: #f8fafc; border-color: #e2e8f0; color: #475569; }
.attendance-detail-hours-pill.is-adjustment { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.attendance-detail-hours-pill.is-payable { background: #ecfdf5; border-color: #c7f0d7; color: #166534; }
.attendance-detail-hours-pill.is-payable.is-pending { background: #fef2f2; border-color: #fbd1d1; color: #dc2626; }
.attendance-detail-time-cell,
.attendance-detail-hours-cell,
.attendance-detail-planned-cell {
  text-align: center;
}
.attendance-detail-time-cell > *,
.attendance-detail-hours-cell > *,
.attendance-detail-planned-cell > * {
  margin-left: auto;
  margin-right: auto;
}
.attendance-detail-text {
  max-width: 240px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
  color: var(--c-text);
}
.attendance-detail-text.is-empty { color: var(--c-text3); font-style: italic; }
.attendance-week-total-row td {
  background: var(--c-blue-dim);
  border-top: 1.5px solid #c7d9fd;
  border-bottom: 1.5px solid #c7d9fd;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--c-blue);
}
.attendance-week-total-row strong { font-weight: 500; }
#attendanceAdjustmentModal { z-index: 3000; }
#attendanceDetailModal     { z-index: 2000; }

/* ── LOCATION CARDS ──────────────────────────────────────── */
.location-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 10px; margin-top: 14px; }
.locations-stats { grid-template-columns: 1fr 1fr; }

/* ── TASK CARDS ──────────────────────────────────────────── */
.task-card { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--c-border); border-radius: var(--r-sm); background: var(--c-surface); margin-bottom: 5px; transition: border-color var(--t); }
.task-card:hover { border-color: var(--c-border2); }
.task-card:last-child { margin-bottom: 0; }
.task-card-body { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.task-card-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-card-meta  { font-size: 11px; color: var(--c-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-card-status { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; text-transform: uppercase; letter-spacing: 0.04em; }
.task-status-done   { background: var(--c-green-dim); color: var(--c-green-text); border: 1px solid var(--c-green-border); }
.task-status-open   { background: var(--c-blue-dim);  color: var(--c-blue);       border: 1px solid #c7d9fd; }
.task-status-reopen { background: var(--c-amber-dim); color: var(--c-amber);      border: 1px solid var(--c-amber-border); }
.task-card-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ── SELECTS ─────────────────────────────────────────────── */
#rotaLocationSelect, #rotaMonth, #settingsLocationSelect { font-weight: 600; }
#rotaTab .form-grid, #rotaSettingsTab .form-row { align-items: end; }

/* ── RESPONSIVE: TABLET ──────────────────────────────────── */
@media (max-width: 1200px) { .grid-2 { grid-template-columns: 1fr; } }

@media (max-width: 1100px) {
  .grid-2, .grid-2-equal, .form-grid, .search-row,
  .employee-toolbar-main, .stats-row { grid-template-columns: 1fr; }
  .employee-toolbar-filters { align-items: stretch; }
  .employee-pagination { justify-content: stretch; }
}

@media (max-width: 980px) {
  .tabs { grid-template-columns: 1fr 1fr; gap: 4px; }
  .tab-btn { min-height: 38px; font-size: 11px; }
}

.dashboard-users-list { display: grid; gap: 8px; margin: 12px 0 16px; }
.dashboard-user-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--c-border); border-radius: var(--r-sm); background: var(--c-surface); }
.dashboard-user-main { min-width: 0; }
.dashboard-access-checkbox { display:flex; align-items:flex-start; gap:10px; padding:12px; border:1px solid var(--c-border); border-radius:var(--r-sm); background:var(--c-surface); cursor:pointer; }
.dashboard-access-checkbox input { margin-top:3px; width:18px; height:18px; flex:0 0 auto; }
.dashboard-access-checkbox span { display:grid; gap:3px; }
.dashboard-access-checkbox small { color:var(--c-text3); line-height:1.35; }

/* ══════════════════════════════════════════════════════════
   MOBILE ≤ 640px
   ══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {

  /* Bottom nav */
  .tabs {
    position: fixed; bottom: var(--visual-viewport-bottom); left: 0; right: 0; top: auto;
    min-height: calc(var(--nav-h) + var(--nav-safe-bottom));
    margin: 0; border-radius: 0; border: none;
    border-top: 1px solid var(--c-border);
    box-shadow: 0 -4px 20px rgba(15,22,40,0.1);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(5,1fr);
    gap: 4px; z-index: 200;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(12px);
    transform: translate3d(0,0,0);
    will-change: bottom;
  }
  .tab-btn {
    flex-direction: column; gap: 3px; min-height: 44px;
    padding: 4px 2px; border-radius: var(--r-sm);
    font-size: 9px; font-weight: 600; color: var(--c-text3);
  }
  .tab-btn.active { background: var(--c-blue-dim); color: var(--c-blue); box-shadow: none; }
  .tab-btn.active .tab-icon { transform: scale(1.1); }
  .tab-icon { font-size: 18px; }

  /* App */
  html, body { min-height: 100%; overflow-x: hidden; }
  body { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + var(--nav-safe-bottom) + 16px); }
  .app { width: 100%; max-width: 100%; padding: 8px; overflow-x: hidden; }
  .tab-panel, .panel, .panel-inner, #rotaMainGrid, .rota-grid-panel { min-width: 0; max-width: 100%; }

  /* Topbar */
  .topbar { padding: 12px 14px; border-radius: var(--r-lg); margin-bottom: 8px; }
  .topbar-row { align-items: flex-start; }
  .topbar h1 { font-size: 16px; }
  .topbar p  { font-size: 11px; margin-bottom: 8px; }
  .pill { padding: 3px 9px; font-size: 10px; }
  html.auth-page-root,
  body.auth-page {
    width: 100%;
    height: 100%;
    min-height: 100%;
    padding-bottom: 0;
    overflow: hidden;
    position: fixed;
    inset: 0;
    overscroll-behavior: none;
    touch-action: manipulation;
  }
  .auth-shell {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100svh;
    min-height: 100svh;
    align-items: center;
    padding: max(12px, env(safe-area-inset-top)) 18px max(12px, env(safe-area-inset-bottom));
  }
  .auth-card {
    padding: 20px;
    max-width: 100%;
    max-height: calc(100svh - 28px);
    overflow: hidden;
  }
  .auth-title { font-size: 24px; }
  .auth-input {
    font-size: 16px !important;
    line-height: 1.25;
    min-height: 52px;
  }

  /* Panels */
  .panel { border-radius: var(--r); }
  .panel-inner { padding: 12px; }
  .section-title { font-size: 14px; }
  .section-subtitle { font-size: 11px; margin-bottom: 10px; }
  .location-highlight { padding: 2px 7px; margin: 0 3px; font-size: 10px; }

  /* Layouts — single col */
  .grid-2, .grid-2-equal, .form-grid, .search-row, .employee-toolbar-main { grid-template-columns: 1fr; }

  /* Rota section: shift grid first, draft team below */
  #rotaMainGrid { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
  #rotaMainGrid > * { width: 100%; max-width: 100%; min-width: 0; align-self: stretch; flex: 0 0 auto; }
  .rota-grid-panel { order: 1; }
  .rota-tasks-card { order: 2; }

  /* Stats 2-col */
  .stats-row { grid-template-columns: 1fr 1fr; gap: 6px; }
  .stat-card { padding: 10px 11px; border-radius: var(--r-sm); }
  .stat-value { font-size: 17px; }
  .stat-label { font-size: 9px; }
  .stat-sub   { font-size: 9px; }

  /* Rota action buttons grid */
  .actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  #createDraftBtn { grid-column: 1; }
  #autofillBtn    { grid-column: 2; }
  #aiReviewBtn    { grid-column: 3; }
  #recalcBtn      { grid-column: 1; }
  #clearBtn       { grid-column: 2; }
  #publishBtn     { grid-column: 3; }
  #saveSettingsBtn, #reloadSettingsBtn { flex: 1 1 calc(50% - 3px); }
  .btn { padding: 9px 10px; font-size: 12px; border-radius: var(--r-xs); }

  /* Centered modals */
  .modal-backdrop { align-items: center; justify-content: center; padding: 12px; }
  .modal {
    width: 100%;
    max-width: 680px;
    max-height: calc(100vh - 24px);
    border-radius: var(--r-xl);
    border-bottom: 1.5px solid var(--c-border);
  }
  .modal-header { padding: 14px 16px 10px; }
  .modal-title  { font-size: 16px; }
  .modal-body   { padding: 12px 16px; }
  .modal-footer { padding: 10px 16px 20px; }
  .modal-footer, .modal-footer-right { display: grid; grid-template-columns: 1fr; width: 100%; gap: 6px; }
  #publishConfirmModal .publish-recipient-list {
    max-height: none;
    overflow: visible;
  }

  /* Table */
  .rota-grid-panel .table-wrap {
    max-height: none;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
  }
  .table-wrap { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: visible; padding: 0 8px 10px; }
  #rotaTable { width: max-content; min-width: 100%; table-layout: fixed; }
  #rotaTable th:first-child, #rotaTable td.employee-cell { width: 112px; min-width: 112px; max-width: 112px; }
  #rotaTable th:not(:first-child), #rotaTable td.day-cell { width: 74px; min-width: 74px; max-width: 74px; }
  #rotaTable th.draft-week-total-heading, #rotaTable td.draft-week-total-cell { width: 66px; min-width: 66px; max-width: 66px; }
  .draft-week-total { gap: 3px; padding: 5px 3px; }
  .draft-week-total strong { font-size: 13px; }
  .draft-week-total span { font-size: 9px; }
  .draft-week-total-holiday { padding: 3px 4px; }
  #rotaTable th:not(:first-child) div:first-child { font-size: 9px; line-height: 1.1; }
  #rotaTable th:not(:first-child) div:last-child { font-size: 8px; line-height: 1.1; }
  #rotaTable th.draft-week-total-heading { padding: 7px 3px; }
  #rotaTable th.draft-week-total-heading div:first-child { font-size: 8px; line-height: 1.05; }
  #rotaTable th.draft-week-total-heading span,
  #rotaTable th.draft-week-total-heading small { font-size: 8px; line-height: 1.15; white-space: normal; }
  .day-cell { height: 62px; padding: 3px; }
  .shift-card { height: 54px; min-height: 54px; max-height: 54px; border-radius: var(--r-xs); padding: 4px 3px; gap: 1px; }
  .coverage-box {
    width: 56px;
    min-width: 56px;
    height: 18px;
    min-height: 18px;
    font-size: 10px;
    padding: 0 6px;
  }
  .coverage-label-cell { padding: 3px 8px; }
  .coverage-label-chip {
    width: 100%;
    min-width: 0;
    height: 18px;
    padding: 0 8px;
    font-size: 9px;
  }
  .shift-card-status { font-size: 10px; }
  .shift-card small, .shift-card-line, .shift-actual-time { font-size: 9px !important; }
  .shift-card-request .shift-card-status, .shift-card-request .shift-card-line { font-size: 8px; }

  /* Task cards */
  .task-card { padding: 7px 9px; gap: 6px; }
  .task-card-title { font-size: 12px; }
  .task-card-meta  { font-size: 10px; }

  /* Attendance */
  .attendance-list-row { flex-direction: column; align-items: stretch; padding: 10px 12px; gap: 8px; }
  .attendance-row-main { flex-direction: column; align-items: stretch; gap: 8px; }
  .attendance-cell-person { min-width: 0; }
  .attendance-metrics { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; }
  .attendance-metric-chip { min-width: 0; padding: 6px 8px; }
  .attendance-metric-chip strong { font-size: 13px; }
  .attendance-stats-btn { width: 100%; }
  #attendanceDetailModal .modal {
    width: min(100vw - 12px, 980px);
    max-width: min(100vw - 12px, 980px);
    max-height: calc(100vh - 12px);
  }
  #attendanceDetailModal .modal-body { padding: 8px; }
  #attendanceDetailModal .table-wrap { padding: 0; }
  #attendanceDetailModal table { min-width: 0; width: 100%; table-layout: auto; }
  #attendanceDetailModal thead th {
    font-size: 9px;
    letter-spacing: 0.03em;
    padding: 8px 6px;
  }
  #attendanceDetailModal tbody td { padding: 10px 6px; }
  .attendance-detail-date-cell { width: 92px; }
  .attendance-detail-planned-cell { width: 112px; }
  .attendance-detail-time-cell,
  .attendance-detail-hours-cell { width: 68px; }
  .attendance-detail-request-cell,
  .attendance-detail-reason-cell { display: none; }
  #attendanceDetailModal thead th:nth-child(8),
  #attendanceDetailModal thead th:nth-child(9) { display: none; }
  .attendance-detail-date-badge {
    min-width: 0;
    width: 100%;
    padding: 7px 8px;
    border-radius: 12px;
  }
  .attendance-detail-date-main { font-size: 12px; }
  .attendance-detail-date-sub { font-size: 9px; }
  .attendance-detail-time-stack {
    gap: 4px;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding: 2px 0;
  }
  .attendance-detail-time-separator { font-size: 9px; }
  .attendance-detail-time-pill,
  .attendance-detail-status-pill {
    min-width: 54px;
    min-height: 30px;
    padding: 0 8px;
    border-radius: 10px;
    font-size: 12px;
  }
  .attendance-detail-hours-pill {
    min-width: 58px;
    min-height: 32px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 13px;
  }
  #attendanceDetailModal .sticky-col .btn {
    min-width: 70px;
    padding: 8px 8px;
    font-size: 11px;
  }

  /* List items */
  .list-item { align-items: flex-start; flex-direction: column; }
  .item-actions { width: 100%; }
  .draft-team-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 10px;
  }
  .draft-team-actions {
    width: auto;
    margin-left: auto;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
  }
  .draft-team-actions .badge,
  .draft-team-actions .btn { white-space: nowrap; }

  /* Employee */
  .employee-filter-group { width: 100%; display: grid; grid-template-columns: 1fr; }
  .employee-filter-group .select { width: 100%; min-width: 0; }
  .employee-pagination { display: grid; grid-template-columns: 1fr; }
  .employee-page-info { min-width: 0; }
}

/* prevent iOS input zoom */
input, select, textarea { font-size: 16px; }
.employee-permission-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  margin-top: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
}

.employee-permission-toggle input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.employee-permission-toggle span {
  display: grid;
  gap: 3px;
}
