/* =============================================================
   timetable.css — My Timetable (official course schedule)
   Theme-aware: builds only on tokens from style.css (:root /
   [data-theme="light"] / [data-theme="oled"]) so light, dark and
   oled all work without per-theme rules here.
   ============================================================= */

/* ---------- Course hue palette ----------
   10 hues, assigned by a stable hash of the course code so a course keeps
   the same colour all week. Each hue is a tint (block fill) + a line
   (left border / text accent). Tuned for separation at low tint and for
   ≥4.5:1 label contrast against the block fill in every theme. */
:root {
  --tt-h0: 200; --tt-h1: 262; --tt-h2: 152; --tt-h3: 22;  --tt-h4: 330;
  --tt-h5: 48;  --tt-h6: 178; --tt-h7: 288; --tt-h8: 8;   --tt-h9: 96;

  --tt-tint-s: 62%;   --tt-tint-l: 16%;   --tt-tint-a: 0.30;
  --tt-line-s: 70%;   --tt-line-l: 62%;
  --tt-ink-s:  60%;   --tt-ink-l:  86%;

  --tt-bus: #6b93c4;
  --tt-rail-h: 3px;
}

[data-theme="light"] {
  --tt-tint-s: 70%;   --tt-tint-l: 92%;   --tt-tint-a: 0.85;
  --tt-line-s: 58%;   --tt-line-l: 44%;
  --tt-ink-s:  55%;   --tt-ink-l:  26%;
}

[data-theme="oled"] {
  --tt-tint-s: 60%;   --tt-tint-l: 13%;   --tt-tint-a: 0.38;
  --tt-line-s: 68%;   --tt-line-l: 58%;
  --tt-ink-s:  58%;   --tt-ink-l:  84%;
}

/* Set --h on any element to colour it from the palette. */
.tt-hued {
  --tt-tint: hsla(var(--h), var(--tt-tint-s), var(--tt-tint-l), var(--tt-tint-a));
  --tt-line: hsl(var(--h), var(--tt-line-s), var(--tt-line-l));
  --tt-ink:  hsl(var(--h), var(--tt-ink-s), var(--tt-ink-l));
}

/* ---------- Shell ---------- */
.tt-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 16px 90px;
  color: var(--text);
}

.tt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.tt-head h1 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}
.tt-head .tt-term {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.tt-head-actions { display: flex; gap: 6px; flex-shrink: 0; }

.tt-iconbtn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 9px;
  width: 34px; height: 34px;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.tt-iconbtn:hover { background: var(--hover); color: var(--text); border-color: var(--border2); }
.tt-iconbtn:active { transform: scale(0.94); }

/* ---------- Sticky view switcher ---------- */
.tt-views {
  position: sticky;
  top: calc(var(--nav-h) + 4px);
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  margin-bottom: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 11px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.tt-view-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text3);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.tt-view-btn[aria-selected="true"] {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-1);
}

/* ---------- Panels + view transition ---------- */
.tt-panel[hidden] { display: none; }
.tt-panel { animation: tt-fade-in 0.16s ease both; }
@keyframes tt-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Hero (Now / Next) ---------- */
.tt-hero {
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 16px 16px 18px;
  margin-bottom: 14px;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.tt-hero::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--tt-line, var(--accent));
}
.tt-hero-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 7px;
}
.tt-hero-eyebrow .tt-live {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 var(--success);
  animation: tt-pulse 2.2s infinite;
}
@keyframes tt-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(93,156,106,.5); }
  70%  { box-shadow: 0 0 0 7px rgba(93,156,106,0); }
  100% { box-shadow: 0 0 0 0 rgba(93,156,106,0); }
}
.tt-hero-code {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 7px 0 1px;
  color: var(--tt-ink, var(--text));
  line-height: 1.1;
}
.tt-hero-name {
  font-size: 13.5px;
  color: var(--text2);
  line-height: 1.35;
  margin-bottom: 11px;
}
.tt-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.tt-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  white-space: nowrap;
}
.tt-pill.is-room { background: var(--accent-bg); border-color: transparent; color: var(--accent2); }
.tt-pill.is-north { background: rgba(107,147,196,.14); border-color: transparent; color: var(--blue); }
.tt-pill.is-south { background: rgba(93,156,106,.14); border-color: transparent; color: var(--success); }
.tt-hero-rail {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: var(--tt-rail-h);
  background: var(--border);
}
.tt-hero-rail span {
  display: block;
  height: 100%;
  background: var(--tt-line, var(--accent));
  transition: width 0.6s ease;
}

/* Commute call-out inside the hero */
.tt-hero-hop {
  margin-top: 11px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(107,147,196,.11);
  border: 1px solid rgba(107,147,196,.26);
  font-size: 12.5px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
}
.tt-hero-hop strong { color: var(--text); }
.tt-hero-hop:hover { background: rgba(107,147,196,.17); }

/* ---------- Agenda (Today) ---------- */
.tt-agenda { display: flex; flex-direction: column; gap: 8px; position: relative; }

/* minmax(0,1fr), not 1fr: a grid item defaults to min-width:auto, so the
   nowrap course name inside .tt-card would otherwise widen the track past
   the viewport instead of ellipsising. Same reason on the divider/hop rows. */
.tt-slot {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}
.tt-slot-time {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
  padding-top: 11px;
  text-align: right;
}
.tt-card {
  position: relative;
  width: 100%;
  text-align: left;
  font: inherit;
  background: var(--tt-tint, var(--surface2));
  border: 1px solid var(--border);
  border-left: 3px solid var(--tt-line, var(--accent));
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.12s ease, box-shadow var(--transition);
}
.tt-card:hover { box-shadow: var(--shadow-1); }
.tt-card:active { transform: scale(0.985); }
.tt-card.is-now { box-shadow: 0 0 0 2px var(--accent); }
.tt-card-code { font-size: 14px; font-weight: 700; color: var(--tt-ink, var(--text)); }
.tt-card-name {
  font-size: 12px;
  color: var(--text2);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tt-card-meta {
  font-size: 11px;
  color: var(--text3);
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
}
.tt-card-badge {
  position: absolute;
  top: 8px; right: 10px;
  font-size: 10px;
  font-weight: 700;
  color: var(--warn);
}

/* Lunch + free-gap dividers */
.tt-divider {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  font-size: 11.5px;
  color: var(--text3);
}
.tt-divider-body {
  border-top: 1px dashed var(--border2);
  padding: 9px 0 9px 2px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.tt-divider-body em { font-style: normal; color: var(--text2); font-weight: 600; }

/* Commute hop row */
.tt-hop {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-decoration: none;
}
.tt-hop-body {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 12px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px dashed rgba(107,147,196,.4);
  background: rgba(107,147,196,.08);
  color: var(--text2);
}
.tt-hop-body strong { color: var(--text); font-weight: 700; }
.tt-hop.is-tight .tt-hop-body {
  border-color: rgba(196,162,72,.5);
  background: rgba(196,162,72,.09);
}
.tt-hop.is-impossible .tt-hop-body {
  border-color: rgba(196,88,88,.5);
  background: rgba(196,88,88,.09);
}

/* Live "now" line */
.tt-nowline {
  position: relative;
  height: 0;
  margin: -4px 0;
  pointer-events: none;
}
.tt-nowline::before {
  content: "";
  position: absolute;
  left: 46px; right: 0;
  top: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  opacity: .85;
}
.tt-nowline::after {
  content: "";
  position: absolute;
  left: 42px;
  top: -3px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Week grid ---------- */
.tt-weekwrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  margin: 0 -16px;
  padding: 0 16px 6px;
  -webkit-overflow-scrolling: touch;
}
.tt-week {
  display: grid;
  grid-template-columns: 44px repeat(5, minmax(104px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-width: 580px;
  position: relative;
}
.tt-week > * { background: var(--bg); }
.tt-wk-corner { background: var(--surface); }
.tt-wk-day {
  background: var(--surface);
  text-align: center;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 9px 4px;
  scroll-snap-align: start;
}
.tt-wk-day.is-today { color: var(--accent2); }
.tt-wk-day.is-today::after {
  content: "";
  display: block;
  width: 4px; height: 4px;
  margin: 3px auto 0;
  border-radius: 50%;
  background: var(--accent);
}
.tt-wk-time {
  background: var(--surface);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding: 5px 6px 0 2px;
}
.tt-wk-cell { min-height: 42px; padding: 2px; }
.tt-wk-cell.is-today-col { background: var(--surface2); }

.tt-blk {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 38px;
  text-align: left;
  font: inherit;
  cursor: pointer;
  border: 0;
  border-left: 3px solid var(--tt-line, var(--accent));
  border-radius: 7px;
  background: var(--tt-tint, var(--accent-bg));
  color: var(--tt-ink, var(--text));
  padding: 5px 6px;
  overflow: hidden;
  transition: transform 0.12s ease, filter var(--transition);
}
.tt-blk:hover { filter: brightness(1.08); }
.tt-blk:active { transform: scale(0.96); }
.tt-blk-code {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tt-blk-room {
  font-size: 9px;
  font-weight: 600;
  color: var(--text3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tt-blk.is-optional { border-left-style: dashed; opacity: .82; }
.tt-blk.is-conflict {
  background-image: repeating-linear-gradient(
    45deg, transparent 0 5px, rgba(196,88,88,.28) 5px 10px);
  border-left-color: var(--danger);
}
.tt-blk-warn { font-size: 9px; font-weight: 800; color: var(--danger); }

.tt-blk.is-new { animation: tt-land 0.5s ease both; }
@keyframes tt-land {
  0%   { transform: scale(0.9); filter: brightness(1.5); }
  55%  { transform: scale(1.02); filter: brightness(1.35); }
  100% { transform: none; filter: none; }
}

/* ---------- Courses view ---------- */
.tt-section-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
  margin: 18px 0 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tt-section-title:first-child { margin-top: 4px; }
.tt-section-title .tt-count { font-weight: 700; color: var(--text2); letter-spacing: 0; text-transform: none; }

.tt-crow {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--card);
  margin-bottom: 7px;
}
.tt-crow-swatch {
  width: 4px;
  align-self: stretch;
  min-height: 30px;
  border-radius: 3px;
  background: var(--tt-line, var(--accent));
  flex-shrink: 0;
}
.tt-crow-body { flex: 1; min-width: 0; }
.tt-crow-code { font-size: 13.5px; font-weight: 700; }
.tt-crow-name {
  font-size: 12px;
  color: var(--text2);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tt-crow-meta { font-size: 11px; color: var(--text3); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 3px 8px; }
.tt-crow-actions { display: flex; gap: 5px; flex-shrink: 0; }

.tt-att {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text2);
  white-space: nowrap;
}
.tt-att.is-low { background: rgba(196,162,72,.16); color: var(--warn); }

.tt-badge-tbd {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(196,162,72,.14);
  color: var(--warn);
}

.tt-credits {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  margin-bottom: 4px;
}
.tt-credits b { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.tt-credits span { font-size: 12px; color: var(--text3); }

/* ---------- Buttons ---------- */
.tt-btn {
  appearance: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 11px 16px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  transition: background var(--transition), transform 0.12s ease;
}
.tt-btn:hover { background: var(--hover); }
.tt-btn:active { transform: scale(0.98); }
.tt-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.tt-btn-primary:hover { background: var(--accent2); }
.tt-btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tt-btn-row .tt-btn { flex: 1; min-width: 130px; }
.tt-btn-sm { font-size: 12px; padding: 6px 11px; border-radius: 8px; }

/* ---------- Setup / empty state ---------- */
.tt-setup {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow-1);
}
.tt-setup h2 { font-size: 17px; font-weight: 800; margin: 0 0 4px; letter-spacing: -0.02em; }
.tt-setup p.tt-sub { font-size: 13px; color: var(--text2); margin: 0 0 16px; line-height: 1.45; }

.tt-field { margin-bottom: 13px; }
.tt-field > label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 6px;
}
.tt-field select,
.tt-field input[type="text"],
.tt-field input[type="time"],
.tt-field input[type="date"] {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 10px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
}
.tt-field select:focus,
.tt-field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.tt-field-hint { font-size: 11.5px; color: var(--text3); margin-top: 5px; line-height: 1.4; }

.tt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tt-chip {
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.tt-chip:hover { border-color: var(--border2); color: var(--text); }
.tt-chip[aria-pressed="true"] {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent2);
}

/* Empty state — a ghost of a filled week behind the invitation */
.tt-empty { position: relative; padding: 8px 0 4px; }
.tt-empty-ghost {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 5px;
  opacity: .16;
  pointer-events: none;
  filter: blur(0.4px);
}
.tt-empty-ghost i { border-radius: 6px; background: var(--border2); }
.tt-empty-ghost i:nth-child(3n) { background: var(--accent); opacity: .55; }
.tt-empty-ghost i:nth-child(4n) { background: transparent; }
.tt-empty-card {
  position: relative;
  text-align: center;
  padding: 34px 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.tt-empty-card h3 { font-size: 17px; font-weight: 800; margin: 0 0 6px; letter-spacing: -0.02em; }
.tt-empty-card p { font-size: 13px; color: var(--text2); margin: 0 0 16px; line-height: 1.45; }

.tt-note {
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text2);
  line-height: 1.45;
  margin-bottom: 12px;
}
.tt-note.is-special { background: var(--accent-bg); border-color: transparent; color: var(--accent2); font-weight: 600; }
.tt-restday { text-align: center; padding: 40px 20px; }
.tt-restday .tt-restday-emoji { font-size: 38px; display: block; margin-bottom: 10px; }
.tt-restday h3 { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.tt-restday p { font-size: 13px; color: var(--text3); margin: 0; }

/* ---------- Sheet (picker + editors) ---------- */
.tt-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 90;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: tt-fade 0.18s ease both;
}
@keyframes tt-fade { from { opacity: 0 } to { opacity: 1 } }

.tt-sheet {
  position: fixed;
  z-index: 91;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-2);
  /* Desktop: right-hand panel */
  top: 0; right: 0; bottom: 0;
  width: min(440px, 100%);
  border-radius: 0;
  animation: tt-slide-right 0.22s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes tt-slide-right {
  from { transform: translateX(100%); }
  to   { transform: none; }
}
.tt-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 16px 11px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tt-sheet-head h2 { font-size: 16px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
.tt-sheet-body { flex: 1; overflow-y: auto; padding: 14px 16px 22px; -webkit-overflow-scrolling: touch; }
.tt-sheet-handle { display: none; }

/* Sticky footer: the running "N courses added" count is what tells a student
   their taps actually stuck, without needing an explicit save step. */
.tt-sheet-foot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px calc(11px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.tt-sheet-count {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text2);
}
.tt-sheet-foot .tt-btn { padding: 9px 22px; }

.tt-searchbar { position: sticky; top: 0; z-index: 2; background: var(--surface); padding-bottom: 10px; }
.tt-searchbar input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
}
.tt-searchbar input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.tt-filters { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }

.tt-result {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  font: inherit;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  margin-bottom: 6px;
  transition: border-color var(--transition), background var(--transition);
}
.tt-result:hover { border-color: var(--border2); background: var(--hover); }
.tt-result[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-bg); }
.tt-result-check {
  width: 19px; height: 19px;
  border-radius: 6px;
  border: 1.5px solid var(--border2);
  flex-shrink: 0;
  margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  color: transparent;
}
.tt-result[aria-pressed="true"] .tt-result-check {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.tt-result-body { flex: 1; min-width: 0; }
.tt-result-code { font-size: 13px; font-weight: 700; }
.tt-result-name { font-size: 12px; color: var(--text2); margin-top: 1px; line-height: 1.35; }
.tt-result-meta { font-size: 11px; color: var(--text3); margin-top: 5px; display: flex; flex-wrap: wrap; gap: 3px 8px; }
.tt-result-warn {
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--danger);
}
.tt-result-warn.is-tight { color: var(--warn); }

.tt-emptyline { padding: 26px 8px; text-align: center; font-size: 13px; color: var(--text3); line-height: 1.5; }

/* ── Per-course time editor ────────────────────────────────────────── */
/* Phones first. A native time input needs ~110px for its picker icon, so on a
   narrow screen each class gets three lines inside one bordered card:
     day …………… ✕
     start – end
     room
   Placement is explicit (grid-row/column) rather than flow order, so the ✕
   stays on line 1 instead of being pushed below the room field. */
.tt-timerow {
  display: grid;
  grid-template-columns: 1fr auto 1fr 32px;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.tt-timerow [data-f="day"]   { grid-column: 1 / 4; grid-row: 1; }
.tt-timerow .tt-timerow-del  { grid-column: 4;     grid-row: 1; }
.tt-timerow [data-f="start"] { grid-column: 1;     grid-row: 2; }
.tt-timerow .tt-timerow-dash { grid-column: 2;     grid-row: 2; }
.tt-timerow [data-f="end"]   { grid-column: 3;     grid-row: 2; }
.tt-timerow [data-f="room"]  { grid-column: 1 / 5; grid-row: 3; }

/* Deliberately NO wide single-line variant. On desktop this sheet is a fixed
   ~420px drawer, so viewport width says nothing about the space available here
   — a min-width media query put four fields on one line inside a narrow drawer
   and clipped the times to "09:(". The stacked layout fits at every width. */
.tt-timerow select,
.tt-timerow input {
  width: 100%;
  min-width: 0;
  padding: 8px 7px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.tt-timerow input[type="time"] { font-variant-numeric: tabular-nums; }
.tt-timerow select:focus,
.tt-timerow input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.tt-timerow-dash { color: var(--text3); font-size: 12px; text-align: center; }
.tt-timerow-del {
  width: 30px; height: 30px;
  font-size: 12px;
  color: var(--text3);
}
.tt-timerow-del:hover { color: var(--danger); }

/* Marks a course whose times the student has overridden. Mirrors .tt-badge-tbd. */
.tt-badge-edited {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(107,147,196,.16);
  color: var(--blue);
}

.tt-searchnote {
  font-size: 11.5px;
  color: var(--text3);
  padding: 2px 2px 9px;
}

/* Mobile: sheets become bottom sheets */
@media (max-width: 768px) {
  .tt-sheet {
    top: auto; right: 0; left: 0; bottom: 0;
    width: 100%;
    max-height: 86vh;
    border-radius: 18px 18px 0 0;
    animation: tt-slide-up 0.24s cubic-bezier(.22,.61,.36,1) both;
  }
  @keyframes tt-slide-up {
    from { transform: translateY(100%); }
    to   { transform: none; }
  }
  .tt-sheet-handle {
    display: block;
    width: 38px; height: 4px;
    border-radius: 99px;
    background: var(--border2);
    margin: 9px auto 0;
    flex-shrink: 0;
  }
  .tt-page { padding: 12px 14px 90px; }
  .tt-hero-code { font-size: 24px; }
  .tt-weekwrap { margin: 0 -14px; padding: 0 14px 6px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .tt-panel,
  .tt-sheet,
  .tt-sheet-backdrop,
  .tt-blk.is-new { animation: none !important; }
  .tt-hero-eyebrow .tt-live { animation: none; }
  .tt-card:active,
  .tt-blk:active,
  .tt-btn:active,
  .tt-iconbtn:active { transform: none; }
  .tt-hero-rail span { transition: none; }
}
