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

/* ── Variables ── */
:root {
  --bg:        #f5f4f0;
  --surface:   #ffffff;
  --surface2:  #f0ede8;
  --border:    #ddd9d0;
  --accent:    #2d6a4f;
  --accent-lt: #d8ede3;
  --accent2:   #1a4a8a;
  --accent2-lt:#dce8f5;
  --text:      #1a1a18;
  --muted:     #6b6860;
  --danger:    #b83232;
  --danger-lt: #fdecea;
  --warning:   #92600a;
  --warning-lt:#fef3dc;
  --radius:    8px;
  --mono:      'DM Mono', 'Courier New', monospace;
  --serif:     'Fraunces', Georgia, serif;
  --sans:      'DM Sans', system-ui, sans-serif;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 2px 8px rgba(0,0,0,.10);
}

/* ── Base ── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Nav ── */
nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: .9rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  margin-left: auto;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: .3rem 0;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}

.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Main ── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { opacity: .88; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); box-shadow: none; }

.btn-primary  { background: var(--accent);  color: #fff; }
.btn-secondary{ background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost    { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn:disabled { opacity: .4; pointer-events: none; transform: none; box-shadow: none; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* ── Tags / Badges ── */
.tag {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  background: var(--surface2);
  color: var(--muted);
}
.tag-green   { background: var(--accent-lt);  color: var(--accent); }
.tag-blue    { background: var(--accent2-lt); color: var(--accent2); }
.tag-red     { background: var(--danger-lt);  color: var(--danger); }
.tag-warning { background: var(--warning-lt); color: var(--warning); }

/* ── Section label ── */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.2rem;
}

/* ── Hero ── */
.hero {
  padding: 4rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}
.hero-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 300;
  font-style: italic;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 1rem;
}
.hero h1 span { color: var(--accent); font-style: normal; font-weight: 600; }
.hero p { color: var(--muted); max-width: 480px; line-height: 1.8; }

/* ── Tool cards (homepage) ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  display: block;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s, transform .2s;
  position: relative;
  overflow: hidden;
}
.tool-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s;
}
.tool-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.tool-card:hover::before { transform: scaleX(1); }
.tool-card-icon { font-size: 1.8rem; margin-bottom: 1rem; }
.tool-card h3 { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; margin-bottom: .4rem; }
.tool-card p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.tool-card-meta { margin-top: 1rem; display: flex; gap: .4rem; flex-wrap: wrap; }

/* ── Page header ── */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 300;
  font-style: italic;
  letter-spacing: -.02em;
  margin-bottom: .3rem;
}
.page-header p { color: var(--muted); }

/* ── Upload zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  background: var(--surface);
  transition: border-color .2s, background .2s;
  cursor: pointer;
  position: relative;
  margin-bottom: 1.2rem;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-lt);
}
.upload-zone input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-icon { font-size: 2.2rem; margin-bottom: .6rem; }
.upload-zone h3 { font-size: 1rem; font-weight: 600; margin-bottom: .3rem; }
.upload-zone p { color: var(--muted); font-size: 13px; }
.upload-zone .accent { color: var(--accent); font-weight: 600; }

/* ── File list ── */
.file-list { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.2rem; }

.file-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  animation: slideIn .18s ease;
}
@keyframes slideIn { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:translateY(0); } }

.file-item-icon { color: var(--accent); }
.file-item-name { flex: 1; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.file-item-label {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  padding: .3rem .6rem;
  width: 140px;
  transition: border-color .15s;
}
.file-item-label:focus { outline: none; border-color: var(--accent); }

.file-item-remove {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: .9rem; padding: 0 .3rem;
  transition: color .15s;
}
.file-item-remove:hover { color: var(--danger); }

/* ── Actions row ── */
.actions { display: flex; gap: .8rem; align-items: center; margin-bottom: .5rem; }
#statusMsg { color: var(--muted); font-size: 13px; }

/* ── Progress bar ── */
.progress-bar-wrap {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin: 1.2rem 0;
  overflow: hidden;
  display: none;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  animation: progress 1.4s ease-in-out infinite alternate;
}
@keyframes progress { from { width: 15%; } to { width: 85%; } }

/* ── Results ── */
#results { display: none; margin-top: 2.5rem; }

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.results-header h2 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
}
.results-meta { display: flex; gap: .6rem; align-items: center; }

/* ── Table ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: var(--surface2); }
th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafaf8; }
.portfolio-group td:first-child { border-left: 3px solid var(--accent); }

/* ── Score pills ── */
.score-pill {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
  font-family: var(--mono);
}
.score-fail   { background: #fdecea; color: #b83232; }
.score-third  { background: #fef3dc; color: #92600a; }
.score-lower2 { background: #e8f5e9; color: #2e7d32; }
.score-upper2 { background: #e3f0fd; color: #1a4a8a; }
.score-first  { background: #ede8f5; color: #5a2d8a; }
.score-high1  { background: #fce4ec; color: #880e4f; }

/* ── Feedback cell ── */
.feedback-cell {
  max-width: 380px;
  color: var(--muted);
  line-height: 1.5;
  cursor: pointer;
}
.feedback-cell.truncated {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feedback-cell.expanded { -webkit-line-clamp: unset; display: block; }

/* ── Errors / warnings ── */
.errors-box {
  background: var(--danger-lt);
  border: 1px solid #f5c6c6;
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  margin-bottom: 1.2rem;
  color: var(--danger);
  font-size: 13px;
}
.errors-box ul { margin-top: .4rem; padding-left: 1.2rem; }

/* ── Settings panel ── */
.settings-panel {
  margin-bottom: 1.2rem;
  animation: slideIn .2s ease;
}
.settings-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.4rem;
}
.setting-group {
  margin-bottom: 1.4rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--border);
}
.setting-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.setting-label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: .7rem;
}
.setting-hint {
  font-weight: 400;
  color: var(--muted);
  margin-left: .5rem;
  font-size: 12px;
}

/* ── Toggle group (BSc/MSc) ── */
.toggle-group { display: flex; gap: .4rem; }
.toggle-btn {
  padding: .5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  display: flex; align-items: center; gap: .4rem;
}
.toggle-btn:hover { border-color: var(--accent); color: var(--text); }
.toggle-btn.active { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.toggle-sub { font-size: 11px; font-weight: 400; opacity: .8; }

/* ── Strategy cards ── */
.strategy-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: .8rem; margin-bottom: .8rem; }
@media (max-width: 700px) { .strategy-cards { grid-template-columns: 1fr; } }

.strategy-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  cursor: pointer;
  background: var(--surface2);
  transition: border-color .15s, background .15s;
  position: relative;
}
.strategy-card:hover { border-color: var(--accent); background: var(--surface); }
.strategy-card.active { border-color: var(--accent); background: var(--accent-lt); }
.strategy-name { font-weight: 700; font-size: 13px; margin-bottom: .4rem; }
.strategy-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.strategy-tag {
  display: inline-block;
  margin-top: .6rem;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .15rem .45rem;
  border-radius: 3px;
  background: var(--border);
  color: var(--muted);
}
.strategy-card.active .strategy-tag { background: var(--accent); color: #fff; }

/* ── Manual inputs ── */
.manual-inputs { margin-top: .8rem; }
.manual-grid { display: flex; flex-direction: column; gap: .4rem; max-width: 380px; }
.manual-row { display: grid; grid-template-columns: 100px 1fr 80px; gap: .8rem; align-items: center; font-size: 13px; }
.manual-count-input {
  width: 60px;
  padding: .3rem .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 13px;
  text-align: center;
}
.manual-count-input:focus { outline: none; border-color: var(--accent); }

/* ── Toggle switch ── */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}
.slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ── Reasoning box ── */
.reasoning-wrap { margin-bottom: 1.2rem; display: flex; flex-direction: column; gap: .6rem; }
.reasoning-block {
  background: var(--accent-lt);
  border: 1px solid #b8dfc8;
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
}
.reasoning-title { font-weight: 700; font-size: 12px; color: var(--accent); margin-bottom: .4rem; }
.reasoning-list { padding-left: 1.2rem; font-size: 12px; color: var(--text); line-height: 1.8; }

/* ── Reason cell ── */
.reason-cell { font-size: 11px; color: var(--muted); max-width: 200px; line-height: 1.4; }

/* ── Instructions panel ── */
.instructions-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.instructions-toggle {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 1rem 1.2rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  list-style: none;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: background .15s;
}
.instructions-toggle:hover { background: var(--surface2); }
details[open] .instructions-toggle { border-bottom-color: var(--border); }
.instructions-toggle::-webkit-details-marker { display: none; }
.instructions-toggle-icon { font-size: 1rem; }
.instructions-chevron { margin-left: auto; color: var(--muted); font-size: .75rem; transition: transform .2s; }
details[open] .instructions-chevron { transform: rotate(180deg); }

.instructions-list {
  list-style: none;
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
}
.instructions-list li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  font-size: 13px;
}
.step-num {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent-lt);
  color: var(--accent);
  font-weight: 700;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  margin-top: .1rem;
}
.instructions-list li strong { display: block; font-weight: 600; margin-bottom: .15rem; }
.instructions-list li p { color: var(--muted); line-height: 1.6; margin: 0; }
.instructions-list li code {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1rem .4rem;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent2);
}

/* ── Drag handle & reorder ── */
.drag-handle {
  color: var(--muted);
  cursor: grab;
  font-size: 1rem;
  padding: 0 .2rem;
  user-select: none;
  flex-shrink: 0;
}
.drag-handle:active { cursor: grabbing; }
.file-item.dragging { opacity: .4; }
.file-item.drag-over-item {
  border-color: var(--accent);
  background: var(--accent-lt);
}

/* ── Nav user area ── */
.nav-divider { color: var(--border); }
.nav-user { color: var(--muted); font-size: 13px; }
.nav-logout { color: var(--muted); font-size: 13px; text-decoration: none; transition: color .15s; }
.nav-logout:hover { color: var(--danger); }

/* ── Auth page ── */
.auth-wrap {
  min-height: calc(100vh - 57px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
}
.auth-logo {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1.5rem;
}
.auth-title {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 300;
  font-style: italic;
  letter-spacing: -.02em;
  margin-bottom: .5rem;
}
.auth-sub { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.2rem; }
.auth-note { font-size: 12px; color: var(--muted); line-height: 1.6; text-align: center; margin-top: 1rem; }

/* ── Form fields ── */
.field-group { display: flex; flex-direction: column; gap: .4rem; }
.field-label { font-size: 12px; font-weight: 600; color: var(--text); }
.field-input {
  width: 100%;
  padding: .6rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  transition: border-color .15s;
}
.field-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.field-input::placeholder { color: var(--muted); }

.btn-full { width: 100%; justify-content: center; padding: .7rem; font-size: 14px; }

/* ── Flash messages ── */
.flash {
  padding: .7rem 1rem;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.flash-success { background: var(--accent-lt); border-color: #b8dfc8; color: var(--accent); }
.flash-error   { background: var(--danger-lt); border-color: #f5c6c6; color: var(--danger); }

/* ── Invite form ── */
.invite-form { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* ── One-click re-login ── */
.relogin-box {
  background: var(--accent-lt);
  border: 1px solid #b8dfc8;
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: .8rem;
}
.relogin-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: .3rem; }
.relogin-email { font-weight: 600; font-size: 14px; color: var(--text); }

.auth-divider {
  text-align: center;
  position: relative;
  margin: 1rem 0;
  color: var(--muted);
  font-size: 12px;
}
.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: var(--border);
}
.auth-divider span {
  position: relative;
  background: var(--surface);
  padding: 0 .8rem;
}

/* ── Spec table ── */
.spec-table { display: flex; flex-direction: column; gap: .3rem; margin-top: .5rem; max-width: 380px; }
.spec-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .4rem .7rem;
  background: var(--surface2);
  border-radius: 6px;
  font-size: 13px;
}
.spec-val { font-family: var(--mono); font-weight: 600; color: var(--accent); font-size: 12px; }

/* ── Help screenshot ── */
.help-screenshot {
  display: block;
  margin-top: .8rem;
  max-width: 320px;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* ── FYP Day tabs ── */
.day-tabs {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}
.day-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .6rem .9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all .15s;
  font-family: var(--sans);
  min-width: 72px;
}
.day-tab:hover { border-color: var(--accent); }
.day-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.day-tab-weekday { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; opacity: .7; }
.day-tab-date { font-size: 13px; font-weight: 600; }
.day-tab-count {
  margin-top: .3rem;
  font-size: 10px;
  background: rgba(0,0,0,.1);
  border-radius: 10px;
  padding: .1rem .4rem;
}
.day-tab.active .day-tab-count { background: rgba(255,255,255,.25); }

/* ── Day panel ── */
.day-panel { display: none; }
.day-panel.active { display: block; }
.day-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.day-panel-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.day-panel-meta { font-size: 12px; color: var(--muted); }

/* ── Timeline grid ── */
.timeline-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  max-height: 70vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.timeline-grid {
  display: grid;
  grid-template-columns: 52px repeat(var(--cols), 150px);
  min-width: max-content;
  width: max-content;
}
.tl-time-gutter { background: var(--surface2); border-bottom: 1px solid var(--border); position: sticky; left: 0; top: 0; z-index: 3; }
.tl-room-header {
  padding: .6rem .6rem;
  background: var(--surface2);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
}
.tl-time {
  padding: .5rem .4rem;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  text-align: right;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  white-space: nowrap;
  position: sticky;
  left: 0;
  z-index: 1;
}
.tl-cell {
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: .4rem .5rem;
  min-height: 72px;
  vertical-align: top;
  transition: opacity .2s;
}
.tl-cell--empty { background: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(0,0,0,.015) 4px, rgba(0,0,0,.015) 8px); }
.tl-cell--filled {
  background: var(--accent-lt);
  border-left-color: var(--accent);
  border-left-width: 2px;
  cursor: default;
}
.tl-cell--filled:hover { background: #c8e6d4; }
.tl-student { font-weight: 700; font-size: 12px; margin-bottom: .2rem; }
.tl-title {
  font-size: 11px;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: .3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tl-panel { font-size: 10px; color: var(--muted); line-height: 1.5; }
.tl-role {
  display: inline-block;
  width: 14px; height: 14px;
  background: var(--accent);
  color: #fff;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  line-height: 14px;
  margin-right: 2px;
}

/* ── No Room Assigned column ── */
.tl-room-header--unscheduled {
  color: var(--warning) !important;
  background: var(--warning-lt) !important;
}
.tl-cell--unscheduled {
  background: var(--warning-lt) !important;
  border-left-color: var(--warning) !important;
}

/* ── Sortable table headers ── */
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover { color: var(--accent); }
.sort-icon { font-size: 10px; color: var(--muted); margin-left: .3rem; }
