/* STARTRACK DESIGN SYSTEM - styles.css */

:root {
  /* --- STELLAR NAVIGATION THEME --- */

  /* Brand Colors (Stellar) */
  --primary: #fbbf24; /* Stellar Gold */
  --primary-hover: #f59e0b; /* Darker Gold */
  --primary-light: rgba(251, 191, 36, 0.15); /* Gold transparent */

  /* Navy Palette */
  --stellar-navy: #1a2332;
  --stellar-navy-light: #263847;
  --stellar-navy-dark: #0f1720;
  --stellar-navy-deeper: #0a0f16;

  /* Gold Palette */
  --stellar-gold: #fbbf24;
  --stellar-gold-bright: #fcd34d;
  --stellar-gold-dark: #f59e0b;
  --stellar-gold-glow: rgba(251, 191, 36, 0.3);

  /* Blue Accents */
  --stellar-blue: #3b82f6;
  --stellar-blue-dim: rgba(59, 130, 246, 0.3);
  --stellar-blue-glow: rgba(59, 130, 246, 0.2);

  /* Backgrounds */
  --bg-app: #0f1720; /* Dark navy */
  --bg-surface: rgba(26, 35, 50, 0.98); /* Navy - increased opacity for performance */
  --bg-surface-solid: #1a2332; /* Solid navy */
  --bg-elevated: rgba(38, 56, 71, 0.98); /* Lighter navy - increased opacity */

  /* Borders */
  --border: rgba(59, 130, 246, 0.2); /* Blue border */
  --border-subtle: rgba(59, 130, 246, 0.1);
  --border-strong: rgba(59, 130, 246, 0.4);

  /* Text Colors */
  --text-main: #e5e7eb; /* Light gray */
  --text-muted: #9ca3af; /* Medium gray */
  --text-dim: #6b7280; /* Dimmer gray */
  --text-bright: #ffffff; /* Pure white */

  /* Semantic / Status Colors (Enhanced for Dark Theme) */
  --status-green-bg: rgba(16, 185, 129, 0.15);
  --status-green-text: #34d399;
  --status-green-glow: rgba(16, 185, 129, 0.3);

  --status-yellow-bg: rgba(251, 191, 36, 0.15);
  --status-yellow-text: #fbbf24;
  --status-yellow-glow: rgba(251, 191, 36, 0.3);

  --status-red-bg: rgba(239, 68, 68, 0.15);
  --status-red-text: #f87171;
  --status-red-glow: rgba(239, 68, 68, 0.3);

  --status-blue-bg: rgba(59, 130, 246, 0.15);
  --status-blue-text: #60a5fa;
  --status-blue-glow: rgba(59, 130, 246, 0.3);

  /* --- 2. Typography --- */
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Rajdhani', sans-serif;
  --font-xs: 0.75rem;
  --font-sm: 0.875rem;
  --font-base: 1rem;
  --font-lg: 1.125rem;
  --font-xl: 1.5rem;
  --font-2xl: 1.875rem;

  /* --- 3. Spacing & Shape --- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px var(--stellar-gold-glow);
  --shadow-glow-blue: 0 0 20px var(--stellar-blue-glow);
  --surface-subtle: rgba(38, 56, 71, 0.3);
  --sidebar-border: rgba(59, 130, 246, 0.2);

  /* Grid Pattern */
  --grid-pattern: linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
                  linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
}

/* --- Global Reset --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--font-sans);
  background: linear-gradient(135deg, var(--stellar-navy-deeper) 0%, var(--stellar-navy-dark) 50%, var(--stellar-navy) 100%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex; /* App Layout */
  position: relative;
}

/* Constellation grid background - static */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: var(--grid-pattern);
  background-size: 50px 50px;
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}

.app-shell {
  display: flex;
  width: 100%;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.main-with-sidebar {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* --- LAYOUT COMPONENTS --- */

/* Sidebar */
.app-sidebar {
  width: 240px;
  background: linear-gradient(180deg, rgba(26, 35, 50, 0.95) 0%, rgba(15, 23, 32, 0.95) 100%);
  /* backdrop-filter removed for performance */
  border-right: 1px solid var(--border);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1200;
  font-size: var(--font-sm);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
}

.app-sidebar .logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--stellar-gold);
  margin-bottom: 2rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 0 20px var(--stellar-gold-glow);
  /* animation removed for performance */
  display: flex;
  justify-content: center;
  align-items: center;
}

.sidebar-logo-image {
  max-width: 180px;
  height: auto;
  filter: drop-shadow(0 0 15px var(--stellar-gold-glow));
  transition: filter 0.3s ease;
}

.sidebar-logo-image:hover {
  filter: drop-shadow(0 0 25px var(--stellar-gold-glow));
}

.app-sidebar nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-bottom: 0.25rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.app-sidebar nav a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--stellar-gold);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

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

.sidebar-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

.sidebar-toggle {
  background: rgba(26, 35, 50, 0.9);
  /* backdrop-filter removed for performance */
  color: var(--stellar-gold);
  border: 1px solid var(--border);
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  display: none;
  z-index: 900;
  transition: all 0.3s ease;
  cursor: pointer;
}

.sidebar-toggle:hover {
  background: rgba(38, 56, 71, 0.9);
  border-color: var(--stellar-gold);
  box-shadow: 0 0 20px var(--stellar-gold-glow);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.8);
  /* backdrop-filter removed for performance */
  z-index: 1100;
  display: none;
}


.topbar-inline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 900;
  display: none;
}

.mobile-topbar {
  display: none;
  padding: 0.75rem 1rem 0 1rem;
  align-items: center;
  gap: 0.75rem;
}

@media (max-width: 900px) {
  body {
    flex-direction: column;
  }
  .app-shell {
    flex-direction: column;
  }
  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1200;
    transform: translateX(-100%);
    display: flex;
  }
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-right: 0.5rem;
  }
  .sidebar-backdrop {
    display: none;
  }
  .sidebar-open .app-sidebar {
    transform: translateX(0);
  }
  .sidebar-open .sidebar-backdrop {
    display: block;
  }
  body.sidebar-open {
    overflow: hidden;
  }
  .app-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  .breadcrumbs {
    margin-left: 0;
    padding-left: 0.5rem;
  }
}

.link-danger {
  color: inherit;
  font-weight: 600;
}
.link-danger:hover,
.link-danger:focus {
  color: inherit;
}
.btn-ghost.link-danger,
.btn-ghost.link-danger:hover,
.btn-ghost.link-danger:focus {
  color: inherit;
  background-color: transparent;
}
.app-sidebar nav a:hover {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--text-bright);
  box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.1);
}

.app-sidebar nav a.active {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
  color: var(--stellar-gold);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.2);
}

.app-sidebar .nav-section {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 2px;
  color: var(--stellar-blue);
  margin: 1.5rem 0 0.75rem 0;
  font-weight: 600;
  opacity: 0.8;
}

/* Main Content Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Top Header */
.app-header {
  background: rgba(26, 35, 50, 0.7);
  /* backdrop-filter removed for performance */
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 10;
}

@media (max-width: 900px) {
  .app-header {
    justify-content: flex-start;
    padding: 1rem 1rem 1rem 1.5rem;
  }
}

.breadcrumbs {
  font-family: var(--font-display);
  font-size: var(--font-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.breadcrumbs a {
  color: var(--stellar-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumbs a:hover {
  color: var(--stellar-gold);
}

.breadcrumbs a:visited {
  color: var(--stellar-blue);
}

.breadcrumbs span {
  color: var(--stellar-gold);
  font-weight: 600;
}

/* Scrollable Content */
.content-area {
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
  min-width: 0;
  background: linear-gradient(135deg, rgba(15, 23, 32, 0.5) 0%, rgba(26, 35, 50, 0.3) 100%);
}

/* --- ATOMIC COMPONENTS --- */

/* 1. Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--font-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.3s ease;
  text-decoration: none;
  gap: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--stellar-gold) 0%, var(--stellar-gold-dark) 100%);
  color: var(--stellar-navy-dark);
  box-shadow: 0 4px 15px var(--stellar-gold-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--stellar-gold-glow);
}

.btn-secondary {
  background-color: rgba(38, 56, 71, 0.6);
  border-color: var(--border);
  color: var(--text-main);
  /* backdrop-filter removed for performance */
}

.btn-secondary:hover {
  background-color: rgba(59, 130, 246, 0.1);
  border-color: var(--stellar-blue);
  color: var(--stellar-blue);
}

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

.btn-ghost:hover {
  color: var(--stellar-gold);
  background-color: rgba(251, 191, 36, 0.1);
}

/* 2. Badges (Status Indicators) */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: 99px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid currentColor;
}

.badge-green {
  background-color: var(--status-green-bg);
  color: var(--status-green-text);
  box-shadow: 0 0 12px var(--status-green-glow);
}

.badge-yellow {
  background-color: var(--status-yellow-bg);
  color: var(--status-yellow-text);
  box-shadow: 0 0 12px var(--status-yellow-glow);
}

.badge-red {
  background-color: var(--status-red-bg);
  color: var(--status-red-text);
  box-shadow: 0 0 12px var(--status-red-glow);
}

.badge-blue {
  background-color: var(--status-blue-bg);
  color: var(--status-blue-text);
  box-shadow: 0 0 12px var(--status-blue-glow);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  background-color: currentColor;
  /* animation removed for performance */
}

.payments-coverage-column,
.payments-coverage-cell {
  width: 1%;
  padding-right: 0;
  text-align: center;
  vertical-align: middle;
}

.payments-coverage-dot {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  border: 1px solid currentColor;
}

.payments-coverage-dot-green {
  background-color: var(--status-green-bg);
  color: var(--status-green-text);
  box-shadow: 0 0 12px var(--status-green-glow);
}

.payments-coverage-dot-red {
  background-color: var(--status-red-bg);
  color: var(--status-red-text);
  box-shadow: 0 0 12px var(--status-red-glow);
}

.payments-status-stack {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-content: flex-start;
  white-space: nowrap;
}

.payments-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--status-green-text);
  cursor: default;
  flex-shrink: 0;
  font-size: 0.95rem;
  line-height: 1;
}

.payments-status-icon:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: 999px;
}

.payments-status-label {
  white-space: nowrap;
}

.payments-action-buttons {
  --payments-action-size: 1.75rem;
  display: inline-grid;
  grid-template-columns: repeat(2, var(--payments-action-size));
  grid-auto-rows: var(--payments-action-size);
  gap: 0.25rem;
  flex-shrink: 0;
}

.payments-action-buttons--single {
  grid-template-columns: var(--payments-action-size);
}

.payments-action-btn {
  width: var(--payments-action-size);
  height: var(--payments-action-size);
  min-height: var(--payments-action-size);
  padding: 0;
  border-radius: 0.55rem;
  border-width: 1px;
  box-shadow: none;
  font-size: 0.82rem;
  letter-spacing: 0;
  line-height: 1;
  text-shadow: none;
}

.payments-action-btn::before {
  display: none;
}

.payments-action-btn:hover,
.payments-action-btn:focus-visible {
  transform: translateY(-1px);
}

.payments-action-btn i {
  line-height: 1;
}

/* 3. Cards */
.card {
  background: rgba(26, 35, 50, 0.6);
  /* backdrop-filter removed for performance */
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
              0 0 20px var(--stellar-blue-glow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-family: var(--font-display);
  font-size: var(--font-lg);
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: 0.5px;
}

.card-subtitle {
  font-size: var(--font-sm);
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* 4. Avatars */
.avatar-group {
  display: flex;
  align-items: center;
  margin-left: -0.5rem;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid white;
  margin-left: -8px; /* overlap */
}
.avatar:first-child {
  margin-left: 0;
}

/* 5. Phase / Milestone / Task Hierarchy */
.phase-container {
  margin-bottom: 2rem;
}
.phase-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}
.phase-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: var(--font-lg);
}

.milestone-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  overflow: hidden;
}
.milestone-header {
  background-color: #f9fafb;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.milestone-title {
  font-weight: 600;
  font-size: var(--font-sm);
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.task-list {
  padding: 0;
}
.task-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: var(--font-sm);
}
.task-item:last-child {
  border-bottom: none;
}
.task-item:hover {
  background-color: #f9fafb;
}
.task-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* 6. Tabs */
.tabs {
  display: flex;
  gap: 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.tab {
  padding-bottom: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  font-weight: 500;
  font-size: var(--font-sm);
}
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* 7. Grid Utilities */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mt-4 {
  margin-top: 1rem;
}

/* --- APPEND TO styles.css --- */

/* 8. TYPOGRAPHY UTILITIES */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-main);
  margin-bottom: 0.5rem;
  font-weight: 600;
}
h1 {
  font-size: var(--font-2xl);
}
h2 {
  font-size: var(--font-xl);
}
h3 {
  font-size: var(--font-lg);
}
p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.text-sm {
  font-size: var(--font-sm);
}
.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}
.text-muted {
  color: var(--text-muted);
}

/* 9. FORMS */
.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--stellar-gold);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: var(--font-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: rgba(15, 23, 32, 0.6);
  color: var(--text-bright);
  transition: all 0.3s ease;
  font-family: inherit;
}

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--stellar-gold);
  background-color: rgba(15, 23, 32, 0.8);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1),
              0 0 20px var(--stellar-gold-glow);
}

.form-input:disabled,
.form-select:disabled {
  background-color: rgba(15, 23, 32, 0.3);
  cursor: not-allowed;
  color: var(--text-dim);
  opacity: 0.6;
}

/* Date input calendar icon - better contrast for dark theme */
input[type="date"],
input[type="month"] {
  color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  filter: brightness(0) saturate(100%) invert(83%) sepia(48%) saturate(1538%) hue-rotate(359deg) brightness(102%) contrast(98%);
  cursor: pointer;
  opacity: 0.92;
  transition: opacity 0.2s ease, filter 0.2s ease, transform 0.2s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  filter: brightness(0) saturate(100%) invert(88%) sepia(37%) saturate(1664%) hue-rotate(350deg) brightness(106%) contrast(102%) drop-shadow(0 0 0.35rem rgba(251, 191, 36, 0.28));
  transform: scale(1.05);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.form-check input[type="hidden"] {
  display: none;
}
.form-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}
.form-check label {
  font-size: var(--font-sm);
  color: var(--text-main);
  cursor: pointer;
}

/* Auth layout */
.auth-layout {
  width: 100%;
  min-height: 100vh;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  background-color: var(--bg-app);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

/* Wider form card for management screens */
.form-card {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.abilities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem 1rem;
  align-items: flex-start;
}
.auth-header {
  margin-bottom: 1rem;
}
.auth-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.auth-links {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: var(--font-sm);
}

/* ========================================
   STELLAR AUTH THEME (Login Page)
   ======================================== */

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

:root {
  --stellar-navy: #1a2332;
  --stellar-navy-light: #263847;
  --stellar-navy-dark: #0f1720;
  --stellar-gold: #fbbf24;
  --stellar-gold-glow: rgba(251, 191, 36, 0.3);
  --stellar-blue: #3b82f6;
  --stellar-text: #e5e7eb;
  --stellar-text-dim: #9ca3af;
}

/* Main layout */
.stellar-auth-layout {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, var(--stellar-navy-dark) 0%, var(--stellar-navy) 50%, var(--stellar-navy-light) 100%);
  overflow: hidden;
}

/* Animated background */
.stellar-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

/* Constellation grid */
.constellation-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.5;
}

@keyframes gridPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

/* Animated stars - login page only */
.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  animation: starTwinkle 3s ease-in-out infinite;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
}

.star:nth-child(1) { top: 10%; left: 20%; animation-delay: 0s; }
.star:nth-child(2) { top: 20%; left: 80%; animation-delay: 0.5s; }
.star:nth-child(3) { top: 30%; left: 40%; animation-delay: 1s; }
.star:nth-child(4) { top: 40%; left: 10%; animation-delay: 1.5s; }
.star:nth-child(5) { top: 50%; left: 90%; animation-delay: 0.3s; }
.star:nth-child(6) { top: 60%; left: 30%; animation-delay: 0.8s; }
.star:nth-child(7) { top: 70%; left: 70%; animation-delay: 1.2s; }
.star:nth-child(8) { top: 80%; left: 50%; animation-delay: 0.6s; }
.star:nth-child(9) { top: 15%; left: 60%; animation-delay: 1.8s; }
.star:nth-child(10) { top: 25%; left: 15%; animation-delay: 0.2s; }
.star:nth-child(11) { top: 35%; left: 85%; animation-delay: 1.1s; }
.star:nth-child(12) { top: 45%; left: 45%; animation-delay: 0.9s; }
.star:nth-child(13) { top: 55%; left: 25%; animation-delay: 1.4s; }
.star:nth-child(14) { top: 65%; left: 65%; animation-delay: 0.4s; }
.star:nth-child(15) { top: 75%; left: 35%; animation-delay: 1.6s; }
.star:nth-child(16) { top: 85%; left: 75%; animation-delay: 0.7s; }
.star:nth-child(17) { top: 12%; left: 50%; animation-delay: 1.3s; }
.star:nth-child(18) { top: 22%; left: 95%; animation-delay: 0.1s; }
.star:nth-child(19) { top: 32%; left: 5%; animation-delay: 1.7s; }
.star:nth-child(20) { top: 42%; left: 55%; animation-delay: 0.5s; }
.star:nth-child(21) { top: 52%; left: 18%; animation-delay: 1.9s; }
.star:nth-child(22) { top: 62%; left: 82%; animation-delay: 0.25s; }
.star:nth-child(23) { top: 72%; left: 42%; animation-delay: 1.05s; }
.star:nth-child(24) { top: 82%; left: 92%; animation-delay: 0.65s; }
.star:nth-child(25) { top: 18%; left: 38%; animation-delay: 1.45s; }
.star:nth-child(26) { top: 28%; left: 68%; animation-delay: 0.35s; }
.star:nth-child(27) { top: 38%; left: 22%; animation-delay: 1.55s; }
.star:nth-child(28) { top: 48%; left: 78%; animation-delay: 0.75s; }
.star:nth-child(29) { top: 58%; left: 48%; animation-delay: 1.25s; }
.star:nth-child(30) { top: 68%; left: 12%; animation-delay: 0.45s; }
.star:nth-child(31) { top: 78%; left: 88%; animation-delay: 1.65s; }
.star:nth-child(32) { top: 88%; left: 58%; animation-delay: 0.15s; }
.star:nth-child(33) { top: 8%; left: 72%; animation-delay: 1.75s; }
.star:nth-child(34) { top: 95%; left: 28%; animation-delay: 0.55s; }
.star:nth-child(35) { top: 5%; left: 8%; animation-delay: 1.35s; }
.star:nth-child(36) { top: 92%; left: 98%; animation-delay: 0.85s; }
.star:nth-child(37) { top: 14%; left: 44%; animation-delay: 1.15s; }
.star:nth-child(38) { top: 24%; left: 64%; animation-delay: 0.95s; }
.star:nth-child(39) { top: 34%; left: 34%; animation-delay: 1.85s; }
.star:nth-child(40) { top: 44%; left: 74%; animation-delay: 0.05s; }
.star:nth-child(41) { top: 54%; left: 54%; animation-delay: 1.95s; }
.star:nth-child(42) { top: 64%; left: 14%; animation-delay: 0.55s; }
.star:nth-child(43) { top: 74%; left: 84%; animation-delay: 1.25s; }
.star:nth-child(44) { top: 84%; left: 24%; animation-delay: 0.95s; }
.star:nth-child(45) { top: 16%; left: 76%; animation-delay: 1.65s; }
.star:nth-child(46) { top: 26%; left: 36%; animation-delay: 0.35s; }
.star:nth-child(47) { top: 36%; left: 96%; animation-delay: 1.05s; }
.star:nth-child(48) { top: 46%; left: 26%; animation-delay: 0.75s; }
.star:nth-child(49) { top: 56%; left: 66%; animation-delay: 1.45s; }
.star:nth-child(50) { top: 66%; left: 46%; animation-delay: 0.15s; }

@keyframes starTwinkle {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.5);
  }
}

/* Login card */
.stellar-auth-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 480px;
  background: rgba(26, 35, 50, 0.85);
  /* backdrop-filter removed for performance */
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 16px;
  padding: 3rem 2.5rem;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(59, 130, 246, 0.1),
    inset 0 0 80px rgba(59, 130, 246, 0.02);
  animation: cardEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Logo */
.stellar-logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
  /* animation removed for performance */
}

.stellar-logo {
  max-width: 280px;
  height: auto;
  filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.3));
}

@keyframes logoGlow {
  0%, 100% {
    filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 30px rgba(251, 191, 36, 0.5));
  }
}

/* Coordinate line */
.coordinate-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--stellar-gold);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
  /* animation removed for performance */
}

.coordinate-text {
  opacity: 0.9;
}

.coordinate-value {
  font-family: 'IBM Plex Sans', monospace;
  opacity: 0.6;
  font-size: 0.7rem;
}

@keyframes coordinateScan {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* Header */
.stellar-header {
  margin-bottom: 2rem;
  text-align: center;
}

.stellar-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  text-shadow: 0 0 30px rgba(251, 191, 36, 0.4);
}

.stellar-subtitle {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--stellar-text-dim);
  font-weight: 400;
}

/* Form */
.stellar-form {
  margin-bottom: 1.5rem;
}

.stellar-form-group {
  margin-bottom: 1.5rem;
}

.stellar-label {
  display: block;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--stellar-gold);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.5rem;
}

.stellar-input-wrapper {
  position: relative;
}

.stellar-input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--stellar-text-dim);
  font-size: 1rem;
  pointer-events: none;
  transition: color 0.3s ease;
}

.stellar-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 1rem;
  color: white;
  background: rgba(15, 23, 32, 0.6);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  outline: none;
  transition: all 0.3s ease;
}

.stellar-input::placeholder {
  color: var(--stellar-text-dim);
  opacity: 0.5;
}

.stellar-input:focus {
  background: rgba(15, 23, 32, 0.8);
  border-color: var(--stellar-gold);
  box-shadow:
    0 0 0 3px rgba(251, 191, 36, 0.1),
    0 0 20px rgba(251, 191, 36, 0.2);
}

.stellar-input:focus + .stellar-input-icon,
.stellar-input-wrapper:focus-within .stellar-input-icon {
  color: var(--stellar-gold);
}

/* Form actions */
.stellar-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.stellar-link {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.875rem;
  color: var(--stellar-blue);
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
}

.stellar-link:hover {
  color: var(--stellar-gold);
}

.stellar-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--stellar-gold);
  transition: width 0.3s ease;
}

.stellar-link:hover::after {
  width: 100%;
}

.stellar-submit-btn {
  flex: 1;
  padding: 0.875rem 2rem;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--stellar-navy-dark);
  background: linear-gradient(135deg, var(--stellar-gold) 0%, #f59e0b 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.3);
  position: relative;
  overflow: hidden;
}

.stellar-submit-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.stellar-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(251, 191, 36, 0.5);
}

.stellar-submit-btn:hover::before {
  left: 100%;
}

.stellar-submit-btn:active {
  transform: translateY(0);
}

/* Symbol decoration */
.symbol-decoration {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(59, 130, 246, 0.2);
}

.symbol {
  font-family: 'Rajdhani', monospace;
  font-size: 1.25rem;
  color: rgba(59, 130, 246, 0.4);
  /* animation removed for performance */
}

.symbol.gold {
  color: var(--stellar-gold);
  /* animation removed for performance */
}

.symbol:nth-child(1) { animation-delay: 0s; }
.symbol:nth-child(2) { animation-delay: 0.5s; }
.symbol:nth-child(3) { animation-delay: 1s; }
.symbol:nth-child(4) { animation-delay: 1.5s; }

@keyframes symbolFloat {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-5px); opacity: 0.7; }
}

@keyframes symbolGlow {
  0%, 100% {
    opacity: 0.7;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
  }
  50% {
    opacity: 1;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.8);
  }
}

/* Status indicator */
.stellar-status {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.75rem;
  color: var(--stellar-text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  /* animation removed for performance */
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

@keyframes statusPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.2);
  }
}

/* AOS-like fade animations */
[data-aos="fade-up"] {
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

[data-aos="fade-down"] {
  animation: fadeDown 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

[data-aos="fade-left"] {
  animation: fadeLeft 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

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

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeLeft {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

[data-aos-delay="100"] { animation-delay: 0.1s; }
[data-aos-delay="200"] { animation-delay: 0.2s; }
[data-aos-delay="300"] { animation-delay: 0.3s; }
[data-aos-delay="400"] { animation-delay: 0.4s; }
[data-aos-delay="500"] { animation-delay: 0.5s; }
[data-aos-delay="600"] { animation-delay: 0.6s; }
[data-aos-delay="700"] { animation-delay: 0.7s; }

/* Responsive */
@media (max-width: 640px) {
  .stellar-auth-card {
    padding: 2rem 1.5rem;
  }

  .stellar-title {
    font-size: 2rem;
  }

  .stellar-logo {
    max-width: 220px;
  }

  .coordinate-line {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .stellar-form-actions {
    flex-direction: column-reverse;
  }

  .stellar-submit-btn {
    width: 100%;
  }
}

/* 10. TABLES */
.table-container {
  width: 100%;
  overflow-x: auto;
  background: rgba(26, 35, 50, 0.6);
  /* backdrop-filter removed for performance */
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--font-sm);
}

.table th {
  background: linear-gradient(180deg, rgba(38, 56, 71, 0.8) 0%, rgba(26, 35, 50, 0.6) 100%);
  color: var(--stellar-gold);
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 1px;
  padding: 1rem 1.5rem;
  border-bottom: 2px solid var(--border-strong);
}

.table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
  transition: background-color 0.2s ease;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: all 0.2s ease;
}

.table tbody tr:hover td {
  background-color: rgba(59, 130, 246, 0.08);
  box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.05);
}

.table tbody tr:nth-child(even) {
  background-color: rgba(15, 23, 32, 0.3);
}

.table-sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.table-sort-link:hover,
.table-sort-link:focus {
  color: var(--stellar-gold);
  text-decoration: none;
}

.companies-index-toolbar {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.companies-index-search-form {
  flex: 1 1 30rem;
}

.companies-index-search-form,
.employees-index-search-form {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}

.companies-index-search-field,
.employees-index-search-field {
  flex: 1 1 18rem;
  width: auto;
  min-width: 12rem;
}

.companies-index-search-form .btn,
.companies-index-toolbar > .btn {
  min-height: 2.375rem;
  display: inline-flex;
  align-items: center;
}

.employees-index-search-card {
  margin-bottom: 1rem;
}

.employees-inactive-count-badge {
  margin-left: 0.5rem;
}

.employees-actions-cluster {
  justify-content: flex-end;
  --cluster-gap: 0.5rem;
}

.companies-index-search-card {
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .companies-index-toolbar,
  .companies-index-search-form,
  .employees-index-search-form {
    width: 100%;
    justify-content: flex-start;
  }

  .companies-index-search-field,
  .employees-index-search-field {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }
}

/* 11. ALERTS & CALLOUTS */
.alert {
  padding: 1rem;
  border-radius: var(--radius-md);
  border-left: 4px solid transparent;
  margin-bottom: 1rem;
  font-size: var(--font-sm);
  display: flex;
  gap: 0.75rem;
  flex-direction: column;
}
.alert ul {
  margin: 0.25rem 0 0 1rem;
  padding: 0;
  list-style: disc;
}
.alert ul li {
  margin: 0.15rem 0;
}
.alert-info {
  background-color: var(--status-blue-bg);
  color: var(--status-blue-text);
  border-left-color: var(--status-blue-text);
}
.alert-success {
  background-color: var(--status-green-bg);
  color: var(--status-green-text);
  border-left-color: var(--status-green-text);
}
.alert-warning {
  background-color: var(--status-yellow-bg);
  color: var(--status-yellow-text);
  border-left-color: var(--status-yellow-text);
}
.alert-danger {
  background-color: var(--status-red-bg);
  color: var(--status-red-text);
  border-left-color: var(--status-red-text);
}

.alert-dismissible {
  position: relative;
  padding-right: 2.5rem;
}

.alert-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: currentColor;
  cursor: pointer;
}

.alert-close:hover {
  background: rgba(0, 0, 0, 0.08);
}

.alert-close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 1px;
}

/* 12. MODALS (Simple implementation) */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  /* backdrop-filter removed for performance */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  /* To hide: display: none; */
}
.modal {
  background: rgba(26, 35, 50, 0.95);
  /* backdrop-filter removed for performance */
  border: 1px solid var(--border-strong);
  width: 100%;
  max-width: 500px;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6),
              0 0 40px var(--stellar-blue-glow);
  animation: slideIn 0.2s ease-out;
  max-height: calc(100vh - 2rem);
  height: min(90vh, calc(100vh - 2rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.modal.modal-schedule {
  max-width: 980px;
}
.modal form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1 1 0;
  min-height: 0;
}
.modal-footer {
  padding: 1rem 1.5rem;
  background: rgba(15, 23, 32, 0.5);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.schedule-modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1rem;
  align-items: start;
}

.schedule-modal-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.schedule-modal-form .form-group {
  margin-bottom: 0;
}

.schedule-modal-history {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.schedule-history-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  padding: 0.75rem;
}

.schedule-history-title {
  margin: 0 0 0.5rem;
  font-size: var(--font-sm);
}

.schedule-history-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--font-sm);
}

.schedule-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 16rem;
  overflow: auto;
}

.schedule-history-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  padding: 0.5rem 0.625rem;
  font-size: var(--font-xs);
}

.schedule-history-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.schedule-history-status {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
}

.schedule-history-item-details,
.schedule-history-item-time {
  margin-top: 0.2rem;
}

@media (max-width: 600px) {
  .modal-backdrop {
    align-items: flex-end;
    padding: 1rem;
  }

  .modal {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-md);
  }

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

  .schedule-modal-layout {
    grid-template-columns: 1fr;
  }

  .schedule-history-list {
    max-height: 12rem;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }

  .map-container {
    height: 200px;
  }
}

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

/* Button Variants Additions */
.btn-danger {
  background-color: #dc2626;
  color: white;
}
.btn-danger:hover {
  background-color: #b91c1c;
}
.btn-success {
  background-color: #16a34a;
  color: white;
}
.btn-success:hover {
  background-color: #15803d;
}
.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}
 .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
 }

/* 13. UTILITIES & APP-SPECIFIC HELPERS */
.stack > * + * {
  margin-top: var(--stack-space, 0.5rem);
}

.cluster {
  display: flex;
  align-items: center;
  gap: var(--cluster-gap, 0.75rem);
  flex-wrap: wrap;
}

.section-divider {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.eyebrow {
  font-size: var(--font-xs);
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
}

.display-lg {
  font-size: var(--font-2xl);
}

.text-critical {
  color: var(--status-red-text);
}

.card-critical {
  border-left: 4px solid var(--status-red-text);
}

.btn-block {
  width: 100%;
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: var(--font-xs);
}

.mt-lg {
  margin-top: 3rem;
}

.mb-sm {
  margin-bottom: 0.5rem;
}

.mb-md {
  margin-bottom: 1rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  font-size: var(--font-xs);
  padding: 0.15rem 0.5rem;
  font-weight: 700;
  line-height: 1.2;
  min-width: 1.5rem;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--sidebar-border);
  color: #e5e7eb;
}

.sidebar-footer .eyebrow {
  color: #9ca3af;
}

.sidebar-footer .sidebar-identity {
  font-weight: 600;
  color: #fff;
}

.card-section {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.stat-value {
  font-weight: 600;
  font-size: 1.25rem;
}

.stat-subtext {
  font-size: var(--font-sm);
  font-weight: 400;
  color: var(--text-muted);
}

.section-heading {
  margin-top: 3rem;
  margin-bottom: 1rem;
}

.avatar-primary {
  background-color: var(--primary-light);
  color: var(--primary);
}

.avatar-warm {
  background-color: #fdba74;
  color: #9a3412;
}

.avatar-muted {
  background-color: #e5e7eb;
  color: #6b7280;
}

/* 14. FORM FIELDSETS */
.form-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background-color: var(--bg-surface);
}

.form-fieldset legend {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-main);
  padding: 0 0.75rem;
  margin-left: -0.5rem;
  background-color: var(--bg-surface);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  align-items: end;
}

.form-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

.form-row-4 {
  grid-template-columns: repeat(4, 1fr);
}

.form-row > .form-group {
  display: flex;
  flex-direction: column;
}

.form-row > .form-group > .form-label {
  margin-bottom: 0.375rem;
}

.form-row + .form-row {
  margin-top: 1rem;
}

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

.form-fieldset .form-group {
  margin-bottom: 0;
}

.form-fieldset .form-group + .form-group {
  margin-top: 1rem;
}

.col-span-2 {
  grid-column: span 2;
}

@media (max-width: 640px) {
  .form-row,
  .form-row-3,
  .form-row-4 {
    grid-template-columns: 1fr;
  }
  .col-span-2 {
    grid-column: span 1;
  }
}

.form-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.375rem; /* Match form-input height */
}

.form-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: var(--font-sm);
  color: var(--text-main);
  height: 2.375rem; /* Match form-input height */
}

.form-checkbox input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Screen reader only - visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 15. DETAIL VIEWS */
.detail-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.detail-section {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.detail-section:first-child {
  border-top: none;
  padding-top: 0;
}

.detail-section-title {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem 2rem;
}

.detail-item dt {
  font-size: var(--font-xs);
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.detail-item dd {
  font-size: var(--font-sm);
  color: var(--text-main);
}

.detail-item-wide {
  grid-column: span 2;
}

@media (max-width: 640px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .detail-item-wide {
    grid-column: span 1;
  }
}

.card-footer {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.abilities-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Table row links */
.table td a.table-link {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
}

.table td a.table-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* 14. SITES MANAGEMENT */
.content-area:has(.sites-grid) {
  display: flex;
  flex-direction: column;
}

.sites-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  flex: 1;
  min-height: 0;
}

.sites-grid > .card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.selectable-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.selectable-list > turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.selectable-list > [data-controller="schedule-sortable"],
.selectable-list > turbo-frame > [data-controller="schedule-sortable"] {
  flex: 1;
}

.selectable-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s;
}

.selectable-item .item-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.selectable-item .item-info .badge {
  margin-left: auto;
}

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

.selectable-item:hover {
  background-color: var(--surface-subtle);
}

.selectable-item.selected {
  background-color: var(--primary-light) !important;
  border-left: 3px solid var(--primary);
  font-weight: 500;
}

.selectable-item.inactive {
  opacity: 0.5;
}

.selectable-item.inactive .item-name {
  color: var(--text-muted);
}

.selectable-item:hover .remove-btn {
  opacity: 1;
}

.remove-btn {
  opacity: 0;
  transition: opacity 0.15s;
}

.empty-state {
  padding: 2rem;
  text-align: center;
}

.disabled-state {
  background: var(--surface-subtle);
  opacity: 0.6;
}

@media (max-width: 1200px) {
  .sites-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .sites-grid {
    grid-template-columns: 1fr;
  }
}

/* --- TOM SELECT OVERRIDES --- */
.ts-wrapper {
  border: none !important;
  padding: 0 !important;
}

.modal.modal-schedule .ts-control,
.modal.modal-schedule .ts-dropdown,
.modal.modal-schedule .ts-dropdown .no-results,
.modal.modal-schedule .ts-dropdown .create {
  color: var(--text-main) !important;
}

.modal.modal-schedule .ts-control input {
  color: var(--text-bright) !important;
  caret-color: var(--text-bright);
  -webkit-text-fill-color: var(--text-bright);
  opacity: 1;
}

.ts-wrapper.single .ts-control,
.ts-wrapper.single.input-active .ts-control {
  padding: 0.625rem 0.75rem;
  font-size: var(--font-sm);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-app) 100%);
  color: var(--text-main);
  min-height: 2.625rem;
  line-height: 1.5;
}

/* Hide the original select when Tom Select is active */
select.tomselected {
  display: none !important;
}

.ts-wrapper.single .ts-control::after {
  border-color: var(--text-muted) transparent transparent transparent;
}

.ts-wrapper.single .ts-control .item {
  color: var(--text-main);
}

/* Hide empty items (when no real selection) */
.ts-wrapper.single .ts-control .item[data-value=""] {
  display: none;
}

/* Make input expand when no item is selected */
.ts-wrapper.single .ts-control > input {
  flex: 1;
  min-width: 100px;
}

/* Ensure placeholder is visible */
.ts-wrapper.single .ts-control > input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.ts-wrapper.single.focus .ts-control {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.ts-wrapper {
  position: relative;
}

.ts-dropdown {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  border-top: none;
  box-shadow: var(--shadow-md);
  margin: 0 !important;
  z-index: 9999 !important;
  position: absolute !important;
  top: calc(100% - 1px) !important;
  left: 0 !important;
  right: 0 !important;
  width: auto !important;
}

.ts-wrapper.single.dropdown-active .ts-control {
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom-color: transparent;
}

.ts-dropdown .ts-dropdown-content {
  max-height: 250px;
  background: var(--bg-surface-solid);
}

.ts-dropdown .optgroup-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem 0.4rem;
  background: var(--surface-subtle);
  border-top: 1px solid var(--border);
}

.ts-dropdown .optgroup-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--status-blue-text);
  background: var(--status-blue-bg);
}

.ts-dropdown .optgroup-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.ts-dropdown .optgroup:first-child .optgroup-header {
  border-top: none;
}

.ts-dropdown .option {
  padding: 0.5rem 0.75rem;
  font-size: var(--font-sm);
  color: var(--text-main);
  background-color: transparent;
  border-top: 1px solid var(--border-subtle);
}

.ts-option-entry {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.ts-option-point {
  color: var(--text-main);
  font-weight: 500;
}

.ts-option-site {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.ts-dropdown .option.active,
.ts-dropdown .option.selected {
  background-color: var(--primary);
  color: var(--stellar-navy-deeper);
}

.ts-dropdown .option.active .ts-option-point,
.ts-dropdown .option.active .ts-option-site,
.ts-dropdown .option.selected .ts-option-point,
.ts-dropdown .option.selected .ts-option-site {
  color: var(--stellar-navy-deeper);
}

.ts-dropdown .option:hover {
  background-color: var(--status-blue-bg);
  color: var(--stellar-navy-deeper);
}

.ts-dropdown .option:hover .ts-option-point,
.ts-dropdown .option:hover .ts-option-site {
  color: var(--stellar-navy-deeper);
}

.ts-dropdown .option.active:hover {
  background-color: var(--primary);
  color: var(--stellar-navy-deeper);
}

.ts-wrapper .ts-control input {
  font-size: var(--font-sm);
}

.ts-wrapper .ts-control input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.ts-wrapper.multi .ts-control {
  gap: 0.45rem;
}

.ts-wrapper.multi .ts-control > input {
  min-width: 7rem;
  margin: 0;
}

.ts-wrapper.multi .item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ts-wrapper.multi .item .remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  color: inherit;
  font-size: 0.9rem;
  line-height: 1;
  text-decoration: none;
  opacity: 0.72;
  transition: background-color 0.18s ease, opacity 0.18s ease;
}

.ts-wrapper.multi .item .remove:hover,
.ts-wrapper.multi .item .remove:focus {
  background: rgba(255, 255, 255, 0.14);
  opacity: 1;
}

.ts-wrapper.single .ts-control .ts-input-placeholder {
  color: var(--text-muted);
}

.ts-selected-entry {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ts-selected-point {
  color: var(--text-bright);
  font-weight: 500;
}

.ts-selected-site {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* --- 16. DASHBOARD CARDS --- */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.dashboard-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  background: rgba(26, 35, 50, 0.6);
  /* backdrop-filter removed for performance */
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.dashboard-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.05) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dashboard-card:hover::before {
  opacity: 1;
}

.dashboard-card:hover {
  transform: translateY(-4px);
  border-color: var(--stellar-gold);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4),
              0 0 30px var(--stellar-gold-glow);
}

.dashboard-card-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dashboard-card-disabled:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.dashboard-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(59, 130, 246, 0.1) 100%);
  color: var(--stellar-gold);
  border-radius: var(--radius-md);
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--stellar-gold-glow);
  transition: all 0.3s ease;
}

.dashboard-card:hover .dashboard-card-icon {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 0 30px var(--stellar-gold-glow);
}

.dashboard-card-content {
  flex: 1;
  min-width: 0;
}

.dashboard-card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--font-lg);
  color: var(--text-bright);
  margin-bottom: 0.375rem;
  letter-spacing: 0.5px;
}

.dashboard-card-count {
  font-size: var(--font-sm);
  color: var(--text-muted);
}

.dashboard-card-arrow {
  color: var(--text-dim);
  font-size: var(--font-base);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.dashboard-card:hover .dashboard-card-arrow {
  color: var(--stellar-gold);
  transform: translateX(4px);
}

.dashboard-card-warning {
  border-color: rgba(239, 68, 68, 0.45);
  background: linear-gradient(135deg, rgba(76, 24, 24, 0.68) 0%, rgba(40, 17, 22, 0.88) 100%);
}

.dashboard-card-warning .dashboard-card-icon {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22) 0%, rgba(251, 191, 36, 0.12) 100%);
  color: #fca5a5;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.18);
}

.dashboard-card-warning:hover {
  border-color: rgba(248, 113, 113, 0.75);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.42), 0 0 28px rgba(239, 68, 68, 0.16);
}

.dashboard-card-disabled:hover .dashboard-card-arrow {
  color: var(--text-dim);
  transform: none;
}

/* --- 17. MAP PICKER --- */
.map-container {
  height: 250px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--bg-app);
}

.map-container .leaflet-container {
  height: 100%;
  width: 100%;
  font-family: var(--font-sans);
}

/* --- 18. SCHEDULE PAGE --- */
.schedule-toolbar-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.schedule-toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.25rem;
  min-width: 0;
}

.schedule-toolbar-field {
  flex: 0 1 12.5rem;
  margin-bottom: 0;
}

.schedule-toolbar-input {
  width: min(100%, 12.5rem);
}

.schedule-toolbar-buttons {
  flex: 1 1 26rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.schedule-toolbar-buttons .btn {
  flex: 0 0 auto;
}

.schedule-toolbar-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.schedule-toolbar-main {
  flex: 1 1 52rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.schedule-toolbar-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  flex: 0 0 auto;
  padding-top: 3rem;
}

.schedule-period-switch {
  display: inline-flex;
  gap: 0.5rem;
  align-self: flex-start;
  padding: 0.35rem;
  border: 1px solid rgba(59, 130, 246, 0.16);
  border-radius: calc(var(--radius-md) + 0.2rem);
  background: linear-gradient(180deg, rgba(7, 16, 28, 0.82) 0%, rgba(13, 27, 45, 0.76) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.schedule-report-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.schedule-report-fields {
  display: grid;
  grid-template-columns: minmax(14rem, 18rem) repeat(2, minmax(16rem, 1fr));
  gap: 1rem 1.1rem;
  align-items: start;
}

.schedule-report-field {
  margin-bottom: 0;
}

.schedule-report-field--period {
  grid-column: 1 / -1;
}

.schedule-report-field--site-points {
  grid-column: 1 / -1;
}

.schedule-report-actions {
  display: flex;
  justify-content: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.schedule-report-actions .btn + .btn {
  margin-left: 0.25rem;
}

.schedule-report-form .form-input,
.schedule-report-form .form-select,
.schedule-report-form .ts-wrapper.multi .ts-control {
  border-color: rgba(46, 96, 164, 0.42);
  background: linear-gradient(180deg, rgba(10, 20, 34, 0.88) 0%, rgba(12, 24, 40, 0.96) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.schedule-report-form .form-input:hover,
.schedule-report-form .ts-wrapper.multi:hover .ts-control {
  border-color: rgba(79, 146, 224, 0.54);
}

.schedule-report-select + .ts-wrapper {
  width: 100%;
}

.schedule-report-select + .ts-wrapper.multi .ts-control {
  min-height: 4rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(46, 96, 164, 0.42);
  border-radius: var(--radius-md);
  align-items: center;
  flex-wrap: wrap;
}

.schedule-report-select + .ts-wrapper.multi.focus .ts-control {
  border-color: var(--stellar-gold);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1),
              0 0 20px rgba(251, 191, 36, 0.18);
}

.schedule-report-select + .ts-wrapper.multi.has-items .ts-control {
  align-items: flex-start;
}

.schedule-report-select + .ts-wrapper.multi .ts-control > input {
  color: var(--text-bright);
  min-width: 8rem;
  padding: 0.2rem 0;
}

.schedule-report-select + .ts-wrapper.multi .ts-control > input::placeholder {
  color: rgba(216, 226, 242, 0.7);
}

.schedule-report-select + .ts-wrapper.multi .item {
  display: inline-grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.55rem;
  max-width: 100%;
  margin: 0;
  padding: 0.45rem 1rem 0.45rem 0.7rem;
  border: 1px solid rgba(93, 156, 228, 0.34);
  border-radius: 0.9rem;
  background: linear-gradient(135deg, rgba(25, 45, 73, 0.94) 0%, rgba(18, 34, 58, 0.98) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: var(--text-bright);
}

.schedule-report-select + .ts-wrapper.multi .item.active {
  border-color: rgba(251, 191, 36, 0.42);
  background: linear-gradient(135deg, rgba(62, 51, 17, 0.94) 0%, rgba(41, 35, 14, 0.98) 100%);
}

.schedule-report-select + .ts-wrapper.multi .item .remove {
  position: static;
  flex-shrink: 0;
  margin-right: 0.35rem;
  color: #f8d784;
  background: rgba(251, 191, 36, 0.1);
}

.schedule-report-select + .ts-wrapper.multi .item .remove:hover,
.schedule-report-select + .ts-wrapper.multi .item .remove:focus {
  background: rgba(251, 191, 36, 0.2);
}

.schedule-report-select + .ts-wrapper.multi .ts-dropdown {
  margin-top: 0.3rem !important;
  border-top: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.schedule-report-company-filter,
.schedule-report-site-filter,
.schedule-report-site-point-filter {
  min-width: 0;
  min-height: auto;
}

.schedule-report-filter-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.schedule-report-filter-summary {
  color: rgba(216, 226, 242, 0.72);
  font-size: var(--font-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.schedule-report-site-point-filter + .ts-wrapper.multi .item {
  position: relative;
  display: block;
  padding: 0.6rem 3rem 0.55rem 0.7rem;
}

.schedule-report-site-point-filter + .ts-wrapper.multi .item .remove {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  margin-right: 0;
}

.schedule-report-site-point-filter + .ts-wrapper .ts-selected-entry {
  display: block;
  min-width: 0;
  max-width: 100%;
}

.schedule-report-site-point-filter + .ts-wrapper .ts-selected-point {
  display: block;
  min-width: 0;
  color: #f7fbff;
  font-size: 0.86rem;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  margin-bottom: 0.18rem;
}

.schedule-report-site-point-filter + .ts-wrapper .ts-selected-site {
  display: block;
  color: #a9bddb;
  font-size: 0.73rem;
  line-height: 1.15;
  max-width: calc(100% - 0.35rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-month-day {
  padding: 1rem;
}

.schedule-month-day-header {
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.schedule-month-day-title {
  margin: 0;
  font-size: var(--font-base);
}

.schedule-table-readonly {
  min-width: 860px;
}

.schedule-table-readonly .schedule-col-site-point {
  width: 32%;
}

.schedule-table-readonly .schedule-col-employee {
  width: 28%;
}

.schedule-table-readonly .schedule-col-phone {
  width: 16%;
}

.schedule-table-readonly .schedule-col-time {
  width: 12%;
}

.schedule-toast-region {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1300;
  width: min(26rem, calc(100vw - 2rem));
  pointer-events: none;
}

.schedule-toast-region .alert {
  box-shadow: var(--shadow-md);
  margin-bottom: 0.5rem;
  pointer-events: auto;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.schedule-toast-region .alert.toast-leaving {
  opacity: 0;
  transform: translateY(-0.4rem);
}

.schedule-confirmation-fallback-actions {
  --cluster-gap: 0.5rem;
}

.schedule-confirmation-fallback-actions .btn {
  white-space: nowrap;
}

.schedule-company-group {
  margin-bottom: 1.5rem;
}

.schedule-grid-shell {
  position: relative;
}

.schedule-grid-skeleton {
  display: none;
}

.schedule-grid-shell.is-loading > turbo-frame#schedule-grid {
  display: none;
}

.schedule-grid-shell.is-loading .schedule-grid-skeleton {
  display: block;
}

.schedule-skeleton-card {
  overflow: hidden;
}

.schedule-skeleton-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1.25fr 0.8fr 0.8fr 1fr;
  gap: 0.75rem;
  padding: 0.65rem 0;
}

.schedule-skeleton-line {
  height: 0.85rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--surface-subtle) 0%,
    var(--bg-surface) 50%,
    var(--surface-subtle) 100%
  );
  background-size: 220% 100%;
  animation: schedule-skeleton-shimmer 1.15s linear infinite;
}

.schedule-skeleton-line--title {
  width: min(18rem, 50%);
}

.schedule-skeleton-line--short {
  width: 70%;
}

.schedule-skeleton-line--tiny {
  width: 60%;
}

@keyframes schedule-skeleton-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -20% 0; }
}

/* Schedule table container - horizontal scroll on small screens */
.schedule-table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(59, 130, 246, 0.24);
  border-radius: var(--radius-md);
  background: linear-gradient(120deg, rgba(8, 17, 30, 0.94) 0%, rgba(12, 24, 41, 0.9) 44%, rgba(8, 17, 30, 0.96) 100%);
}

.schedule-table {
  --schedule-drag-column-width: 2.75rem;
  --schedule-actions-column-width: 6.8rem;
  --schedule-content-columns-width: calc(100% - var(--schedule-drag-column-width) - var(--schedule-actions-column-width));
  --schedule-time-column-width: calc(var(--schedule-content-columns-width) * 0.2);
  table-layout: fixed;
  width: 100%;
  min-width: 940px;
  border-collapse: separate;
  border-spacing: 0;
}

.schedule-table:not(.schedule-table-readonly) {
  --schedule-time-column-width: 7.4rem;
  --schedule-content-columns-width: calc(100% - var(--schedule-drag-column-width) - var(--schedule-actions-column-width) - var(--schedule-time-column-width));
}

.schedule-table th {
  padding: 0.875rem 0.95rem;
  background: rgba(8, 17, 30, 0.92);
  color: var(--stellar-gold-bright);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(59, 130, 246, 0.34);
  white-space: nowrap;
}

.schedule-table tbody td {
  padding: 0.95rem 1rem;
  background: linear-gradient(105deg, rgba(8, 17, 30, 0.84) 0%, rgba(11, 23, 40, 0.9) 100%);
  border-bottom: 1px solid rgba(59, 130, 246, 0.14);
  vertical-align: middle;
  line-height: 1.3;
}

.schedule-table th + th,
.schedule-table tbody td + td {
  border-left: 1px solid rgba(59, 130, 246, 0.2);
}

.schedule-col-drag {
  width: var(--schedule-drag-column-width);
  min-width: var(--schedule-drag-column-width);
  max-width: var(--schedule-drag-column-width);
  padding-inline: 0.25rem !important;
  box-sizing: border-box;
}

.schedule-col-site-point {
  width: calc(var(--schedule-content-columns-width) * 0.38);
}

.schedule-table:not(.schedule-table-readonly) .schedule-col-site-point {
  width: calc(var(--schedule-content-columns-width) * 0.46);
}

.schedule-col-employee {
  width: calc(var(--schedule-content-columns-width) * 0.42);
}

.schedule-table:not(.schedule-table-readonly) .schedule-col-employee {
  width: calc(var(--schedule-content-columns-width) * 0.54);
}

.schedule-col-time {
  width: var(--schedule-time-column-width);
}

.schedule-col-actions,
.schedule-actions-cell {
  width: var(--schedule-actions-column-width);
  min-width: var(--schedule-actions-column-width);
  max-width: var(--schedule-actions-column-width);
}

.schedule-data-row:hover td {
  background: linear-gradient(110deg, rgba(16, 30, 50, 0.9) 0%, rgba(12, 29, 50, 0.94) 100%);
}

/* Site group header row */
.schedule-site-row td {
  background: linear-gradient(90deg, rgba(26, 52, 88, 0.58) 0%, rgba(19, 37, 62, 0.7) 45%, rgba(10, 22, 38, 0.9) 100%);
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-main);
  padding: 0.78rem 1.1rem;
  border-top: 1px solid rgba(59, 130, 246, 0.4);
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

.schedule-site-row td i {
  color: var(--stellar-gold);
  margin-right: 0.55rem;
}

.schedule-site-row .drag-handle {
  margin-right: 0.5rem;
}

.schedule-primary-text {
  color: var(--text-bright);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.15;
}

.schedule-employee-status {
  margin-top: 0.3rem;
}

.schedule-employee-status .badge {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  padding: 0.28rem 0.55rem;
}

.schedule-employee-phone {
  margin-top: 0.18rem;
  color: #9eb4d4;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84rem;
  letter-spacing: 0.05em;
  line-height: 1.15;
}

.schedule-secondary-text {
  margin-top: 0.14rem;
  color: #94a9c8;
  font-size: 0.84rem;
  line-height: 1.2;
}

.schedule-phone-cell {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84rem;
  letter-spacing: 0.02em;
  color: #c6d6eb;
  white-space: nowrap;
}

.schedule-time-cell {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: #d2def1;
  white-space: nowrap;
}

.schedule-time-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.28rem;
  font-variant-numeric: tabular-nums;
}

.schedule-time-item {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  line-height: 1;
}

.schedule-time-item i {
  width: 0.88rem;
  font-size: 0.72rem;
  text-align: center;
}

.schedule-time-item:first-child i {
  color: #63d69f;
}

.schedule-time-item:last-child i {
  color: #f3bf64;
}

.schedule-time-value {
  line-height: 1;
}

.schedule-actions-cell {
  padding: 0.55rem 0.5rem !important;
}

.schedule-unassigned td {
  background: linear-gradient(105deg, rgba(60, 43, 14, 0.5) 0%, rgba(46, 34, 13, 0.54) 100%);
}

.schedule-unassigned:hover td {
  background: linear-gradient(110deg, rgba(76, 54, 18, 0.54) 0%, rgba(61, 46, 20, 0.58) 100%);
}

.schedule-overloaded td {
  background: linear-gradient(110deg, rgba(88, 20, 28, 0.62) 0%, rgba(58, 16, 28, 0.68) 100%);
}

.schedule-overloaded:hover td {
  background: linear-gradient(110deg, rgba(108, 24, 34, 0.68) 0%, rgba(74, 19, 35, 0.74) 100%);
}

@media (max-width: 768px) {
  .schedule-toolbar-controls {
    align-items: stretch;
  }

  .schedule-toolbar-field,
  .schedule-toolbar-buttons {
    flex-basis: 100%;
  }

  .schedule-toolbar-input {
    width: 100%;
    max-width: none;
  }

  .schedule-toolbar-buttons {
    justify-content: flex-start;
  }

  .schedule-toolbar-buttons .btn {
    width: 100%;
  }

  .schedule-toolbar-actions {
    width: 100%;
    justify-content: flex-start;
    padding-top: 0;
  }

  .schedule-toolbar-actions .btn {
    width: 100%;
  }

  .schedule-report-fields {
    grid-template-columns: 1fr;
  }

  .schedule-report-field--period,
  .schedule-report-field--site-points {
    grid-column: auto;
  }

  .schedule-report-actions .btn {
    width: 100%;
  }

  .schedule-report-filter-label-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .schedule-report-select + .ts-wrapper.multi .item {
    width: 100%;
    justify-content: space-between;
  }

  .schedule-skeleton-row {
    grid-template-columns: 1fr 1fr;
  }

  .schedule-toast-region {
    right: 1rem;
    left: 1rem;
    width: auto;
  }
}

/* --- 19. DRAG AND DROP SORTING --- */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
}

.drag-handle:hover {
  color: var(--text-main);
}

.drag-handle:active {
  cursor: grabbing;
}

/* Div-based dragging (sites_management page) */
div[data-sortable-level="company"].dragging,
div[data-sortable-level="site"].dragging,
div[data-sortable-level="sitePoint"].dragging {
  height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  pointer-events: none;
  opacity: 0;
}

/* Site level dragging (table row - schedule page) */
tr[data-sortable-level="site"].dragging {
  opacity: 0.5;
}

tr[data-sortable-level="site"].dragging td {
  background: var(--primary-light);
}

/* Rows being dragged as a group (site + its data rows) */
tr.dragging-group {
  opacity: 0.5;
}

tr.dragging-group td {
  background: var(--primary-light);
}

/* SitePoint (table row) dragging - schedule page */
tr[data-sortable-level="sitePoint"].dragging {
  opacity: 0.5;
}

tr[data-sortable-level="sitePoint"].dragging td {
  background: var(--primary-light);
}

/* Placeholder for div elements */
div.sortable-placeholder {
  background: var(--surface-subtle);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
}

/* Placeholder for table rows */
tr.sortable-placeholder {
  background: transparent;
}

tr.sortable-placeholder td,
tr.sortable-placeholder .sortable-placeholder-cell {
  background: var(--surface-subtle);
  border-top: 2px dashed var(--primary);
  border-bottom: 2px dashed var(--primary);
}

.schedule-table .drag-handle-cell {
  width: var(--schedule-drag-column-width);
  min-width: var(--schedule-drag-column-width);
  max-width: var(--schedule-drag-column-width);
  padding: 0.72rem 0.25rem !important;
  text-align: center;
  box-sizing: border-box;
}


.card-header .drag-handle {
  margin-right: 0.5rem;
}

/* 20. PAGINATION */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: var(--font-sm);
  color: var(--text-muted);
}

.pagination-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pagination-links nav.pagy {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pagination-links a,
.pagination-links span.current,
.pagination-links span.gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  font-size: var(--font-sm);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.pagination-links a {
  color: var(--text-muted);
  border: 1px solid var(--border);
  background-color: var(--bg-surface);
}

.pagination-links a:hover:not([aria-disabled="true"]) {
  color: var(--text-main);
  background-color: var(--bg-app);
  border-color: #d1d5db;
}

/* Current page - Pagy uses aria-disabled on the current page link */
.pagination-links a[aria-disabled="true"],
.pagination-links a.current,
.pagination-links span.current {
  background-color: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  font-weight: 500;
  cursor: default;
  pointer-events: none;
}

.pagination-links span.gap {
  color: var(--text-muted);
  border: none;
}

/* 21. COLLAPSIBLE SECTION UTILITIES */
.hidden {
  display: none !important;
}

[data-collapsible-section-target="toggle"] span {
  display: none;
}

[data-collapsible-section-target="toggle"][data-visible="false"] span[data-show-when="false"] {
  display: inline;
}

[data-collapsible-section-target="toggle"][data-visible="true"] span[data-show-when="true"] {
  display: inline;
}

/* --- 22. SCHEDULE ACTIONS --- */
.schedule-actions {
  display: flex;
  align-items: center;
  justify-content: center;
}

.schedule-action-buttons {
  --schedule-action-size: 1.85rem;
  width: auto;
  display: grid;
  grid-template-columns: repeat(2, var(--schedule-action-size));
  grid-auto-rows: var(--schedule-action-size);
  gap: 0.28rem;
  justify-content: center;
}

.schedule-action-buttons--single {
  grid-template-columns: var(--schedule-action-size);
}

.schedule-action-buttons .button_to {
  margin: 0;
}

.schedule-action-btn {
  width: var(--schedule-action-size);
  height: var(--schedule-action-size);
  justify-content: center;
  min-height: var(--schedule-action-size);
  padding: 0;
  border-radius: 0.56rem;
  border-width: 1px;
  box-shadow: none;
  font-size: 0.86rem;
  letter-spacing: 0;
  text-align: center;
  line-height: 1;
  white-space: nowrap;
  text-shadow: none;
}

.schedule-action-btn--icon {
  min-height: var(--schedule-action-size);
  padding: 0;
  font-size: 0.88rem;
  letter-spacing: 0;
}

.schedule-action-btn--icon i {
  line-height: 1;
}

.schedule-action-btn::before {
  display: none;
}

.schedule-action-btn:hover {
  transform: translateY(-1px);
}

.schedule-action-btn--edit {
  background: linear-gradient(180deg, rgba(46, 61, 80, 0.86) 0%, rgba(35, 47, 62, 0.86) 100%);
  border-color: rgba(130, 154, 188, 0.38);
  color: #d8e2f2;
}

.schedule-action-btn--request {
  background: linear-gradient(180deg, rgba(27, 145, 101, 0.9) 0%, rgba(21, 120, 84, 0.92) 100%);
  border-color: rgba(95, 221, 165, 0.45);
  color: #e5fff3;
}

.schedule-action-btn--confirm {
  background: linear-gradient(180deg, rgba(36, 72, 120, 0.88) 0%, rgba(30, 61, 101, 0.9) 100%);
  border-color: rgba(113, 169, 247, 0.52);
  color: #d6e8ff;
}

.schedule-action-btn--reject {
  background: linear-gradient(180deg, rgba(182, 61, 64, 0.9) 0%, rgba(146, 48, 51, 0.92) 100%);
  border-color: rgba(245, 123, 123, 0.46);
  color: #ffe3e3;
}

.schedule-actions-empty {
  color: #8195b4;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 1200px) {
  .schedule-report-fields {
    grid-template-columns: repeat(2, minmax(16rem, 1fr));
  }

  .schedule-report-field--period,
  .schedule-report-field--site-points {
    grid-column: 1 / -1;
  }

  .schedule-table {
    min-width: 900px;
  }

  .schedule-col-actions,
  .schedule-actions-cell {
    width: 6.4rem;
    min-width: 6.4rem;
  }
}

@media (max-width: 992px) {
  .schedule-report-fields {
    grid-template-columns: 1fr;
  }

  .schedule-report-field--period,
  .schedule-report-field--site-points {
    grid-column: auto;
  }

  .schedule-table {
    min-width: 860px;
  }

  .schedule-col-actions,
  .schedule-actions-cell {
    width: 6rem;
    min-width: 6rem;
  }

  .schedule-primary-text {
    font-size: 0.93rem;
  }

  .schedule-secondary-text {
    font-size: 0.76rem;
  }

  .schedule-time-cell {
    font-size: 0.9rem;
  }
}

.cluster-tight {
  --cluster-gap: 0.5rem;
}

.events-index-filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  width: 100%;
}

.events-index-filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.events-index-empty-state {
  text-align: center;
}

@media (max-width: 640px) {
  .events-index-filter-actions {
    align-items: stretch;
  }

  .events-index-filter-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

.align-center {
  align-items: center;
}

.employee-rg-number {
  flex: 1;
}

.employee-rg-digit {
  width: 4rem;
}

.whatsapp-settings-stack {
  --stack-space: 1.5rem;
  max-width: 600px;
}

.alert--danger {
  background: var(--status-red-bg);
  color: var(--status-red-text);
}

.card--fusion {
  background: linear-gradient(180deg, rgba(14, 19, 32, 0.95), rgba(10, 14, 24, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  overflow: hidden;
}

.card__headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0.75rem;
  gap: 1rem;
}

.badge-soft {
  background: rgba(92, 225, 197, 0.12);
  color: #8bf0d7;
  border: 1px solid rgba(92, 225, 197, 0.35);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}

.fusion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  padding: 0 1.5rem 1.5rem;
  align-items: start;
}

.preview-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-title {
  color: #cdd6e5;
  font-weight: 600;
  font-size: 0.95rem;
}

.editor-panel {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.label-title {
  display: block;
  font-weight: 700;
  color: #e7ecf5;
}

.label-hint {
  display: block;
  color: #94a4c0;
  font-size: 0.9rem;
  margin-top: 0.25rem;
  line-height: 1.3;
}

.textarea-shell {
  margin-top: 0.75rem;
}

.textarea-chrome {
  background: rgba(7, 10, 18, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 30px rgba(0, 0, 0, 0.25);
}

.fusion-textarea {
  background: transparent;
  color: #f0f4fb;
  border: none;
  width: 100%;
  padding: 0.9rem 1rem;
  resize: vertical;
  min-height: 180px;
}

.fusion-textarea::placeholder {
  color: rgba(233, 238, 245, 0.72);
}

.textarea-footer {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0.5rem 0.1rem;
  color: #7f90ae;
  font-size: 0.85rem;
}

.actions-row {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn--wide {
  padding-inline: 1.2rem;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.06);
  color: #dbe5f8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn--primary:hover,
.btn--primary:focus {
  border-color: #36c28a;
  box-shadow: 0 0 0 3px rgba(54, 194, 138, 0.2);
}

.btn--ghost:hover,
.btn--ghost:focus {
  border-color: #36c28a;
  color: #8bf0d7;
}

.message-preview {
  position: relative;
  border: 1px solid transparent;
  background-image:
    linear-gradient(145deg, rgba(54, 194, 138, 0.35), rgba(54, 194, 138, 0)),
    linear-gradient(145deg, rgba(9, 15, 30, 0.9), rgba(12, 20, 36, 0.95));
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  white-space: pre-wrap;
  font-family: ui-monospace, "SFMono-Regular", menlo, monaco, consolas, "Liberation Mono", "Courier New", monospace;
  color: #e9eef5;
  line-height: 1.6;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  margin: 0;
}

.user-guide-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.user-guide-nav-card {
  position: sticky;
  top: 1.5rem;
}

.user-guide-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.user-guide-nav-link {
  text-decoration: none;
  color: var(--text-main);
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.user-guide-nav-link:hover {
  background: var(--surface-subtle);
  border-color: var(--border);
}

.user-guide-content {
  min-width: 0;
}

.user-guide-flow-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.user-guide-flow {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.user-guide-flow:first-child {
  border-top: none;
  padding-top: 0;
}

.user-guide-flow-title {
  margin: 0;
  font-size: var(--font-base);
  font-weight: 600;
}

.user-guide-label {
  font-weight: 600;
  margin-right: 0.35rem;
}

.user-guide-steps {
  padding-left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.user-guide-troubleshooting-list {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.user-guide-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.user-guide-media-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  background: var(--surface-subtle);
}

.user-guide-media-card figcaption {
  font-size: var(--font-sm);
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.user-guide-media-trigger {
  display: block;
  width: 100%;
  border: none;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}

.user-guide-media-card img,
.user-guide-media-card video {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
}

.user-guide-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2200;
  background: rgba(2, 6, 23, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.user-guide-lightbox-dialog {
  position: relative;
  max-width: min(96vw, 1400px);
  max-height: 96vh;
  width: 100%;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.user-guide-lightbox-media {
  width: 100%;
  max-height: calc(96vh - 6rem);
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.user-guide-lightbox-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.84);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.user-guide-lightbox-caption {
  color: #f3f4f6;
  font-size: var(--font-sm);
  margin: 0;
}

body.user-guide-lightbox-open {
  overflow: hidden;
}

@media (max-width: 1100px) {
  .user-guide-layout {
    grid-template-columns: 1fr;
  }

  .user-guide-nav-card {
    position: static;
  }
}
