/* NSA Scheduler — professional operational UI (aligned with Rig Check Admin) */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --navy-700: #334155;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-muted: #dbeafe;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-subtle: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-hover: #b91c1c;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --info: #0284c7;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --header-h: 48px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --transition: 0.15s ease;

  /* Legacy aliases used in JS inline styles / modals */
  --primary: var(--navy-900);
  --primary-light: var(--navy-800);
  --accent-dark: var(--accent-hover);
  --bg-main: var(--surface-muted);
  --bg-secondary: var(--surface-subtle);
  --bg-card: var(--surface);
  --text-primary: var(--text);
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-muted);
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  left: 0;
  right: 0;
  overscroll-behavior: none;
}

html.modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

/* ── App header ── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy-900);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  height: var(--header-h);
}

.app-header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--space-5);
  height: 100%;
  display: flex;
  align-items: center;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

.brand-org {
  color: #fff;
}

.brand-sep {
  color: rgba(255, 255, 255, 0.35);
  font-weight: 400;
}

.brand-page {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

/* ── Main layout ── */

.app-main {
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-5) var(--space-6);
}

/* ── Buttons ── */

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  padding: 0.4375rem 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  font-family: inherit;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface-subtle);
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.btn-icon {
  min-width: 2rem;
  padding: 0.4375rem;
  font-size: 1.125rem;
  line-height: 1;
}

/* Legacy button classes (modals / dynamic HTML) */
.control-btn,
.save-btn {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

.control-btn {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.control-btn:hover {
  background: var(--surface-subtle);
}

.save-btn:hover {
  background: var(--accent-hover);
}

.delete-btn {
  background: var(--danger);
  color: #fff;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

.delete-btn:hover {
  background: var(--danger-hover);
}

.close-btn {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

.close-btn:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.submit-week {
  width: 100%;
  margin-top: var(--space-4);
  padding: 0.625rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.submit-week:hover {
  background: var(--accent-hover);
}

/* ── Calendar toolbar ── */

.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-2);
}

.toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}

.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.nav-buttons {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.toolbar-period {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0 var(--space-2);
  min-width: 8rem;
}

.view-toggle {
  display: inline-flex;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}

.view-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.view-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
}

.view-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.view-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ── More menu ── */

.more-menu-wrap {
  position: relative;
}

.more-menu-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-1);
  z-index: 200;
}

.more-menu-dropdown[hidden] {
  display: none;
}

.more-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.5rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
}

.more-menu-item:hover,
.more-menu-item:focus-visible {
  background: var(--surface-subtle);
  outline: none;
}

.more-menu-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-1) 0;
}

/* ── Shift legend ── */

.shift-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-2) 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.shift-legend-label {
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: var(--space-1);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-swatch--6a6p { background: #1E90FF; }
.legend-swatch--7a7p { background: #32CD32; }
.legend-swatch--12p { background: #FFD700; }
.legend-swatch--7p7a { background: #FF4500; }
.legend-swatch--standby { background: #7c3aed; }
.legend-swatch--custom { background: #1e293b; }

/* ── Unit status strip ── */

.unit-status-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-2);
}

.unit-status-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-right: var(--space-1);
}

.unit-status-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.25rem 0.625rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: border-color var(--transition), background var(--transition);
}

.unit-status-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
}

.unit-status-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.unit-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.unit-status-btn.out-of-service .unit-dot {
  background: var(--danger);
}

.unit-status-btn.out-of-service {
  border-color: #fecaca;
  background: var(--danger-bg);
  color: var(--danger);
}

/* ── Unassigned banner ── */

.unassigned-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  background: var(--warning-bg);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--warning);
  cursor: pointer;
  transition: background var(--transition);
}

.unassigned-banner:hover {
  background: #fef3c7;
}

.unassigned-text {
  font-weight: 500;
}

.unassigned-action {
  font-weight: 600;
  color: var(--warning);
  white-space: nowrap;
}

/* ── Selection bar ── */

.selection-bar {
  display: none;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  background: var(--accent-muted);
  border: 1px solid #93c5fd;
  border-radius: var(--radius);
  font-size: 0.8125rem;
}

.selection-bar.is-visible {
  display: flex;
}

.selection-bar-label {
  flex: 1;
  color: var(--accent-hover);
  font-weight: 500;
  min-width: 12rem;
}

/* ── Calendar container ── */

.calendar-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  margin-bottom: 0;
}

.weekdays div {
  background: var(--surface-subtle);
  padding: var(--space-2) var(--space-1);
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  min-height: 480px;
}

.day {
  background: var(--surface);
  min-height: 110px;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  transition: background var(--transition);
}

.day:hover {
  background: var(--surface-muted);
}

.day.empty {
  background: var(--surface-subtle);
  cursor: default;
  opacity: 0.5;
}

.day.empty:hover {
  background: var(--surface-subtle);
}

.day .date {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
  line-height: 1.2;
}

.day.today {
  background: #f0fdf4;
}

.day.today .date {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.375rem;
  background: var(--success);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 700;
}

.day.drag-over {
  background: var(--success-bg);
  outline: 2px solid var(--success);
  outline-offset: -2px;
}

.day-view-single {
  min-height: 400px;
  border: none;
  grid-column: 1 / -1;
}

/* Multi-copy mode */
body.multi-copy-mode {
  cursor: crosshair;
}

body.multi-copy-mode .day:not(.empty) {
  cursor: pointer;
}

body.multi-copy-mode .day:not(.empty):hover {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.day.multi-copy-selected {
  background: var(--accent-muted) !important;
  outline: 2px solid var(--accent) !important;
  outline-offset: -2px;
}

.day.multi-copy-selected::after {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--surface);
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 1px solid var(--accent);
  pointer-events: none;
}

/* ── Event cards ── */

.event {
  color: #fff;
  font-size: 0.6875rem;
  padding: 0.375rem 0.5rem;
  margin-top: 0.25rem;
  border-radius: var(--radius);
  line-height: 1.35;
  cursor: grab;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #1e293b;
  position: relative;
  box-shadow: none;
}

.event:active {
  cursor: grabbing;
}

.event:hover {
  filter: brightness(1.05);
}

.event-time {
  font-size: 0.625rem;
  opacity: 0.92;
  margin-bottom: 1px;
}

.event-unit {
  font-weight: 600;
  font-size: 0.6875rem;
}

.event-crews {
  font-size: 0.625rem;
  opacity: 0.95;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-info {
  font-size: 0.625rem;
  opacity: 0.85;
  margin-top: 2px;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-title {
  font-weight: 600;
  font-size: 0.6875rem;
  margin-bottom: 2px;
}

.standby-event {
  background: #7c3aed !important;
  border-color: rgba(124, 58, 237, 0.3);
}

.event[data-shift="6a-6p"] { background: #1E90FF; }
.event[data-shift="7a-7p"] { background: #32CD32; }
.event[data-shift="12p-11:59p"] {
  background: #FFD700;
  color: #1e293b;
}
.event[data-shift="12p-11:59p"] .event-title,
.event[data-shift="12p-11:59p"] .event-time,
.event[data-shift="12p-11:59p"] .event-unit,
.event[data-shift="12p-11:59p"] .event-crews {
  color: #1e293b;
}
.event[data-shift="7p-7a"] { background: #FF4500; }

/* Selection mode */
.event-checkbox {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  cursor: pointer;
  z-index: 10;
  accent-color: var(--accent);
}

.day-select-all {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  cursor: pointer;
  z-index: 5;
  accent-color: var(--success);
}

.event.selectable {
  padding-right: 1.25rem;
}

body.selection-mode .event {
  cursor: pointer;
}

/* ── Multi-copy bar ── */

.multi-copy-bar {
  position: fixed;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-900);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 10000;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  max-width: calc(100% - 2rem);
}

.multi-copy-bar-text {
  font-weight: 500;
  font-size: 0.875rem;
}

.multi-copy-bar-count {
  background: rgba(255, 255, 255, 0.12);
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.8125rem;
}

.multi-copy-bar .copy-selected-btn {
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.4375rem 0.875rem;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.multi-copy-bar .cancel-multi-copy-btn {
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  padding: 0.4375rem 0.875rem;
  font: inherit;
  cursor: pointer;
}

/* ── Loading ── */

#loadingOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 99999;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Toasts ── */

.toast {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-md);
  z-index: 100001;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  max-width: 360px;
  font-size: 0.8125rem;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info { border-left-color: var(--info); }

/* ── Modals ── */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-5);
  overflow-y: auto;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 2.5rem);
  display: flex;
  flex-direction: column;
  margin: auto;
}

.modal-content.modal-wide {
  max-width: 900px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
}

.modal-header .close {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 var(--space-1);
  border-radius: var(--radius);
}

.modal-header .close:hover {
  color: var(--text);
  background: var(--surface-subtle);
}

.modal-body {
  padding: var(--space-4) var(--space-5);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Forms */
.modal label,
.form-section label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin: var(--space-3) 0 var(--space-1);
}

.modal label:first-child,
.form-section label:first-child {
  margin-top: 0;
}

.modal input[type="text"],
.modal input[type="date"],
.modal input[type="datetime-local"],
.modal input[type="time"],
.modal select,
.modal textarea {
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface);
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  outline: 2px solid var(--accent-muted);
  border-color: var(--accent);
}

.modal textarea {
  min-height: 4rem;
  resize: vertical;
}

.form-section {
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.form-section h3,
.form-section h4 {
  margin: 0 0 var(--space-3);
  font-size: 0.9375rem;
  font-weight: 600;
}

/* Tables in modals */
#employeesTable,
#crewAssignmentsTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  margin-bottom: var(--space-4);
}

#employeesTable th,
#employeesTable td,
#crewAssignmentsTable th,
#crewAssignmentsTable td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
}

#employeesTable th,
#crewAssignmentsTable th {
  background: var(--surface-subtle);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

/* Event wizard */
.event-wizard-step {
  padding: var(--space-1) 0;
}

.wizard-intro {
  margin: 0 0 var(--space-4);
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.wizard-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.wizard-option-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition), background var(--transition);
}

.wizard-option-btn:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.wizard-option-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
}

.wizard-option-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.wizard-option-icon {
  display: none;
}

.wizard-hint {
  padding: var(--space-3);
  background: var(--accent-muted);
  border: 1px solid #93c5fd;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--accent-hover);
  margin-bottom: var(--space-4);
}

.wizard-shift-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.wizard-shift-btn {
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  text-align: left;
  transition: border-color var(--transition), background var(--transition);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wizard-shift-btn span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.wizard-shift-btn:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.wizard-back-btn {
  margin-top: var(--space-2);
}

/* Split shift */
.split-shift-section {
  margin-top: var(--space-4);
}

.split-shift-toggle-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--surface-subtle);
}

.split-shift-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  cursor: pointer;
}

.split-shift-toggle-desc {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 24px;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.split-assign-panel {
  margin-bottom: var(--space-4);
}

.split-assign-row {
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.split-assign-name {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.split-assign-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.split-assign-choice {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  cursor: pointer;
  background: var(--surface);
}

.split-assign-choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-muted);
  font-weight: 500;
}

.split-assign-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.split-assign-empty {
  padding: var(--space-3);
  background: var(--surface-subtle);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Weekly schedule */
.week-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
  margin-bottom: var(--space-4);
}

.week-controls label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: 0.8125rem;
  font-weight: 500;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
}

.week-day-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--surface-subtle);
}

.week-day-card .week-date {
  font-weight: 600;
  margin-bottom: var(--space-2);
  font-size: 0.875rem;
}

/* Unassigned modal cards */
.unassigned-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--surface-subtle);
}

.unassigned-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  font-size: 0.875rem;
}

.unassigned-controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: var(--space-2);
  align-items: end;
}

/* Tips modal */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-3);
}

.tip-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--surface-subtle);
}

.tip-card h3 {
  margin: 0 0 var(--space-2);
  font-size: 0.875rem;
  font-weight: 600;
}

.tip-card ul {
  margin: 0;
  padding-left: 1.125rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.tip-card li {
  margin-bottom: var(--space-1);
}

.tip-card li strong {
  color: var(--text);
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.table-input,
.table-select {
  width: 100%;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.8125rem;
}

.action-cell {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* CSV preview (dynamic modal uses same modal classes) */
.csv-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.csv-preview-table th,
.csv-preview-table td {
  padding: var(--space-2);
  border: 1px solid var(--border);
  text-align: left;
}

/* Hidden utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.visually-hidden-date-picker {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ── Responsive ── */

@media (max-width: 1024px) {
  .app-main {
    padding: var(--space-3) var(--space-4) var(--space-5);
  }

  .calendar {
    min-height: 420px;
  }
}

@media (max-width: 768px) {
  .calendar-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left,
  .toolbar-right {
    justify-content: space-between;
  }

  .toolbar-period {
    font-size: 0.9375rem;
    min-width: auto;
  }

  .calendar-container {
    overflow-x: auto;
  }

  .weekdays,
  .calendar {
    min-width: 640px;
  }

  .day {
    min-height: 90px;
  }

  .wizard-options {
    grid-template-columns: 1fr;
  }

  .wizard-shift-grid {
    grid-template-columns: 1fr;
  }

  .unassigned-controls {
    grid-template-columns: 1fr;
  }

  .split-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    max-width: 100%;
  }

  .unit-status-strip {
    gap: var(--space-2);
  }
}

@media (max-width: 480px) {
  .app-header-inner {
    padding: 0 var(--space-3);
  }

  .app-main {
    padding: var(--space-2) var(--space-3) var(--space-4);
  }

  .toolbar-right {
    width: 100%;
  }

  .toolbar-right .btn-primary {
    flex: 1;
  }

  .weekdays,
  .calendar {
    min-width: 560px;
  }
}
