/* =========================================================================
   Trena — Components extras (P1: Data Table, Tabs, Modals, Toast)
   Дополняет components.css. Использует существующие токены.
   ========================================================================= */

/* =========================================================================
   1. DATA TABLE
   ========================================================================= */
.dt-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dt-toolbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-wrap: wrap;
}
.dt-toolbar__search { width: 280px; max-width: 100%; }
.dt-toolbar__filters { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; flex: 1; min-width: 0; }
.dt-toolbar__actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }

.dt-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

.dt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
  font-variant-numeric: tabular-nums;
}
.dt-table thead th {
  position: sticky; top: 0;
  background: var(--bg-subtle);
  color: var(--ink-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  text-align: left;
  padding: 10px var(--s-4);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  user-select: none;
  z-index: 2;
}
.dt-table thead th.is-sortable { cursor: pointer; }
.dt-table thead th.is-sortable:hover { color: var(--ink); background: var(--line-soft); }
.dt-table thead th .sort-ind {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.dt-table thead th.is-sortable:hover .sort-ind { opacity: 0.55; }
.dt-table thead th.is-sorted-asc .sort-ind,
.dt-table thead th.is-sorted-desc .sort-ind { opacity: 1; color: var(--brand); }
.dt-table thead th.is-sorted-desc .sort-ind svg { transform: rotate(180deg); }
.dt-table thead th .sort-ind svg { width: 10px; height: 10px; }

.dt-table tbody tr {
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--t-fast);
}
.dt-table tbody tr:last-child { border-bottom: none; }
.dt-table tbody tr:hover { background: var(--bg-subtle); }
.dt-table tbody tr.is-selected { background: var(--brand-soft); }
.dt-table tbody tr.is-selected:hover { background: var(--brand-soft-2); }

.dt-table td {
  padding: var(--s-3) var(--s-4);
  color: var(--ink);
  vertical-align: middle;
  white-space: nowrap;
}
.dt-table td.dt-td--name { font-weight: var(--fw-medium); white-space: normal; }
.dt-table td.dt-td--muted { color: var(--ink-muted); font-size: var(--fs-sm); }
.dt-table td.dt-td--right { text-align: right; }
.dt-table td.dt-td--actions { width: 1%; padding-right: var(--s-3); }
.dt-table td.dt-td--check { width: 1%; padding-right: 0; }

.dt-row--compact td { padding: 8px var(--s-4); }
.dt-row--comfortable td { padding: var(--s-3) var(--s-4); }

/* Compact density mode — applied to entire .dt-wrap */
.dt-wrap.is-compact .dt-table td { padding: 6px var(--s-4); }
.dt-wrap.is-compact .dt-table .row-with-avatar .row-meta__sub { display: none; }
.dt-wrap.is-compact .avatar.avatar--sm { width: 22px; height: 22px; font-size: 9px; }

.dt-table .row-with-avatar { display: flex; align-items: center; gap: 10px; }
.dt-table .row-with-avatar .row-meta__sub { display: block; font-size: 11px; color: var(--ink-muted); margin-top: 1px; }

/* Skeleton row */
.dt-skel-row td { padding: var(--s-3) var(--s-4); }
.dt-skel-row .skel { height: 12px; border-radius: var(--r-sm); }

/* Empty / error states inside table */
.dt-state {
  padding: var(--s-10) var(--s-6);
  text-align: center;
  color: var(--ink-secondary);
}
.dt-state__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--ink); margin-bottom: 4px; }
.dt-state__body { font-size: var(--fs-md); color: var(--ink-muted); max-width: 360px; margin: 0 auto var(--s-4); }

/* Pagination */
.dt-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--s-4);
  border-top: 1px solid var(--line);
  background: var(--bg-subtle);
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.dt-pagination__nav { display: flex; align-items: center; gap: 4px; }
.dt-pagination__nav button {
  height: 28px; padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--ink);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.dt-pagination__nav button:hover:not(:disabled) { background: var(--bg-subtle); border-color: var(--line-strong); }
.dt-pagination__nav button:disabled { opacity: 0.4; cursor: not-allowed; }
.dt-pagination__nav button.is-active { background: var(--ink); color: white; border-color: var(--ink); }
.dt-pagination__nav .dots { padding: 0 4px; color: var(--ink-muted); }

/* Action menu trigger */
.dt-actions-btn {
  width: 26px; height: 26px;
  display: inline-grid; place-items: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--ink-muted);
}
.dt-actions-btn:hover { background: var(--line-soft); color: var(--ink); border-color: var(--line); }
.dt-actions-btn svg { width: 14px; height: 14px; }

/* Bulk action bar (shown when rows selected) */
.dt-bulkbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--s-4);
  background: var(--ink);
  color: white;
  font-size: var(--fs-sm);
}
.dt-bulkbar__count { font-weight: var(--fw-semibold); }
.dt-bulkbar__sep { width: 1px; height: 18px; background: rgba(255,255,255,0.15); }
.dt-bulkbar__action {
  background: transparent; border: 1px solid rgba(255,255,255,0.2);
  color: white;
  height: 26px; padding: 0 10px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
  cursor: pointer;
}
.dt-bulkbar__action:hover { background: rgba(255,255,255,0.1); }
.dt-bulkbar__close { margin-left: auto; opacity: 0.6; cursor: pointer; }
.dt-bulkbar__close:hover { opacity: 1; }

/* =========================================================================
   2. TABS (underline style)
   ========================================================================= */
.tabs {
  display: flex;
  gap: var(--s-1);
  border-bottom: 1px solid var(--line);
  align-items: flex-end;
  overflow-x: auto;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--brand);
}
.tab__count {
  display: inline-grid; place-items: center;
  height: 16px; min-width: 16px;
  padding: 0 5px;
  background: var(--line-soft);
  color: var(--ink-muted);
  border-radius: var(--r-full);
  font-size: 10px;
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}
.tab.is-active .tab__count { background: var(--brand-soft); color: var(--brand-active); }
.tab--lg { padding: 14px 16px; font-size: var(--fs-lg); }
.tab:focus-visible { outline: none; box-shadow: var(--sh-focus); border-radius: var(--r-sm); }

.tab-content { padding: var(--s-5) 0; }

/* Pill variant — for secondary tabs */
.tabs--pill {
  border-bottom: none;
  gap: 4px;
  padding: 4px;
  background: var(--bg-subtle);
  border-radius: var(--r-md);
  display: inline-flex;
}
.tab--pill {
  height: 28px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border-bottom: none;
  margin-bottom: 0;
  font-size: var(--fs-sm);
}
.tab--pill:hover { background: var(--surface); }
.tab--pill.is-active {
  background: var(--surface);
  color: var(--ink);
  border-bottom: none;
  box-shadow: var(--sh-xs);
}

/* Vertical variant — for side-nav settings */
.tabs--vertical {
  flex-direction: column;
  border-bottom: none;
  border-right: 1px solid var(--line);
  align-items: stretch;
  padding-right: var(--s-2);
  gap: 2px;
  overflow-x: visible;
}
.tab--v {
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: none;
  border-right: 2px solid transparent;
  border-radius: var(--r-md) 0 0 var(--r-md);
  margin-bottom: 0;
  margin-right: -1px;
}
.tab--v:hover { background: var(--bg-subtle); }
.tab--v.is-active {
  background: var(--brand-soft);
  color: var(--brand-active);
  border-right-color: var(--brand);
  border-bottom: none;
}
.tab--v.is-active .tab__count { background: var(--brand); color: white; }

/* Mobile card list (replaces data table on <768px) */
.dt-card-list { display: flex; flex-direction: column; gap: var(--s-2); }
.dt-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.dt-card:hover { background: var(--bg-subtle); }
.dt-card.is-selected { background: var(--brand-soft); border-color: var(--brand-soft-2); }
.dt-card__hd { display: flex; align-items: center; gap: 10px; }
.dt-card__name { font-size: var(--fs-md); font-weight: var(--fw-medium); }
.dt-card__sub  { font-size: 11px; color: var(--ink-muted); margin-top: 1px; }
.dt-card__row { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); }

/* =========================================================================
   3. FORM MODAL helpers (extends existing .modal)
   ========================================================================= */
.modal--form { width: min(560px, calc(100vw - 32px)); }
.modal__form-body { padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.modal__form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.modal__form-row--3 { grid-template-columns: 1fr 1fr 1fr; }

.field.is-error .input,
.field.is-error .select,
.field.is-error .textarea { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12); }
.field.is-error .field__error { display: block; }

/* Color picker (group color swatches) */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-picker__swatch {
  width: 28px; height: 28px;
  border-radius: var(--r-md);
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: transform var(--t-fast), border-color var(--t-fast);
}
.color-picker__swatch:hover { transform: scale(1.08); }
.color-picker__swatch.is-selected { border-color: var(--ink); }
.color-picker__swatch.is-selected::after {
  content: '';
  position: absolute; inset: 4px;
  border-radius: 4px;
  border: 2px solid white;
}

/* =========================================================================
   4. CONFIRMATION MODAL (small with icon)
   ========================================================================= */
.modal--confirm { width: min(380px, calc(100vw - 32px)); }
.modal__confirm-body { padding: var(--s-5) var(--s-5) var(--s-4); text-align: left; }
.modal__icon {
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  margin-bottom: var(--s-3);
}
.modal__icon svg { width: 18px; height: 18px; }
.modal__icon--warning { background: var(--warning-soft); color: var(--warning-ink); }
.modal__icon--danger  { background: var(--danger-soft);  color: var(--danger-ink); }
.modal__icon--info    { background: var(--info-soft);    color: var(--info-ink); }
.modal__icon--success { background: var(--success-soft); color: var(--success-ink); }
.modal__confirm-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin-bottom: 6px; }
.modal__confirm-body p { color: var(--ink-secondary); font-size: var(--fs-md); }

/* =========================================================================
   5. TOAST
   ========================================================================= */
.toast-stack {
  position: fixed;
  right: var(--s-5);
  bottom: var(--s-5);
  display: flex;
  flex-direction: column-reverse;
  gap: var(--s-2);
  z-index: 120;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  min-width: 280px;
  max-width: 380px;
  animation: toast-in 220ms var(--ease);
}
@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.toast--leaving { animation: toast-out 180ms var(--ease) forwards; }
@keyframes toast-out {
  to { transform: translateY(8px); opacity: 0; }
}
.toast__icon {
  width: 22px; height: 22px;
  flex-shrink: 0;
  border-radius: var(--r-full);
  display: grid; place-items: center;
}
.toast__icon svg { width: 12px; height: 12px; color: white; }
.toast--success .toast__icon { background: var(--success); }
.toast--danger  .toast__icon { background: var(--danger); }
.toast--warning .toast__icon { background: var(--warning); }
.toast--info    .toast__icon { background: var(--info); }
.toast__body { flex: 1; min-width: 0; }
.toast__title { font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--ink); line-height: 1.35; }
.toast__sub { font-size: var(--fs-sm); color: var(--ink-muted); margin-top: 2px; }
.toast__action {
  background: transparent;
  border: none;
  color: var(--brand);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  padding: 0;
  margin-top: 4px;
}
.toast__action:hover { color: var(--brand-active); }
.toast__close {
  width: 20px; height: 20px;
  flex-shrink: 0;
  background: transparent; border: none;
  color: var(--ink-muted);
  cursor: pointer;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  margin-top: -1px;
}
.toast__close:hover { background: var(--line-soft); color: var(--ink); }
.toast__close svg { width: 12px; height: 12px; }

@media (max-width: 640px) {
  .toast-stack { left: var(--s-3); right: var(--s-3); bottom: var(--s-3); }
  .toast { min-width: 0; max-width: 100%; }
}

/* =========================================================================
   6. RESPONSIVE — extras
   ========================================================================= */
@media (max-width: 768px) {
  .dt-toolbar { padding: 10px 12px; gap: 8px; }
  .dt-toolbar__search { width: 100%; }
  .dt-table thead th, .dt-table td { padding: 10px 12px; }
  .dt-pagination { padding: 8px 12px; flex-direction: column; align-items: stretch; gap: 8px; }
  .modal__form-row, .modal__form-row--3 { grid-template-columns: 1fr; }
}

/* =========================================================================
   7. DATE RANGE PICKER
   ========================================================================= */
.dp-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: var(--fs-base);
  color: var(--ink);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--t-fast);
}
.dp-trigger:hover { border-color: var(--line-strong); }
.dp-trigger.is-open { border-color: var(--brand); box-shadow: var(--sh-focus); }
.dp-trigger svg { width: 14px; height: 14px; color: var(--ink-muted); }
.dp-trigger .chev { margin-left: 4px; opacity: 0.5; }

.dp-pop {
  position: relative;
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  overflow: hidden;
  max-width: 640px;
}
.dp-presets {
  width: 160px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--bg-subtle);
}
.dp-preset {
  display: block;
  padding: 8px 10px;
  background: transparent; border: none;
  text-align: left;
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--ink-secondary);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.dp-preset:hover { background: var(--line-soft); color: var(--ink); }
.dp-preset.is-active { background: var(--ink); color: white; font-weight: var(--fw-medium); }
.dp-preset__hint { display: block; font-size: 10px; color: var(--ink-muted); font-variant-numeric: tabular-nums; margin-top: 2px; }
.dp-preset.is-active .dp-preset__hint { color: rgba(255,255,255,0.7); }

.dp-cal-wrap {
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
}
.dp-cal-months { display: flex; gap: var(--s-4); }
.dp-cal {
  display: grid;
  grid-template-columns: repeat(7, 30px);
  gap: 2px;
}
.dp-cal__header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.dp-cal__title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.dp-cal__nav {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--ink-secondary);
}
.dp-cal__nav:hover { background: var(--bg-subtle); color: var(--ink); }
.dp-cal__nav svg { width: 10px; height: 10px; }
.dp-cal__wd {
  font-size: 10px; color: var(--ink-muted);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  text-align: center;
  padding: 4px 0;
}
.dp-day {
  height: 28px;
  display: grid; place-items: center;
  font-size: 12px;
  color: var(--ink);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  background: transparent;
  border: none;
  font-family: inherit;
  position: relative;
}
.dp-day:hover { background: var(--bg-subtle); }
.dp-day.is-out { color: var(--ink-disabled); }
.dp-day.is-today { font-weight: var(--fw-semibold); color: var(--brand); }
.dp-day.is-in-range { background: var(--brand-soft); border-radius: 0; }
.dp-day.is-range-start,
.dp-day.is-range-end {
  background: var(--brand);
  color: white;
  font-weight: var(--fw-semibold);
  border-radius: var(--r-sm);
}
.dp-day.is-range-start { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.dp-day.is-range-end { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.dp-day:disabled { opacity: 0.3; cursor: not-allowed; }

.dp-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px var(--s-3);
  border-top: 1px solid var(--line);
  margin: var(--s-3) calc(-1 * var(--s-3)) calc(-1 * var(--s-3));
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  gap: var(--s-2);
}
.dp-foot__range { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: var(--fw-medium); }

@media (max-width: 768px) {
  .dp-pop { flex-direction: column; }
  .dp-presets { width: 100%; border-right: none; border-bottom: 1px solid var(--line); flex-direction: row; overflow-x: auto; gap: 6px; }
  .dp-preset { flex-shrink: 0; }
  .dp-cal-months { flex-direction: column; }
}

/* =========================================================================
   8. CHARTS — shells
   ========================================================================= */
/* Metric card (KPI) */
.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  position: relative;
  overflow: hidden;
}
.metric__eyebrow {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--ink-muted);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
}
.metric__value {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-tighter);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.metric__delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
}
.metric__delta--up   { color: var(--success-ink); }
.metric__delta--down { color: var(--danger-ink); }
.metric__delta--flat { color: var(--ink-muted); }
.metric__delta svg { width: 12px; height: 12px; }
.metric__sub { font-size: 11px; color: var(--ink-muted); }
.metric__spark {
  position: absolute;
  right: var(--s-3); bottom: var(--s-3);
  width: 88px; height: 32px;
}
.metric--accent {
  background: linear-gradient(180deg, var(--brand-soft) 0%, var(--surface) 60%);
  border-color: var(--brand-soft-2);
}

/* Chart card */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.chart-card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line-soft);
  gap: var(--s-3);
}
.chart-card__head > :first-child { min-width: 0; flex: 1; }
.chart-card__title { font-size: var(--fs-md); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-card__sub   { font-size: var(--fs-sm); color: var(--ink-muted); margin-top: 2px; }
.chart-card__body  { padding: var(--s-4) var(--s-5); }
.chart-card__legend {
  display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-4);
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--line-soft);
  font-size: var(--fs-sm);
  color: var(--ink-secondary);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.legend-item__dot { width: 8px; height: 8px; border-radius: 2px; }

/* Y-axis labels */
.chart-area {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
}
.chart-yaxis {
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: 10px; font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  text-align: right;
  padding: 4px 0;
}
.chart-canvas {
  position: relative;
  border-bottom: 1px solid var(--line);
  background-image:
    repeating-linear-gradient(to top, var(--line-soft) 0 1px, transparent 1px 25%);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: bottom;
}
.chart-canvas svg { width: 100%; height: 100%; display: block; }
.chart-xaxis {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--ink-muted);
  margin-top: 6px; padding-left: 62px;
  font-variant-numeric: tabular-nums;
}

/* Donut */
.donut-row { display: grid; grid-template-columns: auto 1fr; gap: var(--s-6); align-items: center; }
.donut-svg { width: 140px; height: 140px; }
.donut-center {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.donut-center__value { font-size: var(--fs-xl); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.donut-center__sub   { font-size: 11px; color: var(--ink-muted); }

/* Breakdown table */
.breakdown { display: flex; flex-direction: column; gap: 10px; }
.breakdown-row { display: grid; grid-template-columns: 140px 1fr auto auto; gap: var(--s-3); align-items: center; font-size: var(--fs-sm); }
.breakdown-row__name { font-weight: var(--fw-medium); }
.breakdown-row__bar { height: 8px; background: var(--line-soft); border-radius: var(--r-full); overflow: hidden; }
.breakdown-row__fill { height: 100%; border-radius: var(--r-full); }
.breakdown-row__value { font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); min-width: 80px; text-align: right; }
.breakdown-row__pct { color: var(--ink-muted); font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }

/* =========================================================================
   9. AUTOCOMPLETE / TYPEAHEAD
   ========================================================================= */
.ac { position: relative; }
.ac__input { padding-right: 28px; }
.ac__clear {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  display: grid; place-items: center;
  background: var(--line-soft);
  border: none;
  border-radius: var(--r-full);
  cursor: pointer;
  color: var(--ink-muted);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.ac__clear svg { width: 10px; height: 10px; }
.ac.has-value .ac__clear { opacity: 1; }
.ac__clear:hover { background: var(--line); color: var(--ink); }

.ac__menu {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-md);
  z-index: 50;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}
.ac__item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.ac__item:hover,
.ac__item.is-focused { background: var(--bg-subtle); }
.ac__item.is-focused {
  background: var(--brand-soft);
}
.ac__item-name { font-size: var(--fs-md); font-weight: var(--fw-medium); }
.ac__item-meta { font-size: 11px; color: var(--ink-muted); margin-top: 1px; }
.ac__highlight { color: var(--brand-active); font-weight: var(--fw-semibold); background: rgba(237, 89, 70, 0.1); border-radius: 2px; padding: 0 2px; }
.ac__empty {
  padding: 16px;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
}

/* =========================================================================
   10. FILE UPLOAD (Dropzone)
   ========================================================================= */
.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-lg);
  padding: var(--s-10) var(--s-6);
  text-align: center;
  background: var(--bg-subtle);
  cursor: pointer;
  transition: border-color var(--t-base), background var(--t-base);
}
.dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.is-dragover { border-color: var(--brand); background: var(--brand-soft); border-style: solid; }
.dropzone__icon {
  width: 44px; height: 44px;
  margin: 0 auto var(--s-3);
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  color: var(--ink-secondary);
}
.dropzone__icon svg { width: 20px; height: 20px; }
.dropzone__title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--ink); margin-bottom: 4px; }
.dropzone__hint  { font-size: var(--fs-sm); color: var(--ink-muted); }

.dz-file {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.dz-file__icon {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: var(--success-soft);
  color: var(--success-ink);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.dz-file__icon svg { width: 14px; height: 14px; }
.dz-file__body { flex: 1; min-width: 0; }
.dz-file__name { font-weight: var(--fw-medium); font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dz-file__sub  { font-size: 11px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.dz-file__close {
  width: 26px; height: 26px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-muted);
  display: grid; place-items: center;
  border-radius: var(--r-sm);
}
.dz-file__close:hover { background: var(--line-soft); color: var(--ink); }
.dz-file__close svg { width: 12px; height: 12px; }
.dz-file--error .dz-file__icon { background: var(--danger-soft); color: var(--danger-ink); }
.dz-file--uploading .dz-file__icon { background: var(--info-soft); color: var(--info-ink); }

/* =========================================================================
   11. PROGRESS BAR
   ========================================================================= */
.progress {
  width: 100%;
  height: 6px;
  background: var(--line-soft);
  border-radius: var(--r-full);
  overflow: hidden;
  position: relative;
}
.progress__fill {
  height: 100%;
  background: var(--brand);
  border-radius: var(--r-full);
  transition: width var(--t-slow) var(--ease);
}
.progress--success .progress__fill { background: var(--success); }
.progress--warning .progress__fill { background: var(--warning); }
.progress--danger  .progress__fill { background: var(--danger); }
.progress--lg { height: 10px; }
.progress--xs { height: 3px; }

.progress-row { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.progress-row .progress { flex: 1; }

/* =========================================================================
   12. STEPPER
   ========================================================================= */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
}
.step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.step__num {
  width: 24px; height: 24px;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  background: var(--line-soft);
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast);
}
.step__num svg { width: 12px; height: 12px; }
.step__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--ink-muted);
  white-space: nowrap;
}
.step.is-current .step__num { background: var(--brand); color: white; }
.step.is-current .step__label { color: var(--ink); }
.step.is-done .step__num { background: var(--success); color: white; }
.step.is-done .step__label { color: var(--ink-secondary); }
.step__line {
  flex: 1;
  height: 1px;
  background: var(--line);
  margin: 0 var(--s-3);
  min-width: 24px;
}
.step.is-done + .step__line,
.step.is-done .step__line { background: var(--success); }

@media (max-width: 640px) {
  .stepper { overflow-x: auto; }
  .step__label { display: none; }
  .step.is-current .step__label { display: inline; }
}

/* =========================================================================
   MOBILE GAPS — touch-friendly tabs, stacked charts, compact upload
   ========================================================================= */
@media (max-width: 768px) {
  /* ---- TABS: horizontal scroll + bigger hit area ---- */
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
  }
  .tab {
    flex-shrink: 0;
    padding: 12px 14px;
    font-size: var(--fs-md);
    min-height: 44px;
    scroll-snap-align: start;
  }
  .tab--lg { padding: 14px 16px; }

  /* Pill — same horizontal scroll */
  .tabs--pill { flex-wrap: nowrap; overflow-x: auto; padding: 4px; max-width: 100%; }
  .tab--pill { flex-shrink: 0; height: 34px; padding: 0 14px; }

  /* Vertical → horizontal scroll bar on mobile */
  .tabs--vertical {
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: flex-end;
  }
  .tab--v {
    flex-shrink: 0;
    justify-content: flex-start;
    border-right: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    margin-right: 0;
    margin-bottom: -1px;
    padding: 12px 14px;
    min-height: 44px;
  }
  .tab--v.is-active {
    background: transparent;
    border-bottom-color: var(--brand);
    color: var(--ink);
  }
  .tab--v.is-active .tab__count { background: var(--brand-soft); color: var(--brand-active); }

  /* ---- CHARTS ---- */
  .metric { min-height: auto; padding: 12px 14px; gap: 6px; }
  .metric__value { font-size: var(--fs-2xl); }
  .metric__spark { display: none; }
  .metric--accent { background: var(--brand-soft); }

  .chart-card__head { flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
  .chart-card__body { padding: 12px 14px; }
  .chart-card__legend { padding: 8px 14px; gap: 10px; }

  /* Donut row — stack vertically, smaller donut */
  .chart-card__body > div[style*="grid-template-columns: auto 1fr"] {
    grid-template-columns: 1fr !important;
    gap: var(--s-3) !important;
    text-align: left;
  }
  .donut-svg { width: 120px !important; height: 120px !important; margin: 0 auto; display: block; }

  /* Breakdown — name on full width, bar+value+pct below */
  .breakdown-row {
    grid-template-columns: 1fr auto auto;
    gap: 8px 10px;
    row-gap: 4px;
  }
  .breakdown-row__name { grid-column: 1 / -1; }
  .breakdown-row__bar  { grid-column: 1 / 2; min-width: 0; }
  .breakdown-row__value { min-width: 0; }

  /* Chart area — tighter yaxis */
  .chart-area { grid-template-columns: 36px 1fr; gap: 6px; }
  .chart-yaxis { font-size: 9px; padding: 2px 0; }
  .chart-xaxis { font-size: 9px; padding-left: 42px; }

  /* ---- AUTOCOMPLETE ---- */
  .ac__menu { max-height: 240px; left: -4px; right: -4px; }
  .ac__item { padding: 10px; min-height: 44px; }
  .ac__item-name { font-size: var(--fs-md); }

  /* ---- FILE UPLOAD ---- */
  .dropzone { padding: var(--s-6) var(--s-4); }
  .dropzone__icon { width: 36px; height: 36px; margin-bottom: var(--s-2); }
  .dropzone__icon svg { width: 16px; height: 16px; }
  .dropzone__title { font-size: var(--fs-md); }
  .dropzone__hint { font-size: 11px; }

  .dz-file { padding: 10px 12px; gap: 10px; }
  .dz-file__icon { width: 28px; height: 28px; }
}

@media (max-width: 480px) {
  .metric { padding: 10px 12px; }
  .metric__value { font-size: var(--fs-xl); }
  /* Charts — hide every other xaxis label to save space */
  .chart-xaxis span:nth-child(even) { visibility: hidden; }
}

/* =========================================================================
   ====== STUDENTS PAGE — Phase 6.1 ========================================
   Components for master-detail Students UI. Append-only. Uses existing tokens.
   ========================================================================= */

/* =========================================================================
   13. MASTER-DETAIL LAYOUT
   ========================================================================= */
.md-layout {
  display: grid;
  grid-template-columns: minmax(320px, 32%) 1fr;
  height: calc(100vh - var(--header-h));
  min-height: 0;
  background: var(--bg-app);
  min-width: 0;
}
.md-left {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;        /* grid item: allow shrink so .md-left__scroll owns the scroll */
  position: relative;
}
.md-right {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-app);
  overflow: hidden; /* contains its own scroll context */
}

.md-panel-head {
  position: sticky;
  top: 0;
  z-index: 18;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: var(--s-3) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.md-panel-foot {
  position: sticky;
  bottom: 0;
  z-index: 12;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: var(--s-2) var(--s-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}

.md-left__scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.md-right__scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: var(--s-5) var(--s-4) 0;
}

.md-right--empty {
  display: grid;
  place-items: center;
  padding: var(--s-12) var(--s-6);
  text-align: center;
  color: var(--ink-muted);
  flex: 1;
}
/* display:grid above overrides the UA [hidden] rule — restore it so the
   empty-state can be toggled via the hidden attribute. */
.md-right--empty[hidden] { display: none; }
.md-right--empty .md-empty__icon {
  width: 56px; height: 56px;
  border-radius: var(--r-full);
  background: var(--bg-subtle);
  display: grid; place-items: center;
  margin: 0 auto var(--s-3);
  color: var(--ink-disabled);
}
.md-right--empty .md-empty__icon svg { width: 22px; height: 22px; }
.md-right--empty .md-empty__title { font-size: var(--fs-md); color: var(--ink-secondary); font-weight: var(--fw-medium); }

/* Right-panel inner sections */
.md-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: var(--s-4);
  overflow: hidden;
}
.md-section__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  gap: var(--s-3);
  border-bottom: 1px solid var(--line-soft);
}
.md-section__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  display: inline-flex; align-items: center; gap: var(--s-2);
}
.md-section__title .badge { margin-left: 4px; }
.md-section__body { padding: var(--s-4); }

/* Mobile back-button (only shown on stacked mobile) */
.md-back {
  display: none;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--line);
  height: 30px;
  padding: 0 10px;
  border-radius: var(--r-md);
  color: var(--ink);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
}
.md-back:hover { background: var(--bg-subtle); }
.md-back svg { width: 14px; height: 14px; }

@media (max-width: 1024px) {
  .md-layout { grid-template-columns: 1fr; }
  .md-right { border-left: none; }
  .md-layout.is-detail-mode .md-left { display: none; }
  .md-layout:not(.is-detail-mode) .md-right { display: none; }
  .md-layout.is-detail-mode .md-back { display: inline-flex; }
  .md-right__scroll { padding: var(--s-4); }
}
@media (max-width: 768px) {
  .md-right__scroll { padding: var(--s-3); }
  .md-panel-head { padding: var(--s-3); }
  .md-section__head { padding: var(--s-3); }
  .md-section__body { padding: var(--s-3); }
}

/* =========================================================================
   14. BIRTHDAY WIDGET
   ========================================================================= */
.bday {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.bday__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) var(--s-4) var(--s-2);
}
.bday__title {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--ink);
}
.bday__title .count {
  font-size: 10px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  font-weight: var(--fw-semibold);
}
.bday__list {
  padding: 0 var(--s-2) var(--s-2);
  display: flex; flex-direction: column;
  max-height: 232px;
  overflow-y: auto;
}
.bday-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px var(--s-2);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast);
  background: transparent;
  border: none;
  text-align: left;
  font-family: inherit;
  width: 100%;
  color: var(--ink);
}
.bday-card:hover { background: var(--bg-subtle); }
.bday-card:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.bday-card__name { font-size: var(--fs-base); font-weight: var(--fw-medium); line-height: 1.25; }
.bday-card__age  { font-size: 11px; color: var(--ink-muted); margin-top: 1px; font-variant-numeric: tabular-nums; }
.bday-card__when {
  font-size: 11px;
  font-weight: var(--fw-semibold);
  color: var(--brand-active);
  background: var(--brand-soft);
  padding: 2px 8px;
  border-radius: var(--r-full);
  white-space: nowrap;
}
.bday-card__when.is-soon { background: var(--warning-soft); color: var(--warning-ink); }

/* =========================================================================
   15. STUDENT LIST ROW
   ========================================================================= */
.student-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0;
  padding: 8px var(--s-3) 8px var(--s-4);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  border-bottom: 1px solid var(--line-soft);
  position: relative;
  transition: background var(--t-fast);
  min-height: 52px;
}
.student-row:hover { background: var(--bg-subtle); }
.student-row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--brand); }
.student-row.is-selected {
  background: var(--brand-soft);
}
.student-row.is-selected::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--brand);
}
.student-row__stripe {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--line);
}
.student-row.s-g-malyshi .student-row__stripe { background: var(--g-malyshi-stripe); }
.student-row.s-g-junior  .student-row__stripe { background: var(--g-junior-stripe); }
.student-row.s-g-middle  .student-row__stripe { background: var(--g-middle-stripe); }
.student-row.s-g-senior  .student-row__stripe { background: var(--g-senior-stripe); }
.student-row.s-g-teen    .student-row__stripe { background: var(--g-teen-stripe); }
.student-row.is-selected .student-row__stripe { visibility: hidden; }

.student-row .avatar { margin-right: 10px; }
.student-row__body { min-width: 0; }
.student-row__name {
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  line-height: 1.25;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.student-row__meta {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.student-row__meta.is-warning { color: var(--warning-ink); font-weight: var(--fw-medium); }
.student-row__meta.is-danger  { color: var(--danger-ink);  font-weight: var(--fw-medium); }
.student-row__warn {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: var(--warning);
  margin-left: var(--s-2);
}
.student-row__warn svg { width: 14px; height: 14px; }
.student-row__warn.is-danger { color: var(--danger); }

.list-section-head {
  padding: var(--s-3) var(--s-4) 6px;
  font-size: 10px;
  font-weight: var(--fw-semibold);
  color: var(--ink-muted);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;   /* above scrolling .student-row, below .md-panel-head(18)/foot(12) */
  border-bottom: 1px solid var(--line-soft);
}

/* =========================================================================
   16. STUDENT STATUS BADGE
   ========================================================================= */
.s-status {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px;
  padding: 0 10px 0 8px;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1;
  white-space: nowrap;
}
.s-status::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.s-status--active   { background: var(--success-soft); color: var(--success-ink); }
.s-status--inactive { background: var(--warning-soft); color: var(--warning-ink); }
.s-status--inactive::before { background: var(--warning-ink); border-radius: 50%; background: radial-gradient(circle at 30% 50%, var(--warning-ink) 50%, transparent 50%); }
.s-status--dropped  { background: var(--danger-soft);  color: var(--danger-ink); }
.s-status--dropped::before { background: transparent; border: 1.5px solid currentColor; box-sizing: border-box; }
.s-status--none     { background: var(--line-soft);    color: var(--ink-muted); }
.s-status--none::before { background: var(--ink-muted); opacity: 0.5; }

/* =========================================================================
   17. ATTENDANCE CALENDAR STRIP
   ========================================================================= */
.att-cal { display: flex; flex-direction: column; gap: var(--s-3); }
.att-cal__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.att-cal__month {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--ink);
  display: inline-flex; align-items: center; gap: var(--s-2);
}
.att-cal__nav { display: inline-flex; gap: 2px; }
.att-cal__nav-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--ink-secondary);
  transition: background var(--t-fast), color var(--t-fast);
}
.att-cal__nav-btn:hover { background: var(--bg-subtle); color: var(--ink); }
.att-cal__nav-btn svg { width: 12px; height: 12px; }

.att-cal__pills {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.att-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 6px;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  background: var(--line-soft);
  color: var(--ink-secondary);
}
.att-pill__icon {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10px;
  font-weight: var(--fw-bold);
  background: var(--surface);
  color: inherit;
}
.att-pill__icon svg { width: 10px; height: 10px; }
.att-pill--present { background: var(--success-soft); color: var(--success-ink); }
.att-pill--present .att-pill__icon { background: var(--success); color: white; }
.att-pill--absent  { background: var(--danger-soft);  color: var(--danger-ink); }
.att-pill--absent .att-pill__icon { background: var(--danger); color: white; }
.att-pill--sick    { background: var(--warning-soft); color: var(--warning-ink); }
.att-pill--sick .att-pill__icon { background: var(--warning); color: white; }

.att-cal__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 4px;
  align-content: start;
}
.att-cal__grid--fixed31 { grid-template-columns: repeat(16, 1fr); }
@media (max-width: 1280px) { .att-cal__grid--fixed31 { grid-template-columns: repeat(11, 1fr); } }
@media (max-width: 640px)  { .att-cal__grid--fixed31 { grid-template-columns: repeat(8, 1fr); } }

.att-day {
  position: relative;
  aspect-ratio: 1 / 1;
  min-width: 28px;
  max-width: 36px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: var(--line-soft);
  border: 1px solid transparent;
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
  cursor: default;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.att-day:hover { transform: translateY(-1px); box-shadow: var(--sh-sm); z-index: 2; }
.att-day__num {
  position: absolute;
  top: 2px; left: 4px;
  font-size: 9px;
  color: var(--ink-muted);
  opacity: 0.85;
  letter-spacing: 0;
}
.att-day__icon { width: 14px; height: 14px; display: grid; place-items: center; }
.att-day__icon svg { width: 12px; height: 12px; stroke-width: 2.5; }

.att-day--present { background: var(--success-soft); color: var(--success-ink); }
.att-day--present .att-day__num { color: var(--success-ink); opacity: 0.55; }
.att-day--absent  { background: var(--danger-soft);  color: var(--danger-ink); }
.att-day--absent  .att-day__num { color: var(--danger-ink); opacity: 0.55; }
.att-day--sick    { background: var(--warning-soft); color: var(--warning-ink); }
.att-day--sick    .att-day__num { color: var(--warning-ink); opacity: 0.6; }
.att-day--scheduled {
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  color: var(--ink-muted);
}
.att-day--none { background: var(--bg-subtle); color: var(--ink-disabled); }
.att-day--none .att-day__num { color: var(--ink-disabled); }
.att-day--today {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

/* Tooltip (CSS-only, optional JS to position) */
.att-day[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  font-size: 11px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  z-index: 30;
  font-weight: var(--fw-regular);
  pointer-events: none;
  box-shadow: var(--sh-md);
}
.att-day[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%; transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--ink);
  z-index: 30;
}

/* Short report */
.att-cal__report {
  margin-top: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-3) var(--s-4);
}
.att-rep {
  display: flex; flex-direction: column; gap: 2px;
  font-variant-numeric: tabular-nums;
}
.att-rep__value { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--ink); line-height: 1.1; }
.att-rep__label { font-size: 11px; color: var(--ink-muted); }
.att-rep--accent .att-rep__value { color: var(--brand-active); }

@media (max-width: 768px) {
  .att-cal__report { grid-template-columns: 1fr 1fr; }
}

/* =========================================================================
   18. COACH MESSAGES TIMELINE
   ========================================================================= */
.msg-tl {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.msg-tl::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--line);
}
.msg-item {
  position: relative;
  padding-left: 36px;
  display: flex; flex-direction: column;
  gap: 4px;
}
.msg-item__avatar {
  position: absolute;
  left: 0; top: 0;
  width: 24px; height: 24px;
  border-radius: var(--r-full);
  background: var(--bg-app);
  color: var(--ink-secondary);
  font-size: 10px;
  font-weight: var(--fw-semibold);
  display: grid; place-items: center;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  z-index: 1;
}
.msg-item__head {
  display: flex; align-items: center; gap: var(--s-2);
  flex-wrap: wrap;
}
.msg-item__author {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--ink);
}
.msg-item__date {
  font-size: 11px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.msg-item__body {
  font-size: var(--fs-base);
  color: var(--ink-secondary);
  line-height: 1.45;
  margin-top: 2px;
}
.msg-item.is-unread .msg-item__avatar {
  box-shadow: 0 0 0 1px var(--brand);
  background: var(--brand-soft);
  color: var(--brand-active);
}

.msg-tl__more {
  align-self: flex-start;
  margin-top: var(--s-1);
  margin-left: 36px;
  background: transparent;
  border: 1px dashed var(--line-strong);
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  padding: 6px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
}
.msg-tl__more:hover { background: var(--bg-subtle); color: var(--ink); border-color: var(--ink-muted); }

/* =========================================================================
   19. INLINE FORM CARD
   ========================================================================= */
.form-card {
  /* Lives inside .md-section already, this is the inner toggle */
}
.form-card__edit {
  display: inline-flex;
  align-items: center; gap: 4px;
  background: transparent;
  border: 1px solid var(--line);
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--ink-secondary);
  cursor: pointer;
}
.form-card__edit:hover { background: var(--bg-subtle); color: var(--ink); }
.form-card__edit svg { width: 12px; height: 12px; }

.form-card__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3) var(--s-5);
}
@media (max-width: 768px) {
  .form-card__grid { grid-template-columns: 1fr; }
}

.form-card__field {
  display: flex; flex-direction: column;
  gap: 4px;
}
.form-card__label {
  font-size: 10px;
  font-weight: var(--fw-semibold);
  color: var(--ink-muted);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
}
.form-card__value {
  font-size: var(--fs-base);
  color: var(--ink);
  font-weight: var(--fw-medium);
  min-height: 18px;
}
.form-card__value.is-empty { color: var(--ink-muted); font-weight: var(--fw-regular); font-style: italic; }

.form-card__footer {
  display: flex; justify-content: flex-end; gap: var(--s-2);
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line-soft);
}

/* =========================================================================
   20. SUBSCRIPTION CARD
   ========================================================================= */
.sub-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  display: flex; flex-direction: column;
  gap: var(--s-2);
}
.sub-card--active   { border-color: var(--brand-soft-2); background: linear-gradient(180deg, var(--brand-soft) 0%, var(--surface) 80%); }
.sub-card--warning  { border-color: #f3d9a3; background: linear-gradient(180deg, var(--warning-soft) 0%, var(--surface) 80%); }
.sub-card--expired  { border-color: #f4cccc; background: linear-gradient(180deg, var(--danger-soft) 0%, var(--surface) 80%); }
.sub-card--empty    {
  background: var(--bg-subtle);
  border-style: dashed;
  border-color: var(--line-strong);
  text-align: center;
  padding: var(--s-5) var(--s-4);
  align-items: center;
}

.sub-card__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3);
}
.sub-card__type {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--ink);
}
.sub-card__price {
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sub-card__progress {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.sub-card__progress .progress { flex: 1; }
.sub-card__progress-text { font-weight: var(--fw-semibold); color: var(--ink); white-space: nowrap; }
.sub-card__meta {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}
.sub-card__cta { margin-top: 2px; align-self: flex-start; }

.sub-card__empty-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  color: var(--ink-muted);
  margin-bottom: var(--s-2);
}
.sub-card__empty-icon svg { width: 16px; height: 16px; }

/* =========================================================================
   21. PARENT LINKER CARD
   ========================================================================= */
.parent-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.parent-card__head {
  padding: var(--s-3) var(--s-4);
  display: flex; align-items: center;
  gap: var(--s-3);
  border-bottom: 1px solid var(--line-soft);
}
.parent-card__body {
  padding: var(--s-3) var(--s-4);
  display: flex; flex-direction: column;
  gap: 6px;
}
.parent-card__name {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--ink);
}
.parent-card__field {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-base);
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}
.parent-card__field svg { width: 13px; height: 13px; color: var(--ink-muted); flex-shrink: 0; }
.parent-card__actions {
  display: flex; gap: var(--s-2);
  padding: var(--s-2) var(--s-4) var(--s-3);
  border-top: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

.parent-card--unlinked {
  border-style: dashed;
  border-color: var(--line-strong);
  background: var(--bg-subtle);
}
.parent-card--unlinked .parent-card__head { border-bottom-color: transparent; }

.max-badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
}
.max-badge--active  { background: var(--success-soft); color: var(--success-ink); }
.max-badge--pending { background: var(--warning-soft); color: var(--warning-ink); }
.max-badge svg { width: 9px; height: 9px; }

/* =========================================================================
   22. TRIAL WIZARD (extends existing .modal + .stepper)
   ========================================================================= */
.modal--wizard { width: min(560px, calc(100vw - 32px)); }
.modal--wizard .stepper {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-subtle);
}
.wizard__body { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.wizard__heading {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--s-1);
}
.wizard__sub {
  font-size: var(--fs-sm);
  color: var(--ink-secondary);
  margin-top: -4px;
}

/* Conflict warning panel */
.wizard-warn {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--warning-soft);
  border: 1px solid #f3d9a3;
  border-radius: var(--r-md);
  color: var(--warning-ink);
}
.wizard-warn__icon {
  width: 24px; height: 24px;
  border-radius: var(--r-full);
  background: var(--warning);
  color: white;
  flex-shrink: 0;
  display: grid; place-items: center;
}
.wizard-warn__icon svg { width: 14px; height: 14px; }
.wizard-warn__title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--warning-ink); }
.wizard-warn__body  { font-size: var(--fs-sm); color: var(--warning-ink); opacity: 0.9; margin-top: 2px; }

/* Existing parent summary */
.wizard-existing {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.wizard-existing__name { font-weight: var(--fw-semibold); }
.wizard-existing__meta { font-size: var(--fs-sm); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.wizard-radios { display: flex; flex-direction: column; gap: var(--s-2); }
.wizard-radios .radio {
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  width: 100%;
  align-items: flex-start;
  gap: var(--s-3);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.wizard-radios .radio.is-checked { border-color: var(--brand); background: var(--brand-soft); }
.wizard-radios .radio__label { font-size: var(--fs-base); font-weight: var(--fw-medium); }
.wizard-radios .radio__hint { display: block; font-size: var(--fs-sm); color: var(--ink-muted); margin-top: 2px; font-weight: var(--fw-regular); }

/* Success step */
.wizard-success {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-4);
  background: var(--success-soft);
  border: 1px solid #cdf2d8;
  border-radius: var(--r-md);
}
.wizard-success__icon {
  width: 32px; height: 32px;
  background: var(--success);
  color: white;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  margin-bottom: 2px;
}
.wizard-success__icon svg { width: 16px; height: 16px; }
.wizard-success__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--success-ink); }
.wizard-success__body  { font-size: var(--fs-sm); color: var(--success-ink); opacity: 0.9; }

.code-block {
  font-family: var(--font-num);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  color: var(--ink);
  max-height: 200px;
  overflow-y: auto;
}

/* =========================================================================
   23. STUDENT HERO (right-panel top, not its own component but used)
   ========================================================================= */
.s-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-4);
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: var(--s-4);
  align-items: center;
}
.s-hero__avatar {
  width: 64px; height: 64px;
  border-radius: var(--r-full);
  background: var(--brand-soft);
  color: var(--brand-active);
  display: grid; place-items: center;
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  border: 1px solid var(--brand-soft-2);
  flex-shrink: 0;
}
.s-hero__name {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-tight);
  line-height: 1.1;
}
.s-hero__meta {
  display: flex; align-items: center; gap: var(--s-2);
  margin-top: 6px;
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--ink-secondary);
}
.s-hero__sub {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 4px;
}
.s-hero__actions { display: flex; gap: var(--s-2); align-self: flex-start; }

@media (max-width: 640px) {
  .s-hero { grid-template-columns: auto 1fr; }
  .s-hero__actions { grid-column: 1 / -1; }
  .s-hero__avatar { width: 48px; height: 48px; font-size: var(--fs-lg); }
  .s-hero__name { font-size: var(--fs-xl); }
}

/* =========================================================================
   STUDENTS · RESPONSIVE — explicit mobile rules for every new component
   ========================================================================= */
@media (max-width: 1024px) {
  /* Hero: actions wrap below */
  .s-hero { padding: var(--s-3) var(--s-4); }

  /* Attendance: tighter day cells */
  .att-day { min-width: 26px; }
  .att-cal__head { gap: var(--s-2); }
  .att-pill { padding: 2px 8px 2px 5px; font-size: 11px; }
  .att-pill__icon { width: 16px; height: 16px; }

  /* Messages: hide MSK suffix on tight screens */
  .msg-item__date { font-size: 10px; }
}

@media (max-width: 768px) {
  /* Birthday widget — tighter padding, single column */
  .bday__head { padding: var(--s-2) var(--s-3); }
  .bday__list { padding: 0 4px var(--s-2); max-height: 200px; }
  .bday-card { padding: 8px; gap: 8px; }
  .bday-card__name { font-size: var(--fs-sm); }
  .bday-card__when { padding: 2px 6px; font-size: 10px; }

  /* Student row — slightly bigger touch target */
  .student-row { min-height: 56px; padding: 10px var(--s-2) 10px 0; }
  .student-row .avatar { margin-right: 8px; }
  .student-row__name { font-size: var(--fs-base); }
  .student-row__meta { font-size: 10px; }

  /* Status badge — smaller text */
  .s-status { height: 20px; font-size: var(--fs-xs); padding: 0 8px 0 6px; }

  /* Attendance — smaller grid + tighter report */
  .att-cal__head { flex-direction: column; align-items: stretch; gap: var(--s-2); }
  .att-cal__pills { justify-content: flex-start; }
  .att-day__icon svg { width: 10px; height: 10px; }
  .att-day__num { font-size: 8px; top: 1px; left: 3px; }
  .att-cal__grid { gap: 3px; }
  .att-cal__report { grid-template-columns: 1fr 1fr; gap: var(--s-2) var(--s-3); padding-top: var(--s-2); }
  .att-rep__value { font-size: var(--fs-md); }

  /* Tooltip: position smarter (avoid overflow on left/right edges) */
  .att-day[data-tooltip]:hover::after { font-size: 10px; padding: 4px 6px; }

  /* Coach messages — tighter timeline */
  .msg-tl { gap: var(--s-3); }
  .msg-tl::before { left: 9px; }
  .msg-item { padding-left: 30px; }
  .msg-item__avatar { width: 20px; height: 20px; font-size: 9px; }
  .msg-item__head { gap: 6px; }
  .msg-item__author { font-size: var(--fs-sm); }
  .msg-item__body { font-size: var(--fs-sm); line-height: 1.4; }
  .msg-tl__more { margin-left: 30px; font-size: var(--fs-sm); padding: 5px 10px; }

  /* Subscription card — stack head, full-width cta */
  .sub-card { padding: var(--s-3); }
  .sub-card__head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .sub-card__meta { flex-direction: column; align-items: flex-start; gap: 6px; }
  .sub-card__cta { width: 100%; justify-content: center; }
  .sub-card--empty { padding: var(--s-4) var(--s-3); }

  /* Parent card — wrap actions */
  .parent-card__head { flex-wrap: wrap; gap: var(--s-2); }
  .parent-card__head .max-badge { margin-left: auto; }
  .parent-card__actions { padding: var(--s-2) var(--s-3) var(--s-3); }
  .parent-card__actions .btn { flex: 1; }

  /* Trial wizard: full-width, tighter stepper */
  .modal--wizard .stepper { padding: var(--s-2) var(--s-3); }
  .modal--wizard .stepper .step__line { min-width: 12px; margin: 0 6px; }
  .wizard__body { padding: var(--s-4) var(--s-3); gap: var(--s-3); }
  .wizard-warn { padding: var(--s-3); }
  .wizard-existing { padding: var(--s-2) var(--s-3); }
  .wizard-radios .radio { padding: var(--s-2) var(--s-3); }
  .code-block { font-size: 11px; padding: var(--s-2) var(--s-3); max-height: 160px; }

  /* Form card — already stacks via earlier rule; tighten footer */
  .form-card__footer { padding-top: var(--s-2); }
  .form-card__footer .btn { flex: 1; }

  /* Master-detail: panel head tighter, foot wraps */
  .md-panel-foot { flex-wrap: wrap; gap: 6px; }
  .md-panel-foot .btn { flex: 1; min-width: 0; }
}

@media (max-width: 480px) {
  /* Birthday: hide secondary age line to save space */
  .bday-card__age { display: none; }
  /* Attendance: tooltip below instead of above (so it doesn't clip on edge cases) */
  .att-day[data-tooltip]:hover::after { white-space: normal; max-width: 180px; }
  /* Stepper: hide all labels except current — already in extras.css */
  /* Sub-card: smaller type */
  .sub-card__type { font-size: var(--fs-base); }
}


/* =========================================================================
   ====== PAYMENTS PAGE — Phase 6.3 ========================================
   Components for Payments page. Append-only. Uses existing tokens.
   ========================================================================= */

/* =========================================================================
   21. MONEY — amount utility
   Используется для сумм в ленте операций, карточках ученика, таблицах.
   Знак «+» / «−» — часть значения, не отдельный элемент.
   ========================================================================= */
.amount {
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.amount--positive { color: var(--success-ink); }
.amount--negative { color: var(--danger-ink); }
.amount--muted    { color: var(--ink-muted); font-weight: var(--fw-medium); }
.amount--lg  { font-size: var(--fs-xl); letter-spacing: var(--ls-tight); }
.amount--xl  { font-size: var(--fs-3xl); letter-spacing: var(--ls-tighter); line-height: 1.05; }
.amount__sign { opacity: 0.75; margin-right: 1px; }

/* Operation kind badge — semantic mapping, single source of truth.
   Used in feed + table. Use together with .badge base class. */
.op-badge--payment    { background: var(--success-soft); color: var(--success-ink); }
.op-badge--refund     { background: var(--danger-soft);  color: var(--danger-ink); }
.op-badge--sick       { background: var(--info-soft);    color: var(--info-ink); }
.op-badge--freeze     { background: var(--warning-soft); color: var(--warning-ink); }
.op-badge--transfer   { background: var(--line-soft);    color: var(--ink-secondary); }
.op-badge--charge     { background: var(--bg-subtle);    color: var(--ink-muted); border: 1px dashed var(--line-strong); }

/* =========================================================================
   22. INLINE ALERT — внутри карточки/секции (не overlay-toast)
   Использовать когда надо предупредить о состоянии данных в контексте.
   Цветовая семантика синхронна с .badge / .modal__icon.
   ========================================================================= */
.inline-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  font-size: var(--fs-sm);
  color: var(--ink-secondary);
}
.inline-alert__icon {
  width: 20px; height: 20px;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.inline-alert__icon svg { width: 12px; height: 12px; }
.inline-alert__body { flex: 1; min-width: 0; line-height: 1.4; }
.inline-alert__title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--ink);
  margin-bottom: 2px;
}
.inline-alert__sub { font-size: var(--fs-sm); color: var(--ink-secondary); }
.inline-alert__action {
  background: transparent; border: none; padding: 0;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--brand);
  cursor: pointer;
  margin-top: 4px;
  align-self: flex-start;
}
.inline-alert__action:hover { color: var(--brand-active); }
.inline-alert__close {
  width: 22px; height: 22px;
  background: transparent; border: none;
  border-radius: var(--r-sm);
  color: var(--ink-muted);
  cursor: pointer;
  display: grid; place-items: center;
  flex-shrink: 0;
  margin: -2px -4px -2px 0;
}
.inline-alert__close:hover { background: rgba(0,0,0,0.06); color: var(--ink); }
.inline-alert__close svg { width: 12px; height: 12px; }

.inline-alert--warning {
  background: var(--warning-soft);
  border-color: #f3d9a3;
}
.inline-alert--warning .inline-alert__icon { background: var(--warning); color: white; }
.inline-alert--warning .inline-alert__title { color: var(--warning-ink); }
.inline-alert--warning .inline-alert__sub   { color: var(--warning-ink); opacity: 0.85; }

.inline-alert--danger {
  background: var(--danger-soft);
  border-color: #f4cccc;
}
.inline-alert--danger .inline-alert__icon { background: var(--danger); color: white; }
.inline-alert--danger .inline-alert__title { color: var(--danger-ink); }
.inline-alert--danger .inline-alert__sub   { color: var(--danger-ink); opacity: 0.85; }

.inline-alert--info {
  background: var(--info-soft);
  border-color: #c5d6f5;
}
.inline-alert--info .inline-alert__icon { background: var(--info); color: white; }
.inline-alert--info .inline-alert__title { color: var(--info-ink); }
.inline-alert--info .inline-alert__sub   { color: var(--info-ink); opacity: 0.85; }

.inline-alert--success {
  background: var(--success-soft);
  border-color: #b6e0c4;
}
.inline-alert--success .inline-alert__icon { background: var(--success); color: white; }
.inline-alert--success .inline-alert__title { color: var(--success-ink); }
.inline-alert--success .inline-alert__sub   { color: var(--success-ink); opacity: 0.85; }

.inline-alert--sm { padding: 8px 10px; font-size: var(--fs-xs); }
.inline-alert--sm .inline-alert__icon { width: 16px; height: 16px; }
.inline-alert--sm .inline-alert__icon svg { width: 10px; height: 10px; }

/* =========================================================================
   23. SUBSCRIPTION CARD — COMPACT ROW (вариант §20)
   Для списков «Заканчиваются» и истории абонементов. Одна строка.
   ========================================================================= */
.sub-card--compact {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-3);
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.sub-card--compact + .sub-card--compact { margin-top: 6px; }
.sub-card--compact:hover { background: var(--bg-subtle); }
.sub-card--compact .sub-card__type { font-size: var(--fs-base); font-weight: var(--fw-medium); }
.sub-card--compact .sub-card__meta-line {
  font-size: 11px; color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}
.sub-card--compact__days {
  display: inline-flex; align-items: baseline; gap: 3px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sub-card--compact__days-num {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  line-height: 1;
}
.sub-card--compact__days-unit {
  font-size: 11px;
  color: var(--ink-muted);
  font-weight: var(--fw-medium);
}
.sub-card--compact.is-urgent { border-color: #f4cccc; background: linear-gradient(180deg, var(--danger-soft) 0%, var(--surface) 90%); }
.sub-card--compact.is-urgent .sub-card--compact__days-num { color: var(--danger-ink); }
.sub-card--compact.is-warning { border-color: #f3d9a3; background: linear-gradient(180deg, var(--warning-soft) 0%, var(--surface) 90%); }
.sub-card--compact.is-warning .sub-card--compact__days-num { color: var(--warning-ink); }

/* =========================================================================
   24. OP-FORM — pattern for conditional field groups
   Внесение операции: тип выбирается чипами, поля показываются по data-when.
   В реальном UI .op-form__group[hidden] прячется JS. В showcase убрать hidden.
   ========================================================================= */
.op-form { display: flex; flex-direction: column; gap: var(--s-4); }

/* Operation-type picker — большие радио-карточки */
.op-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.op-picker__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: center;
  transition: border-color var(--t-fast), background var(--t-fast);
  font-family: inherit;
  color: var(--ink-secondary);
}
.op-picker__item:hover { border-color: var(--line-strong); color: var(--ink); }
.op-picker__item.is-selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-active);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.op-picker__icon {
  width: 24px; height: 24px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
}
.op-picker__icon svg { width: 14px; height: 14px; }
.op-picker__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.15;
}
.op-picker__item--payment  .op-picker__icon { background: var(--success-soft); color: var(--success-ink); }
.op-picker__item--refund   .op-picker__icon { background: var(--danger-soft);  color: var(--danger-ink); }
.op-picker__item--sick     .op-picker__icon { background: var(--info-soft);    color: var(--info-ink); }
.op-picker__item--freeze   .op-picker__icon { background: var(--warning-soft); color: var(--warning-ink); }
.op-picker__item--transfer .op-picker__icon { background: var(--line-soft);    color: var(--ink-secondary); }
.op-picker__item.is-selected .op-picker__icon { background: var(--surface); }

@media (max-width: 640px) {
  .op-picker { grid-template-columns: repeat(2, 1fr); }
  .op-picker__item { flex-direction: row; padding: 8px 10px; gap: 8px; text-align: left; justify-content: flex-start; }
}

/* Conditional group — стандартная обёртка для группы полей по типу операции.
   В showcase помечена data-when="..." для документации, в проде поверх — JS toggle. */
.op-form__group {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  position: relative;
}
.op-form__group::before {
  content: 'Поля для: ' attr(data-when);
  position: absolute;
  top: -8px; left: 10px;
  background: var(--surface);
  padding: 0 6px;
  font-size: 10px;
  font-weight: var(--fw-semibold);
  color: var(--ink-muted);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}
.op-form__group[hidden] { display: none !important; }

/* In production these helpers will be invisible — they're documentation cues.
   Add .op-form__group--bare to suppress chrome and just keep gap. */
.op-form__group--bare {
  padding: 0;
  border: none;
  background: transparent;
}
.op-form__group--bare::before { display: none; }

/* =========================================================================
   25. ACTIVITY FEED — лента операций ученика
   Каждая строка: иконка типа + описание + сумма + действия (icon-buttons).
   Списания из посещаемости — без действий, более приглушенно.
   ========================================================================= */
.feed { display: flex; flex-direction: column; }
.feed__day {
  font-size: 10px;
  font-weight: var(--fw-semibold);
  color: var(--ink-muted);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  padding: var(--s-3) var(--s-4) 6px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--line-soft);
}
.feed__day:first-child { padding-top: var(--s-2); }

.feed-item {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--s-4);
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--t-fast);
}
.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: var(--bg-subtle); }
.feed-item:hover .feed-item__actions { opacity: 1; }
.feed-item--charge { background: transparent; }
.feed-item--charge .feed-item__title { color: var(--ink-secondary); }

.feed-item__icon {
  width: 28px; height: 28px;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.feed-item__icon svg { width: 14px; height: 14px; }
.feed-item__icon--payment  { background: var(--success-soft); color: var(--success-ink); }
.feed-item__icon--refund   { background: var(--danger-soft);  color: var(--danger-ink); }
.feed-item__icon--sick     { background: var(--info-soft);    color: var(--info-ink); }
.feed-item__icon--freeze   { background: var(--warning-soft); color: var(--warning-ink); }
.feed-item__icon--transfer { background: var(--line-soft);    color: var(--ink-secondary); }
.feed-item__icon--charge   { background: var(--bg-subtle);    color: var(--ink-muted); border: 1px dashed var(--line-strong); }

.feed-item__body { min-width: 0; }
.feed-item__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  color: var(--ink);
  line-height: 1.3;
}
.feed-item__meta {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.feed-item__meta .badge { transform: translateY(-1px); }

.feed-item__amount {
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  font-size: var(--fs-md);
}

.feed-item__actions {
  display: inline-flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.feed-item__actions .btn--icon { color: var(--ink-muted); }

/* When list is shown on touch / always-visible mode */
.feed--always-actions .feed-item__actions { opacity: 1; }

/* Mobile — actions always visible, charge collapses */
@media (max-width: 768px) {
  .feed-item__actions { opacity: 1; }
  .feed-item { grid-template-columns: 24px 1fr auto; gap: 10px; padding: 10px var(--s-3); }
  .feed-item__amount { grid-column: 2 / 3; grid-row: 2; font-size: var(--fs-sm); margin-top: -4px; }
  .feed-item__actions { grid-column: 3 / 4; grid-row: 1 / 3; }
  .feed-item__icon { width: 24px; height: 24px; }
  .feed-item__icon svg { width: 12px; height: 12px; }
}

/* =========================================================================
   26. BALANCE HERO — крупный блок «баланс ученика» в карточке
   ========================================================================= */
.balance-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  background: linear-gradient(180deg, var(--bg-subtle) 0%, var(--surface) 80%);
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.balance-hero__main { min-width: 0; }
.balance-hero__name {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-tight);
  color: var(--ink);
  line-height: 1.2;
}
.balance-hero__sub {
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.balance-hero__balance {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.balance-hero__balance-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--ink-muted);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .balance-hero { padding: var(--s-3) var(--s-4); }
  .balance-hero__balance { text-align: left; align-items: flex-start; }
}
/* =========================================================================
   ====== SETTINGS PAGE — Phase 6.5 ========================================
   Components for Settings (Конструктор → /v2/settings). Append-only.
   Использует существующие токены. §27-29.
   NB: §21-26 (Payments) планируются к перенумерации — здесь продолжаем
   с §27, чтобы не конфликтовать с уже выпущенными классами.
   ========================================================================= */

/* =========================================================================
   27. TOGGLE — labeled switch form-control (row)
   Полноширинная кликабельная строка: переключатель слева, лейбл + описание
   справа. Для блока «Права» в Сотрудниках и любых булевых настроек.
   Состояния: .is-on / off (база) / .is-disabled. Отличается от голого
   .switch (§5) тем, что это весь form-control с лейблом и hit-area.
   ========================================================================= */
.toggle {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.toggle:hover { border-color: var(--line-strong); }
.toggle:focus-visible { outline: none; box-shadow: var(--sh-focus); border-color: var(--brand); }

.toggle__control {
  flex-shrink: 0;
  margin-top: 1px;
  width: 32px; height: 18px;
  background: var(--line-strong);
  border-radius: var(--r-full);
  position: relative;
  transition: background var(--t-fast);
}
.toggle__control::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: white;
  border-radius: var(--r-full);
  box-shadow: var(--sh-sm);
  transition: transform var(--t-fast);
}
.toggle.is-on .toggle__control { background: var(--brand); }
.toggle.is-on .toggle__control::after { transform: translateX(14px); }

.toggle__text { min-width: 0; flex: 1; }
.toggle__label {
  display: block;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: var(--ink);
  line-height: 1.3;
}
.toggle__desc {
  display: block;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  margin-top: 2px;
  line-height: 1.35;
}

.toggle.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg-subtle);
}
.toggle.is-disabled:hover { border-color: var(--line); }
.toggle.is-disabled .toggle__control { background: var(--line-strong); }
.toggle.is-disabled.is-on .toggle__control { background: var(--brand-soft-2); }

/* Borderless variant — для плотных списков прав внутри группы */
.toggle--bare {
  border: none;
  border-radius: 0;
  padding: 8px 0;
  background: transparent;
}
.toggle--bare:hover { border: none; background: transparent; }
.toggle-group {
  display: flex;
  flex-direction: column;
}
.toggle-group .toggle--bare + .toggle--bare { border-top: 1px solid var(--line-soft); }

/* =========================================================================
   28. PASSWORD INPUT (.input--password) — eye show/hide + «Сгенерировать»
   Только при СОЗДАНИИ сотрудника. При редактировании поля пароля нет —
   отдельная кнопка «Сменить пароль» открывает мелкую модалку.
   Структура: .pw-field > (.pw-field__wrap > input.input--password + eye) + .btn «Сгенерировать»
   ========================================================================= */
.pw-field {
  display: flex;
  gap: var(--s-2);
  align-items: stretch;
}
.pw-field__wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.input--password {
  width: 100%;
  padding-right: 34px;
  font-family: var(--font-num);
  letter-spacing: 0.06em;
}
.input--password::placeholder { letter-spacing: 0; font-family: var(--font-sans); }
.pw-field__eye {
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: var(--ink-muted);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.pw-field__eye:hover { background: var(--line-soft); color: var(--ink); }
.pw-field__eye svg { width: 15px; height: 15px; }
.pw-field__gen { flex-shrink: 0; white-space: nowrap; }

@media (max-width: 480px) {
  .pw-field { flex-direction: column; }
  .pw-field__gen { width: 100%; }
}

/* =========================================================================
   29. SEGMENTED FIELD — выбор роли COACH / MANAGER
   Решение: НЕ плодим новый компонент. Переиспользуем .btn-group / .btn-seg
   (§4 components.css) — это и есть сегментированный контрол. Добавлен лишь
   модификатор .btn-group--block, чтобы сегменты тянулись на всю ширину
   form-row (две равные половины). Нативный <select> остаётся для длинных
   списков; для бинарного выбора роли сегмент нагляднее.
   ========================================================================= */
.btn-group--block {
  display: flex;
  width: 100%;
}
.btn-group--block .btn-seg {
  flex: 1;
  height: 28px;
}

/* =========================================================================
   30. SETTINGS LAYOUT — vertical tabs (nav) + panel
   Вертикальные вкладки слева на десктопе; на мобиле .tabs--vertical уже
   флипается в горизонтальный скролл (см. §2 mobile). Здесь — обёртка-грид.
   ========================================================================= */
.set-layout {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: var(--s-7);
  align-items: start;
  max-width: 1100px;
}
.set-nav {
  position: sticky;
  top: calc(var(--header-h) + var(--s-6));
}
.set-panel { min-width: 0; }

/* Panel header inside a tab: title + primary action (+ Добавить) */
.set-panel__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}
.set-panel__title { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: var(--ls-tight); }
.set-panel__sub { font-size: var(--fs-sm); color: var(--ink-muted); margin-top: 2px; max-width: 52ch; }
.set-tabpanel[hidden] { display: none; }

/* Read-only field (slug / type в Профиле) — визуально приглушено */
.field--readonly .input,
.input--readonly {
  background: var(--bg-subtle);
  color: var(--ink-muted);
  border-color: var(--line);
  cursor: default;
}
.field--readonly .field__label { color: var(--ink-muted); }
.input--readonly:focus { box-shadow: none; border-color: var(--line); }

@media (max-width: 900px) {
  .set-layout {
    grid-template-columns: 1fr;
    gap: var(--s-4);
  }
  .set-nav { position: static; }
}

/* =========================================================================
   31. BOTTOM-SHEET — модалка превращается в нижний лист на мобиле
   §3 Form Modal / §4 Confirm используют .modal. На узких экранах
   .modal--sheet прижимается к низу и тянется на всю ширину (full-screen
   при длинном контенте). Десктоп — поведение не меняется.
   ========================================================================= */
@media (max-width: 600px) {
  .modal.modal--sheet {
    left: 0; right: 0; bottom: 0; top: auto;
    transform: translateY(100%);
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  .modal.modal--sheet.is-open { transform: translateY(0); }
  .modal.modal--sheet .modal__footer { border-radius: 0; }
}


/* =========================================================================
   ====== ANALYTICS PAGE — Phase 6.4 =======================================
   Components for Analytics (/v2/analytics). Append-only. Только токены DS.
   §32-34. §8 даёт chart-shells + .metric + .breakdown-row — переиспользуем;
   здесь добавляем то, чего в каталоге нет: тренд-график, воронку, disclosure.
   ========================================================================= */

/* =========================================================================
   32. TREND CHART — динамика по месяцам (выручка + прибыль)
   Резиновый bar-chart: высота столбца = выручка, заполненная нижняя
   часть = прибыль (остаток = расходы). 6 или 12 месяцев. Резиновый,
   читается на узком экране. Обёртка — §8 chart-card.
   ========================================================================= */
.trend { display: flex; flex-direction: column; }
.trend__plot {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
}
.trend__y {
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: 10px; color: var(--ink-muted);
  text-align: right; font-variant-numeric: tabular-nums;
  padding-bottom: 20px;
}
.trend__bars {
  position: relative;
  display: flex; align-items: flex-end; gap: 2%;
  height: 220px;
  border-bottom: 1px solid var(--line);
  background-image: repeating-linear-gradient(to top, var(--line-soft) 0 1px, transparent 1px 25%);
}
.trend__col {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  position: relative; height: 100%;
}
.trend__bar {
  width: 64%; max-width: 40px;
  background: var(--brand-soft);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  position: relative;
  transition: filter var(--t-fast);
}
.trend__bar-fill {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--brand);
  border-radius: 0;
}
.trend__col:hover .trend__bar { filter: brightness(0.96); }
.trend__x {
  display: flex; gap: 2%;
  padding-left: 66px;
  margin-top: 6px;
}
.trend__x span {
  flex: 1; min-width: 0; text-align: center;
  font-size: 10px; color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Hover tooltip */
.trend__col[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: white;
  font-size: 11px; line-height: 1.4; font-weight: var(--fw-regular);
  padding: 6px 9px; border-radius: var(--r-sm);
  white-space: nowrap; z-index: 30; pointer-events: none;
  box-shadow: var(--sh-md);
}
.trend__col[data-tip]:hover::before {
  content: ''; position: absolute; bottom: calc(100% + 1px); left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--ink); z-index: 30;
}
@media (max-width: 768px) {
  .trend__bars { height: 168px; gap: 1.5%; }
  .trend__plot { grid-template-columns: 40px 1fr; gap: 6px; }
  .trend__x { padding-left: 46px; }
  .trend__bar { width: 72%; }
  .trend__col[data-tip]:hover::after { white-space: normal; max-width: 150px; }
  /* На 12 мес — прячем каждую вторую подпись чтобы не слипались */
  .trend--dense .trend__x span:nth-child(even) { visibility: hidden; }
}

/* =========================================================================
   33. FUNNEL — воронка конверсии (Пробные → Платные → %)
   Две полосы (пробных = 100%, платных = conversionRate%) + итоговый
   крупный процент. Без декоративных нулей: если trials=0 — показываем
   пустое состояние, не воронку.
   ========================================================================= */
.funnel { display: flex; flex-direction: column; gap: var(--s-3); }
.funnel__step {
  display: grid;
  grid-template-columns: 168px 1fr;
  align-items: center;
  gap: var(--s-4);
}
.funnel__label {
  font-size: var(--fs-sm); color: var(--ink-secondary);
  font-weight: var(--fw-medium);
}
.funnel__label small { display: block; color: var(--ink-muted); font-weight: var(--fw-regular); font-size: var(--fs-xs); margin-top: 1px; }
.funnel__track {
  height: 44px; background: var(--bg-subtle);
  border-radius: var(--r-md); position: relative; overflow: hidden;
}
.funnel__bar {
  height: 100%;
  border-radius: var(--r-md);
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px;
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: width var(--t-slower) var(--ease);
  min-width: 92px;
}
.funnel__bar--full { background: var(--brand-soft); color: var(--brand-active); }
.funnel__bar--conv { background: var(--brand); color: white; }
.funnel__bar small { font-weight: var(--fw-regular); opacity: 0.85; }
.funnel__result {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--success-soft) 0%, var(--surface) 90%);
}
.funnel__result-num {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-tighter);
  line-height: 1;
  color: var(--success-ink);
  font-variant-numeric: tabular-nums;
}
.funnel__result-label { font-size: var(--fs-sm); color: var(--ink-secondary); }
.funnel__result-label b { color: var(--ink); }
@media (max-width: 600px) {
  .funnel__step { grid-template-columns: 1fr; gap: 4px; }
  .funnel__result { flex-direction: column; align-items: flex-start; gap: var(--s-2); }
}

/* =========================================================================
   34. DISCLOSURE — раскрывающийся блок (native <details>)
   Лёгкий хелпер на <details>/<summary> — без JS. Для «Расходы (детали)»
   и списка «Мои занятия» в режиме тренера.
   ========================================================================= */
.disclosure {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.disclosure + .disclosure { margin-top: var(--s-3); }
.disclosure > summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--ink);
  user-select: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover { background: var(--bg-subtle); }
.disclosure > summary:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.disclosure__summary-meta {
  margin-left: auto;
  font-weight: var(--fw-medium);
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
}
.disclosure__chev {
  width: 16px; height: 16px; flex-shrink: 0;
  color: var(--ink-muted);
  transition: transform var(--t-base) var(--ease);
}
.disclosure[open] > summary .disclosure__chev { transform: rotate(180deg); }
.disclosure__body {
  padding: var(--s-4);
  border-top: 1px solid var(--line-soft);
}
.disclosure__body--flush { padding: 0; }

/* =========================================================================
   35. BOTTOM NAVIGATION — мобильная навигация под роль
   На десктопе (≥1024px) роль навигируется боковым меню (.sidebar). На телефоне
   (<1024px) показывается нижняя панель: до 4 главных пунктов + «Ещё».
   ========================================================================= */
.bottomnav {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottomnav__item {
  appearance: none; background: none; border: none; cursor: pointer;
  font-family: inherit; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 8px 4px 9px;
  min-height: 56px;
  color: var(--ink-muted);
  position: relative;
  transition: color var(--t-fast);
}
.bottomnav__item:hover { color: var(--ink-secondary); }
.bottomnav__icon { width: 23px; height: 23px; flex-shrink: 0; }
.bottomnav__icon svg { width: 100%; height: 100%; stroke-width: 2; }
.bottomnav__label {
  font-size: 10.5px; font-weight: var(--fw-medium); line-height: 1;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bottomnav__item[aria-current="page"] { color: var(--brand); }
.bottomnav__item[aria-current="page"] .bottomnav__label { font-weight: var(--fw-semibold); }
.bottomnav__item[aria-current="page"]::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 2px; border-radius: 0 0 var(--r-full) var(--r-full);
  background: var(--brand);
}
.bottomnav__item:focus-visible { outline: none; box-shadow: var(--sh-focus); border-radius: var(--r-sm); }
.bottomnav__badge {
  position: absolute; top: 6px; left: 50%; margin-left: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  display: none; align-items: center; justify-content: center;
  background: var(--brand); color: white;
  border: 2px solid var(--surface);
  border-radius: var(--r-full);
  font-size: 9px; font-weight: var(--fw-bold); line-height: 1;
}
.bottomnav__badge.is-on { display: inline-flex; }
.bottomnav--app { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; }

.bottomnav-scrim {
  position: fixed; inset: 0; z-index: 88;
  background: rgba(17, 17, 17, .28);
  opacity: 0;
  transition: opacity var(--t-base) var(--ease);
}
.bottomnav-scrim.is-open { opacity: 1; }
.bottomnav-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 91;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--sh-lg);
  padding: 8px var(--s-4) calc(12px + env(safe-area-inset-bottom, 0));
  transform: translateY(110%);
  transition: transform var(--t-base) var(--ease);
}
.bottomnav-sheet.is-open { transform: translateY(0); }
.bottomnav-sheet__grip {
  width: 38px; height: 4px; margin: 0 auto var(--s-3);
  border-radius: var(--r-full);
  background: var(--line);
}
.bottomnav-sheet__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--ink);
  margin-bottom: var(--s-2);
}
.bottomnav-sheet__body { display: grid; gap: 2px; }
.bottomnav-more__item {
  min-height: 48px;
  display: flex; align-items: center; gap: var(--s-3);
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--r-md);
  padding: 0 var(--s-3);
  font-weight: var(--fw-medium);
}
.bottomnav-more__item:hover { background: var(--bg-subtle); }
.bottomnav-more__item[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }
.bottomnav-more__icon {
  width: 22px; height: 22px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.bottomnav-more__icon svg { width: 100%; height: 100%; stroke-width: 2; }

@media (min-width: 1024px) {
  .bottomnav--app,
  .bottomnav-scrim,
  .bottomnav-sheet { display: none; }
}
@media (max-width: 1023px) {
  body.has-bottomnav .sidebar,
  body.has-bottomnav .sidebar-scrim,
  body.has-bottomnav .topbar__hamburger { display: none; }
  body.has-bottomnav .main {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0));
  }
}
