/* ProCDZ · веб-кабинет
   Форма: карточки 18px, кнопки 12px, статусы — pill. Один акцент (violet).
   Тема: светлая по системе, тёмная по prefers-color-scheme, ручной переключатель. */

@import url("/app/assets/fonts/fonts.css");

:root {
  --r-card: 16px;
  --r-btn: 12px;
  --r-pill: 999px;

  /* палитра ближе к приложению МЭШ: графит + синий акцент */
  --bg: #0c0d11;
  --panel: #14161c;
  --card: #1a1c23;
  --card-2: #20232c;
  --line: #262a34;
  --line-strong: #333845;
  --text: #eef1f8;
  --muted: #939bab;
  --faint: #6d7585;
  --accent: #3b5bff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(59, 91, 255, 0.16);
  --ok: #45d69a;
  --ok-soft: rgba(69, 214, 154, 0.14);
  --warn: #f2b544;
  --warn-soft: rgba(242, 181, 68, 0.14);
  --danger: #ff6b81;
  --danger-soft: rgba(255, 107, 129, 0.14);
  --shadow: none;
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
}

/* системная светлая тема — только если пользователь явно не выбрал тёмную */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f2f4f9;
    --panel: #ffffff;
    --card: #ffffff;
    --card-2: #f6f7fb;
    --line: #e2e6ef;
    --line-strong: #ccd3e1;
    --text: #14161c;
    --muted: #5b6478;
    --faint: #8b93a6;
    --accent: #2c4bef;
    --accent-ink: #ffffff;
    --accent-soft: #e9edff;
    --ok: #0f9f6e;
    --ok-soft: #e2f7ee;
    --warn: #b06a00;
    --warn-soft: #fdf1dc;
    --danger: #c22f4a;
    --danger-soft: #fdeaee;
    --shadow: 0 1px 2px rgba(18, 21, 28, 0.04);
  }
}

:root[data-theme="light"] {
  --bg: #f2f4f9;
  --panel: #ffffff;
  --card: #ffffff;
  --card-2: #f6f7fb;
  --line: #e2e6ef;
  --line-strong: #ccd3e1;
  --text: #14161c;
  --muted: #5b6478;
  --faint: #8b93a6;
  --accent: #2c4bef;
  --accent-ink: #ffffff;
  --accent-soft: #e9edff;
  --ok: #0f9f6e;
  --ok-soft: #e2f7ee;
  --warn: #b06a00;
  --warn-soft: #fdf1dc;
  --danger: #c22f4a;
  --danger-soft: #fdeaee;
  --shadow: 0 1px 2px rgba(18, 21, 28, 0.04);
}

* { box-sizing: border-box; }

/* Атрибут hidden должен побеждать display у .sk/.days/.weekbar: иначе
   скрытые блоки остаются на экране (проверено глазами на живом кабинете). */
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--panel);
  padding: 10px 14px;
  border-radius: var(--r-btn);
  z-index: 50;
}
.skip:focus { left: 12px; top: 12px; }

.shell {
  width: min(920px, 100% - 32px);
  margin-inline: auto;
}

/* ── topbar ─────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar__in {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  text-decoration: none;
  flex: 0 0 auto;
}

.brand__mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 800;
}

.weeknav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-inline: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 3px;
}

.weeknav__label {
  min-width: 148px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  padding-inline: 8px;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}

.weeknav__today {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-family: inherit;
}

.iconbtn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.16s ease, color 0.16s ease;
}
.iconbtn:hover { background: var(--accent-soft); color: var(--text); }
.iconbtn:active { transform: scale(0.96); }
.iconbtn:disabled { opacity: 0.35; cursor: default; }

.topbar__right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  border: 1px solid var(--line);
}

/* ── page ───────────────────────────────────────────────── */

main { padding: 28px 0 96px; }

.headline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.headline h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 800;
}

.sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}

.sub b { color: var(--text); font-weight: 700; }

/* ── banner ─────────────────────────────────────────────── */

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--r-btn);
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
}
.banner[data-kind="error"] { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.banner[data-kind="warn"] { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.banner[data-kind="ok"] { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.banner button { margin-left: auto; }

/* ── days ───────────────────────────────────────────────── */

.days { display: grid; gap: 26px; }

.day__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.day__dow { color: var(--text); }
.day__today {
  text-transform: none;
  letter-spacing: 0;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r-pill);
  padding: 1px 8px;
  font-size: 11.5px;
  font-weight: 800;
}

.tasks { display: grid; gap: 10px; }

.task {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: border-color 0.16s ease, background 0.16s ease;
}
.task:hover { border-color: var(--line-strong); }
.task[data-status="solving"] { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

.task__top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.task__subject {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}

.task__title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.task__meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.task__error {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 12.5px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--r-pill);
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pill--new { background: var(--accent-soft); color: var(--accent); }
.pill--solving { background: var(--accent-soft); color: var(--accent); }
.pill--solved { background: var(--ok-soft); color: var(--ok); }
.pill--manual { background: var(--warn-soft); color: var(--warn); }
.pill--failed { background: var(--danger-soft); color: var(--danger); }

.pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill--solving .pill__dot { animation: pulse 1.6s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.82); }
}

/* ── buttons ────────────────────────────────────────────── */

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  border-radius: var(--r-btn);
  border: 1px solid transparent;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, #000); }

.btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}
.btn--ghost:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }

.btn--sm { padding: 7px 13px; font-size: 13px; }

.btn--wide { width: 100%; justify-content: center; }

:where(button, a, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-btn);
}

/* ── sticky week action ─────────────────────────────────── */

.weekbar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 15;
  width: min(920px, 100% - 32px);
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}
.weekbar .btn {
  pointer-events: auto;
  box-shadow: 0 12px 30px -12px color-mix(in srgb, var(--accent) 70%, transparent);
  padding: 12px 20px;
  font-size: 15px;
}

/* ── login / empty ──────────────────────────────────────── */

.gate {
  max-width: 560px;
  margin: 32px auto 0;
  text-align: center;
}
.gate h1 {
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
  font-weight: 800;
}
.gate p { color: var(--muted); margin: 0 0 22px; }
.gate__note { margin-top: 18px; font-size: 13.5px; }

.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0 0 26px;
  display: grid;
  gap: 10px;
  text-align: left;
}
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: center;
  line-height: 1.45;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 12px 16px;
  font-size: 14.5px;
}
.steps li::before {
  content: counter(step);
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 13px;
}
.steps a { color: var(--text); }
.steps code {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 6px;
  padding: 1px 6px;
  font: inherit;
  font-weight: 800;
}

.empty {
  text-align: center;
  padding: 56px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-card);
  color: var(--muted);
}
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }

/* ── skeleton ───────────────────────────────────────────── */

.sk { display: grid; gap: 10px; }
.sk__row {
  height: 86px;
  border-radius: var(--r-card);
  background: linear-gradient(100deg, var(--card) 30%, color-mix(in srgb, var(--card) 70%, var(--line)) 50%, var(--card) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border: 1px solid var(--line);
}
@keyframes shimmer {
  from { background-position: 150% 0; }
  to { background-position: -50% 0; }
}

footer {
  border-top: 1px solid var(--line);
  padding: 20px 0 28px;
  color: var(--faint);
  font-size: 12.5px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: space-between;
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--text); }

/* ── mobile ─────────────────────────────────────────────── */

@media (max-width: 640px) {
  .shell { width: calc(100% - 24px); }
  main { padding-top: 20px; }
  .topbar__in { height: 58px; gap: 8px; }
  .brand span:last-child { display: none; }
  .weeknav__label { min-width: 112px; font-size: 13px; }
  .weeknav__today { display: none; }
  .headline { flex-direction: column; align-items: flex-start; gap: 6px; }
  .headline h1 { font-size: 23px; }
  .task { grid-template-columns: 1fr; gap: 12px; padding: 14px 15px; }
  .task__side .btn { width: 100%; justify-content: center; }
  .weekbar { justify-content: stretch; bottom: 12px; width: calc(100% - 24px); }
  .weekbar .btn { width: 100%; justify-content: center; }
  .gate { margin-top: 12px; }
  .gate h1 { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── экран входа: варианты ──────────────────────────────── */

.gate__eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r-pill);
  padding: 3px 10px;
  margin: 0 0 14px;
}

.gate__lead { max-width: 46ch; margin-inline: auto; }

.gate__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.gate__note {
  margin: 16px 0 0;
  font-size: 13.5px;
  color: var(--faint);
}

.codeform {
  text-align: left;
  max-width: 420px;
  margin: 0 auto 26px;
}

.codeform__label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 8px;
}

.codeform__row { display: flex; gap: 8px; }

.codeform__input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-btn);
  padding: 11px 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.codeform__input::placeholder { color: var(--faint); letter-spacing: 0.1em; }
.codeform__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.codeform__hint {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--faint);
  line-height: 1.5;
}
.codeform__hint[data-error] { color: var(--danger); font-weight: 700; }
.codeform__hint code {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 6px;
  padding: 1px 5px;
  font: inherit;
  font-weight: 800;
}

/* ── карточка: кликабельность ───────────────────────────── */

.task { cursor: pointer; }
.task:hover { transform: translateY(-1px); }
.task:hover .task__chevron { color: var(--accent); transform: translateX(2px); }

.task__chevron {
  font-size: 22px;
  line-height: 1;
  color: var(--faint);
  transition: color 0.16s ease, transform 0.16s ease;
  padding: 0 4px;
}

/* ── шторка ЦДЗ ─────────────────────────────────────────── */

body.is-locked { overflow: hidden; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 12, 0.55);
  backdrop-filter: blur(3px);
}

.sheet__panel {
  position: relative;
  width: min(560px, 100%);
  max-height: min(86dvh, 760px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px 22px 18px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.6);
  animation: sheet-in 0.18s ease-out;
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.sheet__grip { display: none; }
.sheet__panel:focus { outline: none; }

.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sheet__titles { min-width: 0; }

.sheet__title {
  margin: 2px 0 0;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.sheet__body {
  margin: 16px 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  padding-right: 2px;
}

.sheet__actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.sheet__actions .btn { flex: 1 1 auto; justify-content: center; }

.sheet__note {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--muted);
}

.banner--inline { margin: 12px 0 0; }

/* поля настроек */

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 4px; }

.field__label {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}
.field__hint {
  font-weight: 600;
  color: var(--faint);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
  font-variant-numeric: tabular-nums;
}
.chip:hover { border-color: var(--accent); }
.chip:active { transform: scale(0.97); }
.chip--on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* ответы */

.answer {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--card);
}
.answer--clipped .answer__q {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.answer--clipped { cursor: pointer; }
.answer--clipped.answer--open .answer__q { display: block; -webkit-line-clamp: unset; }

.answer__q {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
  padding-right: 72px;
}
.answer__a {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.answer__badge {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 10.5px;
  padding: 1px 7px;
}

/* ── мобильная шторка ───────────────────────────────────── */

@media (max-width: 640px) {
  .sheet { padding: 0; align-items: flex-end; }
  .sheet__panel {
    width: 100%;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
    animation: sheet-up 0.2s ease-out;
  }
  @keyframes sheet-up {
    from { transform: translateY(24px); opacity: 0.6; }
    to { transform: none; opacity: 1; }
  }
  .sheet__grip {
    display: block;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: var(--line-strong);
    margin: 2px auto 12px;
  }
  .sheet__actions { position: sticky; bottom: 0; background: var(--panel); }
  .codeform__row { flex-direction: column; }
  .codeform__row .btn { width: 100%; justify-content: center; }
}

/* ── полоса дней как в МЭШ ──────────────────────────────── */

.weekstrip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin: 4px 0 14px;
  padding: 2px 0;
}

.daytab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 2px 10px;
  border: 0;
  background: none;
  border-radius: 14px;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
  transition: background 0.14s ease, color 0.14s ease;
}
.daytab:hover { background: var(--card-2); }

.daytab__dow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.daytab__num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: background 0.14s ease, color 0.14s ease;
}

.daytab--active { color: var(--text); }
.daytab--active .daytab__num {
  background: var(--accent);
  color: var(--accent-ink);
}

.daytab--today .daytab__dow { color: #ff6b6b; }
.daytab--weekend .daytab__dow { color: #ff8b8b; }

.daytab__dot {
  position: absolute;
  bottom: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.9;
}
.daytab--active .daytab__dot { background: var(--accent-ink); opacity: 0.85; }

/* шапка дня и карточки */

.dayhead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 10px;
  font-size: 13px;
  color: var(--muted);
}
.dayhead b { color: var(--text); font-weight: 800; }

.task {
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 14px;
  border-radius: var(--r-card);
  background: var(--card);
  border: 1px solid var(--line);
}

.task__badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--card-2);
  color: var(--text);
  font-weight: 800;
  font-size: 17px;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.task[data-status="solved"] .task__badge { color: var(--ok); }
.task[data-status="solving"] .task__badge,
.task[data-status="queued"] .task__badge { color: var(--accent); border-color: var(--accent); }
.task[data-status="manual"] .task__badge { color: var(--warn); }
.task[data-status="failed"] .task__badge { color: var(--danger); }

.task__subject { font-size: 11.5px; letter-spacing: 0.04em; }
.task__title { font-size: 15px; line-height: 1.35; }
.task__meta { font-size: 12.5px; }

/* прогресс решения внутри карточки */

.tp {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}
.tp__row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tp__bar {
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.tp__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.tp__fill--indeterminate {
  width: 35% !important;
  animation: tp-slide 1.6s ease-in-out infinite;
}
@keyframes tp-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

/* своё время: поле ввода */

.inlineform {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.inlineform__input {
  width: 92px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-btn);
  padding: 8px 10px;
  font-variant-numeric: tabular-nums;
}
.inlineform__input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.inlineform__hint { align-self: center; font-size: 12px; color: var(--faint); }

/* ответы: части через ;; в столбик */

.answer__a { font-weight: 700; }
.answer__part {
  display: block;
  padding: 4px 0 4px 10px;
  border-left: 2px solid var(--accent-soft);
  margin: 4px 0;
  font-weight: 700;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .task { grid-template-columns: 38px 1fr auto; padding: 12px; gap: 10px; }
  .task__badge { width: 38px; height: 38px; font-size: 15px; border-radius: 10px; }
  .weekstrip { gap: 0; }
  .daytab { padding: 6px 0 8px; }
  .daytab__num { width: 32px; height: 32px; font-size: 14px; }
}

/* ── правки переполнения: длинные названия рвали сетку ──── */

.task { overflow: hidden; }

.task__main {
  min-width: 0; /* без этого 1fr-колонка не сжимается и карточка выезжает */
}

.task__side { flex: 0 0 auto; }

.task__top { min-width: 0; }

.task__subject {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task__title {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.task__error {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.pill { flex: 0 0 auto; }

.dayhead { min-width: 0; }

/* ── анимации и уведомления ─────────────────────────────── */

.weeknav__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  padding: 6px 8px;
  border-radius: var(--r-btn);
  cursor: pointer;
  min-width: 148px;
  justify-content: center;
  transition: background 0.14s ease;
}
.weeknav__label:hover { background: var(--card-2); }
.weeknav__caret { font-size: 10px; color: var(--faint); }

.weekchips {
  display: flex;
  gap: 8px;
  margin: -4px 0 14px;
  flex-wrap: wrap;
}
.weekchips .chip { font-size: 12.5px; padding: 6px 12px; }

/* тосты */

.toasts {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100% - 24px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--card) 92%, #000);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.4;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.7);
  animation: toast-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast--out { animation: toast-out 0.18s ease-in forwards; }
.toast__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex: 0 0 auto;
  background: var(--accent);
}
.toast--ok .toast__dot { background: var(--ok); }
.toast--warn .toast__dot { background: var(--warn); }
.toast--error .toast__dot { background: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(6px) scale(0.99); }
}

/* появление карточек лесенкой */

.task {
  animation: card-in 0.26s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: calc(var(--i, 0) * 32ms);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* закончилось решение — короткая вспышка */

.task--flash { animation: card-flash 1.1s ease-out; }
@keyframes card-flash {
  0% { box-shadow: inset 0 0 0 1px var(--accent); }
  100% { box-shadow: inset 0 0 0 1px transparent; }
}
.task[data-status="solved"].task--flash { animation-name: card-flash-ok; }
@keyframes card-flash-ok {
  0% { box-shadow: inset 0 0 0 1px var(--ok); }
  100% { box-shadow: inset 0 0 0 1px transparent; }
}

/* полоса дня: мягкий переход */

.daytab__num { transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease; }
.daytab--active .daytab__num { transform: scale(1.04); }

/* колокольчик */

#bell[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
#bell[aria-pressed="true"] svg { fill: color-mix(in srgb, var(--accent) 22%, transparent); }
.iconbtn--bell svg { transition: fill 0.16s ease, color 0.16s ease; }

/* шторка «другая неделя» */

.sheet__panel--sm { width: min(420px, 100%); }
.inlineform--wide { margin-top: 4px; }
.inlineform__input[type="date"] {
  width: auto;
  flex: 1 1 auto;
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
}
.inlineform__input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.6);
  cursor: pointer;
}

/* фон шторки мягко проявляется */

.sheet__backdrop { animation: fade-in 0.18s ease-out; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 640px) {
  .weeknav__label { min-width: 118px; font-size: 13px; }
  .toasts { bottom: calc(68px + env(safe-area-inset-bottom)); }
}

/* ── карточка «в работе»: прогресс вместо срока ─────────── */

.task[data-status="solving"] .task__title,
.task[data-status="queued"] .task__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.task[data-status="solving"] .task__badge,
.task[data-status="queued"] .task__badge {
  animation: badge-pulse 2.2s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); }
  50% { box-shadow: 0 0 0 5px transparent; }
}

.tp { margin-top: 10px; gap: 7px; }
.tp__row { font-size: 13px; }
.tp__stage { font-weight: 800; color: var(--text); }
.tp__count { font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.tp__bar { height: 6px; background: color-mix(in srgb, var(--line) 70%, transparent); }
.tp__fill { transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.tp__sub { font-size: 11.5px; color: var(--faint); }

/* ── шторка «почему уведомления не работают» ────────────── */

#bell.is-soft { color: var(--warn); background: var(--warn-soft); }
#bell.is-soft svg { fill: none; }

#notifysheet .sheet__panel {
  max-height: min(86vh, 720px);
  overflow-y: auto;
}
#notifysheet .sheet__note { margin-bottom: 14px; }
#notifysheet .steps { gap: 8px; margin-bottom: 16px; }
#notifysheet .steps li {
  grid-template-columns: 24px 1fr;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.45;
}
#notifysheet .steps li::before {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  font-size: 12px;
}

.sheet__note--tight {
  margin: 0 0 4px;
  font-size: 12.5px;
  color: var(--faint);
  line-height: 1.45;
}
