/* ══════════════════════════════════════════════
   GradeFlow — styles.css
   Friendly, warm, modern. Sora font. Full light/dark.
══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap');

/* ─── VARIABLES ─── */
:root {
  --bg:          #f0f4f8;
  --surface:     #ffffff;
  --surface2:    #e8edf3;
  --surface3:    #dce3ec;
  --border:      #d1dae6;
  --border2:     #b8c6d6;

  --text:        #0f1e2e;
  --text2:       #4a5f73;
  --text3:       #8fa3b8;

  --accent:      #2563eb;
  --accent2:     #3b7dff;
  --accent-dim:  #dbeafe;
  --accent-dark: #1d4ed8;

  --green:       #16a34a;
  --green-dim:   #dcfce7;
  --green-text:  #14532d;

  --amber:       #c07000;
  --amber-dim:   #fef3c7;
  --amber-text:  #78350f;

  --red:         #dc2626;
  --red-dim:     #fee2e2;
  --red-text:    #7f1d1d;

  --radius:      14px;
  --radius-sm:   8px;
  --radius-lg:   20px;
  --radius-xl:   28px;

  --font:        'Sora', 'Segoe UI', sans-serif;
  --mono:        'JetBrains Mono', 'Consolas', monospace;

  --nav-h:       56px;
  --tab-h:       64px;
  --shadow:      0 2px 16px rgba(37,99,235,0.08);
  --shadow-md:   0 4px 24px rgba(37,99,235,0.13);

  --transition:  0.18s ease;
}

[data-theme="dark"] {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface2:    #1c2230;
  --surface3:    #222d3d;
  --border:      #2a3548;
  --border2:     #364560;

  --text:        #e6edf3;
  --text2:       #8b949e;
  --text3:       #4d5f72;

  --accent:      #3b82f6;
  --accent2:     #60a5fa;
  --accent-dim:  #1a2a45;
  --accent-dark: #60a5fa;

  --green:       #3fb950;
  --green-dim:   #0d2318;
  --green-text:  #7ee8a2;

  --amber:       #d29922;
  --amber-dim:   #2a1e06;
  --amber-text:  #e3b341;

  --red:         #f85149;
  --red-dim:     #2a0d0d;
  --red-text:    #ff7b72;

  --shadow:      0 2px 16px rgba(0,0,0,0.5);
  --shadow-md:   0 4px 24px rgba(0,0,0,0.6);
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding-top: var(--nav-h);
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 8px);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ─── SETUP OVERLAY ─── */
.setup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.setup-overlay.hidden { display: none; }

.setup-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

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

.setup-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

/* setup-logo-mark replaced by inline SVG */

.setup-logo-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.setup-logo-sub {
  font-size: 11px;
  color: var(--text3);
  font-weight: 500;
}

.setup-step { display: none; }
.setup-step.active { display: block; }

.setup-heading {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.setup-hint {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 22px;
  line-height: 1.5;
}

.setup-field {
  margin-bottom: 14px;
}

.setup-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.setup-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.setup-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.setup-input::placeholder { color: var(--text3); }

.setup-btn {
  width: 100%;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 8px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.setup-btn:hover { background: var(--accent-dark); box-shadow: 0 6px 20px rgba(37,99,235,0.4); }
.setup-btn:active { transform: scale(0.97); }

.setup-btn-outline {
  flex: 1;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text2);
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.setup-btn-outline:hover { background: var(--surface3); }

.setup-field-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.setup-field-row .setup-btn { margin-top: 0; flex: 1.5; }

.setup-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setup-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 16px 18px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  transition: all var(--transition);
}

.setup-choice:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.setup-choice strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.setup-choice small {
  font-size: 12px;
  color: var(--text3);
}

.choice-icon {
  font-size: 22px;
  margin-bottom: 4px;
}

/* Custom subject rows */
.custom-subjects-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 10px;
  padding-right: 2px;
}

.custom-subject-row {
  display: grid;
  grid-template-columns: 80px 1fr 60px 28px;
  gap: 6px;
  align-items: center;
}

.custom-subject-row input {
  padding: 8px 10px;
  font-size: 12px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
}

.custom-subject-row input:focus { border-color: var(--accent); }
.custom-subject-row input::placeholder { color: var(--text3); }

.btn-remove-row {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--red-dim);
  color: var(--red);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.setup-add-row {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
}

/* ─── TOP NAV ─── */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: var(--nav-h);
  gap: 12px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.topnav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-svg-mark {
  flex-shrink: 0;
  border-radius: 9px;
  box-shadow: 0 2px 10px rgba(37,99,235,0.35);
  display: block;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.4px;
}

.logo-title-accent {
  color: var(--accent);
}

.logo-sub {
  font-size: 10px;
  font-weight: 500;
  color: var(--text3);
  letter-spacing: 0.2px;
}

.topnav-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.icon-btn svg { width: 15px; height: 15px; pointer-events: none; }
.icon-btn:hover { background: var(--surface3); color: var(--text); border-color: var(--border2); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.danger:hover { background: var(--red-dim); color: var(--red); border-color: var(--red); }

/* ─── BOTTOM TABS ─── */
.bottom-tabs {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(37,99,235,0.08);
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 10px;
  font-family: var(--font);
  font-weight: 600;
  padding: 8px 4px;
  transition: color var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.tab-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.tab-btn span { font-size: 10px; line-height: 1; }
.tab-btn.active { color: var(--accent); }

.tab-btn.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 36px; height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}

.tab-btn:active { background: var(--surface2); }

/* ─── PAGES ─── */
.page { display: none; padding: 0 0 20px; animation: fadeIn 0.22s ease; }
.page.active { display: block; }

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

/* ─── PAGE HEADER ─── */
.page-header { padding: 20px 16px 14px; }

.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.7px;
}

.page-subtitle { font-size: 12px; color: var(--text3); margin-top: 3px; font-weight: 500; }

/* ─── STATS STRIP ─── */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 16px 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}

.stat-card:hover { transform: translateY(-1px); }

.stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.stat-label {
  font-size: 9px;
  color: var(--text3);
  margin-top: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  line-height: 1.2;
}

/* ─── CARDS GRID ─── */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 0 16px;
}

@media (min-width: 540px)  { .cards-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px)  { .cards-grid { grid-template-columns: 1fr 1fr 1fr; } }

/* ─── CARDS LIST ─── */
.cards-list { display: flex; flex-direction: column; gap: 10px; padding: 0 16px; }

/* ─── SUBJECT CARD ─── */
.subject-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.subject-card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition);
}

.card-header:hover  { background: var(--surface2); }
.card-header:active { background: var(--surface3); }

.card-code {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent);
  background: var(--accent-dim);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  min-width: 0;
}

.card-name small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--text3);
  margin-top: 2px;
}

.card-badges { display: flex; gap: 5px; align-items: center; flex-shrink: 0; }

.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  font-family: var(--mono);
}

.badge-grade  { background: var(--surface3); color: var(--text3); }
.badge-green  { background: var(--green-dim); color: var(--green-text); }
.badge-amber  { background: var(--amber-dim); color: var(--amber-text); }
.badge-red    { background: var(--red-dim);   color: var(--red-text); }

.card-chevron {
  width: 18px;
  height: 18px;
  color: var(--text3);
  flex-shrink: 0;
  transition: transform var(--transition);
}

.card-chevron svg { width: 18px; height: 18px; }

.subject-card.open .card-chevron { transform: rotate(180deg); }

.card-body {
  display: none;
  border-top: 1px solid var(--border);
  padding: 16px;
}

.subject-card.open .card-body { display: block; }

/* ─── CARD TOTAL BAR ─── */
.card-total-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.card-total-label { font-size: 11px; font-weight: 600; color: var(--text3); flex: 1; }
.card-total-value { font-size: 13px; font-weight: 700; font-family: var(--mono); color: var(--text2); }

.card-total-grade {
  font-size: 13px;
  font-weight: 800;
  color: var(--text3);
}
.card-total-grade.green { color: var(--green); }
.card-total-grade.amber { color: var(--amber); }
.card-total-grade.red   { color: var(--red); }

/* ─── MARKS INPUT ─── */
.marks-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 14px 0 8px;
}

.marks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.marks-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.final-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.marks-input-group { display: flex; flex-direction: column; gap: 3px; }

.marks-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  text-align: center;
}

.marks-input {
  padding: 9px 6px;
  font-size: 13px;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  text-align: center;
  transition: border-color var(--transition), background var(--transition);
  width: 100%;
  -moz-appearance: textfield;
}
.marks-input::-webkit-inner-spin-button,
.marks-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.marks-input:focus { border-color: var(--accent); background: var(--surface); }
.marks-input.has-val { border-color: var(--accent2); }
.marks-input::placeholder { color: var(--text3); font-size: 11px; font-weight: 500; }

.marks-live-pct {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  text-align: center;
  color: var(--text3);
  height: 14px;
}
.marks-live-pct.good   { color: var(--green); }
.marks-live-pct.warn   { color: var(--amber); }
.marks-live-pct.danger { color: var(--red); }

/* ─── CARD RESET BTN ─── */
.btn-card-reset {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text3);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-card-reset svg { width: 13px; height: 13px; }
.btn-card-reset:hover { color: var(--red); border-color: var(--red); background: var(--red-dim); }

/* ─── ATTENDANCE ─── */
.att-log-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.att-btn {
  padding: 11px 8px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.att-btn:active { transform: scale(0.95); }

.att-btn-present { background: var(--green-dim); color: var(--green-text); }
.att-btn-present:hover { background: var(--green); color: #fff; }

.att-btn-absent { background: var(--red-dim); color: var(--red-text); }
.att-btn-absent:hover { background: var(--red); color: #fff; }

.att-btn-late { background: var(--amber-dim); color: var(--amber-text); }
.att-btn-late:hover { background: var(--amber); color: #fff; }

.att-summary {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.att-stat { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 56px; }
.att-stat-val { font-size: 22px; font-weight: 800; font-family: var(--mono); line-height: 1; }
.att-stat-val.green { color: var(--green); }
.att-stat-val.red   { color: var(--red); }
.att-stat-val.amber { color: var(--amber); }
.att-stat-label { font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; margin-top: 2px; letter-spacing: 0.4px; }

.att-pct-bar-wrap {
  height: 10px;
  background: var(--surface3);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 6px;
}

.att-pct-bar {
  height: 100%;
  background: var(--green);
  border-radius: 10px;
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}
.att-pct-bar.warn   { background: var(--amber); }
.att-pct-bar.danger { background: var(--red); }

.att-pct-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  margin-bottom: 12px;
  font-family: var(--mono);
}

.att-manual-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}

.att-manual-label { font-size: 9px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }

.att-manual-input {
  width: 100%;
  padding: 8px 6px;
  font-size: 13px;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  text-align: center;
  transition: border-color var(--transition);
  -moz-appearance: textfield;
}
.att-manual-input::-webkit-inner-spin-button,
.att-manual-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.att-manual-input:focus { border-color: var(--accent); }

/* ─── DASHBOARD BREAKDOWN ─── */
.dash-breakdown { display: flex; flex-direction: column; gap: 6px; }
.dash-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
}
.dash-breakdown-label { font-size: 11px; color: var(--text3); font-weight: 500; }
.dash-breakdown-val {
  font-weight: 700;
  color: var(--text2);
  font-family: var(--mono);
  font-size: 11px;
}
.dash-breakdown-val.green { color: var(--green); }
.dash-breakdown-val.amber { color: var(--amber); }
.dash-breakdown-val.red   { color: var(--red); }

/* ─── ANALYZE ─── */
.analyze-gpa-block {
  margin: 0 16px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
  background: linear-gradient(145deg, var(--surface) 60%, var(--surface2) 100%);
}

.big-gpa-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.big-gpa-value {
  font-size: 72px;
  font-weight: 800;
  letter-spacing: -4px;
  color: var(--text);
  line-height: 1;
}

.big-gpa-value.green { color: var(--green); }
.big-gpa-value.amber { color: var(--amber); }
.big-gpa-value.red   { color: var(--red); }

.big-gpa-grade {
  font-size: 15px;
  font-weight: 600;
  color: var(--text2);
  margin-top: 8px;
}

.semester-progress-text {
  font-size: 11px;
  color: var(--text3);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-weight: 500;
}

.analyze-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 16px 12px;
  box-shadow: var(--shadow);
}

.analyze-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}

.analyze-section-title.green-title { color: var(--green); }
.analyze-section-title.amber-title { color: var(--amber); }
.analyze-section-title.red-title   { color: var(--red); }

.analyze-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 16px 12px;
}

@media (max-width: 480px) {
  .analyze-two-col { grid-template-columns: 1fr; }
  .analyze-two-col .analyze-section { margin: 0; }
}
.analyze-two-col .analyze-section { margin: 0; }

.analyze-hint { font-size: 12px; color: var(--text3); margin-bottom: 12px; line-height: 1.5; }

/* ─── BAR CHART ─── */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }

.bar-row { display: flex; align-items: center; gap: 8px; }

.bar-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text2);
  width: 56px;
  flex-shrink: 0;
  font-family: var(--mono);
  text-align: right;
}

.bar-track {
  flex: 1;
  height: 22px;
  background: var(--surface2);
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  align-items: center;
  padding: 0 8px;
  min-width: 2px;
}

.bar-fill.bar-green { background: var(--green); }
.bar-fill.bar-amber { background: var(--amber); }
.bar-fill.bar-red   { background: var(--red); }

.bar-pct { font-size: 10px; font-weight: 700; color: #fff; white-space: nowrap; }

.bar-val {
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  width: 36px;
  flex-shrink: 0;
  text-align: right;
  font-family: var(--mono);
}

/* ─── STRENGTHS / WEAKNESSES ─── */
.sw-list { display: flex; flex-direction: column; gap: 6px; }

.sw-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
}

.sw-item.green { background: var(--green-dim); color: var(--green-text); }
.sw-item.amber { background: var(--amber-dim); color: var(--amber-text); }
.sw-item.red   { background: var(--red-dim);   color: var(--red-text); }

.sw-item-name { font-weight: 600; flex: 1; min-width: 0; }
.sw-item-pct  { font-family: var(--mono); font-weight: 700; }

.empty-msg { font-size: 12px; color: var(--text3); font-style: italic; padding: 8px 0; }

/* ─── CALCULATOR ─── */
.calc-block { display: flex; flex-direction: column; gap: 10px; }
.calc-row { display: flex; flex-direction: column; gap: 4px; }

.calc-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.calc-select, .calc-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

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

.calc-select:focus, .calc-input:focus { border-color: var(--accent); }

.calc-result {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  color: var(--text2);
  min-height: 48px;
  display: block;
  line-height: 1.8;
}

.calc-result strong {
  font-weight: 800;
  color: var(--text);
}

/* ─── BUTTONS ─── */
.btn-primary {
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 3px 10px rgba(37,99,235,0.25);
}
.btn-primary:hover  { background: var(--accent-dark); box-shadow: 0 5px 16px rgba(37,99,235,0.35); }
.btn-primary:active { transform: scale(0.97); }

.btn-claude {
  padding: 13px 20px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  color: #fff;
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  box-shadow: 0 4px 14px rgba(37,99,235,0.3);
}
.btn-claude:hover  { opacity: 0.92; box-shadow: 0 6px 20px rgba(37,99,235,0.4); }
.btn-claude:active { transform: scale(0.98); }
.btn-claude:disabled { background: var(--surface3); color: var(--text3); cursor: not-allowed; box-shadow: none; }

/* ─── AI RESULT ─── */
.ai-result {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  padding: 14px;
  min-height: 0;
  display: none;
}

.ai-result.visible { display: block; }

.ai-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text3);
  font-size: 13px;
}

.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── TOAST ─── */
.toast {
  position: fixed;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--surface);
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 999;
  max-width: calc(100vw - 40px);
  text-align: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }

/* ─── FOCUS ─── */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ─── UTILITY ─── */
.hidden { display: none !important; }

/* ─── RESPONSIVE ─── */
@media (max-width: 360px) {
  .stats-strip { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 17px; }
  .big-gpa-value { font-size: 54px; }
}

@media (min-width: 768px) {
  .page-header { padding: 28px 24px 16px; }
  .stats-strip { padding: 0 24px 20px; }
  .cards-grid  { padding: 0 24px; }
  .cards-list  { padding: 0 24px; }
  .analyze-section { margin: 0 24px 14px; }
  .analyze-gpa-block { margin: 0 24px 20px; }
  .analyze-two-col { margin: 0 24px 14px; }
  .marks-grid { grid-template-columns: repeat(6, 1fr); }
}

@media (min-width: 1024px) {
  body { max-width: 960px; margin: 0 auto; }
  .topnav { max-width: 960px; left: 50%; transform: translateX(-50%); right: auto; width: 960px; }
  .bottom-tabs { max-width: 960px; left: 50%; transform: translateX(-50%); right: auto; width: 960px; }
  .toast { bottom: calc(var(--tab-h) + 24px); }
}

/* ─── MOBILE ENHANCEMENTS ─── */
@media (max-width: 480px) {
  .topnav { padding: 0 12px; }
  .logo-title { font-size: 14px; }
  .logo-sub { font-size: 9px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .icon-btn { width: 32px; height: 32px; }
  .topnav-actions { gap: 4px; }
  .calc-result { font-size: 13px; }
  .stat-value { font-size: 18px; }
}

/* ─── RESET CONFIRMATION MODAL ─── */
.reset-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.18s ease;
}
.reset-modal-overlay.hidden { display: none; }

.reset-modal-box {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

.reset-step { display: none; }
.reset-step.active { display: block; }

.reset-modal-icon { font-size: 40px; text-align: center; margin-bottom: 12px; }

.reset-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.4px;
  text-align: center;
  margin-bottom: 10px;
}

.reset-modal-desc {
  font-size: 13px;
  color: var(--text2);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 22px;
}

.reset-modal-desc strong { color: var(--text); }

.reset-modal-actions {
  display: flex;
  gap: 10px;
}

.reset-btn-cancel {
  flex: 1;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text2);
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.reset-btn-cancel:hover { background: var(--surface3); }

.reset-btn-danger {
  flex: 1;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  color: #fff;
  background: var(--red);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 3px 10px rgba(220,38,38,0.25);
}
.reset-btn-danger:hover { background: #b91c1c; }
.reset-btn-danger:active { transform: scale(0.97); }
.reset-btn-danger:disabled {
  background: var(--surface3);
  color: var(--text3);
  cursor: not-allowed;
  box-shadow: none;
}

.reset-type-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.reset-type-input:focus { border-color: var(--red); }
.reset-type-input::placeholder { color: var(--text3); font-size: 12px; letter-spacing: 0; }

.reset-type-hint {
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 16px;
  min-height: 16px;
  font-weight: 500;
}
.reset-type-hint.match { color: var(--green); }
.reset-type-hint.no-match { color: var(--red); }

@media print {
  .reset-modal-overlay { display: none; }
}

@media print {
  .topnav, .bottom-tabs, .toast, .setup-overlay { display: none; }
  body { padding-bottom: 0; }
}
