/* ══════════════════════════════════════════════════
   MiTurno365 — Design System & Global Styles
   Colors derived from Logo: Navy, Teal, Green
   ══════════════════════════════════════════════════ */

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

/* ── Design Tokens ── */
:root {
  /* Primary colors from logo */
  --navy-900: #0a2540;
  --navy-800: #0d3b66;
  --navy-700: #0d4a8b;
  --navy-600: #1565c0;
  --navy-500: #1976d2;
  --navy-400: #42a5f5;
  --navy-300: #90caf9;
  --navy-200: #bbdefb;
  --navy-100: #e3f2fd;

  --teal-700: #00838f;
  --teal-600: #0097a7;
  --teal-500: #00b4d8;
  --teal-400: #26c6da;
  --teal-300: #4dd0e1;
  --teal-200: #80deea;
  --teal-100: #e0f7fa;

  --green-700: #2e7d32;
  --green-600: #388e3c;
  --green-500: #43a047;
  --green-400: #66bb6a;
  --green-300: #81c784;
  --green-200: #a5d6a7;
  --green-100: #e8f5e9;

  /* Neutrals */
  --gray-900: #111827;
  --gray-800: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;
  --white: #ffffff;

  /* Semantic */
  --primary: var(--navy-700);
  --primary-light: var(--navy-500);
  --primary-dark: var(--navy-900);
  --accent: var(--teal-500);
  --accent-light: var(--teal-300);
  --success: var(--green-500);
  --success-light: var(--green-300);
  --warning: #f59e0b;
  --warning-light: #fcd34d;
  --danger: #ef4444;
  --danger-light: #fca5a5;

  /* Surfaces */
  --bg-body: #f0f4f8;
  --bg-card: var(--white);
  --bg-sidebar: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 50%, #0b3d6e 100%);
  --bg-header: var(--white);

  /* Text */
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted: var(--gray-400);
  --text-on-dark: var(--white);
  --text-on-primary: var(--white);

  /* Borders & Shadows */
  --border-color: var(--gray-200);
  --border-radius-sm: 8px;
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --border-radius-xl: 24px;
  --border-radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
  --shadow-glow: 0 0 20px rgba(0,180,216,0.15);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 250ms ease;
  --transition-slow: 400ms ease;

  /* Spacing */
  --sidebar-width: 260px;
  --header-height: 64px;
  --mobile-nav-height: 64px;
}

/* ── Reset & Base ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-on-dark);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo img {
  height: 40px;
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.sidebar-logo h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-logo h1 span {
  color: var(--green-400);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.sidebar-nav a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  transform: scaleY(0);
  transition: transform var(--transition-fast);
}

.sidebar-nav a:hover {
  color: var(--white);
  background: rgba(255,255,255,0.08);
}

.sidebar-nav a.active {
  color: var(--white);
  background: rgba(0,180,216,0.15);
}

.sidebar-nav a.active::before {
  transform: scaleY(1);
}

.sidebar-nav a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-full);
  background: linear-gradient(135deg, var(--teal-500), var(--green-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
}

/* ── Main Content Area ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ── */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy-900);
  letter-spacing: -0.01em;
}

.header-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-left: 4px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--border-radius-sm);
}

.menu-toggle:hover {
  background: var(--gray-100);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  position: relative;
}

.header-btn:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.header-btn .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: var(--border-radius-full);
  border: 2px solid var(--white);
}

.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-full);
  background: linear-gradient(135deg, var(--navy-700), var(--teal-500));
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: box-shadow var(--transition-fast);
}

.header-avatar:hover {
  box-shadow: 0 0 0 3px var(--teal-200);
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
  width: 100%;
}

.page-content > section {
  display: none;
}

.page-content > section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy-900);
}

.card-body {
  padding: 20px 24px;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Dashboard Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
  cursor: default;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--navy-100); color: var(--navy-600); }
.stat-icon.teal { background: var(--teal-100); color: var(--teal-600); }
.stat-icon.green { background: var(--green-100); color: var(--green-600); }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }

.stat-icon svg { width: 24px; height: 24px; }

.stat-info h4 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--navy-900);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Today's Shift Banner ── */
.today-shift {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700), var(--teal-600));
  border-radius: var(--border-radius-lg);
  padding: 32px;
  color: var(--white);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.today-shift::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(0,180,216,0.2) 0%, transparent 70%);
  border-radius: 50%;
}

.today-shift::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: 20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(67,160,71,0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.today-shift-content {
  position: relative;
  z-index: 1;
}

.today-shift-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.8;
  margin-bottom: 8px;
}

.today-shift-name {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.today-shift-name .shift-badge {
  padding: 4px 12px;
  border-radius: var(--border-radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(4px);
}

.today-shift-time {
  font-size: 1.1rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.today-shift-meta {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}

.today-shift-meta span {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.85;
}

/* ── Dashboard Grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ── Upcoming Shifts List ── */
.upcoming-list {
  list-style: none;
}

.upcoming-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}

.upcoming-item:last-child {
  border-bottom: none;
}

.upcoming-date {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  background: var(--navy-100);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.upcoming-date .day {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--navy-700);
  line-height: 1;
}

.upcoming-date .month {
  font-size: 0.65rem;
  color: var(--navy-500);
  text-transform: uppercase;
  font-weight: 600;
}

.upcoming-info {
  flex: 1;
  min-width: 0;
}

.upcoming-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.upcoming-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.upcoming-tag {
  padding: 4px 10px;
  border-radius: var(--border-radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Quick Actions ── */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px;
  border-radius: var(--border-radius);
  border: 2px dashed var(--border-color);
  background: var(--gray-50);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.quick-action-btn:hover {
  border-color: var(--accent);
  background: var(--teal-100);
  transform: translateY(-2px);
}

.quick-action-btn svg {
  width: 28px;
  height: 28px;
  color: var(--navy-600);
}

.quick-action-btn span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ══════════════════════════════════════════
   CALENDAR PAGE
   ══════════════════════════════════════════ */

.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-nav h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy-900);
  min-width: 200px;
  text-align: center;
}

.calendar-views {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--border-radius-sm);
  padding: 3px;
}

.calendar-views button {
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.calendar-views button.active {
  background: var(--white);
  color: var(--navy-700);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* Month Calendar Grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.calendar-day-header {
  background: var(--navy-800);
  color: var(--text-on-dark);
  padding: 10px 8px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calendar-day {
  background: var(--white);
  min-height: 100px;
  padding: 8px;
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}

.calendar-day:hover {
  background: var(--gray-50);
}

.calendar-day.other-month {
  background: var(--gray-50);
  opacity: 0.5;
}

.calendar-day.today {
  background: var(--teal-100);
}

.calendar-day .day-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.calendar-day.today .day-number {
  background: var(--accent);
  color: var(--white);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-full);
  font-size: 0.8rem;
}

.calendar-day.holiday .day-number {
  color: var(--danger);
}

.calendar-event {
  display: block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--white);
}

/* Week View */
.week-view {
  display: none;
}

.week-view.active {
  display: block;
}

.week-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.week-time-slot {
  padding: 8px 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  border-bottom: 1px solid var(--gray-100);
  height: 50px;
}

.week-cell {
  border-left: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
  min-height: 50px;
  padding: 2px;
  position: relative;
  cursor: pointer;
}

.week-cell:hover {
  background: var(--gray-50);
}

.week-header {
  background: var(--navy-800);
  color: var(--white);
  padding: 10px 8px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  border-left: 1px solid rgba(255,255,255,0.1);
}

.week-header.today-col {
  background: var(--teal-600);
}

.week-corner {
  background: var(--navy-900);
}

/* Day View */
.day-view {
  display: none;
}

.day-view.active {
  display: block;
}

.day-timeline {
  position: relative;
}

.day-hour {
  display: grid;
  grid-template-columns: 60px 1fr;
  min-height: 60px;
  border-bottom: 1px solid var(--gray-100);
}

.day-hour-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 8px 8px 0 0;
  text-align: right;
}

.day-hour-content {
  border-left: 1px solid var(--gray-200);
  padding: 4px 8px;
  cursor: pointer;
}

.day-hour-content:hover {
  background: var(--gray-50);
}

.day-event-block {
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 4px;
}

/* ══════════════════════════════════════════
   SHIFTS PAGE
   ══════════════════════════════════════════ */

.shifts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.shifts-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: var(--border-radius-full);
  border: 1px solid var(--border-color);
  background: var(--white);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn.active, .filter-btn:hover {
  background: var(--navy-700);
  color: var(--white);
  border-color: var(--navy-700);
}

.shifts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shift-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  cursor: pointer;
}

.shift-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.shift-color-bar {
  width: 4px;
  height: 48px;
  border-radius: 2px;
  flex-shrink: 0;
}

.shift-item-info {
  flex: 1;
  min-width: 0;
}

.shift-item-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.shift-item-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.shift-item-tag {
  padding: 4px 12px;
  border-radius: var(--border-radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.shift-item-actions {
  display: flex;
  gap: 4px;
}

.shift-item-actions button {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.shift-item-actions button:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.shift-item-actions button.delete:hover {
  background: #fee2e2;
  color: var(--danger);
}

/* ══════════════════════════════════════════
   EVENTS PAGE
   ══════════════════════════════════════════ */

.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}

.event-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.event-card-banner {
  height: 8px;
}

.event-card-body {
  padding: 20px;
}

.event-card-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--border-radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.event-card-body h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.event-card-body p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.event-card-dates {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.event-card-dates svg {
  width: 16px;
  height: 16px;
  color: var(--navy-500);
}

/* ══════════════════════════════════════════
   STATS PAGE
   ══════════════════════════════════════════ */

.stats-charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.chart-container h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy-900);
  margin-bottom: 20px;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 200px;
  padding-top: 20px;
}

.bar-chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  max-width: 40px;
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height var(--transition-slow);
  position: relative;
}

.bar:hover {
  opacity: 0.85;
}

.bar-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}

.bar-value {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Donut / Pie */
.donut-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.donut-svg {
  width: 180px;
  height: 180px;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.donut-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.donut-legend-label {
  flex: 1;
  color: var(--text-secondary);
}

.donut-legend-value {
  font-weight: 600;
  color: var(--text-primary);
}

.export-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════
   SETTINGS PAGE
   ══════════════════════════════════════════ */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.settings-section {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.settings-section-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-section-header svg {
  width: 20px;
  height: 20px;
  color: var(--navy-600);
}

.settings-section-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy-900);
}

.settings-section-body {
  padding: 20px 24px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--white);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,180,216,0.1);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-row-info h4 {
  font-size: 0.85rem;
  font-weight: 600;
}

.toggle-row-info p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: var(--border-radius-full);
  transition: background var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  top: 3px;
  left: 3px;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

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

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

/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 18px; height: 18px; }

.btn-primary {
  background: linear-gradient(135deg, var(--navy-700), var(--navy-600));
  color: var(--white);
  box-shadow: 0 2px 8px rgba(13,74,139,0.25);
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(13,74,139,0.35);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, var(--teal-500), var(--teal-400));
  color: var(--white);
  box-shadow: 0 2px 8px rgba(0,180,216,0.25);
}

.btn-accent:hover {
  box-shadow: 0 4px 12px rgba(0,180,216,0.35);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--green-600), var(--green-500));
  color: var(--white);
  box-shadow: 0 2px 8px rgba(67,160,71,0.25);
}

.btn-success:hover {
  box-shadow: 0 4px 12px rgba(67,160,71,0.35);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--white);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

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

.btn-ghost:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-sm svg {
  width: 16px;
  height: 16px;
}

/* ══════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,37,64,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  animation: modalBgIn 0.2s ease;
}

@keyframes modalBgIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy-900);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Color picker row ── */
.color-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-full);
  border: 3px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.selected {
  border-color: var(--navy-900);
  box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--navy-700);
}

/* ── Mobile Nav ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--white);
  border-top: 1px solid var(--border-color);
  z-index: 100;
  padding: 0 8px;
}

.mobile-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
}

.mobile-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 600;
  transition: color var(--transition-fast);
  border-radius: var(--border-radius-sm);
}

.mobile-nav a svg {
  width: 22px;
  height: 22px;
}

.mobile-nav a.active {
  color: var(--navy-700);
}

.mobile-nav a:hover {
  color: var(--navy-600);
}

/* ── Shift type colors ── */
.bg-morning { background: #f59e0b; }
.bg-afternoon { background: var(--teal-500); }
.bg-night { background: var(--navy-700); }
.bg-guard { background: #7c3aed; }
.bg-rest { background: var(--green-500); }
.bg-vacation { background: #ec4899; }
.bg-permit { background: #8b5cf6; }
.bg-court { background: #ef4444; }
.bg-compensation { background: #06b6d4; }

.text-morning { color: #b45309; background: #fef3c7; }
.text-afternoon { color: #0e7490; background: var(--teal-100); }
.text-night { color: var(--navy-700); background: var(--navy-100); }
.text-guard { color: #6d28d9; background: #f5f3ff; }
.text-rest { color: var(--green-700); background: var(--green-100); }
.text-vacation { color: #be185d; background: #fce7f3; }

/* ── Pattern Wizard ── */
.pattern-wizard {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.pattern-wizard h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy-900);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pattern-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.pattern-step {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--white);
}

.pattern-step .step-count {
  font-weight: 700;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .stats-charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 30px rgba(0,0,0,0.3);
  }
  .main-content {
    margin-left: 0;
    padding-bottom: var(--mobile-nav-height);
  }
  .mobile-nav {
    display: block;
  }
  .menu-toggle {
    display: flex;
  }
  .page-content {
    padding: 16px;
  }
  .header {
    padding: 0 16px;
  }
  .today-shift {
    padding: 20px;
  }
  .today-shift-name {
    font-size: 1.25rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .today-shift-meta {
    flex-direction: column;
    gap: 8px;
  }
  .calendar-day {
    min-height: 60px;
    padding: 4px;
  }
  .calendar-day .day-number {
    font-size: 0.75rem;
  }
  .calendar-event {
    font-size: 0.6rem;
    padding: 1px 4px;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .quick-actions {
    grid-template-columns: 1fr 1fr;
  }
  .shifts-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .events-grid {
    grid-template-columns: 1fr;
  }
  .modal {
    max-width: 100%;
    margin: 10px;
    max-height: 85vh;
  }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── Print Styles ── */
@media print {
  .sidebar, .mobile-nav, .header { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto 20px;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}
