/* ==========================================================================
   Geron — стили учебного портала
   ========================================================================== */

:root {
  --bg: #f4f7f3;
  --surface: #ffffff;
  --surface-2: #fafbf8;
  --ink: #0e1712;
  --ink-soft: #26332c;
  --muted: #64716a;
  --line: #e3e8de;
  --line-strong: #d3dacd;
  --green: #12a05c;
  --green-dark: #0b7b46;
  --green-soft: #e6f5ec;
  --coral: #ff6a55;
  --coral-dark: #d94a36;
  --coral-soft: #ffedea;
  --blue: #3d6bff;
  --blue-dark: #234dd6;
  --blue-soft: #ebf0ff;
  --yellow: #f5b32b;
  --yellow-dark: #946200;
  --yellow-soft: #fff4dc;
  --purple: #8a5cf6;
  --purple-dark: #6a3fd6;
  --purple-soft: #f1ecff;
  --red: #e03e3e;
  --red-soft: #fdecec;

  --radius: 22px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(16, 23, 18, 0.04), 0 8px 24px rgba(16, 23, 18, 0.05);
  --shadow-md: 0 24px 48px -24px rgba(16, 23, 18, 0.3);
  --font-head: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --sidebar-w: 264px;
  --topbar-h: 68px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body.no-scroll {
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 800;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

svg {
  display: block;
}

:focus-visible {
  outline: 3px solid rgba(18, 160, 92, 0.35);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -100px;
  z-index: 200;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
}

/* ------------------------------ Каркас --------------------------------- */

.portal {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 6px;
}

.sidebar__brand img {
  width: 42px;
  height: 34px;
  object-fit: contain;
}

.sidebar__brand b {
  font-family: var(--font-head);
  font-size: 22px;
  letter-spacing: -0.03em;
  line-height: 1;
  display: block;
}

.sidebar__brand small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(150deg, var(--green-soft), #f3fbf6 70%);
  border: 1px solid #d9efe1;
}

.sidebar__user-meta {
  min-width: 0;
}

.sidebar__user-meta b {
  display: block;
  font-size: 14px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__user-meta span {
  font-size: 12px;
  color: var(--green-dark);
  font-weight: 600;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 14.5px;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}

.nav-link .icon {
  color: var(--muted);
  flex: none;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav-link.is-active {
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 700;
}

.nav-link.is-active .icon {
  color: var(--green-dark);
}

.nav-badge {
  margin-left: auto;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar__foot {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar__foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 8px;
  border-radius: 9px;
  background: none;
  border: 0;
}

.sidebar__link:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.lang-switch a,
.lang-switch button {
  border: 0;
  background: none;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.lang-switch .is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(16, 23, 18, 0.12);
}

.portal__content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 18px;
}

.topbar__brand img {
  width: 34px;
  height: 27px;
  object-fit: contain;
}

.topbar__spacer {
  flex: 1;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  transition: background 0.15s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
}

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(10, 20, 14, 0.4);
  backdrop-filter: blur(2px);
}

.main {
  flex: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 30px 34px 60px;
}

/* ------------------------------ Шапка страницы ------------------------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head h1 {
  font-size: clamp(24px, 2.4vw, 32px);
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--green-dark);
  margin-bottom: 6px;
}

.page-lead {
  color: var(--muted);
  margin-top: 7px;
  max-width: 65ch;
  font-size: 14.5px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.back-link:hover {
  color: var(--green-dark);
}

/* ------------------------------ Сетки ---------------------------------- */

.grid {
  display: grid;
  gap: 18px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-sidebar {
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  align-items: start;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.spacer {
  flex: 1;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

/* ------------------------------ Карточки ------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  min-width: 0;
}

.card--flush {
  padding: 0;
  overflow: hidden;
}

.card--soft {
  background: var(--surface-2);
  box-shadow: none;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.card__head h2,
.card__head h3 {
  font-size: 17px;
}

.card__head p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.card__link {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-dark);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.card__link:hover {
  text-decoration: underline;
}

.card__pad {
  padding: 20px 22px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, #0d3b24 0%, #0f5733 48%, #12a05c 100%);
  color: #fff;
  border: 0;
}

.hero-card h1,
.hero-card h2 {
  color: #fff;
}

.hero-card p {
  color: rgba(255, 255, 255, 0.78);
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -90px;
  top: -110px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 65%);
  pointer-events: none;
}

.hero-card .btn--light {
  position: relative;
  z-index: 1;
}

/* ------------------------------ Статистика ----------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 17px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat__label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}

.stat__value {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat__hint {
  font-size: 12px;
  color: var(--muted);
}

.stat--green .stat__label .icon {
  color: var(--green-dark);
}

.stat--yellow .stat__label .icon {
  color: var(--yellow-dark);
}

.stat--blue .stat__label .icon {
  color: var(--blue-dark);
}

.stat--coral .stat__label .icon {
  color: var(--coral-dark);
}

.stat--purple .stat__label .icon {
  color: var(--purple-dark);
}

/* ------------------------------ Кнопки --------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 17px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.btn--primary:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.btn--dark {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.btn--dark:hover {
  background: #1f2d25;
}

.btn--soft {
  background: var(--green-soft);
  color: var(--green-dark);
  border-color: transparent;
}

.btn--soft:hover {
  background: #d8efe2;
}

.btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

.btn--ghost:hover {
  background: var(--surface-2);
}

.btn--danger {
  background: var(--red-soft);
  color: #a82626;
  border-color: transparent;
}

.btn--danger:hover {
  background: #fbdcdc;
}

.btn--light {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.btn--light:hover {
  background: rgba(255, 255, 255, 0.24);
}

.btn--white {
  background: #fff;
  color: var(--green-dark);
  border-color: #fff;
}

.btn--sm {
  padding: 7px 11px;
  font-size: 12.5px;
  border-radius: 9px;
}

.btn--block {
  width: 100%;
}

.btn[disabled],
.btn.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.link {
  color: var(--green-dark);
  font-weight: 600;
}

.link:hover {
  text-decoration: underline;
}

/* ------------------------------ Бейджи --------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.badge--green {
  background: var(--green-soft);
  color: var(--green-dark);
}

.badge--yellow {
  background: var(--yellow-soft);
  color: var(--yellow-dark);
}

.badge--coral,
.badge--red {
  background: var(--coral-soft);
  color: var(--coral-dark);
}

.badge--blue {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.badge--violet {
  background: var(--purple-soft);
  color: var(--purple-dark);
}

.badge--gray {
  background: #eef1ec;
  color: var(--muted);
}

.badge--outline {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* ------------------------------ Аватары -------------------------------- */

.avatar {
  --av-bg: var(--green-soft);
  --av-fg: var(--green-dark);
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--av-bg);
  color: var(--av-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.01em;
  flex: none;
  overflow: hidden;
}

.avatar--sm {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  font-size: 11px;
}

.avatar--lg {
  width: 56px;
  height: 56px;
  border-radius: 17px;
  font-size: 19px;
}

.avatar--yellow {
  --av-bg: var(--yellow-soft);
  --av-fg: var(--yellow-dark);
}

.avatar--coral {
  --av-bg: var(--coral-soft);
  --av-fg: var(--coral-dark);
}

.avatar--blue {
  --av-bg: var(--blue-soft);
  --av-fg: var(--blue-dark);
}

.avatar--violet {
  --av-bg: var(--purple-soft);
  --av-fg: var(--purple-dark);
}

/* ------------------------------ Таблицы -------------------------------- */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
}

table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

table.data tbody tr:last-child td {
  border-bottom: 0;
}

table.data tbody tr:hover {
  background: #fbfcf9;
}

table.data .num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.data .actions {
  text-align: right;
  white-space: nowrap;
}

table.data .actions form {
  display: inline;
}

.cell-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cell-user__meta {
  min-width: 0;
}

.cell-user__meta b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-user__meta span {
  font-size: 12px;
  color: var(--muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------ Формы ---------------------------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label,
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.field .req {
  color: var(--coral-dark);
}

.input,
select.input,
textarea.input {
  width: 100%;
  padding: 10px 13px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 42px;
}

textarea.input {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

.input:hover {
  border-color: #bcc7b7;
}

.input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(18, 160, 92, 0.14);
  outline: none;
}

.input::placeholder {
  color: #9aa69f;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.hint--warning {
  color: var(--yellow-dark);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  max-height: 230px;
  overflow-y: auto;
  padding: 3px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
}

.check:hover {
  background: var(--surface-2);
}

.check input {
  accent-color: var(--green);
  width: 16px;
  height: 16px;
  flex: none;
}

.search-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.search-form .input {
  min-height: 38px;
  padding: 7px 12px;
  font-size: 13px;
}

.input--search {
  min-width: 220px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-bar form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ------------------------------ Flash / alerts ------------------------- */

.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
}

.flash .icon {
  flex: none;
  margin-top: 1px;
}

.flash--success {
  background: var(--green-soft);
  color: var(--green-dark);
  border-color: #c8e9d5;
}

.flash--error {
  background: var(--red-soft);
  color: #a82626;
  border-color: #f6cdcd;
}

.flash--warning {
  background: var(--yellow-soft);
  color: var(--yellow-dark);
  border-color: #f3dfad;
}

.flash--info {
  background: var(--blue-soft);
  color: var(--blue-dark);
  border-color: #d3ddfc;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 13.5px;
  line-height: 1.5;
}

.notice--green {
  background: var(--green-soft);
  color: var(--green-dark);
}

.notice--yellow {
  background: var(--yellow-soft);
  color: var(--yellow-dark);
}

.notice--gray {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}

/* ------------------------------ Пустые состояния ----------------------- */

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty .icon {
  color: #b8c3bb;
}

.empty b {
  color: var(--ink-soft);
  font-size: 15px;
}

.empty p {
  font-size: 13px;
  max-width: 46ch;
}

/* ------------------------------ Списки --------------------------------- */

.list {
  display: flex;
  flex-direction: column;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.list-item:last-child {
  border-bottom: 0;
}

.list-item__body {
  flex: 1;
  min-width: 0;
}

.list-item__body b {
  font-size: 14px;
  font-weight: 600;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item__body span {
  font-size: 12.5px;
  color: var(--muted);
  display: block;
}

.list-item__side {
  text-align: right;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.list-item--link:hover {
  background: var(--surface-2);
}

.list-item--link {
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 9px;
}

/* ------------------------------ Расписание ----------------------------- */

.week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.day {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 150px;
  min-width: 0;
}

.day.is-today {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(18, 160, 92, 0.1);
}

.day__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 9px;
}

.day__name {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.day__date {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.day.is-today .day__name,
.day.is-today .day__date {
  color: var(--green-dark);
}

.lesson-chip {
  display: block;
  border-radius: 10px;
  padding: 8px 9px;
  margin-bottom: 7px;
  background: var(--surface-2);
  border-left: 3px solid var(--green);
  min-width: 0;
}

.lesson-chip:last-child {
  margin-bottom: 0;
}

.lesson-chip b {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-chip span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-chip--yellow {
  border-left-color: var(--yellow);
}

.lesson-chip--coral {
  border-left-color: var(--coral);
}

.lesson-chip--blue {
  border-left-color: var(--blue);
}

.lesson-chip--violet {
  border-left-color: var(--purple);
}

.lesson-chip:hover {
  background: var(--green-soft);
}

.day__empty {
  font-size: 11.5px;
  color: #a4afa8;
  padding: 6px 0;
}

/* ------------------------------ Журнал --------------------------------- */

.journal-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
}

table.journal {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 13px;
}

table.journal th,
table.journal td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 8px 10px;
  text-align: center;
  min-width: 78px;
}

table.journal th:last-child,
table.journal td:last-child {
  border-right: 0;
}

table.journal thead th {
  background: var(--surface-2);
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  vertical-align: bottom;
}

table.journal thead th a {
  display: block;
  color: var(--ink-soft);
}

table.journal thead th a:hover {
  color: var(--green-dark);
}

table.journal th.sticky,
table.journal td.sticky {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  text-align: left;
  min-width: 190px;
  border-right: 1px solid var(--line-strong);
}

table.journal thead th.sticky {
  background: var(--surface-2);
  z-index: 3;
}

.journal-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.25;
}

.journal-grade {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 15px;
}

.grade-0,
.grade-1,
.grade-2,
.grade-3,
.grade-4,
.grade-5,
.grade-6,
.grade-7,
.grade-8,
.grade-9 {
  color: var(--coral-dark);
}

.grade-10,
.grade-11,
.grade-12,
.grade-13,
.grade-14,
.grade-15,
.grade-16,
.grade-17 {
  color: var(--yellow-dark);
}

.grade-18,
.grade-19,
.grade-20,
.grade-21,
.grade-22,
.grade-23,
.grade-24 {
  color: var(--blue-dark);
}

.grade-25,
.grade-26,
.grade-27,
.grade-28,
.grade-29,
.grade-30 {
  color: var(--green-dark);
}

.journal-att {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.att-present {
  color: var(--green-dark);
}

.att-absent {
  color: var(--coral-dark);
}

.att-late {
  color: var(--yellow-dark);
}

.att-excused {
  color: var(--blue-dark);
}

/* ------------------------------ Задания / файлы ------------------------ */

.hw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.hw-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hw-card:hover {
  border-color: #c6d8cc;
  box-shadow: var(--shadow-sm);
}

.hw-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.hw-card h3 {
  font-size: 15.5px;
  line-height: 1.3;
}

.hw-card h3 a:hover {
  color: var(--green-dark);
}

.hw-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--muted);
}

.hw-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hw-card__foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.files {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  min-width: 0;
}

.file-row .icon {
  color: var(--muted);
  flex: none;
}

.file-row__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.file-row__size {
  color: var(--muted);
  font-size: 11.5px;
  flex: none;
}

.file-row form {
  display: flex;
}

.file-input {
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  padding: 14px;
  background: var(--surface-2);
  font-size: 13px;
  width: 100%;
}

.file-input::file-selector-button {
  border: 0;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 8px;
  margin-right: 10px;
  cursor: pointer;
}

/* ------------------------------ Кошелёк -------------------------------- */

.balance-card {
  background: linear-gradient(135deg, #0d3b24, #12663b 55%, #12a05c);
  color: #fff;
  border: 0;
  position: relative;
  overflow: hidden;
}

.balance-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  right: -70px;
  bottom: -100px;
}

.balance-card__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
}

.balance-card__value {
  font-family: var(--font-head);
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 6px 0 2px;
}

.balance-card__note {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.7);
  position: relative;
  z-index: 1;
}

.coin-amount {
  font-family: var(--font-head);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.coin-plus {
  color: var(--green-dark);
}

.coin-minus {
  color: var(--coral-dark);
}

/* ------------------------------ Сообщения ------------------------------ */

.messages-layout {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.thread-list {
  display: flex;
  flex-direction: column;
}

.thread-item {
  display: block;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s ease;
}

.thread-item:last-child {
  border-bottom: 0;
}

.thread-item:hover {
  background: var(--surface-2);
}

.thread-item.is-active {
  background: var(--green-soft);
  border-left: 3px solid var(--green);
}

.thread-item__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.thread-item__top b {
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-item__top span {
  font-size: 11px;
  color: var(--muted);
  flex: none;
}

.thread-item p {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-item__foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.chat {
  display: flex;
  flex-direction: column;
  height: min(68vh, 640px);
  min-height: 380px;
}

.chat__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.chat__body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface-2);
}

.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px 14px 14px 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.bubble--mine {
  align-self: flex-end;
  border-radius: 14px 14px 4px 14px;
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.bubble__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.bubble--mine .bubble__meta {
  color: rgba(255, 255, 255, 0.72);
}

.bubble p {
  white-space: pre-line;
}

.chat__form {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 9px;
  align-items: flex-end;
  background: var(--surface);
}

.chat__form textarea {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  resize: vertical;
}

.chat__closed {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  background: var(--surface-2);
  text-align: center;
}

/* ------------------------------ Профиль -------------------------------- */

.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.profile-head h1 {
  font-size: 26px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
}

.meta-item {
  min-width: 0;
}

.meta-item__label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 3px;
}

.meta-item__value {
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* ------------------------------ Табы / чипы ---------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px;
  background: #e9eee6;
  border-radius: 12px;
}

.tabs a {
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.tabs a:hover {
  color: var(--ink);
}

.tabs a.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(16, 23, 18, 0.12);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.chip .icon {
  color: var(--muted);
}

/* ------------------------------ Прогресс ------------------------------- */

.progress {
  height: 7px;
  border-radius: 999px;
  background: #e9eee6;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #4cc383);
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: 90px;
}

.bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  height: 100%;
  min-width: 0;
}

.bar__col {
  width: 100%;
  max-width: 34px;
  border-radius: 6px 6px 3px 3px;
  background: var(--green-soft);
  border: 1px solid #cae8d6;
}

.bar__col.is-filled {
  background: linear-gradient(180deg, #45c184, var(--green));
  border-color: var(--green);
}

.bar__label {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 700;
}

/* 31 столбик (шкала 0–30): на узких экранах подписываем только кратные 5 */
@media (max-width: 640px) {
  .bars {
    gap: 2px;
  }

  .bar__label {
    font-size: 8.5px;
  }

  .bar__label:not(.bar__label--major) {
    visibility: hidden;
  }
}

/* ------------------------------ Авторизация ---------------------------- */

.auth-body {
  background: var(--bg);
}

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}

.auth__visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 38px 44px;
  color: #fff;
  background:
    linear-gradient(150deg, rgba(6, 30, 19, 0.82), rgba(6, 44, 25, 0.65) 55%, rgba(18, 160, 92, 0.5)),
    url("/assets/img/class-1.webp") center/cover no-repeat;
  overflow: hidden;
}

.auth__visual::after {
  content: "";
  position: absolute;
  inset: auto -120px -160px auto;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14), transparent 62%);
}

.auth__brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 23px;
  letter-spacing: -0.03em;
  position: relative;
  z-index: 1;
}

.auth__brand img {
  width: 46px;
  height: 37px;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  padding: 4px;
}

.auth__brand small {
  display: block;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.65);
}

.auth__visual-body {
  position: relative;
  z-index: 1;
  max-width: 470px;
  margin: 40px 0;
}

.auth__visual-body h2 {
  font-size: clamp(28px, 3.2vw, 42px);
  letter-spacing: -0.035em;
  margin-bottom: 14px;
}

.auth__visual-body p {
  color: rgba(255, 255, 255, 0.75);
  font-size: 16px;
  max-width: 42ch;
}

.auth__points {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.auth__point {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.86);
}

.auth__point .icon {
  color: #7ee2ab;
}

.auth__visual-foot {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.55);
  position: relative;
  z-index: 1;
}

.auth__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth__form {
  width: 100%;
  max-width: 420px;
}

.auth__form h1 {
  font-size: 30px;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.auth__form .page-lead {
  margin-bottom: 24px;
}

.auth__form .field {
  margin-bottom: 14px;
}

.auth__form .form-actions {
  border: 0;
  padding: 0;
  margin-top: 22px;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.auth__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
}

.auth__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 28px;
}

.auth__demo {
  margin-top: 26px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--surface-2);
}

.auth__demo b {
  font-size: 12.5px;
  display: block;
  margin-bottom: 7px;
}

.auth__demo-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.auth__demo-list span {
  color: var(--ink-soft);
}

.auth__demo-button {
  margin-top: 9px;
  border: 0;
  background: none;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 0;
}

/* ------------------------------ Страница ошибки ------------------------ */

.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.error-page__inner {
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.error-page__code {
  font-family: var(--font-head);
  font-size: 88px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--green);
}

.error-page h1 {
  font-size: 26px;
}

.error-page p {
  color: var(--muted);
}

/* ------------------------------ Печать --------------------------------- */

.print-only {
  display: none;
}

@media print {
  .sidebar,
  .topbar,
  .page-actions,
  .flash,
  .no-print {
    display: none !important;
  }

  .portal__content {
    margin-left: 0;
  }

  .main {
    padding: 0;
    max-width: none;
  }

  .card {
    box-shadow: none;
    border-color: #bbb;
  }

  .print-only {
    display: block;
  }

  body {
    background: #fff;
    font-size: 12px;
  }
}

/* ------------------------------ Адаптив -------------------------------- */

@media (max-width: 1180px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-sidebar {
    grid-template-columns: minmax(0, 1fr);
  }

  .week {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-104%);
    transition: transform 0.24s ease;
    box-shadow: var(--shadow-md);
    width: min(310px, 86vw);
    border-right: 0;
  }

  body.sidebar-open .sidebar {
    transform: none;
  }

  body.sidebar-open .sidebar-scrim {
    display: block;
  }

  .portal__content {
    margin-left: 0;
  }

  .topbar {
    display: flex;
  }

  .main {
    padding: 22px 20px 50px;
  }

  .auth {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth__visual {
    display: none;
  }

  .auth__panel {
    min-height: 100vh;
  }
}

@media (max-width: 860px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .week {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .messages-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat {
    height: 62vh;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14.5px;
  }

  .main {
    padding: 18px 14px 44px;
  }

  .card {
    padding: 17px;
    border-radius: 18px;
  }

  .page-head {
    gap: 12px;
    margin-bottom: 17px;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat {
    padding: 13px;
  }

  .stat__value {
    font-size: 22px;
  }

  .week {
    grid-template-columns: minmax(0, 1fr);
  }

  .day {
    min-height: 0;
  }

  .grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar {
    padding: 0 12px;
  }

  .auth__panel {
    padding: 28px 18px;
  }

  .auth__form h1 {
    font-size: 26px;
  }

  .bubble {
    max-width: 92%;
  }

  .hw-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .balance-card__value {
    font-size: 34px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* -------------------------------- Магазин -------------------------------- */

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.product-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.product-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-soft), #eef6ef);
}

.product-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-card__placeholder {
  color: var(--green-dark);
  opacity: 0.45;
}

.product-card__price {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--yellow-dark);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(20, 40, 25, 0.12);
}

.product-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  padding: 14px 16px 16px;
}

.product-card__title {
  font-size: 15px;
  line-height: 1.35;
}

.product-card__text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__stock {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.product-card__foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
}

.product-card__foot form {
  margin: 0;
}

.shop-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.shop-cell__meta {
  min-width: 0;
}

.shop-cell__meta b {
  display: block;
}

.shop-cell__meta span {
  display: block;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.shop-thumb {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: cover;
}

.shop-thumb--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--bg);
}

.shop-image-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 14px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.shop-image-preview img {
  width: 76px;
  height: 76px;
  border-radius: 10px;
  object-fit: cover;
}

@media (max-width: 520px) {
  .shop-grid {
    grid-template-columns: 1fr;
  }

  .shop-cell__meta span {
    max-width: 150px;
  }
}

/* ------------------------- Приложение на телефоне ------------------------- */

@supports (padding: env(safe-area-inset-top)) {
  .topbar {
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }

  .sidebar {
    padding-top: calc(22px + env(safe-area-inset-top));
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .main {
    padding-bottom: calc(50px + env(safe-area-inset-bottom));
  }

  .auth__panel {
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }
}

.btn,
.icon-btn,
.nav-link,
.sidebar__link,
.lang-switch a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body.has-pwa-banner .main {
  padding-bottom: calc(132px + env(safe-area-inset-bottom, 0px));
}

@media (display-mode: standalone) {
  .portal {
    min-height: 100dvh;
  }

  .auth__panel {
    min-height: 100dvh;
  }

  body {
    overscroll-behavior-y: contain;
  }
}

/* Плашка «Установить приложение» */

.pwa-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: #0e1712;
  color: #fff;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.55);
  animation: pwa-rise 0.28s ease;
}

.pwa-banner__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pwa-banner__text b {
  font-family: var(--font-head);
  font-size: 14px;
  line-height: 1.25;
}

.pwa-banner__text span {
  font-size: 12px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.72);
}

.pwa-banner__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.pwa-banner .btn--ghost {
  background: rgba(255, 255, 255, 0.12);
  border-color: transparent;
  color: #fff;
}

.pwa-banner .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.2);
}

.pwa-banner .btn--primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

@media (max-width: 520px) {
  .pwa-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .pwa-banner__actions {
    justify-content: flex-end;
  }
}

/* Тост «Доступна новая версия» */

.pwa-update {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 130;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 16px;
  border-radius: 999px;
  background: #0e1712;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.55);
  animation: pwa-rise 0.28s ease;
  max-width: calc(100vw - 24px);
}

.pwa-update .btn--primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.pwa-update__close {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 20px;
  line-height: 1;
  padding: 0 4px;
}

.pwa-update__close:hover {
  color: #fff;
}

@media (max-width: 520px) {
  .pwa-update {
    left: 12px;
    right: 12px;
    transform: none;
    border-radius: 16px;
    flex-wrap: wrap;
  }
}

@keyframes pwa-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Печать: матрица модулей, карточки и сводка
   ========================================================================== */

.th-hint {
  display: block;
  font-weight: 400;
  font-size: 10.5px;
  color: var(--muted);
}

.typing-matrix th,
.typing-matrix td {
  text-align: center;
  white-space: nowrap;
}

.typing-matrix__name {
  text-align: left !important;
  min-width: 190px;
}

.typing-matrix__no {
  display: block;
  font-weight: 700;
}

.typing-matrix__dates {
  display: block;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--muted);
}

.typing-matrix__year {
  background: var(--green-soft);
}

.typing-matrix tfoot td {
  border-top: 2px solid var(--line);
  background: #fafbfa;
}

.typing-cell {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.typing-cell__speed {
  font-weight: 700;
  color: var(--ink);
}

.typing-cell__errors {
  font-size: 12px;
  color: var(--muted);
}

.typing-cell.is-empty {
  opacity: 0.5;
}

.typing-cell--year {
  background: var(--green-soft);
}

.typing-modules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.typing-module {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.typing-module__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.typing-module__head b {
  display: block;
  font-size: 15px;
}

.typing-module__head .hint {
  display: block;
  font-size: 11.5px;
}

.typing-module__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.typing-module__stats > div {
  background: #f6f7f6;
  border-radius: 12px;
  padding: 9px 11px;
}

.typing-module__stats span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}

.typing-module__stats b {
  display: block;
  font-size: 19px;
  line-height: 1.2;
}

.typing-module__stats small {
  font-size: 10.5px;
  color: var(--muted);
}

.typing-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.typing-summary--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 10px;
}

.typing-summary__item {
  background: #f6f7f6;
  border-radius: 13px;
  padding: 11px 13px;
}

.typing-summary__item span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}

.typing-summary__item b {
  display: block;
  font-size: 22px;
  line-height: 1.15;
}

.typing-summary__item small {
  font-size: 10.5px;
  color: var(--muted);
}

.typing-group {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.typing-group__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.typing-group__head > div {
  flex: 1;
}

.typing-group__head b {
  display: block;
  font-size: 14.5px;
}

.typing-group__head .hint {
  display: block;
  font-size: 11.5px;
}

.typing-module-table td,
.typing-module-table th {
  font-size: 12.5px;
}

.typing-recent {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.typing-recent__item {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 10px;
  background: #f6f7f6;
  font-size: 12.5px;
}

.typing-recent__date {
  color: var(--muted);
}

.typing-recent__name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.typing-recent__speed {
  font-weight: 700;
}

.typing-recent__errors {
  color: var(--coral-dark);
}

.typing-recent small {
  color: var(--muted);
  font-weight: 400;
}

@media (max-width: 640px) {
  .typing-summary,
  .typing-summary--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .typing-recent__item {
    grid-template-columns: 76px minmax(0, 1fr) auto;
  }

  .typing-recent__name {
    display: none;
  }
}

/* --------------------- Приложение Geron в профиле ----------------------- */

.install-app {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.install-app[hidden] {
  display: none;
}

.install-app__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--green-soft);
  color: var(--green-dark);
}

.install-app__body {
  flex: 1 1 260px;
  min-width: 0;
}

.install-app__body h2 {
  font-size: 17px;
}

.install-app__body p {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 4px;
}

.install-app__body .install-app__hint {
  color: var(--ink-soft);
  font-size: 12.5px;
}

.install-app__action {
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  .install-app {
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
  }

  .install-app__body {
    flex-basis: calc(100% - 70px);
  }

  .install-app__action {
    width: 100%;
    justify-content: center;
  }
}

@media (display-mode: standalone) {
  .install-app {
    display: none;
  }
}
