:root {
  --navy: #0f2147;
  --navy-2: #1a3263;
  --navy-3: #2b4a86;
  --orange: #f97316;
  --orange-2: #ff8a3d;
  --orange-soft: #fff1e6;
  --white: #ffffff;
  --bg: #f6f8fc;
  --line: #e3e8f2;
  --text: #0f1b33;
  --muted: #61708c;
  --danger: #dc2626;
  --success: #16a34a;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --surface-3: #eef1f6;
  --heading: #0f2147;
  --hover-orange: #fffaf5;
  --danger-soft: #fef2f2;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(15, 33, 71, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 33, 71, 0.16);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--navy-3); text-decoration: none; }
a:hover { color: var(--orange); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 2px 16px rgba(15, 33, 71, 0.25);
}
.header-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 24px; height: 68px;
}
.logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 18px; white-space: nowrap; }
.logo:hover { color: #fff; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  display: grid; place-items: center; box-shadow: 0 6px 16px rgba(249, 115, 22, 0.45);
}
.logo-mark svg { width: 20px; height: 20px; stroke: #fff; }
.logo small { display: block; font-size: 11px; font-weight: 600; opacity: 0.65; letter-spacing: 0.06em; text-transform: uppercase; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255, 255, 255, 0.72); font-weight: 600; padding: 9px 14px; border-radius: 12px; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.nav a.active { color: #fff; background: rgba(249, 115, 22, 0.18); box-shadow: inset 0 -2px 0 var(--orange); }
.nav a.active svg { stroke: var(--orange); }
.user-box { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; color: #fff; padding: 4px 12px 4px 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.user-chip:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }
.user-chip > span:not(.avatar) { font-weight: 700; font-size: 14px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 0; cursor: pointer;
  display: grid; place-items: center; background: rgba(255, 255, 255, 0.08); color: #fff;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.16); }

/* ---------- Layout ---------- */
main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 20px 120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 30px; font-weight: 800; color: var(--heading); }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.eyebrow { color: var(--orange); font-weight: 800; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.grid { display: grid; gap: 18px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 20px; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 11px 18px; font-weight: 700; cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s, opacity 0.15s; white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--orange), var(--orange-2)); color: #fff; box-shadow: 0 8px 20px rgba(249, 115, 22, 0.35); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 26px rgba(249, 115, 22, 0.5); color: #fff; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover:not(:disabled) { background: var(--navy-2); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--heading); border: 1px solid var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--navy-3); color: var(--heading); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid #f5c2c2; }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 14px 26px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 700; font-size: 13px; color: var(--heading); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 14px; background: var(--surface);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { resize: vertical; min-height: 80px; }
.input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.14); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > .field { flex: 1; min-width: 160px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; margin-bottom: 10px; }
.check input { width: 18px; height: 18px; accent-color: var(--orange); }
.error-box { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecaca; padding: 10px 14px; border-radius: 12px; font-weight: 600; margin-bottom: 14px; }

/* ---------- Auth ---------- */
.auth-wrap { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; max-width: 900px; margin: 10px auto; overflow: hidden; }
.auth-side {
  background: radial-gradient(circle at 20% 10%, rgba(249, 115, 22, 0.45), transparent 50%), linear-gradient(160deg, var(--navy), var(--navy-2));
  color: #fff; padding: 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px;
}
.auth-side h2 { font-size: 28px; font-weight: 800; }
.auth-side p { opacity: 0.8; }
.auth-points { display: grid; gap: 12px; }
.auth-points div { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.auth-points svg { stroke: var(--orange); }
.auth-form { padding: 40px; }
.auth-form h1 { font-size: 26px; color: var(--heading); margin-bottom: 6px; }
.auth-form .sub { color: var(--muted); margin-bottom: 22px; }
.auth-switch { margin-top: 16px; text-align: center; color: var(--muted); }

/* ---------- Booking ---------- */
.announcement { display: flex; gap: 12px; align-items: flex-start; background: var(--orange-soft); border: 1px solid #fed7aa; color: #9a3412; padding: 14px 18px; border-radius: 14px; margin-bottom: 18px; font-weight: 600; white-space: pre-line; }
.day-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.day-tab {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px 16px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 2px; min-width: 170px; transition: border-color 0.15s, box-shadow 0.15s;
}
.day-tab b { color: var(--heading); }
.day-tab small { color: var(--muted); font-weight: 600; }
.day-tab.active { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.12); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge-open { background: #dcfce7; color: #166534; }
.badge-upcoming { background: var(--orange-soft); color: #c2410c; }
.badge-closed { background: var(--surface-3); color: var(--muted); }
.badge-navy { background: var(--navy); color: #fff; }
.badge-orange { background: var(--orange); color: #fff; }
.badge-red { background: #fee2e2; color: var(--danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge-open .dot { animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

.booking-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.status-card { padding: 22px; position: sticky; top: 88px; }
.status-card h3 { color: var(--heading); font-size: 18px; margin-bottom: 4px; }
.status-card .muted { color: var(--muted); font-size: 14px; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.countdown div { background: var(--navy); color: #fff; border-radius: 12px; padding: 10px 4px; text-align: center; }
.countdown b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.countdown span { font-size: 11px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.06em; }
.progress { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin: 14px 0 6px; }
.progress div { height: 100%; background: linear-gradient(90deg, var(--orange), var(--orange-2)); border-radius: 999px; transition: width 0.4s; }
.info-list { display: grid; gap: 10px; margin-top: 16px; font-size: 14px; }
.info-list div { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); }
.info-list svg { stroke: var(--orange); margin-top: 2px; }

.slots-card { overflow: hidden; }
.slots-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px;
  background: linear-gradient(120deg, var(--navy), var(--navy-2)); color: #fff;
}
.slots-head h2 { font-size: 20px; }
.slots-head p { margin: 2px 0 0; opacity: 0.7; font-size: 13px; }
.slots-table { width: 100%; border-collapse: collapse; }
.slots-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 12px 22px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.slot-row { border-bottom: 1px solid var(--line); transition: background 0.15s; }
.slot-row:last-child { border-bottom: 0; }
.slot-row td { padding: 12px 22px; vertical-align: middle; }
.slot-row.free.clickable { cursor: pointer; }
.slot-row.free.clickable:hover { background: var(--hover-orange); }
.slot-row.selected { background: var(--orange-soft); }
.slot-row.mine { background: linear-gradient(90deg, rgba(249, 115, 22, 0.1), transparent); }
.slot-num { font-weight: 800; color: var(--heading); font-size: 18px; width: 70px; }
.slot-num small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.slot-circle-cell { width: 80px; }
.circle {
  width: 46px; height: 46px; border-radius: 50%; border: 2.5px dashed #b8c3d9; background: var(--surface);
  display: grid; place-items: center; cursor: default; padding: 0; transition: all 0.2s; font-weight: 800; font-size: 14px; color: #fff;
}
.slot-row.free.clickable .circle { cursor: pointer; }
.slot-row.free.clickable:hover .circle { border-color: var(--orange); border-style: solid; box-shadow: 0 0 0 6px rgba(249, 115, 22, 0.1); }
.circle.selected {
  border: 0; background: radial-gradient(circle at 35% 30%, #ffb37a, var(--orange) 60%);
  box-shadow: 0 0 0 6px rgba(249, 115, 22, 0.2), 0 0 24px rgba(249, 115, 22, 0.7); animation: glow 1.6s ease-in-out infinite;
}
.circle.selected svg { stroke: #fff; width: 22px; height: 22px; }
@keyframes glow { 50% { box-shadow: 0 0 0 10px rgba(249, 115, 22, 0.12), 0 0 34px rgba(249, 115, 22, 0.9); } }
.circle.taken { border: 0; background: var(--navy); }
.circle.mine { border: 0; background: linear-gradient(135deg, var(--orange), var(--orange-2)); box-shadow: 0 0 0 5px rgba(249, 115, 22, 0.18); }
.circle.anon { border: 0; background: #cfd7e6; }
.slot-name { font-weight: 700; color: var(--heading); }
.slot-name a { color: var(--heading); }
.slot-name a:hover { color: var(--orange); }
.slot-free { color: #9aa6bd; font-weight: 600; }
.slot-row.selected .slot-free { color: var(--orange); font-weight: 800; }
.you-tag { margin-left: 8px; }

.action-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 40;
  width: min(720px, calc(100% - 24px));
  background: var(--navy); color: #fff; border-radius: 20px; padding: 14px 14px 14px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; box-shadow: var(--shadow-lg);
}
.action-bar .txt { font-weight: 600; }
.action-bar .txt b { color: var(--orange-2); }
.action-bar .txt small { display: block; opacity: 0.65; font-weight: 500; }

/* ---------- Lists ---------- */
.segmented { display: inline-flex; background: var(--surface-3); padding: 4px; border-radius: 14px; }
.segmented button { border: 0; background: transparent; padding: 8px 16px; border-radius: 10px; font-weight: 700; color: var(--muted); cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--heading); box-shadow: 0 2px 8px rgba(15, 33, 71, 0.1); }
.date-group { overflow: hidden; }
.date-group-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.date-chip { display: flex; align-items: center; gap: 14px; }
.date-box { width: 54px; height: 58px; border-radius: 14px; background: var(--navy); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.date-box b { font-size: 22px; }
.date-box span { font-size: 11px; text-transform: uppercase; opacity: 0.75; font-weight: 700; }
.date-chip h3 { color: var(--heading); }
.date-chip p { margin: 0; color: var(--muted); font-size: 13px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 10px 22px; background: var(--surface-2); }
.table td { padding: 11px 22px; border-top: 1px solid var(--line); vertical-align: middle; }
.place-pill { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--orange-soft); color: var(--orange); font-weight: 800; }
.person { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--heading); }
.person:hover { color: var(--orange); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; stroke: #c3cbe0; margin-bottom: 10px; }

/* ---------- Avatars ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; flex: none; letter-spacing: 0.02em; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-lg { width: 120px; height: 120px; font-size: 42px; border: 5px solid var(--surface); box-shadow: var(--shadow-lg); }
.avatar-md { width: 56px; height: 56px; font-size: 19px; }

/* ---------- Students ---------- */
.students-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.student-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; transition: transform 0.15s, box-shadow 0.15s; color: inherit; position: relative; overflow: hidden; }
.student-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--navy), var(--orange)); opacity: 0; transition: opacity 0.15s; }
.student-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: inherit; }
.student-card:hover::before { opacity: 1; }
.student-card .top { display: flex; gap: 14px; align-items: center; }
.student-card h3 { font-size: 16px; color: var(--heading); }
.student-card .bio { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 20px; }
.student-card .meta { display: flex; gap: 8px; flex-wrap: wrap; }
.search { position: relative; min-width: 260px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); stroke: var(--muted); }
.search .input { padding-left: 40px; }

/* ---------- Profile ---------- */
.profile-hero { overflow: hidden; margin-bottom: 20px; }
.profile-cover {
  height: 150px;
  background:
    radial-gradient(circle at 85% 20%, rgba(249, 115, 22, 0.9), transparent 40%),
    radial-gradient(circle at 10% 120%, rgba(255, 138, 61, 0.5), transparent 45%),
    linear-gradient(120deg, var(--navy), var(--navy-3));
  position: relative;
}
.profile-cover::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px); background-size: 18px 18px;
}
.profile-main { display: flex; gap: 22px; padding: 0 28px 24px; align-items: flex-end; flex-wrap: wrap; }
.profile-main .avatar-lg { margin-top: -60px; position: relative; z-index: 1; }
.profile-info { flex: 1; min-width: 220px; padding-top: 14px; }
.profile-info h1 { font-size: 28px; color: var(--heading); font-weight: 800; }
.profile-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.profile-bio { color: var(--muted); margin-top: 10px; max-width: 640px; white-space: pre-line; }
.profile-links { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 14px; color: var(--muted); }
.profile-links span, .profile-links a { display: inline-flex; align-items: center; gap: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { padding: 20px; display: flex; gap: 14px; align-items: center; }
.stat-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--orange-soft); }
.stat-icon svg { stroke: var(--orange); width: 22px; height: 22px; }
.stat.navy .stat-icon { background: #e7ecf7; }
.stat.navy .stat-icon svg { stroke: var(--navy); }
.stat b { display: block; font-size: 22px; color: var(--heading); line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }
.timeline { padding: 6px 22px 16px; }
.tl-item { display: flex; gap: 16px; padding: 14px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.tl-item:last-child { border-bottom: 0; }
.tl-item .date-box { width: 48px; height: 52px; }
.tl-item.past .date-box { background: #cfd7e6; }
.tl-item .grow { flex: 1; }
.tl-item h4 { margin: 0; color: var(--heading); }
.tl-item p { margin: 0; color: var(--muted); font-size: 13px; }
.section-title { font-size: 18px; color: var(--heading); font-weight: 800; padding: 18px 22px 4px; display: flex; align-items: center; gap: 10px; }
.color-picks { display: flex; gap: 10px; flex-wrap: wrap; }
.color-pick { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; }
.color-pick.active { box-shadow: 0 0 0 3px var(--orange); }
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }

/* ---------- Admin ---------- */
.admin-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.admin-tabs button { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: var(--surface); padding: 10px 16px; border-radius: 12px; font-weight: 700; color: var(--muted); cursor: pointer; }
.admin-tabs button.active { background: var(--navy); color: #fff; border-color: var(--heading); }
.admin-tabs button.active svg { stroke: var(--orange); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.toolbar .spacer { flex: 1; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.table-wrap { overflow-x: auto; }
.user-row.banned { background: var(--danger-soft); }
.user-row.banned .person { color: #9aa6bd; text-decoration: line-through; }
.weekdays { display: flex; gap: 8px; flex-wrap: wrap; }
.weekdays label { display: flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); padding: 8px 12px; border-radius: 10px; cursor: pointer; font-weight: 700; }
.weekdays input { accent-color: var(--orange); }
.weekdays label:has(input:checked) { border-color: var(--orange); background: var(--orange-soft); color: #c2410c; }
.settings-section { padding: 22px; border-bottom: 1px solid var(--line); }
.settings-section:last-child { border-bottom: 0; }
.settings-section h3 { color: var(--heading); margin-bottom: 12px; font-size: 16px; }

/* ---------- Modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 33, 71, 0.55); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade 0.15s; }
.modal { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop 0.18s; }
.modal-head { padding: 20px 22px 6px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.modal-head h3 { color: var(--heading); font-size: 19px; }
.modal-body { padding: 12px 22px; }
.modal-foot { padding: 12px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.close-x { border: 0; background: var(--surface-3); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.pick-list { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; margin-top: 10px; }
.pick-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.pick-item:last-child { border-bottom: 0; }
.pick-item:hover { background: var(--orange-soft); }
.pick-item small { color: var(--muted); display: block; font-weight: 500; }
.pick-item .grow { flex: 1; font-weight: 700; color: var(--heading); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } }
.toasts { position: fixed; top: 82px; right: 16px; z-index: 200; display: grid; gap: 10px; width: min(360px, calc(100% - 32px)); }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 600; display: flex; gap: 10px; align-items: flex-start; animation: slide 0.2s; border-left: 5px solid var(--orange); }
.toast.error { border-left-color: #f87171; }
.toast.success { border-left-color: #4ade80; }
@keyframes slide { from { transform: translateX(20px); opacity: 0; } }
.loader { display: grid; place-items: center; padding: 60px; }
.spinner { width: 36px; height: 36px; border: 4px solid #e3e8f2; border-top-color: var(--orange); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .booking-layout, .two-col { grid-template-columns: 1fr; }
  .status-card { position: static; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .stats { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .header-inner { height: auto; flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .nav { order: 3; flex-basis: 100%; }
  .user-box { margin-left: auto; }
  .user-chip > span:not(.avatar) { display: none; }
  .user-chip { padding: 4px; }
  main { padding: 20px 16px 120px; }
  .page-head h1 { font-size: 24px; }
  .slot-row td, .slots-table th { padding: 10px 12px; }
  .slot-num { width: 50px; }
  .slot-circle-cell { width: 60px; }
  .table th, .table td { padding: 10px 12px; }
  .auth-form { padding: 26px 20px; }
  .profile-main { padding: 0 18px 20px; }
  .action-bar { flex-direction: column; align-items: stretch; text-align: center; padding: 14px; }
  .hide-sm { display: none; }
  .search { min-width: 0; width: 100%; }
}

/* ---------- Subjects ---------- */
.subject-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.subject-tab {
  display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: var(--surface);
  padding: 9px 16px; border-radius: 999px; font-weight: 700; color: var(--heading); cursor: pointer; transition: all 0.15s;
}
.subject-tab:hover { border-color: var(--orange); }
.subject-tab.active { background: var(--navy); border-color: var(--heading); color: #fff; box-shadow: 0 6px 16px rgba(15, 33, 71, 0.2); }
.subject-tab.active svg { stroke: var(--orange); }
.subject-tab.add { border-style: dashed; color: var(--orange); }

/* ---------- Deadlines ---------- */
.subject-tab .count { background: rgba(15, 33, 71, 0.08); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.subject-tab.active .count { background: rgba(255, 255, 255, 0.18); }
.toolbar-plain { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.muted-sm { color: var(--muted); font-size: 14px; }
.muted-sm b { color: var(--heading); }
.dl-card { display: flex; gap: 18px; padding: 18px 20px; align-items: flex-start; border-left: 5px solid var(--navy); }
.dl-card.active { border-left-color: #22c55e; }
.dl-card.urgent { border-left-color: var(--orange); }
.dl-card.urgent .date-box { background: linear-gradient(135deg, var(--orange), var(--orange-2)); }
.dl-card.past { border-left-color: #cfd7e6; opacity: 0.75; }
.dl-card.past .date-box { background: #cfd7e6; }
.dl-main { flex: 1; min-width: 0; }
.dl-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dl-top h3 { color: var(--heading); font-size: 18px; }
.badge-subject { background: #e7ecf7; color: var(--heading); }
.dl-time { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin-top: 6px; }
.dl-time b { color: var(--heading); }
.dl-time svg { width: 16px; height: 16px; }
.dl-desc { color: var(--muted); font-size: 14px; margin-top: 6px; white-space: pre-line; }
.dl-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.points { text-align: right; line-height: 1.1; }
.points b { font-size: 26px; color: var(--orange); font-weight: 800; }
.points span { display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
@media (max-width: 720px) {
  .dl-card { flex-wrap: wrap; }
  .dl-side { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .points { text-align: left; }
}

/* ---------- Text list ---------- */
.text-list { margin: 0; padding: 14px 16px; background: var(--surface-2); border: 1.5px dashed var(--line); border-radius: 12px; font-family: inherit; font-size: 15px; font-weight: 600; color: var(--heading); white-space: pre-wrap; user-select: all; line-height: 1.7; }
.text-card { padding: 18px 22px; margin-top: 20px; }
.text-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.text-card-head h3 { color: var(--heading); font-size: 16px; display: flex; gap: 8px; align-items: center; }
.text-card-head h3 svg { stroke: var(--orange); }
.date-group .text-wrap { padding: 0 22px 18px; }
@media (max-width: 720px) {
  .subject-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 0 16px 4px; }
  .subject-tabs::-webkit-scrollbar { display: none; }
  .subject-tab { flex: none; }
}

/* ---------- Dark theme ---------- */
html[data-theme='dark'] {
  color-scheme: dark;
  --navy: #13254d;
  --navy-2: #1b3264;
  --navy-3: #8fb0ff;
  --bg: #0a1224;
  --surface: #111c35;
  --surface-2: #0e1830;
  --surface-3: #1a2747;
  --line: #24345a;
  --text: #e3e9f6;
  --heading: #f1f5ff;
  --muted: #93a2c0;
  --orange-soft: rgba(249, 115, 22, 0.14);
  --hover-orange: rgba(249, 115, 22, 0.08);
  --danger-soft: rgba(220, 38, 38, 0.12);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
}
html[data-theme='dark'] .header { background: #0d1a36; }
html[data-theme='dark'] .badge-open { background: rgba(34, 197, 94, 0.16); color: #4ade80; }
html[data-theme='dark'] .badge-upcoming { color: #fdba74; }
html[data-theme='dark'] .badge-closed { background: #1f2c4d; color: #93a2c0; }
html[data-theme='dark'] .badge-red { background: rgba(220, 38, 38, 0.18); color: #f87171; }
html[data-theme='dark'] .badge-subject { background: #1f2c4d; color: #c9d6f3; }
html[data-theme='dark'] .badge-navy { background: #2b4a86; }
html[data-theme='dark'] .announcement { border-color: rgba(249, 115, 22, 0.35); color: #fdba74; }
html[data-theme='dark'] .error-box { border-color: rgba(220, 38, 38, 0.4); }
html[data-theme='dark'] .btn-danger { border-color: rgba(220, 38, 38, 0.45); color: #f87171; }
html[data-theme='dark'] .circle { border-color: #3a4c78; }
html[data-theme='dark'] .circle.anon { background: #3a4c78; }
html[data-theme='dark'] .slot-free { color: #6c7ca0; }
html[data-theme='dark'] .stat.navy .stat-icon { background: #1f2c4d; }
html[data-theme='dark'] .stat.navy .stat-icon svg { stroke: #8fb0ff; }
html[data-theme='dark'] .tl-item.past .date-box,
html[data-theme='dark'] .dl-card.past .date-box { background: #2a3a60; }
html[data-theme='dark'] .dl-card.past { border-left-color: #2a3a60; }
html[data-theme='dark'] .admin-tabs button.active,
html[data-theme='dark'] .subject-tab.active { background: #2b4a86; border-color: #2b4a86; }
html[data-theme='dark'] .segmented button.active { box-shadow: none; }
html[data-theme='dark'] .close-x { background: var(--surface-3); color: var(--text); }
html[data-theme='dark'] .subject-tab .count { background: rgba(255, 255, 255, 0.08); }
html[data-theme='dark'] .slots-head { background: linear-gradient(120deg, #13254d, #1f3a73); }
html[data-theme='dark'] .action-bar { background: #1b2d57; border: 1px solid #2b4a86; }
html[data-theme='dark'] .toast { background: #1b2d57; }
html[data-theme='dark'] input[type='date'], html[data-theme='dark'] input[type='time'], html[data-theme='dark'] input[type='datetime-local'] { color-scheme: dark; }

/* ---------- Swaps ---------- */
.nav-badge { background: var(--orange); color: #fff; font-size: 11px; font-weight: 800; min-width: 18px; height: 18px; border-radius: 999px; display: inline-grid; place-items: center; padding: 0 5px; margin-left: 2px; }
.slot-name-cell { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.swap-btn { padding: 5px 10px; font-size: 12px; }
.swap-btn svg { width: 15px; height: 15px; stroke: var(--orange); }
.swaps { display: grid; gap: 10px; margin-bottom: 18px; }
.swap-card { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 18px; flex-wrap: wrap; }
.swap-card.incoming { border: 1.5px solid var(--orange); background: linear-gradient(90deg, var(--orange-soft), var(--surface)); }
.swap-text { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 240px; }
.swap-text > svg { stroke: var(--orange); width: 22px; height: 22px; }
.swap-text .avatar { display: inline-grid; vertical-align: middle; margin-right: 6px; }
.swap-text b { color: var(--heading); }
.swap-text small { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------- Results ---------- */
.result-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.res-btn { display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 9px; padding: 5px 8px; font-size: 12px; font-weight: 700; cursor: pointer; }
.res-btn svg { width: 14px; height: 14px; }
.res-btn:hover { border-color: var(--heading); }
.res-passed.on { background: #dcfce7; border-color: #22c55e; color: #166534; }
.res-not_reached.on { background: var(--orange-soft); border-color: var(--orange); color: #c2410c; }
.res-absent.on { background: #fee2e2; border-color: #ef4444; color: #b91c1c; }
html[data-theme='dark'] .res-passed.on { background: rgba(34, 197, 94, 0.16); color: #4ade80; }
html[data-theme='dark'] .res-not_reached.on { color: #fdba74; }
html[data-theme='dark'] .res-absent.on { background: rgba(220, 38, 38, 0.18); color: #f87171; }
@media (max-width: 900px) { .res-btn span { display: none; } }

/* ---------- Grades ---------- */
.grades { padding: 4px 22px 20px; display: grid; gap: 18px; }
.grade-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.grade-head > b { color: var(--heading); font-size: 16px; }
.grade-head span { color: var(--muted); font-weight: 600; }
.grade-head span b { color: var(--orange); font-size: 20px; }
.grade-subj .progress { margin: 8px 0 6px; }
.grade-items { display: grid; }
.grade-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.grade-item:last-child { border-bottom: 0; }
.gi-kind { font-weight: 700; color: var(--heading); }
.gi-date { font-size: 12px; color: var(--muted); }
.gi-input { width: 84px; padding: 7px 10px; text-align: right; font-weight: 800; }
.gi-points { font-size: 16px; color: var(--heading); min-width: 40px; text-align: right; }
.gi-points.none { color: var(--muted); font-weight: 600; }
.gi-max { color: var(--muted); font-weight: 600; min-width: 44px; }
.hint-inline { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: auto; }
.stat b .of { font-size: 14px; color: var(--muted); font-weight: 700; }
.dl-my { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 14px; color: var(--muted); font-weight: 600; flex-wrap: wrap; }
.dl-my > svg { stroke: var(--orange); width: 16px; height: 16px; }
.dl-my b { color: var(--heading); }
.link-btn { border: 0; background: none; color: var(--orange); font-weight: 700; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 6px; }
.link-btn svg { stroke: var(--orange); width: 16px; height: 16px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Profile cards ---------- */
.card-h3 { color: var(--heading); font-size: 16px; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.card-h3 svg { stroke: var(--orange); }
.muted-p { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.howto { display: grid; gap: 6px; font-size: 13px; color: var(--muted); margin-top: 12px; }
.howto b { color: var(--heading); }
.section-title { flex-wrap: wrap; }
@media (max-width: 720px) { .hint-inline { margin-left: 0; flex-basis: 100%; } }

/* ---------- Tasks & Moodle ---------- */
.badge-moodle { background: #fff1e6; color: #c2410c; border: 1px solid #fed7aa; }
html[data-theme='dark'] .badge-moodle { background: rgba(249, 115, 22, 0.14); color: #fdba74; border-color: rgba(249, 115, 22, 0.35); }
.moodle-card { margin-bottom: 18px; }
.moodle-sites { padding: 4px 22px 14px; }
.moodle-site { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.moodle-site:last-child { border-bottom: 0; }
.ms-main { flex: 1; min-width: 180px; }
.ms-name { font-weight: 800; color: var(--heading); }
.ms-url { font-size: 13px; color: var(--muted); }
.ms-status { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 200px; }
.ms-status small { color: var(--muted); font-size: 12px; }
.task-card { display: flex; gap: 14px; padding: 16px 18px; align-items: flex-start; border-left: 5px solid var(--line); }
.task-card.urgent { border-left-color: var(--orange); }
.task-card.overdue { border-left-color: var(--danger); }
.task-card.closed { opacity: 0.6; }
.task-card.closed .task-title { text-decoration: line-through; }
.task-check { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; margin-top: 2px; padding: 0; }
.task-check:hover { border-color: var(--orange); }
.task-check.on { background: var(--orange); border-color: var(--orange); }
.task-check.on svg { stroke: #fff; width: 16px; height: 16px; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 800; color: var(--heading); font-size: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.task-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.task-due { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.task-due svg { width: 15px; height: 15px; }
.task-due b { color: var(--heading); }
.task-due .overdue { color: var(--danger); }
.task-labels { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: var(--surface-3); color: var(--muted); }
.label svg { width: 12px; height: 12px; }
.task-notes { margin-top: 8px; font-size: 14px; color: var(--text); background: var(--surface-2); border-radius: 10px; padding: 8px 12px; white-space: pre-line; }
.task-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.prio { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.prio-1 { background: var(--surface-3); color: var(--muted); }
.prio-2 { background: var(--orange-soft); color: #c2410c; }
.prio-3 { background: #fee2e2; color: #b91c1c; }
html[data-theme='dark'] .prio-2 { color: #fdba74; }
html[data-theme='dark'] .prio-3 { background: rgba(220, 38, 38, 0.18); color: #f87171; }
@media (max-width: 720px) {
  .task-card { flex-wrap: wrap; }
  .task-actions { flex-direction: row; width: 100%; justify-content: space-between; align-items: center; }
}
.nodue { margin-top: 18px; }
.nodue summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--heading); padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; }
.nodue summary::-webkit-details-marker { display: none; }
.nodue summary svg { stroke: var(--orange); }
.nodue summary .count { background: var(--surface-3); border-radius: 999px; padding: 0 8px; font-size: 12px; }
