:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --border: #475569;
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #38bdf8;
  --primary-dark: #0ea5e9;
  --success: #4ade80;
  --danger: #f87171;
  --warning: #fbbf24;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.dashboard-layout {
  display: flex;
  min-height: 100vh;
  --sidebar-width: 260px;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-x: hidden;
  overflow-y: auto;
  transition: width 0.25s ease, padding 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
  z-index: 1000;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 999;
}

body.sidebar-drawer-open {
  overflow: hidden;
}

.dashboard-layout.sidebar-collapsed .sidebar {
  width: 0;
  padding: 0;
  opacity: 0;
  border-right: none;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 8px;
}

.sidebar-brand strong {
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  color: var(--primary);
}

.sidebar-brand span {
  font-size: 0.8rem;
  color: var(--muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 12px 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px;
  min-height: 44px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-icon-filled {
  fill: currentColor;
  stroke: none;
}

.sidebar-link.active .sidebar-icon {
  stroke-width: 2.25;
}

.sidebar-link:hover {
  background: var(--surface-hover);
}

.sidebar-link.active {
  background: var(--primary);
  color: #0f172a;
  font-weight: 600;
}

.dashboard-main {
  flex: 1;
  min-width: 0;
  padding: 24px;
  overflow-y: auto;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

#dashboard-view.active {
  display: block;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header-start {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.sidebar-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 9px;
  margin-top: 2px;
  flex-shrink: 0;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sidebar-toggle:hover {
  background: var(--border);
}

.sidebar-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.dashboard-layout:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.dashboard-layout:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(2) {
  opacity: 0;
}

.dashboard-layout:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 1024px) {
  .dashboard-layout:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(1),
  .dashboard-layout:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(2),
  .dashboard-layout:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(3) {
    transform: none;
    opacity: 1;
  }

  .dashboard-layout.sidebar-open .sidebar-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .dashboard-layout.sidebar-open .sidebar-toggle span:nth-child(2) {
    opacity: 0;
  }

  .dashboard-layout.sidebar-open .sidebar-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

.page-header h1 {
  margin: 0;
  font-size: 1.75rem;
}

.subtitle {
  color: var(--muted);
  margin: 4px 0 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.card + .card {
  margin-top: 20px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.25rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.875rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  font-size: 0.95rem;
}

input[type="file"] {
  padding: 8px;
  cursor: pointer;
}

.field-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.image-preview {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  max-width: 320px;
  background: #0b1220;
}

.image-preview img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: cover;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #0f172a;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: #7f1d1d;
  color: var(--text);
}

.btn-danger:hover {
  background: #991b1b;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.panel-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-toolbar h2 {
  margin: 0 0 4px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr.student-row-clickable {
  cursor: pointer;
}

.data-table tbody tr.student-row-clickable:hover,
.data-table tbody tr.student-row-clickable:focus-visible {
  background: rgba(56, 189, 248, 0.08);
  outline: none;
}

.table-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 140px;
}

.table-progress-bar {
  flex: 1;
  min-width: 72px;
  height: 8px;
}

.table-progress-value {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.student-detail-toolbar {
  margin-bottom: 16px;
}

#student-progress-detail-view #progress-container {
  max-width: 420px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  white-space: nowrap;
}

.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 14px !important;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.alert-error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid var(--danger);
  color: #fecaca;
}

.alert-success {
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid var(--success);
  color: #bbf7d0;
}

.alert-warning {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid #f59e0b;
  color: #fde68a;
}

.medical-expiry-alert ul {
  margin: 8px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Smart search above the student progress grid */
.student-search-bar {
  position: relative;
  margin-bottom: 14px;
}

.student-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

#student-search-input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.95rem;
}

#student-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Documentation status column */
.docs-col {
  text-align: center;
  white-space: nowrap;
}

.docs-complete-check {
  color: var(--success, #22c55e);
  font-size: 1rem;
  font-weight: 700;
}

.docs-incomplete {
  color: var(--muted);
}

.medical-expiry-flag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  color: #f59e0b;
  font-size: 0.9rem;
  vertical-align: middle;
}

.nav-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  width: min(100%, 480px);
  max-height: calc(100vh - 48px);
  overflow: auto;
}

body.modal-open {
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.tab-btn {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--primary);
  color: #0f172a;
  border-color: var(--primary);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.login-bg-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.login-bg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 6, 23, 0.62);
  z-index: 1;
}

/* Subtle grid pattern over the video, fading toward the edges */
.login-bg-grid {
  position: fixed;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.09) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 30%, transparent 100%);
  pointer-events: none;
}

/* Drifting aurora glow blobs */
.login-aurora {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.35;
  z-index: 1;
  pointer-events: none;
  animation: login-aurora-drift 14s ease-in-out infinite alternate;
}

.login-aurora-1 {
  background: #0ea5e9;
  top: -140px;
  left: -120px;
}

.login-aurora-2 {
  background: #6366f1;
  bottom: -160px;
  right: -120px;
  animation-delay: -7s;
}

@keyframes login-aurora-drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(60px, 40px) scale(1.15); }
}

/* Animated shine border wrapper (adapted from Magic UI "Shine Border") */
.login-card-shine {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 430px;
  border-radius: 20px;
  padding: 1.5px;
  background: linear-gradient(115deg,
    rgba(56, 189, 248, 0.9),
    rgba(99, 102, 241, 0.55),
    rgba(56, 189, 248, 0.12),
    rgba(99, 102, 241, 0.55),
    rgba(56, 189, 248, 0.9));
  background-size: 300% 300%;
  animation: login-shine 7s linear infinite;
}

@keyframes login-shine {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.login-card {
  width: 100%;
  border-radius: 18.5px;
  padding: 36px 32px 28px;
  background: rgba(11, 18, 32, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 70px rgba(2, 6, 23, 0.6);
}

.brand {
  text-align: center;
  margin-bottom: 28px;
}

.brand-badge {
  display: inline-block;
  padding: 4px 14px;
  margin-bottom: 14px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
  color: #7dd3fc;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0;
  font-size: 2.6rem;
  letter-spacing: 0.14em;
  font-weight: 800;
}

/* Animated gradient text (adapted from Magic UI "Animated Gradient Text") */
.brand-gradient-text {
  background: linear-gradient(90deg, #38bdf8, #818cf8, #e2e8f0, #38bdf8);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: login-gradient-text 6s linear infinite;
}

@keyframes login-gradient-text {
  to { background-position: 250% 0; }
}

.brand p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-form-group {
  margin-bottom: 18px;
}

.login-input-wrap {
  position: relative;
}

.login-input-wrap svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  fill: none;
  stroke: #64748b;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: stroke 0.2s;
}

.login-input-wrap input {
  padding-left: 40px;
  background: rgba(2, 6, 23, 0.55);
  border-color: rgba(71, 85, 105, 0.7);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.login-input-wrap input:focus + svg,
.login-input-wrap:focus-within svg {
  stroke: var(--primary);
}

/* Shimmer sign-in button (adapted from Magic UI "Shimmer Button") */
.btn-login-shimmer {
  position: relative;
  width: 100%;
  margin-top: 6px;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(14, 165, 233, 0.35);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.btn-login-shimmer::after {
  content: "";
  position: absolute;
  top: 0;
  left: -80%;
  width: 60%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  animation: login-btn-shimmer 2.75s ease-in-out infinite;
  pointer-events: none;
}

@keyframes login-btn-shimmer {
  0%   { left: -80%; }
  55%  { left: 130%; }
  100% { left: 130%; }
}

.btn-login-shimmer:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(14, 165, 233, 0.45);
  filter: brightness(1.06);
}

.btn-login-shimmer:active {
  transform: translateY(0);
}

.btn-login-shimmer:disabled {
  opacity: 0.7;
  cursor: wait;
}

.login-footnote {
  margin: 22px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8125rem;
}

.login-page-logo {
  position: fixed;
  top: 20px;
  left: 24px;
  width: 144px;
  height: 144px;
  object-fit: contain;
  z-index: 3;
  filter: drop-shadow(0 4px 14px rgba(2, 6, 23, 0.6));
}

/* On narrow viewports the fixed logo would overlap the card — hide it,
   the card carries the branding. */
@media (max-width: 900px) {
  .login-page-logo {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-aurora,
  .login-card-shine,
  .brand-gradient-text,
  .btn-login-shimmer::after {
    animation: none;
  }
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.student-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.student-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: #0b1220;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat {
  background: #0b1220;
  border-radius: 8px;
  padding: 10px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
}

.hidden {
  display: none !important;
}

.student-card-clickable {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.student-card-clickable:hover {
  transform: translateY(-2px);
}

.lesson-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.lesson-banner-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 4px 16px;
  margin-bottom: 16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.lesson-banner {
  flex: 0 0 180px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 110px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.lesson-banner:hover {
  border-color: var(--primary);
}

.lesson-banner.active {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.12);
}

.lesson-banner.completed {
  border-color: var(--success);
}

.lesson-banner-number {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
}

.lesson-banner-title {
  font-size: 0.95rem;
  line-height: 1.3;
  flex: 1;
}

.lesson-banner-progress {
  font-size: 0.85rem;
  color: var(--muted);
}

.lesson-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lesson-detail-header h2 {
  margin: 0 0 8px;
}

.lesson-sync-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.lesson-sync-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lesson-action-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.offline-badge,
.pending-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.offline-badge {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.pending-badge {
  background: rgba(56, 189, 248, 0.15);
  color: var(--primary);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.lesson-banner.pending-sync {
  box-shadow: inset 0 0 0 2px rgba(56, 189, 248, 0.45);
}

#submit-lesson-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.readonly-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.15);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.lesson-detail-readonly .checklist-item-readonly {
  cursor: default;
  pointer-events: none;
}

.readonly-notes {
  min-height: 96px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  white-space: pre-wrap;
}

.flight-data-readonly .computed-value {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.lesson-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.lesson-section.expanded .lesson-section-header {
  margin-bottom: 16px;
}

.lesson-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.lesson-section-heading {
  font-size: 1.125rem;
  font-weight: 700;
}

.lesson-section-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.lesson-section.expanded .lesson-section-chevron {
  transform: rotate(90deg);
}

.lesson-section.collapsed .lesson-section-body {
  display: none;
}

.lesson-section-header h3 {
  margin: 0;
}

.section-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--muted);
  white-space: nowrap;
}

.section-badge-active {
  background: rgba(56, 189, 248, 0.2);
  color: var(--primary);
}

.section-badge-complete {
  background: rgba(74, 222, 128, 0.2);
  color: var(--success);
}

.flight-data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  border-radius: 10px;
  background: #0b1220;
}

.computed-value {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-hover);
  font-weight: 700;
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #0b1220;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.checklist-item:hover {
  border-color: var(--border);
}

.checklist-item.checked {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
}

.checklist-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checklist-box {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--border);
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
}

.checklist-item.checked .checklist-box {
  background: var(--success);
  border-color: var(--success);
}

.checklist-item.checked .checklist-box::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 6px;
  height: 11px;
  border: solid #0f172a;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checklist-text {
  line-height: 1.45;
  font-size: 1rem;
}

.student-open-lessons {
  width: 100%;
}

@media (max-width: 1024px) {
  .dashboard-layout {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(var(--sidebar-width), 85vw);
    max-width: 320px;
    transform: translateX(-100%);
    box-shadow: var(--shadow);
  }

  .dashboard-layout.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .dashboard-layout.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .dashboard-layout.sidebar-collapsed .sidebar {
    width: min(var(--sidebar-width), 85vw);
    max-width: 320px;
    padding: 24px 16px;
    opacity: 1;
    border-right: 1px solid var(--border);
  }

  .dashboard-main {
    width: 100%;
    padding: 16px;
  }

  .page-header h1 {
    font-size: 1.4rem;
  }

  .nav-links {
    flex-wrap: wrap;
    gap: 10px;
  }

  .progress-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
  }

  .lesson-banner-scroll {
    margin-left: -4px;
    margin-right: -4px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }

  .lesson-banner {
    min-width: 140px;
  }

  .flight-data-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .airplane-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .panel-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-toolbar .btn {
    width: 100%;
  }

  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .table-actions .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .dashboard-main {
    padding: 12px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header-start {
    width: 100%;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
  }

  .card {
    padding: 16px;
  }

  .progress-grid {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .flight-data-grid {
    grid-template-columns: 1fr;
  }

  .lesson-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .lesson-detail-header-row {
    flex-direction: column;
  }

  .lesson-sync-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .lesson-sync-actions .btn {
    width: 100%;
  }

  .selected-airplane-summary {
    align-items: flex-start;
    width: 100%;
  }

  .checklist-item {
    min-height: 44px;
    padding: 10px 0;
  }

  .login-card {
    padding: 26px 20px 22px;
  }
}

.airplane-selection {
  margin-bottom: 20px;
}

.airplane-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.airplane-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #0b1220;
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.airplane-card:hover,
.airplane-card.selected {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.12);
}

.airplane-card-image {
  aspect-ratio: 4 / 3;
  background: #111827;
  overflow: hidden;
}

.airplane-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.airplane-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 2rem;
  font-weight: 700;
  color: var(--muted);
  background: linear-gradient(135deg, #111827, #1f2937);
}

.airplane-card-body {
  padding: 14px 16px 16px;
}

.airplane-card-body h3 {
  margin: 0 0 6px;
  font-size: 1.125rem;
}

.airplane-card-body p {
  margin: 0;
  color: var(--text);
}

.airplane-card-meta {
  margin-top: 4px !important;
  color: var(--muted) !important;
  font-size: 0.875rem;
}

.lesson-detail-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.selected-airplane-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 180px;
}

.selected-airplane-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.selected-airplane-summary .btn {
  margin-top: 8px;
}

/* ── GPS Tracking ───────────────────────────── */

.btn-gps {
  background: #166534;
  color: #dcfce7;
  border: 1px solid #16a34a;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease;
}

.btn-gps:hover {
  background: #15803d;
}

.gps-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  flex-shrink: 0;
}

.gps-dot-active {
  background: #f87171;
  animation: gps-pulse 1.2s ease-in-out infinite;
}

@keyframes gps-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(1.3); }
}

.gps-status-text {
  font-size: 0.8125rem;
  color: var(--muted);
  display: inline-block;
}

.gps-status-error {
  color: #f87171;
}

.gps-point-count {
  font-size: 0.8125rem;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Flight Map Panel ───────────────────────── */

.flight-map-panel {
  margin-top: 16px;
}

.flight-map-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.flight-map-header h3 {
  margin: 0 0 4px;
}

.flight-map-container {
  width: 100%;
  height: 400px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  z-index: 0;
}

@media (max-width: 768px) {
  .flight-map-container {
    height: 280px;
  }
}

/* ── Schedule ───────────────────────────────── */

.schedule-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.schedule-week-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.schedule-week-label {
  font-size: 0.9375rem;
  font-weight: 600;
  min-width: 150px;
  text-align: center;
}

.schedule-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
}

.schedule-day {
  background: var(--surface);
  min-height: 120px;
  padding: 0;
}

.schedule-day-today {
  background: rgba(56, 189, 248, 0.06);
}

.schedule-day-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px 6px;
  border-bottom: 1px solid var(--border);
  gap: 2px;
}

.schedule-day-name {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

.schedule-day-date {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.schedule-day-date-today {
  background: var(--primary);
  color: #0f172a;
}

.schedule-day-events {
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.schedule-event {
  border-radius: 5px;
  padding: 4px 6px;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-left: 3px solid var(--primary);
  background: rgba(56, 189, 248, 0.12);
  transition: background 0.15s;
}

.schedule-event:hover {
  background: rgba(56, 189, 248, 0.22);
}

.schedule-event.badge-pending {
  border-left-color: #eab308;
  background: rgba(234, 179, 8, 0.15);
}

.schedule-event.badge-pending:hover {
  background: rgba(234, 179, 8, 0.25);
}

.schedule-event.badge-approved {
  border-left-color: #22c55e;
  background: rgba(34, 197, 94, 0.13);
}

.schedule-event.badge-approved:hover {
  background: rgba(34, 197, 94, 0.22);
}

.schedule-event.badge-completed {
  border-left-color: #6b7280;
  background: rgba(107, 114, 128, 0.1);
  opacity: 0.75;
}

.schedule-event.badge-cancelled {
  border-left-color: #6b7280;
  background: rgba(107, 114, 128, 0.08);
  opacity: 0.5;
}

.schedule-event-time {
  font-size: 0.7rem;
  color: var(--muted);
}

.schedule-event-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-event-lesson {
  font-size: 0.7rem;
  color: var(--primary);
}

.schedule-event-pending-dot {
  color: #eab308;
  font-size: 0.6rem;
  margin-left: 3px;
  vertical-align: middle;
}

.schedule-pending-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #a16207;
}

.schedule-pending-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #eab308;
  flex-shrink: 0;
  animation: gps-pulse 1.4s ease-in-out infinite;
}

.btn-approve {
  background: #16a34a;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-approve:hover {
  background: #15803d;
}

.schedule-upcoming-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.schedule-empty {
  color: var(--muted);
  text-align: center;
  padding: 20px 0;
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schedule-list-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.schedule-list-item:hover {
  background: var(--surface-hover);
}

.schedule-list-datetime {
  display: flex;
  flex-direction: column;
  min-width: 72px;
  flex-shrink: 0;
}

.schedule-list-date {
  font-weight: 700;
  font-size: 0.9rem;
}

.schedule-list-time {
  font-size: 0.8125rem;
  color: var(--muted);
}

.schedule-list-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.schedule-list-lesson,
.schedule-list-cfi,
.schedule-list-plane,
.schedule-list-notes {
  font-size: 0.8125rem;
  color: var(--muted);
}

.schedule-list-lesson {
  color: var(--primary);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  align-self: flex-start;
}

.badge-scheduled {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-pending {
  background: rgba(250, 204, 21, 0.15);
  color: #ca8a04;
  border: 1px solid rgba(250, 204, 21, 0.4);
}

.badge-approved {
  background: rgba(74, 222, 128, 0.15);
  color: #16a34a;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.badge-completed {
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-cancelled {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.3);
}

@media (max-width: 768px) {
  .schedule-week-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .schedule-week-grid .schedule-day:nth-child(n+5) {
    display: none;
  }

  .schedule-toolbar-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ── Billing ────────────────────────────────── */

.billing-stats-row {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.billing-stat-card {
  flex: 1;
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.billing-stat-overdue {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.05);
}

.billing-stat-paid {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.05);
}

.billing-stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

.billing-stat-value {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
}

.billing-stat-overdue .billing-stat-value { color: #ef4444; }
.billing-stat-paid .billing-stat-value { color: #22c55e; }

.billing-stat-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  background: #ef4444;
  color: #fff;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
}

.billing-filter-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.form-select-sm {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  min-width: 160px;
}

.invoice-number {
  font-family: monospace;
  font-size: 0.875rem;
  color: var(--muted);
}

.invoice-amount { font-weight: 700; }

.invoice-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 5px;
}

.btn-overdue {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-overdue:hover { background: rgba(239, 68, 68, 0.25); }

.badge-draft {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-sent {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-paid {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-overdue {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
  animation: overdue-pulse 2s ease-in-out infinite;
}

@keyframes overdue-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* ── Overdue flag in student table ── */

.overdue-flag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  color: #ef4444;
  font-size: 0.9rem;
  vertical-align: middle;
  animation: overdue-pulse 2s ease-in-out infinite;
}

/* ── Overdue banner in lesson view ── */

.overdue-payment-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid rgba(239, 68, 68, 0.5);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  color: #b91c1c;
}

.overdue-payment-banner .overdue-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  fill: #ef4444;
  margin-top: 1px;
}

.overdue-payment-banner strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.overdue-payment-banner span {
  font-size: 0.875rem;
  opacity: 0.85;
}

/* ── Hobbs camera button ─────────────────────── */

.hobbs-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hobbs-input-row input[type="number"] {
  flex: 1;
}

.flight-type-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.flight-type-btn {
  flex: 1;
  padding: 8px 18px;
  border: none;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.flight-type-btn + .flight-type-btn {
  border-left: 1px solid var(--border);
}

.flight-type-btn:hover {
  background: var(--surface-hover);
}

.flight-type-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Track Start / Track End datetime inputs in flight data grid */
.flight-data-grid input[type="datetime-local"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: var(--border-radius);
  font-size: 14px;
  color: #374151;
  background: #fff;
}

.track-ts-value {
  font-size: 14px;
  color: #374151;
}

.btn-camera {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.btn-camera:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-camera svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Hobbs photo preview (lesson view) ────────── */

.hobbs-photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.hobbs-uploading {
  font-size: 0.8125rem;
  color: var(--muted);
  font-style: italic;
}

.hobbs-upload-error {
  font-size: 0.8125rem;
  color: #ef4444;
}

.hobbs-thumb {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 120px;
}

.hobbs-thumb img {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--border);
  display: block;
}

.hobbs-thumb a:hover img {
  opacity: 0.85;
}

.hobbs-thumb-meta {
  display: flex;
  flex-direction: column;
  font-size: 0.7rem;
  color: var(--muted);
  gap: 1px;
}

.hobbs-thumb-date { font-weight: 600; }

/* ── Hobbs Timeline panel ─────────────────────── */

.hobbs-timeline {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-bottom: 24px;
}

.hobbs-timeline-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hobbs-timeline-day-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.hobbs-timeline-entry {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.hobbs-timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.hobbs-badge-in { background: #38bdf8; }
.hobbs-badge-out { background: #f59e0b; }

.hobbs-timeline-content {
  display: flex;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  flex: 1;
  align-items: flex-start;
}

.hobbs-timeline-photo-link {
  flex-shrink: 0;
}

.hobbs-timeline-photo {
  width: 90px;
  height: 70px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--border);
  display: block;
  transition: opacity 0.15s;
}

.hobbs-timeline-photo-link:hover .hobbs-timeline-photo {
  opacity: 0.8;
}

.hobbs-timeline-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.hobbs-timeline-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hobbs-timeline-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
}

.hobbs-timeline-badge.hobbs-badge-in { background: #0ea5e9; }
.hobbs-timeline-badge.hobbs-badge-out { background: #d97706; }

.hobbs-reading {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  font-family: monospace;
}

.hobbs-timeline-sub {
  display: flex;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--muted);
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .hobbs-timeline-photo {
    width: 70px;
    height: 55px;
  }

  .hobbs-timeline-content {
    flex-direction: column;
  }
}

/* ── Aircraft Flight Log ──────────────────────────────────── */
.flight-log-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-top: 16px;
}

.flight-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 900px;
}

.flight-log-table thead {
  background: var(--surface-hover);
}

.flight-log-table th {
  background: var(--surface-hover);
  color: var(--muted);
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--border);
}

.flight-log-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
  background: var(--surface);
}

.flight-log-table tbody tr:last-child td { border-bottom: none; }
.flight-log-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.02); }
.flight-log-table tbody tr:hover td { background: var(--surface-hover) !important; }

.flight-log-center { text-align: center; }
.flight-log-total  { font-weight: 700; color: var(--primary); }
.flight-log-ts     { font-size: 12px; white-space: nowrap; color: var(--muted); }
.flight-log-notes  { font-size: 12px; color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.flight-log-loading,
.flight-log-empty,
.flight-log-error {
  text-align: center;
  padding: 32px;
  color: var(--muted);
  font-style: italic;
}
.flight-log-error { color: var(--danger); font-style: normal; }

/* ── Maintenance Panel ─────────────────────────────────────────────────── */
.maint-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.maint-form-card {
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius);
  background: #f8fafc;
}

.maint-form-card h3 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
}

.maint-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.maint-table thead tr {
  background: #f1f5f9;
}

.maint-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.maint-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e8edf2;
  vertical-align: top;
}

.maint-table tbody tr:last-child td { border-bottom: none; }
.maint-table tbody tr:hover td { background: #f8fafc; }

.maint-notes {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maint-tail {
  font-weight: 600;
  white-space: nowrap;
}

/* Priority badges */
.maint-priority-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
  white-space: nowrap;
}

.priority-urgent { background: #fee2e2; color: #b91c1c; }
.priority-medium { background: #fef3c7; color: #92400e; }
.priority-low    { background: #dcfce7; color: #166534; }

/* Status badges */
.maint-status-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.maint-status-open       { background: #dbeafe; color: #1d4ed8; }
.maint-status-inprogress { background: #fef3c7; color: #92400e; }
.maint-status-resolved   { background: #dcfce7; color: #166534; }
.maint-status-closed     { background: #f1f5f9; color: #475569; }

/* Action buttons inside table */
.btn-maint-action {
  padding: 4px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  margin-right: 4px;
  transition: background .15s, border-color .15s;
}

.btn-maint-action:hover     { background: #f1f5f9; }
.btn-maint-status           { border-color: #3b82f6; color: #1d4ed8; }
.btn-maint-status:hover     { background: #eff6ff; }
.btn-maint-delete           { border-color: #ef4444; color: #b91c1c; }
.btn-maint-delete:hover     { background: #fef2f2; }

.maint-actions { white-space: nowrap; }

.maint-loading,
.maint-empty,
.maint-error {
  text-align: center;
  padding: 32px;
  color: #888;
  font-style: italic;
}
.maint-error { color: var(--danger); font-style: normal; }

/* ── Schedule panel light theme ──────────────────────────────────────────
   The schedule view uses a white background so native calendar controls
   (date picker icon, dropdowns) stay visible. Scoped to #schedule-panel. */

#schedule-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 24px;
  color: #0f172a;
  box-shadow: var(--shadow);
  color-scheme: light;
}

#schedule-panel h2,
#schedule-panel .schedule-week-label,
#schedule-panel .schedule-day-date,
#schedule-panel .schedule-list-date {
  color: #0f172a;
}

#schedule-panel .subtitle,
#schedule-panel label,
#schedule-panel .schedule-day-name,
#schedule-panel .schedule-event-time,
#schedule-panel .schedule-list-time,
#schedule-panel .schedule-list-cfi,
#schedule-panel .schedule-list-plane,
#schedule-panel .schedule-list-notes,
#schedule-panel .schedule-list-approved,
#schedule-panel .schedule-upcoming-title,
#schedule-panel .schedule-empty,
#schedule-panel .field-hint {
  color: #64748b;
}

#schedule-panel .schedule-week-grid {
  background: #e2e8f0;
  border-color: #e2e8f0;
}

#schedule-panel .schedule-day {
  background: #ffffff;
}

#schedule-panel .schedule-day-today {
  background: #eff8fe;
}

#schedule-panel .schedule-day-header {
  border-bottom-color: #e2e8f0;
}

#schedule-panel .schedule-day-date-today {
  background: var(--primary);
  color: #ffffff;
}

#schedule-panel .schedule-list-item {
  background: #ffffff;
  border-color: #e2e8f0;
}

#schedule-panel .schedule-list-item:hover {
  background: #f1f5f9;
}

#schedule-panel input,
#schedule-panel select,
#schedule-panel textarea {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

#schedule-panel input:disabled,
#schedule-panel select:disabled,
#schedule-panel textarea:disabled {
  background: #f1f5f9;
  color: #64748b;
}

#schedule-panel .btn-secondary {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

#schedule-panel .btn-secondary:hover {
  background: #e2e8f0;
}

#schedule-panel .alert-error {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
}

#schedule-panel .alert-success {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
}

