/* AttendIt — mobile-first, no framework.
   Color tokens per specification section 6.5. */

:root {
  --color-primary: #2563EB;
  --color-primary-soft: #DBEAFE;
  --color-success: #16A34A;
  --color-warning: #F59E0B;
  --color-danger: #DC2626;
  --color-neutral-900: #0F172A;
  --color-neutral-700: #334155;
  --color-neutral-600: #475569;
  --color-neutral-400: #94A3B8;
  --color-neutral-200: #E2E8F0;
  --color-neutral-100: #F1F5F9;
  --color-neutral-50: #F8FAFC;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 14px rgba(15, 23, 42, 0.06);
  --header-h: 56px;
  --bottomnav-h: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-neutral-900);
  background: var(--color-neutral-50);
}

h1, h2, h3 { margin: 0 0 10px; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 10px; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font: inherit; }

:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 6px;
}

.muted { color: var(--color-neutral-600); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }

.row { display: flex; align-items: center; }
.row.gap { gap: 10px; }
.row.wrap { flex-wrap: wrap; }

/* ---------- header ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: var(--header-h);
  padding: 0 14px;
  background: #fff;
  border-bottom: 1px solid var(--color-neutral-200);
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-primary);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }

.mode-toggle {
  display: flex;
  background: var(--color-neutral-100);
  border: 1px solid var(--color-neutral-200);
  border-radius: 999px;
  padding: 3px;
}
.mt-btn {
  border: 0;
  background: transparent;
  padding: 6px 16px;
  border-radius: 999px;
  font-weight: 600;
  color: var(--color-neutral-600);
  cursor: pointer;
}
.mt-btn.active {
  background: var(--color-primary);
  color: #fff;
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: var(--color-neutral-700);
}
.icon-btn:hover { background: var(--color-neutral-100); text-decoration: none; }
.icon-btn.active { color: var(--color-primary); }

.badge {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--color-neutral-200);
  background: #fff;
  border-radius: 999px;
  padding: 4px 12px 4px 5px;
  cursor: pointer;
  max-width: 170px;
}
.user-chip:hover { background: var(--color-neutral-100); }
.user-chip span:last-child {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex: 0 0 auto;
}

/* ---------- shell / nav ---------- */

.shell {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
}

.sidebar { display: none; }

.view {
  flex: 1;
  padding: 16px 14px calc(var(--bottomnav-h) + 28px);
  min-width: 0;
}
.view:focus { outline: none; }

.page-title { margin: 6px 2px 14px; }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: space-around;
  background: #fff;
  border-top: 1px solid var(--color-neutral-200);
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
}
.bottom-nav a, .bottom-nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: none;
  color: var(--color-neutral-600);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.bottom-nav .active { color: var(--color-primary); }

.app-footer {
  text-align: center;
  color: var(--color-neutral-400);
  font-size: 0.78rem;
  padding: 10px 16px calc(var(--bottomnav-h) + 14px);
}

/* more sheet (mobile) - the UA hides the dialog until [open] */
.sheet { border: 0; border-radius: 0; padding: 0; margin: 0; }
.sheet::backdrop { background: rgba(15, 23, 42, 0.45); }
.sheet-inner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 18px 16px 26px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 70vh;
  overflow: auto;
}
.sheet-inner a, .sheet-inner .danger {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 10px;
  border-radius: 10px;
  color: var(--color-neutral-900);
  font-weight: 600;
  border: 0;
  background: none;
  font-size: 1rem;
  cursor: pointer;
}
.sheet-inner a:hover { background: var(--color-neutral-100); text-decoration: none; }
.sheet-inner .danger { color: var(--color-danger); justify-content: center; }
.sheet-close {
  position: absolute;
  top: 8px;
  right: 12px;
  border: 0;
  background: var(--color-neutral-100);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
}

/* ---------- cards / grids ---------- */

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.card {
  background: #fff;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
  min-width: 0;
}
.card-title { margin-bottom: 10px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.card-head .card-title { margin-bottom: 0; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat-card {
  border: 1px solid var(--color-neutral-200);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}
.stat-title { font-size: 0.8rem; color: var(--color-neutral-600); font-weight: 600; }
.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.2; }
.stat-sub { font-size: 0.78rem; }
.tone-success { border-left: 4px solid var(--color-success); }
.tone-warning { border-left: 4px solid var(--color-warning); }
.tone-danger { border-left: 4px solid var(--color-danger); }
.tone-neutral { border-left: 4px solid var(--color-neutral-200); }

.kv { margin: 0; }
.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--color-neutral-100);
}
.kv-row:last-child { border-bottom: 0; }
.kv-row dt { color: var(--color-neutral-600); margin: 0; }
.kv-row dd { margin: 0; font-weight: 600; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--color-neutral-200);
  background: #fff;
  color: var(--color-neutral-900);
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  text-decoration: none;
}
.btn:hover { background: var(--color-neutral-100); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn-primary:hover { background: #1D4ED8; }
.btn-danger { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-warning { background: var(--color-warning); border-color: var(--color-warning); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: 0.85rem; border-radius: 8px; }
.btn-block { width: 100%; }

.big-btn {
  width: 100%;
  padding: 18px;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  border-radius: 14px;
  margin: 14px 0;
  min-height: 64px;
}

.linklike {
  border: 0;
  background: none;
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  padding: 8px 4px;
  text-align: left;
  font-size: 0.95rem;
}
.linklike:hover { text-decoration: underline; }

.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); }
  50% { box-shadow: 0 0 0 12px rgba(220, 38, 38, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* ---------- chips ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.chip-success { background: #DCFCE7; color: #166534; }
.chip-warning { background: #FEF3C7; color: #92400E; }
.chip-danger { background: #FEE2E2; color: #991B1B; }
.chip-info { background: var(--color-primary-soft); color: #1E40AF; }
.chip-neutral { background: var(--color-neutral-100); color: var(--color-neutral-700); }
.chip-btn {
  cursor: pointer;
  border: 1px solid var(--color-neutral-200);
  background: #fff;
  font-size: 0.8rem;
  padding: 6px 14px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---------- forms ---------- */

.field { display: block; margin-bottom: 12px; min-width: 0; }
.field-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; color: var(--color-neutral-700); }
.field-hint { display: block; font-size: 0.78rem; margin-top: 4px; }

.input {
  width: 100%;
  border: 1px solid var(--color-neutral-200);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: var(--color-neutral-900);
  min-height: 44px;
}
.input:focus { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 3px var(--color-primary-soft); }
.input-color { padding: 4px; height: 44px; width: 90px; }

.checkrow { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 0.92rem; cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--color-primary); }

.form-card {
  border: 1px solid var(--color-neutral-200);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  background: var(--color-neutral-50);
}
.form-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.list-group { display: flex; flex-direction: column; gap: 8px; }
.list-dates { display: flex; flex-direction: column; gap: 6px; }
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--color-neutral-200);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.9rem;
}

/* ---------- toasts / modal ---------- */

.toasts {
  position: fixed;
  bottom: calc(var(--bottomnav-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--color-success); }
.toast-info { background: var(--color-neutral-700); }
.toast-warning { background: var(--color-warning); }
.toast-danger { background: var(--color-danger); }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ---------- charts ---------- */

.chart-wrap { margin: 6px 0; min-width: 0; }
.chart-center { display: flex; justify-content: center; margin: 8px 0; }
.chart-label { font-size: 10px; fill: var(--color-neutral-600); }
.chart-grid { stroke: var(--color-neutral-100); stroke-width: 1; }
.donut-value { font-size: 24px; font-weight: 700; fill: var(--color-neutral-900); }

.progress {
  height: 10px;
  background: var(--color-neutral-100);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0;
}
.progress-fill { height: 100%; border-radius: 999px; transition: width 0.4s; }

/* ---------- dashboard pieces ---------- */

.today-block { padding: 10px 0; border-bottom: 1px dashed var(--color-neutral-100); }
.today-block:last-child { border-bottom: 0; }
.today-block-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.today-rows { display: flex; flex-direction: column; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--color-neutral-100);
  flex-wrap: wrap;
}
.mini-list li:last-child { border-bottom: 0; }
.mini-list .dot { flex: 0 0 auto; }

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
  background: var(--color-neutral-400);
}
.dot-present { background: var(--color-success); }
.dot-absent { background: var(--color-danger); }
.dot-incomplete { background: var(--color-warning); }
.dot-off { background: var(--color-neutral-200); }

.subj-list { display: flex; flex-direction: column; gap: 12px; }
.subj-row { display: grid; grid-template-columns: minmax(90px, 40%) 1fr; gap: 10px; align-items: center; }
.subj-name { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 0.92rem; min-width: 0; }
.subj-name span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subj-bar-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.subj-bar-wrap .progress { flex: 1; margin: 0; }
.subj-pct { font-size: 0.82rem; font-weight: 700; min-width: 48px; text-align: right; }

/* ---------- attendance ---------- */

.tabs {
  display: flex;
  gap: 6px;
  background: var(--color-neutral-100);
  border: 1px solid var(--color-neutral-200);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 14px;
}
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 10px;
  border-radius: 9px;
  font-weight: 700;
  color: var(--color-neutral-600);
  cursor: pointer;
}
.tab.active { background: #fff; color: var(--color-primary); box-shadow: var(--shadow); }

.clock-time {
  font-size: 2.6rem;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.clock-card { text-align: center; }
.clock-card .row { justify-content: center; }

.class-list { display: flex; flex-direction: column; gap: 10px; }
.class-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--color-neutral-200);
  border-radius: 10px;
  padding: 10px 12px;
  flex-wrap: wrap;
}
.class-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.class-name { font-weight: 700; }
.mark-group { display: flex; gap: 6px; }
.mark-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid var(--color-neutral-200);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}
.mark-btn.ok.active { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.mark-btn.no.active { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.mark-btn.ex.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

.strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.strip-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--color-neutral-200);
  background: #fff;
  border-radius: 10px;
  padding: 8px 2px;
  cursor: pointer;
}
.strip-day:hover { background: var(--color-neutral-100); }
.strip-day.today { border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary-soft); }
.strip-dow { font-size: 0.68rem; color: var(--color-neutral-600); font-weight: 600; }
.strip-num { font-size: 0.95rem; font-weight: 700; }

/* ---------- subjects / timetable ---------- */

.subject-cards { display: grid; grid-template-columns: 1fr; gap: 12px; }
.subject-card {
  border: 1px solid var(--color-neutral-200);
  border-top: 5px solid var(--subj-color, var(--color-primary));
  border-radius: 10px;
  padding: 14px;
  background: #fff;
}
.subject-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.subject-name { font-weight: 700; font-size: 1.02rem; }
.subject-pct { font-size: 1.7rem; font-weight: 800; margin: 8px 0 2px; }

.tt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.tt-col {
  border: 1px solid var(--color-neutral-200);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
  min-height: 80px;
}
.tt-col.tt-today { border-color: var(--color-primary); background: var(--color-primary-soft); }
.tt-day { font-weight: 700; font-size: 0.85rem; margin-bottom: 8px; color: var(--color-neutral-700); }
.tt-entry {
  position: relative;
  background: var(--color-neutral-50);
  border-radius: 8px;
  padding: 7px 24px 7px 9px;
  margin-bottom: 7px;
  font-size: 0.82rem;
}
.tt-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.tt-name { font-weight: 600; }
.tt-meta { color: var(--color-neutral-600); font-size: 0.75rem; }
.tt-empty { padding: 4px 2px; }
.tt-del {
  position: absolute;
  top: 4px;
  right: 4px;
  border: 0;
  background: none;
  color: var(--color-neutral-400);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.tt-del:hover { color: var(--color-danger); }

/* ---------- reports / tables ---------- */

.report-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}
.report-section { margin-bottom: 22px; }
.section-title { margin-bottom: 10px; }
.sub-title { margin: 16px 0 8px; font-size: 0.95rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--color-neutral-200); border-radius: 10px; margin-bottom: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.84rem; min-width: 560px; }
.table th {
  text-align: left;
  background: var(--color-neutral-100);
  padding: 8px 10px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-neutral-600);
  white-space: nowrap;
}
.table td { padding: 7px 10px; border-top: 1px solid var(--color-neutral-100); white-space: nowrap; }
.table tbody tr:hover { background: var(--color-neutral-50); }

/* ---------- alerts ---------- */

.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--color-neutral-200);
  border-left-width: 5px;
  margin-bottom: 10px;
  background: #fff;
  flex-wrap: wrap;
}
.alert-item:last-child { margin-bottom: 0; }
.alert-danger { border-left-color: var(--color-danger); background: #FEF2F2; }
.alert-warning { border-left-color: var(--color-warning); background: #FFFBEB; }
.alert-info { border-left-color: var(--color-primary); background: #EFF6FF; }
.alert-title { font-weight: 700; }
.alert-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.alert-check { display: flex; width: 100%; }
.alert-check + .alert-check { margin-top: 8px; }

/* ---------- auth pages ---------- */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(160deg, var(--color-neutral-50), var(--color-primary-soft));
}
.auth-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
  width: 100%;
  max-width: 400px;
}
.auth-brand { text-align: center; color: var(--color-primary); margin-bottom: 18px; }
.auth-brand h1 { color: var(--color-neutral-900); font-size: 1.5rem; margin: 8px 0 4px; }
.auth-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.92rem;
  flex-wrap: wrap;
}

/* ---------- responsive: md ---------- */

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .stat-row { grid-template-columns: repeat(3, 1fr); }
  .strip { grid-template-columns: repeat(14, 1fr); }
  .subject-cards { grid-template-columns: repeat(2, 1fr); }
  .tt-grid { grid-template-columns: repeat(4, 1fr); }
  .report-controls { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- responsive: lg ---------- */

@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .stat-row { grid-template-columns: repeat(5, 1fr); }
  .subject-cards { grid-template-columns: repeat(3, 1fr); }
  .tt-grid { grid-template-columns: repeat(7, 1fr); }

  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 220px;
    flex: 0 0 auto;
    padding: 18px 12px;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
  }
  .sidebar a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 14px;
    border-radius: 10px;
    color: var(--color-neutral-700);
    font-weight: 600;
  }
  .sidebar a:hover { background: var(--color-neutral-100); text-decoration: none; }
  .sidebar a.active { background: var(--color-primary-soft); color: var(--color-primary); }

  .bottom-nav { display: none; }
  .view { padding: 22px 24px 40px; }
  .app-footer { padding-bottom: 16px; }
  .hide-sm { display: inline; }
  .toasts { bottom: 24px; }
}

@media (max-width: 1023px) {
  .hide-sm { display: none; }
}

/* ---------- print (PDF via browser) ---------- */

@media print {
  .app-header, .sidebar, .bottom-nav, .app-footer, .toasts, .tabs,
  .report-controls, .form-actions, .btn, .alert-actions, .sheet { display: none !important; }
  body { background: #fff; }
  .view { padding: 0; }
  .card { box-shadow: none; border: none; padding: 8px 0; break-inside: avoid; }
  .table-wrap { overflow: visible; border: none; }
  .table { min-width: 0; font-size: 11px; }
  .table td, .table th { white-space: normal; }
}

/* ---------- calendar (job + college) ---------- */

.dot-late { background: var(--color-warning); }
.dot-holiday { background: #7C3AED; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow {
  font-size: 0.62rem; font-weight: 700; color: var(--color-neutral-600);
  text-align: center; padding: 2px 0; text-transform: uppercase; letter-spacing: 0.03em;
}
.cal-blank { }
.cal-day {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 48px; padding: 5px 2px;
  background: #fff; border: 1px solid var(--color-neutral-200); border-radius: 10px;
  cursor: pointer; font: inherit;
}
.cal-day:hover:not(:disabled) { border-color: var(--color-primary); }
.cal-day:disabled { opacity: 0.4; cursor: default; }
.cal-day.today { box-shadow: 0 0 0 2px var(--color-primary-soft); border-color: var(--color-primary); }
.cal-num { font-size: 0.78rem; font-weight: 700; line-height: 1; }
.cal-day .dot { width: 7px; height: 7px; flex: 0 0 auto; }
.cal-note { position: absolute; top: 3px; right: 4px; font-size: 0.58rem; color: var(--color-neutral-600); }
.cal-day.cal-weekoff, .cal-day.cal-future { background: var(--color-neutral-50); }
.cal-day.cal-holiday { background: #F5F3FF; }
.cal-day.cal-missed { background: #FEF2F2; }
.cal-day.has { background: var(--color-neutral-100); }
.cal-subj-dots { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; max-width: 90%; }
.subj-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.subj-dot.no { opacity: 0.35; }
.subj-dot.cxl { opacity: 0.18; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 10px; }
.cal-legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: 0.68rem; color: var(--color-neutral-600); }
.cal-note-line { margin-top: 10px; }
.cal-nav { flex-wrap: wrap; }
.cal-label { min-width: 112px; }

@media (max-width: 480px) {
  .cal-day { min-height: 42px; border-radius: 8px; }
  .cal-num { font-size: 0.72rem; }
}

/* ---------- streaks ---------- */

.streak-row { display: flex; gap: 10px; }
.streak-item { flex: 1; text-align: center; }
.streak-num { font-size: 1.55rem; font-weight: 800; color: var(--color-primary); line-height: 1.2; }
