/* =========================================================
   МедРасписание — Telegram Mini App
   ========================================================= */

:root {
  --bg: #edf4f2;
  --bg-deep: #e4efec;
  --surface: #ffffff;
  --surface-2: #f5f9f8;
  --surface-3: #eaf2f0;
  --text: #102c2b;
  --muted: #607c78;
  --faint: #8ba29f;
  --border: rgba(16, 44, 43, 0.09);
  --border-strong: rgba(16, 44, 43, 0.14);
  --primary: #0b6b61;
  --primary-deep: #074d46;
  --primary-bright: #128a7c;
  --primary-soft: #d9f2ec;
  --primary-soft-2: #eefaf7;
  --on-primary: #ffffff;
  --danger: #bd3f3a;
  --danger-soft: #fbe9e7;
  --warning: #9a6415;
  --warning-soft: #fcf1df;
  --violet: #6c58a8;
  --violet-soft: #efebfa;
  --blue: #2b6499;
  --blue-soft: #e8f1fa;
  --live: #b45309;
  --live-soft: #fdf1dd;
  --live-line: rgba(180, 83, 9, 0.32);
  --on-live: #ffffff;
  --shadow-sm: 0 2px 8px rgba(13, 53, 49, 0.05);
  --shadow: 0 12px 34px rgba(13, 53, 49, 0.09);
  --shadow-lg: 0 24px 70px rgba(7, 43, 39, 0.22);
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --nav-height: 66px;
}

html.theme-dark {
  --bg: #081414;
  --bg-deep: #0b1919;
  --surface: #102121;
  --surface-2: #152a29;
  --surface-3: #1a3331;
  --text: #edf8f6;
  --muted: #9db5b1;
  --faint: #76918d;
  --border: rgba(225, 246, 241, 0.09);
  --border-strong: rgba(225, 246, 241, 0.16);
  --primary: #45c9b6;
  --primary-deep: #0d4d45;
  --primary-bright: #62dbc9;
  --primary-soft: #153d37;
  --primary-soft-2: #122f2b;
  --on-primary: #062e2a;
  --danger: #ef7d75;
  --danger-soft: #3a1f1e;
  --warning: #e8b66e;
  --warning-soft: #332814;
  --violet: #b9a8ee;
  --violet-soft: #28213d;
  --blue: #8fc0ec;
  --blue-soft: #162c3d;
  --live: #ffb257;
  --live-soft: #35260f;
  --live-line: rgba(255, 178, 87, 0.34);
  --on-live: #2a1a05;
  --live: #ffb257;
  --live-soft: #35260f;
  --live-line: rgba(255, 178, 87, 0.34);
  --on-live: #2a1a05;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
  html:not(.theme-light) {
    --bg: #081414;
    --bg-deep: #0b1919;
    --surface: #102121;
    --surface-2: #152a29;
    --surface-3: #1a3331;
    --text: #edf8f6;
    --muted: #9db5b1;
    --faint: #76918d;
    --border: rgba(225, 246, 241, 0.09);
    --border-strong: rgba(225, 246, 241, 0.16);
    --primary: #45c9b6;
    --primary-deep: #0d4d45;
    --primary-bright: #62dbc9;
    --primary-soft: #153d37;
    --primary-soft-2: #122f2b;
    --on-primary: #062e2a;
    --danger: #ef7d75;
    --danger-soft: #3a1f1e;
    --warning: #e8b66e;
    --warning-soft: #332814;
    --violet: #b9a8ee;
    --violet-soft: #28213d;
    --blue: #8fc0ec;
    --blue-soft: #162c3d;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow: 0 14px 36px rgba(0, 0, 0, 0.32);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.55);
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html {
  background: var(--bg);
  color-scheme: light;
}

html.theme-dark {
  color-scheme: dark;
}

body {
  font-family: var(--font);
  background:
    radial-gradient(1100px 500px at 100% -10%, rgba(18, 138, 124, 0.1), transparent 60%),
    radial-gradient(800px 480px at -20% 20%, rgba(43, 100, 153, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

body.sheet-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: var(--primary);
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--primary-soft);
  color: var(--text);
}

/* ---------- каркас ---------- */

.app-shell {
  min-height: 100dvh;
}

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)))
    max(16px, calc((100vw - 688px) / 2)) 10px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.app-header.is-scrolled {
  border-bottom-color: var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  min-width: 0;
}

.brand__mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary-bright), var(--primary-deep));
  box-shadow: 0 5px 14px rgba(11, 107, 97, 0.25);
}

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.brand__text strong {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.brand__text small {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.avatar {
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 750;
  overflow: hidden;
  padding: 0;
  flex: 0 0 auto;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--header {
  width: 40px;
  height: 40px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}

.view {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 4px 16px calc(112px + var(--safe-bottom));
  flex: 1;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 20px 20px 17px;
  color: #f2fffc;
  background:
    radial-gradient(180px 150px at 92% 10%, rgba(255, 255, 255, 0.14), transparent 70%),
    linear-gradient(135deg, #0a5c54 0%, #0c7c6f 58%, #149487 100%);
  box-shadow: 0 18px 38px rgba(7, 77, 69, 0.22);
  animation: rise 0.45s ease both;
}

.hero::after {
  content: "";
  position: absolute;
  right: -45px;
  bottom: -70px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 26px rgba(255, 255, 255, 0.035),
    0 0 0 54px rgba(255, 255, 255, 0.025);
  pointer-events: none;
}

.hero__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.hero__kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(240, 255, 251, 0.72);
}

.hero__kicker::before {
  content: "";
  width: 16px;
  height: 1px;
  background: currentColor;
}

.hero h1 {
  margin: 5px 0 0;
  font-size: clamp(27px, 7.5vw, 34px);
  line-height: 1.05;
  font-weight: 780;
  letter-spacing: -0.035em;
}

.hero__sub {
  margin: 7px 0 0;
  font-size: 12.5px;
  color: rgba(237, 255, 251, 0.76);
  max-width: 310px;
}

.hero__cross {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.16);
  flex: 0 0 42px;
}

.hero__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}

.hero__meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(241, 255, 252, 0.82);
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.hero__ecg {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  width: 100%;
  height: 44px;
  opacity: 0.38;
  color: rgba(195, 255, 244, 0.6);
  pointer-events: none;
}

/* ---------- секции ---------- */

.section {
  margin-top: 22px;
}

.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 0 2px;
}

.section__title {
  margin: 0;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.section__hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--faint);
}

/* ---------- группы ---------- */

.group-strip {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 1px 5px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.group-strip::-webkit-scrollbar {
  display: none;
}

.group-chip {
  flex: 0 0 auto;
  min-width: 52px;
  height: 42px;
  padding: 0 13px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
  scroll-snap-align: start;
}

.group-chip:active {
  transform: scale(0.95);
}

.group-chip.is-active {
  color: var(--on-primary);
  border-color: transparent;
  background: linear-gradient(145deg, var(--primary-bright), var(--primary));
  box-shadow: 0 7px 16px rgba(11, 107, 97, 0.24);
}

/* ---------- неделя ---------- */

.weekbar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.weekbar__arrow {
  width: 42px;
  height: 46px;
  flex: 0 0 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--primary);
  display: grid;
  place-items: center;
  transition: background 0.15s ease;
}

.weekbar__arrow:active {
  background: var(--surface-3);
}

.weekbar__center {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding: 1px 2px;
}

.weekbar__dates {
  font-size: 14.5px;
  font-weight: 750;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weekbar__meta {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.parity-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.02em;
  background: var(--primary-soft);
  color: var(--primary);
}

.parity-pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.parity-pill.is-even {
  background: var(--violet-soft);
  color: var(--violet);
}

.weekbar__iso {
  font-size: 10.5px;
  color: var(--faint);
}

.week-tools {
  display: flex;
  justify-content: flex-end;
  margin-top: 7px;
}

.link-btn {
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 650;
  padding: 5px 7px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.link-btn:active {
  background: var(--primary-soft);
}

/* ---------- дни ---------- */

.days {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.day {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: rise 0.35s ease both;
}

.day.is-today {
  border-color: color-mix(in srgb, var(--primary) 38%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 12%, transparent),
    var(--shadow);
}

.day__head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  background: var(--surface-2);
  border-bottom: 1px solid transparent;
}

.day.has-entries .day__head {
  border-bottom-color: var(--border);
}

.day.is-today .day__head {
  background: linear-gradient(90deg, var(--primary-soft-2), var(--surface-2));
}

.day__date {
  width: 44px;
  height: 46px;
  flex: 0 0 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  line-height: 1;
}

.day.is-today .day__date {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.day__dow {
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.68;
}

.day__num {
  font-size: 20px;
  font-weight: 780;
  margin-top: 3px;
  letter-spacing: -0.03em;
}

.day__titles {
  min-width: 0;
  flex: 1;
}

.day__title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 750;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 7px;
}

.today-dot {
  font-size: 9.5px;
  font-weight: 750;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 2px 7px;
  letter-spacing: 0.02em;
}

.day__sub {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--faint);
}

.day__add {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  display: grid;
  place-items: center;
}

.day__add:active {
  background: var(--primary-soft);
  color: var(--primary);
}

.day__body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day__empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 5px 7px;
  color: var(--faint);
  font-size: 12.5px;
}

.day__empty svg {
  opacity: 0.65;
}

/* ---------- карточка пары ---------- */

.entry {
  position: relative;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 28px;
  gap: 10px;
  padding: 11px 10px 11px 0;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

.entry:active {
  background: var(--surface-3);
}

.entry.is-lecture {
  background: linear-gradient(90deg, var(--blue-soft), var(--surface-2) 58%);
}

html.theme-dark .entry.is-lecture {
  background: linear-gradient(90deg, var(--blue-soft), var(--surface-2) 72%);
}

.entry__time {
  padding-left: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border-right: 1px solid var(--border);
  min-height: 44px;
}

.entry__start {
  font-size: 13px;
  font-weight: 780;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.entry__end {
  font-size: 10px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

.entry__pair {
  margin-top: 5px;
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
  border-radius: 5px;
  padding: 1px 5px;
}

.entry__main {
  min-width: 0;
}

.entry__badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--primary-soft);
  color: var(--primary);
  white-space: nowrap;
}

.type-badge[data-type="lecture"] {
  background: var(--blue-soft);
  color: var(--blue);
}

.type-badge[data-type="seminar"] {
  background: var(--violet-soft);
  color: var(--violet);
}

.type-badge[data-type="lab"] {
  background: var(--warning-soft);
  color: var(--warning);
}

.type-badge[data-type="exam"] {
  background: var(--danger-soft);
  color: var(--danger);
}

.mini-parity {
  font-size: 9px;
  font-weight: 650;
  color: var(--faint);
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
}

.entry__subject {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.012em;
  overflow-wrap: anywhere;
}

.entry__teacher {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry__foot {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.entry__meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 550;
}

.entry__limit {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 650;
  color: var(--warning);
  background: var(--warning-soft);
  padding: 2px 6px;
  border-radius: 5px;
}

.entry__note {
  margin: 6px 0 0;
  font-size: 10.5px;
  color: var(--faint);
  padding-left: 8px;
  border-left: 2px solid var(--border-strong);
  overflow-wrap: anywhere;
}

.entry__edit {
  align-self: start;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}

.entry__edit:active {
  color: var(--primary);
  background: var(--primary-soft);
}

.entry__chevron {
  align-self: center;
  color: var(--faint);
  opacity: 0.7;
  display: grid;
  place-items: center;
}

/* ---------- пустое состояние ---------- */

.empty {
  text-align: center;
  padding: 26px 20px 22px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  margin-top: 14px;
}

.empty__icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 10px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
}

.empty h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 750;
}

.empty p {
  margin: 5px auto 0;
  max-width: 340px;
  font-size: 12.5px;
  color: var(--muted);
}

.empty .btn {
  margin-top: 14px;
}

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
  transition: transform 0.14s ease, background 0.14s ease, opacity 0.14s ease;
}

.btn:active {
  transform: scale(0.975);
}

.btn--primary {
  border-color: transparent;
  background: linear-gradient(145deg, var(--primary-bright), var(--primary));
  color: var(--on-primary);
  box-shadow: 0 7px 16px rgba(11, 107, 97, 0.22);
}

.btn--soft {
  border-color: transparent;
  background: var(--primary-soft);
  color: var(--primary);
}

.btn--danger {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger);
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn--block {
  width: 100%;
}

.btn--sm {
  min-height: 34px;
  padding: 0 11px;
  font-size: 11.5px;
  border-radius: 9px;
}

.btn:disabled {
  box-shadow: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}

/* ---------- нижняя навигация ---------- */

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(10px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 40;
  width: min(calc(100vw - 24px), 460px);
  height: var(--nav-height);
  padding: 6px;
  display: flex;
  align-items: stretch;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: 0 12px 40px rgba(7, 43, 39, 0.16);
}

.nav-item {
  flex: 1;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  padding: 4px 2px;
  transition: background 0.15s ease, color 0.15s ease;
  min-width: 0;
}

.nav-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.nav-item.is-active {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-item:active {
  transform: scale(0.97);
}

/* ---------- админ-панель ---------- */

.page-head {
  margin: 4px 0 16px;
  animation: rise 0.3s ease both;
}

.page-head h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.08;
  font-weight: 780;
  letter-spacing: -0.035em;
}

.page-head p {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 520px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 15px;
}

.stat {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 11px 12px;
  box-shadow: var(--shadow-sm);
}

.stat__value {
  font-size: 22px;
  font-weight: 780;
  letter-spacing: -0.04em;
  line-height: 1;
}

.stat__label {
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.25;
}

.stat.is-accent {
  background: linear-gradient(145deg, var(--primary), var(--primary-deep));
  border-color: transparent;
  color: #fff;
}

.stat.is-accent .stat__label {
  color: rgba(255, 255, 255, 0.72);
}

.admin-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.admin-actions .btn {
  flex: 1;
}

.segmented {
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: 13px;
  background: var(--surface-3);
  margin-top: 18px;
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar {
  display: none;
}

.segmented button {
  flex: 1;
  min-width: fit-content;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 8px 10px;
  white-space: nowrap;
}

.segmented button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 13px;
}

.searchbox {
  position: relative;
}

.searchbox svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}

.searchbox input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 12px 0 37px;
  font-size: 13px;
  outline: none;
}

.searchbox input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 13%, transparent);
}

.toolbar__row {
  display: flex;
  gap: 8px;
}

.toolbar__row .field {
  flex: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field > label,
.field__label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
  padding-left: 2px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  padding: 0 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23607c78' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.field textarea {
  min-height: 74px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.4;
}

.field__hint {
  font-size: 10px;
  color: var(--faint);
  padding-left: 2px;
  line-height: 1.35;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 13px;
}

.admin-entry {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 11px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.admin-entry__top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.admin-entry__slot {
  font-size: 9.5px;
  font-weight: 750;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 7px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.admin-entry__subject {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.admin-entry__sub {
  margin: 3px 0 0;
  font-size: 10.5px;
  color: var(--muted);
}

.admin-entry__dates {
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  color: var(--faint);
}

/* Пометка «только для иностранцев / только для русских» в списке пар. */
.admin-entry__scope {
  margin: 4px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(88, 132, 255, 0.14);
  color: #7f9dff;
  font-size: 9.5px;
  font-weight: 600;
}

.admin-entry__actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  display: grid;
  place-items: center;
}

.icon-btn:active {
  color: var(--primary);
  background: var(--primary-soft);
}

.icon-btn--danger:active {
  color: var(--danger);
  background: var(--danger-soft);
}

.list-count {
  font-size: 11px;
  color: var(--faint);
  margin: 10px 2px 0;
}

/* ---------- команда ---------- */

.team-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 13px;
}

.person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.avatar--person {
  width: 40px;
  height: 40px;
  font-size: 12px;
  border: 0;
}

.person__main {
  min-width: 0;
  flex: 1;
}

.person__name {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person__meta {
  font-size: 10.5px;
  color: var(--faint);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--surface-3);
  color: var(--muted);
  white-space: nowrap;
}

.role-badge--superadmin {
  background: var(--warning-soft);
  color: var(--warning);
}

.role-badge--admin {
  background: var(--primary-soft);
  color: var(--primary);
}

.person__select {
  flex: 0 0 auto;
  width: 110px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 10.5px;
  padding: 0 6px;
}

.you-badge {
  font-size: 8.5px;
  color: var(--faint);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}

/* ---------- настройки ---------- */

.settings-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  padding: 14px;
  margin-top: 12px;
  box-shadow: var(--shadow-sm);
}

.settings-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.settings-card__head h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 750;
}

.settings-card__head p {
  margin: 3px 0 0;
  font-size: 10.5px;
  color: var(--muted);
  max-width: 420px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.form-grid .is-full {
  grid-column: 1 / -1;
}

.bells-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.bell-row {
  display: grid;
  grid-template-columns: 54px 1fr 1fr;
  align-items: center;
  gap: 7px;
}

.bell-row__label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
}

.bell-row input {
  min-height: 38px;
  font-variant-numeric: tabular-nums;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 12px;
}

.audit-list {
  display: flex;
  flex-direction: column;
  margin-top: 13px;
}

.audit-item {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 9px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.audit-item:last-child {
  border-bottom: 0;
}

.audit-item__mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 750;
}

.audit-item__text {
  font-size: 11px;
  line-height: 1.4;
}

.audit-item__text strong {
  font-weight: 700;
}

.audit-item__time {
  display: block;
  font-size: 9.5px;
  color: var(--faint);
  margin-top: 2px;
}

/* ---------- профиль ---------- */

.profile-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(180px 150px at 100% 0, rgba(255, 255, 255, 0.15), transparent 65%),
    linear-gradient(145deg, #0a5a52, #0e8073);
  color: #f3fffc;
  padding: 20px;
  box-shadow: 0 18px 38px rgba(7, 77, 69, 0.22);
  animation: rise 0.35s ease both;
}

.profile-card__row {
  display: flex;
  align-items: center;
  gap: 13px;
}

.avatar--profile {
  width: 62px;
  height: 62px;
  font-size: 19px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.profile-card h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.1;
  font-weight: 780;
  letter-spacing: -0.025em;
}

.profile-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 5px;
  font-size: 11px;
  color: rgba(240, 255, 251, 0.74);
}

.profile-card__role {
  margin-top: 15px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

/* ---------- настройки профиля ---------- */

.profile-setup {
  border-color: rgba(18, 138, 124, 0.24);
  background:
    radial-gradient(240px 140px at 100% 0, rgba(18, 138, 124, 0.07), transparent 70%),
    var(--surface);
}

.profile-setup__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 13px;
}

.profile-setup__icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-soft);
}

.profile-setup__head h2 {
  margin: 1px 0 3px;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--text);
}

.profile-setup__head p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

.profile-setup__form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.profile-setup__status {
  margin: 0;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--primary);
  background: var(--primary-soft);
}

.profile-setup .field select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.profile-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.profile-switch__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.profile-switch__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.profile-switch__hint {
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--muted);
}

.profile-setup__note {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--muted);
}

.switch {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.switch__track {
  position: relative;
  display: block;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-3);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(7, 43, 39, 0.22);
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch input:checked + .switch__track {
  border-color: var(--primary);
  background: var(--primary);
}

.switch input:checked + .switch__track .switch__thumb {
  transform: translateX(18px);
  background: var(--on-primary);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--primary-bright);
  outline-offset: 2px;
}

.switch input:disabled + .switch__track {
  opacity: 0.6;
  cursor: wait;
}

.profile-setup .btn {
  margin-top: 2px;
}

.info-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 15px;
  margin-top: 12px;
  box-shadow: var(--shadow-sm);
}

.info-card h2 {
  margin: 0 0 9px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.info-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.info-row:last-child {
  border-bottom: 0;
}

.info-row span {
  color: var(--muted);
}

.info-row strong {
  font-weight: 650;
  text-align: right;
  overflow-wrap: anywhere;
}

.info-note {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

.info-note + .info-note {
  margin-top: 8px;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature {
  display: flex;
  gap: 10px;
}

.feature__icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
}

.feature strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
}

.feature p {
  margin: 2px 0 0;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.4;
}

.app-foot {
  text-align: center;
  font-size: 9.5px;
  color: var(--faint);
  padding: 22px 0 0;
}

/* ---------- скелетон ---------- */

.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}

.skel-hero {
  height: 146px;
  border-radius: var(--radius-lg);
}

.skel-line {
  height: 12px;
  border-radius: 6px;
  margin-top: 10px;
}

.skel-row {
  height: 42px;
  margin-top: 12px;
}

.skel-card {
  height: 148px;
  margin-top: 12px;
}

/* ---------- шторка / формы ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 20, 19, 0.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.18s ease both;
}

.sheet {
  width: min(100%, 620px);
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-lg);
  animation: sheet-up 0.28s cubic-bezier(0.22, 0.9, 0.3, 1) both;
  overflow: hidden;
}

.sheet__handle {
  width: 40px;
  height: 4px;
  flex: 0 0 4px;
  border-radius: 999px;
  background: var(--border-strong);
  margin: 8px auto 2px;
}

.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px 10px;
}

.sheet__head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 780;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.sheet__head p {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.sheet__close {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--muted);
  display: grid;
  place-items: center;
}

.sheet__body {
  padding: 8px 18px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet__foot {
  padding: 11px 18px calc(14px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  display: flex;
  gap: 8px;
}

.sheet__foot .btn {
  flex: 1;
}

.sheet__foot .btn--danger {
  flex: 0 0 auto;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.form-section {
  border-top: 1px solid var(--border);
  padding-top: 11px;
  margin-top: 2px;
}

.form-section:first-child {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.form-section__title {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}

.group-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.group-pick {
  position: relative;
}

.group-pick input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.group-pick span {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.group-pick input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.group-pick--all span {
  min-width: 82px;
}

.segmented--field {
  margin-top: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.segmented--field button {
  font-size: 10.5px;
  padding: 8px 5px;
}

.segmented--field button.is-active {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: none;
}

.error-box {
  margin-top: 10px;
  border: 1px solid color-mix(in srgb, var(--danger) 24%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 11px;
  padding: 9px 11px;
  font-size: 11px;
  line-height: 1.4;
}

.error-box ul {
  margin: 5px 0 0;
  padding-left: 16px;
}

.error-box li {
  margin-top: 2px;
}

.entry-detail__time {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 24px;
  font-weight: 780;
  letter-spacing: -0.04em;
  margin-bottom: 3px;
}

.entry-detail__time small {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}

.detail-list {
  margin: 12px 0 0;
}

.detail-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-row dt {
  color: var(--muted);
  flex: 0 0 auto;
}

.detail-row dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

/* ---------- toast ---------- */

.toast-stack {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: calc(92px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(calc(100vw - 32px), 420px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 13px;
  border-radius: 12px;
  background: #102c2b;
  color: #f3fffc;
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.4;
  box-shadow: 0 12px 30px rgba(3, 20, 19, 0.3);
  animation: toast-in 0.24s ease both;
}

html.theme-dark .toast {
  background: #eaf8f5;
  color: #0a2422;
}

.toast.is-error {
  background: #7d2b28;
  color: #fff4f2;
}

.toast__icon {
  flex: 0 0 auto;
  margin-top: 1px;
}

/* ---------- подтверждение ---------- */

.confirm-layer {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(3, 20, 19, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  animation: fade 0.16s ease both;
}

.confirm-card {
  width: min(100%, 380px);
  background: var(--surface);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  animation: sheet-up 0.22s ease both;
}

.confirm-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--danger-soft);
  color: var(--danger);
  margin-bottom: 12px;
}

.confirm-card h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 780;
  letter-spacing: -0.025em;
}

.confirm-card p {
  margin: 7px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.confirm-card__error {
  margin-top: 10px;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.4;
}

.confirm-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.confirm-card__actions .btn {
  flex: 1;
}

/* ---------- загрузка / ошибка ---------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: calc(30px + max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px))) 22px
    calc(46px + var(--safe-bottom));
  color: var(--text);
  background:
    radial-gradient(700px 420px at 50% -8%, rgba(18, 138, 124, 0.14), transparent 62%),
    radial-gradient(560px 380px at 6% 104%, rgba(43, 100, 153, 0.08), transparent 60%),
    var(--bg);
  overflow: hidden;
  animation: boot-in 0.32s ease both;
}

html.theme-dark .boot {
  background:
    radial-gradient(700px 420px at 50% -8%, rgba(69, 201, 182, 0.13), transparent 62%),
    radial-gradient(560px 380px at 6% 104%, rgba(143, 192, 236, 0.07), transparent 60%),
    var(--bg);
}

.boot.is-leaving {
  opacity: 0;
  transform: scale(1.015);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.boot__inner {
  width: 100%;
  max-width: 372px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: rise 0.45s ease both;
}

/* приветствие вместо логотипа */
.boot__hello {
  margin: 0;
  font-size: clamp(19px, 5.6vw, 23px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--muted);
  text-wrap: balance;
}

/* маленький логотип в самом низу экрана */
.boot__brand {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(9px + var(--safe-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 0;
  padding: 0;
  opacity: 0.8;
}

.boot__mark {
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary-bright), var(--primary-deep));
  box-shadow: none;
}

html.theme-dark .boot__mark {
  color: var(--on-primary);
}

.boot__name {
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.015em;
  color: var(--faint);
}

.boot__today {
  margin-top: 10px;
}

/* день, число и месяц — одна строка, один шрифт и размер */
.boot__weekday,
.boot__date {
  display: inline;
  margin: 0;
  font-family: inherit;
  font-size: clamp(23px, 7.8vw, 31px);
  line-height: 1.2;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.035em;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.boot__weekday::after {
  content: ",";
}

/* приветствие, дата и координата — единая композиция по центру */
.boot__stage {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* аккуратная кардиограмма между датой и координатой */
.boot__pulse {
  width: min(136px, 36vw);
  margin-top: 24px;
  color: var(--primary);
  opacity: 0.55;
}

.boot__pulse svg {
  display: block;
  width: 100%;
  height: auto;
}

/* координата дня: точки-пары и промежутки между ними */

.boot__timeline {
  width: 100%;
  margin: 0;
  padding: 22px 0 0;
}

.boot__track {
  display: flex;
  align-items: center;
  width: 100%;
  height: 26px;
}

.boot__rail {
  flex: 1 1 0;
  min-width: 3px;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--border);
  overflow: hidden;
}

.boot__rail i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-bright), var(--primary));
  transform: scaleX(var(--fill, 0));
  transform-origin: left center;
  transition: transform 0.55s cubic-bezier(0.22, 0.8, 0.3, 1);
}

/* пока не знаем число пар — по координате бежит блик */
.boot__rail.is-ghost i {
  width: 38%;
  transform: none;
  background: linear-gradient(90deg, transparent, var(--primary-bright), transparent);
  animation: bootSweep 1.2s ease-in-out infinite;
}

.boot__dot {
  position: relative;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--border-strong);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease,
    transform 0.25s ease;
}

.boot__dot.is-on {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 14%, transparent);
}

.boot__dot.is-current {
  transform: scale(1.1);
}

.boot__dot.is-current::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: inherit;
  border: 2px solid color-mix(in srgb, var(--primary) 50%, transparent);
  animation: dot-pulse 1.5s ease-out infinite;
}

/* время начала и конца пар — под крайними кружками */
.boot__times {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 0 2px;
  min-height: 17px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.boot__times[hidden] {
  display: none;
}

/* одна пара: кружок по центру и общая подпись начала–конца */
.boot__track.is-single {
  justify-content: center;
}

.boot__times.is-single {
  justify-content: center;
}

/* поздравление, когда пар нет */
.boot__weekend {
  width: 100%;
  margin: 0;
  padding: 22px 4px 4px;
  animation: rise 0.35s ease both;
}

.boot__weekend[hidden] {
  display: none;
}

.boot__weekend-title {
  margin: 0;
  font-size: clamp(19px, 5.4vw, 23px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--primary);
  text-wrap: balance;
}

.boot__weekend-text {
  margin: 7px auto 0;
  max-width: 280px;
  font-size: 13.5px;
  line-height: 1.5;
  font-weight: 560;
  color: var(--muted);
  text-wrap: balance;
}

@keyframes bootSweep {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(300%);
  }
}

.boot__track.is-done .boot__dot.is-current::after {
  display: none;
}

.fatal {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  max-width: 430px;
  margin: 0 auto;
}

.fatal__icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 25px;
  font-weight: 800;
  margin-bottom: 14px;
}

.fatal h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.03em;
}

.fatal p {
  margin: 8px 0 18px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

.fatal__hint {
  margin-top: 14px;
  font-size: 10.5px;
  color: var(--faint);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 11px;
  line-height: 1.45;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* ---------- анимации ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(22px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.035);
  }
}

@keyframes boot-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes dot-pulse {
  0% {
    opacity: 0.85;
    transform: scale(0.72);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.25);
  }
}

/* ---------- Группа: лента ---------- */

.feed-group-select {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.feed-group-select label {
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--faint);
  flex: 0 0 auto;
}

.feed-group-select select {
  flex: 1;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 0 2px;
}

.feed-actions {
  display: flex;
  gap: 7px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.feed-actions::-webkit-scrollbar {
  display: none;
}

.feed-actions .btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  font-size: 11.5px;
  border-radius: 10px;
}

.feed-section {
  margin-top: 20px;
}

.feed-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
  margin-top: 9px;
}

.feed-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.feed-card__time {
  font-size: 10px;
  color: var(--faint);
  white-space: nowrap;
}

.feed-card__title {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.32;
  letter-spacing: -0.01em;
}

.feed-card__body {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.feed-card__meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
  font-size: 11px;
  color: var(--faint);
  line-height: 1.4;
}

.feed-card__foot {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--faint);
}

.feed-card__foot--action {
  display: flex;
  justify-content: flex-end;
}

.feed-card__position {
  font-size: 10px;
  font-weight: 750;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}

.feed-card--notice.is-important {
  border-color: color-mix(in srgb, var(--warning) 30%, transparent);
  background: color-mix(in srgb, var(--warning-soft) 45%, var(--surface));
}

.feed-card--queue {
  border-left: 3px solid var(--primary);
}

.feed-card--list {
  border-left: 3px solid var(--violet);
}

.feed-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--primary-soft);
  color: var(--primary);
  white-space: nowrap;
}

.feed-badge.is-important {
  background: var(--warning-soft);
  color: var(--warning);
}

.feed-badge.is-queue {
  background: var(--primary-soft);
  color: var(--primary);
}

.feed-badge.is-list {
  background: var(--violet-soft);
  color: var(--violet);
}

.feed-empty {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 13px;
  font-size: 11.5px;
  color: var(--faint);
}

.group-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.group-list__item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  font-size: 12px;
}

.group-list__item strong {
  font-weight: 650;
  line-height: 1.35;
}

.group-list__item p {
  margin: 3px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}

.group-list__item.is-done {
  opacity: 0.55;
}

.group-list__item.is-done strong {
  text-decoration: line-through;
}

.group-list__num {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 750;
}

.btn--small {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 11.5px;
  gap: 5px;
}

/* ---------- Заявки ---------- */

.segmented--small {
  margin-top: 12px;
}

.segmented--small button {
  padding: 7px 8px;
  font-size: 10.5px;
}

.request-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
  margin-top: 10px;
}

.request-card--pending {
  border-left: 3px solid var(--warning);
}

.request-card--approved {
  border-left: 3px solid var(--primary);
}

.request-card--rejected {
  border-left: 3px solid var(--danger);
}

.request-card--cancelled {
  opacity: 0.62;
}

.request-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.request-kind {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--violet-soft);
  color: var(--violet);
  white-space: nowrap;
}

.request-status {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 9.5px;
  font-weight: 750;
  background: var(--surface-3);
  color: var(--muted);
  white-space: nowrap;
}

.request-status--pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.request-status--approved {
  background: var(--primary-soft);
  color: var(--primary);
}

.request-status--rejected {
  background: var(--danger-soft);
  color: var(--danger);
}

.request-status--cancelled {
  background: var(--surface-3);
  color: var(--faint);
}

.request-card__title {
  margin: 8px 0 0;
  font-size: 13.5px;
  font-weight: 750;
  line-height: 1.32;
  letter-spacing: -0.01em;
}

.request-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 5px;
  font-size: 10.5px;
  color: var(--faint);
}

.request-details {
  margin-top: 9px;
  padding: 9px 10px;
  border-radius: 11px;
  background: var(--surface-2);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text);
  overflow-wrap: anywhere;
}

.request-comment {
  margin-top: 9px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-3);
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

.request-card__actions {
  display: flex;
  gap: 7px;
  margin-top: 11px;
}

.request-card__actions .btn {
  flex: 1;
}

.request-preview .request-card__meta {
  margin-top: 0;
}

/* ---------- Админ: сводка ---------- */

.stats--overview {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-section {
  margin-top: 20px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  font-size: 12px;
  cursor: pointer;
}

.check-row input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.person--inline {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.role-badge--junior_admin {
  background: var(--blue-soft);
  color: var(--blue);
}

.role-badge--senior_admin {
  background: var(--primary-soft);
  color: var(--primary);
}

@media (min-width: 620px) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .group-strip {
    flex-wrap: wrap;
    overflow: visible;
  }

  .group-chip {
    flex: 0 0 auto;
  }

  .toolbar {
    flex-direction: row;
    align-items: flex-end;
  }

  .searchbox {
    flex: 1.4;
  }

  .toolbar__row {
    flex: 1;
  }

  .view {
    padding-top: 10px;
  }

  .sheet {
    border-radius: 24px;
    margin-bottom: 26px;
  }

  .sheet-backdrop {
    align-items: center;
    padding: 20px;
  }

  .sheet__handle {
    display: none;
  }

  .sheet__head {
    padding-top: 18px;
  }
}

@media (max-width: 359px) {
  .entry {
    grid-template-columns: 53px minmax(0, 1fr) 24px;
    gap: 7px;
  }

  .entry__time {
    padding-left: 8px;
  }

  .brand__text small {
    max-width: 145px;
  }

  .hero {
    padding: 17px 16px 15px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .boot__weekday,
  .boot__date {
    font-size: 24px;
  }

  .boot__dot {
    width: 17px;
    height: 17px;
    margin: 0 2px;
    border-width: 2.5px;
  }

  .boot__rail {
    height: 6px;
  }

  .boot__times {
    font-size: 12.5px;
  }
}

@media (max-height: 680px) {
  .boot__pulse {
    margin-top: 18px;
  }

  .boot__timeline {
    padding-top: 16px;
  }
}

@media (max-height: 560px) {
  .boot__hello {
    font-size: 18px;
  }

  .boot__today {
    margin-top: 4px;
  }

  .boot__weekday,
  .boot__date {
    font-size: 20px;
  }

  .boot__pulse {
    width: 104px;
    margin-top: 12px;
  }

  .boot__timeline {
    padding-top: 6px;
  }

  .boot__weekend {
    padding-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   Главный экран: выбранный день, чётность и текущая пара
   ========================================================= */

.day-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 18px 18px 15px;
  color: #f2fffc;
  background:
    radial-gradient(190px 150px at 94% 8%, rgba(255, 255, 255, 0.16), transparent 70%),
    linear-gradient(135deg, #0a5c54 0%, #0c7c6f 58%, #149487 100%);
  box-shadow: 0 18px 38px rgba(7, 77, 69, 0.22);
  animation: rise 0.4s ease both;
}

.day-hero::after {
  content: "";
  position: absolute;
  right: -52px;
  bottom: -84px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 0 26px rgba(255, 255, 255, 0.03),
    0 0 0 54px rgba(255, 255, 255, 0.022);
  pointer-events: none;
}

.day-hero__row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.day-hero__titles {
  min-width: 0;
}

.day-hero__kicker {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(240, 255, 251, 0.74);
}

.day-hero__dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.day-hero__title {
  margin: 5px 0 0;
  font-size: clamp(27px, 7.5vw, 34px);
  line-height: 1.04;
  font-weight: 780;
  letter-spacing: -0.035em;
}

.day-hero__date {
  margin: 5px 0 0;
  font-size: 12.5px;
  color: rgba(237, 255, 251, 0.78);
}

.day-hero__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
  padding-top: 2px;
}

.day-hero__count {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
  white-space: nowrap;
}

.day-hero__range {
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: rgba(240, 255, 251, 0.72);
  white-space: nowrap;
}

/* ---------- полоса дня ---------- */

.day-progress {
  position: relative;
  z-index: 1;
  margin-top: 15px;
}

.day-progress__labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: rgba(240, 255, 251, 0.7);
}

.day-progress__now {
  font-weight: 750;
  font-size: 11px;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.day-progress__track {
  position: relative;
  height: 7px;
  margin-top: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.day-progress__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #9ff2e5, #ffffff);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.45);
  transition: width 0.6s ease;
}

.day-progress__knob {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.22);
  transition: left 0.6s ease;
}

.day-progress.is-empty .day-progress__fill,
.day-progress.is-empty .day-progress__knob {
  display: none;
}

.day-progress.is-idle .day-progress__knob {
  display: none;
}

/* ---------- миниатюра дня при скролле ---------- */

.day-mini {
  position: fixed;
  left: 50%;
  top: calc(var(--header-h, 56px) + 2px);
  transform: translate(-50%, -14px);
  z-index: 26;
  width: min(calc(100vw - 32px), 688px);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 15px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(7, 43, 39, 0.18);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.day-mini.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.day-mini:active {
  transform: translate(-50%, 0) scale(0.99);
}

.day-mini__dow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--primary);
}

.day-mini__date {
  font-size: 11.5px;
  color: var(--muted);
}

.day-mini__now {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--live);
}

.day-mini__bar {
  position: absolute;
  left: 15px;
  right: 15px;
  bottom: 5px;
  height: 2px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}

.day-mini__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--live);
  transition: width 0.6s ease;
}

/* ---------- дни недели как группы ---------- */

.day-strip {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 14px 1px 5px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.day-strip::-webkit-scrollbar {
  display: none;
}

.day-chip {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  scroll-snap-align: center;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.day-chip:active {
  transform: scale(0.95);
}

.day-chip__dow {
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.day-chip__num {
  font-size: 18px;
  font-weight: 780;
  letter-spacing: -0.03em;
  line-height: 1;
}

.day-chip__dot {
  position: absolute;
  bottom: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--faint);
  opacity: 0.7;
}

.day-chip:not(.has-dot) .day-chip__dot {
  display: none;
}

.day-chip.is-today {
  box-shadow: inset 0 0 0 1.5px var(--primary), var(--shadow-sm);
  color: var(--primary);
}

.day-chip.is-active {
  color: var(--on-primary);
  border-color: transparent;
  background: linear-gradient(145deg, var(--primary-bright), var(--primary));
  box-shadow: 0 8px 18px rgba(11, 107, 97, 0.24);
}

.day-chip.is-active .day-chip__dot {
  background: var(--on-primary);
}

.day-chip.is-live .day-chip__dot {
  background: var(--live);
  opacity: 1;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 24%, transparent);
  animation: livePulse 1.8s ease-in-out infinite;
}

/* ---------- список пар выбранного дня ---------- */

.day-panel {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 10px;
  animation: rise 0.3s ease both;
}

.day-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.day-empty__icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--surface-3);
  color: var(--primary);
}

.day-empty__text strong {
  display: block;
  font-size: 14px;
  color: var(--text);
}

.day-empty__text p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--faint);
}

.day-empty__add {
  margin-left: auto;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}

/* ---------- текущая пара ---------- */

.entry.is-live {
  border-color: var(--live-line);
  background: linear-gradient(100deg, var(--live-soft), var(--surface-2) 72%);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--live) 16%, transparent);
}

.entry.is-live::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--live);
}

.entry.is-past {
  opacity: 0.62;
}

.entry__live-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 19px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--on-live);
  background: var(--live);
}

.entry__livebar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 10px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--live);
  color: var(--on-live);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.entry__livedot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: currentColor;
  animation: livePulse 1.4s ease-in-out infinite;
}

.entry__live-text {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 9.5px;
  opacity: 0.85;
}

.entry__countdown {
  margin-left: auto;
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

@keyframes livePulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.82);
  }
}

/* ---------- лента группы внутри вкладки ---------- */

.feed-block {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.feed-block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 0 2px;
}

.feed-block__head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 780;
  letter-spacing: 0.02em;
}

.feed-block__head span {
  font-size: 11px;
  color: var(--faint);
  text-align: right;
}

@media (max-width: 400px) {
  .feed-block__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .feed-block__head span {
    text-align: left;
  }
}

/* ------------------------------------------------------------------
   Вкладка «Неделя»: таблица дни × пары
   ------------------------------------------------------------------ */

.wgrid__switch {
  display: flex;
  gap: 8px;
  margin: 2px 0 12px;
  padding: 4px;
  border-radius: 14px;
  background: var(--bg-deep);
}

.wgrid__btn {
  flex: 1;
  padding: 9px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.wgrid__btn.is-active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Горизонтальная прокрутка: 7 колонок не влезают на узкий экран. */
.wgrid__scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.wgrid {
  width: 100%;
  min-width: 560px;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font);
}

.wgrid__corner,
.wgrid__th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 4px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  text-align: center;
  font-weight: 600;
}

.wgrid__corner {
  left: 0;
  z-index: 3;
  width: 54px;
  min-width: 54px;
}

.wgrid__th.is-today {
  background: var(--primary-soft);
}

.wgrid__dow {
  display: block;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.wgrid__th.is-today .wgrid__dow {
  color: var(--primary);
}

.wgrid__date {
  display: block;
  margin-top: 1px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.wgrid__time {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 54px;
  min-width: 54px;
  padding: 6px 4px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
  font-weight: 500;
}

.wgrid__num {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

.wgrid__td {
  padding: 3px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-width: 68px;
}

.wgrid__td:last-child {
  border-right: 0;
}

.wgrid__td.is-today {
  background: color-mix(in srgb, var(--primary-soft) 55%, transparent);
}

.wgrid__entry {
  display: block;
  width: 100%;
  margin-bottom: 3px;
  padding: 5px 6px;
  border: 0;
  border-left: 3px solid var(--primary);
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--text);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.wgrid__entry:last-child {
  margin-bottom: 0;
}

.wgrid__entry.is-lecture {
  border-left-color: var(--violet);
  background: var(--violet-soft);
}

.wgrid__entry:active {
  transform: scale(0.97);
  filter: brightness(0.97);
}

.wgrid__subject {
  display: block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.22;
  color: var(--text);
  word-break: break-word;
}

/* Время пары живёт на самой карточке, а не в колонке слева. */
.wgrid__span {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--primary);
  white-space: nowrap;
}

.wgrid__entry.is-lecture .wgrid__span {
  color: var(--violet);
}

.wgrid__type {
  display: block;
  margin-top: 1px;
  font-size: 8.5px;
  line-height: 1.2;
  color: var(--muted);
}

.wgrid__scope {
  display: inline-block;
  margin-top: 1px;
  font-size: 8px;
  color: var(--warning);
}

.wgrid__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  padding: 0 2px;
  font-size: 10.5px;
  color: var(--muted);
}

.wgrid__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.wgrid__dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--primary);
}

.wgrid__dot.is-lecture {
  background: var(--violet);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}



