/* ==========================================================
   Дневник КСК 911 — дизайн-система
   Modern Academic: тёплый нейтральный фон, чернильно-синий акцент,
   цветовые метки предметов вместо декора.
   ========================================================== */
:root {
  /* поверхности */
  --bg: #fbfaf7; --surface: #ffffff; --surface-2: #f8f7f3; --hover: #f3f1ec; --sunken: #efede7;
  --line: #e4e2dc; --line-strong: #d3d0c8;
  /* текст */
  --text: #1c1c1e; --text-2: #3a3a3e; --muted: #6f6f76;
  /* акцент */
  --accent: #e11d26; --accent-hover: #c4141d; --accent-soft: #fdeceb; --on-accent: #ffffff;
  --ring: rgba(225, 29, 38, .22);
  /* семантика */
  --ok: #1d7a4d; --ok-soft: #e5f4ec; --warn: #a8610a; --warn-soft: #fbf0dc; --bad: #b8312f; --bad-soft: #fbe8e7;
  /* метки предметов: lightness для светлой темы */
  --sub-bg-l: 96%; --sub-line-l: 46%; --sub-text-l: 26%;
  /* типографика */
  --font: "Manrope", "Inter", "Segoe UI", system-ui, sans-serif;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14.5px; --fs-lg: 17px; --fs-xl: 22px; --fs-2xl: 28px;
  /* ритм */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-sm: 7px; --r: 10px; --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(27, 28, 33, .05);
  --shadow-pop: 0 12px 32px -8px rgba(27, 28, 33, .22), 0 2px 6px rgba(27, 28, 33, .08);
  --side-w: 244px; --ease: cubic-bezier(.2, .7, .2, 1);
}
:root[data-theme="dark"] {
  --bg: #141415; --surface: #1c1c1e; --surface-2: #202023; --hover: #262629; --sunken: #171719;
  --line: #2c2c30; --line-strong: #3d3d43;
  --text: #f2f1ee; --text-2: #c2c1bd; --muted: #8e8d92;
  --accent: #ff4a52; --accent-hover: #ff6b72; --accent-soft: #3a1d1f; --on-accent: #1a0507;
  --ring: rgba(255, 74, 82, .35);
  --ok: #54c58a; --ok-soft: #17291f; --warn: #e0a24a; --warn-soft: #2d2413; --bad: #f08582; --bad-soft: #301b1b;
  --sub-bg-l: 15%; --sub-line-l: 62%; --sub-text-l: 82%;
  --shadow-sm: none; --shadow-pop: 0 16px 40px -8px rgba(0, 0, 0, .6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 var(--fs-md)/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; font-feature-settings: "tnum"; }
h1, h2, h3, p, dl, dd { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sheet { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(var(--dx, 16px)); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); font: 700 var(--fs-md) var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn.sec { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn.sec:hover { background: var(--hover); border-color: var(--muted); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; font-weight: 500; }
.btn.quiet:hover { background: var(--hover); color: var(--text); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { filter: brightness(.92); }
.btn.sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); }
.btn.ico { width: 30px; padding: 0; }
.btn.block { width: 100%; height: 42px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .6s linear infinite; }
.btn.del { color: var(--bad); }
.btn.del:hover { background: var(--bad-soft); color: var(--bad); }

/* ---------- поля ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
input, select, textarea { font: inherit; font-size: 15px; width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; padding: 9px 12px; resize: vertical; line-height: 1.45; }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23787b87' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input[type=radio] { width: auto; height: auto; }
.form { display: grid; gap: var(--s4); }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.err { color: var(--bad); font-size: var(--fs-sm); min-height: 18px; }

/* ---------- каркас ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side-w); flex-shrink: 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: var(--s4) var(--s3); background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; scrollbar-width: thin; }
.brand { display: flex; align-items: center; gap: 8px; padding: 8px 8px var(--s5); font-size: 20px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.brand .pl { display: inline-block; padding: 3px 6px 4px; border-radius: 5px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 800; letter-spacing: 0; }
.side nav { display: grid; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--r); color: var(--text-2); font-weight: 500; transition: background .12s, color .12s; position: relative; }
.side nav a:hover { background: var(--hover); color: var(--text); }
.side nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side .grp { margin: var(--s5) 0 6px; padding: 0 10px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.side .me { margin-top: auto; padding-top: var(--s3); border-top: 1px solid var(--line); display: grid; gap: 2px; }
.me .who { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 650; font-size: 12px; flex-shrink: 0; }
.me .who b { display: block; font-size: var(--fs-sm); font-weight: 600; line-height: 1.25; }
.me .who span { display: block; font-size: var(--fs-xs); color: var(--muted); }
.me .arc { display: flex; justify-content: center; align-items: flex-start; gap: 14px; height: 74px; padding-top: 4px; }
.me .arc button { width: 42px; height: 42px; padding: 0; justify-content: center; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); transition: background .15s, color .15s, border-color .15s, transform .15s; }
.me .arc button:nth-child(2) { margin-top: -2px; }
.me .arc button:nth-child(1), .me .arc button:nth-child(3) { margin-top: 18px; }
.me .arc button:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.me button { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-2); font-size: var(--fs-sm); cursor: pointer; text-align: left; }
.me button:hover { background: var(--hover); color: var(--text); }
.main { flex: 1; min-width: 0; padding: var(--s6) var(--s7) 80px; }
.page { max-width: 1480px; margin: 0 auto; animation: rise .28s var(--ease); }
.mtop, .bnav { display: none; }

.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.ph h1 { font-size: var(--fs-2xl); line-height: 1.12; font-weight: 800; letter-spacing: -.03em; }
.ph p { color: var(--muted); margin-top: 4px; }
.pa { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.pa select { width: auto; min-width: 140px; }
.pa:empty, .pa > :empty { display: none; }

/* ---------- поверхности ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); margin-bottom: var(--s5); overflow: hidden; }
.panel > .hd { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 14px var(--s5); border-bottom: 1px solid var(--line); }
.panel > .hd h2 { font-size: 15px; font-weight: 650; letter-spacing: -.005em; }
.panel > .hd .sub { font-size: var(--fs-sm); color: var(--muted); }
.panel > .bd { padding: var(--s5); }
.cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }
.cols .panel { margin-bottom: 0; }
.cols.eq { grid-template-columns: 1fr 1fr; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s3); margin-bottom: var(--s5); }
.stat { padding: 14px var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.stat .k { font-size: var(--fs-sm); color: var(--muted); }
.stat .v { font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; margin-top: 2px; }
.stat .v small { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; margin-left: 4px; letter-spacing: 0; }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; height: 22px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; background: var(--sunken); color: var(--text-2); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.sick { background: #e6eefb; color: #2458a6; }
:root[data-theme="dark"] .tag.sick { background: #1b2740; color: #8db4f0; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 600; font-size: var(--fs-xs); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px var(--s5); border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 11px var(--s5); border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl td.w { white-space: nowrap; }
.tbl .acts { display: flex; justify-content: flex-end; gap: 2px; }

/* метка предмета: оттенок задаётся --h */
[style*="--h:"] { --c-bg: hsl(var(--h) 34% var(--sub-bg-l)); --c-line: hsl(var(--h) 42% var(--sub-line-l)); --c-text: hsl(var(--h) 45% var(--sub-text-l)); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-line); display: inline-block; flex-shrink: 0; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r); background: var(--sunken); }
.seg label { margin: 0; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: block; height: 30px; line-height: 30px; padding: 0 12px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); white-space: nowrap; transition: background .12s, color .12s, box-shadow .12s; }
.seg label:hover span { color: var(--text); }
.seg input:checked + span { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.seg input[value=present]:checked + span { color: var(--ok); }
.seg input[value=late]:checked + span { color: var(--warn); }
.seg input[value=absent]:checked + span { color: var(--bad); }
.seg input[value=sick]:checked + span { color: #2458a6; }
.seg input[value=excused]:checked + span { color: var(--text); }
:root[data-theme="dark"] .seg input[value=sick]:checked + span { color: #8db4f0; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- неделя ---------- */
.wk { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s4); flex-wrap: wrap; }
.wk .range { font-weight: 600; font-size: var(--fs-lg); letter-spacing: -.01em; margin-right: var(--s2); }
.week { display: grid; grid-template-columns: repeat(var(--days), minmax(0, 1fr)); gap: var(--s3); animation: slideIn .24s var(--ease); }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); }
.day > header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.day h3 { font-size: var(--fs-md); font-weight: 650; }
.day .dt { font-size: var(--fs-sm); color: var(--muted); }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm); }
.day.today > header { background: var(--accent-soft); }
.day.today h3 { color: var(--accent); }
.day.past:not(.today) { background: var(--surface-2); }
.ln { margin: 8px; padding: 10px 12px; border-radius: var(--r); background: var(--c-bg); box-shadow: inset 3px 0 0 var(--c-line); display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 0 8px; align-items: start; }

.ln .n { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); padding-top: 3px; text-align: center; }
.ln .s b { display: flex; align-items: center; gap: 7px; font-weight: 600; line-height: 1.3; }
.ln .s small { display: block; color: var(--muted); font-size: var(--fs-xs); margin: 1px 0 0 15px; }
.ln .hwline { grid-column: 2; margin-top: 7px; padding: 7px 9px; border-radius: var(--r-sm); background: var(--surface); border-left: 3px solid var(--c-line); font-size: var(--fs-sm); color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; }
.ln .hwline .lbl { display: block; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; color: var(--c-text); margin-bottom: 1px; }
.ln .mark { grid-column: 2; margin-top: 6px; }
.nolesson { padding: 28px 14px; text-align: center; color: var(--muted); font-size: var(--fs-sm); }
.extra { margin: 0; padding: 10px 14px; border-top: 1px dashed var(--line-strong); font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }
.extra b { color: var(--text); }
.legend { color: var(--muted); font-size: var(--fs-sm); margin-top: var(--s3); }

/* ---------- расписание ---------- */
.sg { display: grid; grid-template-columns: 58px repeat(var(--days), minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.sg > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.sg .lc { border-right: 0; }
.sg .last { border-bottom: 0; }
.sg .dh { padding: 12px 14px; background: var(--surface-2); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 8px; font-weight: 650; }
.sg .dh small { font-size: 11px; font-weight: 650; color: var(--on-accent); background: var(--accent); padding: 1px 7px; border-radius: 999px; }
.sg .dh.today { background: var(--accent-soft); color: var(--accent); }
.nh b, .nn b { font-size: var(--fs-md); color: var(--text); }
.nh small, .nn small { display: block; margin-top: 2px; font-size: 10.5px; font-weight: 600; line-height: 1.25; text-align: center; color: var(--muted); }
.sg .nh { display: grid; place-content: center; justify-items: center; background: var(--surface-2); font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.sg .c { padding: 5px; min-height: 76px; display: flex; position: relative; }
.sg .c.today { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.les { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; text-align: left; padding: 8px 10px 8px 12px; border: 0; border-radius: var(--r); background: var(--c-bg); position: relative; color: var(--text); font-family: inherit; transition: box-shadow .15s, transform .15s; overflow: hidden; }
.les::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c-line); }
.les .s { font-weight: 650; font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; color: var(--text); }
.les .t { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.les .room { display: inline-block; font-weight: 600; color: var(--c-text); }
button.les { cursor: pointer; }
button.les:hover { box-shadow: 0 0 0 1px var(--c-line), var(--shadow-sm); transform: translateY(-1px); }
.les-x { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity .12s; background: var(--surface); border-color: var(--line-strong); }
.sg .c:hover .les-x, .les-x:focus-visible { opacity: 1; }
.add { flex: 1; border: 1px dashed transparent; border-radius: var(--r); background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; opacity: 0; transition: opacity .12s, background .12s, border-color .12s; }
.sg .c:hover .add, .add:focus-visible { opacity: 1; border-color: var(--line-strong); }
.add:hover { background: var(--hover); color: var(--accent); border-color: var(--accent); }
.sg .c .free { margin: auto; font-size: var(--fs-xs); color: var(--line-strong); }
.dtabs, .dlist { display: none; }

/* ---------- задания ---------- */
.hwg { padding: 10px var(--s5); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.hwg.soon { color: var(--warn); }
.hw { display: flex; gap: var(--s3); margin: 8px; padding: 12px 14px; border-radius: var(--r); background: var(--c-bg, var(--surface-2)); box-shadow: inset 3px 0 0 var(--c-line, var(--line-strong)); transition: filter .12s; }

.hw:hover { filter: brightness(.98); }
.hw .body { flex: 1; min-width: 0; }
.hw .subj { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.hw p { margin-top: 3px; color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; }
.hw .meta { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; }

.lec { display: flex; gap: var(--s3); margin: 8px; padding: 14px 16px; border-radius: var(--r); background: var(--c-bg, var(--surface-2)); box-shadow: inset 3px 0 0 var(--c-line, var(--line-strong)); }
.lec .body { flex: 1; min-width: 0; }
.lec .subj { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 600; }
.lec h3 { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em; margin-top: 4px; overflow-wrap: anywhere; }
.lec p { margin-top: 4px; color: var(--text-2); overflow-wrap: anywhere; white-space: pre-wrap; }
.lec .meta { font-size: var(--fs-xs); color: var(--muted); margin-top: 10px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin-top: 12px; max-width: 720px; }
@media (min-width: 901px) { .thumbs { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
.thumb { aspect-ratio: 4 / 3; padding: 0; border: 0; border-radius: var(--r); overflow: hidden; background: var(--sunken); cursor: zoom-in; position: relative; transition: transform .18s var(--ease), box-shadow .18s; }
.thumb:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--ease); }
.thumb:hover img { transform: scale(1.05); }
.subjpick { display: flex; flex-wrap: wrap; gap: 8px; }
.spill { position: relative; margin: 0; }
.spill input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.spill span { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); transition: background .12s, border-color .12s, color .12s; }
.spill:hover span { border-color: var(--muted); }
.spill input:checked + span { background: var(--c-bg, var(--sunken)); border-color: var(--c-line, var(--text)); color: var(--text); box-shadow: 0 0 0 1px var(--c-line, var(--text)); }
.spill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: var(--s4); border: 1.5px dashed var(--line-strong); border-radius: var(--r); background: var(--surface-2); transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.prev { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.prev:empty { display: none; }
.pv { position: relative; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; background: var(--sunken); animation: pop .2s var(--ease); }
.pv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv.doc { display: grid; place-content: center; justify-items: center; gap: 6px; padding: 8px; font-size: var(--fs-xs); font-weight: 600; text-align: center; color: var(--text-2); }
.pv.doc span { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pv button { position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(20, 20, 21, .72); color: #fff; cursor: pointer; }
.pv button:hover { background: var(--accent); }
.pv button .i { width: 14px; height: 14px; }
.gal { position: fixed; inset: 0; z-index: 90; display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; background: rgba(10, 10, 11, .92); animation: fade .15s; }
.gal .p { grid-column: 1; grid-row: 1; } .gal .n { grid-column: 3; grid-row: 1; } .gal figure { grid-column: 2; grid-row: 1; }
.gal figure { margin: 0; display: grid; justify-items: center; gap: 12px; min-width: 0; }
.gal img { max-width: 100%; max-height: calc(100vh - 110px); border-radius: var(--r); box-shadow: 0 20px 60px rgba(0, 0, 0, .5); animation: pop .22s var(--ease); }
.gal figcaption { color: #d8d7d3; font-size: var(--fs-sm); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gbtn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; cursor: pointer; justify-self: center; transition: background .15s; }
.gbtn:hover { background: var(--accent); }
.gbtn.x { position: absolute; top: 16px; right: 16px; }
.gbtn[hidden] { display: none; }
@media (max-width: 900px) { .gal { grid-template-columns: 1fr; } .gal figure { grid-column: 1; } .gal .p, .gal .n { grid-column: 1; } .gal .p, .gal .n { position: absolute; bottom: 20px; } .gal .p { left: 16px; } .gal .n { right: 16px; } .gal img { max-height: calc(100vh - 160px); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); font-size: var(--fs-sm); font-weight: 600; overflow: hidden; }
.chip small { color: var(--muted); font-weight: 500; white-space: nowrap; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.lbimg { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: var(--r); }
input[type=file] { height: auto; padding: 8px 10px; }
.att { display: flex; align-items: center; gap: var(--s4); padding: 8px var(--s5); border-bottom: 1px solid var(--line); }
.att:last-child { border-bottom: 0; }
.att .nm { flex: 1; min-width: 0; font-weight: 500; }
.att .nm .av { display: none; }
.savebar { display: flex; align-items: center; gap: var(--s2); padding: 12px var(--s5); border-top: 1px solid var(--line); background: var(--surface-2); }
.savebar .grow { flex: 1; color: var(--muted); font-size: var(--fs-sm); }
.toolbar { display: flex; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.toolbar .field { flex: 1; }
.toolbar .field.sm { flex: 0 0 180px; }

.rows > * { padding: 11px var(--s5); border-bottom: 1px solid var(--line); }
.rows > *:last-child { border-bottom: 0; }
.row { display: flex; align-items: center; gap: var(--s3); }
.row .grow { flex: 1; min-width: 0; }
.addrow { display: flex; gap: var(--s2); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }

.empty { padding: 44px var(--s5); text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 4px; }
.empty .ei { width: 40px; height: 40px; border-radius: 12px; background: var(--sunken); color: var(--muted); display: grid; place-items: center; margin-bottom: 8px; }
.empty b { color: var(--text-2); font-weight: 600; font-size: 15px; }
.alert { padding: 12px 14px; border-radius: var(--r); background: var(--bad-soft); color: var(--bad); font-weight: 500; }
.alert.note { background: var(--accent-soft); color: var(--accent); margin: var(--s4) var(--s5) 0; }
.skel { border-radius: var(--r-lg); background: linear-gradient(90deg, var(--line) 25%, var(--hover) 50%, var(--line) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; margin-bottom: var(--s3); }

/* окна и уведомления */
.ov { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: var(--s5); background: rgba(18, 19, 25, .42); backdrop-filter: blur(2px); animation: fade .15s; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: pop .2s var(--ease); }
.modal.wide { max-width: 620px; }
.modal .mh { display: flex; align-items: center; justify-content: space-between; padding: 16px var(--s5) 4px; }
.modal .mh h2 { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.01em; }
.modal .mb { padding: var(--s3) var(--s5) var(--s2); overflow-y: auto; }
.modal .mf { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s3) var(--s5) var(--s5); }
.modal .kv { display: grid; grid-template-columns: 120px 1fr; gap: 10px var(--s3); }
.modal .kv dt { color: var(--muted); } .modal .kv dd { margin: 0; font-weight: 600; }
.cred { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.cred td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.cred td:nth-child(n+2) { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.toasts { position: fixed; right: var(--s5); bottom: var(--s5); z-index: 80; display: grid; gap: var(--s2); }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r); background: var(--text); color: var(--surface); font-weight: 500; box-shadow: var(--shadow-pop); animation: pop .22s var(--ease); max-width: 360px; }
.toast .i { color: var(--ok); } :root:not([data-theme=dark]) .toast .i { color: #6fe0a6; }
.toast.bad .i { color: #ff9b97; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }

/* вход */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--bg); }
.auth .hero { padding: var(--s7); display: flex; flex-direction: column; justify-content: space-between; background: #1c1c1e; color: #fff; position: relative; overflow: hidden; }
:root[data-theme=dark] .auth .hero { background: #0e0e0f; }
.auth .hero .brand { padding: 0; }
.auth .hero h2 em { font-style: normal; color: #ff4a52; }

.auth .hero h2 { font-size: 52px; line-height: 1.05; letter-spacing: -.035em; font-weight: 800; max-width: 9em; }
.auth .hero ul { list-style: none; padding: 0; margin: var(--s5) 0 0; display: grid; gap: 10px; opacity: .88; }
.auth .hero li { display: flex; align-items: center; gap: 10px; }
.auth .hero li .i { opacity: .8; }
.auth .grid-bg { position: absolute; right: -80px; bottom: -80px; width: 360px; height: 360px; opacity: .1; pointer-events: none; background: repeating-linear-gradient(0deg, currentColor 0 1px, transparent 1px 40px), repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 40px); }
.auth .panel-r { display: grid; place-items: center; padding: var(--s5); }
.login { width: 100%; max-width: 360px; animation: rise .35s var(--ease); }
.login h1 { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.login > p { color: var(--muted); margin: 6px 0 var(--s5); }

/* ---------- адаптив ---------- */
@media (max-width: 1360px) { .main { padding: var(--s6) var(--s6) 80px; } }
@media (max-width: 1180px) {
  :root { --side-w: 216px; }
  .week { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --side-w: 280px; }
  .mtop { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 30; height: 54px; padding: 0 var(--s4); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
  .mtop .brand { padding: 0; } .mtop .brand .logo { width: 28px; height: 28px; }
  .shell { display: block; min-height: 0; }
  .side { position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; height: auto; transform: translateX(-102%); transition: transform .25s var(--ease); }
  .side.open { transform: none; box-shadow: var(--shadow-pop); }
  .scrim { position: fixed; inset: 0; z-index: 45; background: rgba(18, 19, 25, .42); animation: fade .15s; }
  .main { padding: var(--s5) var(--s4) 96px; }
  .ph h1 { font-size: 24px; }
  .bnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bnav a, .bnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; padding: 6px 2px; border: 0; background: none; font-size: 10.5px; font-weight: 500; line-height: 1.1; color: var(--muted); cursor: pointer; }
  .bnav .on { color: var(--accent); font-weight: 650; }
  .toasts { left: var(--s4); right: var(--s4); bottom: 72px; } .toast { max-width: none; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: var(--s2); }
  .stat .v { font-size: 22px; }
  .cols.eq { grid-template-columns: 1fr; }
  .week { grid-template-columns: 1fr; }
  .sg { display: none; }
  .dtabs { display: grid; grid-template-columns: repeat(var(--days), 1fr); gap: 4px; padding: 4px; border-radius: var(--r); background: var(--sunken); margin-bottom: var(--s3); }
  .dtabs button { border: 0; border-radius: var(--r-sm); background: none; height: 38px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background .12s; }
  .dtabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
  .dtabs button.td:not(.on) { color: var(--accent); }
  .dlist { display: grid; gap: var(--s2); animation: rise .2s var(--ease); }
  .dlist .it { display: grid; grid-template-columns: 46px minmax(0, 1fr); align-items: stretch; gap: var(--s2); }
  .dlist .it { position: relative; }
  .dlist .nn { display: grid; place-items: center; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
  .dlist .les { min-height: 62px; padding: 10px 40px 10px 14px; }
  .dlist .les-x { opacity: 1; top: 50%; transform: translateY(-50%); }
  .dlist .free { min-height: 46px; border: 1px dashed var(--line-strong); border-radius: var(--r); background: none; color: var(--muted); font-size: var(--fs-sm); cursor: pointer; }
  .tbl.stk thead { display: none; }
  .tbl.stk, .tbl.stk tbody, .tbl.stk tr, .tbl.stk td { display: block; width: 100%; }
  .tbl.stk tr { padding: 12px var(--s4); border-bottom: 1px solid var(--line); }
  .tbl.stk tbody tr:last-child { border-bottom: 0; }
  .tbl.stk td { padding: 2px 0; border: 0; }
  .tbl.stk td.r { text-align: left; }
  .tbl.stk .acts { justify-content: flex-start; margin-top: 4px; }
  .savebar { flex-wrap: wrap; } .savebar .grow { flex-basis: 100%; } .savebar .btn { flex: 1; height: 40px; }
  .att { flex-wrap: wrap; gap: 8px; padding: 12px var(--s4); } .att .nm { flex-basis: 100%; }
  .att .seg { width: 100%; flex-wrap: wrap; } .att .seg label { flex: 1 1 30%; } .att .seg span { padding: 0 2px; text-align: center; }
  .toolbar { flex-direction: column; padding: var(--s4); } .toolbar .field.sm { flex-basis: auto; }
  .form .two { grid-template-columns: 1fr; }
  .ov { place-items: end center; padding: 0; }
  .modal { max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92vh; animation: sheet .28s var(--ease); }
  .modal .mf { padding-bottom: calc(var(--s5) + env(safe-area-inset-bottom)); } .modal .mf .btn { flex: 1; height: 42px; }
  .panel > .hd, .hw, .rows > *, .addrow { padding-left: var(--s4); padding-right: var(--s4); }
  .hwg { padding-left: var(--s4); padding-right: var(--s4); }
  .auth { grid-template-columns: 1fr; }
  .auth .hero { display: none; }
  .auth .panel-r { align-items: start; padding-top: 12vh; }
  .login-brand { display: flex !important; }
}
.login-brand { display: none; margin-bottom: var(--s6); }
@media (max-width: 420px) { .ph { margin-bottom: var(--s4); } .ph .pa { width: 100%; } .ph .pa .btn { flex: 1; } .ph .pa select { flex: 1; } }
