/* =============================================
   Driving School Manager — Main Stylesheet
   ============================================= */

:root {
  --ds-primary: #1d4ed8;
  --ds-primary-light: #3b82f6;
  --ds-primary-dark: #1e3a5f;
  --ds-success: #16a34a;
  --ds-success-light: #22c55e;
  --ds-warning: #d97706;
  --ds-warning-light: #f59e0b;
  --ds-danger: #dc2626;
  --ds-danger-light: #ef4444;
  --ds-bg: #f0f4f8;
  --ds-surface: #ffffff;
  --ds-surface-hover: #f8fafc;
  --ds-border: #e2e8f0;
  --ds-text: #1e293b;
  --ds-text-muted: #64748b;
  --ds-text-subtle: #94a3b8;
  --ds-radius: 12px;
  --ds-radius-sm: 8px;
  --ds-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
  --ds-shadow-lg: 0 4px 24px rgba(0,0,0,.12);
  --ds-header-h: 68px;
}

* { box-sizing: border-box; }

.ds-wrap {
  min-height: 100vh;
  background: var(--ds-bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ds-text);
}

/* ---- HEADER ---- */
.ds-header {
  background: var(--ds-primary-dark);
  height: var(--ds-header-h);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.ds-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.ds-header-brand { display: flex; align-items: center; gap: 12px; color: white; text-decoration: none; }
.ds-logo-icon {
  width: 40px; height: 40px; background: rgba(255,255,255,.15);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
}
.ds-brand-name { font-size: 1.1rem; font-weight: 700; color: white; }
.ds-brand-role { font-size: .75rem; color: rgba(255,255,255,.6); }
.ds-header-actions { display: flex; align-items: center; gap: 12px; }
.ds-user-greeting { color: rgba(255,255,255,.8); font-size: .875rem; }

/* ---- NAV TABS ---- */
.ds-nav-tabs {
  background: var(--ds-surface);
  border-bottom: 1px solid var(--ds-border);
  display: flex;
  gap: 0;
  padding: 0 24px;
  overflow-x: auto;
}
.ds-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 16px 20px;
  font-size: .875rem; font-weight: 500;
  color: var(--ds-text-muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all .2s;
}
.ds-tab:hover { color: var(--ds-primary-light); }
.ds-tab.active { color: var(--ds-primary-light); border-bottom-color: var(--ds-primary-light); }

/* ---- CARDS ---- */
.ds-card {
  background: var(--ds-surface);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
  overflow: hidden;
  margin-bottom: 20px;
}
.ds-card-full { width: 100%; }
.ds-card-header {
  padding: 16px 20px;
  font-weight: 600;
  font-size: .9rem;
  border-bottom: 1px solid var(--ds-border);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ds-primary-dark);
}
.ds-card-header button, .ds-card-header .ds-btn { margin-left: auto; }
.ds-card-subtitle { margin-left: auto; font-size: .75rem; color: var(--ds-text-muted); font-weight: 400; }

/* ---- LAYOUT ---- */
.ds-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
}
.ds-content-main { min-width: 0; }

/* ---- BUTTONS ---- */
.ds-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: .875rem; font-weight: 500;
  cursor: pointer; border: none; text-decoration: none;
  transition: all .2s; line-height: 1;
}
.ds-btn-primary { background: var(--ds-primary-light); color: white; }
.ds-btn-primary:hover { background: var(--ds-primary); color: white; }
.ds-btn-outline { background: transparent; color: var(--ds-primary-light); border: 1.5px solid var(--ds-primary-light); }
.ds-btn-outline:hover { background: var(--ds-primary-light); color: white; }
.ds-btn-danger { background: var(--ds-danger-light); color: white; }
.ds-btn-danger:hover { background: var(--ds-danger); }
.ds-btn-sm { padding: 6px 12px; font-size: .8rem; }
.ds-btn-xs { padding: 4px 8px; font-size: .75rem; border-radius: 6px; }
.ds-btn-full { width: 100%; justify-content: center; }
.ds-btn-link { background: none; border: none; cursor: pointer; font-size: .8rem; color: var(--ds-primary-light); padding: 0 4px; }
.ds-btn-link.ds-danger { color: var(--ds-danger); }
.ds-logout-btn { background: rgba(255,255,255,.1); color: rgba(255,255,255,.9); border: 1px solid rgba(255,255,255,.2); }
.ds-logout-btn:hover { background: rgba(255,255,255,.2); }

/* ---- FORMS ---- */
.ds-form { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.ds-form-group { display: flex; flex-direction: column; gap: 6px; }
.ds-form-group label { font-size: .8rem; font-weight: 600; color: var(--ds-text-muted); }
.ds-form-group input, .ds-form-group textarea, .ds-form-group select {
  padding: 10px 14px;
  border: 1.5px solid var(--ds-border);
  border-radius: 8px;
  font-size: .875rem;
  color: var(--ds-text);
  outline: none;
  transition: border .2s;
  background: var(--ds-surface);
}
.ds-form-group input:focus, .ds-form-group textarea:focus, .ds-form-group select:focus {
  border-color: var(--ds-primary-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.ds-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.ds-form-actions { display: flex; gap: 12px; padding-top: 4px; }

/* ---- AUTH / LOGIN ---- */
.ds-auth-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.ds-auth-card {
  background: white;
  border-radius: 20px;
  width: 100%; max-width: 440px;
  box-shadow: var(--ds-shadow-lg);
  overflow: hidden;
}
.ds-auth-logo {
  background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%);
  padding: 36px 32px 28px;
  text-align: center; color: white;
}
.ds-auth-logo-icon {
  width: 72px; height: 72px;
  background: rgba(255,255,255,.2);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.ds-auth-logo h1 { font-size: 1.5rem; margin: 0 0 8px; font-weight: 700; }
.ds-auth-logo p { margin: 0; opacity: .8; font-size: .9rem; }
.ds-form-links { text-align: center; font-size: .85rem; }
.ds-form-links a { color: var(--ds-primary-light); text-decoration: none; }
.ds-form-links a:hover { text-decoration: underline; }

/* ---- NOTICES ---- */
.ds-notice {
  padding: 12px 16px; border-radius: 8px; font-size: .875rem; margin-bottom: 16px;
}
.ds-notice-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.ds-notice-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* ---- PUPIL LIST ---- */
.ds-pupil-list { padding: 8px 0; }
.ds-pupil-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  text-decoration: none; color: var(--ds-text);
  transition: background .15s;
  border-left: 3px solid transparent;
}
.ds-pupil-item:hover { background: var(--ds-surface-hover); }
.ds-pupil-item.active { background: #eff6ff; border-left-color: var(--ds-primary-light); }
.ds-pupil-avatar {
  width: 38px; height: 38px; background: var(--ds-primary-dark);
  color: white; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.ds-pupil-name { font-weight: 500; font-size: .875rem; }
.ds-pupil-meta { font-size: .75rem; color: var(--ds-text-muted); }

/* ---- TRAFFIC LIGHTS ---- */
.ds-traffic-light {
  display: inline-block; width: 14px; height: 14px;
  border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0,0,0,.1);
}
.tl-green  { background: var(--ds-success-light); box-shadow: 0 0 6px rgba(34,197,94,.5); }
.tl-amber  { background: var(--ds-warning-light);  box-shadow: 0 0 6px rgba(245,158,11,.5); }
.tl-red    { background: var(--ds-danger-light);   box-shadow: 0 0 6px rgba(239,68,68,.5); }
.tl-grey   { background: var(--ds-text-subtle); }

/* ---- PUPIL DETAIL ---- */
.ds-pupil-detail-header {
  display: flex; align-items: center; gap: 16px; padding: 20px;
  flex-wrap: wrap;
}
.ds-pupil-detail-avatar {
  width: 56px; height: 56px; background: var(--ds-primary-dark);
  color: white; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; flex-shrink: 0;
}
.ds-pupil-detail-info { flex: 1; min-width: 180px; }
.ds-pupil-detail-info h2 { margin: 0 0 6px; font-size: 1.2rem; }
.ds-pupil-detail-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: .8rem; color: var(--ds-text-muted); }
.ds-pupil-detail-badges { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.ds-pupil-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.ds-badge {
  display: inline-flex; align-items: center;
  background: #f1f5f9; color: var(--ds-text-muted);
  padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 500;
}
.ds-badge-blue { background: #eff6ff; color: var(--ds-primary-light); }

.ds-detail-grid {
  display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start;
  padding: 0;
}
.ds-detail-left { min-width: 0; }
.ds-detail-right { min-width: 0; }

/* ---- LESSONS ---- */
.ds-lesson-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid var(--ds-border);
}
.ds-lesson-row:last-child { border-bottom: none; }
.ds-lesson-date { text-align: center; min-width: 44px; }
.ds-lesson-day { font-size: 1.3rem; font-weight: 700; line-height: 1; color: var(--ds-primary-dark); }
.ds-lesson-month { font-size: .7rem; color: var(--ds-text-muted); text-transform: uppercase; }
.ds-lesson-info { flex: 1; min-width: 0; }
.ds-lesson-title { font-weight: 500; font-size: .875rem; }
.ds-lesson-preview { font-size: .78rem; color: var(--ds-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 250px; }
.ds-lesson-grade { font-size: .875rem; font-weight: 600; color: var(--ds-primary-light); min-width: 40px; }
.ds-lesson-actions { display: flex; gap: 6px; }

.ds-status-badge {
  padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 600; text-transform: uppercase;
}
.status-scheduled { background: #eff6ff; color: #1d4ed8; }
.status-completed  { background: #f0fdf4; color: #16a34a; }
.status-cancelled  { background: #fef2f2; color: #dc2626; }

/* ---- COACHING SUGGESTIONS ---- */
.ds-coaching-card .ds-card-header { color: #7c3aed; }
.ds-suggestion { padding: 12px 16px; border-bottom: 1px solid var(--ds-border); }
.ds-suggestion:last-child { border-bottom: none; }
.ds-suggestion-skill { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.ds-suggestion-skill strong { font-size: .875rem; }
.ds-suggestion p { margin: 0; font-size: .8rem; color: var(--ds-text-muted); line-height: 1.5; }
.ds-coaching-inline { background: #f5f3ff; border-radius: 8px; padding: 12px; margin-bottom: 16px; }
.ds-coaching-inline .ds-suggestion-inline { margin-bottom: 8px; font-size: .8rem; }

.ds-grade-mini {
  display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: .75rem; font-weight: 600;
}
.grade-0 { background: #f1f5f9; color: #64748b; }
.grade-1 { background: #fef2f2; color: #dc2626; }
.grade-2 { background: #fef9c3; color: #854d0e; }
.grade-3 { background: #fff7ed; color: #c2410c; }
.grade-4 { background: #f0fdf4; color: #16a34a; }
.grade-5 { background: #dcfce7; color: #15803d; }

/* ---- TEST READINESS CARD ---- */
.ds-readiness-card .ds-card-header { color: #0891b2; }
.ds-readiness-body { padding: 16px; }
.ds-readiness-ready { display: flex; align-items: flex-start; gap: 12px; }
.ds-readiness-icon { width: 40px; height: 40px; background: var(--ds-success-light); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.ds-readiness-window { }
.ds-readiness-label { font-size: .75rem; text-transform: uppercase; color: var(--ds-text-muted); font-weight: 600; letter-spacing: .05em; }
.ds-readiness-dates { font-size: 1rem; font-weight: 700; color: var(--ds-primary-dark); margin: 4px 0; }
.ds-readiness-weeks { font-size: .8rem; color: var(--ds-text-muted); margin-bottom: 10px; }
.ds-readiness-bar-track { background: #e5e7eb; border-radius: 20px; height: 8px; overflow: hidden; }
.ds-readiness-bar { background: linear-gradient(90deg, #3b82f6, #22c55e); height: 100%; border-radius: 20px; transition: width 1s ease; }
.ds-readiness-bar-hours { background: linear-gradient(90deg, #f59e0b, #22c55e); }
.ds-readiness-basis { font-size: .75rem; color: var(--ds-text-muted); margin-top: 10px; font-style: italic; }
.ds-readiness-unknown { font-size: .875rem; color: var(--ds-text-muted); padding: 4px 0; }
.ds-readiness-disclaimer { margin-top: 14px; padding-top: 12px; border-top: 1px solid #e5e7eb; font-size: .75rem; color: #9ca3af; line-height: 1.5; }

/* ---- SKILLS SECTION ---- */
.ds-skills-section { padding: 0 20px 16px; }
.ds-skills-section h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ds-text-muted); margin: 0 0 12px; }
.ds-skill-category { margin-bottom: 16px; }
.ds-skill-cat-header {
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ds-primary-dark); background: #f8fafc;
  padding: 6px 0; margin-bottom: 8px; border-bottom: 1px solid var(--ds-border);
}
.ds-skill-grid { display: flex; flex-direction: column; gap: 8px; }
.ds-skill-item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ds-skill-name { font-size: .8rem; min-width: 200px; flex: 1; }
.ds-grade-selector { display: flex; gap: 4px; flex-wrap: wrap; }
.ds-grade-opt { cursor: pointer; }
.ds-grade-opt input { display: none; }
.ds-grade-opt span {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 6px;
  background: #f1f5f9; color: var(--ds-text-muted);
  font-size: .8rem; font-weight: 600;
  transition: all .15s; border: 2px solid transparent;
}
.ds-grade-opt input:checked + span { background: var(--ds-primary-light); color: white; border-color: var(--ds-primary); }
.ds-grade-opt:hover span { background: #e2e8f0; }

/* Grade badge */
.ds-grade-badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: .78rem; font-weight: 600;
}

/* ---- SKILL MANAGEMENT ---- */
.ds-skills-manage { max-width: 1400px; margin: 0 auto; padding: 24px; }
.ds-skill-cat-section { padding: 0 0 16px; }
.ds-skill-cat-title { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; background: #f8fafc; border-top: 2px solid var(--ds-primary-light); font-weight: 600; }
.ds-skill-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--ds-border); }
.ds-skill-row:last-child { border-bottom: none; }
.ds-skill-row-name { flex: 1; font-size: .875rem; }
.ds-skill-row-desc { font-size: .78rem; color: var(--ds-text-muted); }
.ds-skill-row-actions { display: flex; gap: 6px; }
.ds-meta { font-size: .78rem; color: var(--ds-text-muted); }

/* ---- WELCOME CARD ---- */
.ds-welcome-card { padding: 40px; text-align: center; }
.ds-welcome-icon { font-size: 3rem; margin-bottom: 16px; }
.ds-welcome-card h2 { font-size: 1.4rem; color: var(--ds-primary-dark); margin: 0 0 8px; }
.ds-welcome-card p { color: var(--ds-text-muted); }
.ds-stats-row { display: flex; justify-content: center; gap: 40px; margin-top: 24px; }
.ds-stat-item { text-align: center; }
.ds-stat-num { font-size: 2.5rem; font-weight: 800; color: var(--ds-primary-light); }
.ds-stat-label { font-size: .8rem; color: var(--ds-text-muted); }

/* ---- PUPIL DASHBOARD ---- */
.ds-pupil-hero {
  background: linear-gradient(135deg, var(--ds-primary-dark) 0%, var(--ds-primary) 100%);
  padding: 32px 24px;
  display: flex; align-items: center; gap: 32px; flex-wrap: wrap;
}
.ds-hero-progress { text-align: center; color: white; }
.ds-progress-circle-wrap svg { filter: drop-shadow(0 4px 12px rgba(0,0,0,.2)); }
.ds-hero-label { font-size: .8rem; color: rgba(255,255,255,.7); margin-top: 8px; text-transform: uppercase; letter-spacing: .08em; }
.ds-hero-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.ds-stat-card {
  background: rgba(255,255,255,.12); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--ds-radius);
  padding: 20px 24px; text-align: center; color: white; min-width: 120px;
}
.ds-stat-icon { font-size: 1.5rem; margin-bottom: 8px; }
.ds-stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.ds-stat-label { font-size: .75rem; opacity: .75; margin-top: 4px; }
.ds-hero-readiness { flex: 1; min-width: 260px; }
.ds-hero-readiness .ds-readiness-card { background: rgba(255,255,255,.95); border-radius: var(--ds-radius); margin: 0; }

.ds-pupil-grid {
  display: grid; grid-template-columns: 1fr 340px; gap: 24px;
  max-width: 1400px; margin: 0 auto; padding: 24px; align-items: start;
}
.ds-pupil-main { min-width: 0; }
.ds-pupil-sidebar { min-width: 0; }

/* ---- TIMELINE ---- */
.ds-timeline { padding: 8px 20px; }
.ds-timeline-item { display: flex; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--ds-border); position: relative; }
.ds-timeline-item:last-child { border-bottom: none; }
.ds-timeline-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ds-primary-light); flex-shrink: 0; margin-top: 4px; box-shadow: 0 0 0 3px rgba(59,130,246,.2); }
.ds-timeline-item.status-completed .ds-timeline-dot { background: var(--ds-success-light); }
.ds-timeline-item.status-cancelled .ds-timeline-dot { background: var(--ds-text-subtle); }
.ds-timeline-content { flex: 1; min-width: 0; }
.ds-timeline-header { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.ds-timeline-date { font-weight: 600; font-size: .875rem; color: var(--ds-primary-dark); }
.ds-timeline-meta { font-size: .78rem; color: var(--ds-text-muted); flex: 1; }
.ds-grade-overall { background: var(--ds-primary-light); color: white; padding: 2px 10px; border-radius: 12px; font-size: .78rem; font-weight: 700; }
.ds-lesson-notes { font-size: .8rem; color: var(--ds-text-muted); margin: 8px 0; padding: 8px 12px; background: #f8fafc; border-radius: 6px; border-left: 3px solid var(--ds-border); }
.ds-more-info-btn { margin: 8px 0; }
.ds-lesson-detail { margin-top: 12px; padding: 12px; background: #f8fafc; border-radius: 8px; }
.ds-skill-group { margin-bottom: 12px; }
.ds-skill-group-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ds-text-muted); margin-bottom: 6px; }
.ds-skill-score-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; }
.ds-skill-score-name { font-size: .8rem; }

/* ---- COMMENTS ---- */
.ds-comment { padding: 10px 14px; border-radius: 8px; margin: 8px 0; }
.ds-comment-instructor { background: #eff6ff; border-left: 3px solid var(--ds-primary-light); }
.ds-comment-pupil { background: #f0fdf4; border-left: 3px solid var(--ds-success-light); }
.ds-comment-header { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; font-size: .78rem; }
.ds-comment-author { font-weight: 600; }
.ds-comment-time { color: var(--ds-text-subtle); }
.ds-comment-body { font-size: .85rem; line-height: 1.5; }
.ds-instr-comments { margin-bottom: 8px; }
.ds-add-comment { margin-top: 10px; display: flex; gap: 8px; align-items: flex-start; }
.ds-comment-input { flex: 1; padding: 8px 12px; border: 1.5px solid var(--ds-border); border-radius: 8px; font-size: .8rem; resize: none; min-height: 60px; outline: none; transition: border .2s; }
.ds-comment-input:focus { border-color: var(--ds-primary-light); }

/* ---- IMPROVE/FOCUS AREAS ---- */
.ds-improve-card { }
.ds-improve-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--ds-border); }
.ds-improve-item:last-child { border-bottom: none; }
.ds-improve-rank { width: 24px; height: 24px; background: var(--ds-danger-light); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex-shrink: 0; }
.ds-improve-name { flex: 1; font-size: .8rem; font-weight: 500; }
.ds-improve-score { display: flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 600; color: var(--ds-text-muted); min-width: 80px; }
.ds-mini-bar { width: 50px; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.ds-mini-bar-fill { height: 100%; background: var(--ds-danger-light); border-radius: 3px; }

/* ---- SKILL OVERVIEW ---- */
.ds-skill-overview-cat { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--ds-border); }
.ds-skill-overview-cat:last-child { border-bottom: none; }
.ds-skill-overview-cat-name { flex: 1; font-size: .78rem; color: var(--ds-text); }
.ds-skill-overview-bar { flex: 1; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.ds-skill-overview-fill { height: 100%; border-radius: 3px; transition: width .8s ease; }
.ds-skill-overview-score { font-size: .78rem; font-weight: 600; min-width: 30px; text-align: right; color: var(--ds-text-muted); }

/* ---- UPCOMING ---- */
.ds-upcoming-item { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--ds-border); }
.ds-upcoming-item:last-child { border-bottom: none; }
.ds-upcoming-date-block { text-align: center; background: var(--ds-primary-dark); color: white; border-radius: 8px; padding: 8px 12px; min-width: 50px; }
.ds-upcoming-day { font-size: 1.3rem; font-weight: 800; line-height: 1; }
.ds-upcoming-month { font-size: .7rem; opacity: .75; text-transform: uppercase; }
.ds-upcoming-time { font-weight: 600; font-size: .9rem; }
.ds-upcoming-meta { font-size: .78rem; color: var(--ds-text-muted); }

/* ---- LOGO (login page only) ---- */
.ds-auth-logo-img-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}
.ds-auth-logo-img {
    max-height: 90px;
    max-width: 260px;
    width: auto;
    object-fit: contain;
}

/* ---- CALENDAR ---- */
.ds-calendar-wrap {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box;
}
.ds-calendar-wrap .ds-card { width: 100%; }
#ds-calendar {
  padding: 20px;
  width: 100%;
  min-width: 0;
}
.fc {
  font-family: inherit;
  width: 100% !important;
}
.fc-toolbar-title { font-size: 1.1rem !important; font-weight: 700 !important; }
.fc-toolbar { flex-wrap: wrap; gap: 8px; }
.fc-button-primary {
  background: var(--ds-primary-light) !important;
  border-color: var(--ds-primary) !important;
  border-radius: 6px !important;
  font-size: .82rem !important;
}
.fc-event {
  border-radius: 6px !important;
  font-size: .78rem !important;
  padding: 2px 6px !important;
  border: none !important;
}
.fc-daygrid-body { width: 100% !important; }
.fc-scrollgrid { width: 100% !important; }
.fc-view-harness { width: 100% !important; }

/* ---- CALENDAR — Content area override ---- */
.ds-content.ds-calendar-wrap {
  display: block;    /* override the two-column grid when on calendar tab */
  padding: 24px;
}

@media (max-width: 768px) {
  .ds-calendar-wrap { padding: 12px; }
  #ds-calendar { padding: 10px; }
  .fc-toolbar-title { font-size: .9rem !important; }
  .fc-button-primary { padding: 4px 8px !important; font-size: .75rem !important; }
  .fc-toolbar { gap: 4px; }
}

/* ---- CURRICULUM CARD ---- */
.ds-curriculum-card { }
.ds-curriculum-picker { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ds-curriculum-current { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .875rem; }
.ds-curriculum-label { color: var(--ds-text-muted); }
.ds-curriculum-change { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ds-curriculum-select {
    padding: 8px 12px; border: 1.5px solid var(--ds-border); border-radius: 8px;
    font-size: .875rem; flex: 1; min-width: 200px; outline: none;
    background: white; cursor: pointer;
}
.ds-curriculum-select:focus { border-color: var(--ds-primary-light); }
.ds-curriculum-badge {
    display: inline-block; padding: 2px 10px; background: #ede9fe; color: #7c3aed;
    border-radius: 12px; font-size: .75rem; font-weight: 600; margin-left: 8px;
}
.ds-skills-section h4 { display: flex; align-items: center; }

/* ---- PARENTS ---- */
.ds-parent-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--ds-border); }
.ds-parent-item:last-child { border-bottom: none; }
.ds-parent-avatar { width: 32px; height: 32px; background: #7c3aed; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; }

/* ---- MODALS ---- */
.ds-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
}
.ds-modal-content {
  background: var(--ds-surface);
  border-radius: var(--ds-radius);
  width: 100%; max-width: 580px;
  box-shadow: var(--ds-shadow-lg);
  max-height: 90vh; overflow-y: auto;
}
.ds-modal-lg { max-width: 900px; }
.ds-modal-header {
  padding: 16px 20px;
  font-weight: 700; font-size: 1rem;
  border-bottom: 1px solid var(--ds-border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: white; z-index: 1;
}
.ds-modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--ds-text-muted); line-height: 1; padding: 0; }
.ds-modal-close:hover { color: var(--ds-text); }

/* ---- EMPTY STATES ---- */
.ds-empty-state { padding: 32px; text-align: center; color: var(--ds-text-muted); font-size: .875rem; }
.ds-empty-state-sm { padding: 12px 16px; color: var(--ds-text-muted); font-size: .8rem; }

/* ---- ADMIN WRAP ---- */
.ds-admin-wrap { margin-top: 20px; }

/* =============================================
   MOBILE RESPONSIVE
   ============================================= */

/* --- Tablet (≤1024px) --- */
@media (max-width: 1024px) {
    .ds-content {
        grid-template-columns: 260px 1fr;
        padding: 16px;
        gap: 16px;
    }
    .ds-detail-grid { grid-template-columns: 1fr; }
    .ds-pupil-grid { grid-template-columns: 1fr; }
    .ds-pupil-sidebar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    .ds-pupil-sidebar > .ds-card { margin-bottom: 0; }
}

/* --- Collapse sidebar (≤900px) --- */
@media (max-width: 900px) {
    .ds-content { grid-template-columns: 1fr; }
}

/* --- Mobile (≤768px) --- */
@media (max-width: 768px) {

    /* Header */
    .ds-header { height: auto; min-height: 56px; }
    .ds-header-inner { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
    .ds-user-greeting { display: none; }
    .ds-brand-name { font-size: 1rem; }
    .ds-brand-role { font-size: .7rem; }
    .ds-logo-icon { width: 34px; height: 34px; border-radius: 8px; }

    /* Nav tabs */
    .ds-nav-tabs { padding: 0 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .ds-nav-tabs::-webkit-scrollbar { display: none; }
    .ds-tab { padding: 12px 14px; font-size: .8rem; white-space: nowrap; }
    .ds-tab svg { display: none; }

    /* Layout */
    .ds-content { grid-template-columns: 1fr; padding: 12px; gap: 12px; }
    .ds-calendar-wrap { padding: 12px; }
    .ds-skills-manage { padding: 12px; }
    .ds-pupil-grid { grid-template-columns: 1fr; padding: 12px; gap: 12px; }
    .ds-pupil-sidebar { display: block; }
    .ds-detail-grid { grid-template-columns: 1fr; }

    /* Cards */
    .ds-card { border-radius: 10px; margin-bottom: 12px; }
    .ds-card-header { padding: 12px 14px; font-size: .85rem; flex-wrap: wrap; gap: 8px; }

    /* Buttons */
    .ds-btn { padding: 9px 14px; font-size: .82rem; }
    .ds-btn-sm { padding: 6px 10px; font-size: .78rem; }
    .ds-btn-xs { padding: 4px 8px; font-size: .72rem; }
    .ds-logout-btn { padding: 6px 10px; font-size: .78rem; }

    /* Forms */
    .ds-form { padding: 14px; gap: 12px; }
    .ds-form-row { grid-template-columns: 1fr; }
    .ds-form-actions { flex-direction: column; }
    .ds-form-actions .ds-btn { justify-content: center; }

    /* Auth / Login */
    .ds-auth-wrap { padding: 12px; align-items: flex-start; padding-top: 40px; }
    .ds-auth-card { border-radius: 16px; }
    .ds-auth-logo { padding: 24px 20px 20px; }
    .ds-auth-logo h1 { font-size: 1.3rem; }

    /* Pupil hero */
    .ds-pupil-hero { flex-direction: column; align-items: stretch; padding: 20px 14px; gap: 20px; }
    .ds-hero-progress { display: flex; align-items: center; gap: 16px; text-align: left; }
    .ds-hero-label { font-size: .75rem; margin-top: 0; }
    .ds-hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .ds-stat-card { padding: 14px 8px; min-width: 0; }
    .ds-stat-icon { font-size: 1.2rem; margin-bottom: 4px; }
    .ds-stat-value { font-size: 1.4rem; }
    .ds-stat-label { font-size: .68rem; }
    .ds-hero-readiness .ds-readiness-card { margin: 0; }

    /* Pupil detail header */
    .ds-pupil-detail-header { flex-direction: column; align-items: flex-start; padding: 14px; gap: 12px; }
    .ds-pupil-detail-actions { margin-left: 0; width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
    .ds-pupil-detail-actions .ds-btn { flex: 1; justify-content: center; }

    /* Lessons */
    .ds-lesson-row { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
    .ds-lesson-preview { max-width: 100%; white-space: normal; }
    .ds-lesson-actions { margin-left: auto; }

    /* Timeline */
    .ds-timeline { padding: 8px 10px; }
    .ds-timeline-item { gap: 10px; padding: 14px 0; }
    .ds-timeline-dot { width: 12px; height: 12px; margin-top: 5px; }
    .ds-timeline-header { flex-direction: column; gap: 4px; }
    .ds-timeline-date { font-size: .82rem; }

    /* Skill grading */
    .ds-skill-item { flex-direction: column; align-items: flex-start; gap: 6px; }
    .ds-skill-name { min-width: 0; font-size: .82rem; }
    .ds-grade-selector { gap: 3px; }
    .ds-grade-opt span { width: 34px; height: 34px; font-size: .82rem; border-radius: 8px; }

    /* Skills management */
    .ds-skill-row { flex-wrap: wrap; gap: 6px; padding: 10px 14px; }
    .ds-skill-cat-title { flex-wrap: wrap; gap: 6px; }

    /* Stats row (welcome card) */
    .ds-stats-row { gap: 20px; }

    /* Pupil list */
    .ds-pupil-item { padding: 10px 12px; }

    /* Comments */
    .ds-add-comment { flex-direction: column; }
    .ds-add-comment .ds-btn { align-self: flex-start; }

    /* Improve / focus areas */
    .ds-improve-item { padding: 8px 12px; }

    /* Upcoming */
    .ds-upcoming-item { padding: 10px 14px; }

    /* Modals — slide up from bottom on mobile */
    .ds-modal { padding: 0; align-items: flex-end; }
    .ds-modal-content {
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
        width: 100%;
        max-width: 100%;
    }
    .ds-modal-lg { max-width: 100%; }
    .ds-modal-header { padding: 14px 16px; font-size: .95rem; }
    .ds-skills-section { padding: 0 14px 12px; }

    /* Calendar */
    #ds-calendar { padding: 10px 6px; }
    .fc-toolbar { flex-direction: column; align-items: flex-start; gap: 6px; }
    .fc-toolbar-chunk { display: flex; gap: 4px; flex-wrap: wrap; }
    .fc-toolbar-title { font-size: .95rem !important; }
    .fc-button-primary { padding: 5px 9px !important; font-size: .75rem !important; }
    .fc-daygrid-day-number { font-size: .75rem; }
    .fc-event { font-size: .7rem !important; padding: 1px 4px !important; }
}

/* --- Small mobile (≤480px) --- */
@media (max-width: 480px) {
    .ds-header-inner { padding: 8px 12px; }
    .ds-auth-wrap { padding: 8px; padding-top: 24px; }
    .ds-auth-logo { padding: 20px 16px 16px; }
    .ds-auth-logo-img { max-height: 70px; max-width: 200px; }

    .ds-hero-stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .ds-stat-card { padding: 10px 6px; }
    .ds-stat-value { font-size: 1.2rem; }
    .ds-pupil-hero { padding: 14px 10px; }
    .ds-progress-circle-wrap svg { width: 110px; height: 110px; }

    .ds-form { padding: 12px; }
    .ds-card-header { padding: 10px 12px; }
    .ds-pupil-detail-header { padding: 12px; }
    .ds-pupil-detail-avatar { width: 44px; height: 44px; font-size: 1.1rem; border-radius: 10px; }
    .ds-pupil-detail-info h2 { font-size: 1rem; }

    /* Stack lesson row fully on very small screens */
    .ds-lesson-row { flex-direction: column; gap: 4px; }

    /* Wider tap targets for grade buttons */
    .ds-grade-opt { flex: 1; }
    .ds-grade-opt span { width: 100%; min-width: 0; }
    .ds-grade-selector { width: 100%; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
}


/* ---- Test Booking ---- */
.ds-test-booking-card .ds-card-header { color: #7c3aed; }
.ds-test-booking-body { padding: 14px 16px; }
.ds-test-booked-date { font-size: 1rem; font-weight: 700; color: #1e293b; }
.ds-test-booked-centre { display: flex; align-items: center; gap: 5px; font-size: .82rem; color: #64748b; margin-top: 4px; }
.ds-test-countdown { font-size: .82rem; font-weight: 600; color: #3b82f6; margin-top: 6px; }
.ds-test-soon { color: #dc2626; }
.ds-test-unbooked { padding: 4px 0; }

/* Upcoming tests list on instructor welcome screen */
.ds-upcoming-test-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid #f1f5f9; text-decoration: none; color: inherit; transition: background .15s; }
.ds-upcoming-test-row:last-child { border-bottom: none; }
.ds-upcoming-test-row:hover { background: #f8fafc; }
.ds-upcoming-test-avatar { width: 34px; height: 34px; border-radius: 50%; background: #ede9fe; color: #7c3aed; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; flex-shrink: 0; }
.ds-upcoming-test-info { flex: 1; min-width: 0; }
.ds-upcoming-test-name { font-weight: 600; font-size: .9rem; color: #1e293b; }
.ds-upcoming-test-detail { font-size: .78rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-upcoming-test-days { font-size: .8rem; font-weight: 700; color: #3b82f6; flex-shrink: 0; }
.ds-upcoming-test-days.ds-test-soon { color: #dc2626; }

/* Pupil portal booked test card */
.ds-test-booked-pupil-card .ds-card-header { color: #7c3aed; }
