/* ──────────────────────────────────────────────────────────────────────────
 * styles.css — the whole stylesheet, in the order a page needs it.
 *
 * One file rather than four: a school network makes every extra request a
 * chance to stall, and none of these sections is useful without the others.
 * The order is load-bearing — the tokens define the variables the rest read.
 *
 *   1. Tokens    the colours every surface is drawn from, light and dark
 *   2. Shell     the header, tabs, dialogs, buttons and fields
 *   3. Gradebook the course cards, the breakdown table, the what-if rows
 *   4. Calendar  the month grid
 *
 * Dark mode is a class on <html>, not a media query — a saved choice has to
 * win over the OS, and it is read before first paint.
 * ────────────────────────────────────────────────────────────────────────── */

/* ══════════════════════════════════════════════════════════════════════════
   1. Tokens
   ══════════════════════════════════════════════════════════════════════════ */
:root {
  /* nav — light mode */
  --nav-bg:     #faf8ff;
  --nav-bg-2:   #ede8ff;
  --nav-border: #d8ccf8;
  --nav-text:   #1a1033;
  --nav-text-2: #7c6ab0;
  /* content — light mode */
  --bg:        #f0eeff;
  --bg-2:      #e4d9ff;
  --surface:   rgba(255,255,255,0.55);
  --surface-2: rgba(246,242,255,0.44);
  --border:    rgba(140,110,210,0.16);
  --border-2:  rgba(255,255,255,0.60);
  --surface-solid: #ffffff;
  --text:      #1a1033;
  --text-2:    #6b6088;
  --text-3:    #a89ec4;
  --accent:    #7c3aed;
  --accent-2:  #6d28d9;
  --accent-3:  #ede9fe;
  --accent-4:  #f5f3ff;
  --radius:    18px;
  --radius-sm: 12px;
  --cal-cell-min: 96px;   /* shortest a calendar week row may get before the grid scrolls */
  --gd-cols: minmax(0, 2.2fr) minmax(90px, 0.5fr) minmax(110px, 0.75fr) minmax(70px, 0.45fr);
  --radius-lg: 24px;
  --shadow:    0 2px 16px rgba(100,80,200,0.10);
  --shadow-lg: 0 8px 40px rgba(80,40,180,0.18);
  --transition: 0.15s ease;
  /* liquid glass */
  --glass-bg:     rgba(255,255,255,0.42);
  --glass-bg-2:   rgba(255,255,255,0.58);
  --glass-border: rgba(255,255,255,0.70);
  --glass-edge:   rgba(255,255,255,0.95);
  --glass-shade:  rgba(90,60,170,0.07);
  --glass-sheen:  rgba(255,255,255,0.42);
  --glass-blur:   20px;
  --glass-sat:    1.7;
  --glass-shadow: 0 8px 32px rgba(80,40,180,0.10);
  --glass-divider: rgba(120,90,190,0.16);
  --glass-field:   rgba(255,255,255,0.40);
}
html.dark {
  --nav-bg:     #1a1535;
  --nav-bg-2:   #0f0c22;
  --nav-border: #2e2758;
  --nav-text:   #e8e2f8;
  --nav-text-2: #9b8ec4;
  --bg:        #0d0b1e;
  --bg-2:      #160f30;
  --surface:   rgba(30,24,66,0.44);
  --surface-2: rgba(42,34,84,0.38);
  --border:    rgba(160,124,255,0.18);
  --border-2:  rgba(160,124,255,0.13);
  --surface-solid: #151130;
  --text:      #e8e2f8;
  --text-2:    #9b8ec4;
  --text-3:    #6b5f98;
  --accent:    #a07cff;
  --accent-2:  #7c3aed;
  --accent-3:  #1e1640;
  --accent-4:  #17132e;
  --shadow:    0 2px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.55);
  --glass-bg:     rgba(26,20,58,0.38);
  --glass-bg-2:   rgba(26,20,58,0.55);
  --glass-border: rgba(160,124,255,0.20);
  --glass-edge:   rgba(255,255,255,0.14);
  --glass-shade:  rgba(0,0,0,0.30);
  --glass-sheen:  rgba(160,124,255,0.10);
  --glass-blur:   22px;
  --glass-sat:    1.4;
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.45);
  --glass-divider: rgba(160,124,255,0.20);
  --glass-field:   rgba(10,7,26,0.22);
}

/* ══════════════════════════════════════════════════════════════════════════
   2. Shell
   ══════════════════════════════════════════════════════════════════════════ */
/* Everything here is the shell: the header, the two dialogs and the tabs.
   The gradebook itself is styled by gradebook.css. */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100dvh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* A single soft wash rather than animated blobs. It costs one gradient and
   no frames, which is the whole point of this page. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vw 50vh at 12% 0%,  var(--bg-2), transparent 70%),
    radial-gradient(50vw 45vh at 92% 8%,  var(--accent-3), transparent 72%);
}

/* ── Header ── */
.lite-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px clamp(12px, 3vw, 22px);
  border-bottom: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0;
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
}
.lite-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.lite-brand .cc-logo { width: 30px; height: 30px; }

/* The logo is black line art and vanishes against the dark background. A
   CSS invert would whiten it but turn the yellow tassel blue, so dark mode
   gets its own file: same art, greyscale inverted, tassel left alone. */
.cc-logo {
  display: inline-block; flex-shrink: 0;
  background-image: url('/icons/coursecat-mark.png');
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}
html.dark .cc-logo { background-image: url('/icons/coursecat-mark-dark.png'); }
.lite-name { font-size: 1rem; font-weight: 700; letter-spacing: -0.2px; white-space: nowrap; }
.lite-tag {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase;
  color: var(--accent); background: var(--accent-3);
  padding: 2px 7px; border-radius: 999px; flex-shrink: 0;
}
.lite-header-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
  cursor: pointer; font-size: 0.95rem; font-family: inherit;
  box-shadow: inset 0 1px 0 var(--glass-edge);
  transition: color var(--transition), border-color var(--transition);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── View tabs ── */
.lite-tabs {
  display: flex; gap: 6px; flex-shrink: 0;
  padding: 8px clamp(12px, 3vw, 22px);
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.lite-tab {
  padding: 5px 16px; font: inherit; font-size: 0.82rem; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border-2); border-radius: 999px; cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-edge);
}
.lite-tab:hover  { color: var(--accent); border-color: var(--accent); }
.lite-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Main ── */
.lite-main { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; }
.lite-main > #syng-content,
.lite-main > #cal-content { flex: 1 1 auto; min-height: 0; }
.lite-main > [hidden] { display: none; }

/* ── Cards, buttons, fields ── */
.card-panel {
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: 24px;
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
}
.field { display: block; margin-bottom: 12px; }
.field > span {
  display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.3px;
  text-transform: uppercase; color: var(--text-2); margin-bottom: 5px;
}
.field input {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 0.88rem;
  color: var(--text); background: var(--glass-field);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 2px var(--glass-shade);
}
.field input:focus { outline: none; border-color: var(--accent); }
.field-hint { font-size: 0.71rem; color: var(--text-3); margin-top: 5px; line-height: 1.5; }
.btn-primary {
  width: 100%; padding: 11px; font: inherit; font-size: 0.9rem; font-weight: 700;
  color: #fff; background: var(--accent); border: none;
  border-radius: 999px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn-primary:hover  { filter: brightness(1.07); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ghost {
  padding: 9px 16px; font: inherit; font-size: 0.83rem; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }
.msg { font-size: 0.8rem; line-height: 1.5; margin-top: 12px; color: #dc2626; }
.msg.ok { color: #16a34a; }
.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 0.76rem; color: var(--text-2); text-decoration: underline;
}
.link-btn:hover { color: var(--accent); }

/* ── Dialogs ── */
.modal-wrap {
  position: fixed; inset: 0; z-index: 60; display: none;
  align-items: center; justify-content: center;
  padding: 20px; background: rgba(15,10,40,0.45); overflow-y: auto;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.modal-wrap.open { display: flex; }
.modal-card { width: 100%; max-width: 400px; }
.modal-card h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.modal-card > p { font-size: 0.8rem; color: var(--text-2); line-height: 1.55; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.modal-actions .btn-primary { flex: 1; }

/* ── Optional-field grouping and the how-to dialog ── */
.field-group { margin-bottom: 12px; }
.field-optional {
  font-weight: 600; font-size: 0.62rem; letter-spacing: 0.4px;
  color: var(--text-3); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 1px 6px; margin-left: 6px; text-transform: uppercase;
}
.howto {
  margin: 4px 0 16px; padding-left: 1.35em;
  font-size: 0.85rem; line-height: 1.65; color: var(--text);
}
.howto li { margin-bottom: 7px; }
.howto li::marker { color: var(--accent); font-weight: 700; }
.howto code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 5px; word-break: break-all;
}
.howto-note {
  font-size: 0.79rem; line-height: 1.6; color: var(--text-2);
  background: color-mix(in srgb, #f59e0b 9%, var(--surface-2));
  border: 1px solid color-mix(in srgb, #f59e0b 30%, var(--border));
  border-radius: var(--radius-sm); padding: 10px 12px;
}

@media (max-width: 700px) { html { font-size: 16px; } }

/* ══════════════════════════════════════════════════════════════════════════
   3. Gradebook
   ══════════════════════════════════════════════════════════════════════════ */
/* ── Grade-source tabs (the full app shows Lms/Portal; lite has no tabs,
 *    but .gd-container and .gd-source-content carry the scroll behaviour both
 *    need, so the group stays intact). ── */
.gd-container { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.gd-source-tabs { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.gd-source-tab { padding: 5px 16px; border-radius: 20px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2); font-size: 0.82rem; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.gd-source-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
/* The scroll container for both grade sources. Everything above it (#pretty-view,
   .gd-container) is overflow:hidden to pin the tabs in place, so if this doesn't
   scroll, nothing does — content past the fold is simply unreachable, which is
   what happens on a phone once the cards stack into two columns. */
.gd-source-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; display: flex; flex-direction: column; }

/* ── Grades dashboard ── */
.gd-layout { display: flex; height: 100%; overflow: hidden; }
.gd-sidebar {
  width: clamp(220px, 19vw, 320px); flex-shrink: 0; border-right: 1px solid var(--border);
  overflow-y: auto; background: var(--surface);
}
/* Surface rather than transparent so the table reads as one panel down to the
   bottom of the viewport, instead of stopping dead under the last row. */
.gd-main { flex: 1; min-width: 0; background: var(--surface); overflow-y: auto; }
.gd-course-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  transition: background var(--transition);
}
.gd-course-item:hover { background: var(--accent-4); }
.gd-course-item.selected { background: var(--accent-3); border-left: 3px solid var(--accent); }
.gd-course-name { font-size: 0.83rem; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-course-grade { font-size: 0.87rem; font-weight: 800; flex-shrink: 0; }
.gd-header {
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  background: var(--surface); display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; position: sticky; top: 0; z-index: 2;
  box-shadow: 0 2px 8px rgba(100,80,200,0.06);
}
.gd-header-title { font-size: 1rem; font-weight: 600; flex: 1; min-width: 0; color: var(--text); }
.gd-grade-display { font-size: 0.82rem; padding: 5px 12px; border-radius: 99px; font-weight: 500; }
.gd-reset-btn {
  font-size: 0.73rem; padding: 4px 11px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; color: var(--text-2); font-family: inherit; transition: all var(--transition);
}
.gd-reset-btn:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
.gd-group-header {
  padding: 7px 18px; font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--accent); background: var(--accent-4);
  border-bottom: 1px solid var(--border-2);
  display: flex; justify-content: space-between;
}
.gd-row {
  display: grid; grid-template-columns: var(--gd-cols);
  align-items: center; gap: 10px; padding: 9px 18px;
  border-bottom: 1px solid var(--border); font-size: 0.83rem;
  transition: background var(--transition); background: var(--surface);
}
.gd-row:hover { background: var(--accent-4); }
.gd-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.gd-row-due  { font-size: 0.73rem; color: var(--text-2); }
.gd-score-wrap { display: flex; align-items: center; gap: 5px; }
.gd-score-input {
  width: 62px; padding: 4px 7px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.87rem; text-align: center;
  background: var(--surface-2); font-family: inherit;
  /* Without an explicit color these inherit the UA default (black), which vanishes against
     a dark surface until .simulated swaps in a light background. */
  color: var(--text);
  transition: border-color var(--transition), background var(--transition);
}
.gd-score-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,58,237,0.12); }
/* Fixed light amber background, so pin a dark text color rather than a themed one. */
.gd-score-input.simulated { border-color: #f59e0b; background: #fffbeb; color: #92400e; font-weight: 700; }
.gd-pts  { font-size: 0.73rem; color: var(--text-3); }
.gd-pct  { font-size: 0.78rem; font-weight: 500; text-align: right; }
.gd-col-headers {
  display: grid; grid-template-columns: var(--gd-cols);
  gap: 10px; padding: 7px 18px;
  font-size: 0.68rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-3);
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.gd-empty { padding: 32px; text-align: center; color: var(--text-3); font-size: 0.88rem; }
.gd-portal-hint {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 14px 18px 0; padding: 10px 14px; border-radius: var(--radius);
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  font-size: 0.83rem; line-height: 1.45;
}
html.dark .gd-portal-hint { background: #2a1a08; border-color: #7c3d12; color: #fdba74; }

/* Portal: term/mark switcher, grade calculator, semester projection */
.syng-grid {
  display: grid; gap: 16px; padding: 16px 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
/* Below ~1250px four large cards get cramped, so step down a column at a time. */
@media (max-width: 1250px) { .syng-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 950px)  { .syng-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.syng-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 22px 22px; min-height: 168px; text-align: left;
  border: 1px solid var(--border-2); border-left: 5px solid var(--card-accent, var(--border-2));
  border-radius: var(--radius); background: var(--surface);
  font-family: inherit; cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.syng-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.10);
  border-color: var(--card-accent, var(--accent));
}
.syng-card-top { display: flex; align-items: center; gap: 8px; }
.syng-card-period {
  font-size: 0.74rem; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.syng-card-proj {
  font-size: 0.68rem; font-weight: 800; color: #b45309;
  text-transform: uppercase; letter-spacing: 0.4px;
  background: #f59e0b22; padding: 2px 7px; border-radius: 12px;
}
.syng-card-title {
  font-size: 1.08rem; font-weight: 700; color: var(--text); line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.syng-card-teacher {
  font-size: 0.84rem; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Push the grade to the bottom so cards in a row line their numbers up. */
.syng-card-grade { display: flex; align-items: baseline; gap: 8px; margin-top: auto; padding-top: 12px; flex-wrap: wrap; }
.syng-card-pct    { font-size: 2.1rem; font-weight: 500; letter-spacing: -0.5px; }
.syng-card-letter { font-size: 1.25rem; font-weight: 500; opacity: 0.85; }
.syng-card-delta  { font-size: 0.8rem; font-weight: 500; }

.syng-backrow { padding: 12px 18px 0; }
.syng-back {
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2);
  padding: 4px 12px; border-radius: 16px;
  font-size: 0.78rem; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all var(--transition);
}
.syng-back:hover { border-color: var(--accent); color: var(--accent); }

.syng-chiprow { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 18px 8px; background: var(--surface); }
.syng-chip {
  padding: 3px 12px; border-radius: 16px; border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--text-2);
  font-size: 0.78rem; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all var(--transition);
}
.syng-chip:hover { border-color: var(--accent); color: var(--accent); }
.syng-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.syng-calc { padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.syng-calc-line {
  display: flex; gap: 7px; align-items: center; flex-wrap: wrap;
  font-size: 0.82rem; color: var(--text-2);
}
.syng-input {
  padding: 5px 8px; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  font-size: 0.83rem; background: var(--surface-2); color: var(--text); font-family: inherit;
}
.syng-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,58,237,0.12); }
.syng-btn {
  padding: 5px 14px; border-radius: var(--radius-sm); border: none;
  background: var(--accent); color: #fff;
  font-size: 0.82rem; font-weight: 700; cursor: pointer; font-family: inherit;
}
.syng-btn:hover { filter: brightness(1.08); }
.syng-x {
  border: none; background: none; color: var(--text-3);
  font-size: 1.05rem; line-height: 1; cursor: pointer; padding: 0 4px; font-family: inherit;
}
.syng-x:hover { color: #dc2626; }
.syng-link {
  border: none; background: none; color: var(--accent);
  font-size: 0.7rem; cursor: pointer; font-family: inherit; text-decoration: underline; padding: 0;
}
/* Semester projection terms: name, category chips, then the term grade. Flex rather than
   .gd-row's fixed grid, so the chips can wrap without squeezing the columns. */
.syng-term-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 18px; font-size: 0.83rem;
  border-bottom: 1px solid var(--border); background: var(--surface);
  transition: background var(--transition);
}
.syng-term-row:hover { background: var(--accent-4); }
.syng-term-name { font-weight: 500; flex-shrink: 0; }
.syng-term-cats { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.syng-term-val  { margin-left: auto; text-align: right; flex-shrink: 0; }

.syng-hypo-row { background: color-mix(in srgb, #f59e0b 7%, var(--surface)); }
.syng-hypo-tag {
  font-size: 0.68rem; font-weight: 700; color: #b45309;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.syng-proj-note {
  font-size: 0.7rem; font-weight: 700; color: #f59e0b;
  text-transform: uppercase; letter-spacing: 0.5px; margin-top: 3px;
}
.syng-catline {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 16px 11px;
}
.syng-cat {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 3px 9px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 0.75rem; white-space: nowrap;
}
.syng-cat-name { font-weight: 600; color: var(--text-2); }
.syng-cat-w { color: var(--text-3); font-size: 0.7rem; }
.syng-verdict {
  margin: 10px 18px; padding: 11px 14px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 0.84rem; line-height: 1.5;
}
.syng-solve { margin-top: 9px; font-size: 0.84rem; color: var(--text); line-height: 1.5; }
.gd-projected { color: #f59e0b; }
.gd-legend { padding: 8px 18px; font-size: 0.71rem; color: var(--text-3); border-top: 1px solid var(--border); background: var(--surface); }

/* Transparency is decorative here; legibility is not. Mirrors the guard in
   index.html for the surfaces this file owns, so lite.html gets it too. */
@media (prefers-reduced-transparency: reduce) {
  .gd-sidebar, .gd-header, .gd-col-headers, .gd-row,
  .syng-card, .syng-calc, .syng-chiprow, .syng-cat {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: var(--surface-solid) !important;
  }
}

/* ── Phones ─────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
/* Grades dashboard: course list becomes a horizontally-scrolling strip
   above the grade table instead of a side rail (there's no room for both). */
.gd-layout { flex-direction: column; }
.gd-sidebar {
  width: 100%; display: flex; overflow-x: auto; overflow-y: hidden;
  border-right: none; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.gd-course-item { border-bottom: none; border-right: 1px solid var(--border); flex-shrink: 0; min-width: 160px; }
.gd-col-headers { grid-template-columns: 1fr 70px 60px; }
.gd-col-headers span:nth-child(2) { display: none; } /* Due — cut for space */
.gd-row { grid-template-columns: 1fr 70px 60px; padding: 9px 12px; gap: 6px; }
.syng-chiprow, .syng-calc { padding-left: 12px; padding-right: 12px; }
.syng-verdict { margin-left: 12px; margin-right: 12px; }
.syng-catline { padding-left: 12px; padding-right: 12px; }
.syng-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; }
.syng-card { padding: 13px 14px 15px; min-height: 132px; }
.syng-card-title { font-size: 0.92rem; }
.syng-card-teacher { font-size: 0.74rem; }
.syng-card-pct { font-size: 1.5rem; }
.syng-card-letter { font-size: 1rem; }
.syng-backrow { padding-left: 12px; padding-right: 12px; }
.syng-term-row { padding-left: 12px; padding-right: 12px; }
.syng-term-cats { flex-basis: 100%; order: 3; }
/* Stack the calculator controls instead of letting them overflow the row. */
.syng-calc-line { gap: 5px; }
.syng-calc-line .syng-input { flex: 1 1 auto; min-width: 0; }
.gd-row-due { display: none; }
.gd-score-input { width: 46px; padding: 4px; }
}

/* ── Liquid glass ────────────────────────────────────────────────────────────
 * The surfaces this file owns, given the same treatment the rest of CourseCat
 * uses. index.html restates these later in its own inline block and wins on
 * source order, so the full app is unchanged; lite.html has only this copy.
 * ─────────────────────────────────────────────────────────────────────────── */

/* Containers that float over scrolling content frost; list items (.syng-card,
   .gd-row) deliberately don't — they render in bulk and the tint tier is
   visually indistinguishable from frost at that size. */
.gd-sidebar, .gd-header, .gd-col-headers, .syng-calc, .syng-chiprow {
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
}

/* The rim. */
.gd-sidebar, .syng-card, .syng-cat {
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    inset 0 -1px 0 var(--glass-shade),
    var(--glass-shadow);
}

/* Hover is defined earlier and outranks the rule above, so it restates the rim
   to keep the edge from blinking. */
.syng-card:hover {
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    inset 0 -1px 0 var(--glass-shade),
    var(--shadow-lg);
}

/* Fields read as pressed into the glass, so the rim inverts: shade on top,
   no lit edge. */
.gd-score-input, .syng-input {
  background: var(--glass-field);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 2px var(--glass-shade);
}

/* Pills and chips share the button's shape language. */
.syng-chip, .gd-source-tab, .gd-reset-btn, .syng-back {
  border-radius: 999px;
  box-shadow: inset 0 1px 0 var(--glass-edge);
}

/* ══════════════════════════════════════════════════════════════════════════
   4. Calendar
   ══════════════════════════════════════════════════════════════════════════ */
.cv-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; max-width: 100%; }
.cv-wrap * { box-sizing: border-box; }

/* ── Toolbar ── */
.cv-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px clamp(12px, 3vw, 18px);
  border-bottom: 1px solid var(--border); background: var(--surface);
  flex-shrink: 0;
}
.cv-title {
  font-size: 1rem; font-weight: 700; letter-spacing: -0.2px; margin-right: auto;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cv-btn {
  padding: 5px 12px; font: inherit; font-size: 0.8rem; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-edge);
}
.cv-btn:hover  { color: var(--accent); border-color: var(--accent); }
.cv-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Grid ── */
.cv-grid-wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.cv-dows {
  display: grid; grid-template-columns: repeat(7, 1fr);
  padding: 8px clamp(8px, 2vw, 14px) 4px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--text-3); text-align: center;
}
.cv-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px;
  padding: 0 clamp(8px, 2vw, 14px) 14px;
}
.cv-cell {
  min-height: var(--cv-cell-min, 96px);
  /* Without this a grid item will not shrink below its content, so a single
     long assignment title widens its column and the seven-column grid overflows
     the screen instead of ellipsing. */
  min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
  padding: 6px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: inherit;
  font: inherit; cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-edge);
  transition: border-color var(--transition), background var(--transition);
}
.cv-cell:hover    { border-color: var(--accent); background: var(--accent-4); }
.cv-cell.outside  { opacity: 0.38; }
.cv-cell.today    { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cv-cell.selected { background: var(--accent-3); border-color: var(--accent); }
.cv-daynum { font-size: 0.78rem; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.cv-daynum .cv-sticker { font-size: 0.85rem; line-height: 1; }
.cv-cell.today .cv-daynum { color: var(--accent); }

/* Event pills. Colour comes from the course, assigned in calendar-view.js. */
.cv-pill {
  font-size: 0.68rem; line-height: 1.3; font-weight: 600;
  padding: 2px 5px; border-radius: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%; min-width: 0;
  background: var(--pill, var(--accent-3)); color: var(--pill-fg, var(--text));
  border-left: 2px solid var(--pill-edge, var(--accent));
}
.cv-pill.done { opacity: 0.45; text-decoration: line-through; }
.cv-more { font-size: 0.64rem; color: var(--text-3); font-weight: 600; padding-left: 2px; }

/* ── Day detail ── */
.cv-detail {
  flex-shrink: 0; border-top: 1px solid var(--border);
  background: var(--surface); max-height: 44%; overflow-y: auto;
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
}
.cv-detail-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px clamp(12px, 3vw, 18px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--surface);
}
.cv-detail-date { font-weight: 700; font-size: 0.9rem; margin-right: auto; }
.cv-row {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px clamp(12px, 3vw, 18px);
  border-bottom: 1px solid var(--border);
}
.cv-row:last-child { border-bottom: none; }
.cv-row-main { flex: 1; min-width: 0; }
.cv-row-title { font-size: 0.86rem; font-weight: 600; word-break: break-word; }
.cv-row-title.done { opacity: 0.5; text-decoration: line-through; }
.cv-row-meta { font-size: 0.72rem; color: var(--text-2); margin-top: 2px; word-break: break-word; }
.cv-row-notes { font-size: 0.74rem; color: var(--text-3); margin-top: 4px; line-height: 1.5; }
.cv-row a { color: var(--accent); font-weight: 600; text-decoration: none; }
.cv-row a:hover { text-decoration: underline; }
.cv-check {
  width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px;
  accent-color: var(--accent); cursor: pointer;
}
.cv-x {
  background: none; border: none; cursor: pointer; padding: 0 3px;
  color: var(--text-3); font-size: 1rem; line-height: 1; flex-shrink: 0;
}
.cv-x:hover { color: #dc2626; }
.cv-empty { padding: 20px clamp(12px, 3vw, 18px); color: var(--text-3); font-size: 0.83rem; }

/* ── Sticker picker ── */
.cv-stickers { display: flex; gap: 3px; flex-wrap: wrap; }
.cv-sticker-opt {
  width: 27px; height: 27px; padding: 0; font-size: 0.95rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer;
}
.cv-sticker-opt:hover  { border-color: var(--accent); }
.cv-sticker-opt.active { background: var(--accent-3); border-color: var(--accent); }

/* ── Add-an-event row ── */
.cv-add {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  padding: 9px clamp(12px, 3vw, 18px); border-top: 1px solid var(--border);
}
.cv-input {
  flex: 1 1 140px; min-width: 0; padding: 6px 9px;
  font: inherit; font-size: 0.8rem; color: var(--text);
  background: var(--glass-field); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: inset 0 1px 2px var(--glass-shade);
}
.cv-input:focus { outline: none; border-color: var(--accent); }

/* ── Setup prompt ── */
.cv-setup { padding: 44px 24px; text-align: center; max-width: 420px; margin: 0 auto; }
.cv-setup h3 { font-size: 1rem; font-weight: 700; margin-bottom: 7px; }
.cv-setup p  { font-size: 0.85rem; color: var(--text-2); line-height: 1.6; margin-bottom: 16px; }

@media (max-width: 700px) {
  .cv-grid { gap: 3px; }
  .cv-cell { min-height: var(--cv-cell-min, 62px); padding: 4px; }
  .cv-pill { font-size: 0.6rem; padding: 1px 3px; }
  .cv-detail { max-height: 50%; }
}

@media (prefers-reduced-transparency: reduce) {
  .cv-cell, .cv-detail, .cv-detail-head, .cv-bar {
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    background: var(--surface-solid) !important;
  }
}

/* ── Narrow phones ───────────────────────────────────────────────────────────
 * Seven columns on a 360px screen leaves roughly 45px a cell. A title ellipsed
 * to three characters tells nobody anything, so each item collapses to a dot in
 * its course colour and the day panel carries the detail. The dots still say how
 * much is due and roughly what kind, which is what a month view is actually for.
 * ─────────────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .cv-cell {
    flex-flow: row wrap; align-content: flex-start; gap: 3px;
    padding: 4px 3px;
  }
  .cv-daynum { flex: 0 0 100%; font-size: 0.72rem; }
  .cv-pill {
    flex: 0 0 auto;
    width: 7px; height: 7px; padding: 0; border-radius: 50%;
    font-size: 0; line-height: 0; border-left: none;
    background: var(--pill-edge, var(--accent));
  }
  .cv-more { flex: 0 0 100%; font-size: 0.58rem; }
  .cv-dows { font-size: 0.6rem; padding-left: 6px; padding-right: 6px; }
  /* The picker is the widest thing in the header; let it drop to its own line. */
  .cv-detail-head  { gap: 6px; }
  .cv-detail-date  { flex: 1 1 100%; }
  .cv-sticker-opt  { width: 24px; height: 24px; font-size: 0.85rem; }
}
