:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  background: #0b1020;
  color: #f4f5ff;
  --muted: #a2acc6;
  --surface: #131b30;
  --border: #27314a;
  --accent: #b7a6ff;
  --bottom: max(env(safe-area-inset-bottom), var(--tg-safe-bottom, 0px));
  --left: max(env(safe-area-inset-left), var(--tg-safe-left, 0px));
  --right: max(env(safe-area-inset-right), var(--tg-safe-right, 0px));
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 0;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 48% -10%, #1d2143 0, transparent 52%);
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid #bdadff; outline-offset: 3px; }
main:focus { outline: none; }
h1, h2, h3, p { margin: 0; }
svg { width: 22px; height: 22px; flex: none; }
.shell {
  width: min(100%, 960px);
  margin-inline: auto;
  padding: max(16px, env(safe-area-inset-top), var(--tg-safe-top, 0px)) max(18px, var(--right))
    calc(105px + var(--bottom)) max(18px, var(--left));
}
.brandbar { display: flex; align-items: center; justify-content: space-between; padding-block: 8px 17px; border-bottom: 1px solid #27314a; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand strong { display: block; font-size: 1.08rem; line-height: 1.2; letter-spacing: -.025em; }
.brand small, .welcome-name { display: block; color: var(--muted); margin-top: 4px; font-size: .87rem; }
.brand-dot { color: #ab94ff; }
.brand-mark, .profile, .avatar, .tile-icon { display: grid; place-items: center; flex: none; }
.brand-mark {
  width: 43px; height: 43px; border-radius: 14px;
  background: linear-gradient(145deg, #8e70ff, #5844d6);
  box-shadow: 0 5px 20px #7658ff45;
}
.profile { width: 43px; height: 43px; border-radius: 50%; background: #29254b; color: #d5caff; border: 1px solid #493c73; font-size: .85rem; font-weight: 750; }
.welcome, .page-heading { margin-block: 25px 19px; }
.period { color: #bcafff; font-size: .83rem; display: flex; gap: 7px; align-items: center; margin-bottom: 9px; font-weight: 650; }
.period svg { width: 16px; height: 16px; }
h1 { font-size: clamp(2rem, 5vw, 2.95rem); line-height: 1.05; letter-spacing: -.06em; font-weight: 760; }
.page-heading p { margin-top: 10px; color: var(--muted); line-height: 1.45; }
.hero {
  position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center;
  min-height: 159px; border-radius: 24px; padding: 22px;
  border: 1px solid #a68eff75;
  background: radial-gradient(ellipse at 100% 0%, #9975ff, transparent 63%), linear-gradient(112deg, #3e2c9d, #6546dc);
  box-shadow: 0 10px 30px #37217935;
}
.hero-content { position: relative; z-index: 1; }
.hero-content p { display: flex; align-items: center; gap: 8px; color: #f0e9ff; font-size: .95rem; font-weight: 650; }
.hero-content p svg { width: 19px; height: 19px; }
.hero strong { display: block; font-size: clamp(2rem, 8vw, 3.5rem); line-height: 1.05; letter-spacing: -.06em; margin-block: 9px 5px; }
.hero-content > span { color: #efe8ff; font-size: .9rem; }
.chart { display: flex; align-items: end; justify-content: flex-end; gap: clamp(5px, 1.4vw, 14px); position: absolute; inset: 18px 18px 0 51%; z-index: 0; }
.chart i { height: var(--bar); width: min(11%, 42px); border-radius: 8px 8px 0 0; background: linear-gradient(#dbcaff8c, #bca2ff26); border: 1px solid #e7daff3d; border-bottom: 0; }
.chart i:last-child { background: linear-gradient(#f1e7ff, #c5acff55); }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-top: 11px; }
.metric, .panel, .quick button { border: 1px solid var(--border); background: var(--surface); }
.metric { display: flex; align-items: center; gap: 11px; min-height: 83px; padding: 12px; border-radius: 20px; }
.metric p { color: var(--muted); font-size: .875rem; line-height: 1.25; }
.metric strong { display: block; margin-top: 4px; font-size: clamp(1.32rem, 5vw, 1.7rem); line-height: 1; letter-spacing: -.04em; }
.tile-icon, .avatar { width: 40px; height: 40px; border-radius: 13px; }
.tile-icon svg { width: 20px; height: 20px; }
.avatar { font-size: .83rem; font-weight: 750; }
.violet { color: #d0bdff; background: #312654; }
.mint { color: #85e9cf; background: #173c40; }
.peach { color: #ffd096; background: #42312e; }
.blue { color: #a5c3ff; background: #243858; }
.section { margin-top: 23px; min-width: 0; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; }
.section-title h2 { font-size: 1.23rem; letter-spacing: -.035em; }
.panel { border-radius: 20px; overflow: hidden; }
.row {
  width: 100%; display: flex; align-items: center; gap: 11px;
  padding: 13px 12px; min-height: 69px; text-align: left; background: transparent; border: 0;
}
.row + .row { border-top: 1px solid #27314a; }
.row:focus-visible { outline-offset: -3px; }
.row-copy { display: grid; min-width: 0; flex: 1; gap: 4px; }
.row-copy strong { line-height: 1.15; font-size: .96rem; }
.row-copy small, .lesson-time small, .chat-meta small { color: var(--muted); font-size: .84rem; line-height: 1.25; }
.lesson-time { flex: 0 0 58px; display: grid; gap: 4px; font-variant-numeric: tabular-nums; }
.lesson-time strong { color: #d9caff; font-size: 1rem; }
.duration { display: flex; align-items: center; gap: 4px; flex: none; color: var(--muted); font-size: .82rem; }
.duration svg { width: 14px; height: 14px; }
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.quick button { min-height: 86px; border-radius: 17px; display: grid; align-content: center; justify-items: start; gap: 8px; padding: 10px; text-align: left; font-size: .86rem; font-weight: 650; }
.status { border-radius: 12px; padding: 6px 8px; font-size: .84rem; font-weight: 650; text-align: center; max-width: 44%; }
.amount { white-space: nowrap; }
.payout { min-height: 130px; }
.chat-meta { display: grid; justify-items: end; gap: 5px; }
.chat-row .row-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread { display: grid; place-items: center; min-width: 22px; min-height: 22px; padding-inline: 4px; border-radius: 11px; background: #b6a0ff; color: #201340; font-size: .8rem; font-weight: 800; }
.navigation {
  position: fixed; z-index: 2; bottom: 0; left: 0; right: 0;
  border-top: 1px solid #303957; background: #101629f5;
  padding: 5px max(4px, var(--right)) calc(5px + var(--bottom)) max(4px, var(--left));
  backdrop-filter: blur(15px);
}
.nav-inner { width: min(100%, 600px); margin-inline: auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
.nav-item { min-width: 0; min-height: 59px; background: transparent; border: 0; border-radius: 13px; color: #adb6ce; display: grid; align-content: center; justify-items: center; gap: 4px; padding: 4px 1px; font-size: clamp(.75rem, 2.9vw, .88rem); }
.nav-icon { position: relative; display: grid; place-items: center; border-radius: 12px; width: 44px; height: 29px; }
.nav-icon i { position: absolute; right: 7px; top: 3px; width: 8px; height: 8px; border: 1px solid #101629; border-radius: 50%; background: #bc9fff; }
.nav-item[aria-current] { color: #d4c4ff; font-weight: 750; }
.nav-item[aria-current] .nav-icon { background: #322656; }
dialog { color: inherit; width: min(94%, 490px); padding: 20px; border: 1px solid var(--border); border-radius: 23px; background: #171e34; max-height: 80dvh; }
dialog::backdrop { background: #060910b8; backdrop-filter: blur(3px); }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.dialog-header h2 { font-size: 1.35rem; }
.icon-button { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--border); background: #202943; font-size: 1.6rem; }
.settings-button { display: grid; place-items: center; color: var(--muted); }
.theme-options { margin: 0; padding: 11px 0 0; border: 0; min-inline-size: 0; display: grid; gap: 8px; }
.theme-options legend { padding: 0; color: var(--muted); font-size: .9rem; }
.theme-option {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 13px; background: var(--surface); cursor: pointer;
}
.theme-option input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.theme-option:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.student-detail { display: flex; align-items: center; gap: 10px; margin-bottom: 17px; }
.student-detail .status { display: inline-block; max-width: none; margin-top: 6px; }
.muted, .detail-lessons { color: var(--muted); line-height: 1.5; }
#detail-content h3 { font-size: 1rem; margin-bottom: 6px; }
.detail-lessons { padding-left: 20px; margin: 0; }
.bubbles { display: grid; gap: 8px; margin-block: 14px; }
.bubbles p { border-radius: 4px 16px 16px; background: #2c2850; padding: 10px 13px; width: fit-content; }
.chat-note { font-size: .875rem; }
.action {
  display: inline-flex; align-items: center; justify-content: center; width: fit-content; max-width: 100%;
  min-height: 44px; padding: 8px 11px; border: 1px solid var(--border); border-radius: 13px;
  background: #202943; color: #f4f5ff; text-decoration: none; text-align: center; font-size: .875rem; font-weight: 650;
}
.action.primary { color: #201340; background: var(--accent); border-color: transparent; }
.action.compact { margin-top: 4px; text-align: left; }
.detail-action { margin-top: 14px; }
.detail-form { display: grid; gap: 12px; }
.form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.detail-form label, .composer label { display: grid; gap: 5px; color: var(--muted); font-size: .875rem; }
.detail-form :is(input, select), .composer textarea {
  min-height: 44px; min-width: 0; width: 100%; padding: 8px; border-radius: 12px;
  border: 1px solid var(--border); background: #131b30; color: inherit; font: inherit; font-size: 1rem;
}
.composer textarea { color: #f4f5ff; resize: vertical; }
.panel-note, .conversation { padding: 13px; }
.conversation-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-note .conversation-actions { margin: 12px 0 0; }
.composer { display: grid; gap: 7px; padding-top: 12px; border-top: 1px solid var(--border); }
.composer button { justify-self: end; }
.transcript { max-height: 42dvh; min-height: 100px; overflow-y: auto; align-content: start; }
.bubble-line { display: grid; justify-items: start; gap: 4px; max-width: 88%; overflow-wrap: anywhere; }
.bubble-line p { white-space: pre-wrap; }
.bubble-line small { color: var(--muted); font-size: .8rem; }
.bubble-line.mine { justify-self: end; justify-items: end; }
.bubble-line.mine p { border-radius: 16px 4px 16px 16px; background: #243858; }
@media (hover: hover) {
  button.row:hover, .quick button:hover, .nav-item:hover { background: #202943; }
}
@media (min-width: 680px) {
  .shell { padding-inline: max(26px, var(--left)) max(26px, var(--right)); }
  .brandbar { padding-block: 9px 17px; }
  .hero { min-height: 178px; padding-inline: 26px; }
  .chart { inset-inline-start: 52%; inset-inline-end: 28px; }
  .metric { padding-inline: 17px; }
  .dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; }
  .quick { grid-template-columns: 1fr; gap: 0; border: 1px solid var(--border); border-radius: 20px; overflow: hidden; }
  .quick button { grid-template-columns: auto 1fr; align-items: center; border-radius: 0; border: 0; min-height: 69px; gap: 11px; padding: 12px; font-size: .95rem; }
  .quick button + button { border-top: 1px solid var(--border); }
}
@media (max-width: 370px) {
  .metric { align-items: flex-start; flex-direction: column; gap: 6px; }
  .metric .tile-icon { width: 32px; height: 32px; }
  .lesson .avatar { display: none; }
  .row { gap: 8px; }
}

:root[data-theme="light"] {
  color-scheme: light;
  background: #f8f7fc;
  color: #231c36;
  --muted: #594f6b;
  --surface: #ffffff;
  --border: #ddd6e9;
  --accent: #6036a1;
}

[data-theme="light"] body { background: radial-gradient(ellipse at 48% -10%, #eee7fb 0, transparent 52%); }
[data-theme="light"] button:focus-visible { outline-color: var(--accent); }
[data-theme="light"] .brandbar, [data-theme="light"] .row + .row,
[data-theme="light"] .quick button + button { border-color: var(--border); }
[data-theme="light"] .brand-mark { color: white; background: linear-gradient(145deg, #7853d4, #5844b5); }
[data-theme="light"] .brand-dot, [data-theme="light"] .period,
[data-theme="light"] .lesson-time strong { color: var(--accent); }
[data-theme="light"] .profile { background: #eee6fa; color: #563484; border-color: #d8c6f0; }
[data-theme="light"] .hero {
  color: #35204f;
  border-color: #d5c4f0;
  background: linear-gradient(112deg, #ffffff, #eee5ff);
  box-shadow: 0 10px 30px #44277416;
}
[data-theme="light"] .hero-content :is(p, span) { color: #57377c; }
[data-theme="light"] .chart i { background: linear-gradient(#b896ee, #e0cef9); border-color: #b091da; }
[data-theme="light"] .chart i:last-child { background: linear-gradient(#8051c4, #c5a8f0); }
[data-theme="light"] .violet { color: #573281; background: #eee4fb; }
[data-theme="light"] .mint { color: #135649; background: #def5ed; }
[data-theme="light"] .peach { color: #763d14; background: #ffeedb; }
[data-theme="light"] .blue { color: #234881; background: #e4edff; }
[data-theme="light"] .unread { background: #6036a1; color: #ffffff; }
[data-theme="light"] .navigation { border-color: var(--border); background: #fffffff5; }
[data-theme="light"] .nav-item { color: #584b6c; }
[data-theme="light"] .nav-item[aria-current] { color: #532d91; }
[data-theme="light"] .nav-item[aria-current] .nav-icon { background: #eee4fb; }
[data-theme="light"] .nav-icon i { background: #6036a1; border-color: #ffffff; }
[data-theme="light"] dialog { background: var(--surface); }
[data-theme="light"] dialog::backdrop { background: #22173573; }
[data-theme="light"] :is(.icon-button, .action) { background: #f2ebfc; color: #4f2a85; }
[data-theme="light"] .action.primary { color: #ffffff; background: var(--accent); }
[data-theme="light"] :is(.detail-form input, .detail-form select, .composer textarea) {
  background: var(--surface); color: #231c36; border-color: #998daa;
}
[data-theme="light"] .composer textarea::placeholder { color: var(--muted); }
[data-theme="light"] .bubbles p { background: #f1e8fb; }
[data-theme="light"] .bubble-line.mine p { background: #e5edff; }
[data-theme="light"] .theme-option:has(input:checked) { border-color: var(--accent); }
@media (hover: hover) {
  [data-theme="light"] :is(button.row, .quick button, .nav-item):hover { background: #f2ebfc; }
}
