/* ============================================================
   CalJS — Maintenance Calendar
   styles.css — Modern, clean, production-ready
   ============================================================ */

/* ----------------------------------------------------------
   CSS Reset & Custom Properties
   ---------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #eff6ff;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --success: #10b981;
  --success-light: #ecfdf5;
  --info: #6366f1;

  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-raised: #f1f5f9;
  --border: #e2e8f0;
  --border-focus: #93c5fd;

  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-inverse: #ffffff;

  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.16);

  --sidebar-width: 280px;
  --navbar-height: 60px;
  --panel-width: 420px;

  --transition: 200ms ease;
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ----------------------------------------------------------
   Scrollbar
   ---------------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ----------------------------------------------------------
   Navbar
   ---------------------------------------------------------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--navbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  gap: 1rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.375rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.sidebar-toggle:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.brand-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-logo {
  font-size: 1.4rem;
  line-height: 1;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  line-height: 1.2;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ----------------------------------------------------------
   App Layout
   ---------------------------------------------------------- */
.app-layout {
  display: flex;
  margin-top: var(--navbar-height);
  min-height: calc(100vh - var(--navbar-height));
}

/* ----------------------------------------------------------
   Sidebar
   ---------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: calc(100vh - var(--navbar-height));
  position: sticky;
  top: var(--navbar-height);
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform var(--transition-slow), width var(--transition-slow);
  z-index: 50;
}

.sidebar.collapsed {
  width: 0;
  overflow: hidden;
}

.sidebar-inner {
  padding: 1rem;
  min-width: var(--sidebar-width);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(0,0,0,0.35);
}
.sidebar-overlay.active {
  display: block;
}

/* Sidebar sections */
.sidebar-section {
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.subsection-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}

/* ----------------------------------------------------------
   Statistics Cards
   ---------------------------------------------------------- */
.stat-card {
  background: var(--surface-raised);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

/* Category / Priority bars */
.category-bars, .priority-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.bar-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bar-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.bar-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.bar-track {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.4s ease;
  min-width: 0;
}

.bar-fill.cat-maintenance { background: #3b82f6; }
.bar-fill.cat-upgrade     { background: #8b5cf6; }
.bar-fill.cat-inspection  { background: #06b6d4; }
.bar-fill.cat-incident    { background: #ef4444; }
.bar-fill.cat-other       { background: #64748b; }

.bar-fill.pri-low      { background: var(--success); }
.bar-fill.pri-normal   { background: var(--primary); }
.bar-fill.pri-high     { background: var(--warning); }
.bar-fill.pri-critical { background: var(--danger); }

/* ----------------------------------------------------------
   Freeze Date Form & List
   ---------------------------------------------------------- */
.freeze-form {
  background: var(--surface-raised);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.freeze-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.freeze-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}
.freeze-item:hover {
  border-color: var(--danger);
}

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

.freeze-item-date {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.freeze-item-reason {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.freeze-type-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.freeze-type-badge.it_freeze          { background: #fee2e2; color: #b91c1c; }
.freeze-type-badge.public_holiday     { background: #fef3c7; color: #92400e; }
.freeze-type-badge.maintenance_window { background: #e0e7ff; color: #4338ca; }

.freeze-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.freeze-delete-btn:hover {
  color: var(--danger);
  background: var(--danger-light);
}

/* ----------------------------------------------------------
   Calendar Area
   ---------------------------------------------------------- */
.calendar-area {
  flex: 1;
  min-width: 0;
  padding: 1.25rem;
  overflow: auto;
}

#calendar {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* FullCalendar overrides */
.fc {
  font-family: inherit;
}

.fc .fc-toolbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.fc .fc-button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  box-shadow: none !important;
  outline: none !important;
}
.fc .fc-button:hover,
.fc .fc-button:focus {
  background: var(--surface-raised);
  border-color: var(--primary);
  color: var(--primary);
}
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

.fc .fc-col-header-cell-cushion {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
}

.fc .fc-daygrid-day-number {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.5rem;
}
.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-full);
  padding: 0.2rem 0.45rem;
}

.fc .fc-daygrid-day:hover {
  background: var(--surface-raised);
  cursor: pointer;
}

.fc .fc-daygrid-day-top {
  position: relative;
}

/* Freeze day */
.fc-day-freeze {
  background: #fff5f5 !important;
}
.fc-day-freeze .fc-daygrid-day-number {
  color: var(--danger) !important;
}

/* Event pills */
.fc-event {
  border: none !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer !important;
  font-size: 0.75rem !important;
  line-height: 1.3 !important;
  padding: 0 !important;
  transition: opacity var(--transition), transform var(--transition) !important;
  box-shadow: none !important;
}
.fc-event:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.fc-daygrid-event-harness {
  margin-bottom: 2px !important;
}

/* Custom event pill */
.event-pill {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  white-space: nowrap;
  width: 100%;
}
.event-pill .event-icon { font-size: 0.7rem; flex-shrink: 0; }
.event-pill .event-title {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.73rem;
  font-weight: 500;
  color: #fff;
}

/* Priority pills */
.priority-low      .event-pill { background: var(--success); }
.priority-normal   .event-pill { background: var(--primary); }
.priority-high     .event-pill { background: var(--warning); }
.priority-critical .event-pill { background: var(--danger); }

/* Custom color override via inline style */
.fc-event.has-custom-color .event-pill {
  background: var(--event-color, var(--primary));
}

/* +N more link */
.fc .fc-daygrid-more-link {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 600;
  padding: 0.1rem 0.45rem;
}
.fc .fc-daygrid-more-link:hover {
  background: var(--primary-light);
  border-radius: var(--radius-sm);
}

/* Warning badge on day cells with multiple events */
.day-warning-badge {
  position: absolute;
  top: 4px;
  right: 28px;
  font-size: 0.7rem;
  line-height: 1;
  cursor: default;
  z-index: 2;
  user-select: none;
  opacity: 0.8;
}

/* List view */
.fc .fc-list-event:hover td {
  background: var(--primary-light);
}
.fc .fc-list-event-dot {
  border-color: var(--primary);
}

/* ----------------------------------------------------------
   Event Popup
   ---------------------------------------------------------- */
.event-popup {
  position: fixed;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 320px;
  max-width: 90vw;
  display: none;
  overflow: hidden;
  animation: popupIn 0.15s ease;
}

.event-popup.visible {
  display: block;
}

@keyframes popupIn {
  from { opacity: 0; transform: scale(0.94) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.popup-header {
  padding: 0.875rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.popup-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  padding-right: 2rem;
  word-break: break-word;
}

.popup-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color var(--transition);
}
.popup-close:hover { color: var(--text); }

.popup-freeze-warning {
  background: var(--danger-light);
  border-bottom: 1px solid #fecaca;
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  color: #b91c1c;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.popup-body {
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.popup-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.popup-row-icon {
  width: 1rem;
  flex-shrink: 0;
  color: var(--text-muted);
  text-align: center;
}

.popup-row-label {
  color: var(--text-muted);
  white-space: nowrap;
  font-size: 0.78rem;
}

.popup-row-value {
  color: var(--text);
  word-break: break-word;
  flex: 1;
}

.popup-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Priority indicator dot in popup */
.priority-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  vertical-align: middle;
  margin-right: 0.25rem;
}
.priority-dot.low      { background: var(--success); }
.priority-dot.normal   { background: var(--primary); }
.priority-dot.high     { background: var(--warning); }
.priority-dot.critical { background: var(--danger); }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}
.status-planned     { background: #f1f5f9; color: #475569; }
.status-in_progress { background: var(--primary-light); color: var(--primary-dark); }
.status-done        { background: var(--success-light); color: #065f46; }
.status-cancelled   { background: var(--danger-light); color: #b91c1c; text-decoration: line-through; }

/* ----------------------------------------------------------
   Slide-in Panel
   ---------------------------------------------------------- */
.slide-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--panel-width);
  max-width: 100vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  overflow: hidden;
}

.slide-panel.open {
  transform: translateX(0);
}

.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 299;
  background: rgba(0,0,0,0.25);
  display: none;
  backdrop-filter: blur(1px);
}
.panel-backdrop.visible {
  display: block;
}

.slide-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.slide-panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.panel-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color var(--transition), background var(--transition);
}
.panel-close-btn:hover {
  color: var(--text);
  background: var(--surface-raised);
}

.slide-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

/* ----------------------------------------------------------
   Forms
   ---------------------------------------------------------- */
.form-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem;
  margin-bottom: 1rem;
}

.form-legend {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 0 0.35rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.form-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.form-row:last-child { margin-bottom: 0; }
.form-row .form-group:last-child:not(:first-child) { flex: 1; }

.form-group + .form-group {
  margin-top: 0.65rem;
}
.form-row .form-group + .form-group {
  margin-top: 0;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}
.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-input,
.form-select,
.form-textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-light);
}

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

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 2rem;
}

.form-color {
  width: 3rem;
  height: 2.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
  cursor: pointer;
  background: var(--surface);
}
.form-color:focus {
  outline: none;
  border-color: var(--primary);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

/* Metadata rows */
.metadata-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.metadata-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.metadata-row .form-input {
  flex: 1;
}

.metadata-remove-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.metadata-remove-btn:hover {
  color: var(--danger);
  background: var(--danger-light);
  border-color: var(--danger);
}

/* Freeze form (sidebar) — tighter spacing */
.freeze-form .form-group {
  gap: 0.2rem;
}
.freeze-form .form-group + .form-group {
  margin-top: 0.4rem;
}

/* ----------------------------------------------------------
   Buttons
   ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(59,130,246,0.35);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-raised);
  border-color: #cbd5e1;
}

.btn-danger {
  background: var(--danger);
  color: var(--text-inverse);
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
  box-shadow: 0 2px 8px rgba(239,68,68,0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-raised);
  color: var(--text);
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
}

.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ----------------------------------------------------------
   Modal / Confirm dialog
   ---------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-overlay.visible {
  display: flex;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 380px;
  max-width: 92vw;
  overflow: hidden;
  animation: modalIn 0.18s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.modal-body {
  padding: 1rem 1.25rem;
}
.modal-body p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.modal-footer {
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ----------------------------------------------------------
   Toast notifications
   ---------------------------------------------------------- */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: var(--text-inverse);
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 320px;
  animation: toastIn 0.2s ease;
  opacity: 1;
  transition: opacity 0.3s ease;
}
.toast.fade-out { opacity: 0; }

.toast.toast-success { background: #065f46; }
.toast.toast-error   { background: #991b1b; }
.toast.toast-warning { background: #92400e; }

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

/* ----------------------------------------------------------
   Responsive
   ---------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --panel-width: 100vw;
  }

  .sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    height: calc(100vh - var(--navbar-height));
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    z-index: 50;
    width: var(--sidebar-width);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar.collapsed {
    width: var(--sidebar-width);
    overflow: auto;
  }

  .calendar-area {
    padding: 0.75rem;
  }

  .brand-subtitle { display: none; }

  .navbar-actions .btn-secondary { display: none; }
}

@media (max-width: 480px) {
  .navbar { padding: 0 0.75rem; }
  .calendar-area { padding: 0.5rem; }
  #calendar { border-radius: var(--radius); }
  .fc .fc-toolbar { flex-wrap: wrap; gap: 0.5rem; }
}

/* ----------------------------------------------------------
   Utility classes
   ---------------------------------------------------------- */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.mt-1 { margin-top: 0.5rem; }
.empty-state {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
}
