/* =============================================================
   IIM Timetable — shadcn/ui-style design system
   Neutral tokens, hairline borders, soft shadows, calm surfaces.
   Responsive: sidebar layout on desktop, bottom tabs on mobile.
   ============================================================= */

:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --destructive: 0 72% 51%;
  --destructive-foreground: 0 0% 98%;
  --success: 142 64% 38%;
  --warning: 35 92% 45%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5% 65%;
  --radius: 0.65rem;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08);
  --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.10), 0 2px 6px -2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 12px 32px -8px rgb(0 0 0 / 0.18);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code", monospace;

  --sidebar-w: 256px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

[data-theme="dark"] {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 6% 10%;
  --card-foreground: 0 0% 98%;
  --popover: 240 8% 7%;
  --popover-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 5.9% 10%;
  --secondary: 240 3.7% 15.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 3.7% 17%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 72% 51%;
  --destructive-foreground: 0 0% 98%;
  --success: 142 64% 45%;
  --warning: 35 92% 55%;
  --border: 240 3.7% 16%;
  --input: 240 3.7% 18%;
  --ring: 240 4.9% 45%;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 8px; border: 3px solid hsl(var(--background)); }

/* =============================================================
   App layout
   ============================================================= */
.layout { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  display: none;
  flex-direction: column;
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  padding: 16px 12px;
  gap: 4px;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 14px;
}
.side-brand .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  display: grid; place-items: center; flex-shrink: 0;
}
.side-brand .logo svg { width: 19px; height: 19px; }
.side-brand .bn { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; line-height: 1.1; }
.side-brand .bs { font-size: 12px; color: hsl(var(--muted-foreground)); }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid hsl(var(--border)); }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 9px 11px;
  border: none; background: none;
  border-radius: calc(var(--radius) - 2px);
  font-size: 14px; font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-align: left;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.nav-item.active { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); font-weight: 600; }
.nav-item .nav-ava { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
  background: hsl(var(--background) / 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid hsl(var(--border));
}
.appbar-main { display: flex; flex-direction: column; min-width: 0; }
.appbar-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.appbar-status { display: flex; align-items: center; gap: 7px; font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 1px; }
.appbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.alert-slot:empty { display: none; }
.page {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px calc(96px + var(--safe-bottom));
}

/* sync status dot */
.dot { width: 7px; height: 7px; border-radius: 50%; background: hsl(var(--success)); flex-shrink: 0; }
.dot.demo { background: hsl(var(--warning)); }
.dot.err { background: hsl(var(--destructive)); }

/* =============================================================
   Icon buttons
   ============================================================= */
.icon-btn {
  width: 36px; height: 36px;
  border-radius: calc(var(--radius) - 2px);
  display: grid; place-items: center;
  border: 1px solid transparent;
  background: transparent;
  color: hsl(var(--foreground));
  transition: background .15s, border-color .15s, transform .1s;
}
.icon-btn:hover { background: hsl(var(--accent)); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid hsl(var(--border)); cursor: pointer; }

/* =============================================================
   Buttons
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  font-size: 14px; font-weight: 600;
  transition: background .15s, border-color .15s, transform .08s, opacity .15s;
}
.btn:active { transform: scale(0.985); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.btn-primary:hover { opacity: .9; }
.btn-glass, .btn-outline { background: hsl(var(--background)); color: hsl(var(--foreground)); border-color: hsl(var(--border)); }
.btn-glass:hover, .btn-outline:hover { background: hsl(var(--accent)); }
.btn-row { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; }

/* =============================================================
   Cards / Now-Next board
   ============================================================= */
.board { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.tt-layout { display: grid; gap: 18px; grid-template-columns: 1fr; }
.tt-rail { min-width: 0; }
.tt-main { min-width: 0; }
.card {
  position: relative;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  padding: 15px;
  min-height: 128px;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: var(--shadow-sm);
}
.card.now { border-color: hsl(var(--foreground) / 0.22); }
.card-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.card.now .card-label { color: hsl(var(--foreground)); }
.card-code { font-size: 21px; font-weight: 750; letter-spacing: -0.02em; margin: 8px 0 3px; }
.card-room { font-size: 13px; color: hsl(var(--muted-foreground)); font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-meta { font-size: 12.5px; color: hsl(var(--muted-foreground)); font-weight: 500; font-variant-numeric: tabular-nums; }
.card-empty { margin: auto 0; font-size: 14px; color: hsl(var(--muted-foreground)); }
.card-pip { position: absolute; top: 14px; right: 14px; width: 9px; height: 9px; border-radius: 50%; }
.card-progress { height: 6px; border-radius: 99px; background: hsl(var(--muted)); overflow: hidden; margin-top: 10px; }
.card-progress-fill { height: 100%; border-radius: 99px; transition: width .8s cubic-bezier(.4,0,.2,1); }
.card-remaining { font-size: 11px; font-weight: 600; color: hsl(var(--muted-foreground)); margin-top: 5px; font-variant-numeric: tabular-nums; }
.seat { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: hsl(var(--secondary-foreground)); background: hsl(var(--secondary)); border-radius: 6px; padding: 2px 7px; }
.seat svg { width: 11px; height: 11px; }

/* =============================================================
   Timetable toolbar + day cards
   ============================================================= */
.section-title { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: hsl(var(--muted-foreground)); padding: 6px 2px 8px; }
.tt-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tt-scope { font-size: 13px; font-weight: 600; color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; }

.seg { display: inline-flex; background: hsl(var(--muted)); border-radius: calc(var(--radius) - 2px); padding: 3px; gap: 2px; }
.seg button { border: none; background: none; padding: 6px 14px; border-radius: calc(var(--radius) - 4px); font-size: 13px; font-weight: 500; color: hsl(var(--muted-foreground)); transition: background .15s, color .15s; }
.seg button.on { background: hsl(var(--background)); color: hsl(var(--foreground)); box-shadow: var(--shadow-sm); font-weight: 600; }

.days { display: grid; gap: 14px; grid-template-columns: 1fr; }
.day {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.day.today { border-color: hsl(var(--foreground) / 0.3); }
.day-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid hsl(var(--border)); }
.day-name { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.day-date { font-size: 12px; color: hsl(var(--muted-foreground)); font-weight: 500; font-variant-numeric: tabular-nums; }
.tag-today { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: hsl(var(--primary-foreground)); background: hsl(var(--primary)); border-radius: 99px; padding: 2px 8px; }

.slot { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid hsl(var(--border)); transition: background .15s, opacity .2s; }
.slot:last-child { border-bottom: none; }
.slot.absent { opacity: .5; }
.slot-time { width: 66px; flex-shrink: 0; display: flex; flex-direction: column; gap: 1px; font-family: var(--mono); font-size: 11px; font-variant-numeric: tabular-nums; line-height: 1.3; }
.slot-time .t1 { color: hsl(var(--foreground)); font-weight: 600; }
.slot-time .t2 { color: hsl(var(--muted-foreground)); }
.slot-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.slot-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; padding: 3px 9px 3px 8px; border-radius: 99px; background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); border: 1px solid hsl(var(--border)); }
.badge .bdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.lec-num { font-size: 11px; font-weight: 600; color: hsl(var(--muted-foreground)); }
.chip { font-size: 12px; font-weight: 500; color: hsl(var(--muted-foreground)); background: hsl(var(--muted)); border-radius: 6px; padding: 2px 8px; }
.info-line { font-size: 13px; color: hsl(var(--muted-foreground)); font-weight: 500; }
.empty-day { padding: 16px; font-size: 13px; color: hsl(var(--muted-foreground)); }
.slot-event { padding: 0; }
.event-banner { width: 100%; padding: 12px 14px; font-size: 12.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: hsl(var(--warning)); background: hsl(var(--warning) / 0.1); border-left: 3px solid hsl(var(--warning)); }

/* attendance toggle button on a slot */
.attend { flex-shrink: 0; width: 34px; height: 34px; border-radius: calc(var(--radius) - 3px); border: 1px solid hsl(var(--success) / 0.5); background: hsl(var(--success) / 0.12); color: hsl(var(--success)); display: grid; place-items: center; transition: transform .1s, background .15s; }
.attend svg { width: 17px; height: 17px; }
.attend:active { transform: scale(0.88); }
.attend.is-absent { border-color: hsl(var(--destructive) / 0.5); background: hsl(var(--destructive) / 0.12); color: hsl(var(--destructive)); }
.attend.pop { animation: pop .42s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop { 0%{transform:scale(1)} 32%{transform:scale(1.2)} 62%{transform:scale(.93)} 100%{transform:scale(1)} }

/* =============================================================
   Calendar
   ============================================================= */
.cal { max-width: 460px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-month { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 18px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 600; color: hsl(var(--muted-foreground)); padding: 4px 0; }
.cal-day { aspect-ratio: 1; border: none; border-radius: calc(var(--radius) - 3px); background: transparent; color: hsl(var(--muted-foreground)); font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; display: flex; align-items: center; justify-content: center; position: relative; transition: background .12s, transform .1s; }
.cal-day:hover { background: hsl(var(--accent)); }
.cal-day:active { transform: scale(.92); }
.cal-day.has { color: hsl(var(--foreground)); font-weight: 600; }
.cal-day.other { opacity: .35; }
.cal-day.today { box-shadow: inset 0 0 0 1px hsl(var(--border)); color: hsl(var(--foreground)); }
.cal-day.sel { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)) !important; }
.cal-mark { position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .6; }
.cal-detail { border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); overflow: hidden; box-shadow: var(--shadow-sm); }
.cal-detail-head { padding: 12px 14px; border-bottom: 1px solid hsl(var(--border)); font-size: 14px; font-weight: 650; }

/* =============================================================
   Attendance
   ============================================================= */
.att { display: grid; gap: 14px; grid-template-columns: 1fr; }
.att-card { border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); overflow: hidden; box-shadow: var(--shadow-sm); }
.att-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px 10px; }
.att-subject { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.att-subject .bdot { width: 9px; height: 9px; border-radius: 50%; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; font-variant-numeric: tabular-nums; transition: background .3s, color .3s; }
.pill.ok { background: hsl(var(--success) / 0.14); color: hsl(var(--success)); }
.pill.warn { background: hsl(var(--warning) / 0.16); color: hsl(var(--warning)); }
.pill.danger { background: hsl(var(--destructive) / 0.14); color: hsl(var(--destructive)); }
.bar-track { height: 6px; border-radius: 99px; background: hsl(var(--muted)); margin: 0 14px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; transition: width .5s cubic-bezier(.4,0,.2,1); }
.att-stats { font-size: 12px; color: hsl(var(--muted-foreground)); font-weight: 500; padding: 8px 14px 2px; font-variant-numeric: tabular-nums; }
.att-lecs { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px 14px 16px; }
.lec { position: relative; width: 38px; height: 38px; border-radius: calc(var(--radius) - 3px); border: 1px solid hsl(var(--border)); background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); font-size: 13px; font-weight: 600; display: grid; place-items: center; font-variant-numeric: tabular-nums; transition: transform .1s; }
.lec:active { transform: scale(.86); }
.lec.present { border-color: hsl(var(--success) / 0.5); background: hsl(var(--success) / 0.12); color: hsl(var(--success)); }
.lec.absent { border-color: hsl(var(--destructive) / 0.5); background: hsl(var(--destructive) / 0.12); color: hsl(var(--destructive)); }
.lec.pending { box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 3px hsl(var(--warning)); }
.lec.noted::after { content: ""; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--foreground)); border: 2px solid hsl(var(--background)); }
.lec.pop { animation: pop .42s cubic-bezier(.34,1.56,.64,1); }

/* absence reporting form card */
.form-card { border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); overflow: hidden; box-shadow: var(--shadow-sm); margin-bottom: 14px; }
.form-card.warn { border-color: hsl(var(--warning) / 0.5); }
.form-open { width: 100%; display: flex; align-items: center; gap: 10px; padding: 13px 14px; border: none; background: none; font-size: 14px; font-weight: 600; color: hsl(var(--foreground)); transition: background .15s; }
.form-open:hover { background: hsl(var(--accent)); }
.form-open svg:first-child { width: 18px; height: 18px; }
.form-open span { flex: 1; text-align: left; }
.form-open svg:last-child { width: 15px; height: 15px; color: hsl(var(--muted-foreground)); }
.form-pending, .form-ok { display: flex; align-items: center; gap: 8px; padding: 9px 14px; font-size: 12.5px; font-weight: 600; border-top: 1px solid hsl(var(--border)); }
.form-pending { color: hsl(var(--warning)); }
.form-pending svg { width: 15px; height: 15px; }
.form-ok { color: hsl(var(--success)); }
.form-ok svg { width: 15px; height: 15px; }

/* =============================================================
   Notes
   ============================================================= */
.note-add { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.note-add input { flex: 1; }
.np-add { width: 42px; height: 42px; flex-shrink: 0; border-radius: calc(var(--radius) - 2px); background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border: none; }
.np-add:hover { opacity: .9; }
.np-add svg { width: 20px; height: 20px; }
.notes { display: grid; gap: 10px; grid-template-columns: 1fr; }
.note-item { display: flex; align-items: flex-start; gap: 11px; padding: 13px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); box-shadow: var(--shadow-sm); transition: opacity .22s, transform .22s; }
.note-item.removing { opacity: 0; transform: translateX(30px); }
.note-check { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid hsl(var(--border)); background: transparent; color: hsl(var(--primary-foreground)); display: grid; place-items: center; transition: background .15s, border-color .15s, transform .1s; }
.note-check svg { width: 14px; height: 14px; }
.note-item.done .note-check { background: hsl(var(--success)); border-color: hsl(var(--success)); }
.note-check.pop { animation: pop .42s cubic-bezier(.34,1.56,.64,1); }
.note-text { flex: 1; min-width: 0; min-height: 22px; font-size: 14.5px; line-height: 1.5; outline: none; word-break: break-word; white-space: pre-wrap; border-radius: 4px; }
.note-text:focus { box-shadow: 0 0 0 2px hsl(var(--ring) / 0.5); }
.note-item.done .note-text { color: hsl(var(--muted-foreground)); text-decoration: line-through; }
.note-del { flex-shrink: 0; width: 30px; height: 30px; border: none; background: none; color: hsl(var(--muted-foreground)); border-radius: 7px; display: grid; place-items: center; transition: color .15s, background .15s; }
.note-del:hover { color: hsl(var(--destructive)); background: hsl(var(--destructive) / 0.1); }
.note-del svg { width: 16px; height: 16px; }

/* =============================================================
   Inputs
   ============================================================= */
input[type="search"], input[type="number"], input[type="text"], textarea {
  width: 100%;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  color: hsl(var(--foreground));
  padding: 10px 12px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 15px; font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: hsl(var(--ring)); box-shadow: 0 0 0 3px hsl(var(--ring) / 0.25); }
input::placeholder, textarea::placeholder { color: hsl(var(--muted-foreground)); }

/* =============================================================
   Alerts / warning banner / toast
   ============================================================= */
.warn-banner { display: flex; align-items: center; gap: 9px; margin: 12px 16px 0; padding: 10px 13px; border-radius: var(--radius); font-size: 13px; font-weight: 500; color: hsl(var(--warning)); background: hsl(var(--warning) / 0.1); border: 1px solid hsl(var(--warning) / 0.4); }
.warn-banner svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-bottom)); transform: translateX(-50%) translateY(16px); background: hsl(var(--popover)); color: hsl(var(--popover-foreground)); border: 1px solid hsl(var(--border)); padding: 10px 16px; border-radius: 99px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 80; opacity: 0; transition: opacity .25s, transform .3s cubic-bezier(.34,1.56,.64,1); pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* =============================================================
   Bottom tab bar (mobile)
   ============================================================= */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; background: hsl(var(--background) / 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid hsl(var(--border)); padding-bottom: var(--safe-bottom); }
.tab { flex: 1; border: none; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px 8px; color: hsl(var(--muted-foreground)); font-size: 10.5px; font-weight: 500; transition: color .15s; }
.tab svg { width: 22px; height: 22px; }
.tab.active { color: hsl(var(--foreground)); font-weight: 600; }

/* =============================================================
   Overlays: bottom sheet + centered popup
   ============================================================= */
.overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: rgb(0 0 0 / 0.5); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet { width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; border-radius: var(--radius) var(--radius) 0 0; background: hsl(var(--popover)); color: hsl(var(--popover-foreground)); border: 1px solid hsl(var(--border)); box-shadow: var(--shadow-lg); padding-bottom: var(--safe-bottom); animation: slideup .3s cubic-bezier(.32,.72,0,1); }
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-grip { width: 36px; height: 4px; border-radius: 99px; background: hsl(var(--border)); margin: 10px auto 2px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px 12px; border-bottom: 1px solid hsl(var(--border)); }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.sheet-body { padding: 14px 16px; overflow-y: auto; flex: 1; }
.sheet-foot { padding: 12px 16px; border-top: 1px solid hsl(var(--border)); }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 2px; border-bottom: 1px solid hsl(var(--border)); }
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 15px; font-weight: 600; }
.setting-desc { font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 2px; max-width: 230px; }

.toplinks { display: flex; gap: 16px; font-size: 13px; font-weight: 600; margin: 10px 0; }
.toplinks span { color: hsl(var(--foreground)); cursor: pointer; }
.toplinks span:hover { text-decoration: underline; }
.pick { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid hsl(var(--border)); }
.pick:last-child { border-bottom: none; }
.pick label { display: flex; align-items: center; gap: 11px; flex: 1; font-size: 15px; cursor: pointer; }
.pick input[type="checkbox"] { width: 20px; height: 20px; accent-color: hsl(var(--primary)); }
.pick-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.pick-sub { font-weight: 600; }
.pick-sec { color: hsl(var(--muted-foreground)); font-size: 13px; }
.seat-input { width: 70px; margin: 0; padding: 7px; text-align: center; font-size: 14px; }
.seat-input.hidden { display: none; }

/* centered popup (absence note) */
.note-overlay { align-items: center; padding: 20px; }
.note-pop { width: 100%; max-width: 420px; border-radius: var(--radius); padding: 16px; background: hsl(var(--popover)); color: hsl(var(--popover-foreground)); border: 1px solid hsl(var(--border)); box-shadow: var(--shadow-lg); animation: popin .26s cubic-bezier(.34,1.56,.64,1); }
@keyframes popin { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.note-pop-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.note-pop-title { font-size: 16px; font-weight: 700; }
.note-pop-sub { font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 2px; }
.note-area { resize: none; }
.np-check { display: flex; align-items: center; gap: 10px; margin: 12px 2px; font-size: 14px; font-weight: 500; }
.np-check input { width: 20px; height: 20px; accent-color: hsl(var(--success)); }
.np-formlink { margin-bottom: 4px; }
.note-pop-foot { margin-top: 10px; }

/* =============================================================
   Empty / boot / setup (login + error)
   ============================================================= */
.empty { padding: 60px 24px; text-align: center; color: hsl(var(--muted-foreground)); font-size: 15px; line-height: 1.7; }
.empty .glyph { font-size: 38px; margin-bottom: 10px; }
.empty b { color: hsl(var(--foreground)); }
.boot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; min-height: 80vh; color: hsl(var(--muted-foreground)); font-size: 15px; }
.boot-glyph { width: 38px; height: 38px; border-radius: 50%; border: 3px solid hsl(var(--muted)); border-top-color: hsl(var(--foreground)); animation: spin .8s linear infinite; }
.setup { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.setup-logo { width: 72px; height: 72px; border-radius: 18px; display: grid; place-items: center; margin-bottom: 18px; background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.setup-logo svg { width: 40px; height: 40px; }
.setup-title { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; }
.setup-sub { color: hsl(var(--muted-foreground)); font-size: 15px; line-height: 1.6; margin: 8px 0 26px; max-width: 340px; }

/* =============================================================
   Focus rings (keyboard)
   ============================================================= */
:focus { outline: none; }
.icon-btn:focus-visible, .btn:focus-visible, .tab:focus-visible, .nav-item:focus-visible,
.cal-day:focus-visible, .lec:focus-visible, .attend:focus-visible, .seg button:focus-visible {
  outline: none; box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

/* =============================================================
   Responsive — desktop gets the sidebar + multi-column grids
   ============================================================= */
@media (min-width: 1024px) {
  .sidebar { display: flex; }
  .tabbar { display: none; }
  .only-mobile { display: none !important; }
  .page { padding: 24px 32px 48px; }
  .appbar { padding: 16px 32px; }

  /* Timetable: agenda (left) + sticky Now/Next rail (right) */
  .tt-layout { grid-template-columns: minmax(0, 1fr) 324px; align-items: start; }
  .tt-main { grid-column: 1; grid-row: 1; }
  .tt-rail { grid-column: 2; grid-row: 1; position: sticky; top: 88px; }
  .tt-rail .board { grid-template-columns: 1fr; margin-bottom: 0; }

  /* Attendance + Notes: masonry-style columns (no uneven row gaps) */
  .att, .notes { display: block; column-count: 2; column-gap: 16px; }
  .att-card, .note-item { break-inside: avoid; margin-bottom: 16px; }

  .cal-wrap { display: grid; grid-template-columns: 440px 1fr; gap: 28px; align-items: start; }
  .cal { max-width: none; }
}
@media (min-width: 1440px) {
  .att, .notes { column-count: 3; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}


/* =============================================================
   Refinements — hover elevation, focus, desktop polish
   ============================================================= */
@media (hover: hover) and (pointer: fine) {
  .day:hover, .att-card:hover, .note-item:hover, .form-card:hover, .cal-detail:hover {
    border-color: hsl(var(--foreground) / 0.18);
    box-shadow: var(--shadow-md);
  }
  .card:hover { box-shadow: var(--shadow-md); }
  .cal-day:hover { background: hsl(var(--accent)); }
}
.day, .att-card, .note-item, .form-card, .card { transition: box-shadow .18s ease, border-color .18s ease; }

/* active sidebar item uses a clean filled state (shadcn) */
.side-nav .nav-item { position: relative; }

/* desktop density + rhythm */
@media (min-width: 1024px) {
  .appbar-title { font-size: 20px; }
  .board { gap: 14px; }
  .day-head { padding: 13px 16px; }
  .slot { padding: 12px 16px; }
}

/* nicer empty states */
.empty { max-width: 420px; margin: 0 auto; }
