:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --card-soft: #f9fafb;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --link: #2563eb;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);

  --attended-bg: #d1fae5;
  --attended-text: #065f46;
  --missed-bg: #fee2e2;
  --missed-text: #991b1b;
  --booked-bg: #e0e7ff;
  --booked-text: #3730a3;

  --btn-attend-bg: #059669;
  --btn-attend-hover: #047857;
  --btn-miss-bg: #dc2626;
  --btn-miss-hover: #b91c1c;
}


  :root.dark{
    --bg: #0f172a;
    --card: #111827;
    --card-soft: #1f2937;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --border: #374151;
    --link: #60a5fa;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);

    --attended-bg: #064e3b;
    --attended-text: #6ee7b7;
    --missed-bg: #450a0a;
    --missed-text: #fca5a5;
    --booked-bg: #1e1b4b;
    --booked-text: #a5b4fc;

    --btn-attend-bg: #059669;
    --btn-attend-hover: #10b981;
    --btn-miss-bg: #dc2626;
    --btn-miss-hover: #ef4444;
  }


* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  min-height: 100vh;
  color: var(--text);
}

.wrap {
  max-width: 1000px;
  margin: 30px auto;
  padding: 20px;
}

.card {
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 20px 52px rgba(74, 62, 130, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(28px) saturate(178%);
  -webkit-backdrop-filter: blur(28px) saturate(178%);
}


  :root.dark .card{
    background: rgba(17, 24, 39, 0.62);
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 0 20px 52px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  }


h1 {
  margin-top: 0;
  font-size: 32px;
  color: var(--text);
}

h2 {
  color: var(--text);
}

.topnav {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.topnav::-webkit-scrollbar { display: none; }

.topnav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  white-space: nowrap;
  text-decoration: none;
  color: var(--link);
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
}

/* Home icon — slightly larger, tighter padding */
.nav-home {
  font-size: 18px;
  padding: 6px 10px;
  min-width: 38px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.item {
  background: var(--card-soft);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border);
}

.label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.value-small {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.lesson-meta {
  margin-top: 10px;
  color: var(--text);
}

.lesson-meta div {
  margin-bottom: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

th {
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
}
/* The finance report table uses Title-case labels; opt out of the
   global uppercase to save horizontal space and match the data style. */
.finance-summary-table th {
  text-transform: none;
}

td a {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
}

td a:hover {
  text-decoration: underline;
}

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

  table, thead, tbody, th, td, tr {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 12px;
    background: var(--card);
  }

  td {
    border: none;
    padding: 8px 0;
  }

  td::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 2px;
    text-transform: uppercase;
  }
}

.action-links a {
  display: block;
  margin-bottom: 10px;
}

.action-links a:last-child {
  margin-bottom: 0;
}

a.active {
  color: #fff;
  font-weight: 600;
}

/* ── Сторінка Today ─────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.dashboard-hero {
  align-items: center;
}

.dashboard-hero > div {
  min-width: 0;
}

.dashboard-hero-month {
  display: block;
  margin-top: 10px;
}

.dashboard-liza-frame {
  width: clamp(96px, 14vw, 142px);
  height: clamp(96px, 14vw, 142px);
  display: block;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 50%;
}

.dashboard-liza-photo {
  width: clamp(96px, 14vw, 142px);
  height: clamp(96px, 14vw, 142px);
  display: block;
  object-fit: cover;
  object-position: 50% 34%;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.52);
  box-shadow: 0 20px 52px rgba(50, 87, 166, 0.20), inset 0 1px 0 rgba(255,255,255,0.62);
  background: rgba(255,255,255,0.30);
  box-sizing: border-box;
}

:root.dark .dashboard-liza-photo {
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 22px 56px rgba(0,0,0,0.38), 0 0 0 1px rgba(96,165,250,0.14);
}

.page-header h1 {
  margin: 0;
}

.page-meta {
  font-size: 15px;
  color: var(--muted);
}

.page-date {
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
}

/* Блок однієї групи */
.group-block {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

/* Шапка групи */
.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--card-soft);
  border-bottom: 2px solid var(--border);
}

.group-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.group-time {
  font-size: 26px;
  font-weight: 800;
  color: var(--link);
  font-variant-numeric: tabular-nums;
  min-width: 58px;
}

.group-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.group-coach {
  font-size: 14px;
  color: var(--muted);
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.group-count {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

/* Таблиця всередині блоку */
.group-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

.group-table th {
  padding: 10px 20px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

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

.group-table tbody tr:last-child td {
  border-bottom: none;
}

/* Рядок що вже відмічений — кольорове підсвічування */
.student-row.status-attended {
  background: rgba(5, 150, 105, 0.12);
}
.student-row.status-missed {
  background: rgba(220, 38, 38, 0.12);
}
/* Приглушення неактивної кнопки — перенесено у блок кнопок нижче */

/* Посилання на учня */
.student-link {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.student-link:hover {
  color: var(--link);
  /* underline only the text part, not the avatar circle */
  text-decoration: none;
}
.student-link:hover .student-name-text {
  text-decoration: underline;
}

/* Кругла аватарка */
.student-avatar-mini {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  overflow: hidden;
  background: rgba(37, 99, 235, 0.10);
  border: 1.5px solid rgba(37, 99, 235, 0.16);
  text-decoration: none !important;
  /* No underline ever — even when parent link is hovered */
  -webkit-text-decoration: none !important;
}

.student-avatar-mini img,
.student-avatar-display img,
.avatar-upload-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

  :root.dark .student-avatar-mini{
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.22);
  }

  :root.dark .student-avatar-display,
  :root.dark .avatar-upload-preview {
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.22);
  }


/* Бейджики статусу */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-attended {
  background: var(--attended-bg);
  color: var(--attended-text);
}
.badge-missed {
  background: var(--missed-bg);
  color: var(--missed-text);
}
.badge-booked {
  background: var(--booked-bg);
  color: var(--booked-text);
}

/* ── Кнопки відмітки ──────────────────────────────────────── */
.attend-btns {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.attend-btns-wrap {
  display: flex;
  justify-content: flex-end;
}
.attend-past-actions,
.attend-future-actions {
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  text-align: center;
  flex: 1;        /* рівна ширина кнопок всередині flex-контейнера */
  min-width: 0;
}

/* Не активна кнопка «Був» — м'який зелений контур */
.btn-attend {
  background: rgba(5, 150, 105, 0.10);
  color: #059669;
  border: 1.5px solid rgba(5, 150, 105, 0.30);
}
.btn-attend:hover {
  background: rgba(5, 150, 105, 0.18);
  border-color: rgba(5, 150, 105, 0.55);
  color: #047857;
  text-decoration: none;
}
/* Активна: яскраво-зелена заливка */
.btn-attend.btn-active {
  background: var(--btn-attend-bg);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--btn-attend-bg);
}

/* Не активна кнопка «Не був» — м'який червоний контур */
.btn-miss {
  background: rgba(220, 38, 38, 0.10);
  color: #dc2626;
  border: 1.5px solid rgba(220, 38, 38, 0.30);
}
.btn-miss:hover {
  background: rgba(220, 38, 38, 0.18);
  border-color: rgba(220, 38, 38, 0.55);
  color: #b91c1c;
  text-decoration: none;
}
/* Активна: яскраво-червона заливка */
.btn-miss.btn-active {
  background: var(--btn-miss-bg);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--btn-miss-bg);
}


  :root.dark .btn-attend{
    background: rgba(5, 150, 105, 0.14);
    color: #34d399;
    border-color: rgba(5, 150, 105, 0.30);
  }
  :root.dark .btn-attend:hover{ background: rgba(5, 150, 105, 0.22); border-color: rgba(5, 150, 105, 0.55); color: #6ee7b7; }
  :root.dark .btn-attend.btn-active{ background: var(--btn-attend-bg); color: #fff; border-color: transparent; box-shadow: 0 0 0 3px #1f2937, 0 0 0 5px var(--btn-attend-bg); }

  :root.dark .btn-miss{
    background: rgba(220, 38, 38, 0.14);
    color: #f87171;
    border-color: rgba(220, 38, 38, 0.30);
  }
  :root.dark .btn-miss:hover{ background: rgba(220, 38, 38, 0.22); border-color: rgba(220, 38, 38, 0.55); color: #fca5a5; }
  :root.dark .btn-miss.btn-active{ background: var(--btn-miss-bg); color: #fff; border-color: transparent; box-shadow: 0 0 0 3px #1f2937, 0 0 0 5px var(--btn-miss-bg); }


/* Приглушуємо неактивну кнопку коли вже є відмітка — тепер через opacity */
.student-row.status-attended .btn-miss,
.student-row.status-missed  .btn-attend {
  opacity: 0.30;
}

/* Кнопка «Не прийде» — спокійна синя, ненав'язлива */
.btn-absent {
  background: rgba(99, 102, 241, 0.08);
  color: #4f46e5;
  border: 1.5px solid rgba(99, 102, 241, 0.22);
  cursor: pointer;
  font-family: inherit;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn-absent:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.40);
}

  :root.dark .btn-absent{
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.28);
  }
  :root.dark .btn-absent:hover{ background: rgba(99, 102, 241, 0.20); border-color: rgba(99, 102, 241, 0.45); }


/* Кнопка скасування відмітки */
.btn-reset {
  background: var(--card-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 7px 10px;
  font-size: 16px;
  line-height: 1;
}
.btn-reset:hover {
  background: var(--border);
  color: var(--text);
  text-decoration: none;
}

/* Колонка кнопок */
.col-actions { white-space: nowrap; }
.attend-cell { text-align: right; white-space: nowrap; }

/* Бейдж і нотатка для оголошеної відсутності */
.attend-declared {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
}
.badge-declared {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.075);
  border: 1px solid rgba(245, 158, 11, 0.24);
  color: #a16207;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.attend-declared:hover .badge-declared {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.36);
}

  :root.dark .badge-declared{
    background: rgba(245, 158, 11, 0.11);
    border-color: rgba(245, 158, 11, 0.24);
    color: #f8d489;
  }
  :root.dark .attend-declared:hover .badge-declared{ background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.34); }

.declared-note {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  text-align: right;
  max-width: 160px;
}

/* Рядок з оголошеною відсутністю — спокійний жовтий натяк */
.student-row.status-declared {
  background: rgba(245, 158, 11, 0.055);
}

/* Прихований елемент */
.hidden { display: none !important; }

/* ── Модал «Не прийде» (Liquid Glass) ─────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }

.modal-glass {
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.70);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(60, 40, 120, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.90);
  padding: 28px 24px 24px;
  max-width: 400px;
  width: 100%;
  position: relative;
}
.modal-glass-small {
  max-width: 360px;
}

  :root.dark .modal-glass{
    background: rgba(18, 18, 36, 0.84);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  }


.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: transparent; border: none;
  cursor: pointer; font-size: 17px;
  color: var(--muted); padding: 6px; line-height: 1;
  border-radius: 6px;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--border); color: var(--text); }

.modal-title {
  font-size: 17px; font-weight: 700;
  margin: 0 0 2px 0; color: var(--text);
}
.modal-subtitle {
  font-size: 13px; color: var(--muted);
  margin: 0 0 18px 0;
}
.modal-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: -6px 0 18px 0;
}

@media (max-width: 600px) {
  .modal-backdrop {
    align-items: flex-start;
    overflow-y: auto;
    padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  }

  .modal-glass {
    margin: 0 auto;
    max-width: none;
  }

  .modal-actions {
    align-items: stretch;
  }

  .modal-actions button {
    flex: 1;
  }
}

.modal-options {
  display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px;
}
.modal-option {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 13px; border-radius: 12px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.modal-option:hover {
  border-color: rgba(37, 99, 235, 0.46);
  background: rgba(37, 99, 235, 0.05);
}
.modal-option.selected {
  border-color: rgba(37, 99, 235, 0.76);
  background: rgba(37, 99, 235, 0.08);
}
.modal-option input[type="radio"] {
  margin-top: 3px; accent-color: #2563eb; flex-shrink: 0;
}
.modal-option-title { font-size: 14px; font-weight: 600; color: var(--text); }
.modal-option-desc  { font-size: 12px; color: var(--muted); margin-top: 1px; }

.modal-note-label {
  font-size: 13px; font-weight: 600; color: var(--text);
  display: block; margin-bottom: 6px;
}
.modal-note-input {
  width: 100%; padding: 9px 12px; border-radius: 10px;
  border: 1.5px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text); font-size: 14px;
  resize: none; margin-bottom: 18px;
  font-family: inherit; box-sizing: border-box;
}
.modal-note-input:focus { outline: none; border-color: rgba(37, 99, 235, 0.58); }

  :root.dark .modal-note-input{ background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.14); }


.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-modal-confirm {
  background: linear-gradient(145deg, #60a5fa, #2563eb); color: #fff; border: none;
  padding: 10px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  transition: background 0.15s;
}
.btn-modal-confirm:hover { background: linear-gradient(145deg, #7ab6ff, #1d4ed8); }
.btn-modal-cancel {
  background: var(--card-soft); color: var(--muted);
  border: 1px solid var(--border);
  padding: 10px 16px; border-radius: 10px;
  font-size: 14px; cursor: pointer;
  transition: background 0.15s;
}
.btn-modal-cancel:hover { background: var(--border); color: var(--text); }

.muted-text {
  font-size: 13px;
  color: var(--muted);
}

/* Назва групи як текст (для нон-групових секцій) */
.group-time-text {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

/* Пілюля з кількістю учнів у шапці */
.group-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 14px;
  background: var(--link);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

/* Залишок занять по групі у шапці */
.group-lessons-left {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* Бейдж попередження (1-2 заняття) */
.badge-warn {
  background: #fef3c7;
  color: #92400e;
}

  :root.dark .badge-warn{
    background: #451a03;
    color: #fcd34d;
  }


/* Тег снаряду для індивідуальних */
.apparatus-tag {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--card-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}

/* Дата закінчення абонементу */
.end-date {
  font-size: 14px;
  color: var(--muted);
}

/* Вирівнювання колонок таблиці */
.col-center {
  text-align: center;
}

.col-right {
  text-align: right;
}

/* ── Акордеон (details / summary) ───────────────────────── */

/* Скасовуємо нативний маркер у всіх браузерах */
details > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::marker              { content: ''; font-size: 0; }
/* iOS Safari fallback */
details > summary::before              { content: none; display: none; }

.collapse-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(120, 160, 255, 0.28);
  background: rgba(255, 255, 255, 0.46);
  color: rgba(78, 105, 148, 0.78);
  box-shadow:
    0 6px 18px rgba(70, 100, 180, 0.12),
    inset 1px 1px 0 rgba(255, 255, 255, 0.60);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  font-size: 0;
  line-height: 1;
  transition-property: transform, background, border-color, color, box-shadow;
}

.collapse-chevron::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
}
summary:hover .collapse-chevron {
  background: rgba(96, 165, 250, 0.16);
  border-color: rgba(96, 165, 250, 0.46);
  color: var(--link);
  box-shadow:
    0 8px 22px rgba(37, 99, 235, 0.18),
    inset 1px 1px 0 rgba(255, 255, 255, 0.64);
}
details[open] > summary .collapse-chevron {
  transform: rotate(180deg);
}


  :root.dark .collapse-chevron{
    background: rgba(20, 30, 60, 0.55);
    border-color: rgba(100, 150, 255, 0.22);
    color: rgba(190, 219, 254, 0.76);
    box-shadow:
      0 8px 22px rgba(0, 0, 0, 0.28),
      inset 1px 1px 0 rgba(180, 210, 255, 0.10);
  }

  :root.dark summary:hover .collapse-chevron{
    background: rgba(96, 165, 250, 0.16);
    border-color: rgba(125, 181, 255, 0.46);
    color: #bfdbfe;
    box-shadow:
      0 10px 26px rgba(37, 99, 235, 0.20),
      inset 1px 1px 0 rgba(180, 210, 255, 0.16);
  }


/* ── Скасовуємо загальну мобільну верстку таблиць для group-table ── */
/* (загальний @media 700px перетворює всі tr на картки з border-radius) */
@media (max-width: 700px) {
  .group-table                    { display: table; }
  .group-table thead,
  .group-table tbody               { display: table-row-group; }
  .group-table thead               { display: none; }
  .group-table tr                  { display: table-row; border: none; border-radius: 0; margin-bottom: 0; background: transparent; padding: 0; }
  .group-table th,
  .group-table td                  { display: table-cell; }
  .group-table td::before          { content: none; display: none; }
  .group-table tbody tr:last-child td { border-bottom: none; }
}

/* ── Компактна мобільна верстка рядків group-table ─────── */
@media (max-width: 600px) {
  /* Шапка: залишається рядком, менші відступи */
  .group-header {
    padding: 12px 16px;
  }
  .group-header-left {
    gap: 10px;
  }

  /* Рядки — горизонтальний flex */
  .group-table tbody tr {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border) !important;
    border-radius: 0 !important;
    margin-bottom: 0 !important;
    background: transparent !important;
  }
  .group-table tbody tr:last-child {
    border-bottom: none !important;
  }

  /* Усі комірки — flex-елементи */
  .group-table tbody td {
    flex: 0 0 auto;
    padding: 0 !important;
    border: none !important;
    vertical-align: middle;
  }
  .group-table tbody td::before {
    content: none !important;
    display: none !important;
  }

  /* Ім'я учня — займає решту простору, обрізається при переповненні */
  .group-table tbody td:first-child {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Колонка «Залишок» — фіксована ширина, щоб бейджики завжди були в одній колонці */
  .group-table tbody td.col-center {
    flex: 0 0 44px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  /* Колонка «Діє до» — фіксована ширина, вирівнювання праворуч */
  .group-table tbody td.col-right {
    flex: 0 0 56px;
    text-align: right;
  }

  .group-table tbody td .end-date {
    font-size: 13px;
    white-space: nowrap;
  }
  .group-table tbody td .apparatus-tag {
    font-size: 11px;
    padding: 2px 6px;
  }

  .attend-btns {
    gap: 6px;
  }
}

/* ── Мобільна верстка рядків сторінки Today ─────────────── */
@media (max-width: 700px) {
  /* Скасовуємо загальний картковий стиль для student-row */
  .student-row {
    border-radius: 0 !important;
    margin-bottom: 0 !important;
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 10px 16px !important;
  }
  .student-row:last-child {
    border-bottom: none !important;
  }
  .student-row td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
  }
  .student-row td::before {
    display: none !important;
    content: none !important;
  }
  /* Ім'я на окремому рядку */
  .student-row .student-link {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
  }
  /* Кнопки трохи менші на мобільному */
  .student-row .btn {
    padding: 6px 11px;
    font-size: 12px;
  }
  /* Повертаємо кольори рядка (перебиваємо background:transparent!important з 600px) */
  .student-row.status-attended {
    background: rgba(5, 150, 105, 0.12) !important;
  }
  .student-row.status-missed {
    background: rgba(220, 38, 38, 0.12) !important;
  }

  .group-table tbody tr.student-row {
    display: flex !important;
    align-items: center;
    gap: 8px;
  }

  .group-table tbody tr.student-row td:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  .group-table tbody tr.student-row td.attend-cell {
    display: flex !important;
    flex: 0 0 auto;
    justify-content: flex-end;
    max-width: 46%;
  }

  .group-table tbody tr.student-row .student-link {
    display: flex;
    align-items: center;
    min-width: 0;
    margin-bottom: 0;
  }

  .group-table tbody tr.student-row .student-name-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .group-table tbody tr.student-row .attend-btns {
    gap: 5px;
  }

  .group-table tbody tr.student-row .btn {
    min-width: 58px;
    padding: 6px 7px;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .group-table tbody tr.student-row {
    gap: 6px;
    padding-left: 12px !important;
    padding-right: 8px !important;
  }

  .group-table tbody tr.student-row td.attend-cell {
    max-width: 48%;
  }

  .group-table tbody tr.student-row .btn {
    min-width: 52px;
    padding: 6px;
  }
}

@media (max-width: 560px) {
  .group-table,
  .group-table tbody {
    display: block;
    width: 100%;
  }

  .group-table tbody tr.student-row {
    --journal-actions-width: 176px;
    display: block !important;
    position: relative;
    padding-right: 10px; /* ≈ 1/3 менше від 16px за замовчуванням */
    width: 100%;
    min-height: 58px;
    box-sizing: border-box;
    overflow: hidden;
  }

  /* Лева частина: аватар + ім'я.
     iOS Safari has render bugs with mask-image on flex items inside <tr>.
     Use rock-solid text-overflow:ellipsis approach with flex:1 1 0%
     to guarantee the name never overlaps the buttons on any browser. */
  .group-table tbody tr.student-row td:first-child {
    display: block !important;
    min-width: 0;
    width: calc(100% - var(--journal-actions-width) - 8px);
    max-width: calc(100% - var(--journal-actions-width) - 8px);
    overflow: hidden;
  }

  .group-table tbody tr.student-row .student-link {
    display: flex;
    align-items: center;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .group-table tbody tr.student-row .student-avatar-mini {
    flex: 0 0 26px;
  }

  .group-table tbody tr.student-row .student-name-text {
    display: block;
    flex: 1 1 0%;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* Buffer between name end and the action buttons */
    padding-right: 6px;
  }

  /* Правая часть: зона действий */
  .group-table tbody tr.student-row td.attend-cell {
    display: flex !important;
    position: absolute;
    top: 50%;
    right: 8px;
    width: var(--journal-actions-width);
    transform: translateY(-50%);
    justify-content: flex-end;
    max-width: none;
    min-width: 0;
    z-index: 1;
  }

  /* Сценарий с двумя кнопками: Був / Не був */
  .group-table tbody tr.student-row .attend-past-actions {
    display: grid;
    grid-template-columns: 84px 86px;
    gap: 6px;
    width: var(--journal-actions-width);
    flex: 0 0 var(--journal-actions-width);
  }

  .group-table tbody tr.student-row .attend-past-actions .btn {
    width: 100%;
    min-width: 0;
    padding: 6px 4px;
    font-size: 12px;
    box-sizing: border-box;
  }

  /* Сценарий с одной кнопкой: Не прийде */
  .group-table tbody tr.student-row .attend-future-actions {
    display: flex;
    width: auto;
    flex: 0 0 auto;
  }

  .group-table tbody tr.student-row .attend-future-actions .btn,
  .group-table tbody tr.student-row .btn-absent {
    width: auto;
    min-width: 0;
    padding: 7px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .group-table tbody tr.student-row .attend-btns-wrap,
  .group-table tbody tr.student-row .attend-btns {
    width: auto;
  }
}

/* ── Слайдер дат (сторінка Журнал) ───────────────────────── */

.date-slider-wrap {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.date-slider-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  box-shadow: var(--shadow-soft);
  transition: transform 0.14s, border-color 0.14s, background 0.14s;
}

.date-slider-arrow:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.45);
}

.date-slider {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 8px 20px 16px 20px;
  scrollbar-width: none;
}
.date-slider::-webkit-scrollbar { display: none; }

.date-pill {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 12px 6px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  scroll-snap-align: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
  min-width: 52px;
  font-family: inherit;
}
.date-pill:hover {
  border-color: var(--link);
}
.date-pill.active {
  background: var(--link);
  border-color: var(--link);
  color: #fff;
}
.date-pill.past {
  opacity: 0.6;
}
.date-pill.past:hover { opacity: 1; }

/* Пігулка «сьогодні» (якщо не активна — синя обводка) */
.date-pill.today:not(.active) {
  border-color: var(--link);
  border-width: 2px;
  background:
    linear-gradient(180deg, rgba(96, 165, 250, 0.18), rgba(96, 165, 250, 0.07)),
    var(--card);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.16);
}

.date-pill-weekday {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.65;
  line-height: 1;
}
.date-pill.active .date-pill-weekday { opacity: 0.85; }

.date-pill-day {
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* Крапка — «є заняття» */
.date-pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--link);
  opacity: 0.5;
}
.date-pill.active .date-pill-dot {
  background: #fff;
  opacity: 0.75;
}
.date-pill.today .date-pill-dot {
  width: 7px;
  height: 7px;
  opacity: 0.95;
}

/* Порожній день (після AJAX-завантаження дня без занять) */
.no-classes-day {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 24px;
  text-align: center;
}

.empty-schedule-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: 18px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--link);
  text-decoration: none;
  font-weight: 800;
}

.empty-schedule-link:hover {
  border-color: var(--link);
  background: rgba(37, 99, 235, 0.06);
  text-decoration: none;
}

/* ═══════════════════════════════════════════════════════════
   Дашборд (головна сторінка)
   ═══════════════════════════════════════════════════════════ */

/* ── KPI-ряд ────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px 22px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-icon {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 38px;
  font-weight: 900;
  color: var(--link);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kpi-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
}

/* ── Кнопки дій на дашборді ─────────────────────────────── */
.dash-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.dash-actions .btn {
  flex: 1 1 auto;
  text-align: center;
  white-space: nowrap;
}

@media (min-width: 480px) {
  .dash-actions .btn {
    flex: 0 0 auto;
  }
}

/* ── Основна сітка: Календар | Фінанси+Групи ────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 24px;
  align-items: start;
}

/* ── Міні-календар ──────────────────────────────────────── */
.dash-cal-card {
  min-width: 0;
}

.dash-section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 14px;
}

.dash-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.dash-cal-head .dash-section-label,
.sched-cal-head .dash-section-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 999px;
  border: 1px solid rgba(120, 160, 255, 0.28);
  background: rgba(255, 255, 255, 0.50);
  box-shadow: 0 2px 8px rgba(70, 100, 220, 0.10), inset 0 1px 0 rgba(255,255,255,0.55);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  font-size: 16px;
  letter-spacing: 0;
  line-height: 1;
  margin-bottom: 0;
}


  :root.dark .dash-cal-head .dash-section-label, :root.dark .sched-cal-head .dash-section-label{
    background: rgba(20, 30, 60, 0.55);
    border-color: rgba(100, 150, 255, 0.22);
    box-shadow: 0 2px 8px rgba(0,0,0,0.30), inset 0 1px 0 rgba(180,210,255,0.10);
  }


.cal-nav {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 14px;
}

.cal-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-soft);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  text-decoration: none;
}

.cal-nav a:not(.sched-today-link) {
  width: 30px;
  padding: 0;
}

.cal-nav .sched-today-link {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.cal-nav a:hover {
  border-color: var(--link);
  color: var(--link);
  text-decoration: none;
}

.cal-date-link {
  display: inline-flex;
  text-decoration: none;
}

.cal-date-link,
.cal-date-link:visited,
.sched-day-link,
.sched-day-link:visited {
  color: inherit;
  text-decoration: none;
}

.cal-date-link:hover,
.sched-day-link:hover {
  text-decoration: none;
}

.cal-date-link:hover .cal-num,
.sched-day-link:hover .cal-num {
  box-shadow: inset 0 0 0 1px var(--link);
}

/* Перевизначаємо загальну таблицю для міні-календаря */
.mini-cal {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
  table-layout: fixed;
}

.mini-cal th {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 0 8px;
  border: none;
}

.mini-cal th.cal-weekend {
  color: #dc2626;
  opacity: 0.7;
}

  :root.dark .mini-cal th.cal-weekend{ color: #f87171; }


.mini-cal td {
  text-align: center;
  padding: 3px 2px;
  border: none;
  width: 36px;
}

.mini-cal td::before { display: none !important; content: none !important; }

/* Клітинка дня */
.cal-day {
  position: relative;
}

.cal-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 500;
  margin: 0 auto;
  color: var(--text);
}

/* День із заняттям — жирний + легке підсвічення */
.cal-has-class .cal-num {
  font-weight: 700;
  background: rgba(37, 99, 235, 0.08);
  color: var(--link);
}

/* Сьогодні — суцільне коло */
.cal-today .cal-num {
  background: var(--link);
  color: #fff;
  font-weight: 700;
}

.cal-outside .cal-num {
  color: var(--muted);
  opacity: 0.42;
}

.cal-outside.cal-has-class .cal-num {
  background: transparent;
}

/* Крапка під днем із заняттям */
.cal-dot {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--link);
  margin: 2px auto 0;
  opacity: 0.6;
}
.cal-today .cal-dot {
  background: #fff;
  opacity: 0.7;
}

/* Порожня клітинка */
.cal-empty { opacity: 0; pointer-events: none; }

/* Легенда */
.cal-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.cal-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--link);
  opacity: 0.5;
  flex-shrink: 0;
}

.cal-legend-today {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--link);
  margin-left: 8px;
  flex-shrink: 0;
}

/* ── Права колонка: Фінанси + Групи ────────────────────── */
.dash-right-card {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Finance hero */
.finance-hero {
  margin: 6px 0 18px;
}

.finance-amount {
  font-size: 34px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.finance-amount--positive {
  color: #10b981;
  text-shadow: 0 10px 30px rgba(16, 185, 129, 0.18);
}

:root.dark .finance-amount--positive {
  color: #34d399;
  text-shadow: 0 0 28px rgba(52, 211, 153, 0.16);
}

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

.finance-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  margin-top: 10px;
}
.delta-pos { background: rgba(5, 150, 105, 0.12); color: #059669; }
.delta-neg { background: rgba(220, 38, 38, 0.09); color: #dc2626; }

  :root.dark .delta-pos{ color: #10b981; }
  :root.dark .delta-neg{ color: #f87171; }


/* Finance stat boxes */
.finance-stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.finance-stat-box {
  background: transparent;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fsb-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.fsb-value--muted {
  color: var(--muted);
  font-weight: 500;
  font-size: 16px;
}

.fsb-label {
  font-size: 11px;
  color: var(--muted);
}

/* Divider between Finance and Groups */
.dash-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0 20px;
}

/* Group bars */
.group-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.group-bar-row:last-child { margin-bottom: 0; }

.gbar-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--link);
  min-width: 54px;
  font-variant-numeric: tabular-nums;
}

.gbar-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.gbar-fill {
  height: 100%;
  background: var(--link);
  border-radius: 4px;
  opacity: 0.75;
  transition: width 0.4s ease;
}

.gbar-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  min-width: 18px;
  text-align: right;
}

/* ── Абонементи, що спливають ───────────────────────────── */
.dash-expiring-card {
  margin-bottom: 0;
}

.expiring-table {
  margin-top: 12px;
  margin-bottom: 0;
}

.exp-group {
  color: var(--muted);
  font-size: 14px;
}

.exp-date {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}

.exp-days {
  white-space: nowrap;
}

/* Бейджики "залишилось" */
.exp-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.exp-badge--today,
.exp-badge--urgent {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}
.exp-badge--warn {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
}
.exp-badge--ok {
  background: rgba(5, 150, 105, 0.10);
  color: #059669;
}


  :root.dark .exp-badge--today, :root.dark .exp-badge--urgent{ color: #f87171; }
  :root.dark .exp-badge--warn{ color: #fbbf24; }
  :root.dark .exp-badge--ok{ color: #10b981; }


/* ── Мобільна адаптація дашборду ────────────────────────── */
@media (max-width: 840px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .dash-grid { grid-template-columns: 1fr; }
  .finance-stats-row { grid-template-columns: repeat(2, 1fr); }
  .finance-stat-box--prev { display: none; } /* прибираємо "минулий місяць" на телефоні */
  .dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(88px, 24vw, 116px);
    align-items: center;
    gap: 18px;
  }
  .dashboard-hero h1 {
    font-size: clamp(34px, 10vw, 44px);
    line-height: 1;
  }
  .dashboard-liza-photo {
    width: 100%;
    height: 100%;
  }
  .dashboard-liza-frame {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }
  .mini-cal {
    display: table;
    max-width: none;
    table-layout: fixed;
  }
  .mini-cal thead { display: table-header-group; }
  .mini-cal tbody { display: table-row-group; }
  .mini-cal tr {
    display: table-row;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    background: transparent;
  }
  .mini-cal th,
  .mini-cal td {
    display: table-cell;
    padding: 4px 2px;
    border: none;
  }
  .mini-cal td::before {
    content: none;
    display: none;
  }

  .dash-expiring-card {
    padding: 18px;
  }
  .expiring-table,
  .expiring-table tbody,
  .expiring-table tr,
  .expiring-table td {
    display: block;
  }
  .expiring-table thead {
    display: none;
  }
  .expiring-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    padding: 12px 0;
    margin: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
  }
  .expiring-table tr:last-child {
    border-bottom: none;
  }
  .expiring-table td {
    padding: 0;
    border: none;
  }
  .expiring-table td::before {
    content: none;
    display: none;
  }
  .expiring-table td:first-child {
    grid-column: 1;
    min-width: 0;
  }
  .exp-group {
    grid-column: 1;
    font-size: 12px;
  }
  .exp-date {
    grid-column: 2;
    grid-row: 1;
    font-size: 14px;
  }
  .exp-days {
    grid-column: 2;
    grid-row: 2;
  }
}

@media (max-width: 480px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .kpi-value { font-size: 30px; }
  .finance-amount { font-size: 26px; }
}

/* ═══════════════════════════════════════════════════════════
   Картка учня
   ═══════════════════════════════════════════════════════════ */

.student-card {
  display: grid;
  gap: 24px;
}

.student-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.student-title-row,
.student-actions,
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.student-actions,
.page-header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Equal-height buttons in the student card action row */
.student-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
}

/* Let the text block inside page-header--with-btn grow and shrink */
.page-header--with-btn > div {
  flex: 1 1 0;
  min-width: 0;
}

.student-avatar-display {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.10);
  border: 1px solid rgba(37, 99, 235, 0.18);
  font-size: 28px;
  flex-shrink: 0;
  overflow: hidden;
}

.student-header h1 {
  margin-bottom: 4px;
}

.student-subtitle {
  color: var(--muted);
  font-size: 14px;
}

.btn-soft {
  background: var(--card-soft);
  border: 1px solid var(--border);
  color: var(--text);
}

.student-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.student-edit-form {
  display: grid;
  gap: 18px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.62);
}

.student-edit-section {
  display: grid;
  gap: 8px;
}

.student-edit-label,
.student-edit-grid > label > span,
.student-edit-field > span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

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

.avatar-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.avatar-option span {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.52);
  font-size: 22px;
  cursor: pointer;
}

.avatar-option input:checked + span {
  border-color: var(--link);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.avatar-upload {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.avatar-upload-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(37, 99, 235, 0.10);
  border: 1px solid rgba(37, 99, 235, 0.18);
  font-size: 30px;
  flex: 0 0 auto;
}

.avatar-upload-actions,
.avatar-cropper-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.avatar-upload-btn,
.avatar-clear-btn,
.avatar-cropper-actions .btn-modal-cancel,
.avatar-cropper-actions .btn {
  min-height: 38px;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.avatar-upload-btn input {
  display: none;
}

.avatar-cropper {
  display: grid;
  gap: 10px;
  max-width: 320px;
}

.avatar-cropper[hidden] {
  display: none;
}

.avatar-cropper-stage {
  width: 280px;
  height: 280px;
  max-width: 100%;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #f3f4f6;
  border: 1px solid var(--border);
}

.avatar-cropper-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

.avatar-cropper-stage canvas:active {
  cursor: grabbing;
}

.avatar-cropper-mask {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, transparent 0 49.5%, rgba(15, 23, 42, 0.42) 50%);
}

.avatar-cropper-mask::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
}

.avatar-zoom-label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.avatar-zoom-label input {
  width: 280px;
  max-width: 100%;
}

.student-edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.student-edit-grid label,
.student-edit-field {
  display: grid;
  gap: 6px;
}

.student-edit-grid input,
.student-edit-grid select,
.student-edit-grid textarea {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  font: inherit;
  padding: 9px 11px;
}

.student-edit-grid textarea {
  resize: vertical;
  min-height: 86px;
}

.student-edit-field--wide {
  grid-column: span 2;
}

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

.apparatus-check-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.apparatus-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 11px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.54);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.apparatus-check-input:checked + .apparatus-check {
  border-color: rgba(37, 99, 235, 0.72);
  background: rgba(37, 99, 235, 0.14);
  color: var(--link);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.14);
}

.apparatus-check-input:focus-visible + .apparatus-check {
  outline: 2px solid rgba(37, 99, 235, 0.45);
  outline-offset: 2px;
}

.student-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}


  :root.dark .student-avatar-display, :root.dark .student-edit-form{
    background: rgba(12, 20, 42, 0.46);
    border-color: rgba(147, 197, 253, 0.13);
  }

  :root.dark .avatar-option span, :root.dark .student-edit-grid input, :root.dark .student-edit-grid select, :root.dark .student-edit-grid textarea, :root.dark .apparatus-check{
    background: rgba(13, 19, 36, 0.64);
    border-color: rgba(147, 197, 253, 0.18);
    color: #e5edff;
  }

  :root.dark .student-summary-item--metric .value{
    color: rgba(125, 184, 255, 0.96);
  }

  :root.dark .student-summary-item--metric .value-small{
    color: rgba(240, 246, 255, 0.92);
  }

  :root.dark .student-summary-item .apparatus-value{
    color: rgba(203, 225, 255, 0.96);
  }

  :root.dark .student-summary-item--comment .value-small{
    color: rgba(226, 236, 255, 0.9);
  }


.student-profile-grid,
.student-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  align-items: start;
}
.student-profile-actions {
  display: flex;
  justify-content: flex-start;
  margin: 12px 0 20px;
}

.student-summary-item {
  background: var(--card-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  min-width: 0;
  min-height: 116px;
}

.student-summary-item--metric .value {
  line-height: 1;
  margin: 6px 0 5px;
  color: rgba(96, 170, 255, 0.98);
}

.student-summary-item--metric .value-small {
  color: var(--text);
}

/* Slim divider for "X / Y" composite metrics (lessons left, abons/indivs). */
.student-summary-item--metric .value .value-divider,
.student-summary-item--metric .value-small .value-divider {
  opacity: 0.45;
  font-weight: 500;
  margin: 0 2px;
}

.student-summary-item .apparatus-value {
  color: rgba(106, 170, 255, 0.98);
}

.student-summary-item--comment {
  grid-column: 1 / -1;
  min-height: 0;
}

/* Tenure tile: "1 рік 2 міс" is longer than a number — use smaller value font */
.student-summary-item--tenure .value {
  font-size: 20px;
  line-height: 1.2;
}

.student-apparatus-icons,
.student-chip-list,
.student-contact-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.student-apparatus-icons {
  display: grid;
  grid-template-columns: repeat(4, 38px);
  gap: 7px;
  align-items: center;
}

.student-apparatus-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 13px;
  border: 1px solid rgba(96, 170, 255, 0.24);
  background: rgba(96, 170, 255, 0.11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.student-apparatus-icon img {
  width: 72%;
  height: 72%;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(37, 99, 235, 0.22));
}

.student-chip-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}

.student-contact-lines {
  flex-direction: column;
  align-items: flex-start;
}

.student-contact-lines a {
  color: var(--link);
  font-weight: 750;
  text-decoration: none;
}

.student-contact-lines a:hover {
  text-decoration: underline;
}

.student-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.13);
  border: 1px solid rgba(96, 165, 250, 0.22);
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.value-small--missed {
  color: rgba(251, 146, 60, 0.88);
}

.student-summary-item--comment .value-small {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.55;
  color: rgba(31, 42, 68, 0.82);
}


  :root.dark .student-summary-item--metric .value, :root.dark .student-summary-item .apparatus-value{
    color: #6aaaff;
  }

  :root.dark .student-summary-item--comment .value-small{
    color: rgba(232, 240, 255, 0.9);
  }

  :root.dark .student-apparatus-icon{
    border-color: rgba(106, 170, 255, 0.34);
    background: rgba(96, 170, 255, 0.13);
  }

  :root.dark .student-apparatus-icon img{
    filter: drop-shadow(0 10px 20px rgba(96, 170, 255, 0.2));
  }


.apparatus-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
}

.inline-edit select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
  line-height: 1.35;
}

.student-section {
  border-top: 1px solid var(--border);
  padding-top: 22px;
}

.student-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.student-section-head h2 {
  margin: 0;
}

.student-section-head span {
  color: var(--muted);
  font-size: 14px;
}

.student-cal-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.student-cal-title .cal-nav {
  margin-bottom: 0;
}

.student-cal-button {
  display: inline-flex;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.student-cal-button:hover .cal-num {
  box-shadow: inset 0 0 0 1px var(--link);
}

.student-cal-event {
  cursor: pointer;
}

.student-cal {
  max-width: 520px;
}

.student-day-dots {
  display: flex;
  justify-content: center;
  gap: 3px;
  min-height: 7px;
  margin-top: 2px;
}

.student-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.student-dot--attended { background: #059669; }
.student-dot--missed { background: #dc2626; }
.student-dot--booked { background: #2563eb; }

.student-legend {
  gap: 7px;
}

.student-history {
  border-top: 1px solid var(--border);
  padding-top: 4px;
}

.student-history-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  font-size: 18px;
  font-weight: 800;
}

.student-history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  background: var(--card-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
}

.history-item--pulse {
  animation: historyPulse 1.15s ease-in-out 2;
}

.student-cal-day--pulse .cal-num {
  animation: calendarDayPulse 1.15s ease-in-out 2;
}

@keyframes historyPulse {
  0%, 100% {
    box-shadow: none;
    border-color: var(--border);
  }
  45% {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
    border-color: var(--link);
  }
}

@keyframes calendarDayPulse {
  0%, 100% {
    box-shadow: none;
    transform: scale(1);
  }
  45% {
    box-shadow: 0 0 0 8px rgba(96, 165, 250, 0.2);
    transform: scale(1.08);
  }
}

.history-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.history-loading {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.history-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 4px;
}

.history-pagination .btn {
  font-size: 13px;
  padding: 6px 14px;
}

.history-page-info {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  flex: 1;
}

@media (max-width: 760px) {
  .student-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  /* Той самий запобіжник, що й у фінзвіті по учню: nowrap-підказки крайніх
     клітинок тюбика не повинні роздувати ширину сторінки на телефоні. */
  .student-summary-item--progress {
    overflow-x: clip;
    overflow-y: visible;
  }
}

@media (max-width: 520px) {
  .wrap {
    margin: 12px auto;
    padding: 14px;
  }
  .card {
    border-radius: 14px;
    padding: 18px;
  }
  h1 {
    font-size: 28px;
  }
  .page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  /* When header has an action button (Учні page) — keep as row */
  .page-header--with-btn {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
  }
  .page-header--with-btn h1 {
    flex: 1 1 auto;
    min-width: 0;
  }
  .student-header {
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
  }
  .student-title-row {
    flex: 1 1 200px;
    min-width: 0;
    align-items: flex-start;
  }
  /* Student-card action buttons: full-width row, split 50/50 on mobile */
  .student-actions {
    flex: 0 0 100%;
    width: 100%;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: stretch;
    align-items: stretch;
    gap: 8px;
  }
  .student-actions .btn {
    flex: 1 1 0;
    width: auto !important;
    text-align: center;
    justify-content: center;
  }
  .page-header-actions {
    justify-content: flex-start;
  }
  .student-summary-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .student-profile-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  /* Comment and wide fields still span both columns */
  .student-profile-grid .student-summary-item--comment,
  .student-edit-field--wide {
    grid-column: 1 / -1;
  }
  .student-edit-grid {
    grid-template-columns: 1fr;
  }
  .student-edit-actions .btn {
    width: 100%;
    text-align: center;
  }
  /* student-new-btn stays auto width (it's in the page-header--with-btn row) */
  .student-new-btn {
    flex-shrink: 0;
    white-space: nowrap;
  }
  /* Show "Редагувати" label on mobile (was hidden) */
  .edit-label {
    display: inline;
  }
  .student-section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .student-cal-title {
    width: 100%;
    justify-content: space-between;
  }
  .history-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    padding: 10px 12px;
    align-items: center;
  }
  .history-main {
    min-width: 0;
  }
  .history-main .value-small {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .history-main .lesson-meta {
    font-size: 12px;
    margin-top: 3px;
  }
  .history-meta {
    gap: 3px;
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
  }
}

/* ═══════════════════════════════════════════════════════════
   Liquid Glass Design System
   ═══════════════════════════════════════════════════════════ */

/* ── Glass cards ────────────────────────────────────────── */
.card,
.group-block,
.kpi-card {
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 32px rgba(60, 40, 120, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}


  :root.dark .card, :root.dark .group-block, :root.dark .kpi-card{
    background: rgba(18, 24, 44, 0.68);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.40), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  }


/* ── TopNav glass bar ───────────────────────────────────── */
.topnav {
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 16px;
  padding: 8px 14px;
  box-shadow: 0 4px 18px rgba(60, 40, 120, 0.07);
  margin-bottom: 18px;
  /* Ensure scroll stays enabled from base rule */
  overflow-x: auto;
  scrollbar-width: none;
}

.topnav a.active {
  color: #fff;
  background: linear-gradient(145deg, #5d8cff, #2563eb);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.30);
}


  :root.dark .topnav a.active{
    background: linear-gradient(145deg, #8bb8ff, #4776ff 58%, #7c5cff);
    box-shadow: 0 10px 24px rgba(71, 118, 255, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  }



  :root.dark .topnav{
    background: rgba(12, 18, 38, 0.68);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
  }


/* ════════════════════════════════════════════════════════════
   ✦ Liquid Glass — безпечний варіант (без SVG-спотворення)
   Охоплює: TopNav (клас .liquid-glass у шаблонах) + усі модалки
   (.modal-glass). Працює у світлій і темній темі, на телефоні.
   ВІДКОТИТИ: видалити блок між BEGIN / END liquid-glass-pilot
   і прибрати клас liquid-glass з topnav у шаблонах.
   ════════════════════════════════════════════════════════════ */
/* BEGIN liquid-glass-pilot */
.topnav.liquid-glass {
  background:
    linear-gradient(180deg,
      rgba(255, 255, 255, 0.55) 0%,
      rgba(255, 255, 255, 0.16) 42%,
      rgba(255, 255, 255, 0.32) 100%),
    rgba(255, 255, 255, 0.46);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    0 10px 34px rgba(60, 40, 120, 0.14),
    inset 0 1.5px 0.5px rgba(255, 255, 255, 0.95),
    inset 0 -1px 1px rgba(255, 255, 255, 0.45),
    inset 1.5px 0 1px rgba(255, 255, 255, 0.35),
    inset -1.5px 0 1px rgba(255, 255, 255, 0.35);
}

  :root.dark .topnav.liquid-glass {
    background:
      linear-gradient(180deg,
        rgba(255, 255, 255, 0.13) 0%,
        rgba(255, 255, 255, 0.02) 44%,
        rgba(255, 255, 255, 0.07) 100%),
      rgba(12, 18, 38, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
      0 10px 34px rgba(0, 0, 0, 0.40),
      inset 0 1.5px 0.5px rgba(255, 255, 255, 0.18),
      inset 0 -1px 1px rgba(255, 255, 255, 0.05),
      inset 1.5px 0 1px rgba(255, 255, 255, 0.06),
      inset -1.5px 0 1px rgba(255, 255, 255, 0.06);
  }

/* Модалки: той самий ефект, але фон лишаємо щільним для читабельності */
.modal-glass {
  background:
    linear-gradient(180deg,
      rgba(255, 255, 255, 0.50) 0%,
      rgba(255, 255, 255, 0.00) 32%,
      rgba(255, 255, 255, 0.22) 100%),
    rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow:
    0 24px 60px rgba(60, 40, 120, 0.18),
    inset 0 1.5px 0.5px rgba(255, 255, 255, 0.95),
    inset 0 -1px 1px rgba(255, 255, 255, 0.50),
    inset 1.5px 0 1px rgba(255, 255, 255, 0.40),
    inset -1.5px 0 1px rgba(255, 255, 255, 0.40);
}

  :root.dark .modal-glass {
    background:
      linear-gradient(180deg,
        rgba(255, 255, 255, 0.12) 0%,
        rgba(255, 255, 255, 0.00) 34%,
        rgba(255, 255, 255, 0.05) 100%),
      rgba(18, 18, 36, 0.84);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow:
      0 24px 60px rgba(0, 0, 0, 0.55),
      inset 0 1.5px 0.5px rgba(255, 255, 255, 0.18),
      inset 0 -1px 1px rgba(255, 255, 255, 0.06),
      inset 1.5px 0 1px rgba(255, 255, 255, 0.07),
      inset -1.5px 0 1px rgba(255, 255, 255, 0.07);
  }

/* Решта поверхонь: тонкий скляний «ободок» через накладку ::after.
   Не чіпає фон/тіні/розкладку елементів — лише грані + легкий блік згори.
   pointer-events: none — кліки проходять крізь накладку. */
.card,
.kpi-card,
.group-block,
.finance-stats-row,
.date-pill,
.sched-block,
.sched-create-form,
.sched-empty {
  position: relative;
}

.card::after,
.kpi-card::after,
.group-block::after,
.finance-stats-row::after,
.date-pill::after,
.sched-block::after,
.sched-create-form::after,
.sched-empty::after {
  content: "";
  position: absolute;
  /* -1px → накладка лягає рівно на зовнішню рамку елемента,
     інакше ободок дублює рамку паралельною лінією (двоїння на кутах) */
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.30) 0%,
    rgba(255, 255, 255, 0.00) 18%);
  box-shadow:
    inset 0 1.5px 0.5px rgba(255, 255, 255, 0.85),
    inset 0 -1px 1px rgba(255, 255, 255, 0.40),
    inset 1.5px 0 1px rgba(255, 255, 255, 0.28),
    inset -1.5px 0 1px rgba(255, 255, 255, 0.28);
}

  :root.dark .card::after,
  :root.dark .kpi-card::after,
  :root.dark .group-block::after,
  :root.dark .finance-stats-row::after,
  :root.dark .date-pill::after,
  :root.dark .sched-block::after,
  :root.dark .sched-create-form::after,
  :root.dark .sched-empty::after {
    background: linear-gradient(180deg,
      rgba(255, 255, 255, 0.12) 0%,
      rgba(255, 255, 255, 0.00) 18%);
    box-shadow:
      inset 0 1.5px 0.5px rgba(255, 255, 255, 0.16),
      inset 0 -1px 1px rgba(255, 255, 255, 0.05),
      inset 1.5px 0 1px rgba(255, 255, 255, 0.06),
      inset -1.5px 0 1px rgba(255, 255, 255, 0.06);
  }
/* END liquid-glass-pilot */


/* ── Date pills glass ───────────────────────────────────── */
.date-pill {
  background: rgba(255, 255, 255, 0.60);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 255, 255, 0.65);
}


  :root.dark .date-pill{
    background: rgba(20, 28, 54, 0.70);
    border-color: rgba(255, 255, 255, 0.08);
  }


/* ── Soft items inside cards ────────────────────────────── */
.student-summary-item,
.item,
.history-item {
  background: rgba(255, 255, 255, 0.50);
  border: 1px solid rgba(255, 255, 255, 0.60);
}


  :root.dark .student-summary-item, :root.dark .item, :root.dark .history-item{
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.07);
  }


/* Finance stats row — glass container */
.finance-stats-row {
  background: rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(60, 40, 120, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.70);
  gap: 0; /* вертикальні роздільники через border-right */
}

.finance-stat-box {
  background: transparent;
}

.finance-stat-box:not(:last-child) {
  border-right: 1px solid rgba(255, 255, 255, 0.40);
}


  :root.dark .finance-stats-row{
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }
  :root.dark .finance-stat-box:not(:last-child){
    border-right-color: rgba(255, 255, 255, 0.08);
  }


/* ── Group block header glass ───────────────────────────── */
.group-header {
  background: rgba(255, 255, 255, 0.48);
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
}


  :root.dark .group-header{
    background: rgba(255, 255, 255, 0.04);
    border-bottom-color: rgba(255, 255, 255, 0.07);
  }


/* ── Inline edit selects (glass-aware) ──────────────────── */
.inline-edit select {
  background: rgba(255, 255, 255, 0.72);
}


  :root.dark .inline-edit select{
    background: rgba(255, 255, 255, 0.06);
  }


/* ═══════════════════════════════════════════════════════════
   Сторінка Розклад
   ═══════════════════════════════════════════════════════════ */

/* ── Сітка: Календар | День ─────────────────────────────── */
.sched-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: start;
}

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

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

  .sched-day-panel {
    min-width: 0;
  }
}

/* ── Календар розкладу ──────────────────────────────────── */
.sched-cal-card {
  min-width: 260px;
}

.sched-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.sched-day-link {
  display: inline-flex;
  text-decoration: none;
  border-radius: 50%;
}

.sched-day-link .cal-num {
  cursor: pointer;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}

.sched-day-link:hover .cal-num {
  background: rgba(37, 99, 235, 0.10);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.36), 0 6px 16px rgba(37, 99, 235, 0.12);
}

/* Дні з заняттями */
.cal-day-past-class .cal-num {
  color: var(--muted);
  font-weight: 600;
}

.cal-day-future-class .cal-num {
  font-weight: 700;
  background: rgba(37, 99, 235, 0.10);
  color: var(--link);
}

/* Сьогодні — кільце, вибрана дата — заповнене коло */
.sched-cal-card .cal-today .cal-num {
  background: rgba(255, 255, 255, 0.50);
  color: var(--link);
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.62), 0 5px 16px rgba(37, 99, 235, 0.10);
  font-weight: 800;
}

.cal-day-selected .cal-num {
  background: linear-gradient(145deg, #5d8cff, #2563eb);
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.36);
  font-weight: 800;
}

.sched-cal-card .cal-today.cal-day-selected .cal-num {
  background: linear-gradient(145deg, #5d8cff, #2563eb);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16), 0 10px 24px rgba(37, 99, 235, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.36);
}


  :root.dark .sched-day-link:hover .cal-num{
    background: rgba(125, 168, 255, 0.15);
    box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.42), 0 8px 20px rgba(96, 165, 250, 0.12);
  }

  :root.dark .sched-cal-card .cal-today .cal-num{
    background: rgba(147, 197, 253, 0.08);
    color: #bfdbfe;
    box-shadow: inset 0 0 0 2px rgba(147, 197, 253, 0.62), 0 8px 18px rgba(0, 0, 0, 0.20);
  }

  :root.dark .cal-day-selected .cal-num, :root.dark .sched-cal-card .cal-today.cal-day-selected .cal-num{
    background: linear-gradient(145deg, #8bb8ff, #4776ff 58%, #7c5cff);
    color: #fff;
    box-shadow: 0 12px 28px rgba(71, 118, 255, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.42);
  }


/* Крапка під днем */
.sched-dot {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  margin: 2px auto 0;
}

.sched-dot--past   { background: var(--muted); opacity: 0.55; }
.sched-dot--future { background: var(--link);  opacity: 0.65; }

/* ── Права панель: День ─────────────────────────────────── */
.sched-day-panel {
  min-height: 100px;
}

#day-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sched-day-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.sched-day-head h2 {
  margin: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sched-weekday {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

/* ── Блок одного заняття (розклад) ─────────────────────── */
.sched-block {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.34));
  backdrop-filter: blur(34px) saturate(200%) contrast(104%);
  -webkit-backdrop-filter: blur(34px) saturate(200%) contrast(104%);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 24px;
  box-shadow: 0 18px 48px rgba(74, 62, 130, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.86), inset 0 -1px 0 rgba(255, 255, 255, 0.35);
  overflow: hidden;
}


  :root.dark .sched-block{
    background: linear-gradient(145deg, rgba(30, 41, 69, 0.54), rgba(9, 13, 28, 0.46));
    border: 1px solid rgba(255, 255, 255, 0.13);
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.13), inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  }


.sched-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  background: rgba(255, 255, 255, 0.38);
  border-bottom: 1px solid rgba(255, 255, 255, 0.48);
}


  :root.dark .sched-block-header{
    background: rgba(255, 255, 255, 0.04);
    border-bottom-color: rgba(255, 255, 255, 0.07);
  }


.sched-block-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sched-time {
  font-size: 24px;
  font-weight: 800;
  color: var(--link);
  font-variant-numeric: tabular-nums;
  min-width: 52px;
}

.sched-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
}

.sched-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 13px;
  background: var(--link);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

/* Кнопки заголовка блоку */
.sched-block-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sched-btn-add {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--link);
  background: transparent;
  color: var(--link);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.sched-btn-add:hover {
  background: var(--link);
  color: #fff;
}

.sched-btn-delete-class {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.06);
  color: #dc2626;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}

.sched-btn-delete-class:hover {
  background: rgba(220, 38, 38, 0.12);
  border-color: #dc2626;
}

.sched-btn-holiday {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid rgba(14, 165, 233, 0.36);
  background: rgba(14, 165, 233, 0.08);
  color: #0369a1;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}

.sched-btn-holiday:hover {
  background: rgba(14, 165, 233, 0.14);
  border-color: rgba(14, 165, 233, 0.62);
}

.sched-btn-replacement {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid rgba(139, 92, 246, 0.38);
  background: rgba(139, 92, 246, 0.08);
  color: #6d28d9;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}

.sched-btn-replacement:hover {
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(139, 92, 246, 0.62);
}

/* ── Рядки учнів у блоці ────────────────────────────────── */
.sched-student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}


  :root.dark .sched-student-row{
    border-bottom-color: rgba(255, 255, 255, 0.05);
  }


.sched-student-row:last-child {
  border-bottom: none;
}

.sched-add-row {
  display: flex;
  justify-content: flex-end;
  padding: 10px 18px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(238, 244, 255, 0.42));
  border-top: 1px solid rgba(255, 255, 255, 0.40);
}

.sched-add-row .sched-btn-add {
  width: 100%;
}

.sched-student-row.status-attended { background: rgba(5, 150, 105, 0.07); }
.sched-student-row.status-missed   { background: rgba(220, 38, 38, 0.07); }


  :root.dark .sched-add-row{
    background: linear-gradient(180deg, rgba(19, 32, 61, 0.72), rgba(12, 20, 42, 0.88));
    border-top-color: rgba(147, 197, 253, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }


.sched-student-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sched-student-name {
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sched-student-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sched-empty-row {
  padding: 14px 18px;
  color: var(--muted);
  font-size: 14px;
}

.sched-btn-remove,
.sched-btn-remove-past {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  flex-shrink: 0;
}

.sched-btn-remove:hover,
.sched-btn-remove-past:hover {
  border-color: #dc2626;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}

/* ── Панель додавання учня ──────────────────────────────── */
.sched-add-panel {
  padding: 12px 18px 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.35);
}


  :root.dark .sched-add-panel{
    border-top-color: rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
  }


.sched-search {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  margin-bottom: 8px;
  box-sizing: border-box;
}


  :root.dark .sched-search{
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.12);
  }


.sched-search:focus {
  outline: none;
  border-color: var(--link);
}

.sched-candidates {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sched-candidate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 14px;
}

.sched-candidate:hover {
  background: rgba(37, 99, 235, 0.08);
}

.sched-candidate.disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.45;
  background: rgba(148, 163, 184, 0.10);
}

.sched-candidate.disabled:hover {
  background: rgba(148, 163, 184, 0.10);
}

.sched-candidate.hidden { display: none; }

.sched-warn {
  font-size: 12px;
  color: #d97706;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.sched-busy {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Секція «Індивідуальні» ─────────────────────────────── */
.sched-section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 4px 0 8px;
}

/* ── Порожній день ──────────────────────────────────────── */
.sched-empty {
  text-align: center;
  padding: 20px 20px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.44);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  box-shadow: 0 18px 46px rgba(74, 62, 130, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.80);
}

.sched-empty--compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  text-align: left;
}


  :root.dark .sched-empty{
    background: rgba(18, 24, 44, 0.65);
    border-color: rgba(255, 255, 255, 0.06);
  }


.sched-empty-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.sched-day-actions {
  margin-top: 0;
  flex-wrap: nowrap;
}

.sched-day-actions--replacement-full {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.sched-day-actions--replacement-full .sched-btn-replacement {
  grid-column: 1 / -1;
}

.sched-day-actions--replacement-full .sched-btn-add {
  width: 100%;
}

@media (min-width: 701px) {
  .sched-empty-btns {
    flex-wrap: nowrap;
  }

  .sched-empty-btns .sched-btn-add {
    flex: 0 0 auto;
  }
}

/* ── Форма створення заняття ────────────────────────────── */
.sched-create-form {
  background: rgba(255, 255, 255, 0.50);
  backdrop-filter: blur(30px) saturate(190%);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 24px;
  padding: 18px 20px;
  box-shadow: 0 18px 48px rgba(74, 62, 130, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.82);
  display: flex;
  flex-direction: column;
  gap: 12px;
}


  :root.dark .sched-create-form{
    background: linear-gradient(145deg, rgba(30, 41, 69, 0.56), rgba(9, 13, 28, 0.48));
    border-color: rgba(255, 255, 255, 0.13);
  }


.sched-form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.sched-form-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 140px;
}

.sched-form-group--student {
  flex-basis: 220px;
}

.sched-form-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.sched-form-group select,
.sched-form-group input {
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  min-height: 40px;
}


  :root.dark .sched-form-group select, :root.dark .sched-form-group input{
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.12);
  }


.sched-form-group select:focus,
.sched-form-group input:focus {
  outline: none;
  border-color: var(--link);
}

.sched-student-picker {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.sched-create-student-panel {
  position: absolute;
  z-index: 22;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 14px 36px rgba(60, 40, 120, 0.16);
}

.sched-create-student-list {
  max-height: 230px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sched-create-student {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.sched-create-student:hover {
  background: rgba(37, 99, 235, 0.08);
}

.sched-create-student.hidden {
  display: none;
}

.sched-create-student-empty {
  padding: 8px;
  color: var(--muted);
  font-size: 13px;
}


  :root.dark .sched-student-picker{
    background: rgba(13, 19, 36, 0.64);
    border-color: rgba(147, 197, 253, 0.18);
    color: #e5edff;
  }

  :root.dark .sched-create-student-panel{
    background: linear-gradient(145deg, rgba(25, 34, 59, 0.86), rgba(10, 14, 28, 0.78));
    border-color: rgba(147, 197, 253, 0.16);
    box-shadow: 0 20px 52px rgba(0, 0, 0, 0.54), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  }

  :root.dark .sched-create-student{
    color: #e5edff;
  }

  :root.dark .sched-create-student:hover{
    background: rgba(96, 165, 250, 0.14);
  }


.sched-time-trigger {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.sched-time-trigger.time-adjusted {
  animation: timeAdjustedPulse 1.15s ease-in-out 2;
}

@keyframes timeAdjustedPulse {
  0%, 100% {
    box-shadow: none;
    border-color: var(--border);
  }
  45% {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
    border-color: var(--link);
    color: var(--link);
  }
}


  :root.dark .sched-time-trigger{
    background: rgba(13, 19, 36, 0.64);
    border-color: rgba(147, 197, 253, 0.18);
    color: #e5edff;
  }


.sched-time-popover {
  position: absolute;
  z-index: 20;
  margin-top: 6px;
  width: min(360px, calc(100vw - 48px));
  max-height: 260px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(30px) saturate(190%);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  box-shadow: 0 12px 36px rgba(60, 40, 120, 0.16);
}


  :root.dark .sched-time-popover{
    background: linear-gradient(145deg, rgba(25, 34, 59, 0.82), rgba(10, 14, 28, 0.72));
    border-color: rgba(147, 197, 253, 0.16);
    box-shadow: 0 20px 52px rgba(0, 0, 0, 0.54), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  }


.sched-time-option {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.sched-time-option:hover,
.sched-time-option.selected {
  border-color: var(--link);
  color: var(--link);
  background: rgba(37, 99, 235, 0.08);
}

.sched-time-option.is-busy,
.sched-time-option:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.45;
  background: rgba(148, 163, 184, 0.12);
  text-decoration: line-through;
}


  :root.dark .sched-time-option{
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(147, 197, 253, 0.14);
    color: #e5edff;
  }

  :root.dark .sched-time-option:hover, :root.dark .sched-time-option.selected{
    color: #fff;
    border-color: rgba(147, 197, 253, 0.72);
    background: linear-gradient(145deg, rgba(96, 165, 250, 0.34), rgba(124, 92, 255, 0.26));
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  }

  :root.dark .sched-time-option.is-busy, :root.dark .sched-time-option:disabled{
    color: rgba(203, 213, 225, 0.36);
    background: rgba(15, 23, 42, 0.42);
    border-color: rgba(148, 163, 184, 0.08);
    opacity: 1;
  }


.sched-time-option small {
  font-size: 9px;
  font-weight: 700;
  text-decoration: none;
}

.sched-btn-edit-time {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid rgba(37, 99, 235, 0.26);
  background: rgba(37, 99, 235, 0.06);
  color: var(--link);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.sched-btn-edit-time:hover {
  border-color: var(--link);
  background: rgba(37, 99, 235, 0.12);
}

.sched-edit-time-panel {
  padding: 14px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.22);
}

.sched-edit-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 800;
}

.sched-edit-title small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.sched-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}


  :root.dark .sched-btn-edit-time{
    border-color: rgba(147, 197, 253, 0.22);
    background: rgba(96, 165, 250, 0.10);
  }

  :root.dark .sched-edit-time-panel{
    background: rgba(12, 18, 38, 0.32);
    border-bottom-color: rgba(255, 255, 255, 0.07);
  }


.sched-duration-group {
  display: flex;
  gap: 6px;
}

.sched-dur-btn {
  flex: 1;
  padding: 8px 0;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.sched-dur-btn.active,
.sched-dur-btn:hover {
  border-color: var(--link);
  color: var(--link);
  background: rgba(37, 99, 235, 0.06);
}

.sched-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-primary {
  background: var(--link);
  color: #fff;
  border: none;
  padding: 9px 20px;
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.12s;
}

.btn-primary:hover { opacity: 0.88; }

.btn-cancel-form {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--muted);
  padding: 9px 16px;
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}

.btn-cancel-form:hover {
  border-color: var(--text);
  color: var(--text);
}

/* ── Легенда розкладу ───────────────────────────────────── */
.sched-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.sched-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── Loading spinner ────────────────────────────────────── */
.sched-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--muted);
  font-size: 14px;
  gap: 10px;
}

.sched-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--link);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
  .sched-day-head,
  .sched-empty--compact {
    flex-direction: column;
    align-items: stretch;
  }

  .sched-block-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .sched-block-header-left {
    width: 100%;
    flex-wrap: wrap;
  }

  .sched-add-row .sched-btn-add,
  .sched-empty .sched-btn-add,
  .sched-empty--compact .sched-btn-add {
    width: 100%;
  }

  .sched-block-actions {
    width: 100%;
  }

  .sched-btn-edit-time {
    flex: 1;
  }

  .sched-btn-delete-class {
    flex: 1;
  }

  .sched-student-row {
    padding: 10px 12px;
  }

  .sched-student-main {
    gap: 4px;
  }

  .sched-form-actions {
    flex-direction: column;
  }

  .sched-form-actions .btn-primary,
  .btn-cancel-form {
    width: 100%;
  }

  .sched-time-popover {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: max(92px, env(safe-area-inset-bottom));
    width: auto;
    max-height: 48vh;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sched-create-student-panel {
    position: fixed;
    left: 16px;
    right: 16px;
    top: auto;
    bottom: max(92px, env(safe-area-inset-bottom));
  }

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

  .sched-edit-actions {
    flex-direction: column;
  }
}

/* ── Finance page ───────────────────────────────────────── */
.finance-wrap {
  max-width: 1180px;
}

.finance-month-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 800;
  color: var(--text);
}

.finance-summary-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.finance-summary-main,
.finance-summary-item {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 16px 36px rgba(74, 62, 130, 0.10), inset 0 1px 0 rgba(255,255,255,0.78);
  backdrop-filter: blur(22px) saturate(165%);
  -webkit-backdrop-filter: blur(22px) saturate(165%);
  border-radius: 18px;
  padding: 18px;
}

.finance-summary-main {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.92), rgba(21, 128, 61, 0.84));
  color: white;
}

.finance-summary-main span,
.finance-summary-item span,
.finance-summary-item small {
  display: block;
}

.finance-summary-main strong {
  display: block;
  margin: 8px 0;
  font-size: 34px;
  line-height: 1.05;
}

.finance-summary-main span {
  color: rgba(255,255,255,0.84);
  font-size: 13px;
}

.finance-summary-main .finance-kicker {
  color: white;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.finance-summary-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.finance-summary-item strong {
  display: block;
  margin: 8px 0 5px;
  font-size: 25px;
  line-height: 1.1;
}

.finance-summary-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.finance-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 18px;
  margin-bottom: 18px;
}

.finance-card {
  margin-bottom: 18px;
}

.finance-card h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
}

.finance-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.finance-card-head p,
.finance-card-head span {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.finance-total {
  flex-shrink: 0;
  color: var(--link);
  font-weight: 900;
  font-size: 22px;
}

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

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

.finance-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.finance-form input,
.finance-form select {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  min-height: 43px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
}

.finance-form input:focus,
.finance-form select:focus {
  border-color: rgba(37, 99, 235, 0.58);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.finance-form-wide {
  grid-column: span 2;
}

.finance-form-submit {
  align-self: end;
  min-height: 43px;
}

.finance-payout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
}

.finance-payout-row span {
  color: var(--muted);
  font-weight: 700;
}

.finance-payout-row strong {
  font-size: 20px;
}

.finance-payout-balance strong {
  color: #2563eb;
}

.finance-note,
.finance-empty {
  margin-top: 14px;
  color: var(--muted);
  background: rgba(255,255,255,0.42);
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: 14px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.finance-table {
  margin-top: 0;
}

.finance-table th {
  font-size: 12px;
}

.finance-table td {
  vertical-align: middle;
  font-size: 14px;
}

.finance-table-compact th,
.finance-table-compact td {
  padding-top: 9px;
  padding-bottom: 9px;
}

.finance-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.finance-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  background: var(--booked-bg);
  color: var(--booked-text);
}

.finance-status-confirmed,
.finance-status-paid,
.finance-status-completed {
  background: var(--attended-bg);
  color: var(--attended-text);
}

.finance-status-cancelled {
  background: var(--missed-bg);
  color: var(--missed-text);
}

.inline-form {
  display: inline-flex;
  margin-left: 5px;
}

.mini-action {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.18);
}

.mini-action-confirm {
  color: white;
  background: #059669;
}

.finance-prices {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}


  :root.dark .finance-summary-main, :root.dark .finance-summary-item, :root.dark .finance-note, :root.dark .finance-empty{
    background: rgba(17, 24, 39, 0.62);
    border-color: rgba(255,255,255,0.10);
  }

  :root.dark .finance-summary-main{
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.68), rgba(5, 150, 105, 0.56));
  }

  :root.dark .finance-form input, :root.dark .finance-form select{
    background: rgba(17, 24, 39, 0.74);
    border-color: rgba(255,255,255,0.12);
  }


@media (max-width: 900px) {
  .finance-summary-grid,
  .finance-grid,
  .finance-prices {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 600px) {
  .finance-form,
  .finance-form-wide {
    grid-template-columns: 1fr;
    grid-column: span 1;
  }

  .finance-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .finance-page-header .cal-nav,
  .finance-month-nav {
    flex-direction: row;
    align-items: center;
    align-self: flex-start;
    justify-content: flex-start;
    gap: 12px;
  }

  .finance-summary-main strong {
    font-size: 29px;
  }
}

/* ── Графік доходів ────────────────────────────────────────── */
.finance-chart-card {
  margin-bottom: 20px;
}
.finance-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.finance-chart-header h2 { margin: 0; }

.finance-chart-legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  align-items: center;
}
.legend-line {
  display: inline-block;
  width: 22px;
  height: 2.5px;
  border-radius: 2px;
  vertical-align: middle;
}
.legend-line-total {
  background: #60a5fa;
  border-top: 2.5px dashed #60a5fa;
  height: 0;
}
.legend-line-liza { background: #8b5cf6; }

.finance-chart-wrap {
  position: relative;
  overflow: visible;
}
.finance-chart-svg {
  width: 100%;
  display: block;
  overflow: visible;
}

/* SVG елементи */
.chart-grid {
  stroke: var(--border);
  stroke-width: 1;
}
.chart-axis-label {
  font-size: 11px;
  fill: var(--muted);
}
.chart-line-total {
  stroke: #60a5fa;
  stroke-width: 2.5;
  stroke-dasharray: 7 4;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart-line-liza {
  stroke: #8b5cf6;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart-dot-total {
  fill: #60a5fa;
  stroke: var(--card);
  stroke-width: 1.5;
  pointer-events: none;
}
.chart-dot-liza {
  fill: #8b5cf6;
  stroke: var(--card);
  stroke-width: 1.5;
  pointer-events: none;
}
.chart-cursor {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  pointer-events: none;
}
.chart-hit { cursor: crosshair; }

/* Підписи X */
.finance-chart-labels {
  position: relative;
  height: 20px;
  margin-top: 4px;
}
.chart-label {
  position: absolute;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* Tooltip Liquid Glass */
.finance-chart-tooltip {
  position: fixed;
  z-index: 200;
  background: rgba(255, 255, 255, 0.52);
  backdrop-filter: blur(26px) saturate(190%);
  -webkit-backdrop-filter: blur(26px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 13px;
  box-shadow: 0 12px 34px rgba(60, 40, 120, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.62);
  padding: 12px 16px;
  pointer-events: none;
  min-width: 185px;
  font-size: 13px;
}

  :root.dark .finance-chart-tooltip{
    background: rgba(22, 22, 44, 0.58);
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  }

.finance-chart-tooltip strong {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text);
}
.tt-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}
.tt-row strong { display: inline; margin-bottom: 0; margin-left: auto; color: var(--text); font-size: 14px; }
.tt-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.tt-dot-total { background: #60a5fa; }
.tt-dot-liza  { background: #8b5cf6; }

@media (max-width: 600px) {
  .finance-chart-card {
    padding-left: 14px;
    padding-right: 14px;
  }

  .finance-chart-header {
    margin-bottom: 6px;
  }

  .finance-chart-header h2 {
    font-size: 25px;
  }

  .finance-chart-wrap {
    margin-left: -2px;
    margin-right: -2px;
  }

  .chart-axis-label,
  .chart-label {
    font-size: 10px;
  }
}


/* ══════════════════════════════════════════════════════════════
   ✦ Visual Polish — Pinterest glassmorphism refinements
     Відкат: git checkout main -- liza_admin/static/style.css
   ══════════════════════════════════════════════════════════════ */

/* ① Сучасний шрифт — SF Pro / Inter / system-ui замість Arial */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text',
               'Segoe UI', system-ui, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}
h1 { letter-spacing: -0.03em; }
h2 { letter-spacing: -0.02em; }
.kpi-value  { letter-spacing: -0.04em; }
.group-time { letter-spacing: -0.02em; }

/* ④ Dark-mode cards — blue-edge luminescence (як Feature 1/2/3 glass cards) */

  :root.dark .card, :root.dark .group-block, :root.dark .kpi-card, :root.dark .no-classes-day{
    background: rgba(6, 12, 36, 0.84);
    border: 1px solid rgba(71, 118, 255, 0.22);
    box-shadow:
      0 8px 38px rgba(0, 0, 0, 0.56),
      0 0 0 1px rgba(71, 118, 255, 0.06),
      inset 0 1px 0 rgba(71, 118, 255, 0.14);
  }


/* ⑤ Light-mode cards — чистіше скло з синюватим відтінком */

  :root:not(.dark) .card, :root:not(.dark) .group-block, :root:not(.dark) .kpi-card{
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(200, 220, 255, 0.70);
    box-shadow: 0 8px 32px rgba(50, 80, 200, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  }


/* ⑥ Group header в dark-mode */

  :root.dark .group-header{
    background: rgba(6, 12, 36, 0.68);
    border-bottom: 1px solid rgba(71, 118, 255, 0.18);
  }


/* ⑦ TopNav — blue-edge glass у dark-mode */

  :root.dark .topnav{
    background: rgba(4, 8, 26, 0.88);
    border-color: rgba(71, 118, 255, 0.20);
    box-shadow: 0 4px 28px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(71, 118, 255, 0.12);
  }
  :root.dark .topnav a.active{
    background: linear-gradient(145deg, #5a90ff, #3362e8 56%, #5548f0);
    box-shadow: 0 8px 24px rgba(51, 98, 232, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  }


/* ⑧ Date pills — glassmorphism + active gradient (як progress step UI) */

  :root.dark .date-pill{
    background: rgba(5, 10, 32, 0.76);
    border-color: rgba(71, 118, 255, 0.16);
  }

  :root.dark .date-slider-arrow{
    background: rgba(5, 10, 32, 0.76);
    border-color: rgba(71, 118, 255, 0.16);
    color: #dbeafe;
  }

  :root.dark .date-pill.today:not(.active){
    background:
      linear-gradient(180deg, rgba(96, 165, 250, 0.22), rgba(96, 165, 250, 0.08)),
      rgba(5, 10, 32, 0.76);
    border-color: rgba(125, 184, 255, 0.82);
    box-shadow: 0 10px 28px rgba(59, 130, 246, 0.28);
  }

.date-pill.active {
  background: linear-gradient(145deg, #5d8cff, #2563eb);
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

  :root.dark .date-pill.active{
    background: linear-gradient(145deg, #7aaeff, #4474ff 54%, #5b48f5);
    border-color: transparent;
    box-shadow: 0 8px 28px rgba(65, 110, 255, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  }


/* ⑨ KPI великі значення — акцент без glow */

  :root.dark .kpi-value{
    color: #6aaaff;
    text-shadow: none;
  }


/* ⑩ Group time — electric blue glow у dark */

  :root.dark .group-time{
    color: #6aaaff;
    text-shadow: none;
  }


/* ⑪ Фінансові великі суми — легкий glow */

  :root.dark .finance-summary-main strong{
    text-shadow: 0 0 22px rgba(71, 118, 255, 0.30);
  }


/* ⑫ Modal glass — deep blue-tinted (як upload modal з purple glow) */

  :root.dark .modal-glass{
    background: rgba(4, 8, 28, 0.93);
    border-color: rgba(71, 118, 255, 0.24);
    box-shadow:
      0 28px 70px rgba(0, 0, 0, 0.68),
      0 0 0 1px rgba(71, 118, 255, 0.08),
      inset 0 1px 0 rgba(71, 118, 255, 0.16);
  }
  :root.dark .modal-backdrop{
    background: rgba(0, 4, 18, 0.42);
  }


/* ⑬ Student row hover — removed (no highlight) */
.student-row { transition: background 0.12s ease; }

/* ⑭ Group count pill glow */

  :root.dark .group-count-pill{
    background: linear-gradient(145deg, #5a90ff, #3362e8);
    box-shadow: 0 0 12px rgba(71, 118, 255, 0.40);
  }


/* ⑮ Finance chart tooltip у dark */

  :root.dark .finance-chart-tooltip{
    background: rgba(4, 8, 30, 0.78);
    border-color: rgba(71, 118, 255, 0.24);
    box-shadow: 0 12px 38px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(71, 118, 255, 0.14);
  }


/* ⑯ Dark-mode link color — яскравіший electric blue */

  :root.dark{
    --link: #6aabff;
  }


/* ══════════════════════════════════════════════════════════════
   ✦ Cards v2 — прозоріші, кут освітлення 35° (не 90°)
   ══════════════════════════════════════════════════════════════ */

/* Dark: прозорий скляний градієнт 35° + shine на top-left краю */

  :root.dark .card, :root.dark .group-block, :root.dark .kpi-card, :root.dark .no-classes-day{
    background: linear-gradient(
      35deg,
      rgba(70, 115, 255, 0.14) 0%,
      rgba(5, 10, 32, 0.46) 48%,
      rgba(3, 7, 22, 0.56) 100%
    );
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid rgba(80, 130, 255, 0.20);
    box-shadow:
      0 14px 44px rgba(0, 0, 0, 0.50),
      /* Кут 35°: shine на top-left */
      inset 1px 1px 0 rgba(150, 195, 255, 0.18),
      /* Тінь на bottom-right */
      inset -1px -1px 0 rgba(0, 0, 0, 0.18);
  }


/* Light: прозоре скло з soft gradientom 35° */

  :root:not(.dark) .card, :root:not(.dark) .group-block, :root:not(.dark) .kpi-card{
    background: linear-gradient(
      35deg,
      rgba(255, 255, 255, 0.80) 0%,
      rgba(236, 244, 255, 0.54) 52%,
      rgba(230, 242, 255, 0.62) 100%
    );
    backdrop-filter: blur(24px) saturate(170%);
    -webkit-backdrop-filter: blur(24px) saturate(170%);
    border: 1px solid rgba(170, 205, 255, 0.55);
    box-shadow:
      0 8px 32px rgba(35, 65, 175, 0.09),
      inset 1px 1px 0 rgba(255, 255, 255, 0.90),
      inset -1px -1px 0 rgba(90, 130, 210, 0.07);
  }


/* ══════════════════════════════════════════════════════════════
   ✦ Cards edge fix — 35° кут освітлення скрізь (не 90°)
   ══════════════════════════════════════════════════════════════ */

/* ① Finance summary items — усуваємо top-only shine */
.finance-summary-main,
.finance-summary-item {
  box-shadow:
    0 14px 36px rgba(50, 65, 180, 0.10),
    inset 1px 1px 0 rgba(255, 255, 255, 0.26),  /* top-left 35° */
    inset -1px -1px 0 rgba(0, 0, 0, 0.06);       /* bottom-right shadow */
}

/* ② Finance summary main — blue→violet (без зеленого), кут 35° */
.finance-summary-main {
  background: linear-gradient(
    35deg,
    rgba(37, 99, 235, 0.92) 0%,
    rgba(109, 40, 217, 0.80) 100%
  );
}

/* ③ Dark mode: finance summary items */

  :root.dark .finance-summary-main, :root.dark .finance-summary-item{
    background: linear-gradient(
      35deg,
      rgba(70, 115, 255, 0.14) 0%,
      rgba(5, 10, 32, 0.46) 48%,
      rgba(3, 7, 22, 0.56) 100%
    );
    border-color: rgba(80, 130, 255, 0.20);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    box-shadow:
      0 14px 42px rgba(0, 0, 0, 0.50),
      inset 1px 1px 0 rgba(150, 195, 255, 0.18),
      inset -1px -1px 0 rgba(0, 0, 0, 0.18);
  }

  :root.dark /* Accent "ОЧІКУВАНО ЛІЗІ" — blue→violet, :root.dark no green */
  .finance-summary-main{
    background: linear-gradient(
      35deg,
      rgba(50, 95, 235, 0.66) 0%,
      rgba(95, 40, 215, 0.56) 100%
    );
    border-color: rgba(100, 140, 255, 0.28);
  }


/* ④ Schedule blocks — 35° замість top+bottom рівної полоски */
.sched-block {
  box-shadow:
    0 18px 48px rgba(74, 62, 130, 0.10),
    inset 1px 1px 0 rgba(255, 255, 255, 0.75),
    inset -1px -1px 0 rgba(0, 0, 0, 0.04);
}

  :root.dark .sched-block{
    box-shadow:
      0 22px 54px rgba(0, 0, 0, 0.44),
      inset 1px 1px 0 rgba(150, 195, 255, 0.14),
      inset -1px -1px 0 rgba(0, 0, 0, 0.18);
  }


/* ⑤ Schedule empty placeholder */
.sched-empty {
  box-shadow:
    0 18px 46px rgba(74, 62, 130, 0.08),
    inset 1px 1px 0 rgba(255, 255, 255, 0.70),
    inset -1px -1px 0 rgba(0, 0, 0, 0.04);
}

/* ⑥ Base .card та .modal-glass — теж 35° (перезаписуємо найстаріші правила) */
.card {
  box-shadow:
    0 20px 52px rgba(74, 62, 130, 0.10),
    inset 1px 1px 0 rgba(255, 255, 255, 0.72),
    inset -1px -1px 0 rgba(0, 0, 0, 0.04);
}

  :root.dark .card{
    box-shadow:
      0 20px 52px rgba(0, 0, 0, 0.42),
      inset 1px 1px 0 rgba(150, 195, 255, 0.12),
      inset -1px -1px 0 rgba(0, 0, 0, 0.16);
  }

.modal-glass {
  box-shadow:
    0 24px 60px rgba(60, 40, 120, 0.18),
    inset 1px 1px 0 rgba(255, 255, 255, 0.82),
    inset -1px -1px 0 rgba(0, 0, 0, 0.06);
}

  :root.dark .modal-glass{
    box-shadow:
      0 28px 70px rgba(0, 0, 0, 0.68),
      inset 1px 1px 0 rgba(150, 195, 255, 0.18),
      inset -1px -1px 0 rgba(0, 0, 0, 0.22);
  }


/* Schedule selected-day actions must stay inside the fixed 50/50 column. */
@media (min-width: 901px) {
  .sched-day-head {
    flex-direction: column;
    align-items: stretch;
  }

  .sched-day-actions {
    width: 100%;
    justify-content: flex-start;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .sched-day-actions .sched-btn-replacement,
  .sched-day-actions .sched-btn-holiday,
  .sched-day-actions .sched-btn-add {
    min-width: 0;
    width: 100%;
  }
}

/* Fast hover feedback: keep the interface crisp without removing polish. */
.topnav a,
.btn,
.btn-primary,
.btn-modal-confirm,
.btn-modal-cancel,
.modal-close,
.modal-option,
.date-pill,
.cal-nav-btn,
.cal-dropdown-item,
.sched-btn-add,
.sched-btn-delete-class,
.sched-btn-holiday,
.sched-btn-replacement,
.sched-btn-remove,
.sched-btn-remove-past,
.sched-candidate,
.sched-create-student,
.sched-time-option,
.sched-btn-edit-time,
.sched-dur-btn,
.btn-cancel-form,
.student-row,
.student-link,
.empty-schedule-link,
.attend-btn,
.btn-attend,
.btn-miss,
.btn-absent,
.btn-reset {
  transition-duration: 45ms !important;
}

@media (prefers-reduced-motion: reduce) {
  .topnav a,
  .btn,
  .btn-primary,
  .btn-modal-confirm,
  .btn-modal-cancel,
  .modal-close,
  .modal-option,
  .date-pill,
  .cal-nav-btn,
  .cal-dropdown-item,
  .sched-btn-add,
  .sched-btn-delete-class,
  .sched-btn-holiday,
  .sched-btn-replacement,
  .sched-btn-remove,
  .sched-btn-remove-past,
  .sched-candidate,
  .sched-create-student,
  .sched-time-option,
  .sched-btn-edit-time,
  .sched-dur-btn,
  .btn-cancel-form,
  .student-row,
  .student-link,
  .empty-schedule-link,
  .attend-btn,
  .btn-attend,
  .btn-miss,
  .btn-absent,
  .btn-reset {
    transition-duration: 0ms !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   ✦ Animated bokeh — замінює статичний SVG на CSS-анімацію
     (SVG-background не анімується в браузерах)
   ══════════════════════════════════════════════════════════════ */

/* Light mode: 5 very soft white-blue bokeh layers */
body {
  background-color: #fbfdff;
  background-image:
    radial-gradient(ellipse 46% 46% at 50% 50%, rgba(190, 220, 255, 0.12) 0%, transparent 100%),
    radial-gradient(ellipse 38% 38% at 50% 50%, rgba(220, 238, 255, 0.12) 0%, transparent 100%),
    radial-gradient(ellipse 34% 34% at 50% 50%, rgba(236, 248, 255, 0.14) 0%, transparent 100%),
    radial-gradient(ellipse 28% 28% at 50% 50%, rgba(255, 255, 255, 0.50) 0%, transparent 100%),
    radial-gradient(ellipse 30% 30% at 50% 50%, rgba(206, 230, 255, 0.10) 0%, transparent 100%);
  background-size: 200% 200%, 200% 200%, 200% 200%, 200% 200%, 200% 200%;
  background-attachment: fixed;
  background-repeat: no-repeat;
  animation: lightBokeh 24s ease-in-out infinite alternate;
}

@keyframes lightBokeh {
  0%   { background-position: 82% 10%, 10% 16%, 18% 80%, 86% 82%, 50% 44%; }
  33%  { background-position: 72% 26%, 20% 32%, 30% 62%, 76% 70%, 42% 58%; }
  66%  { background-position: 76% 18%, 14% 46%, 24% 74%, 82% 76%, 56% 36%; }
  100% { background-position: 66% 22%, 24% 22%, 34% 68%, 78% 74%, 46% 52%; }
}

/* Dark mode: синьо-фіолетово-помаранчеві кулі */

  :root.dark body{
    background-color: #020711;
    background-image:
      radial-gradient(ellipse 42% 42% at 50% 50%, rgba(32,72,220,0.50) 0%, transparent 100%),
      radial-gradient(ellipse 38% 38% at 50% 50%, rgba(86,35,205,0.42) 0%, transparent 100%),
      radial-gradient(ellipse 34% 34% at 50% 50%, rgba(48,58,200,0.38) 0%, transparent 100%),
      radial-gradient(ellipse 28% 28% at 50% 50%, rgba(190,86,22,0.17) 0%, transparent 100%),
      radial-gradient(ellipse 26% 26% at 50% 50%, rgba(70,42,180,0.18) 0%, transparent 100%);
    background-size: 200% 200%, 200% 200%, 200% 200%, 200% 200%, 200% 200%;
    background-attachment: fixed;
    background-repeat: no-repeat;
    animation: darkBokeh 22s ease-in-out infinite alternate;
  }


@keyframes darkBokeh {
  0%   { background-position: 11% 14%, 86% 12%, 20% 74%, 84% 84%, 12% 76%; }
  33%  { background-position: 22% 30%, 76% 24%, 32% 57%, 74% 72%, 20% 60%; }
  66%  { background-position: 15% 50%, 82% 18%, 25% 68%, 80% 80%, 16% 68%; }
  100% { background-position: 27% 22%, 72% 20%, 28% 64%, 82% 76%, 22% 56%; }
}

/* Mobile: fixed не підтримується iOS */
@media (max-width: 768px) {
  body { background-attachment: scroll; }
}

/* ══════════════════════════════════════════════════════════════
   ✦ Gradient border — яскраво top-left, темно bottom-right
     Замість рівномірного border скрізь
   ══════════════════════════════════════════════════════════════ */

/* Скидаємо звичайний border на transparent для всіх карток */
.card,
.group-block,
.kpi-card,
.no-classes-day,
.finance-summary-item,
.sched-block,
.sched-empty {
  border: 1.5px solid transparent !important;
}

/* Light mode: яскравий top-left (145°) → майже прозорий bottom-right */

  :root:not(.dark) .card, :root:not(.dark) .group-block, :root:not(.dark) .kpi-card, :root:not(.dark) .no-classes-day, :root:not(.dark) .finance-summary-item, :root:not(.dark) .sched-empty{
    background:
      linear-gradient(35deg,
        rgba(255,255,255,0.78) 0%,
        rgba(234,244,255,0.56) 100%
      ) padding-box,
      linear-gradient(145deg,
        rgba(255,255,255,0.90) 0%,
        rgba(200,222,255,0.44) 38%,
        rgba(148,192,255,0.14) 66%,
        rgba(88,130,215,0.06) 100%
      ) border-box;
    box-shadow: 0 12px 36px rgba(38,62,178,0.09);
    backdrop-filter: blur(24px) saturate(170%);
    -webkit-backdrop-filter: blur(24px) saturate(170%);
  }

  :root:not(.dark) .sched-block{
    background:
      linear-gradient(145deg,
        rgba(255,255,255,0.64) 0%,
        rgba(255,255,255,0.36) 100%
      ) padding-box,
      linear-gradient(145deg,
        rgba(255,255,255,0.90) 0%,
        rgba(200,222,255,0.44) 38%,
        rgba(148,192,255,0.12) 66%,
        rgba(80,120,210,0.05) 100%
      ) border-box;
  }


/* Dark mode: electric-blue shine top-left → темний shadow bottom-right */

  :root.dark .card, :root.dark .group-block, :root.dark .kpi-card, :root.dark .no-classes-day, :root.dark .finance-summary-item, :root.dark .sched-empty{
    background:
      linear-gradient(35deg,
        rgba(65,110,255,0.13) 0%,
        rgba(5,10,30,0.46) 50%,
        rgba(3,7,20,0.56) 100%
      ) padding-box,
      linear-gradient(145deg,
        rgba(165,205,255,0.54) 0%,    /* top-left: яскравий */
        rgba(100,152,255,0.20) 36%,
        rgba(60,100,220,0.07) 65%,
        rgba(0,0,0,0.18) 100%          /* bottom-right: темний */
      ) border-box;
    box-shadow: 0 14px 44px rgba(0,0,0,0.52);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
  }

  :root.dark .sched-block{
    background:
      linear-gradient(145deg,
        rgba(28,40,68,0.54) 0%,
        rgba(8,12,28,0.46) 100%
      ) padding-box,
      linear-gradient(145deg,
        rgba(165,205,255,0.50) 0%,
        rgba(100,152,255,0.18) 36%,
        rgba(60,100,220,0.06) 65%,
        rgba(0,0,0,0.18) 100%
      ) border-box;
  }

  :root.dark /* Finance accent card — blue→violet без зеленого */
  .finance-summary-main{
    border: 1.5px solid transparent !important;
    background:
      linear-gradient(35deg,
        rgba(48,92,232,0.68) 0%,
        rgba(92,38,212,0.58) 100%
      ) padding-box,
      linear-gradient(145deg,
        rgba(200,220,255,0.60) 0%,
        rgba(140,170,255,0.24) 36%,
        rgba(90,120,225,0.08) 65%,
        rgba(0,0,0,0.14) 100%
      ) border-box;
  }


/* ═══════════════════════════════════════════════════════════
   Cal-Nav v2 — unified glass calendar navigation
   ═══════════════════════════════════════════════════════════ */

/* Container */
.cal-nav-v2 {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  position: relative;
}

.dash-cal-head .cal-nav-v2,
.sched-cal-head .cal-nav-v2,
.student-cal-title .cal-nav-v2 {
  flex: 1;
  min-width: 0;
}

.cal-nav-pickers,
.cal-nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Base button / link style shared by all nav elements */
.cal-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid rgba(120, 160, 255, 0.28);
  background: rgba(255, 255, 255, 0.50);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
  box-shadow: 0 2px 8px rgba(70, 100, 220, 0.10), inset 0 1px 0 rgba(255,255,255,0.55);
}

.cal-nav-btn:hover,
.cal-nav-btn:focus-visible {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(90, 140, 255, 0.55);
  box-shadow: 0 4px 14px rgba(70, 100, 220, 0.18), inset 0 1px 0 rgba(255,255,255,0.65);
  color: var(--link);
  outline: none;
  text-decoration: none;
}

/* Arrow buttons (‹ ›) — circular */
.cal-nav-arrow {
  width: 34px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

/* Today button — slightly more prominent */
.cal-nav-today {
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Picker button — month / year with chevron */
.cal-nav-picker-btn {
  min-width: 88px;
}

.cnav-chevron {
  flex-shrink: 0;
  opacity: 0.55;
  transition: transform 0.18s;
}
.cal-nav-picker-btn[aria-expanded="true"] .cnav-chevron {
  transform: rotate(180deg);
  opacity: 0.85;
}

/* Picker wrapper — needed for absolute dropdown */
.cal-nav-picker {
  position: relative;
}

/* ── Dropdown panel ── */
.cal-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  min-width: 160px;
  border-radius: 16px;
  border: 1px solid rgba(120, 160, 255, 0.28);
  background: rgba(245, 248, 255, 0.88);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 0 16px 48px rgba(50, 80, 200, 0.16), 0 2px 8px rgba(0,0,0,0.06);
  padding: 8px;
  animation: calDropIn 0.16s ease-out;
}

.cal-dropdown[hidden] {
  display: none !important;
}

@keyframes calDropIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0)     scale(1);    }
}

@keyframes calDropInLeft {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)     scale(1);    }
}

/* Month dropdown — stable compact layout */
.cal-dropdown--months {
  min-width: 188px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
}

/* Year dropdown — single column */
.cal-dropdown--years {
  min-width: 110px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Dropdown item */
.cal-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 8px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.13s, color 0.13s;
}

.cal-dropdown-item:hover {
  background: rgba(80, 130, 255, 0.13);
  color: var(--link);
  text-decoration: none;
}

.cal-dropdown-item--active {
  background: rgba(59, 110, 246, 0.15);
  color: var(--link);
  font-weight: 700;
}

/* ── Dark mode ── */

  :root.dark .cal-nav-btn{
    background: rgba(20, 30, 60, 0.55);
    border-color: rgba(100, 150, 255, 0.22);
    box-shadow: 0 2px 8px rgba(0,0,0,0.30), inset 0 1px 0 rgba(180,210,255,0.10);
  }

  :root.dark .cal-nav-btn:hover, :root.dark .cal-nav-btn:focus-visible{
    background: rgba(30, 50, 100, 0.65);
    border-color: rgba(100, 160, 255, 0.50);
    box-shadow: 0 4px 16px rgba(0,0,0,0.40), inset 0 1px 0 rgba(180,210,255,0.18);
    color: #93c5fd;
  }

  :root.dark .cal-dropdown{
    background: rgba(10, 15, 35, 0.90);
    border-color: rgba(80, 130, 255, 0.25);
    box-shadow: 0 20px 56px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.30);
  }

  :root.dark .cal-dropdown-item:hover{
    background: rgba(80, 130, 255, 0.18);
    color: #93c5fd;
  }

  :root.dark .cal-dropdown-item--active{
    background: rgba(59, 110, 246, 0.25);
    color: #93c5fd;
  }


/* Finance page — cal-nav-v2 in page-header */
.finance-month-nav.cal-nav-v2 {
  margin-bottom: 0;
  min-width: 320px;
}

/* Student page — remove old span spacing */
.student-cal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

#student-calendar-section .student-section-head {
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 18px;
  max-width: 520px;
}

#student-calendar-section .student-cal-title {
  margin-left: auto;
  justify-content: flex-end;
}

#student-calendar-section .student-cal-title .cal-nav-v2 {
  justify-content: flex-end;
}

/* Mobile: smaller fonts + compact */
@media (max-width: 480px) {
  .cal-nav-v2 {
    width: 100%;
  }

  .cal-nav-btn {
    height: 30px;
    padding: 0 9px;
    font-size: 12px;
  }
  .cal-nav-arrow {
    width: 30px;
    font-size: 18px;
  }
  .cal-nav-picker-btn {
    min-width: 72px;
  }
  .cal-nav-today {
    min-width: auto;
  }
  .cal-dropdown--months {
    min-width: min(220px, calc(100vw - 32px));
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cal-nav-picker:first-child .cal-dropdown {
    left: 0;
    right: auto;
    transform: none;
    animation-name: calDropInLeft;
  }

  .finance-month-nav.cal-nav-v2 {
    min-width: 0;
  }

  .finance-month-nav .cal-dropdown {
    left: 0;
    transform: none;
  }

  .finance-month-nav .cal-dropdown--months {
    min-width: min(220px, calc(100vw - 32px));
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Narrow phones: compact sched-cal-head nav so ‹ › are never clipped.
   Keeps the 📅 emoji, tightens gaps and picker padding instead.
   600px covers all standard iPhones (375-430px) with headroom to spare. */
@media (max-width: 600px) {
  .sched-cal-head {
    gap: 6px;
  }
  .sched-cal-head .cal-nav-v2 {
    gap: 3px;
  }
  .sched-cal-head .cal-nav-pickers,
  .sched-cal-head .cal-nav-actions {
    gap: 3px;
  }
  .sched-cal-head .cal-nav-picker-btn {
    padding-left: 7px;
    padding-right: 7px;
    min-width: 56px;
  }
  .sched-cal-head .cal-nav-today {
    padding-left: 7px;
    padding-right: 7px;
  }
}

@media (max-width: 700px) {
  #student-calendar-section .student-section-head {
    align-items: stretch;
    flex-direction: column;
    flex-wrap: nowrap;
  }

  #student-calendar-section .student-cal-title {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  #student-calendar-section .student-cal-title .cal-nav-v2 {
    justify-content: flex-start;
  }
}

/* ═══════════════════════════════════════════════════════════
   Glass typography — subtle gradient text on headings/captions
   ═══════════════════════════════════════════════════════════ */
:root {
  --text-glass-gradient:
    linear-gradient(115deg,
      rgba(255,255,255,0.96) 0%,
      rgba(238,244,255,0.92) 56%,
      rgba(205,222,255,0.86) 100%);
  --muted-glass-gradient:
    linear-gradient(115deg,
      rgba(214,224,246,0.70) 0%,
      rgba(185,200,228,0.62) 58%,
      rgba(158,180,218,0.56) 100%);
  --empty-title-gradient:
    linear-gradient(115deg,
      rgba(255,255,255,0.96) 0%,
      rgba(236,242,252,0.90) 100%);
}


  :root:not(.dark){
    --text-glass-gradient:
      linear-gradient(115deg,
        rgba(15,23,42,0.88) 0%,
        rgba(38,72,145,0.78) 58%,
        rgba(63,82,150,0.68) 100%);
    --muted-glass-gradient:
      linear-gradient(115deg,
        rgba(71,85,105,0.72) 0%,
        rgba(78,105,154,0.58) 58%,
        rgba(92,105,150,0.48) 100%);
    --empty-title-gradient:
      linear-gradient(115deg,
        rgba(15,23,42,0.88) 0%,
        rgba(64,78,106,0.76) 100%);
  }


.page-header h1,
.student-header h1,
.student-section-head h2,
.finance-card h2,
.finance-chart-header h2,
.sched-day-head h2,
.modal-title,
h1,
h2 {
  color: transparent;
  background-image: var(--text-glass-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 1px 18px rgba(140, 180, 255, 0.14);
}

.page-date,
.page-meta,
.dash-section-label,
.student-section-head span,
.sched-weekday,
.sched-empty-row,
.finance-card-head p,
.finance-card-head span,
.finance-chart-legend,
.modal-subtitle,
.modal-copy,
.modal-option-desc,
.muted-text,
.cal-legend,
.sched-legend,
.finance-summary-item span,
.finance-summary-item small,
.finance-note *,
.finance-empty *,
.sched-empty > div:not(.sched-empty-btns),
.sched-empty--compact > div {
  color: transparent;
  background-image: var(--muted-glass-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 1px 16px rgba(120, 160, 230, 0.10);
}

.dash-section-label,
.page-meta,
.page-date {
  opacity: 0.92;
}

.dash-cal-head .dash-section-label,
.sched-cal-head .dash-section-label {
  color: var(--text);
  background-image: none;
  -webkit-text-fill-color: currentColor;
  font-size: 0;
  opacity: 1;
}

.dash-cal-head .dash-section-label::before,
.sched-cal-head .dash-section-label::before {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  background:
    linear-gradient(#ff8a8a, #ff8a8a) 0 0 / 100% 4px no-repeat,
    linear-gradient(135deg, rgba(255,255,255,0.95), rgba(160,200,255,0.74));
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.58),
    inset 0 -5px 10px rgba(60,110,230,0.22),
    0 4px 12px rgba(80,130,255,0.20);
}

.sched-empty > div:first-child:not(.sched-empty-btns) {
  background-image: var(--empty-title-gradient);
  text-shadow: 0 1px 14px rgba(255, 255, 255, 0.10);
}

/* ═══════════════════════════════════════════════════════════
   Final polish — students modal, calmer glass and light theme
   ═══════════════════════════════════════════════════════════ */

  :root:not(.dark) body{
    background-color: #f7fbff;
    background-image:
      radial-gradient(ellipse 46% 46% at 50% 50%, rgba(174,210,255,0.24) 0%, transparent 100%),
      radial-gradient(ellipse 38% 38% at 50% 50%, rgba(207,231,255,0.22) 0%, transparent 100%),
      radial-gradient(ellipse 34% 34% at 50% 50%, rgba(225,242,255,0.24) 0%, transparent 100%),
      radial-gradient(ellipse 28% 28% at 50% 50%, rgba(255,255,255,0.42) 0%, transparent 100%),
      radial-gradient(ellipse 30% 30% at 50% 50%, rgba(194,224,255,0.18) 0%, transparent 100%);
  }

  :root:not(.dark){
    --text-glass-gradient:
      linear-gradient(115deg,
        rgba(20,31,52,0.94) 0%,
        rgba(42,67,118,0.86) 58%,
        rgba(63,88,145,0.76) 100%);
    --muted-glass-gradient:
      linear-gradient(115deg,
        rgba(74,88,112,0.78) 0%,
        rgba(84,107,150,0.64) 58%,
        rgba(92,116,160,0.56) 100%);
    --empty-title-gradient:
      linear-gradient(115deg,
        rgba(20,31,52,0.92) 0%,
        rgba(58,73,105,0.82) 100%);
  }



  :root.dark .card, :root.dark .group-block, :root.dark .kpi-card, :root.dark .no-classes-day, :root.dark .finance-summary-item, :root.dark .sched-empty{
    background:
      linear-gradient(35deg,
        rgba(45,78,190,0.095) 0%,
        rgba(4,9,28,0.54) 50%,
        rgba(2,6,18,0.66) 100%
      ) padding-box,
      linear-gradient(145deg,
        rgba(135,180,245,0.42) 0%,
        rgba(82,125,235,0.16) 36%,
        rgba(48,82,190,0.05) 65%,
        rgba(0,0,0,0.22) 100%
      ) border-box;
  }

  :root.dark .group-table tbody tr, :root.dark .sched-student-row{
    background: rgba(10, 17, 44, 0.16);
  }


.student-new-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  padding-left: 18px;
  padding-right: 18px;
}

@media (max-width: 520px) {
  .student-new-btn {
    flex: 0 0 auto;
    padding-left: 13px;
    padding-right: 13px;
    font-size: 13px;
  }
}

.student-modal-backdrop {
  z-index: 520;
}

.student-modal-glass {
  max-width: 860px;
  max-height: min(86vh, 900px);
  overflow: auto;
  padding: 26px;
}

.student-modal-header {
  margin-bottom: 18px;
  padding-right: 34px;
}

.student-modal-form {
  border-color: rgba(255, 255, 255, 0.28);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.34), rgba(218, 235, 255, 0.17) 52%, rgba(167, 199, 255, 0.12));
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.42),
    inset -1px -1px 0 rgba(255, 255, 255, 0.08),
    0 18px 52px rgba(70, 112, 210, 0.16);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
}

.student-modal-submit {
  flex: 0 0 auto;
}

.cal-nav-v2--loading {
  opacity: 0.72;
  pointer-events: none;
}


  :root.dark .student-modal-form{
    border-color: rgba(135, 178, 255, 0.22);
    background:
      linear-gradient(145deg, rgba(102, 144, 255, 0.15), rgba(11, 18, 42, 0.34) 54%, rgba(5, 9, 25, 0.42));
    box-shadow:
      inset 1px 1px 0 rgba(180, 210, 255, 0.15),
      inset -1px -1px 0 rgba(0, 0, 0, 0.22),
      0 18px 54px rgba(0, 0, 0, 0.32);
  }

  :root.dark .student-modal-form .avatar-option span, :root.dark .student-modal-form .student-edit-grid input, :root.dark .student-modal-form .student-edit-grid select, :root.dark .student-modal-form .student-edit-grid textarea, :root.dark .student-modal-form .apparatus-check{
    background: rgba(8, 14, 32, 0.54);
    border-color: rgba(142, 184, 255, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  }

  :root.dark .apparatus-check-input:checked + .apparatus-check,
  :root.dark .student-modal-form .apparatus-check-input:checked + .apparatus-check{
    background: rgba(96, 165, 250, 0.22);
    border-color: rgba(96, 165, 250, 0.82);
    color: #dbeafe;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.14),
      0 0 0 1px rgba(96, 165, 250, 0.18),
      0 10px 26px rgba(37, 99, 235, 0.14);
  }


body.modal-open {
  overflow: hidden;
}

.schedule-confirm-backdrop {
  z-index: 530;
}

.schedule-confirm-glass {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.32), rgba(218, 235, 255, 0.16) 55%, rgba(167, 199, 255, 0.11));
}


  :root.dark .sched-btn-holiday{
    border-color: rgba(125, 211, 252, 0.28);
    background: rgba(14, 165, 233, 0.07);
    color: #93c5fd;
  }

  :root.dark .sched-btn-holiday:hover{
    background: rgba(14, 165, 233, 0.13);
    border-color: rgba(125, 211, 252, 0.48);
  }

  :root.dark .sched-btn-replacement{
    border-color: rgba(167, 139, 250, 0.34);
    background: rgba(139, 92, 246, 0.10);
    color: #c4b5fd;
  }

  :root.dark .sched-btn-replacement:hover{
    background: rgba(139, 92, 246, 0.16);
    border-color: rgba(196, 181, 253, 0.52);
  }

  :root.dark .schedule-confirm-glass{
    background:
      linear-gradient(145deg, rgba(78, 116, 230, 0.16), rgba(10, 17, 42, 0.70) 56%, rgba(4, 8, 25, 0.78));
  }


@media (max-width: 1180px) and (min-width: 701px) {
  .sched-cal-head {
    flex-wrap: wrap;
  }

  .sched-cal-head .cal-nav-v2 {
    flex: 1 1 420px;
  }

  .sched-day-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .sched-day-head {
    flex-direction: column;
    align-items: stretch;
  }

  .sched-day-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    justify-content: stretch;
  }

  .sched-day-actions .sched-btn-replacement,
  .sched-day-actions .sched-btn-holiday,
  .sched-day-actions .sched-btn-add {
    min-width: 0;
    width: 100%;
  }

  .student-modal-glass {
    max-height: calc(100vh - 32px);
    padding: 22px 18px;
  }

  .student-modal-form .student-edit-grid {
    grid-template-columns: 1fr;
  }

  .student-modal-form .student-edit-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .student-modal-form .student-edit-actions button {
    width: 100%;
  }
}

/* Final pass — steadier schedule grid and calmer blue glass */

  :root:not(.dark) .modal-backdrop{
    background: rgba(104, 128, 158, 0.18);
  }

  :root:not(.dark) .modal-glass{
    background:
      linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(232, 244, 255, 0.50) 54%, rgba(214, 235, 255, 0.38));
    border-color: rgba(255, 255, 255, 0.88);
    box-shadow:
      0 26px 76px rgba(74, 111, 170, 0.22),
      inset 1px 1px 0 rgba(255, 255, 255, 0.92),
      inset -1px -1px 0 rgba(120, 160, 220, 0.12);
  }

  :root:not(.dark) .modal-title{
    color: rgba(28, 44, 72, 0.96);
  }

  :root:not(.dark) .modal-subtitle, :root:not(.dark) .modal-copy, :root:not(.dark) .modal-option-desc{
    color: rgba(70, 91, 125, 0.72);
  }

  :root:not(.dark) .modal-option{
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(120, 160, 220, 0.20);
  }

  :root:not(.dark) .modal-note-input{
    background: rgba(255, 255, 255, 0.52);
    border-color: rgba(120, 160, 220, 0.22);
  }


@media (min-width: 901px) {
  .sched-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .sched-cal-card,
  .sched-day-panel {
    min-width: 0;
    width: 100%;
  }

  .sched-cal-head {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
  }

  .sched-cal-head .dash-section-label {
    grid-column: 1;
    grid-row: 1;
  }

  .sched-cal-head .cal-nav-v2 {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    flex: none;
    min-width: 0;
    justify-content: space-between;
  }

  .sched-cal-head .cal-nav-btn {
    padding-left: 11px;
    padding-right: 11px;
  }

  .sched-cal-head .cal-nav-arrow {
    width: 34px;
    padding: 0;
  }

  .sched-day-panel {
    min-height: 320px;
  }

  .sched-loading {
    min-height: 360px;
  }
}

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

.sched-create-form {
  border: 1.5px solid transparent;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.54), rgba(230, 243, 255, 0.34) 55%, rgba(208, 232, 255, 0.22)) padding-box,
    linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(142, 190, 255, 0.34) 54%, rgba(78, 128, 210, 0.08)) border-box;
  box-shadow:
    0 20px 56px rgba(64, 96, 170, 0.14),
    inset 1px 1px 0 rgba(255, 255, 255, 0.72),
    inset -1px -1px 0 rgba(90, 130, 190, 0.08);
}


  :root.dark .sched-create-form{
    background:
      linear-gradient(145deg, rgba(66, 104, 210, 0.16), rgba(10, 17, 42, 0.48) 56%, rgba(5, 9, 25, 0.54)) padding-box,
      linear-gradient(145deg, rgba(160, 205, 255, 0.46), rgba(90, 140, 255, 0.16) 54%, rgba(0, 0, 0, 0.18)) border-box;
    border-color: transparent;
    box-shadow:
      0 22px 60px rgba(0, 0, 0, 0.48),
      inset 1px 1px 0 rgba(170, 210, 255, 0.13),
      inset -1px -1px 0 rgba(0, 0, 0, 0.22);
  }


/* ── Archive section + button ────────────────────────────── */
/* The archive section reuses .group-time-text styling identical to
   other "non-time" sections (Індивідуальні, Без абонементу). No
   custom overrides here on purpose. */

.student-archive-form {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--card-border);
}
.btn-archive-toggle {
  appearance: none;
  border: 1px solid rgba(220, 38, 38, 0.32);
  background: rgba(220, 38, 38, 0.08);
  color: rgb(185, 28, 28);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.btn-archive-toggle:hover {
  background: rgba(220, 38, 38, 0.14);
}
.btn-archive-toggle:active {
  transform: translateY(1px);
}
.btn-archive-toggle--restore {
  border-color: rgba(34, 197, 94, 0.36);
  background: rgba(34, 197, 94, 0.10);
  color: rgb(21, 128, 61);
}
.btn-archive-toggle--restore:hover {
  background: rgba(34, 197, 94, 0.18);
}
/* Hard-delete button (only shown when student has no history) */
.btn-archive-toggle--delete {
  border-color: rgba(120, 113, 108, 0.45);
  background: rgba(120, 113, 108, 0.10);
  color: rgb(68, 64, 60);
}
.btn-archive-toggle--delete:hover {
  background: rgba(220, 38, 38, 0.14);
  border-color: rgba(220, 38, 38, 0.40);
  color: rgb(185, 28, 28);
}
:root.dark .btn-archive-toggle--delete {
  border-color: rgba(168, 162, 158, 0.30);
  background: rgba(168, 162, 158, 0.10);
  color: rgb(214, 211, 209);
}
:root.dark .btn-archive-toggle--delete:hover {
  background: rgba(252, 165, 165, 0.14);
  border-color: rgba(252, 165, 165, 0.40);
  color: rgb(252, 165, 165);
}
/* Layout for the row containing archive + delete buttons */
.student-danger-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--card-border);
}
.student-danger-row .student-archive-form {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}


  :root.dark .btn-archive-toggle{
    border-color: rgba(248, 113, 113, 0.34);
    background: rgba(248, 113, 113, 0.12);
    color: rgb(252, 165, 165);
  }
  :root.dark .btn-archive-toggle:hover{
    background: rgba(248, 113, 113, 0.20);
  }
  :root.dark .btn-archive-toggle--restore{
    border-color: rgba(74, 222, 128, 0.36);
    background: rgba(74, 222, 128, 0.14);
    color: rgb(134, 239, 172);
  }


/* Schedule student name link — match journal styling */
.sched-student-name.student-link {
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.sched-student-name.student-link:hover .student-name-text {
  text-decoration: underline;
}

/* ── Nav hover highlighting ──────────────────────────────── */
.topnav a {
  transition: background 0.18s, color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.topnav a:not(.active):hover {
  background: rgba(37, 99, 235, 0.10);
  color: var(--link);
  transform: translateY(-1px);
}
.topnav a:not(.active):active {
  transform: translateY(0);
  background: rgba(37, 99, 235, 0.18);
}
.topnav a.active:hover {
  filter: brightness(1.06);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.36);
}
:root.dark .topnav a:not(.active):hover {
  background: rgba(96, 165, 250, 0.14);
  color: #c7d8ff;
}
:root.dark .topnav a:not(.active):active {
  background: rgba(96, 165, 250, 0.22);
}

/* ── Settings gear button (in topnav) ────────────────────── */
.nav-settings {
  appearance: none;
  margin-left: auto;       /* push to the right */
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  width: 38px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.4s;
}
.nav-settings:hover {
  background: rgba(37, 99, 235, 0.10);
  color: var(--link);
  transform: rotate(60deg);
}
.nav-settings:active {
  transform: rotate(60deg) scale(0.94);
}
:root.dark .nav-settings {
  color: #9ca3af;
}
:root.dark .nav-settings:hover {
  background: rgba(96, 165, 250, 0.14);
  color: #c7d8ff;
}

/* ── Settings modal ──────────────────────────────────────── */
.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.settings-backdrop--open { display: flex; }
.settings-glass {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 32px 80px rgba(15, 23, 42, 0.30);
  padding: 22px 22px 20px;
  width: 100%;
  max-width: 420px;
}
.settings-close {
  position: absolute;
  top: 10px;
  right: 12px;
  appearance: none;
  border: none;
  background: transparent;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
}
.settings-close:hover { background: rgba(0,0,0,0.05); color: var(--text); }
.settings-title {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.settings-row { margin-bottom: 14px; }
.settings-row-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.theme-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--card-soft);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.theme-option:hover {
  border-color: var(--link);
  background: rgba(37, 99, 235, 0.06);
}
.theme-option--active {
  border-color: var(--link);
  background: rgba(37, 99, 235, 0.10);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}
.theme-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.theme-option-icon { font-size: 22px; line-height: 1; }
.settings-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  margin-top: 4px;
  border: 1px solid rgba(239, 68, 68, 0.24);
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}
.settings-logout:hover {
  background: rgba(239, 68, 68, 0.13);
  border-color: rgba(239, 68, 68, 0.36);
}
:root.dark .settings-glass {
  background: #111827;
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.48);
}
:root.dark .settings-close:hover { background: rgba(255,255,255,0.06); }
:root.dark .theme-option {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}
:root.dark .theme-option:hover {
  border-color: var(--link);
  background: rgba(96, 165, 250, 0.10);
}
:root.dark .theme-option--active {
  background: rgba(96, 165, 250, 0.16);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}
:root.dark .settings-logout {
  background: rgba(248, 113, 113, 0.10);
  border-color: rgba(248, 113, 113, 0.24);
  color: #fca5a5;
}

/* ── Subscription progress tube (water-tube style) ───────── */
.student-summary-item--progress {
  grid-column: 1 / -1;
}
.student-writeoff-open {
  margin-top: 14px;
}
.student-writeoff-open--urgent {
  border-color: #e6a817;
  color: #b37400;
}
.sub-expired-alert {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fff8e6;
  border: 1px solid #e6a817;
  border-radius: 8px;
  font-size: 13px;
  color: #7a5200;
  line-height: 1.45;
}
.student-writeoff-date {
  display: grid;
  gap: 8px;
  margin: 12px 0 18px;
}
.lesson-tube-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.lesson-tube-meta-title {
  font-size: 13px;
  color: var(--muted);
}
.lesson-tube-meta-counter {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.lesson-tube-meta-counter span { color: var(--muted); font-weight: 500; }

.lesson-tube {
  position: relative;
  display: flex;
  height: 26px;
  border-radius: 14px;
  padding: 3px;
  gap: 0;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.10) 0%, rgba(15, 23, 42, 0.04) 100%);
  box-shadow:
    inset 0 1px 2px rgba(15, 23, 42, 0.18),
    inset 0 -1px 0 rgba(255, 255, 255, 0.45);
  overflow: visible; /* tooltips must escape the tube */
}
/* Track is just a flex row — NO overflow:hidden here so tooltips show.
   The rounded ends are handled by giving the first/last cell radius. */
.lesson-tube-track {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: visible;
}
/* Glassy top highlight running across the tube */
.lesson-tube-track::before {
  content: '';
  position: absolute;
  top: 1px;
  left: 8px;
  right: 8px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
  pointer-events: none;
  z-index: 2;
}

.lesson-tube-cell {
  appearance: none;
  border: none;
  flex: 1 1 0;
  height: 100%;
  border-radius: 0;
  background: rgba(15, 23, 42, 0.05);
  position: relative;
  cursor: default;
  padding: 0;
  transition: filter 0.15s, box-shadow 0.2s;
  /* Thin separator line to the right of every cell except the last */
  box-shadow: inset -1px 0 0 rgba(15, 23, 42, 0.18);
}
.lesson-tube-cell:first-child {
  border-radius: 11px 0 0 11px;
}
.lesson-tube-cell:last-child {
  border-radius: 0 11px 11px 0;
  box-shadow: none;
}
.lesson-tube-cell:only-child {
  border-radius: 11px;
  box-shadow: none;
}
.lesson-tube-cell--used {
  cursor: pointer;
  background:
    linear-gradient(180deg, #6ec0ff 0%, #2563eb 55%, #1e40af 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    inset -1px 0 0 rgba(255, 255, 255, 0.30);
}
.lesson-tube-cell--used:last-child {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}
.lesson-tube-cell--used:only-child {
  border-radius: 11px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}
/* Water reflection inside used cells */
.lesson-tube-cell--used::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 0;
  right: 0;
  height: 35%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
  pointer-events: none;
  border-radius: inherit;
}
.lesson-tube-cell--missed {
  background:
    linear-gradient(180deg, #ff8b8b 0%, #dc2626 55%, #991b1b 100%);
}
/* Hover/focus highlight ONLY on used cells — empty cells stay quiet. */
.lesson-tube-cell--used:hover,
.lesson-tube-cell--used:focus-visible,
.lesson-tube-cell--used.lesson-tube-cell--active {
  z-index: 3;
  outline: none;
  filter: brightness(1.18) saturate(1.20);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(0, 0, 0, 0.20),
    0 0 0 2px rgba(37, 99, 235, 0.85),
    0 0 14px 0 rgba(37, 99, 235, 0.50);
}
.lesson-tube-cell--missed:hover,
.lesson-tube-cell--missed:focus-visible,
.lesson-tube-cell--missed.lesson-tube-cell--active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(0, 0, 0, 0.20),
    0 0 0 2px rgba(220, 38, 38, 0.85),
    0 0 14px 0 rgba(220, 38, 38, 0.50);
}

/* ─── Liquid-glass tooltip ─────────────────────────────────── */
.lesson-tube-cell-tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.42);
  color: #1f2937;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 1000;
  box-shadow:
    0 14px 30px rgba(15, 23, 42, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}
.lesson-tube-cell-tip-num {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.16);
  color: #1e40af;
}
.lesson-tube-cell-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.62);
  filter: drop-shadow(0 1px 0 rgba(15, 23, 42, 0.06));
}
/* Show tooltip ONLY on used cells — empty cells don't have a meaningful date */
.lesson-tube-cell--used:hover .lesson-tube-cell-tip,
.lesson-tube-cell--used:focus-visible .lesson-tube-cell-tip,
.lesson-tube-cell--used.lesson-tube-cell--active .lesson-tube-cell-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

:root.dark .lesson-tube {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.32) 0%, rgba(0, 0, 0, 0.18) 100%);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.55),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}
:root.dark .lesson-tube-cell {
  background: rgba(255, 255, 255, 0.04);
}
:root.dark .lesson-tube-cell--used {
  background: linear-gradient(180deg, #93c5fd 0%, #3b82f6 55%, #1e40af 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -1px 0 rgba(0, 0, 0, 0.32);
}
:root.dark .lesson-tube-cell--missed {
  background: linear-gradient(180deg, #fca5a5 0%, #ef4444 55%, #991b1b 100%);
}
:root.dark .lesson-tube-cell {
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}
:root.dark .lesson-tube-cell:last-child {
  box-shadow: none;
}
:root.dark .lesson-tube-cell--used {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -1px 0 rgba(0, 0, 0, 0.32),
    inset -1px 0 0 rgba(255, 255, 255, 0.18);
}
:root.dark .lesson-tube-cell--used:last-child {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -1px 0 rgba(0, 0, 0, 0.32);
}
:root.dark .lesson-tube-cell-tip {
  background: rgba(30, 41, 59, 0.62);
  border-color: rgba(255, 255, 255, 0.10);
  color: #f3f4f6;
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.20);
}
:root.dark .lesson-tube-cell-tip-num {
  background: rgba(96, 165, 250, 0.20);
  color: #c7d8ff;
}
:root.dark .lesson-tube-cell-tip::after {
  border-top-color: rgba(30, 41, 59, 0.72);
}

/* ── Confirm modal (archive, attendance, etc.) ───────────── */
.confirm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15, 23, 42, 0.36);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.confirm-modal-backdrop--open { display: flex; }
.confirm-modal-glass { max-width: 460px; }
.btn-modal-confirm--danger {
  background: linear-gradient(145deg, #ff7b7b, #dc2626);
  box-shadow: 0 10px 24px rgba(220, 38, 38, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}
.btn-modal-confirm--danger:hover {
  background: linear-gradient(145deg, #ff9b9b, #b91c1c);
}

/* ── Reason picker (Не був / Не прийде) ──────────────────── */
.reason-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 12px 0 16px;
}
.reason-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--card-soft);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
}
.reason-option:hover {
  border-color: var(--link);
  background: rgba(37, 99, 235, 0.06);
}
.reason-option--active {
  border-color: var(--link);
  background: rgba(37, 99, 235, 0.10);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}
.reason-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.reason-option-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.reason-option-body { flex: 1 1 0; min-width: 0; }
.reason-option-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.reason-option-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
:root.dark .reason-option {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}
:root.dark .reason-option:hover {
  border-color: var(--link);
  background: rgba(96, 165, 250, 0.10);
}
:root.dark .reason-option--active {
  background: rgba(96, 165, 250, 0.16);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}

/* ── Makeup / Debt tile ─────────────────────────────────── */
.makeup-debt-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.makeup-debt-sep { color: var(--muted); font-weight: 400; font-size: 1.2rem; }
.makeup-count { color: #b45309; }
.makeup-count--zero { color: var(--muted); }
.debt-count { color: #dc2626; }
.debt-count--zero { color: var(--muted); }
:root.dark .makeup-count { color: #fbbf24; }
:root.dark .debt-count  { color: #fca5a5; }
.student-summary-item--makeup .value-small { color: var(--muted); }

/* Schedule row marker for makeup-funded bookings */
.sched-student-row.makeup-source .sched-student-name::after {
  content: '🎁 відробка';
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(180, 83, 9, 0.15);
  color: #b45309;
  white-space: nowrap;
}
:root.dark .sched-student-row.makeup-source .sched-student-name::after {
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
}

/* ═══════════════════════════════════════════════════════════
   Finance v2 — KPI cards, donut, detail cards, journal, modals
   ═══════════════════════════════════════════════════════════ */

/* Finance page header — three logical blocks (title / period / CTAs)
   that flow differently on desktop vs mobile.
   Desktop ≥720px:  title (left)  ·  period (right of title)  ·  CTAs (top-right)
   Mobile  <720px:  title row 1  /  period row 2 (chips, scroll if needed)
                    /  CTAs row 3 (split 50/50, full width)               */
.finance-page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "title period cta";
  align-items: center;
  column-gap: 16px;
  row-gap: 10px;
  margin-bottom: 18px;
}
.finance-page-title  { grid-area: title; min-width: 0; }
.finance-page-header .finance-period-switch { grid-area: period; }
.finance-cta-row {
  grid-area: cta;
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 10px;
}
.finance-cta-row > .btn,
.finance-cta-row > .btn-soft {
  width: 100%;
  height: 38px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .finance-page-header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "period"
      "cta";
  }
  .finance-page-header .finance-period-switch {
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .finance-page-header .finance-period-switch::-webkit-scrollbar { display: none; }
  .finance-period-btn,
  .finance-period-month { height: 28px; padding: 0 10px; font-size: 12px; }
  .finance-period-month { padding-right: 22px; }
  /* CTAs occupy the full row, split 50/50 */
  .finance-cta-row {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .finance-cta-row > .btn,
  .finance-cta-row > .btn-soft {
    width: 100%;
    height: 40px;
  }
}
/* Quick-period switch */
.finance-period-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--card-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.finance-period-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-radius: 9px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.finance-period-btn:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
}
.finance-period-btn--active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.10);
}
:root.dark .finance-period-switch {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}
:root.dark .finance-period-btn--active {
  background: rgba(96, 165, 250, 0.18);
  color: #fff;
}

/* "(month)" chip — when single-month mode is active, embeds a transparent
   native <select> for picking another month. In range mode it's an <a>
   link back to single-month view (no dropdown until you switch back). */
.finance-period-month {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 26px 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.finance-period-month:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
}
.finance-period-month::after {
  content: '▾';
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--muted);
  pointer-events: none;
}
.finance-period-month--active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.10);
}
.finance-period-month--active::after { color: var(--text); }
.finance-period-month select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  background: transparent;
  font: inherit;
}
:root.dark .finance-period-month--active {
  background: rgba(96, 165, 250, 0.18);
  color: #fff;
}
:root.dark .finance-period-month--active::after { color: #fff; }
/* Equalise the two header action buttons so they share the same height
   and rounding regardless of which `.btn-*` variant is applied. */
.finance-header-actions > .btn,
.finance-header-actions > .btn-soft {
  height: 38px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.btn-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-soft);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
}
.btn-soft:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.32);
}
:root.dark .btn-soft {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.10);
}
:root.dark .btn-soft:hover {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.36);
}

/* KPI row -------------------------------------------------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.kpi-card {
  position: relative;
  padding: 18px 20px 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 132px;
}
.kpi-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.kpi-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-top: 2px;
}
.kpi-delta {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.kpi-delta--up   { color: #10b981; }
.kpi-delta--down { color: #ef4444; }
:root.dark .kpi-delta--up   { color: #34d399; }
:root.dark .kpi-delta--down { color: #f87171; }
.kpi-card--debt .kpi-value { color: #ef4444; }
:root.dark .kpi-card--debt .kpi-value { color: #fca5a5; }
/* Валовий (завжди +) та Чистий дохід (+ зелений / − червоний). Колір цифри
   керується класом на самому значенні, а не карткою, щоб чистий дохід міг
   ставати червоним при мінусі. */
.kpi-value--pos { color: #10b981; }
:root.dark .kpi-value--pos { color: #34d399; }
.kpi-value--neg { color: #ef4444; }
:root.dark .kpi-value--neg { color: #f87171; }

.kpi-spark {
  display: none;
}
.kpi-card > * { position: relative; z-index: 1; }

@media (max-width: 920px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
@media (max-width: 480px) {
  /* Stay at 2 columns on mobile so the four headline numbers fit on one
     screen without scrolling. */
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  /* Верхній ряд на мобільному — два підсумкових числа: Валовий і Чистий. */
  .kpi-card--gross { order: 1; }
  .kpi-card--net   { order: 2; }
  .kpi-card--group { order: 3; }
  .kpi-card--indiv { order: 4; }
  .kpi-card { min-height: 108px; padding: 12px 14px 10px; }
  .kpi-value { font-size: 22px; }
  .kpi-label { font-size: 11px; }
  .kpi-sublabel { display: block; margin-left: 0; }
  .kpi-delta { font-size: 11px; }
}

/* Income structure (donut) -------------------------------- */
/* Two-column wrapper for structure (left) + rent (right) */
.finance-structure-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
@media (max-width: 920px) {
  .finance-structure-row { grid-template-columns: 1fr; }
}

.finance-structure-card,
.finance-rent-card {
  padding: 22px 24px;
  margin: 0;
}
.finance-structure-card h2,
.finance-rent-card h2 {
  margin: 0 0 18px;
}
.structure-row {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: center;
}
.structure-donut-wrap {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 0 auto;
}
.structure-donut {
  width: 100%;
  height: 100%;
  display: block;
}
.structure-donut-segment {
  cursor: pointer;
  transform-origin: 100px 100px;
  transition: opacity 0.16s ease, stroke-width 0.16s ease, filter 0.16s ease;
}
.structure-donut-segment--active {
  stroke-width: 27;
  filter: drop-shadow(0 0 10px rgba(96, 165, 250, 0.34));
}
.structure-donut-segment--muted {
  opacity: 0.34;
}
.structure-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.structure-donut-center strong {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}
.structure-donut-center span {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}
.structure-legend {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.structure-row-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  border-radius: 12px;
  transition: background 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.structure-row-item--active {
  background: rgba(96, 165, 250, 0.08);
  box-shadow: 0 0 0 8px rgba(96, 165, 250, 0.08);
}
:root.dark .structure-row-item--active {
  background: rgba(96, 165, 250, 0.12);
  box-shadow: 0 0 0 8px rgba(96, 165, 250, 0.10);
}
.structure-row-item:last-child { border-bottom: none; padding-bottom: 0; }
.structure-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}
.structure-row-body {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  padding-left: 22px;
}
.structure-pct { font-size: 16px; font-weight: 600; }
.structure-amount { font-size: 22px; }
.structure-pct--neg, .structure-amount--neg { color: #ef4444; }
:root.dark .structure-pct--neg, :root.dark .structure-amount--neg { color: #fca5a5; }
.structure-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.structure-dot--group { background: linear-gradient(180deg, #7c4dff, #4338ca); }
.structure-dot--indiv { background: linear-gradient(180deg, #22d3ee, #0d9488); }
.structure-dot--rent  { background: linear-gradient(180deg, #fb7185, #dc2626); }

@media (max-width: 720px) {
  .structure-row {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .structure-donut-wrap { width: 200px; height: 200px; }
}

/* Rent tile */
.finance-rent-card {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.finance-rent-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.finance-rent-head h2 {
  margin: 0;
}
.finance-rent-btn {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  white-space: nowrap;
  align-self: flex-start;
}

/* Progress tube */
.rent-tube {
  position: relative;
  height: 26px;
  border-radius: 14px;
  padding: 3px;
  background: linear-gradient(180deg, rgba(15,23,42,0.10) 0%, rgba(15,23,42,0.04) 100%);
  box-shadow: inset 0 1px 2px rgba(15,23,42,0.18), inset 0 -1px 0 rgba(255,255,255,0.45);
  margin-bottom: 16px;
  overflow: visible;
}
:root.dark .rent-tube {
  background: linear-gradient(180deg, rgba(0,0,0,0.28) 0%, rgba(0,0,0,0.12) 100%);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.40), inset 0 -1px 0 rgba(255,255,255,0.08);
}
.rent-tube-track {
  display: flex;
  width: 100%;
  height: 100%;
  border-radius: 11px;
  overflow: hidden;
  position: relative;
}
/* Glassy top highlight */
.rent-tube-track::before {
  content: '';
  position: absolute;
  top: 1px; left: 8px; right: 8px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0));
  pointer-events: none;
  z-index: 2;
}
.rent-tube-segment {
  height: 100%;
  transition: filter 0.15s, opacity 0.15s;
  cursor: pointer;
}
.rent-tube-segment--paid {
  background: linear-gradient(90deg, #6366f1 0%, #7c3aed 55%, #22d3ee 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), inset 0 -1px 0 rgba(0,0,0,0.15),
              inset -1px 0 0 rgba(255,255,255,0.20);
  border-radius: 11px 0 0 11px;
  flex-shrink: 0;
}
.rent-tube-segment--paid:only-child { border-radius: 11px; }
.rent-tube-segment--balance {
  flex: 1 1 0;
  background: rgba(15,23,42,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -1px 0 rgba(0,0,0,0.06);
  border-radius: 0 11px 11px 0;
}
:root.dark .rent-tube-segment--balance { background: rgba(255,255,255,0.06); }
.rent-tube-segment--muted { opacity: 0.32; }
.rent-tube-segment--active { filter: brightness(1.12) drop-shadow(0 0 6px rgba(99,102,241,0.45)); }
.rent-tube-segment--balance.rent-tube-segment--active { filter: brightness(0.8); }

/* Rent rows */
.rent-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1 1 auto;
}
.rent-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
  border-radius: 12px;
}
.rent-row-item:last-child { border-bottom: none; padding-bottom: 0; }
.rent-row-item--active {
  background: rgba(96,165,250,0.08);
  box-shadow: 0 0 0 8px rgba(96,165,250,0.08);
}
:root.dark .rent-row-item--active {
  background: rgba(96,165,250,0.12);
  box-shadow: 0 0 0 8px rgba(96,165,250,0.10);
}
.rent-row-item--muted { opacity: 0.35; }
.rent-row-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.rent-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}
.rent-row-sublabel {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding-left: 18px; /* align with label text after dot+gap */
}
.rent-row-amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
.rent-row-amount--neg   { color: #ef4444; }
.rent-row-amount--clear { color: #10b981; }
:root.dark .rent-row-amount--neg   { color: #fca5a5; }
:root.dark .rent-row-amount--clear { color: #34d399; }
/* Balance row — muted label, same size number */
.rent-row-item--balance .rent-row-head { color: var(--muted); font-size: 13px; }

/* Colored dots */
.rent-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.rent-dot--charged { background: linear-gradient(135deg, #a78bfa, #6366f1); }
.rent-dot--paid    { background: linear-gradient(135deg, #6366f1, #7c3aed, #22d3ee); }
.rent-dot--balance { background: linear-gradient(135deg, #fb7185, #dc2626); }
.finance-rent-add-form {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.rent-payments-results {
  min-height: 120px;
}
.finance-rent-card .finance-note,
.rent-payments-results .finance-note {
  margin: 2px 0 12px;
}
.finance-rent-table .rent-cell-source {
  white-space: nowrap;
}
.rent-source-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #0369a1;
  background: rgba(14, 165, 233, 0.12);
}
.rent-source-pill--offset {
  color: #7c2d12;
  background: rgba(251, 146, 60, 0.14);
}
:root.dark .rent-source-pill {
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.18);
}
:root.dark .rent-source-pill--offset {
  color: #fdba74;
  background: rgba(251, 146, 60, 0.18);
}
.finance-rent-table .rent-cell-money span {
  font-weight: 800;
}
.rent-cell-note--empty {
  color: var(--muted);
}
.rent-cell-actions {
  white-space: nowrap;
}
.rent-cell-actions .inline-form {
  display: inline-flex;
}
.rent-locked-action {
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 720px) {
  /* Rent history table — compact journal-style cards */
  .finance-rent-table { display: block; width: 100%; border-collapse: collapse; }
  .finance-rent-table thead { display: none; }
  .finance-rent-table tbody { display: block; width: 100%; }
  .finance-rent-table tbody tr {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    grid-template-areas:
      "date source amount actions"
      "note note   note   .      ";
    column-gap: 8px;
    row-gap: 2px;
    align-items: center;
    padding: 9px 8px;
    border-bottom: 1px solid var(--border);
  }
  .finance-rent-table tbody td { padding: 0; border: none; min-width: 0; }
  .finance-rent-table .rent-cell-date {
    grid-area: date;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    align-self: center;
  }
  .finance-rent-table .rent-cell-source {
    grid-area: source;
    align-self: center;
  }
  .finance-rent-table .rent-cell-money {
    grid-area: amount;
    align-self: center;
    text-align: right;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 700;
  }
  .finance-rent-table .rent-cell-money span { font-size: 15px; }
  .finance-rent-table .rent-cell-note {
    grid-area: note;
    font-size: 11px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    align-self: start;
  }
  .finance-rent-table .rent-cell-note--empty { display: none; }
  .finance-rent-table .rent-cell-actions {
    grid-area: actions;
    align-self: center;
    display: inline-flex;
    gap: 4px;
    align-items: center;
  }
  .finance-rent-table .rent-cell-actions .mini-action {
    width: 28px; height: 26px;
    padding: 0; margin: 0;
    font-size: 13px;
    line-height: 1;
    border-radius: 6px;
  }
  .finance-rent-table .rent-cell-actions .inline-form { display: inline-flex; }
}

/* Detail row (groups / indivs / averages) ------------------ */
.finance-detail-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.finance-detail-card {
  padding: 22px 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.finance-detail-card h2 {
  margin: 0;
  font-size: 16px;
}
.detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
/* Averages card has only 2 top metrics; widen to 2 columns so labels
   don't wrap on narrow desktop viewports. */
.detail-metrics--two {
  grid-template-columns: 1fr 1fr;
}
.detail-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.detail-metric-label {
  font-size: 12px;
  color: var(--muted);
  min-height: 32px;
}
.detail-metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.average-metric {
  gap: 8px;
}
.average-metric .detail-metric-label {
  min-height: 0;
}
.average-metric .detail-metric-label small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.average-metric-values {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.average-metric-values span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.average-metric-values strong {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}
.average-metric-values small {
  font-size: 11px;
  color: var(--muted);
}
.detail-metric-value--accent {
  color: #10b981;
}
:root.dark .detail-metric-value--accent {
  color: #34d399;
}
.detail-metric-value--neg {
  color: #ef4444;
}
:root.dark .detail-metric-value--neg {
  color: #fca5a5;
}
.detail-metric-delta {
  font-size: 12px;
  font-weight: 600;
}
.detail-metric--full {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.detail-metric--full .detail-metric-value { font-size: 26px; }
.detail-divider {
  height: 1px;
  background: var(--border);
}
.finance-detail-foot {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.finance-detail-foot--split {
  flex-direction: row;
  justify-content: space-between;
}

@media (max-width: 920px) {
  .finance-detail-row { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  /* Stack metric rows label-left / value-right so digits stay on a single
     line on phones. Skip the averages card which already has its own
     2-column layout. */
  .finance-detail-card:not(.finance-detail-card--averages) .detail-metrics {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .finance-detail-card:not(.finance-detail-card--averages) .detail-metric {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
  }
  .finance-detail-card:not(.finance-detail-card--averages) .detail-metric-label {
    font-size: 13px;
  }
  .finance-detail-card:not(.finance-detail-card--averages) .detail-metric-value {
    font-size: 18px;
    white-space: nowrap;
  }
}

/* Payment journal ----------------------------------------- */
.finance-journal .journal-kind {
  display: inline;
  font-weight: 600;
  color: var(--text);
}
/* Lessons-count badge sits inline next to the kind label; bold + accent
   colour so it pops on the row even though the rest of the line is
   neutral grey/black. */
.finance-journal .journal-lessons {
  display: inline;
  margin-left: 6px;
  padding: 0;
  background: transparent;
  font-size: inherit;
  font-weight: 700;
  color: var(--link);
}
.finance-journal .journal-lessons::before {
  content: '· ';
  color: var(--muted);
  font-weight: 500;
  margin-right: 2px;
}
.finance-journal .journal-note {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-style: italic;
}
:root.dark .finance-journal .journal-lessons { color: #93c5fd; }
.mini-action-danger {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.32);
  font-weight: 700;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 14px;
  cursor: pointer;
}
.mini-action-danger:hover {
  background: rgba(239, 68, 68, 0.10);
}
:root.dark .mini-action-danger {
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.32);
}
:root.dark .mini-action-danger:hover {
  background: rgba(252, 165, 165, 0.10);
}
/* Pencil-edit mini-action */
.mini-action-edit {
  background: transparent;
  color: var(--link);
  border: 1px solid rgba(37, 99, 235, 0.32);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 14px;
  cursor: pointer;
  margin-right: 4px;
}
.mini-action-edit:hover {
  background: rgba(37, 99, 235, 0.10);
}
:root.dark .mini-action-edit {
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.32);
}
:root.dark .mini-action-edit:hover {
  background: rgba(147, 197, 253, 0.10);
}

/* Payouts table — colour cue when running balance reaches zero */
.finance-payouts-table .payout-balance--ok {
  color: #10b981;
  font-weight: 700;
}
:root.dark .finance-payouts-table .payout-balance--ok { color: #34d399; }
.finance-payouts-table .col-right:last-child {
  white-space: nowrap;
}
.finance-payouts-table .col-right:last-child .inline-form {
  display: inline-flex;
  margin-left: 4px;
}
.finance-payouts-table .payout-cell-money span {
  white-space: nowrap;
}

/* Auth page ------------------------------------------------ */
.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 18%, rgba(96, 165, 250, 0.18), transparent 34%),
    radial-gradient(circle at 86% 8%, rgba(16, 185, 129, 0.13), transparent 30%),
    var(--bg);
}
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(100%, 430px);
  padding: 30px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255,255,255,0.72);
  box-shadow: 0 28px 78px rgba(64, 74, 140, 0.18), inset 0 1px 0 rgba(255,255,255,0.82);
  backdrop-filter: blur(28px) saturate(175%);
  -webkit-backdrop-filter: blur(28px) saturate(175%);
}
.auth-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 22px;
  align-items: center;
}
.auth-photo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}
.auth-photo {
  width: 96px;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: 50% 34%;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.62);
  box-shadow: 0 18px 46px rgba(37, 99, 235, 0.20);
}
.auth-copy {
  min-width: 0;
}
.auth-kicker {
  display: block;
  color: var(--link);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.auth-copy h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.02;
}
.auth-copy p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}
.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 26px;
}
.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.auth-form input {
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.64);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 0 14px;
  text-transform: none;
  letter-spacing: 0;
}
.auth-form input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.62);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.auth-submit {
  min-height: 50px;
  margin-top: 4px;
}
.auth-error {
  border: 1px solid rgba(239, 68, 68, 0.24);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  font-weight: 700;
}
:root.dark .auth-page {
  background:
    radial-gradient(circle at 12% 14%, rgba(96, 165, 250, 0.18), transparent 36%),
    radial-gradient(circle at 86% 10%, rgba(16, 185, 129, 0.11), transparent 32%),
    #070b18;
}
:root.dark .auth-card {
  background: rgba(15, 23, 42, 0.70);
  border-color: rgba(255,255,255,0.10);
  box-shadow: 0 28px 78px rgba(0,0,0,0.52), inset 0 1px 0 rgba(255,255,255,0.08);
}
:root.dark .auth-form input {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.11);
}
@media (max-width: 520px) {
  .auth-shell { padding: 18px; }
  .auth-card { padding: 24px 20px; }
  .auth-head {
    grid-template-columns: minmax(0, 1fr) 86px;
    gap: 16px;
    align-items: center;
  }
  .auth-photo { width: 86px; }
  .auth-copy h1 { font-size: 30px; }
  .auth-copy p { font-size: 15px; }
}

@media (max-width: 390px) {
  .auth-head {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .auth-photo-wrap {
    justify-content: flex-start;
    order: -1;
  }
  .auth-photo { width: 78px; }
}

/* Journal pager */
.finance-pager {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.finance-pager-info {
  font-size: 12px;
  color: var(--muted);
}
.finance-pager-pages {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.finance-pager-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--card-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  min-width: 32px;
  height: 32px;
  border-radius: 8px;
  padding: 0 8px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.finance-pager-btn:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.32);
}
.finance-pager-btn--active {
  background: var(--link);
  border-color: var(--link);
  color: #fff;
}
.finance-pager-btn--active:hover {
  background: var(--link);
  filter: brightness(1.05);
}
:root.dark .finance-pager-btn { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.10); }
:root.dark .finance-pager-btn--active {
  background: linear-gradient(135deg, rgba(96,165,250,0.95), rgba(79,70,229,0.95));
  border-color: rgba(147,197,253,0.70);
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.26);
}
.finance-journal--loading { opacity: 0.6; pointer-events: none; transition: opacity 0.2s; }
.finance-lazy-card--loading {
  min-height: 170px;
}
.finance-lazy-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 118px;
  padding: 28px;
  color: var(--muted);
  font-size: 14px;
  gap: 10px;
}
.finance-lazy-loading--compact {
  min-height: 86px;
  padding: 18px;
}

/* Debts table ---------------------------------------------- */
.finance-debts-table tfoot td {
  font-weight: 600;
  padding-top: 8px;
  border-top: 1px solid var(--border, #d4d4d8);
}
.finance-debts-subtotal td {
  color: var(--muted);
}
.debt-liza-share {
  color: #10b981;
  font-weight: 800;
}
:root.dark .debt-liza-share { color: #34d399; }

/* PnL table ------------------------------------------------ */
.finance-pnl-table .pnl-cell-kind small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.pnl-student-link {
  color: var(--link);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 0;
}
.pnl-student-link:hover {
  color: var(--link);
  text-decoration: none;
  filter: brightness(0.92);
}
.finance-pnl-table .pnl-cell-profit {
  color: #10b981;
  font-weight: 800;
}
.finance-pnl-table .pnl-cell-loss {
  color: #ef4444;
  font-weight: 800;
}
.pnl-no-action {
  color: var(--muted);
}
:root.dark .finance-pnl-table .pnl-cell-profit { color: #34d399; }
:root.dark .finance-pnl-table .pnl-cell-loss { color: #fca5a5; }

/* Year summary -------------------------------------------- */
.finance-summary-card {
  overflow: hidden;
}
.finance-summary-card--loading {
  opacity: 0.68;
  pointer-events: none;
  transition: opacity 0.18s;
}
.finance-summary-head {
  align-items: center;
}
.finance-summary-controls {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.finance-summary-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--card-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.finance-summary-toggle-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  height: 30px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.finance-summary-toggle-btn:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
}
.finance-summary-toggle-btn--active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.10);
}
.finance-summary-year {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.finance-summary-year select {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-soft);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  padding: 0 30px 0 10px;
}
.finance-summary-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(37, 99, 235, 0.38) rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.48);
  background-clip: padding-box;
  clip-path: inset(0 round 16px);
  isolation: isolate;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
}
.finance-summary-scroll::-webkit-scrollbar {
  height: 8px;
}
.finance-summary-scroll::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.12);
  border-radius: 999px;
}
.finance-summary-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.62), rgba(79, 70, 229, 0.62));
  border-radius: 999px;
}
.finance-summary-table {
  min-width: 1320px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.finance-summary-table th,
.finance-summary-table td {
  min-width: 96px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  border-right: 1px solid rgba(148, 163, 184, 0.20);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.finance-summary-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(248, 250, 252, 0.88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}
.finance-summary-table tbody th {
  text-align: left;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  background: rgba(255, 255, 255, 0.90);
}
.finance-summary-table tbody td {
  background: rgba(255, 255, 255, 0.58);
  text-align: right;
}
.finance-summary-table .summary-sticky {
  position: sticky;
  left: 0;
  z-index: 6;
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 1px 0 0 rgba(148, 163, 184, 0.30), 12px 0 20px rgba(15, 23, 42, 0.05);
  background-clip: padding-box;
}
.finance-summary-table thead .summary-sticky {
  z-index: 8;
  text-align: center;
}
.finance-summary-table .summary-total-col {
  font-weight: 800;
  width: 128px;
  min-width: 128px;
}
.finance-summary-table .summary-row-total th,
.finance-summary-table .summary-row-total td {
  border-top: 1px solid rgba(148, 163, 184, 0.32);
  padding-top: 14px;
  font-weight: 800;
}
:root.dark .finance-summary-table .summary-row-total th,
:root.dark .finance-summary-table .summary-row-total td {
  border-top-color: rgba(148, 163, 184, 0.20);
}
.finance-summary-table .summary-row-grand th,
.finance-summary-table .summary-row-grand td {
  font-weight: 900;
  background: rgba(219, 234, 254, 0.70);
}
.finance-summary-table .summary-row-grand .summary-sticky,
.finance-summary-table .summary-row-total .summary-sticky {
  z-index: 7;
  background: rgba(239, 246, 255, 0.96);
}
:root.dark .finance-summary-year select {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.10);
}
:root.dark .finance-summary-toggle {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.10);
}
:root.dark .finance-summary-toggle-btn--active {
  background: rgba(96, 165, 250, 0.18);
  color: #fff;
}
:root.dark .finance-summary-scroll {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  scrollbar-color: rgba(96, 165, 250, 0.52) rgba(255,255,255,0.08);
}
:root.dark .finance-summary-table thead th {
  background: #111827;
  color: var(--text);
}
:root.dark .finance-summary-table tbody th,
:root.dark .finance-summary-table tbody td {
  background: #182033;
}
:root.dark .finance-summary-table .summary-row-grand th,
:root.dark .finance-summary-table .summary-row-grand td {
  background: #293557;
}
:root.dark .finance-summary-table .summary-row-grand .summary-sticky,
:root.dark .finance-summary-table .summary-row-total .summary-sticky {
  background: #1e293b;
}

/* Payments by student ------------------------------------- */
.finance-student-payments-card {
  position: relative;
  z-index: 30;
  overflow: visible;
}
.student-payment-picker {
  display: grid;
  grid-template-columns: 80px minmax(0, 420px);
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}
.student-payment-select {
  position: relative;
  z-index: 35;
}
.student-payment-select .sched-create-student-panel {
  z-index: 140;
}
.student-payment-picker label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.student-payment-picker input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 0 14px;
}
.student-payment-results {
  margin-top: 14px;
}
.student-payment-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.student-payment-card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.07);
  color: var(--link);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}
.student-payment-card-link:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.38);
}
.student-payment-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.student-payment-overview-item {
  min-width: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 5px;
  min-height: 108px;
  padding: 14px 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.36);
  text-align: center;
}
.student-payment-overview-label {
  color: var(--link);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}
.student-payment-overview-count {
  color: var(--link);
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.student-payment-overview-count--lessons {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.student-payment-overview-count--lessons em {
  color: var(--text);
  font-style: normal;
}
.student-payment-overview-value {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.student-payment-results--loading {
  opacity: 0.62;
  pointer-events: none;
}
.student-payments-list {
  display: grid;
  gap: 12px;
}
.student-payment-item {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.42);
  padding: 14px;
}
.student-payment-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 120px 120px;
  gap: 12px;
  align-items: center;
}
.student-payment-date,
.student-payment-method {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.student-payment-kind {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.student-payment-kind strong {
  margin-left: 8px;
  color: var(--link);
}
.student-payment-amount {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}
.student-payment-note,
.student-payment-no-progress {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}
.student-payment-progress {
  margin-top: 12px;
}
:root.dark .student-payment-picker input {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.10);
}
:root.dark .student-payment-item {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.09);
}
:root.dark .student-payment-overview-item {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.09);
}
:root.dark .student-payment-card-link {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.24);
  color: #93c5fd;
}

.student-finance-open {
  margin-top: 12px;
  width: fit-content;
}
.student-finance-modal-glass {
  max-width: 1120px;
  max-height: calc(100vh - 42px);
  overflow-y: auto;
}
.student-finance-modal-head {
  margin-bottom: 12px;
}

@media (max-width: 720px) {
  /* Тюбик використання абонементу тримає підказки (`.lesson-tube-cell-tip`,
     `white-space: nowrap`) у DOM для кожної клітинки. Підказки крайніх клітинок
     вилазять за край екрана й роздувають ширину сторінки — на телефоні Safari
     через це масштабує вʼюпорт і лишає порожнечу справа. Обрізаємо тільки
     горизонталь (вертикаль — підказка над тюбиком — лишається видимою).
     На десктопі не чіпаємо: там підказки мають місце і зайвого зуму немає. */
  .student-payment-results {
    overflow-x: clip;
    overflow-y: visible;
  }

  .student-payment-picker {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .student-payment-overview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .student-payment-overview-item {
    min-height: 86px;
    gap: 4px;
    padding: 10px 6px;
    border-radius: 12px;
  }
  .student-payment-overview-label {
    font-size: 12px;
  }
  .student-payment-overview-count {
    font-size: 28px;
  }
  .student-payment-overview-value {
    font-size: 14px;
  }
  .student-payment-overview-count--lessons { gap: 4px; }
  .student-payment-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "date kind amount"
      "method method amount";
    gap: 3px 8px;
  }
  .student-payment-date { grid-area: date; }
  .student-payment-kind { grid-area: kind; font-size: 13px; }
  .student-payment-method { grid-area: method; }
  .student-payment-amount { grid-area: amount; font-size: 16px; align-self: center; }
  .student-payment-item { padding: 12px; }
  .student-payment-progress .lesson-tube-meta-title {
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .student-payment-actions {
    justify-content: stretch;
  }
  .student-payment-card-link,
  .student-finance-open {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .finance-summary-head {
    align-items: stretch;
    flex-direction: column;
  }
  .finance-summary-year {
    align-self: flex-start;
  }
  .finance-summary-controls {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .finance-summary-table {
    display: table;
    min-width: 1180px;
    margin-top: 0;
  }
  .finance-summary-table thead {
    display: table-header-group;
  }
  .finance-summary-table tbody {
    display: table-row-group;
  }
  .finance-summary-table tr {
    display: table-row;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .finance-summary-table th,
  .finance-summary-table td {
    display: table-cell;
    text-align: right;
    padding-left: 8px;
    padding-right: 8px;
  }
  .finance-summary-table td::before {
    content: none;
    display: none;
  }
  .finance-summary-table .summary-sticky {
    width: 132px;
    min-width: 132px;
    max-width: 132px;
    padding-left: 10px;
    padding-right: 10px;
    text-align: left;
  }
  .finance-summary-table thead .summary-sticky {
    text-align: center;
  }
  .finance-summary-table .summary-total-col {
    width: 140px;
    min-width: 140px;
  }
}

/* Finance modals ------------------------------------------ */
.finance-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(15, 23, 42, 0.42);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.finance-modal-backdrop.open {
  display: flex;
}
body.modal-open { overflow: hidden; }
.finance-modal-glass {
  width: 100%;
  max-width: 520px;
  padding: 24px 26px 22px;
  box-sizing: border-box;
}
.finance-modal-glass--confirm {
  max-width: 420px;
}
.finance-modal-glass .modal-title {
  font-size: 22px;
  margin-bottom: 4px;
}
.finance-modal-glass .modal-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 16px;
}
.finance-modal-glass .finance-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.finance-modal-glass .finance-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.finance-modal-glass .finance-form label > span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.finance-modal-glass .finance-form input,
.finance-modal-glass .finance-form select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  background: var(--card-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  min-height: 40px;
}
.finance-modal-glass .finance-form input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
}
.finance-modal-glass .finance-form-wide {
  grid-column: 1 / -1;
}
.finance-modal-glass .modal-actions {
  grid-column: 1 / -1;
  margin-top: 8px;
}
:root.dark .finance-modal-glass .finance-form input,
:root.dark .finance-modal-glass .finance-form select {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}

/* iOS Safari зумить сторінку при фокусі на полі з font-size < 16px і потім
   не повертає масштаб — інтерфейс лишається «наближеним». Тримаємо всі поля
   фінансових форм ≥16px на телефоні (десктопу 14px достатньо). */
@media (max-width: 768px) {
  .finance-form input,
  .finance-form select,
  .finance-modal-glass .finance-form input,
  .finance-modal-glass .finance-form select {
    font-size: 16px;
  }
}

/* Hide the legacy inline finance form rules for the modal grid */
.finance-modal-glass .finance-form {
  margin: 0;
}

@media (max-width: 540px) {
  .finance-modal-backdrop {
    padding: 16px;
    align-items: flex-start;
  }
  .finance-modal-glass {
    padding: 22px 18px 20px;
  }
  /* Keep 2 columns for short fields (date + amount), let wide fields span both */
  .finance-modal-glass .finance-form { grid-template-columns: 1fr 1fr; }
  /* Rent add/edit forms: date+amount side-by-side, comment full-width */
  .finance-rent-add-form,
  #rent-payment-edit-form.finance-form { grid-template-columns: 1fr 1fr; }
}

/* KPI sublabel (e.g. "40%", "(після оренди)") */
.kpi-sublabel {
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

/* Editable price tables ----------------------------------- */
.finance-prices-card .finance-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.finance-prices-card .finance-card-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
/* Both "Редагувати" buttons render at a fixed compact size so the two
   price cards line up regardless of header text length. */
.finance-prices-card .finance-card-head .btn-soft {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.price-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.price-list-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.price-list-item:last-child { border-bottom: none; }
.price-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.price-list-name {
  font-weight: 600;
  color: var(--text);
}
.price-list-amount {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}
.price-list-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

@media (max-width: 720px) {
  .finance-prices {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .finance-prices-card {
    padding: 16px 18px;
    position: relative;
  }
  /* Move edit button out of the head row into the top-right corner so
     the heading + description stay on the left. */
  .finance-prices-card .finance-card-head {
    padding-right: 110px;
    margin-bottom: 8px;
  }
  .finance-prices-card .finance-card-head .btn-soft {
    position: absolute;
    top: 12px;
    right: 12px;
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
  }
  .price-list-item   { padding: 8px 0; }
  .price-list-name   { font-size: 13px; }
  .price-list-amount { font-size: 15px; }
  .price-list-meta   { font-size: 11px; }
}

/* Averages card on mobile: keep label left + value right on one line. */
@media (max-width: 520px) {
  .finance-detail-card--averages .detail-metrics--two {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .finance-detail-card--averages .detail-metric {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
  }
  .finance-detail-card--averages .detail-metric-value { font-size: 18px; }
}

/* Price edit modal */
.finance-modal-glass--wide {
  max-width: 640px;
}
.price-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.price-edit-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-soft);
}
.price-edit-name strong { display: block; font-size: 14px; color: var(--text); }
.price-edit-name span   { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.price-edit-input {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.price-edit-input span {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.price-edit-input input {
  font-size: 16px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  text-align: right;
}
:root.dark .price-edit-row { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.07); }
:root.dark .price-edit-input input { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.10); }
.price-edit-form .modal-actions {
  margin-top: 10px;
}
@media (max-width: 540px) {
  .price-edit-row {
    grid-template-columns: 1fr 110px;
    padding: 8px 10px;
  }
  .price-edit-name strong { font-size: 13px; }
  .price-edit-name span   { font-size: 11px; }
  .price-edit-input input { font-size: 15px; padding: 6px 8px; }
}

/* Inline copies of method + short kind label (visible only on mobile) */
.journal-method-inline,
.journal-kind-short { display: none; }
/* Container wrapping kind + lessons so they share a grid cell on mobile.
   On desktop it's just a passthrough — kind and lessons render inline. */
.journal-kind-line { display: inline; }

/* Mobile payment journal -- 3-row card per payment ---------- */
@media (max-width: 720px) {
  .finance-journal { display: block; width: 100%; border-collapse: collapse; }
  .finance-journal thead { display: none; }
  .finance-journal tbody { display: block; width: 100%; }

  .finance-journal tbody tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "date  name  amount  actions"
      "meta  meta  meta    actions"
      "note  note  note    actions";
    column-gap: 8px;
    row-gap: 2px;
    align-items: center;
    padding: 9px 8px;
    border-bottom: 1px solid var(--border);
  }
  .finance-journal tbody td { padding: 0; border: none; min-width: 0; }

  /* Row 1 -- date + name + amount + actions */
  .finance-journal tbody .journal-cell-date {
    grid-area: date;
    align-self: center;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
  }
  .finance-journal tbody .journal-cell-name {
    grid-area: name;
    align-self: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
  }
  .finance-journal tbody .journal-cell-name a { color: inherit; text-decoration: none; }

  /* Kind cell becomes a contents passthrough so its children (kind-line,
     method-inline, note) become direct grid items in the tr's grid. */
  .finance-journal tbody .journal-cell-kind { display: contents; }
  .finance-journal tbody .journal-kind-line .journal-kind-short { display: none; }

  /* Row 2 left: kind-line wrapping short kind + bold lessons */
  .finance-journal tbody .journal-kind-line {
    grid-area: meta;
    align-self: center;
    justify-self: start;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }
  .finance-journal tbody .journal-kind-line .journal-kind {
    display: inline;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--text);
  }
  .finance-journal tbody .journal-kind-line .journal-lessons {
    flex: 0 0 auto;
    margin-left: 0;
    padding: 0;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
    color: var(--link);
    white-space: nowrap;
  }
  .finance-journal tbody .journal-kind-line .journal-lessons::before {
    content: '· ';
    color: var(--muted);
    font-weight: 500;
    margin-right: 1px;
  }

  /* Row 2 right: method (small grey, pushed to the end) */
  .finance-journal tbody .journal-method-inline {
    grid-area: meta;
    align-self: center;
    justify-self: end;
    display: inline;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .finance-journal tbody .journal-method-inline::before {
    content: ' · ';
    opacity: 0.5;
  }
  /* Row 3 -- comment (only present when note exists) */
  .finance-journal tbody .journal-cell-kind .journal-note {
    grid-area: note;
    align-self: start;
    margin-top: 1px;
    font-size: 11px;
    color: var(--muted);
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Standalone method <td> hidden on mobile (rendered inline above) */
  .finance-journal tbody .journal-cell-method { display: none; }

  /* Amount + actions occupy rows 1 only and stay centered vertically */
  .finance-journal tbody .journal-cell-amount {
    grid-area: amount;
    align-self: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    text-align: right;
    white-space: nowrap;
  }
  .finance-journal tbody .journal-cell-actions {
    grid-area: actions;
    align-self: center;
    display: inline-flex;
    gap: 4px;
    align-items: center;
  }
  .finance-journal tbody .journal-cell-actions .mini-action {
    width: 28px;
    height: 26px;
    padding: 0;
    font-size: 13px;
    line-height: 1;
    border-radius: 6px;
    margin: 0;
  }
  .finance-journal tbody .journal-cell-actions .inline-form {
    display: inline-flex;
    line-height: 0;
  }
}

/* Coach-payouts table — card-like rows at narrow widths */
@media (max-width: 720px) {
  .finance-payouts-table {
    display: block;
    width: 100%;
    border-collapse: collapse;
  }
  .finance-payouts-table thead {
    display: none;
  }
  .finance-payouts-table tbody {
    display: grid;
    gap: 8px;
    width: 100%;
  }
  .finance-payouts-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "date paid actions"
      "offset balance actions"
      "note note actions";
    column-gap: 8px;
    row-gap: 2px;
    align-items: center;
    padding: 10px 10px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.44);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.62);
  }
  .finance-payouts-table tbody td {
    min-width: 0;
    padding: 0;
    border: none;
    font-size: 13px;
  }
  .finance-payouts-table .payout-cell-date {
    grid-area: date;
    align-self: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
  }
  .finance-payouts-table .payout-cell-note {
    grid-area: note;
    align-self: start;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    font-style: italic;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .finance-payouts-table .payout-cell-note--empty {
    display: none;
  }
  .finance-payouts-table .payout-cell-money {
    display: inline-flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 4px;
    text-align: right;
    white-space: nowrap;
  }
  .finance-payouts-table .payout-cell-money::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.1;
  }
  .finance-payouts-table .payout-cell-money:nth-child(2) {
    grid-area: paid;
    align-self: center;
  }
  .finance-payouts-table .payout-cell-money:nth-child(2)::before { display: none; }
  .finance-payouts-table .payout-cell-money:nth-child(3) {
    grid-area: offset;
    justify-self: start;
    text-align: left;
  }
  .finance-payouts-table .payout-cell-money:nth-child(3)::before {
    content: 'Взаєм.';
  }
  .finance-payouts-table .payout-cell-money:nth-child(4) {
    grid-area: balance;
    justify-self: end;
    margin-left: 10px;
  }
  .finance-payouts-table .payout-cell-money span {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
  }
  .finance-payouts-table .payout-cell-money:nth-child(2) span {
    font-size: 16px;
    font-weight: 800;
  }
  .finance-payouts-table .payout-balance--ok span {
    color: #10b981;
  }
  .finance-payouts-table .payout-cell-actions {
    grid-area: actions;
    display: inline-flex;
    align-self: center;
    flex-direction: row;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
  }
  .finance-payouts-table .payout-cell-actions .mini-action {
    width: 28px;
    height: 26px;
    min-height: 26px;
    margin: 0;
    padding: 0;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1;
  }
  .finance-payouts-table .payout-cell-actions .inline-form {
    display: inline-flex;
    margin: 0;
    line-height: 0;
  }
  :root.dark .finance-payouts-table tbody tr {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.09);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
  }
  :root.dark .finance-payouts-table .payout-balance--ok span {
    color: #34d399;
  }
}

@media (max-width: 380px) {
  .finance-payouts-table tbody tr {
    column-gap: 7px;
    padding: 9px 8px;
  }
  .finance-payouts-table .payout-cell-date,
  .finance-payouts-table .payout-cell-money::before,
  .finance-payouts-table .payout-cell-money span {
    font-size: 11px;
  }
  .finance-payouts-table .payout-cell-money:nth-child(2) span {
    font-size: 15px;
  }
  .finance-payouts-table .payout-cell-actions .mini-action {
    width: 26px;
  }
  .student-payment-overview {
    gap: 6px;
  }
  .student-payment-overview-item {
    padding-inline: 4px;
  }
  .student-payment-overview-count {
    font-size: 25px;
  }
  .student-payment-overview-value {
    font-size: 13px;
  }
}

/* Mobile PnL rows mirror the compact payment journal rhythm. */
@media (max-width: 720px) {
  .finance-pnl-table {
    display: block;
    width: 100%;
    border-collapse: collapse;
  }
  .finance-pnl-table thead {
    display: none;
  }
  .finance-pnl-table tbody {
    display: block;
    width: 100%;
  }
  .finance-pnl-table tbody tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "date student profit actions"
      "kind kind loss actions";
    column-gap: 8px;
    row-gap: 2px;
    align-items: center;
    padding: 9px 8px;
    border-bottom: 1px solid var(--border);
  }
  .finance-pnl-table tbody td {
    min-width: 0;
    padding: 0;
    border: none;
  }
  .finance-pnl-table .pnl-cell-date {
    grid-area: date;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
  }
  .finance-pnl-table .pnl-cell-student {
    grid-area: student;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 700;
  }
  .finance-pnl-table .pnl-cell-kind {
    grid-area: kind;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
  }
  .finance-pnl-table .pnl-cell-kind small {
    display: inline;
    min-width: 0;
    margin-top: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    font-weight: 500;
  }
  .finance-pnl-table .pnl-cell-profit {
    grid-area: profit;
    font-size: 16px;
    white-space: nowrap;
  }
  .finance-pnl-table .pnl-cell-loss {
    grid-area: loss;
    justify-self: end;
    font-size: 12px;
    white-space: nowrap;
  }
  .finance-pnl-table .pnl-cell-loss::before {
    content: 'Loss ';
    color: var(--muted);
    font-weight: 600;
  }
  .finance-pnl-table .pnl-cell-actions {
    grid-area: actions;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
  .finance-pnl-table .pnl-cell-actions .mini-action {
    width: 28px;
    height: 26px;
    min-height: 26px;
    margin: 0;
    padding: 0;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1;
  }
  .finance-pnl-table .pnl-cell-actions .inline-form {
    display: inline-flex;
    margin: 0;
    line-height: 0;
  }

  /* Debts rows mirror the PnL compact grid */
  .finance-debts-table {
    display: block;
    width: 100%;
    border-collapse: collapse;
  }
  .finance-debts-table thead { display: none; }
  .finance-debts-table tbody,
  .finance-debts-table tfoot { display: block; width: 100%; }
  .finance-debts-table tbody tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "date    student amount liza"
      "kind    kind    amount liza";
    column-gap: 8px;
    row-gap: 2px;
    align-items: center;
    padding: 9px 8px;
    border-bottom: 1px solid var(--border);
  }
  .finance-debts-table tbody td {
    min-width: 0;
    padding: 0;
    border: none;
  }
  .finance-debts-table .pnl-cell-date {
    grid-area: date;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
  }
  .finance-debts-table .pnl-cell-student {
    grid-area: student;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 700;
  }
  .finance-debts-table .pnl-cell-kind {
    grid-area: kind;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
  }
  .finance-debts-table .pnl-cell-kind small {
    display: inline;
    margin-top: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    font-weight: 500;
  }
  .finance-debts-table .pnl-cell-loss {
    grid-area: amount;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    justify-self: end;
    white-space: nowrap;
  }
  .finance-debts-table .debt-liza-share {
    grid-area: liza;
    font-size: 16px;
    justify-self: end;
    white-space: nowrap;
  }
  /* tfoot: each row becomes a flex label/value strip */
  .finance-debts-table tfoot tr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
  }
  .finance-debts-table tfoot td {
    border: none;
    padding: 0;
    text-align: left;
  }
  .finance-debts-table tfoot td:empty { display: none; }
  .finance-debts-table tfoot td:first-child { color: var(--muted); }
}

/* ── Шаблон тижневого розкладу ─────────────────────────── */
.sched-template-link {
  display: block;
  margin-top: 12px;
  padding: 9px 12px;
  text-align: center;
  border-radius: 10px;
  border: 1px dashed var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s ease, border-color .15s ease;
}
.sched-template-link:hover {
  background: var(--card-hover, rgba(125,125,125,.08));
  border-color: var(--accent, #888);
}
.tpl-weekday-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tpl-day-btn {
  flex: 1 1 0;
  min-width: 42px;
  padding: 9px 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.tpl-day-btn:hover { border-color: var(--accent, #888); }
.tpl-day-btn.active {
  background: var(--accent, #6c5ce7);
  border-color: var(--accent, #6c5ce7);
  color: #fff;
}
.tpl-day-btn .tpl-day-btn-full { display: none; }
@media (min-width: 720px) {
  .tpl-day-btn { font-size: 0; }
  .tpl-day-btn .tpl-day-btn-full { display: inline; font-size: 13px; }
}
#tpl-day-view .sched-block { margin-top: 12px; }
#tpl-day-view .sched-section-label { margin-top: 8px; }
.btn-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 18px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn-nav-back:hover {
  background: var(--card-hover, rgba(125,125,125,.08));
  border-color: var(--accent, #6c5ce7);
  color: var(--accent, #6c5ce7);
}

/* ── Перехід на власну студію (Mouse Air, 2026-07-01) ─────────────────── */
/* Бейдж режиму доходу над KPI-рядом */
.kpi-regime-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: -6px;
}
.kpi-regime-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #6d28d9;
  background: rgba(139, 92, 246, 0.12);
}
.kpi-regime-badge--mixed {
  color: #92400e;
  background: rgba(245, 158, 11, 0.14);
}
:root.dark .kpi-regime-badge { color: #c4b5fd; background: rgba(139, 92, 246, 0.22); }
:root.dark .kpi-regime-badge--mixed { color: #fcd34d; background: rgba(245, 158, 11, 0.2); }

/* Заморожена історична картка оренди Prof Air Force */
.rent-frozen-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
  color: rgba(15, 23, 42, 0.55);
  background: rgba(15, 23, 42, 0.07);
}
:root.dark .rent-frozen-badge { color: rgba(226, 232, 240, 0.6); background: rgba(226, 232, 240, 0.12); }

/* Маркер режиму під місяцем у Фінансовому Звіті:
   бузковий = Prof Air Force (40/60), бурштиновий = Mouse Air (100%) */
.summary-regime-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 4px;
  border-radius: 50%;
  vertical-align: middle;
  background: linear-gradient(135deg, #a78bfa, #6366f1);
}
.summary-regime-dot--full {
  background: linear-gradient(135deg, #fbbf24, #d97706);
}

/* Чип "подаровано" у PnL — залишок абонемента подаровано старою студією */
.pnl-gifted-chip {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
  background: rgba(245, 158, 11, 0.15);
  white-space: nowrap;
}
:root.dark .pnl-gifted-chip { color: #fcd34d; background: rgba(245, 158, 11, 0.2); }

/* Клітинки подарованого абонемента — бурштин/золото, відмінно від
   червоного --missed і синього --used */
.lesson-tube-cell--used.lesson-tube-cell--gifted {
  background: linear-gradient(180deg, #fcd34d 0%, #d97706 55%, #92400e 100%);
}
.lesson-tube-cell--gifted-empty {
  background: rgba(217, 119, 6, 0.12);
}
.lesson-tube-cell--used.lesson-tube-cell--gifted.lesson-tube-cell--missed {
  /* пропуск на подарованому абоні: лишаємо червоний як домінантний стан */
  background: linear-gradient(180deg, #ff8b8b 0%, #dc2626 55%, #991b1b 100%);
}
:root.dark .lesson-tube-cell--used.lesson-tube-cell--gifted {
  background: linear-gradient(180deg, #fbbf24 0%, #b45309 55%, #78350f 100%);
}
:root.dark .lesson-tube-cell--gifted-empty {
  background: rgba(251, 191, 36, 0.14);
}
