/* ============================================
   Coach Cavanagh Swim School - PWA Styles
   ============================================ */

:root {
  /* Colors */
  --bg-primary: #0a1628;
  --bg-secondary: #111d33;
  --bg-card: #162038;
  --bg-card-hover: #1c2a48;
  --bg-input: #1c2a48;
  --border: #243352;
  --border-light: #2d4068;

  --text-primary: #f0f4f8;
  --text-secondary: #8899b4;
  --text-muted: #5a6d8a;

  --accent: #0ea5e9;
  --accent-hover: #38bdf8;
  --accent-glow: rgba(14, 165, 233, 0.15);
  --accent-bg: rgba(14, 165, 233, 0.1);

  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);

  /* Level colors */
  --level-dolphin: #60a5fa;
  --level-starfish: #f59e0b;
  --level-clownfish: #f97316;
  --level-seaturtle: #22c55e;
  --level-platypus: #8b5cf6;
  --level-octopus: #ec4899;
  --level-jellyfish: #06b6d4;
  --level-whale: #6366f1;
  --level-shark: #ef4444;

  /* Spacing */
  --nav-height: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  padding-top: var(--safe-top);
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

#screen-container {
  flex: 1;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Typography */
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.375rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

/* ============================================
   Bottom Navigation
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn.active {
  color: var(--accent);
}

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

/* ============================================
   Common Components
   ============================================ */
.hidden { display: none !important; }

.screen {
  padding: 20px 16px;
  animation: fadeIn 0.2s ease;
}

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

.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 4px 0;
}

.screen-header h1 {
  flex: 1;
}

.back-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.back-btn:active {
  background: var(--bg-card-hover);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  transition: background 0.15s;
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:active {
  background: var(--bg-card-hover);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

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

.btn-primary:active {
  background: var(--accent-hover);
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:active {
  background: var(--bg-card-hover);
}

.btn-success {
  background: var(--success);
  color: white;
}

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

.btn-warning {
  background: var(--warning);
  color: #1a1a1a;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 16px 28px;
  font-size: 1.0625rem;
  border-radius: var(--radius-lg);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-accent {
  background: var(--accent-bg);
  color: var(--accent);
}

/* Progress bar */
.progress-bar {
  height: 8px;
  background: var(--bg-input);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--accent);
  transition: width 0.5s ease;
}

.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

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

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238899b4' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

/* Chips / Tags */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
}

.chip.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

/* Level indicator */
.level-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.level-banner {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

/* Rating buttons */
.rating-group {
  display: flex;
  gap: 8px;
}

.rating-btn {
  flex: 1;
  padding: 10px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.rating-btn.selected-1 {
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
}

.rating-btn.selected-2 {
  border-color: var(--warning);
  background: var(--warning-bg);
  color: var(--warning);
}

.rating-btn.selected-3 {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}

/* ============================================
   Student Select Screen
   ============================================ */
.student-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--nav-height) - 40px);
  min-height: calc(100dvh - var(--nav-height) - 40px);
  padding: 40px 20px;
  text-align: center;
}

.student-select .logo {
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
}

.student-select h1 {
  margin-bottom: 4px;
}

.student-select .subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 500px;
  margin-bottom: 20px;
}

.student-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.student-card:active {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: scale(0.98);
}

.student-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 auto 10px;
}

.student-card h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.student-card .level-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* ============================================
   Dashboard
   ============================================ */
.dash-greeting {
  margin-bottom: 4px;
}

.dash-student-name {
  color: var(--accent);
}

.dash-subtitle {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 20px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  margin-top: 8px;
}

.section-header h2 {
  font-size: 1.125rem;
}

.see-all {
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
}

/* Current level card */
.current-level-card {
  padding: 0;
  overflow: hidden;
}

.current-level-header {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.level-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.level-info h3 {
  font-size: 1rem;
  margin-bottom: 2px;
}

.level-info .progress-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.current-level-progress {
  padding: 0 16px 16px;
}

.milestone-preview {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
}

.milestone-preview .status-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  flex-shrink: 0;
}

.milestone-preview .status-icon.done {
  background: var(--success);
  color: white;
}

.milestone-preview .status-icon.active {
  background: var(--warning);
  color: white;
}

.milestone-preview .status-icon.pending {
  background: var(--bg-input);
  border: 2px solid var(--border);
}

/* Quick actions */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.quick-action-btn:active {
  background: var(--bg-card-hover);
  transform: scale(0.98);
}

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

/* Recent sessions */
.session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.session-date {
  text-align: center;
  min-width: 44px;
}

.session-date .day {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.session-date .month {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.session-details {
  flex: 1;
}

.session-details h4 {
  font-size: 0.9375rem;
  margin-bottom: 2px;
}

.session-details p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* ============================================
   Progress Screen
   ============================================ */
.level-accordion {
  margin-bottom: 8px;
}

.level-accordion-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  width: 100%;
  text-align: left;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.15s;
}

.level-accordion-header:active {
  background: var(--bg-card-hover);
}

.level-accordion-header .chevron {
  margin-left: auto;
  transition: transform 0.2s;
  color: var(--text-muted);
}

.level-accordion-header.open .chevron {
  transform: rotate(180deg);
}

.level-accordion-header.open {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: none;
}

.level-accordion-body {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 4px 0;
  display: none;
}

.level-accordion-body.open {
  display: block;
}

.milestone-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

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

.milestone-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
  color: transparent;
  font-size: 0.75rem;
}

.milestone-check.done {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.milestone-check.active {
  border-color: var(--warning);
  background: var(--warning-bg);
  color: var(--warning);
}

.milestone-text {
  flex: 1;
}

.milestone-text h4 {
  font-size: 0.9375rem;
  font-weight: 500;
}

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

.milestone-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.level-progress-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.level-progress-summary .progress-bar {
  width: 60px;
}

/* ============================================
   Lesson Builder
   ============================================ */
.lesson-segment {
  margin-bottom: 16px;
}

.segment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.segment-time {
  background: var(--accent-bg);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.segment-title {
  font-weight: 600;
  font-size: 1rem;
}

.activity-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.activity-slot:active {
  background: var(--bg-card-hover);
}

.activity-slot.filled {
  border-style: solid;
  border-color: var(--border);
  background: var(--bg-card);
}

.activity-slot .slot-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
}

.activity-slot .slot-content {
  flex: 1;
}

.activity-slot .slot-content h4 {
  font-size: 0.9375rem;
}

.activity-slot .slot-content p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.add-activity-text {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ============================================
   Lesson Conductor (Poolside Mode)
   ============================================ */
.conductor {
  padding: 12px;
}

.conductor-timer {
  text-align: center;
  padding: 16px;
  margin-bottom: 12px;
}

.timer-segment-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.timer-display {
  font-size: 4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 8px;
  color: var(--accent);
}

.timer-total {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.timer-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.conductor-segments {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding: 2px;
}

.conductor-seg-btn {
  flex: 1;
  min-width: 0;
  padding: 10px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.conductor-seg-btn.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

.conductor-seg-btn.completed {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}

/* Conductor activity card - large touch targets */
.conductor-activity {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}

.conductor-activity h3 {
  font-size: 1.125rem;
  margin-bottom: 8px;
}

.conductor-activity .coaching-cues {
  background: var(--accent-bg);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 12px;
}

.conductor-activity .coaching-cues h4 {
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.conductor-activity .coaching-cues li {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-left: 16px;
  line-height: 1.6;
}

.conductor-activity .equipment {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* SVG illustration container */
.skill-illustration {
  width: 100%;
  max-width: 300px;
  margin: 12px auto;
  display: block;
}

.skill-illustration svg {
  width: 100%;
  height: auto;
}

/* ============================================
   Activity Browser
   ============================================ */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.activity-card {
  padding: 14px 16px;
}

.activity-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.activity-emoji {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.activity-card-header .info {
  flex: 1;
}

.activity-card-header h3 {
  font-size: 1rem;
  margin-bottom: 2px;
}

.activity-card-header .tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.activity-card-header .tag {
  font-size: 0.6875rem;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--bg-input);
  color: var(--text-muted);
}

.activity-card .description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.activity-card .steps {
  list-style: none;
  padding: 0;
}

.activity-card .steps li {
  position: relative;
  padding-left: 20px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.activity-card .steps li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
}

.video-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 0.8125rem;
  text-decoration: none;
  font-weight: 500;
  margin-top: 8px;
}

/* ============================================
   Session History
   ============================================ */
.history-item {
  padding: 14px 16px;
}

.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.history-item-header h3 {
  font-size: 1rem;
}

.history-item-header .date {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.history-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.history-note {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* ============================================
   Settings
   ============================================ */
.settings-section {
  margin-bottom: 24px;
}

.settings-section h2 {
  font-size: 1rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: -1px;
  cursor: pointer;
}

.settings-item:first-of-type {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.settings-item:last-of-type {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  margin-bottom: 0;
}

.settings-item:only-of-type {
  border-radius: var(--radius-md);
}

.settings-item:active {
  background: var(--bg-card-hover);
}

.settings-item-label {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-item-label svg {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

/* ============================================
   Modal / Overlay
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  animation: fadeInOverlay 0.2s ease;
  padding: var(--safe-top) 0 0 0;
}

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

.modal-sheet {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 16px calc(20px + var(--safe-bottom));
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border-light);
  border-radius: 100px;
  margin: 0 auto 16px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 1.25rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.125rem;
}

/* ============================================
   Toast Notification
   ============================================ */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  z-index: 300;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: toastIn 0.3s ease;
  white-space: nowrap;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 20px;
}

/* ============================================
   Token Bank (Dashboard)
   ============================================ */
.token-bank {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  margin-bottom: 16px;
  cursor: pointer;
  background: linear-gradient(135deg, #162038 0%, #1c2a48 100%);
  border: 1px solid #f59e0b30;
  transition: border-color 0.2s;
}
.token-bank:active {
  border-color: #f59e0b60;
}
.token-bank-left {
  text-align: center;
  min-width: 70px;
}
.token-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.token-icon {
  font-size: 1.5rem;
}
.token-count {
  font-size: 1.75rem;
  font-weight: 700;
  color: #f59e0b;
}
.token-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.token-bank-right {
  flex: 1;
}
.points-display {
  font-size: 1.125rem;
  letter-spacing: 2px;
  margin-bottom: 2px;
}
.points-dots {
  color: var(--text-muted);
}
.points-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.token-bank-arrow {
  flex-shrink: 0;
}

/* ============================================
   Token Shop (Modal)
   ============================================ */
.token-shop-balance {
  text-align: center;
  padding: 16px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.token-shop-tokens {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}
.token-icon-lg {
  font-size: 2rem;
}
.token-count-lg {
  font-size: 2.5rem;
  font-weight: 800;
  color: #f59e0b;
}
.token-shop-points {
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.token-shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.shop-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  transition: all 0.2s;
}
.shop-item.affordable {
  border-color: #f59e0b40;
}
.shop-item.locked {
  opacity: 0.55;
}
.shop-item-emoji {
  font-size: 2rem;
  margin-bottom: 6px;
}
.shop-item-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.shop-item-cost {
  font-size: 0.8125rem;
  color: #f59e0b;
  margin-bottom: 8px;
}
.shop-buy-btn {
  width: 100%;
}
.token-shop-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.reward-log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.reward-log-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================
   Award Point Button (Conductor)
   ============================================ */
.btn-award-point {
  background: #f59e0b20;
  color: #f59e0b;
  border: 1px solid #f59e0b40;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
}
.btn-award-point:active {
  background: #f59e0b40;
  transform: scale(0.95);
}
.btn-award-point.awarded {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success);
}

/* ============================================
   Sync Status Indicator
   ============================================ */
.sync-indicator {
  position: fixed;
  top: calc(var(--safe-top, 0px) + 8px);
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-secondary);
  z-index: 9999;
  backdrop-filter: blur(10px);
  transition: opacity 0.3s;
}
.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.sync-dot.syncing {
  background: var(--warning);
  animation: syncPulse 1s ease-in-out infinite;
}
.sync-dot.synced {
  background: var(--success);
}
.sync-dot.error {
  background: var(--danger);
}
@keyframes syncPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============================================
   Activity Filter Sections
   ============================================ */
.filter-section {
  margin-bottom: 12px;
}
.filter-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  font-weight: 600;
}

/* ============================================
   Responsive
   ============================================ */
@media (min-width: 768px) {
  .screen {
    max-width: 700px;
    margin: 0 auto;
    padding: 24px 20px;
  }

  .student-grid {
    max-width: 500px;
  }

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

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

/* ============================================
   Print Styles
   ============================================ */
@media print {
  .bottom-nav, .toast { display: none; }
  body { background: white; color: black; }
  .card { border-color: #ddd; }
}
