:root {
  --green: #17543c;
  --dark: #103d2c;
  --yellow: #f4cb3c;
  --lime: #eaf0ce;
  --paper: #fafbf5;
  --muted: #556a5f;
  --line: #d9e2d7;
  --ink: #173d30;
  font-family: Arial, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; line-height: 1.55; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
a { color: inherit; }
:focus-visible { outline: 3px solid #bc820c; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 30; top: -80px; left: 12px; padding: 10px 16px; border-radius: 10px; background: var(--yellow); }
.skip-link:focus { top: 12px; }
.shell { width: min(1160px, calc(100% - 32px)); margin-inline: auto; }
.brand { display: inline-flex; flex-direction: column; flex: none; gap: 2px; color: var(--dark); line-height: 1; text-decoration: none; }
.brand-mark { font-size: 1.8rem; font-weight: 900; letter-spacing: -.09em; }
.brand-mark span { color: #b38711; }
.brand-caption { font-size: .56rem; font-weight: 800; letter-spacing: .27em; }
.eyebrow { margin: 0 0 10px; font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.17; }
h1 { margin: 0 0 16px; font-size: clamp(2.15rem, 6vw, 3.7rem); letter-spacing: -.04em; }
h2 { margin: 0 0 12px; font-size: clamp(1.35rem, 3vw, 1.8rem); letter-spacing: -.025em; }
h3 { margin: 0 0 8px; font-size: 1.06rem; }
.muted { color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 12px 20px; border: 1px solid transparent; border-radius: 999px; background: var(--green); color: #fff; font-weight: 700; text-align: center; text-decoration: none; transition: background .18s ease, transform .18s ease; }
.button:hover:not(:disabled) { background: var(--dark); transform: translateY(-1px); }
.button-light { background: #fff; border-color: var(--line); color: var(--green); }
.button-light:hover:not(:disabled) { background: var(--lime); }
.button-quiet { background: transparent; border-color: var(--line); color: var(--green); }
.button-quiet:hover:not(:disabled) { background: var(--lime); }
.status { min-height: 1.5em; margin: 12px 0 0; color: var(--muted); font-size: .9rem; }
.status.is-error { color: #982e22; font-weight: 700; }

/* Sign-in and callback */
.auth-page { min-height: 100dvh; padding: 20px 0 36px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 4px 24px; }
.auth-top > a:last-child { padding: 10px 0; color: var(--green); font-size: .9rem; font-weight: 700; }
.auth-layout { display: grid; gap: 16px; }
.auth-intro, .auth-card, .callback-card { border-radius: 24px; }
.auth-intro { position: relative; isolation: isolate; min-height: 220px; overflow: hidden; padding: 30px 26px; background: var(--dark); color: #fff; }
.auth-intro::after { position: absolute; z-index: -1; right: -55px; bottom: -105px; width: 245px; height: 245px; border: 36px solid var(--yellow); border-radius: 50%; content: ""; opacity: .92; }
.auth-intro h1 { max-width: 540px; }
.auth-intro > p:last-child { max-width: 510px; margin: 0; color: #e0eddf; font-size: 1.05rem; }
.auth-intro .eyebrow { color: var(--yellow); }
.auth-card, .callback-card { padding: 28px 24px; border: 1px solid var(--line); background: #fff; box-shadow: 0 15px 40px #103d2c0d; }
.auth-card h2 { margin-bottom: 8px; }
.auth-card > p { margin: 0 0 22px; color: var(--muted); }
.google-button { width: 100%; gap: 12px; min-height: 54px; background: var(--green); }
.google-icon { flex: none; width: 20px; height: 20px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 24px 0; color: var(--muted); font-size: .8rem; }
.auth-divider::before, .auth-divider::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.auth-form { display: grid; gap: 10px; }
.auth-form label { font-size: .92rem; font-weight: 700; }
.auth-form input { width: 100%; min-height: 50px; padding: 12px 15px; border: 1px solid #aec2b5; border-radius: 12px; color: var(--ink); background: #fff; font-size: 1rem; }
.auth-form input::placeholder { color: #728678; }
.auth-form .button { width: 100%; margin-top: 4px; }
.auth-footnote { margin: 20px 0 0 !important; font-size: .86rem; }
.callback-wrap { display: grid; min-height: min(640px, 80dvh); place-items: center; }
.callback-card { width: min(580px, 100%); }
.callback-card .eyebrow { color: var(--green); }
.callback-card p { color: var(--muted); }
.callback-card .button { margin-top: 10px; }
.callback-mark { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 20px; border-radius: 18px; background: var(--lime); color: var(--green); font-size: 1.7rem; font-weight: 800; }
.callback-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Authenticated shells remain hidden until the role check completes. */
.cabinet-page { min-height: 100dvh; padding-bottom: 56px; }
.cabinet-check { display: grid; min-height: 60dvh; place-items: center; padding: 24px; text-align: center; }
.cabinet-check-inner { width: min(480px, 100%); padding: 30px 24px; border: 1px solid var(--line); border-radius: 24px; background: #fff; }
.cabinet-check-inner p { color: var(--muted); }
.cabinet-header { border-bottom: 1px solid var(--line); background: #fff; }
.cabinet-header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding-block: 14px; }
.cabinet-header-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
.account-id { display: flex; align-items: center; gap: 9px; min-width: 0; }
.account-name { max-width: 150px; overflow: hidden; font-size: .85rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; flex: none; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--lime); color: var(--green); font-weight: 800; }
.cabinet-header .button { min-height: 44px; padding: 8px 15px; font-size: .85rem; }
.cabinet-main { padding-top: 28px; }
.welcome-card { position: relative; overflow: hidden; padding: 28px 24px; border-radius: 24px; background: var(--lime); }
.welcome-card::after { position: absolute; right: -65px; bottom: -105px; width: 220px; height: 220px; border: 34px solid #f4cb3c9c; border-radius: 50%; content: ""; pointer-events: none; }
.welcome-card > * { position: relative; z-index: 1; }
.welcome-card .eyebrow { color: var(--green); }
.welcome-card h1 { margin-bottom: 12px; font-size: clamp(1.9rem, 5vw, 3rem); }
.welcome-card > p:last-child { max-width: 680px; margin: 0; color: var(--muted); }
.section-heading { margin: 34px 0 16px; }
.section-heading p { margin: 0; color: var(--muted); }
.dashboard-grid { display: grid; gap: 16px; }
.dashboard-card { min-width: 0; padding: 24px 22px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 8px 24px #103d2c08; }
.dashboard-card .eyebrow { color: var(--green); }
.dashboard-card p { margin: 0; color: var(--muted); }
.card-title-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px; }
.workspace-switch { display: flex; width: fit-content; max-width: 100%; gap: 4px; padding: 4px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.workspace-switch[hidden], .workspace-section-body[hidden] { display: none; }
.workspace-switch a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 14px; border-radius: 12px; color: var(--green); font-weight: 700; text-align: center; text-decoration: none; }
.workspace-switch a[aria-current="page"] { background: var(--green); color: #fff; }
.workspace-switch a:focus-visible, .section-toggle:focus-visible { outline: 3px solid #dd9818; outline-offset: 2px; }
.workspace-collapsible > .section-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.workspace-collapsible > .section-heading h2 { grid-column: 1; grid-row: 1; margin: 0; }
.workspace-collapsible > .section-heading p { grid-column: 1 / -1; grid-row: 2; }
.workspace-collapsible > .section-heading .section-toggle { grid-column: 2; grid-row: 1; }
.workspace-collapsible > .card-title-row { grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; }
.section-toggle { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--green); font: inherit; font-size: .875rem; font-weight: 700; cursor: pointer; }
.section-toggle:hover { background: var(--lime); }
@media (max-width: 540px) { .workspace-collapsible > .card-title-row .icon-tile { display: none; } .workspace-collapsible > .card-title-row { grid-template-columns: minmax(0, 1fr) auto; } .workspace-collapsible > .card-title-row h2 { font-size: 1.15rem; } .workspace-switch { width: 100%; } .workspace-switch a { flex: 1; min-width: 0; padding-inline: 8px; font-size: .875rem; } }
.card-title-row > div { min-width: 0; }
.icon-tile { display: grid; justify-self: end; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--lime); color: var(--green); font-size: 1.35rem; }
.empty-state { margin-top: 22px; padding: 18px; border: 1px dashed #b8c9b8; border-radius: 14px; background: var(--paper); }
.empty-state strong { display: block; margin-bottom: 4px; color: var(--ink); }
.placeholder-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 20px; }
.placeholder-stats div { min-width: 0; padding: 12px 9px; border-radius: 12px; background: var(--paper); text-align: center; }
.placeholder-stats span { display: block; color: var(--muted); font-size: .78rem; }
.placeholder-stats strong { font-size: 1.3rem; }
.quiet-pill { display: inline-flex; align-items: center; min-height: 30px; padding: 4px 10px; border-radius: 999px; background: var(--lime); color: var(--green); font-size: .78rem; font-weight: 700; }
.future-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.future-actions .button { min-height: 44px; padding: 9px 15px; font-size: .85rem; }
.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.overview-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.overview-card span { display: block; color: var(--muted); font-size: .82rem; }
.overview-card strong { display: block; margin-top: 6px; color: var(--green); font-size: 2rem; line-height: 1; }
.cabinet-footer { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.cabinet-footer a { color: var(--green); }

/* Admin dashboard */
body.admin-dialog-open { overflow: hidden; }
.admin-skeleton { width: 62px; height: 30px; border-radius: 8px; background: linear-gradient(90deg, #eaf0e8, #f5f7f2, #eaf0e8); }
.admin-error { margin-top: 14px; padding: 16px; border: 1px solid #e6b7ab; border-radius: 16px; background: #fff8f5; color: #812d22; }
.admin-error p { margin: 0 0 12px; }
.admin-toolbar { display: grid; gap: 12px; margin-bottom: 10px; }
.admin-field { display: grid; gap: 6px; min-width: 0; }
.admin-field label { color: var(--dark); font-size: .9rem; font-weight: 700; }
.admin-field input, .admin-field select, .admin-field textarea { width: 100%; min-width: 0; min-height: 48px; padding: 10px 13px; border: 1px solid #aec2b5; border-radius: 12px; background: #fff; color: var(--ink); }
.admin-field textarea { resize: vertical; }
.admin-table-wrap { min-width: 0; margin-top: 14px; }
.admin-users-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.admin-users-table th, .admin-users-table td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; overflow-wrap: anywhere; }
.admin-users-table th { color: var(--muted); font-size: .78rem; }
.admin-users-table td { font-size: .88rem; }
.admin-users-table td:first-child { font-weight: 700; }
.admin-users-table th:nth-child(1) { width: 15%; }
.admin-users-table th:nth-child(2) { width: 23%; }
.admin-users-table th:nth-child(3) { width: 15%; }
.admin-users-table th:nth-child(4) { width: 12%; }
.admin-users-table th:nth-child(5) { width: 13%; }
.admin-users-table th:nth-child(6) { width: 12%; }
.admin-users-table th:nth-child(7) { width: 10%; }
.admin-manage { min-height: 44px; padding: 8px 12px; font-size: .82rem; }
.admin-state { display: inline-block; padding: 4px 9px; border-radius: 999px; background: var(--lime); color: var(--green); font-size: .78rem; font-weight: 700; }
.admin-state-pending { background: #fff3c7; color: #694a08; }
.admin-state-suspended { background: #fbe6e1; color: #8e3025; }
.admin-dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: #fff; color: var(--ink); box-shadow: 0 24px 70px #103d2c33; overflow: auto; }
.admin-dialog::backdrop { background: #102e26a8; }
.admin-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.admin-dialog-heading h2 { margin-bottom: 4px; }
.admin-dialog-close { flex: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--green); font-size: 1.7rem; line-height: 1; }
.admin-dialog form { display: grid; gap: 14px; }
.admin-dialog p { margin: 0; }
.admin-dialog-person { display: grid; gap: 2px; padding: 14px; border-radius: 14px; background: var(--paper); overflow-wrap: anywhere; }
.admin-dialog-person span, .admin-current-access { color: var(--muted); font-size: .9rem; }
.admin-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 6px; }

/* Live lesson management and cabinet data */
.cabinet-data { min-width: 0; margin-top: 18px; color: var(--muted); }
.cabinet-data p { margin: 0 0 8px; }
.cabinet-data strong { color: var(--ink); }
.cabinet-data .empty-state { margin-top: 0; }
.learning-list { display: grid; gap: 12px; }
.learning-item { display: grid; gap: 4px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); overflow-wrap: anywhere; }
.learning-item h4 { margin: 0 0 4px; color: var(--dark); font-size: 1rem; }
.learning-item .button { justify-self: start; margin-top: 8px; }
.package-summary + .package-summary { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.package-summary .placeholder-stats { margin-top: 8px; }
.cabinet-refresh { margin-top: 20px; }
.admin-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.learning-dialog { width: min(700px, calc(100% - 24px)); }
.learning-dialog .admin-dialog-heading { margin-bottom: 14px; }
.learning-overview-list { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.learning-overview-list .empty-state { margin: 0; }
.learning-action { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; }
.learning-action summary { cursor: pointer; color: var(--green); font-weight: 800; }
.learning-action form { display: grid; gap: 14px; padding-top: 16px; }
.learning-action form > .button { justify-self: start; }
.learning-fields { display: grid; gap: 12px; }
.learning-check { display: flex; align-items: flex-start; gap: 10px; color: var(--dark); font-weight: 700; }
.learning-check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--green); }
.teacher-extra-lessons { margin-top: 20px; }
.learning-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.learning-actions .button { min-height: 44px; padding: 9px 14px; font-size: .87rem; }
.learning-warning { margin: 0; padding: 11px 13px; border: 1px solid #e2c26a; border-radius: 12px; background: #fff6d9; color: #654806; font-size: .88rem; }

/* Read-only admin lesson journal */
.admin-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 6px; }
.admin-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 15px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--green); font-weight: 700; text-decoration: none; }
.admin-nav a:hover { background: var(--lime); }
#overview, #users, #schedule, #chat, #journal { scroll-margin-top: 24px; }
.journal-month { display: flex; align-items: center; justify-content: space-between; gap: 8px; max-width: 390px; margin: 0 0 16px; }
.journal-month .button { flex: none; width: 48px; min-height: 48px; padding: 6px; font-size: 1.3rem; }
.journal-month strong { min-width: 0; text-align: center; text-transform: capitalize; }
.journal-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.journal-summary-scope { margin: 18px 0 0; color: var(--muted); font-size: .88rem; }
.journal-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.journal-summary .overview-card { padding: 13px; }
.journal-summary .overview-card strong { font-size: 1.55rem; }
.journal-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.journal-table th, .journal-table td { padding: 12px 7px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; font-size: .82rem; }
.journal-table th { color: var(--muted); font-size: .75rem; }
.journal-table th:nth-child(1) { width: 13%; }
.journal-table th:nth-child(2), .journal-table th:nth-child(3) { width: 13%; }
.journal-table th:nth-child(4) { width: 8%; }
.journal-table th:nth-child(5) { width: 13%; }
.journal-table th:nth-child(6) { width: 16%; }
.journal-table th:nth-child(7) { width: 14%; }
.journal-table th:nth-child(8) { width: 10%; }
.journal-table td strong, .journal-table td small { display: block; }
.journal-table td small { color: var(--muted); }
.journal-badge { display: inline-block; padding: 4px 8px; border-radius: 999px; background: var(--lime); color: var(--green); font-size: .77rem; font-weight: 700; }
.journal-badge--scheduled { background: #fff2c4; color: #654806; }
.journal-badge--cancelled, .journal-badge--no_show { background: #fbe6e1; color: #8e3025; }
.journal-badge--rescheduled { background: #edf0eb; color: var(--muted); }
.journal-table .button { min-height: 44px; padding: 8px 10px; font-size: .78rem; }
.journal-more { margin-top: 14px; }
.journal-details { display: grid; gap: 8px; margin-top: 16px; }
.journal-details p { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.journal-details a { color: var(--green); }

/* Operational weekly schedule */
.schedule-section { margin-top: 20px; }
.schedule-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.schedule-toolbar strong { flex: 1 1 170px; min-width: 0; text-align: center; }
.schedule-toolbar .button { min-width: 44px; min-height: 44px; padding: 8px 11px; }
.schedule-filter { max-width: 320px; margin-bottom: 16px; }
.schedule-grid { display: grid; gap: 10px; min-width: 0; }
.schedule-day { display: grid; align-content: start; gap: 8px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.schedule-day.is-today { border-color: var(--green); background: #f0f5dc; }
.schedule-day h3 { margin: 0 0 3px; color: var(--green); text-transform: capitalize; }
.schedule-day-short, .schedule-day-date { display: none; }
.schedule-day-empty { color: var(--muted); font-size: .82rem; }
.schedule-lesson { display: grid; gap: 3px; width: 100%; min-width: 0; min-height: 68px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); text-align: left; overflow-wrap: anywhere; }
.schedule-lesson:hover { border-color: var(--green); }
.schedule-lesson strong { color: var(--green); font-size: 1rem; }
.schedule-person { font-weight: 700; }
.schedule-meta { color: var(--muted); font-size: .82rem; }
.schedule-lesson .journal-badge { justify-self: start; margin-top: 3px; }
.schedule-details { display: grid; gap: 8px; margin-top: 14px; }
.schedule-details p { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.schedule-details .button { justify-self: start; margin-top: 6px; }
@media (min-width: 1024px) {
  .schedule-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
  .schedule-day { padding: 9px; }
  .schedule-day h3 { display: grid; gap: 2px; font-size: .78rem; }
  .schedule-day-short { display: block; text-transform: uppercase; letter-spacing: .08em; }
  .schedule-day-date { display: block; }
  .schedule-day-long { display: none; }
  .schedule-lesson { padding: 8px; }
}

/* Private student–admin chat */
.chat-section { margin-top: 20px; }
.chat-section h2 { margin-bottom: 0; }
.chat-status { margin: 14px 0; color: var(--muted); }
.chat-layout { display: grid; gap: 14px; min-width: 0; margin-top: 18px; }
.chat-layout--single .chat-contacts { display: none; }
.chat-contacts { display: grid; align-content: start; gap: 8px; max-height: 430px; overflow: auto; }
.chat-contact { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; width: 100%; min-width: 0; min-height: 72px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); text-align: left; cursor: pointer; }
.chat-contact.is-selected { border-color: var(--green); background: var(--lime); }
.chat-contact strong, .chat-contact span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-contact span { grid-column: 1; color: var(--muted); font-size: .83rem; }
.chat-contact small { grid-column: 2; grid-row: 1; color: var(--muted); }
.chat-unread { display: inline-grid; place-items: center; min-width: 25px; height: 25px; padding: 0 7px; border-radius: 999px; background: var(--yellow); color: var(--dark); font-size: .75rem; font-weight: 800; }
.chat-contact .chat-unread { position: absolute; right: 10px; bottom: 8px; }
.chat-panel { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.chat-panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 10px; }
.chat-panel-head h3 { margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.chat-back, .chat-older, .chat-new { min-height: 44px; padding: 8px 13px; font-size: .83rem; }
.chat-older { margin-bottom: 10px; }
.chat-new { display: block; margin: 8px auto 0; }
.chat-log { min-width: 0; height: min(47dvh, 430px); min-height: 240px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow-y: auto; overscroll-behavior: contain; }
.chat-day { margin: 13px 0; color: var(--muted); text-align: center; font-size: .8rem; }
.chat-bubble { width: fit-content; max-width: min(85%, 520px); margin: 8px 0; padding: 9px 12px; border-radius: 15px; background: var(--lime); color: var(--dark); overflow-wrap: anywhere; }
.chat-bubble--own { margin-left: auto; border-bottom-right-radius: 4px; background: #f8e7a5; }
.chat-bubble--other { border-bottom-left-radius: 4px; }
.chat-bubble p { margin: 0; color: inherit; white-space: pre-wrap; }
.chat-bubble time { display: block; margin-top: 3px; color: var(--muted); text-align: right; font-size: .7rem; }
.chat-empty { color: var(--muted); text-align: center; }
.chat-compose { display: grid; gap: 8px; margin-top: 12px; }
.chat-compose label { color: var(--dark); font-weight: 700; }
.chat-compose textarea { width: 100%; min-width: 0; min-height: 70px; max-height: 150px; padding: 11px 13px; border: 1px solid #aec2b5; border-radius: 12px; background: #fff; color: var(--ink); resize: vertical; font: inherit; font-size: max(16px, 1rem); }
.chat-compose .button { justify-self: end; min-height: 48px; }
.chat-error { margin: 10px 0; color: #8e3025; }
.chat-section :is(button, textarea):focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

@media (min-width: 720px) {
  .shell { width: min(1160px, calc(100% - 56px)); }
  .auth-page { padding-top: 30px; }
  .auth-top { padding-bottom: 34px; }
  .auth-layout { grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); align-items: stretch; gap: 20px; }
  .auth-intro { display: flex; flex-direction: column; justify-content: center; min-height: 570px; padding: 54px; }
  .auth-intro::after { right: -25px; bottom: -75px; width: 320px; height: 320px; border-width: 48px; }
  .auth-card { align-self: center; padding: 38px; }
  .cabinet-header-inner { min-height: 88px; }
  .cabinet-main { padding-top: 38px; }
  .welcome-card { padding: 38px 42px; }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .dashboard-card-wide { grid-column: 1 / -1; }
  .overview-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .admin-toolbar { grid-template-columns: minmax(170px, 220px) minmax(0, 1fr); align-items: end; }
  .learning-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .journal-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .journal-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chat-layout.is-conversation:not(.chat-layout--single) { grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); }
}
@media (max-width: 719px) {
  .chat-layout.is-conversation:not(.chat-layout--single) .chat-contacts { display: none; }
  .chat-layout:not(.is-conversation) .chat-panel { display: none; }
  .chat-panel { padding: 10px; }
  .chat-log { padding: 10px; }
}
@media (max-width: 959px) {
  .admin-users-table, .admin-users-table tbody, .admin-users-table tr, .admin-users-table td { display: block; width: 100%; }
  .admin-users-table thead { display: none; }
  .admin-users-table tr { margin-bottom: 12px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
  .admin-users-table td { display: grid; grid-template-columns: minmax(80px, 36%) minmax(0, 1fr); align-items: center; gap: 8px; padding: 8px 0; border: 0; }
  .admin-users-table td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 400; }
  .journal-table, .journal-table tbody, .journal-table tr, .journal-table td { display: block; width: 100%; }
  .journal-table thead { display: none; }
  .journal-table tr { margin-bottom: 12px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
  .journal-table td { display: grid; grid-template-columns: minmax(84px, 34%) minmax(0, 1fr); gap: 8px; padding: 7px 0; border: 0; }
  .journal-table td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; }
  .journal-table td:first-child { display: block; border-bottom: 1px solid var(--line); color: var(--green); font-weight: 700; }
  .journal-table td:first-child::before { display: none; }
}
@media (max-width: 360px) {
  .account-name { max-width: 90px; }
  .cabinet-header-actions { gap: 7px; }
  .cabinet-header .button { padding-inline: 10px; }
  .dashboard-card { padding: 20px 17px; }
  .overview-card { padding: 14px; }
  .admin-dialog { padding: 18px; }
  .admin-dialog-actions .button { flex: 1; padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}
