﻿/* === 1. CORE STYLES (styles.html) === */
  :root {
    --bg-main: #F1F5F9;
    --bg-sidebar: #0F172A;
    --bg-card: #FFFFFF;
    --accent: #0D9488;
    --accent-hover: #0F766E;
    --accent-light: #F0FDFA;
    --gold: #F59E0B;
    --danger: #EF4444;
    --success: #10B981;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border: #CBD5E1;
    --border-light: #E2E8F0;
    --radius: 14px;
    --shadow: 0 4px 12px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  }

  * { box-sizing: border-box; }
  body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg-main); margin: 0; color: var(--text-main); -webkit-font-smoothing: antialiased; overflow: hidden; }

  input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
  input[type=number] { -moz-appearance: textfield; }

  /* ЛЕЙАУТ ІЗ ЗАФІКСОВАНОЮ БІЧНОЮ ПАНЕЛЛЮ */
  .app-layout { display: flex; height: 100vh; width: 100vw; overflow: hidden; }
  .sidebar { width: 250px; height: 100vh; background: var(--bg-sidebar); color: white; display: flex; flex-direction: column; padding: 20px 14px; flex-shrink: 0; overflow-y: auto; }
  .brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 20px 10px; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 16px; }
  .brand-logo { width: 40px; height: 40px; background: linear-gradient(135deg, #14B8A6, #0D9488); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: 0 4px 12px rgba(20,184,166,0.3); flex-shrink: 0; }
  .brand-title { font-weight: 700; font-size: 15px; letter-spacing: 0.5px; }
  .brand-sub { font-size: 11px; color: #5EEAD4; font-weight: 500; }

  .side-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
  .nav-item { display: flex; align-items: center; gap: 12px; background: none; border: none; color: #94A3B8; padding: 11px 14px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 500; text-align: left; transition: all 0.2s; font-family: inherit; }
  .nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
  .nav-item.active { background: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25); }
  .nav-badge { margin-left: auto; background: var(--gold); color: #0F172A; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 20px; }
  .sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 12px; flex-shrink: 0; padding-top: 12px; }
  .footer-card { padding: 12px 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px; }

  .main-area { flex: 1; height: 100vh; padding: 24px 32px; overflow-y: auto; }
  .tab-content { display: none; max-width: 1220px; animation: fadeIn 0.18s ease; }
  .tab-content.active { display: block; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

  .page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
  .page-title { font-size: 21px; font-weight: 700; margin: 0; color: #0F172A; }

  /* КАРТКИ ДАШБОРДУ */
  .dash-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
  .dash-card { background: var(--bg-card); padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--border-light); box-shadow: var(--shadow); }
  .dash-title { font-size: 12px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.4px; }
  .dash-val { font-size: 26px; font-weight: 700; color: var(--text-main); margin-top: 6px; }

  /* СПИСОК + ДЕТАЛІ (Master-Detail) */
  .master-detail-layout { display: flex; gap: 24px; align-items: flex-start; }
  .master-col { flex: 0 0 320px; background: var(--bg-card); padding: 14px; border-radius: var(--radius); border: 1px solid var(--border-light); box-shadow: var(--shadow); max-height: calc(100vh - 105px); overflow-y: auto; }
  .detail-col { flex: 1; background: transparent; padding: 0 4px 20px 0; max-height: calc(100vh - 105px); overflow-y: auto; min-height: 400px; }

  /* 3 ОКРЕМІ КАРТКИ В ДЕТАЛЯХ (ЧІТКЕ ВІЗУАЛЬНЕ РОЗДІЛЕННЯ) */
  .detail-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden; }
  .card-profile { border-left: 5px solid var(--accent); }
  .card-active-recon { border-left: 5px solid var(--accent); }
  .card-history { border-left: 5px solid #94A3B8; }

  .detail-section-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; background: #F8FAFC; border-bottom: 1px solid var(--border-light); }
  .detail-section-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
  .detail-section-body { padding: 20px 22px; }
  .detail-section-footer { padding: 14px 22px; background: #F8FAFC; border-top: 1px solid var(--border-light); }

  /* КОМПАКТНА СТАТИСТИКА ВСЕРЕДИНІ КАРТКИ ПРОФІЛЮ */
  .profile-top-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border-light); margin-bottom: 14px; }
  .profile-metrics { display: flex; gap: 28px; align-items: center; }
  .metric-item { display: flex; flex-direction: column; }
  .metric-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; margin-bottom: 3px; }
  .metric-value { font-size: 15px; font-weight: 700; color: var(--text-main); }

  .student-chip { display: inline-flex; align-items: center; gap: 5px; background: #F8FAFC; border: 1px solid var(--border-light); padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; color: var(--text-main); }

  .search-input { width: 100%; padding: 9px 12px; border: 1px solid var(--border-light); border-radius: 8px; margin-bottom: 12px; font-size: 13px; background: #F8FAFC; transition: 0.2s; outline: none; font-family: inherit; }
  .search-input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12); }

  .list-item { border: 1px solid var(--border-light); padding: 12px 14px; border-radius: 10px; margin-bottom: 8px; cursor: pointer; transition: all 0.15s; background: #fff; }
  .list-item:hover { border-color: #CBD5E1; transform: translateY(-1px); box-shadow: var(--shadow); }
  .list-item.active { border-color: var(--accent); background: var(--accent-light); box-shadow: 0 0 0 1px var(--accent); }
  .list-item-compact { padding: 8px 12px; margin-bottom: 6px; opacity: 0.75; font-size: 13px; }

  .c-title { font-weight: 600; font-size: 14px; color: var(--text-main); display: flex; align-items: center; justify-content: space-between; }
  .c-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

  .info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; background: #F8FAFC; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--border-light); font-size: 13px; margin-bottom: 14px; }
  .info-label { color: var(--text-muted); font-size: 11px; text-transform: uppercase; font-weight: 600; margin-bottom: 4px; display: block; white-space: nowrap; }
  .info-val { font-size: 15px; font-weight: 700; color: var(--text-main); }

  /* ФОРМИ ТА КНОПКИ */
  .card-panel { background: var(--bg-card); padding: 20px 24px; border-radius: var(--radius); border: 1px solid var(--border-light); box-shadow: var(--shadow); margin-bottom: 20px; }
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 14px; }
  label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 12px; color: #475569; }
  input, select { width: 100%; padding: 8px 11px; border: 1px solid var(--border-light); border-radius: 8px; font-size: 13px; font-family: inherit; transition: 0.2s; outline: none; background: #fff; color: var(--text-main); }
  input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12); }

  .btn-primary { background: var(--accent); color: white; padding: 9px 16px; border: none; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; transition: 0.2s; font-family: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
  .btn-primary:hover { background: var(--accent-hover); }
  .btn-amber { background: var(--gold); color: #fff; padding: 11px 18px; border: none; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; transition: 0.2s; width: 100%; box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25); }
  .btn-amber:hover { filter: brightness(0.95); }
  .btn-amber-muted { background: #fff; color: var(--text-muted); border: 1px dashed var(--border); padding: 10px 18px; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: default; width: 100%; }
  .btn-ghost { background: #F1F5F9; color: #475569; padding: 8px 14px; border: none; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; transition: 0.15s; font-family: inherit; }
  .btn-ghost:hover { background: #E2E8F0; }
  .btn-action { background: var(--success); color: white; border: none; padding: 6px 11px; border-radius: 6px; font-weight: 600; cursor: pointer; }
  .btn-icon { background: none; border: none; font-size: 16px; color: var(--text-muted); cursor: pointer; padding: 4px; }

  .action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .action-btn { background: var(--bg-card); padding: 22px 16px; text-align: center; border-radius: var(--radius); border: 1px solid var(--border-light); cursor: pointer; transition: 0.2s; font-weight: 600; font-size: 14px; color: var(--text-main); box-shadow: var(--shadow); }
  .action-btn:hover { border-color: var(--accent); background: var(--accent-light); transform: translateY(-2px); }
  .action-icon { font-size: 26px; display: block; margin-bottom: 8px; }

  /* ТАБЛИЦІ ТА БЕЙДЖІ */
  table { width: 100%; border-collapse: collapse; font-size: 13px; }
  th { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-light); color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; white-space: nowrap; background: #FAFBFD; }
  td { padding: 11px 12px; border-bottom: 1px solid #F1F5F9; vertical-align: middle; }
  tr:last-child td { border-bottom: none; }
  tr:hover td { background: #F8FAFC; }

  .positive { color: var(--success); font-weight: 700; }
  .negative { color: var(--danger); font-weight: 700; }
  .badge { background: #CCFBF1; color: #115E59; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
  .badge-paused { background: #FEF3C7; color: #B45309; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }

  /* СПОВІЩЕННЯ ТА МОДАЛКИ */
  #msg-overlay { position: fixed; bottom: 24px; right: 24px; background: #0F172A; color: white; padding: 12px 20px; border-radius: 10px; font-weight: 600; font-size: 13px; display: none; z-index: 9999; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
  #mini-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(2px); z-index: 1000; align-items: center; justify-content: center; }
  .modal-content { background: #fff; padding: 20px 24px; border-radius: 14px; width: 92%; max-width: 400px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.15); }
  .modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-light); padding-bottom: 10px; margin-bottom: 14px; }
  .modal-header h3 { margin: 0; font-size: 16px; }

  @media (max-width: 900px) {
    body { overflow: auto; }
    .app-layout { flex-direction: column; height: auto; overflow: visible; }
    .sidebar { width: 100%; height: auto; padding: 12px; }
    .side-nav { flex-direction: row; overflow-x: auto; }
    .sidebar-footer, .brand-sub { display: none; }
    .brand { margin-bottom: 10px; padding-bottom: 10px; }
    .main-area { height: auto; padding: 16px; }
    .dash-grid, .info-grid, .action-grid { grid-template-columns: repeat(2, 1fr); }
    .master-detail-layout { flex-direction: column; }
    .master-col, .detail-col { width: 100%; flex: auto; max-height: none; }
  }
  /* ВЕРХНІЙ ІНДИКАТОР ЗАВАНТАЖЕННЯ (TOP PROGRESS BAR) */
  #top-loader { position: fixed; top: 0; left: 0; width: 100%; height: 3px; background: rgba(20, 184, 166, 0.15); z-index: 10000; display: none; overflow: hidden; }
  #top-loader::after { content: ''; display: block; width: 40%; height: 100%; background: linear-gradient(90deg, transparent, #14B8A6, #F59E0B, transparent); animation: topLoadAnim 1.1s infinite ease-in-out; }
  @keyframes topLoadAnim { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

  /* СТАТУС БАЗИ ТА КНОПКА ОНОВЛЕННЯ У САЙДБАРІ */
 .sync-box { display: flex; align-items: center; justify-content: space-between; }
  .sync-info { display: flex; align-items: center; gap: 10px; }
  .sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); transition: 0.3s; flex-shrink: 0; }
  .sync-dot.loading { background: var(--gold); box-shadow: 0 0 10px var(--gold); animation: pulseDot 0.8s infinite alternate; }
  .sync-dot.error { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
  @keyframes pulseDot { from { opacity: 0.4; transform: scale(0.85); } to { opacity: 1; transform: scale(1.2); } }

.btn-sync { background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12); color: #E2E8F0; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; font-size: 14px; font-weight: 600; flex-shrink: 0; }
  .btn-sync:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
  .btn-sync.spinning span { display: inline-block; animation: spinIcon 0.7s linear infinite; }
  @keyframes spinIcon { 100% { transform: rotate(360deg); } }

  .btn-logout { width: 100%; margin-top: 12px; padding: 8px; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, 0.06); color: #CBD5E1; border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 8px; cursor: pointer; transition: 0.2s; font-family: inherit; }
  .btn-logout:hover { background: rgba(239, 68, 68, 0.18); color: #FCA5A5; border-color: rgba(239, 68, 68, 0.3); }

  /* ПЛАВНЕ ПРИГЛУШЕННЯ ПРИ ЗАПИСІ В БАЗУ */
  .main-area.is-busy { opacity: 0.65; pointer-events: none; transition: opacity 0.2s; }
  /* КНОПКИ МЕСЕНДЖЕРІВ НА КАРТЦІ УЧНЯ */
  .msg-btn-group { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
  .msg-btn { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 8px; font-size: 11px; font-weight: 700; text-decoration: none; transition: 0.15s; border: 1px solid transparent; }
  .msg-btn:hover { transform: translateY(-1px); filter: brightness(0.95); }
  .msg-tg { background: #E0F2FE; color: #0284C7; border-color: #BAE6FD; }
  .msg-vb { background: #F3E8FF; color: #7E22CE; border-color: #E9D5FF; }
  .msg-wa { background: #DCFCE7; color: #15803D; border-color: #BBF7D0; }
  /* ПЕРЕМИКАЧ СПИСОК / КАЛЕНДАР ТА ПАГІНАЦІЯ */
  .view-toggle { display: inline-flex; background: #E2E8F0; padding: 3px; border-radius: 9px; gap: 2px; }
  .view-toggle-btn { border: none; background: transparent; padding: 5px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: 0.15s; font-family: inherit; }
  .view-toggle-btn.active { background: #fff; color: #0F172A; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
  .btn-load-more { width: 100%; padding: 11px; background: #F8FAFC; border: none; border-top: 1px solid var(--border-light); color: var(--accent-hover); font-weight: 600; font-size: 12px; cursor: pointer; transition: 0.15s; font-family: inherit; }
  .btn-load-more:hover { background: var(--accent-light); }

  /* МІНІМАЛІСТИЧНИЙ КАЛЕНДАР УЧНЯ */
  .cal-wrapper { padding: 16px 20px; }
  .cal-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; background: #F8FAFC; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border-light); }
  .cal-month-title { font-weight: 700; font-size: 14px; color: #0F172A; }
  .cal-month-stats { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
  .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
  .cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; padding-bottom: 6px; }
  .cal-day { min-height: 68px; border: 1px solid var(--border-light); border-radius: 8px; padding: 6px; background: #fff; display: flex; flex-direction: column; gap: 4px; transition: 0.15s; }
  .cal-day.empty { background: #FAFBFD; border-color: transparent; min-height: 40px; }
  .cal-day.has-events { border-color: #99F6E4; background: #F0FDFA; }
  .cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--accent); }
  .cal-day-num { font-size: 11px; font-weight: 700; color: #64748B; text-align: right; margin-bottom: 2px; }
  .cal-pill { font-size: 10px; font-weight: 700; padding: 3px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; line-height: 1.2; }
  .cal-pill-lesson { background: #CCFBF1; color: #0F766E; border: 1px solid #99F6E4; }
  .cal-pill-lesson:hover { background: #99F6E4; }
  .cal-pill-pay { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
  /* ДАШБОРД 2.0: СІТКИ, ГРАФІКИ, СТРІЧКА ТА TO-DO (З МОБІЛЬНОЮ АДАПТАЦІЄЮ) */
  .dash-2col { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; margin-bottom: 22px; align-items: stretch; }
  .dash-2col-equal { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 22px; align-items: stretch; }
  .dash-2col > .detail-section, .dash-2col-equal > .detail-section { margin-bottom: 0; display: flex; flex-direction: column; }

  /* Глобальний швидкий пошук */
  .global-search-wrap { position: relative; width: 320px; max-width: 100%; }
  .global-search-results { position: absolute; top: calc(100% + 6px); left: 0; width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 24px rgba(15,23,42,0.12); z-index: 999; max-height: 320px; overflow-y: auto; display: none; }
  .gs-item { padding: 9px 12px; border-bottom: 1px solid #F1F5F9; cursor: pointer; font-size: 12px; display: flex; justify-content: space-between; align-items: center; }
  .gs-item:hover { background: var(--accent-light); }

  /* Міні-графіки (Доходи vs Витрати та Тижневий навантажувач) */
  .bar-chart-box { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; height: 155px; padding: 18px 8px 6px 8px; border-bottom: 1px solid var(--border-light); }
  .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; min-width: 0; }
  .bar-pair { display: flex; align-items: flex-end; gap: 4px; height: 115px; width: 100%; justify-content: center; }
  .bar-pill { width: 14px; border-radius: 4px 4px 0 0; transition: height 0.3s ease; min-height: 3px; position: relative; }
  .bar-lbl { font-size: 10px; font-weight: 600; color: var(--text-muted); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bar-val-top { font-size: 10px; font-weight: 700; color: var(--text-main); margin-bottom: 3px; }

  /* To-Do Список власника */
  .todo-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #F1F5F9; font-size: 13px; }
  .todo-item.done span { text-decoration: line-through; color: var(--text-muted); }

  /* Стрічка подій (Activity Feed) */
  .feed-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #F1F5F9; font-size: 12px; align-items: flex-start; }
  .feed-icon { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; background: #F8FAFC; border: 1px solid var(--border-light); }

  @media (max-width: 960px) {
    .dash-2col, .dash-2col-equal { grid-template-columns: 1fr; gap: 16px; }
    .global-search-wrap { width: 100%; }
    .cal-day { min-height: 52px; padding: 4px; }
    .cal-pill { font-size: 9px; padding: 2px 4px; }
  }
/* МІНІМАЛІСТИЧНИЙ КАБІНЕТ ВЧИТЕЛЯ (ІЗОЛЬОВАНІ СТИЛІ БЕЗ ГОРИЗОНТАЛЬНОГО СКРОЛУ) */
  #teacher-app-container { width: 100%; max-width: 100vw; overflow-x: hidden !important; box-sizing: border-box; }
  .tc-shell { width: 100%; max-width: 600px; margin: 0 auto; padding: 10px 10px 36px 10px; box-sizing: border-box; overflow-x: hidden; }
  .tc-shell *, .tc-shell *::before, .tc-shell *::after { box-sizing: border-box; }
  .tc-shell .detail-section { width: 100%; max-width: 100%; overflow: hidden; margin-left: 0; margin-right: 0; }
  .tc-shell select, .tc-shell input, .tc-shell textarea, .tc-shell button { max-width: 100%; }

  .tc-header-card { background: var(--bg-sidebar); color: #fff; padding: 12px 14px; border-radius: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; box-shadow: var(--shadow); width: 100%; }
  .tc-kpi-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; width: 100%; }
  .tc-dur-pills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; width: 100%; }
  .tc-dur-btn { padding: 9px 2px; border: 1px solid var(--border); background: #F8FAFC; border-radius: 9px; font-size: 12px; font-weight: 600; color: var(--text-main); cursor: pointer; transition: 0.15s; font-family: inherit; text-align: center; white-space: nowrap; min-width: 0; }
  .tc-dur-btn.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent-hover); box-shadow: 0 0 0 1px var(--accent); font-weight: 700; }

  .tc-date-time-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 8px; width: 100%; }
  .tc-input-wrap { min-width: 0; width: 100%; overflow: hidden; }
  .tc-input-wrap input { width: 100% !important; min-width: 0 !important; max-width: 100% !important; display: block; }
  .tc-quick-chip { font-size: 11px; font-weight: 600; color: var(--accent-hover); background: var(--accent-light); padding: 2px 8px; border-radius: 6px; cursor: pointer; border: 1px solid #99F6E4; user-select: none; }

  .tc-lesson-item { padding: 12px 14px; border-bottom: 1px solid #F1F5F9; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; width: 100%; }
  .tc-lesson-item:last-child { border-bottom: none; }
  .tc-meta-tag { display: inline-block; font-size: 11px; font-weight: 600; color: #475569; background: #F1F5F9; padding: 2px 6px; border-radius: 6px; }

  .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; width: 100%; }
  .tc-cal-cell { min-height: 48px; border: 1px solid var(--border-light); border-radius: 8px; padding: 3px; background: #fff; display: flex; flex-direction: column; justify-content: space-between; align-items: center; cursor: pointer; min-width: 0; overflow: hidden; }
  .tc-cal-cell.empty { background: #FAFBFD; border-color: transparent; cursor: default; min-height: 32px; }
  .tc-cal-cell.has-ev { background: #F0FDFA; border-color: #99F6E4; }
  .tc-cal-cell.is-sel { border: 2px solid #0F172A !important; background: #CCFBF1; }
  .tc-cal-num { font-size: 11px; font-weight: 700; color: #475569; align-self: flex-end; line-height: 1; }
  .tc-cal-badge { font-size: 9px; font-weight: 700; background: #CCFBF1; color: #0F766E; border-radius: 4px; padding: 2px 1px; width: 100%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  @media (max-width: 480px) {
    .tc-shell { padding: 8px 8px 32px 8px; }
    .tc-shell .detail-section-header, .tc-shell .detail-section-body { padding: 12px !important; }
    .cal-wrapper { padding: 10px 6px !important; }
    .cal-grid { gap: 3px; }
    .tc-cal-cell { min-height: 44px; padding: 2px; }
  }

/* === 2. STUDENTS BENTO STYLES (view_students.html) === */
  .stu-card-main { background: #fff; border: 1px solid var(--border-light); border-radius: 16px; padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
  
  /* Шапка профілю */
  .stu-top-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
  .stu-avatar-circle { width: 46px; height: 46px; border-radius: 50%; background: #F1F5F9; border: 1px solid #E2E8F0; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
  .stu-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
  .stu-name-h2 { margin: 0; font-size: 19px; font-weight: 800; color: #0F172A; letter-spacing: -0.3px; }
  .stu-pill-lang { background: #CCFBF1; color: #0F766E; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
  .stu-pill-state { background: #F1F5F9; color: #475569; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
  
  .stu-contacts-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 4px; font-size: 12px; color: #64748B; }
  .stu-contact-link { color: #64748B; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; font-weight: 500; cursor: pointer; }
  .stu-contact-link:hover { color: var(--accent-hover); }

  /* Симетрична двоколонкова сітка */
  .stu-bento-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
  .stu-bento-box { background: #F8FAFC; border: 1px solid #EEF2F6; border-radius: 12px; padding: 16px 18px; }
  .stu-box-heading { font-size: 13px; font-weight: 800; color: #64748B; text-transform: uppercase; letter-spacing: 0.4px; margin: 0 0 12px 0; }

  /* Верхня акцентна плашка в кожному блоці (однакова висота 44px) */
  .stu-hero-strip { background: #fff; border: 1px solid #E2E8F0; border-radius: 10px; padding: 9px 12px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; min-height: 42px; box-sizing: border-box; }
  .stu-balance-num { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; }
  .stu-balance-num.pos { color: #0D9488; }
  .stu-balance-num.neg { color: #E11D48; }

  /* Єдиний стандарт рядка: Назва ліворуч — Значення праворуч */
  .stu-kv-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; height: 36px; border-bottom: 1px solid #EEF2F6; font-size: 13px; }
  .stu-kv-row:last-child { border-bottom: none; height: 32px; padding-bottom: 0; }
  .stu-kv-label { color: #64748B; font-weight: 500; white-space: nowrap; flex-shrink: 0; }
  .stu-kv-val { color: #0F172A; font-weight: 700; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; display: flex; align-items: center; gap: 6px; }
  .stu-kv-sub { color: #64748B; font-weight: 500; font-size: 12px; }

  .stu-btn-mini { background: #E2E8F0; color: #334155; border: none; border-radius: 6px; padding: 4px 10px; font-size: 11px; font-weight: 600; cursor: pointer; white-space: nowrap; font-family: inherit; transition: 0.15s; }
  .stu-btn-mini:hover { background: #CBD5E1; color: #0F172A; }

  /* Нижня панель швидких повідомлень строго в 1 ряд */
  .stu-msg-bar { border-top: 1px solid #F1F5F9; padding-top: 14px; }
  .stu-msg-controls { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
  .stu-msg-select { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 8px; border: 1px solid #CBD5E1; background: #F8FAFC; font-size: 12px; font-weight: 600; color: #0F172A; margin: 0; }
  
  .btn-messenger { border-radius: 8px; padding: 7px 10px; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-family: inherit; transition: 0.15s; white-space: nowrap; flex-shrink: 0; }
  .btn-m-copy { background: #F8FAFC; color: #334155; border: 1px solid #CBD5E1; }
  .btn-m-copy:hover { background: #F1F5F9; }
  .btn-m-tg { background: #F0F9FF; color: #0369A1; border: 1px solid #BAE6FD; }
  .btn-m-tg:hover { background: #E0F2FE; }
  .btn-m-viber { background: #F5F3FF; color: #5B21B6; border: 1px solid #DDD6FE; }
  .btn-m-viber:hover { background: #EDE9FE; }
  .btn-m-wa { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }
  .btn-m-wa:hover { background: #DCFCE7; }

  @media (max-width: 900px) {
    .stu-bento-grid { grid-template-columns: 1fr; }
    .stu-msg-controls { flex-wrap: wrap; }
    .stu-msg-select { min-width: 100%; }
  }

/* === 3. TEACHERS BENTO STYLES (view_teachers.html) === */
  .tch-card-main { background: #fff; border: 1px solid var(--border-light); border-radius: 16px; padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
  
  /* Шапка профілю */
  .tch-top-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
  .tch-avatar-circle { width: 46px; height: 46px; border-radius: 50%; background: #F1F5F9; border: 1px solid #E2E8F0; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
  .tch-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
  .tch-name-h2 { margin: 0; font-size: 19px; font-weight: 800; color: #0F172A; letter-spacing: -0.3px; }
  .tch-pill-lang { background: #CCFBF1; color: #0F766E; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
  .tch-pill-state { background: #F1F5F9; color: #475569; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
  
  .tch-contacts-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 4px; font-size: 12px; color: #64748B; }
  .tch-contact-link { color: #64748B; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; font-weight: 500; cursor: pointer; }
  .tch-contact-link:hover { color: var(--accent-hover); }

  /* Симетрична двоколонкова сітка */
  .tch-bento-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
  .tch-bento-box { background: #F8FAFC; border: 1px solid #EEF2F6; border-radius: 12px; padding: 16px 18px; }
  .tch-box-heading { font-size: 13px; font-weight: 800; color: #64748B; text-transform: uppercase; letter-spacing: 0.4px; margin: 0 0 12px 0; }

  .tch-hero-strip { background: #fff; border: 1px solid #E2E8F0; border-radius: 10px; padding: 9px 12px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; min-height: 42px; box-sizing: border-box; }
  .tch-payout-num { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; color: #0D9488; }
  .tch-payout-num.zero { color: #64748B; }

  /* Єдиний стандарт рядка: Назва ліворуч — Значення праворуч */
  .tch-kv-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; height: 36px; border-bottom: 1px solid #EEF2F6; font-size: 13px; }
  .tch-kv-row:last-child { border-bottom: none; height: 32px; padding-bottom: 0; }
  .tch-kv-label { color: #64748B; font-weight: 500; white-space: nowrap; flex-shrink: 0; }
  .tch-kv-val { color: #0F172A; font-weight: 700; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; display: flex; align-items: center; gap: 6px; }
  .tch-kv-sub { color: #64748B; font-weight: 500; font-size: 12px; }

  /* Компактна панель учнів викладача */
  .tch-students-bar { border-top: 1px solid #F1F5F9; padding-top: 12px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
  .tch-stu-chip { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600; color: #0F172A; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: 0.15s; }
  .tch-stu-chip:hover { background: #F0FDFA; border-color: #99F6E4; color: #0F766E; }

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

/* === 4. LEADS FIXED TABLE STYLES (scripts.html) === */
  .leads-fixed-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
  .leads-fixed-table th, .leads-fixed-table td {
    padding: 10px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
  }