/* Школьный трекер питания — design tokens + layout.
   Palette (oklch), Inter type scale, 768px breakpoint (table -> cards). */

:root {
  --c-bg: oklch(97.5% 0.006 95);
  --c-surface: oklch(100% 0 0);
  --c-text: oklch(24% 0.02 260);
  --c-muted: oklch(52% 0.02 260);
  --c-border: oklch(90% 0.01 260);
  --c-accent: oklch(62% 0.14 150);       /* class / success green */
  --c-breakfast: oklch(78% 0.14 75);     /* amber */
  --c-lunch: oklch(62% 0.13 240);        /* blue */
  --c-absent: oklch(85% 0.005 260);      /* grey */
  --c-leave: oklch(58% 0.19 25);         /* red */
  --c-circle: oklch(60% 0.16 300);       /* purple star marker */
  --radius: 10px;
  --shadow-sm: 0 1px 2px oklch(0% 0 0 / 0.06), 0 1px 1px oklch(0% 0 0 / 0.04);
}

* { box-sizing: border-box; }

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, .dashboard__title { font-weight: 700; }

.dashboard { max-width: 1180px; margin: 0 auto; padding: 16px 16px 48px; }

.dashboard__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 0;
}

.dashboard__title {
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--c-text);
}
.dashboard__title i { color: var(--c-accent); }

.dashboard__datenav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 4px 8px;
}
.datenav__btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; color: var(--c-muted); text-decoration: none;
}
.datenav__btn:hover { background: var(--c-bg); }
.datenav__today {
  min-width: 110px;
  text-align: center;
  font-weight: 600;
  color: var(--c-text);
  text-decoration: none;
  padding: 4px 10px;
}
.datenav__today.is-today { color: var(--c-accent); }

.dashboard__actions { gap: 8px; }

.week-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
}
.week-strip__nav {
  flex: 0 0 auto;
  width: 30px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: var(--c-muted);
  text-decoration: none;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
}
.week-strip__nav:hover { background: var(--c-bg); color: var(--c-accent); }
.week-strip__track {
  flex: 1 1 auto;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px;
  touch-action: pan-x;
  cursor: grab;
}
.week-strip__track:active { cursor: grabbing; }
.week-strip__track::-webkit-scrollbar { display: none; }
.week-strip__day {
  flex: 1 1 0;
  min-width: 42px;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  border-radius: 10px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
  user-select: none;
}
.week-strip__day:hover { border-color: var(--c-accent); }
.week-strip__day.is-weekend { color: var(--c-muted); }
.week-strip__day.is-today .week-strip__num { color: var(--c-accent); }
.week-strip__day.is-selected {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: #fff;
}
.week-strip__day.is-selected .week-strip__num,
.week-strip__day.is-selected.is-today .week-strip__num { color: #fff; }
.week-strip__day:active { transform: scale(.95); }
.week-strip__dow { font-size: 11px; text-transform: uppercase; letter-spacing: .02em; opacity: .8; }
.week-strip__num { font-size: 15px; font-weight: 600; }

@media (max-width: 767.98px) {
  .week-strip__day { min-width: 40px; }
}

.help-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--c-muted);
}
.help-panel summary { cursor: pointer; font-weight: 600; color: var(--c-text); font-size: 14px; }
.help-panel__list { margin: 8px 0 2px; padding: 0; list-style: none; }
.help-panel__list li { margin-bottom: 4px; }

.dashboard-fade { transition: opacity .18s ease; }
@media (prefers-reduced-motion: reduce) { .dashboard-fade { transition: none; } }
.dashboard-fade.is-fading { opacity: 0; }

.lock-banner {
  background: oklch(97% 0.05 75 / 0.5);
  border: 1px solid var(--c-breakfast);
  color: oklch(38% 0.1 70);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 14px;
}
.lock-banner i { margin-right: 6px; }

.empty-state {
  background: var(--c-surface);
  border: 1px dashed var(--c-border);
  border-radius: var(--radius);
  padding: 32px 16px;
  text-align: center;
  color: var(--c-muted);
  margin-bottom: 14px;
}
.empty-state__icon { font-size: 28px; color: var(--c-accent); margin-bottom: 8px; display: block; }
.empty-state--schedule { text-align: left; }
.empty-state__grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }
.empty-state__grid-cell { height: 10px; border-radius: 4px; background: var(--c-bg); border: 1px solid var(--c-border); }

.dashboard-table {
  background: var(--c-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.dashboard-table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); border-bottom: 1px solid var(--c-border); }
.dashboard-table__name-col { width: 220px; position: sticky; left: 0; background: var(--c-surface); }
.dashboard-table__meal-col { width: 170px; }
.dashboard-table tbody tr:hover { background: oklch(98% 0.01 150); }

.student-name-btn {
  background: none; border: 0; padding: 0; font-weight: 600; color: var(--c-text);
  text-align: left; display: block;
}
.student-name-btn:hover { color: var(--c-accent); text-decoration: underline; }
.student-default-link {
  background: none; border: 0; padding: 0; font-size: 11px; color: var(--c-muted);
  text-decoration: underline dotted;
}

.meal-checks { display: flex; gap: 14px; }
.meal-check { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--c-muted); position: relative; margin: 0; }
.meal-check input[type="checkbox"] { accent-color: var(--c-breakfast); }
.meal-check--lunch input[type="checkbox"] { accent-color: var(--c-lunch); }
.meal-check.is-locked { opacity: .65; }
.meal-check__lock { font-size: 10px; color: var(--c-leave); }
.meal-anim { transition: transform .12s ease; }
.meal-anim:checked { transform: scale(1.15); }

.absent-bar {
  background: var(--c-absent);
  color: var(--c-muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  display: inline-block;
}

.cal-axis { position: relative; height: 14px; }
.cal-axis__tick { position: absolute; transform: translateX(-50%); font-size: 10px; color: var(--c-muted); }

.cal-timeline {
  position: relative;
  height: 34px;
  background-color: var(--c-bg);
  background-image: repeating-linear-gradient(
    to right,
    oklch(70% 0.01 260 / 0.55) 0,
    oklch(70% 0.01 260 / 0.55) 1px,
    transparent 1px,
    transparent var(--hour-step, 100%)
  );
  background-position: var(--hour-offset, 0) 0;
  background-repeat: repeat-x;
  border-radius: 6px;
}
.cal-timeline--mobile { margin: 8px 0; }
.cal-block { position: absolute; top: 3px; height: 14px; border-radius: 4px; opacity: .85; }
.cal-block--lesson { background: var(--c-lunch); }
.cal-block--break { background: var(--c-absent); }
.cal-block--circle {
  top: 19px; height: 11px; background: var(--c-circle); opacity: 1; min-width: 14px;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 8px; overflow: hidden;
}
.cal-leave-line {
  position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--c-leave);
}
.cal-block, .cal-leave-line { cursor: pointer; }
.cal-block:focus-visible, .cal-leave-line:focus-visible {
  outline: 2px solid var(--c-accent); outline-offset: 1px;
}

.cal-tooltip {
  position: fixed;
  z-index: 1080;
  max-width: 220px;
  background: var(--c-text, #1f2430);
  color: #fff;
  font-size: 12px;
  line-height: 1.35;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
  white-space: normal;
}
.cal-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 9px;
  height: 9px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}
.cal-tooltip--below { transform: translateY(-4px); }
.cal-tooltip--below::after { bottom: auto; top: -5px; }
.cal-tooltip.is-visible { opacity: 1; transform: translateY(0); }

.modal-weekday-badge { font-size: 12px; font-weight: 600; color: var(--c-circle); margin-top: 2px; }
.default-day-tabs { display: flex; gap: 6px; margin-bottom: 12px; padding-bottom: 2px; }
.default-day-tabs__link {
  border: 1px solid var(--c-border); border-radius: 999px; background: var(--c-surface);
  color: var(--c-text-secondary, var(--c-text)); font-size: 13px; font-weight: 500; padding: 5px 14px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.default-day-tabs__link:hover { border-color: var(--c-accent); color: var(--c-accent); }
.default-day-tabs__link.active { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.leave-warning {
  color: oklch(45% 0.15 70);
  background: oklch(97% 0.06 75 / 0.55);
  border: 1px solid var(--c-breakfast);
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 6px;
  font-size: 12.5px;
}
.leave-warning::before { content: "\f071"; font-family: "Font Awesome 6 Free"; font-weight: 900; margin-right: 6px; }
.circle-time-label { font-size: 11px; padding-left: 6px; padding-right: 6px; }

.student-cards { display: flex; flex-direction: column; gap: 10px; }
.student-card {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow-sm);
}
.student-card__name { background: none; border: 0; padding: 0; font-weight: 700; font-size: 16px; display: block; margin-bottom: 6px; color: var(--c-text); }

.export-page__list { columns: 2; }
@media (max-width: 480px) { .export-page__list { columns: 1; } }

/* Toasts */
.app-toast-host { position: fixed; bottom: 16px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.app-toast {
  background: var(--c-text); color: #fff; border-radius: 8px; padding: 10px 14px; font-size: 13px;
  box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 10px; min-width: 220px;
}
.app-toast--error { background: oklch(45% 0.18 25); }
.app-toast__retry { background: none; border: 1px solid oklch(100% 0 0 / 0.5); color: #fff; border-radius: 6px; padding: 2px 8px; font-size: 12px; }

:focus-visible { outline: 2px solid var(--c-lunch); outline-offset: 2px; }

@media (max-width: 767.98px) {
  .dashboard__header { flex-direction: column; align-items: stretch; }
  .dashboard__title { font-size: 18px; }
  .modal.fade .modal-dialog { transition: transform .2s ease-out; }
}
