/* Визуальная система: спокойные нейтральные тона, много воздуха, тонкие разделители,
   скругления и полупрозрачная шапка. Тёмная тема включается по настройке системы. */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .08);
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --hair: rgba(0, 0, 0, .08);
  --hair-strong: rgba(0, 0, 0, .14);
  --accent: #0071e3;
  --accent-ink: #0066cc;
  --accent-tint: rgba(0, 113, 227, .10);
  --red: #ff3b30;
  --red-ink: #d70015;
  --red-tint: rgba(255, 59, 48, .10);
  --orange: #ff9500;
  --orange-ink: #a05a00;
  --orange-tint: rgba(255, 149, 0, .12);
  --green: #34c759;
  --green-ink: #248a3d;
  --green-tint: rgba(52, 199, 89, .12);
  --teal: #30b0c7;
  --teal-ink: #0e7a8c;
  --teal-tint: rgba(48, 176, 199, .14);
  --purple: #af52de;
  --purple-tint: rgba(175, 82, 222, .12);
  --graphite: #8e8e93;
  --nav-bg: rgba(251, 251, 253, .78);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04), 0 1px 1px rgba(0, 0, 0, .03);
  --shadow: 0 4px 24px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .06);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #232325;
    --fill: rgba(118, 118, 128, .24);
    --fill-2: rgba(118, 118, 128, .16);
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --ink-3: #8e8e93;
    --hair: rgba(255, 255, 255, .10);
    --hair-strong: rgba(255, 255, 255, .18);
    --accent: #0a84ff;
    --accent-ink: #409cff;
    --accent-tint: rgba(10, 132, 255, .18);
    --red: #ff453a;
    --red-ink: #ff6961;
    --red-tint: rgba(255, 69, 58, .16);
    --orange-ink: #ffb340;
    --orange-tint: rgba(255, 159, 10, .16);
    --green-ink: #30d158;
    --green-tint: rgba(48, 209, 88, .16);
    --teal-ink: #5ac8dc;
    --teal-tint: rgba(64, 200, 224, .18);
    --purple-tint: rgba(191, 90, 242, .2);
    --nav-bg: rgba(22, 22, 23, .72);
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .06);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .08);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.43 var(--font); letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 700; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
h4 { font-size: 13px; font-weight: 600; color: var(--ink-2); }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7;
        stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ---------- шапка ---------- */
.nav {
  position: sticky; top: 0; z-index: 40; height: 52px;
  display: flex; align-items: center; gap: 28px; padding: 0 max(20px, calc((100vw - 1440px) / 2 + 20px));
  background: var(--nav-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
               background: linear-gradient(180deg, #ff5f57, #ff3b30); color: #fff; font-size: 12px; font-weight: 700; }
.nav .links { display: flex; gap: 4px; }
.nav .links a { color: var(--ink-2); font-size: 13px; padding: 6px 12px; border-radius: 980px; display: inline-flex; align-items: center; gap: 6px; }
.nav .links a:hover { color: var(--ink); background: var(--fill-2); text-decoration: none; }
.nav .links a.on { color: var(--ink); background: var(--fill); font-weight: 600; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff;
         font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; letter-spacing: 0; }
.badge.hot { background: var(--red); }
.nav .menu { margin-left: auto; position: relative; }
.nav .menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; }
.nav .menu summary::-webkit-details-marker { display: none; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
          background: linear-gradient(180deg, #a1a1a6, #7c7c80); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: 0; }
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.ok { background: linear-gradient(180deg, #5ac8fa, #0a84ff); }
.popover { position: absolute; right: 0; top: 40px; min-width: 220px; padding: 6px; border-radius: var(--r);
           background: var(--surface); box-shadow: var(--shadow-lg); border: 1px solid var(--hair); }
.popover .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--hair); margin-bottom: 4px; }
.popover a, .popover button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px;
                              color: var(--ink); font: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
.popover a:hover, .popover button:hover { background: var(--fill-2); text-decoration: none; }
.popover form { margin: 0; }

/* ---------- каркас ---------- */
main { max-width: 1440px; margin: 0 auto; padding: 28px 20px 96px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 20px; }
.page-head .sub { margin-top: 6px; color: var(--ink-2); font-size: 15px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.section { margin-top: 28px; }
.section > h2 { margin-bottom: 12px; }

/* ---------- кнопки и поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 16px;
       border-radius: 980px; border: 0; background: var(--fill); color: var(--ink); font: 500 13px/1 var(--font);
       cursor: pointer; white-space: nowrap; transition: background .15s, transform .1s, opacity .15s; }
.btn:hover { background: var(--fill-2); background: color-mix(in srgb, var(--fill) 100%, var(--ink) 6%); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.ghost { background: transparent; color: var(--accent-ink); padding: 0 10px; }
.btn.ghost:hover { background: var(--accent-tint); }
.btn.lg { height: 44px; padding: 0 24px; font-size: 15px; }
.btn.icon { width: 34px; padding: 0; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
button.link { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }

.select { position: relative; display: inline-flex; align-items: center; }
.select select { appearance: none; -webkit-appearance: none; border: 0; background: var(--fill-2); color: var(--ink);
                 font: 500 13px var(--font); height: 34px; padding: 0 34px 0 14px; border-radius: 980px; cursor: pointer; }
.select::after { content: ""; position: absolute; right: 14px; top: 50%; width: 6px; height: 6px; margin-top: -5px;
                 border-right: 1.7px solid var(--ink-2); border-bottom: 1.7px solid var(--ink-2); transform: rotate(45deg); pointer-events: none; }
.select select:hover { background: var(--fill); }

.seg { display: inline-flex; padding: 2px; border-radius: 980px; background: var(--fill-2); gap: 2px; }
.seg a, .seg span { height: 30px; min-width: 30px; padding: 0 12px; border-radius: 980px; display: inline-flex; align-items: center; justify-content: center;
                    color: var(--ink); font-size: 13px; font-weight: 500; }
.seg a:hover { background: var(--surface); box-shadow: var(--shadow-sm); text-decoration: none; }

.pills { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 980px;
        background: var(--fill-2); color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
label.pill { cursor: pointer; user-select: none; }
label.pill input { position: absolute; opacity: 0; pointer-events: none; }
label.pill:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill b { color: var(--ink); font-weight: 650; }

.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 980px; font-size: 11px; font-weight: 600; letter-spacing: 0; }
.tag.zachet { background: var(--teal-tint); color: var(--teal-ink); }
.tag.current { background: var(--green-tint); color: var(--green-ink); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }

/* ---------- сообщения ---------- */
.toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(560px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: var(--r); background: var(--surface);
         box-shadow: var(--shadow-lg); font-size: 13.5px; animation: drop .35s cubic-bezier(.2, .9, .3, 1.2); transition: opacity .4s, transform .4s; }
.toast.hide { opacity: 0; transform: translateY(-8px); }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.toast.success::before { background: var(--green); }
.toast.error::before { background: var(--red); }
.toast.warning::before { background: var(--orange); }
@keyframes drop { from { opacity: 0; transform: translateY(-12px); } }

/* ---------- доска ---------- */
.board-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 16px; margin-bottom: 18px; }
.board-head .range { font-size: 15px; color: var(--ink-2); margin-top: 4px; }
.bh-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.legend { display: grid; gap: 7px; color: var(--ink-2); font-size: 12.5px; padding: 2px 10px 6px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.sw.lecture { background: var(--accent); }
.sw.practice { background: var(--graphite); }
.sw.zachet { background: var(--teal); }
.sw.conflict { background: transparent; box-shadow: inset 0 0 0 2px var(--red); }
.kbd { font: 11px var(--font); padding: 1px 6px; border-radius: 5px; background: var(--fill-2); color: var(--ink-2); }

.board-wrap { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: auto;
              max-height: calc(100vh - 230px); max-height: calc(100dvh - 230px); }
table.board { border-collapse: separate; border-spacing: 0; width: 100%; table-layout: fixed; min-width: calc(76px + var(--cols) * 160px); }
.board th, .board td { padding: 4px; vertical-align: top; border-bottom: 1px solid var(--hair); }
.board td + td, .board th + th { border-left: 1px solid var(--hair); }
.board thead th { position: sticky; top: 0; z-index: 5; height: 44px; vertical-align: middle; font-size: 12px; font-weight: 600;
                  color: var(--ink-2); letter-spacing: .02em; text-transform: uppercase;
                  background: color-mix(in srgb, var(--surface) 95%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.board thead th b { color: var(--ink); font-size: 15px; letter-spacing: -.01em; margin-left: 2px; }
.board th.time, .board td.time { width: 76px; text-align: right; padding-right: 12px; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.board td.time b { display: block; color: var(--ink); font-weight: 600; font-size: 13px; }
.board .dayhead th { position: static; text-align: left; padding: 16px 16px 8px; background: var(--surface-2); text-transform: none; letter-spacing: -.01em; }
.dayhead .d { display: inline-flex; align-items: baseline; gap: 8px; }
.dayhead .dow { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.dayhead .num { font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1; }
.dayhead .mon { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.today .dayhead .num { color: #fff; background: var(--red); border-radius: 50%; width: 34px; height: 34px; display: inline-grid; place-items: center; font-size: 17px; }
.today .dayhead .dow { color: var(--red); }
.board td.none { color: var(--ink-3); font-size: 12px; padding: 14px; }

.ev { position: relative; display: block; padding: 6px 8px 6px 11px; border-radius: 9px; cursor: pointer; overflow: hidden;
      background: var(--fill-2); transition: background .15s, transform .12s, box-shadow .15s; }
.ev::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--graphite); }
.ev + .ev { margin-top: 4px; }
.ev:hover { background: var(--fill); }
.ev:active { transform: scale(.99); }
/* цвет вида занятия — одинаковый на неделе (.ev) и в месяце (.m-ev) */
.ev.k-lecture, .m-ev.k-lecture { background: var(--accent-tint); }
.ev.k-lecture::before, .m-ev.k-lecture::before { background: var(--accent); }
.ev.k-final, .m-ev.k-final { background: var(--purple-tint); }
.ev.k-final::before, .m-ev.k-final::before { background: var(--purple); }
.ev.zachet, .m-ev.zachet { background: var(--teal-tint); }
.ev.zachet::before, .m-ev.zachet::before { background: var(--teal); }
.ev .t1 { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.ev .t1 b { font-size: 13px; font-weight: 650; }
.ev .t1 .kind { color: var(--ink-2); font-size: 11.5px; }
.k-lecture .t1 .kind { color: var(--accent-ink); }
.ev .t1 .right { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; }
.ev .t2 { font-size: 12px; color: var(--ink); opacity: .82; margin-top: 1px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.cell.whole .ev .t2 { -webkit-line-clamp: 2; }
.ev .t3 { font-size: 11.5px; color: var(--ink-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .flag { color: var(--orange-ink); font-weight: 700; font-size: 12px; }
.cell.unread .ev { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.cell.conflict .ev { box-shadow: inset 0 0 0 2px var(--red); }
.card.empty, p.empty { text-align: center; padding: 80px 20px; color: var(--ink-2); }
.empty .big { font-size: 44px; margin-bottom: 8px; }
.empty h1 { color: var(--ink); margin-bottom: 8px; }
.empty p { margin-bottom: 20px; }

/* ---------- боковая панель ---------- */
#scrim { position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .18); opacity: 0; pointer-events: none; transition: opacity .25s; }
#scrim.on { opacity: 1; pointer-events: auto; }
#panel { position: fixed; z-index: 50; top: 64px; right: 12px; bottom: 12px; width: min(440px, calc(100vw - 24px));
         background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 20px 22px; overflow-y: auto;
         transform: translateX(calc(100% + 24px)); transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
#panel.on { transform: none; }
#panel[hidden] { display: block; visibility: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.panel-head .cap { color: var(--ink-3); font-size: 12px; font-weight: 500; }
.panel-head h2 { font-size: 22px; margin-top: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.close { width: 30px; height: 30px; border-radius: 50%; background: var(--fill-2); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.close:hover { background: var(--fill); }
.panel-title { font-size: 15px; color: var(--ink); margin-bottom: 16px; }
.list { background: var(--surface-2); border-radius: var(--r); border: 1px solid var(--hair); overflow: hidden; }
.list .li { display: flex; gap: 12px; align-items: baseline; padding: 11px 14px; }
.list .li + .li { border-top: 1px solid var(--hair); }
.list .li .k { color: var(--ink-2); min-width: 110px; }
.list .li .v { flex: 1; text-align: right; }
.timeline { list-style: none; margin: 10px 0 0; padding: 0 0 0 18px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 2px; background: var(--hair-strong); border-radius: 1px; }
.timeline li { position: relative; padding: 0 0 16px 8px; }
.timeline li::before { content: ""; position: absolute; left: -18px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
                       background: var(--surface); box-shadow: inset 0 0 0 2.5px var(--graphite); }
.timeline li.ch::before { box-shadow: inset 0 0 0 2.5px var(--orange); }
.timeline .when { font-size: 12px; color: var(--ink-3); }
.timeline .what { font-weight: 600; margin: 2px 0; }

/* ---------- блоки состояний ---------- */
.notice { border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; background: var(--fill-2); }
.notice h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice li { margin: 3px 0; }
.notice.bad { background: var(--red-tint); }
.notice.bad h3 { color: var(--red-ink); }
.notice.warn { background: var(--orange-tint); }
.notice.warn h3 { color: var(--orange-ink); }
.notice.good { background: var(--green-tint); }
.notice.good h3 { color: var(--green-ink); }
.was { color: var(--red-ink); }
.ev-text .now, .timeline .now { color: var(--green-ink); }   /* «стало» в описании изменения (не путать с .period.now, .ev.now) */

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 4px 0 18px; }
.stat { background: var(--surface); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--hair); }
.stat .n { font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.stat .l { color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }

.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; }
.events li + li { border-top: 1px solid var(--hair); }
.events .ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--fill-2); color: var(--ink-2); }
.events .ico.moved { background: var(--orange-tint); color: var(--orange-ink); }
.events .ico.teacher_changed { background: var(--purple-tint); color: var(--purple); }
.events .ico.zachet_changed { background: var(--teal-tint); color: var(--teal-ink); }
.events .ico.removed { background: var(--red-tint); color: var(--red-ink); }
.events .ico.added { background: var(--green-tint); color: var(--green-ink); }
.events .ev-body { min-width: 0; }
.events .ev-kind { font-weight: 600; font-size: 13px; }
.events .ev-text { font-size: 13px; color: var(--ink-2); }
.group-block { padding: 6px 0 4px; }
.group-block + .group-block { border-top: 1px solid var(--hair); margin-top: 6px; padding-top: 12px; }
.group-block h4 { margin-bottom: 2px; }

/* ---------- лента изменений ---------- */
.feed { display: grid; gap: 14px; }
.update { padding: 18px 20px; }
.update .top { display: flex; gap: 14px; align-items: flex-start; }
.update .top .title { font-size: 16px; font-weight: 650; color: var(--ink); }
.update .top .title:hover { text-decoration: none; color: var(--accent-ink); }
.update .top .meta { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.update .top .meta a { color: var(--ink-2); }
.update .top form { margin: 0 0 0 auto; }
.update .unread-dot { margin-top: 7px; }
.update .pills { margin: 12px 0 0; }
.update .seen { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.avatars { display: inline-flex; align-items: center; }
.avatars .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatars .avatar + .avatar { margin-left: -5px; }
details.more { margin-top: 12px; border-top: 1px solid var(--hair); padding-top: 10px; }
details.more summary { cursor: pointer; color: var(--accent-ink); font-size: 13px; font-weight: 500; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary .i { transition: transform .2s; }
details.more[open] summary .i { transform: rotate(90deg); }
details.more .inner { margin-top: 8px; }
.update.is-new { box-shadow: var(--shadow), inset 3px 0 0 var(--accent); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 24px; color: var(--ink-2); }

/* ---------- загрузка ---------- */
.upload-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
@media (max-width: 900px) { .upload-grid { grid-template-columns: 1fr; } }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
        gap: 10px; min-height: 280px; padding: 32px; border-radius: var(--r-lg); background: var(--surface);
        border: 2px dashed var(--hair-strong); transition: border-color .2s, background .2s; }
.drop.over { border-color: var(--accent); background: var(--accent-tint); }
.drop .big-ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-tint); color: var(--accent); }
.drop .big-ico .i { width: 28px; height: 28px; }
.drop h2 { font-size: 21px; }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop .file-name { font-weight: 600; color: var(--accent-ink); min-height: 20px; }
.drop .btn { position: relative; z-index: 2; }
.howto { padding: 22px 24px; }
.steps { list-style: none; margin: 14px 0 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 0 0 16px 38px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 50%;
                    display: grid; place-items: center; background: var(--fill); font-size: 13px; font-weight: 600; }
.dl-list { margin-top: 8px; }
.dl-list a { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--ink); }
.dl-list a:hover { background: var(--fill-2); text-decoration: none; }
.dl-list a .i { color: var(--accent); }
.dl-list a + a { border-top: 1px solid var(--hair); }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px 8px; }
.tbl td { padding: 11px 16px; border-top: 1px solid var(--hair); vertical-align: middle; }
.tbl tr.current td { background: var(--accent-tint); }
.tbl tr.hot td { background: var(--orange-tint); }
.tbl form { margin: 0; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--graphite); }
.status.s-applied::before { background: var(--green); }
.status.s-preview::before { background: var(--orange); }

/* ---------- нижняя панель действий ---------- */
.actionbar { position: sticky; bottom: 16px; z-index: 30; margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
             padding: 12px 14px 12px 20px; border-radius: 980px; background: var(--nav-bg);
             -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: var(--shadow-lg); }
.actionbar .btn.primary { order: 2; }
.actionbar .btn:not(.primary) { order: 1; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--fill);
                position: relative; cursor: pointer; transition: background .2s; margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
                       box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s cubic-bezier(.3, .7, .3, 1.2); }
.switch input:checked { background: var(--green); }
.switch input:checked::after { transform: translateX(18px); }

/* ---------- вход ---------- */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: min(380px, 100%); text-align: center; }
.login-box .logo { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 18px; display: grid; place-items: center;
                   background: linear-gradient(180deg, #ff5f57, #ff3b30); color: #fff; font-size: 26px; font-weight: 700; box-shadow: var(--shadow); }
.login-box h1 { margin-bottom: 6px; }
.login-box .sub { color: var(--ink-2); margin-bottom: 26px; }
.login-box form { display: grid; gap: 12px; text-align: left; }
.field { display: block; }
.field input { width: 100%; height: 48px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--hair-strong);
               background: var(--surface); color: var(--ink); font: 16px var(--font); transition: border-color .15s, box-shadow .15s; }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
.login-box .btn { width: 100%; margin-top: 6px; }
.login-box .note { color: var(--ink-3); font-size: 12.5px; margin-top: 18px; text-align: center; }
.login-box .err { background: var(--red-tint); color: var(--red-ink); border-radius: var(--r); padding: 10px 14px; font-size: 13px; }

/* ---------- узкие экраны ---------- */
@media (max-width: 760px) {
  .nav { gap: 12px; padding: 0 12px; }
  .nav .brand > span:not(.logo) { display: none; }
  .nav .links a { padding: 6px 9px; }
  .nav .links a .lbl { display: none; }
  .nav .menu .name { display: none; }
  main { padding: 18px 12px 96px; }
  h1 { font-size: 24px; }
  table.board { min-width: calc(54px + var(--cols) * 132px); }
  .board th.time, .board td.time { width: 54px; padding-right: 6px; }
  .board-wrap { max-height: none; }
  .board-head { align-items: flex-start; }
  .bh-tools .btn { padding: 0 12px; }
  .bh-tools .btn.icon { padding: 0; }
  .actionbar { border-radius: var(--r-lg); }
}

/* ---------- выпадающие меню доски ---------- */
details.dd { position: relative; }
details.dd[open] { z-index: 30; }
details.dd > summary { list-style: none; cursor: pointer; }
details.dd > summary::-webkit-details-marker { display: none; }
details.dd > .popover { top: calc(100% + 8px); z-index: 30; max-height: min(72vh, 620px); overflow-y: auto; animation: pop .16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.popover.left { left: 0; right: auto; min-width: 300px; }
.popover.wide { width: 400px; }
.popover.mid { min-width: 270px; }
details.dd .popover > a, details.dd .popover > button, details.dd .popover form button { white-space: nowrap; }
.popover hr { border: 0; border-top: 1px solid var(--hair); margin: 6px 4px; }
.popover a.on { font-weight: 600; background: var(--fill-2); }
.popover .aside { margin-left: auto; padding-left: 12px; color: var(--ink-3); font-size: 12px; font-weight: 400; }
.pop-sec { padding: 10px 10px 4px; font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.pop-head { padding: 8px 10px 10px; display: grid; gap: 2px; }
.pop-head span { color: var(--ink-2); font-size: 12.5px; }
.pop-note { padding: 6px 10px 8px; color: var(--ink-2); font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.pop-note.ok { color: var(--green-ink); }
.popover a.pop-foot { color: var(--accent-ink); font-size: 13px; }

.view-title { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); border-radius: 10px; }
.view-title .chev { width: 22px; height: 22px; color: var(--accent); stroke-width: 2.4; transition: transform .2s; }
.view-title:hover h1 { color: var(--accent-ink); }
details[open] > .view-title .chev { transform: rotate(180deg); }
.btn .chev { width: 14px; height: 14px; margin-right: -4px; color: var(--ink-3); }
.btn .count { color: var(--ink-2); font-weight: 600; }
.btn.bad { background: var(--red-tint); color: var(--red-ink); font-weight: 650; }
.btn.info { background: var(--accent-tint); color: var(--accent-ink); font-weight: 650; }
.btn.calm { width: 34px; padding: 0; color: var(--green-ink); }
details.dd[open] > summary.btn:not(.bad):not(.info) { background: var(--fill); }

.opt { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.opt:hover { background: var(--fill-2); }
.popover .opt .opt-toggle { flex: 1; min-width: 0; }
.popover .opt .opt-toggle:hover { background: none; }
.opt .box { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; flex: none;
            box-shadow: inset 0 0 0 1.5px var(--hair-strong); color: transparent; transition: background .15s; }
.opt .box .i { width: 13px; height: 13px; stroke-width: 2.6; }
.opt-toggle.on .box { background: var(--accent); box-shadow: none; color: #fff; }
.opt-toggle:not(.on) { color: var(--ink-3); }
.popover .opt .only { width: auto; flex: none; padding: 3px 10px; margin-right: 4px; border-radius: 980px; font-size: 12px; color: var(--accent-ink);
                      opacity: 0; transition: opacity .15s; }
.opt:hover .only, .opt .only:focus-visible { opacity: 1; }
.popover .opt .only:hover { background: var(--accent); color: #fff; }
@media (hover: none) { .popover .opt .only { opacity: 1; } }

.alert-item { padding: 8px 10px 10px; border-radius: 10px; margin: 2px 0; background: var(--red-tint); }
.alert-item + .alert-item { margin-top: 6px; }
.alert-item .when { font-size: 13px; }
.alert-item .side { font-size: 12.5px; margin-top: 3px; padding-left: 10px; border-left: 2px solid color-mix(in srgb, var(--red) 45%, transparent); }
.popover .alert-item a { display: inline-block; width: auto; padding: 0; color: var(--accent-ink); font-size: 12.5px; }
.alert-item .what { font-size: 11px; font-weight: 650; color: var(--red-ink); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px;
                    display: flex; align-items: center; gap: 6px; }
.alert-item .links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.popover .alert-item a:hover { background: none; text-decoration: underline; }
.tag.off { background: var(--red); color: #fff; }
.mi-row { display: flex; align-items: baseline; gap: 10px; padding: 6px 10px; font-size: 13px; }
.mi-row b { min-width: 74px; }
.popover .mi-row a { display: inline; width: auto; padding: 0; color: var(--accent-ink); }
.popover .mi-row a:hover { background: none; text-decoration: underline; }

/* ---------- доска: подсказка о конфликте и режим «по преподавателям» ---------- */
.ev .t4 { display: flex; gap: 4px; align-items: flex-start; margin-top: 3px; font-size: 11.5px; font-weight: 600; color: var(--red-ink); }
.ev .t4 .i { width: 12px; height: 12px; stroke-width: 2.2; margin-top: 2px; }
.board.multi thead tr.streams-h th { height: 30px; font-size: 11.5px; color: var(--ink-2); border-bottom: 1px solid var(--hair); }
.board.multi thead tr.groups-h th { top: 30px; }
.board.by-teacher { min-width: calc(76px + var(--cols) * 128px); }
.board.by-teacher thead th { text-transform: none; letter-spacing: -.01em; line-height: 1.2; }
.board.by-teacher thead th b { margin: 0; font-size: 13.5px; }
.board.by-teacher thead th .ini { color: var(--ink-3); font-weight: 500; }
.board.by-teacher .ev .t3 { white-space: normal; }
#all-hidden { padding: 40px 20px; }
.day-list .li.this { background: var(--accent-tint); }
.day-list .li.bad { background: var(--red-tint); }
.day-list .li.bad .k { color: var(--red-ink); font-weight: 600; }
.day-list .li .k { min-width: 96px; font-variant-numeric: tabular-nums; }
.day-list .li .v { text-align: left; }

/* ---------- выбор групп в панели ---------- */
.pill.toggle { background: transparent; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--hair-strong); transition: background .15s, color .15s, box-shadow .15s; }
.pill.toggle .ck { width: 13px; height: 13px; display: none; stroke-width: 2.4; }
.pill.toggle.on { background: var(--accent-tint); color: var(--accent-ink); box-shadow: none; }
.pill.toggle.on .ck { display: inline-block; }
.pill.toggle:hover { background: var(--fill); box-shadow: inset 0 0 0 1px var(--accent); }
.pill.toggle.on:hover { background: color-mix(in srgb, var(--accent-tint) 100%, var(--accent) 8%); }
.btn.sm { height: 26px; padding: 0 10px; font-size: 12px; }
.picker .pick-prog { margin: 18px 0 6px; font-size: 13px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.picker .pick-prog:first-of-type { margin-top: 0; }
.pick-stream { padding: 10px 0 12px; border-bottom: 1px solid var(--hair); }
.pick-stream-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.picker-actions { position: sticky; bottom: -20px; margin: 16px -22px -20px; padding: 14px 22px 18px; display: flex; flex-wrap: wrap; gap: 8px;
                  background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
                  border-top: 1px solid var(--hair); }

@media (max-width: 760px) {
  /* Меню на телефоне — шторка снизу: фон затемнён и стоит на месте, листается только шторка,
     тап по фону закрывает (фон — часть summary, тап по нему закрывает details сам). */
  details.dd > .popover {
    position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; min-width: 0;
    max-height: 72vh; max-height: 75dvh; padding-top: 20px; overscroll-behavior: contain; animation: sheet .22s cubic-bezier(.2, .8, .2, 1); }
  details.dd > .popover::before { content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 4px; margin-left: -18px;
                                  border-radius: 2px; background: var(--hair-strong); }
  details.dd[open] { z-index: 55; }
  details.dd[open] > summary { transform: none !important; }   /* иначе фон сожмётся до кнопки, пока её держат */
  details.dd[open] > summary::before { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .42); cursor: default;
                                       touch-action: none; animation: fade .2s; }
  /* Пока открыта шторка или карточка занятия, страница под ними не прокручивается. */
  html:has(details.dd[open]), html:has(#panel.on) { overflow: hidden; }
}
#panel { overscroll-behavior: contain; }
@keyframes sheet { from { transform: translateY(32px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.btn .news { display: inline-flex; align-items: center; gap: 5px; color: var(--accent-ink); }
.legend .flag { width: 10px; text-align: center; color: var(--orange-ink); font-weight: 700; }

/* ---------- выбор потока и преподавателя ---------- */
.chip-row { display: flex; align-items: center; gap: 6px; padding: 4px 10px; }
.chip-row .prog { min-width: 52px; font-size: 12.5px; color: var(--ink-2); }
.popover .chip-row a.chip { display: inline-grid; place-items: center; width: 34px; height: 30px; padding: 0; border-radius: 9px;
                            background: var(--fill-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.popover .chip-row a.chip:hover { background: var(--fill); }
.popover .chip-row a.chip.on { background: var(--accent); color: #fff; }
.view-title .who { width: 26px; height: 26px; vertical-align: -3px; margin-right: 6px; color: var(--accent); stroke-width: 2; }

.now-line { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 10px; }
.now-item { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 12px; border: 0; border-radius: 980px;
            background: var(--fill-2); color: var(--ink); font: 13px var(--font); cursor: pointer; text-align: left; }
button.now-item:hover { background: var(--fill); }
.now-item b { font-weight: 650; }
.now-item.live { background: var(--green-tint); color: var(--green-ink); }
.now-item.live b { color: var(--green-ink); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--green) 25%, transparent); } }
.ev.now { box-shadow: inset 0 0 0 2px var(--green); }
.tag.live { background: var(--green); color: #fff; }

.board thead th a { color: inherit; display: block; }
.board thead th a:hover { text-decoration: none; color: var(--accent-ink); }
.board.one-teacher thead th .ini { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board.one-teacher { min-width: calc(76px + var(--cols) * 150px); }

/* ---------- переключатель «Неделя / Месяц» ---------- */
.seg a.on { background: var(--surface); box-shadow: var(--shadow-sm); font-weight: 600; }

/* ---------- плотная неделя: пара — одна строка («Подробные карточки» в меню ⋯ снимают класс compact) ---------- */
.board .ev .inl, .board .none-note { display: none; }
.board .dayhead th { scroll-margin-top: 44px; }
.board.multi .dayhead th { scroll-margin-top: 74px; }
.board .dayhead th:target { box-shadow: inset 4px 0 0 var(--accent); }
.board.compact th, .board.compact td { padding: 2px 3px; }
.board.compact .ev { padding: 3px 7px 3px 9px; border-radius: 7px; }
.board.compact .ev + .ev { margin-top: 2px; }
.board.compact .ev .t1 { min-width: 0; gap: 5px; font-size: 12px; line-height: 18px; white-space: nowrap; }
.board.compact .ev .t1 b { flex: none; font-size: 12.5px; }
.board.compact .ev .t1 .kind { flex: none; }
.board.compact .ev .inl { display: block; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.board.compact .ev .inl .i { width: 12px; height: 12px; margin-right: 3px; vertical-align: -2px; color: var(--red-ink); stroke-width: 2.2; }
.board.compact .ev .t2, .board.compact .ev .t3, .board.compact .ev .t4 { display: none; }
/* время — только начало (конец в подсказке), вид занятия в узкой ячейке — цветом: остаётся место преподавателю */
.board.compact td.time { padding-top: 5px; line-height: 1.2; }
.board.compact td.time b { font-size: 12.5px; }
.board.compact td.time .end { display: none; }
.board.compact .cell:not(.whole) .ev .t1 .kind { display: none; }
/* заголовок дня прилипает под шапкой групп: при прокрутке всегда видно, какой это день */
.board.compact .dayhead th { position: sticky; top: 44px; z-index: 4; padding: 6px 12px 5px; }
.board.compact.multi .dayhead th { top: 74px; }
.board.compact .dayhead .num { font-size: 15px; }
.board.compact .today .dayhead .num { width: 24px; height: 24px; font-size: 13px; }
.board.compact tr.none-row { display: none; }
.board.compact tbody.is-empty .none-note { display: inline; margin-left: 4px; font-size: 12px; color: var(--ink-3); }
.board.compact tbody.is-empty .dayhead th { padding-top: 3px; padding-bottom: 3px; }

/* ---------- месяц ---------- */
.month { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: clip; }
.m-head, .m-week { display: grid; grid-template-columns: repeat(var(--dcols), minmax(0, 1fr)); }
/* дни недели прилипают под шапкой сайта: при прокрутке длинного месяца видно, где какой день */
.m-head { position: sticky; top: 52px; z-index: 5; background: color-mix(in srgb, var(--surface) 94%, transparent);
          -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.m-head div { padding: 10px 10px 8px; border-bottom: 1px solid var(--hair); font-size: 12px; font-weight: 600; color: var(--ink-3);
              text-transform: uppercase; letter-spacing: .04em; }
.m-week + .m-week { border-top: 1px solid var(--hair); }
.m-day { display: flex; flex-direction: column; gap: 2px; min-width: 0; min-height: 92px; padding: 5px 5px 8px; }
.m-day + .m-day { border-left: 1px solid var(--hair); }
.m-day.out { background: var(--surface-2); }
.m-day.out > * { opacity: .5; }
.m-num { display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; padding: 2px 5px 4px; border-radius: 7px;
         color: var(--ink); font-size: 14px; font-weight: 650; }
.m-num:hover { background: var(--fill-2); text-decoration: none; }
.m-num .dow, .m-num .mon { display: none; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.m-num .mon.on { display: inline; }
.m-day.today .m-num .n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
                         background: var(--red); color: #fff; font-size: 13px; }
.m-ev { position: relative; display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0; padding: 2px 6px 2px 9px;
        border: 0; border-radius: 6px; background: var(--fill-2); color: var(--ink); font: 12px/18px var(--font);
        text-align: left; white-space: nowrap; overflow: hidden; cursor: pointer; }
.m-ev::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--graphite); }
.m-ev:hover { background: var(--fill); }
.m-ev.conflict { box-shadow: inset 0 0 0 1.5px var(--red); }
.m-ev.now { box-shadow: inset 0 0 0 1.5px var(--green); }
.m-ev .tm { flex: none; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.m-ev b { flex: none; font-weight: 650; }
.m-ev .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.m-ev .i { flex: none; width: 12px; height: 12px; color: var(--red-ink); stroke-width: 2.2; }
.m-ev .dot { margin-left: auto; }
.m-ev .tch { display: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.month-note { padding: 20px; text-align: center; color: var(--ink-3); }
@media (max-width: 760px) {
  /* на телефоне месяц — список дней с занятиями */
  .m-head { display: none; }
  .m-week { display: block; }
  .m-week + .m-week { border-top: 0; }
  .m-day { min-height: 0; border-top: 1px solid var(--hair); }
  .m-day + .m-day { border-left: 0; }
  .m-day.out, .m-day.empty { display: none; }
  .m-num .dow, .m-num .mon { display: inline; }
  .m-ev { font-size: 13px; line-height: 24px; }
  .m-ev .tch { display: inline; }
}

/* ---------- правки на сайте: индиго (фиолетовый занят итоговой аттестацией, оранжевый — значками изменений) ---------- */
:root { --indigo: #5856d6; --indigo-ink: #4b49c1; --indigo-tint: rgba(88, 86, 214, .12); --star: #ff9f0a; }
@media (prefers-color-scheme: dark) {
  :root { --indigo: #5e5ce6; --indigo-ink: #8e8cff; --indigo-tint: rgba(94, 92, 230, .24); --star: #ffb340; }
}
.tag.site { background: var(--indigo-tint); color: var(--indigo-ink); white-space: nowrap; }
.ev.site, .m-ev.site { outline: 1.5px dashed var(--indigo); outline-offset: -1.5px; }
.m-ev .ed { flex: none; color: var(--indigo-ink); font-weight: 700; }
.notice.site { background: var(--indigo-tint); }
.notice.site h3, .notice.site b { color: var(--indigo-ink); }
.notice.site-lost { box-shadow: inset 0 0 0 2px var(--red); }
.site-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: -6px 0 12px; padding: 8px 14px;
              border-radius: var(--r); background: var(--indigo-tint); font-size: 13px; color: var(--ink); }
.site-strip a { color: var(--indigo-ink); font-weight: 600; }

/* ---------- избранное ---------- */
.star { color: var(--star); font-size: 12px; line-height: 1; }
.ev .t1 .star { flex: none; margin-right: -2px; }
.m-ev .star { flex: none; }
.board thead th.fav { color: var(--ink); }
.board thead th .star { margin-right: 3px; }
.board td.cell.fav { background: color-mix(in srgb, var(--star) 7%, transparent); }
.popover a .star { width: 16px; text-align: center; font-size: 14px; }
.fav-form { display: inline; }
.star-btn { border: 0; background: none; padding: 0 4px; font-size: 16px; line-height: 1; color: var(--ink-3); cursor: pointer; vertical-align: -1px; }
.star-btn:hover, .star-btn.on { color: var(--star); }

/* ---------- правка в карточке ---------- */
.panel-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 16px; }
.panel-actions .i { width: 15px; height: 15px; }
.btn.ghost-danger { background: transparent; color: var(--red-ink); box-shadow: inset 0 0 0 1px var(--hair-strong); }
.btn.ghost-danger:hover { background: var(--red-tint); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 88%, #000); }
button.link.back { display: inline-flex; align-items: center; gap: 2px; color: var(--accent-ink); font-size: 13px; }
button.link.back .i { width: 15px; height: 15px; }
.edit-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.edit-form .check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; }
.edit-form .check input { margin-top: 3px; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; font-size: 13px; color: var(--ink-2); }
/* Длинный пункт списка (занятый преподаватель и где он занят) не должен раздвигать панель. */
.field-row input, .field-row select, .custom input { height: 36px; padding: 0 10px; border: 1px solid var(--hair-strong); border-radius: 9px;
                                                     background: var(--surface); color: var(--ink); font: 14px var(--font); }
.field-row select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.field-row input:focus, .field-row select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.slot-list { display: grid; gap: 4px; }
.slot-opt { display: grid; grid-template-columns: auto 92px minmax(0, 1fr); align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px;
        background: var(--green-tint); cursor: pointer; font-size: 13px; }
.slot-opt .tm { font-weight: 650; font-variant-numeric: tabular-nums; }
.slot-opt .st { color: var(--green-ink); }
.slot-opt.busy { background: var(--red-tint); }
.slot-opt.busy .st { color: var(--red-ink); }
.slot-opt.here { background: var(--fill-2); cursor: default; }
.slot-opt.here .st { color: var(--ink-3); }
.slot-opt:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent); }
.custom summary { cursor: pointer; color: var(--accent-ink); font-size: 13px; }
.custom .row { display: flex; gap: 12px; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.edit-form .actions { display: flex; gap: 8px; }

/* ---------- поиск в шапке ---------- */
.search { position: relative; margin-left: auto; display: flex; align-items: center; }
.search > .i { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }
.search input { width: 220px; height: 32px; padding: 0 12px 0 31px; border: 0; border-radius: 980px; background: var(--fill-2);
                color: var(--ink); font: 13px var(--font); transition: width .2s, background .15s; }
.search input:focus { outline: none; width: 300px; background: var(--surface); box-shadow: 0 0 0 3px var(--accent-tint), var(--shadow-sm); }
.search input::-webkit-search-cancel-button { display: none; }
.nav .search + .menu { margin-left: 0; }
.search-results { position: absolute; top: calc(100% + 8px); right: 0; width: 340px; max-height: min(60vh, 460px); overflow-y: auto;
                  padding: 6px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); z-index: 60; }
.search-results a { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 2px 8px; padding: 7px 10px; border-radius: 9px; color: var(--ink); }
.search-results a:hover, .search-results a.on { background: var(--fill-2); text-decoration: none; }
.search-results a .ico { grid-row: span 2; color: var(--ink-3); text-align: center; font-size: 13px; }
.search-results a b { font-weight: 600; font-size: 14px; }
.search-results a span.sub { grid-column: 2; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-results .none { padding: 12px; color: var(--ink-3); font-size: 13px; }
@media (max-width: 760px) {
  .search input { width: 38px; padding: 0 0 0 31px; color: transparent; }
  .search input::placeholder { color: transparent; }
  .search input:focus { position: fixed; left: 10px; right: 10px; top: 8px; width: auto; padding: 0 12px 0 31px; color: var(--ink); z-index: 61; }
  .search input:focus::placeholder { color: var(--ink-3); }
  .search:focus-within > .i { position: fixed; left: 20px; top: 17px; z-index: 62; }
  .search-results { position: fixed; top: 52px; left: 10px; right: 10px; width: auto; }
}

/* ---------- номер текущей версии: под заголовком доски и у ссылок на скачивание ---------- */
.board-head .range .ver { padding: 1px 8px; border-radius: 980px; background: var(--fill-2); color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
.board-head .range .ver:hover { background: var(--fill); color: var(--ink); text-decoration: none; }
.board-head .range .ver + .ver { margin-left: 4px; }
.dl-list a .ver { margin-left: auto; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- все потоки программы: колонка — поток ---------- */
.popover .chip-row a.chip.all { width: auto; padding: 0 10px; font-weight: 500; color: var(--ink-2); }
.popover .chip-row a.chip.all.on { color: #fff; }
.board.by-program { min-width: calc(76px + var(--cols) * 220px); }
.board.by-program .ev + .ev { margin-top: 2px; }

/* ---------- листание: посередине открытый период, «Сегодня» — отдельной кнопкой, когда ушли с текущего ---------- */
.seg .period { min-width: 112px; font-weight: 600; cursor: default; }
.seg .period.now::after { content: ""; width: 6px; height: 6px; margin-left: 7px; border-radius: 50%; background: var(--red); }
.btn.today-btn { height: 34px; background: var(--accent-tint); color: var(--accent-ink); font-weight: 600; }
.btn.today-btn:hover { background: color-mix(in srgb, var(--accent-tint) 100%, var(--accent) 10%); }
.board-head .range:not(:has(.ver)) { display: none; }

/* ---------- команда: новые аккаунты и доступ ---------- */
.team-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.team-new { padding: 18px 20px 20px; display: grid; gap: 14px; }
.team-new h2 { font-size: 17px; }
.team-new .btn { justify-self: start; }
.role-pick { display: grid; gap: 6px; }
.role-pick label { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; padding: 8px 10px; border-radius: 9px;
                   border: 1px solid var(--hair-strong); color: var(--ink); cursor: pointer; }
.role-pick label:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.role-pick input { margin: 2px 0 0; grid-row: span 2; }
.creds { display: grid; gap: 8px; justify-items: start; }
.creds h3 { margin-bottom: 0; }
.creds-text { margin: 0; padding: 12px 14px; border-radius: 9px; background: var(--surface); font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
              white-space: pre-wrap; user-select: all; max-width: 100%; }
.tbl.team td:first-child { min-width: 200px; }
.tbl.team tr.off td:not(:nth-child(2), .actions-cell) { opacity: .5; }
.tbl.team .actions-cell { width: 1%; text-align: right; }
.tag.ok { background: var(--green-tint); color: var(--green-ink); }
.tag.warn { background: var(--orange-tint); color: var(--orange-ink); }
.tag.wait { background: var(--accent-tint); color: var(--accent-ink); }
.btn.icon.sm { width: 28px; height: 28px; }
.popover.right { right: 0; left: auto; text-align: left; }
.popover form.rename { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 4px; }
.popover form.rename input { min-width: 0; height: 32px; padding: 0 9px; border: 1px solid var(--hair-strong); border-radius: 8px;
                             background: var(--surface); color: var(--ink); font: 13px var(--font); }
.popover form.rename button { width: auto; padding: 0 10px; height: 32px; background: var(--fill); font-weight: 500; }
.popover button.danger-item { color: var(--red-ink); }
@media (max-width: 900px) {
  .team-grid { grid-template-columns: 1fr; }
  .tbl.team th:nth-child(3), .tbl.team td:nth-child(3), .tbl.team th:nth-child(4), .tbl.team td:nth-child(4) { display: none; }
}

/* ---------- зачёт поставили или сняли (держится 14 дней, как значки ↷ ⇄ ✎) ---------- */
.tag.zachet.fresh { box-shadow: inset 0 0 0 1.5px var(--orange); }
.tag.zachet.gone { background: var(--fill); color: var(--ink-3); text-decoration: line-through; white-space: nowrap; }

/* ---------- телефон: шапка с группами прилипает под верхней панелью (копия над рамкой, см. app.js) ---------- */
.float-head { display: none; }
@media (max-width: 760px) {
  .float-head { display: block; position: sticky; top: 52px; z-index: 20; overflow-x: auto; scrollbar-width: none;
                background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: 0 1px 0 var(--hair); }
  .float-head::-webkit-scrollbar { display: none; }
  .float-head[hidden] { display: none; }
  .float-head table.board { min-width: 0; }
  .float-head table.board thead th { position: static; border-bottom: 0; }
  .float-head th.time { font-size: 11.5px; font-weight: 650; color: var(--accent-ink); text-transform: none; letter-spacing: 0; white-space: nowrap; }
  /* в самой таблице шапка схлопнута до нуля: она нужна только для ширины колонок */
  .board-wrap.has-float { border-radius: 0 0 var(--r-lg) var(--r-lg); }
  .board-wrap.has-float table.board thead th { height: 0; padding-top: 0; padding-bottom: 0; border-bottom: 0;
                                               font-size: 0; line-height: 0; }
  .board-wrap.has-float table.board thead th > * { display: none; }
  .board-wrap.has-float table.board .dayhead th { position: static; }   /* прилипали под исчезнувшей шапкой */
  .board-wrap.has-float .board .dayhead th { scroll-margin-top: calc(52px + var(--head-h, 0px)); }
}

/* ---------- предпросмотр: одно занятие изменили и в файле, и на сайте — выбор варианта ---------- */
.merge-item { margin-top: 12px; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--red) 25%, transparent); }
.merge-what { margin-bottom: 6px; }
.merge-opt { display: flex; align-items: flex-start; gap: 8px; padding: 6px 10px; border-radius: 9px; cursor: pointer; }
.merge-opt input { margin-top: 3px; }
.merge-opt:has(input:checked) { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--accent); }
.events li.by { list-style: none; margin: -4px 0 6px 34px; }

/* ---------- живое обновление: «Расписание обновили · Обновить» ---------- */
.sync-bar { position: fixed; z-index: 45; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(560px, calc(100vw - 24px));
            display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-radius: var(--r);
            background: var(--surface); box-shadow: var(--shadow-lg); border: 1px solid var(--hair); animation: pop .2s ease-out; }
.sync-text { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 13px; }
.sync-text span { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-bar .close { font-size: 20px; line-height: 1; color: var(--ink-3); padding: 0 4px; }

/* ---------- сводка по дням: все занятия всех потоков и групп ---------- */
.days-head { margin-bottom: 12px; }
.day-tabs { position: sticky; top: 52px; z-index: 20; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
            margin: 0 -20px 6px; padding: 8px 20px; background: color-mix(in srgb, var(--bg) 92%, transparent);
            -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.day-tabs::-webkit-scrollbar { display: none; }
.day-tabs a { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 980px;
              background: var(--fill-2); color: var(--ink); font-size: 13px; position: relative; }
.day-tabs a:hover { background: var(--fill); text-decoration: none; }
.day-tabs a b { font-weight: 650; text-transform: capitalize; }
.day-tabs a .n { color: var(--ink-3); font-variant-numeric: tabular-nums; }
/* синим — день, который сейчас на экране (переключается при листании); сегодня — красный кружок, как на доске и в месяце */
.day-tabs a.on { background: var(--accent); color: #fff; }
.day-tabs a.on .n { color: rgba(255, 255, 255, .78); }
.day-tabs a.on i { box-shadow: 0 0 0 1.5px #fff; }
.day-tabs a.today .dn { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin: 0 -2px; padding: 0 3px;
                        border-radius: 980px; background: var(--red); color: #fff; font-weight: 650; }
.day-tabs a.none { opacity: .55; }
.day-tabs a.none.on { opacity: 1; }
.day-tabs a i.bad { width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.day-sec { margin-top: 22px; scroll-margin-top: 104px; }
.day-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; font-size: 19px; margin-bottom: 8px; }
.day-title > span:first-child::first-letter { text-transform: uppercase; }
.day-sec.today .day-title > span:first-child { color: var(--red); }
.day-idle { margin: -2px 0 8px; }
.day-idle a { color: inherit; text-decoration: underline; text-decoration-color: var(--hair-strong); }
.day-list { padding: 4px 0; }
.aud { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 4px 16px; padding: 10px 16px; }
.aud + .aud { border-top: 1px solid var(--hair); }
.aud-who { font-weight: 650; font-size: 13.5px; padding-top: 6px; }
.aud-items { display: grid; gap: 4px; min-width: 0; }
.dl-row { display: grid; grid-template-columns: 96px 150px minmax(0, 1fr) 36px auto; align-items: center; gap: 10px; width: 100%;
          padding: 6px 10px; border: 0; border-radius: 9px; background: var(--fill-2); color: var(--ink); font: inherit; font-size: 13px;
          text-align: left; cursor: pointer; position: relative; }
.dl-row:hover { background: var(--fill); }
.dl-row::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--ink-3); }
.dl-row.k-lecture { background: var(--accent-tint); }
.dl-row.k-lecture::before { background: var(--accent); }
.dl-row.zachet { background: var(--teal-tint); }
.dl-row.zachet::before { background: var(--teal); }
.dl-row.site { outline: 1.5px dashed var(--indigo); outline-offset: -1.5px; }
.dl-row.conflict { box-shadow: inset 0 0 0 2px var(--red); }
.dl-row .tm { font-weight: 650; font-variant-numeric: tabular-nums; }
.dl-row .tc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-row .wt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.dl-row .wt b { color: var(--ink); }
.dl-row .hr { color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.dl-row .tg { display: inline-flex; gap: 4px; align-items: center; }
.dl-row .flag { color: var(--orange-ink); font-weight: 700; font-size: 12px; }
.dl-warn { display: flex; gap: 6px; align-items: center; margin: -2px 0 2px; padding: 0 10px; color: var(--red-ink); font-size: 12px; }
.dl-warn .i { width: 13px; height: 13px; flex: none; }
@media (max-width: 760px) {
  .day-tabs { margin: 0 -12px 6px; padding: 8px 12px; }
  .aud { grid-template-columns: 1fr; padding: 10px 12px; }
  .aud-who { padding-top: 0; }
  .dl-row { grid-template-columns: 92px minmax(0, 1fr) auto; grid-template-areas: 'tm tc tg' 'wt wt hr'; gap: 2px 8px; }
  .dl-row .tm { grid-area: tm; } .dl-row .tc { grid-area: tc; } .dl-row .tg { grid-area: tg; }
  .dl-row .wt { grid-area: wt; white-space: normal; } .dl-row .hr { grid-area: hr; }
  .dl-row .ttl { display: none; }
}
@media print {
  .nav, .bh-tools, .day-tabs, .sync-bar, #panel, #scrim, .toasts { display: none !important; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .day-sec { break-inside: avoid-page; margin-top: 14px; }
  .dl-row { background: none !important; padding: 2px 6px; }
}

/* ---------- «Надо перенести»: сняли с места, новое ещё не выбрали ---------- */
.tag.to-move { background: var(--orange-tint); color: var(--orange-ink); white-space: nowrap; }
.move-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: -6px 0 12px; padding: 8px 12px;
              border-radius: var(--r); background: var(--orange-tint); font-size: 13px; }
.move-strip button { border: 0; border-radius: 980px; padding: 4px 10px; background: var(--surface); color: var(--ink); font: inherit;
                     cursor: pointer; box-shadow: var(--shadow-sm); }
.move-strip button:hover { box-shadow: inset 0 0 0 1.5px var(--orange); }
.to-move-word { color: var(--orange-ink); }
.dl-row.to-move { background: var(--orange-tint); }
.dl-row.to-move::before { background: var(--orange); }
.dl-row.to-move .wt b, .dl-row.to-move .tm { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--orange-ink) 60%, transparent); }
.day-tabs a i.mv { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }

/* ---------- ярлык на экран «Домой» ---------- */
.install-apps { display: flex; gap: 24px; margin: 2px 0 20px; }
.install-apps span { display: grid; justify-items: center; gap: 2px; font-size: 13px; font-weight: 600; text-align: center; }
.install-apps img { width: 60px; height: 60px; border-radius: 14px; margin-bottom: 4px; box-shadow: var(--shadow-sm); }
.install-apps small { color: var(--ink-3); font-weight: 400; font-size: 11.5px; }
svg.i.inline { width: 18px; height: 18px; vertical-align: -3px; color: var(--accent); }
/* уже открыто с ярлыка — пункт меню не нужен */
@media (display-mode: standalone) { .install-item { display: none !important; } }
.standalone .install-item { display: none !important; }
