:root {
  --hour-height: 58px;
  --visible-hours: 24;
  --radius: 8px;
  --shadow: 0 18px 45px rgba(28, 38, 42, 0.1);
  --app-side-column-width: 340px;
  --student-card-color-width: clamp(28px, 12%, 56px);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

dialog:not([open]) {
  display: none;
}

body.is-auth-checking,
body.is-redirecting-to-auth {
  min-height: 100vh;
  overflow: hidden;
}

body.is-auth-checking .app-shell,
body.is-auth-checking .mobile-tabbar,
body.is-redirecting-to-auth .app-shell,
body.is-redirecting-to-auth .mobile-tabbar,
body.is-redirecting-to-auth dialog {
  display: none !important;
}

body {
  --bg: #f7f7f2;
  --surface: #ffffff;
  --surface-strong: #eef7f5;
  --ink: #202225;
  --muted: #707070;
  --line: #dedfd8;
  --accent: #116a73;
  --accent-ink: #ffffff;
  --accent-soft: #d8f1ef;
  --accent-two: #ef9f62;
  --accent-three: #ba5d73;
  --paid: #217a57;
  --unpaid: #b55641;
  --icon-filter: brightness(0) saturate(100%) invert(14%) sepia(8%) saturate(497%) hue-rotate(174deg) brightness(94%) contrast(91%);
  --active-icon-filter: var(--icon-filter);
  --calendar-view-active-bg: var(--accent);
  --calendar-view-active-border: color-mix(in srgb, var(--accent) 72%, #000000);
  --calendar-view-active-ink: var(--accent-ink);
  --calendar-view-active-icon-filter: var(--active-icon-filter);
  --calendar-view-active-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 24%, transparent);
  --student-card-background: var(--surface-strong);
  --student-card-hover-background: var(--accent-soft);
  --student-card-border: var(--line);
  --student-card-hover-shadow: 0 10px 22px rgba(25, 32, 34, 0.14);
  --group-card-background: color-mix(in srgb, var(--student-card-background) 90%, #ffffff);
  --group-card-hover-background: color-mix(in srgb, var(--accent) 18%, var(--group-card-background));
}

body[data-theme="sky"] {
  --bg: #f4f8fb;
  --surface: #ffffff;
  --surface-strong: #edf5fb;
  --ink: #1f2a33;
  --muted: #657482;
  --line: #d7e2ea;
  --accent: #2f6f9f;
  --accent-ink: #ffffff;
  --accent-soft: #dbeef9;
  --accent-two: #dd9a64;
  --accent-three: #9d5d7d;
  --paid: #27745a;
  --unpaid: #b45c4f;
}

body[data-theme="mist"] {
  --bg: #f5f8fa;
  --surface: #ffffff;
  --surface-strong: #eef3f5;
  --ink: #20262b;
  --muted: #68747d;
  --line: #d9e0e5;
  --accent: #7f96a7;
  --accent-ink: #ffffff;
  --accent-soft: #e0e9ef;
  --accent-two: #b17d6c;
  --accent-three: #6f8a8c;
  --paid: #31775c;
  --unpaid: #af554c;
}

body[data-theme="aqua"] {
  --bg: #f2fbfb;
  --surface: #ffffff;
  --surface-strong: #e8f7f8;
  --ink: #1e2b2e;
  --muted: #63777b;
  --line: #d0e5e7;
  --accent: #3d8f9c;
  --accent-ink: #ffffff;
  --accent-soft: #d6f1f3;
  --accent-two: #d89962;
  --accent-three: #8e668a;
  --paid: #28775d;
  --unpaid: #b45c4f;
}

body[data-theme="teal"] {
  --bg: #f2faf8;
  --surface: #ffffff;
  --surface-strong: #e7f5f2;
  --ink: #1d2a2a;
  --muted: #647674;
  --line: #cfe2df;
  --accent: #2d8c89;
  --accent-ink: #ffffff;
  --accent-soft: #d4efec;
  --accent-two: #d89a5d;
  --accent-three: #905f79;
  --paid: #27745a;
  --unpaid: #b45c4f;
}

body[data-theme="rose"] {
  --bg: #fbf6f8;
  --surface: #ffffff;
  --surface-strong: #f6edf1;
  --ink: #2d2327;
  --muted: #786a70;
  --line: #ead8df;
  --accent: #9d526b;
  --accent-ink: #ffffff;
  --accent-soft: #f4dce6;
  --accent-two: #c38355;
  --accent-three: #6f7f4e;
  --paid: #2f7656;
  --unpaid: #ad554b;
}

body[data-theme="blush"] {
  --bg: #fbf6f5;
  --surface: #ffffff;
  --surface-strong: #f7eeeb;
  --ink: #2d2523;
  --muted: #786d68;
  --line: #eadbd7;
  --accent: #b76559;
  --accent-ink: #ffffff;
  --accent-soft: #f2ded9;
  --accent-two: #5d8b82;
  --accent-three: #8a638f;
  --paid: #2f7656;
  --unpaid: #ad554b;
}

body[data-theme="berry"] {
  --bg: #fbf5f8;
  --surface: #ffffff;
  --surface-strong: #f7edf3;
  --ink: #2e2229;
  --muted: #7b6972;
  --line: #ead7e2;
  --accent: #b94777;
  --accent-ink: #ffffff;
  --accent-soft: #f2d8e6;
  --accent-two: #557e7c;
  --accent-three: #d49359;
  --paid: #2f7656;
  --unpaid: #ad554b;
}

body[data-theme="amber"] {
  --bg: #f8f6ef;
  --surface: #ffffff;
  --surface-strong: #f1ead9;
  --ink: #292620;
  --muted: #746f64;
  --line: #e4dcc8;
  --accent: #7a6532;
  --accent-ink: #ffffff;
  --accent-soft: #eee1ba;
  --accent-two: #3d7c79;
  --accent-three: #9a5966;
  --paid: #2d7355;
  --unpaid: #a95d3d;
}

body[data-theme="graphite"] {
  --bg: #f4f5f5;
  --surface: #ffffff;
  --surface-strong: #ebeeee;
  --ink: #23282b;
  --muted: #697173;
  --line: #d8dddd;
  --accent: #4f5a60;
  --accent-ink: #ffffff;
  --accent-soft: #e1e6e7;
  --accent-two: #be8a54;
  --accent-three: #7a6b96;
  --paid: #31775c;
  --unpaid: #a85d4f;
}

body[data-theme="navy"] {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-strong: #e9eff6;
  --ink: #202a35;
  --muted: #687483;
  --line: #d5dde7;
  --accent: #38577b;
  --accent-ink: #ffffff;
  --accent-soft: #dce8f5;
  --accent-two: #d5975d;
  --accent-three: #8b637e;
  --paid: #2e7659;
  --unpaid: #b45c4f;
}

body[data-theme="ocean"] {
  --bg: #f2f7fb;
  --surface: #ffffff;
  --surface-strong: #e8f1f9;
  --ink: #1e2933;
  --muted: #657382;
  --line: #d2dfeb;
  --accent: #1f639b;
  --accent-ink: #ffffff;
  --accent-soft: #d9ebf9;
  --accent-two: #d49a5d;
  --accent-three: #7d6aa0;
  --paid: #27745a;
  --unpaid: #b45c4f;
}

body[data-theme="violet"] {
  --bg: #f7f5fb;
  --surface: #ffffff;
  --surface-strong: #eeeaf7;
  --ink: #282433;
  --muted: #706a7e;
  --line: #ded7ea;
  --accent: #704bb0;
  --accent-ink: #ffffff;
  --accent-soft: #e6dcf4;
  --accent-two: #c18a55;
  --accent-three: #5b8582;
  --paid: #31775c;
  --unpaid: #ad554b;
}

body[data-theme="ruby"] {
  --bg: #fbf5f5;
  --surface: #ffffff;
  --surface-strong: #f6ebeb;
  --ink: #302323;
  --muted: #796b6b;
  --line: #ead7d7;
  --accent: #ae2f39;
  --accent-ink: #ffffff;
  --accent-soft: #f2d8da;
  --accent-two: #3f8279;
  --accent-three: #987044;
  --paid: #2f7656;
  --unpaid: #a92f39;
}

body[data-theme="forest"] {
  --bg: #f4f8f3;
  --surface: #ffffff;
  --surface-strong: #eaf3e8;
  --ink: #232c23;
  --muted: #697766;
  --line: #d7e3d4;
  --accent: #2f7a46;
  --accent-ink: #ffffff;
  --accent-soft: #ddefdf;
  --accent-two: #d19a58;
  --accent-three: #7568a0;
  --paid: #2f7656;
  --unpaid: #ad554b;
}

body[data-theme="dark"] {
  --bg: #111416;
  --surface: #1a1f22;
  --surface-strong: #22292c;
  --ink: #edf1ef;
  --muted: #a8b1ad;
  --line: #334044;
  --accent: #6db7b8;
  --accent-ink: #102124;
  --accent-soft: #263f42;
  --accent-two: #e2a86f;
  --accent-three: #d37b92;
  --paid: #65c38f;
  --unpaid: #df7f69;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.38);
  --icon-filter: brightness(0) invert(92%) sepia(9%) saturate(180%) hue-rotate(145deg) brightness(101%) contrast(91%);
  --active-icon-filter: var(--icon-filter);
  --calendar-view-active-bg: #f7faf9;
  --calendar-view-active-border: #d9e2df;
  --calendar-view-active-ink: #182023;
  --calendar-view-active-icon-filter: brightness(0) saturate(100%) invert(10%) sepia(8%) saturate(596%) hue-rotate(152deg) brightness(95%) contrast(91%);
  --calendar-view-active-shadow: 0 2px 10px rgba(0, 0, 0, 0.24);
  --student-card-hover-shadow: 0 12px 26px rgba(0, 0, 0, 0.34);
  color-scheme: dark;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, var(--app-side-column-width)) minmax(720px, 1fr) minmax(280px, var(--app-side-column-width));
  gap: 18px;
  min-height: 100vh;
  width: min(1760px, calc(100vw - clamp(32px, 4vw, 88px)));
  max-width: none;
  margin: 0 auto;
  padding: 14px;
}

.desktop-side-column {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.sidebar,
.workspace,
.app-right-panel,
.panel,
.lesson-dialog,
.student-dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  min-width: 0;
}

.workspace {
  display: grid;
  position: relative;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: calc(100vh - 28px);
  overflow: hidden;
}

.app-right-panel {
  --right-panel-chrome-height: 68px;
  display: none;
  grid-template-rows: minmax(0, 1fr);
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
  min-height: calc(100vh - 28px);
  max-height: calc(100vh - 28px);
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, var(--bg));
  box-shadow: 0 16px 42px rgba(32, 40, 40, 0.08);
}

body.has-right-panel .app-right-panel:not([hidden]) {
  display: grid;
}

.right-panel-empty[hidden],
.right-panel-body[hidden] {
  display: none !important;
}

.right-panel-empty {
  display: grid;
  align-content: start;
  min-width: 0;
  min-height: 0;
  padding: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.right-panel-empty-card {
  display: grid;
  align-content: start;
  gap: 14px;
  width: 100%;
  margin: 0;
  padding: 0;
}

.right-panel-empty-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.18;
}

.right-panel-empty-actions {
  display: grid;
  gap: 8px;
  margin: 0;
}

.right-panel-empty-actions .secondary-button {
  justify-content: center;
  width: 100%;
  min-height: 42px;
}

.right-panel-body {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.form-panel-body {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.app-right-panel .lesson-dialog,
.app-right-panel .student-dialog {
  position: static;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.lesson-dialog.is-right-panel-docked::backdrop,
.student-dialog.is-right-panel-docked::backdrop {
  display: none;
}

body.is-settings-screen .workspace {
  display: none;
}

body.is-settings-screen #settingsDialog,
body.is-settings-screen #settingsDialog:not([open]) {
  position: static;
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: visible;
  transform: none;
}

body.is-settings-screen #settingsDialog::backdrop {
  display: none;
}

body.is-settings-screen #settingsDialog .student-profile-form {
  max-height: calc(100vh - 28px);
  overflow-y: auto;
}

.brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 38px;
  align-items: center;
  gap: clamp(7px, 0.85vw, 12px);
  padding: 4px 2px 8px;
}

.brand-copy {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.account-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.account-strip[hidden] {
  display: none;
}

.account-strip span {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-account-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.settings-account-panel .section-head span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-verification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 5px 7px 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--unpaid) 9%, var(--surface));
}

.email-verification-row[hidden] {
  display: none;
}

.email-verification-row span {
  min-width: 0;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-verification-row span.is-verified {
  color: var(--paid);
}

.email-verification-row span.is-unverified {
  color: var(--unpaid);
}

.email-verification-row:has(span.is-verified) {
  background: color-mix(in srgb, var(--paid) 9%, var(--surface));
}

.email-verification-row .text-button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.email-verification-row .text-button[hidden] {
  display: none;
}

.logout-settings-button {
  width: 100%;
}

.admin-settings-button {
  width: 100%;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.2fr);
  gap: 12px;
}

.admin-user-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 10px;
  width: 100%;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.admin-user-card span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-user-card strong,
.admin-user-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.role-pill {
  align-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.role-admin {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--accent);
}

.role-manager {
  background: color-mix(in srgb, var(--accent-two) 16%, var(--surface));
  color: var(--accent-two);
}

.admin-user-summary,
.admin-data-section {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-data-section h4 {
  margin: 0;
  font-size: 13px;
}

.admin-lesson-row {
  display: grid;
  gap: 2px;
  padding: 8px;
  border-radius: 10px;
  background: var(--surface-strong);
}

.admin-lesson-row span,
.admin-user-summary span,
.admin-user-summary small {
  color: var(--muted);
  font-size: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  color: var(--accent);
}

.brand-logo {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.app-icon {
  display: block;
  width: 24px;
  height: 24px;
  background-color: currentColor;
  color: currentColor;
  -webkit-mask-image: var(--icon-url);
  -webkit-mask-mode: alpha;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-image: var(--icon-url);
  mask-mode: alpha;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
}

.control-icon {
  position: relative;
  display: block;
  flex: 0 0 auto;
  color: currentColor;
  pointer-events: none;
}

.control-icon-close {
  width: 14px;
  height: 14px;
}

.control-icon-close::before,
.control-icon-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.control-icon-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.control-icon-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.control-icon-chevron {
  width: 10px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.control-icon-chevron.is-left {
  transform: translateX(1px) rotate(-135deg);
}

.control-icon-chevron.is-right {
  transform: translateX(-1px) rotate(45deg);
}

.control-icon-chevron.is-down {
  transform: translateY(-1px) rotate(135deg);
}

.control-icon-settings {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  font-family: "Segoe UI Symbol", "Segoe UI", sans-serif;
  font-size: 19px;
  line-height: 1;
}

.icon-view-day {
  --icon-url: url("/assets/icons/view-day.svg?v=4");
}

.icon-view-week {
  --icon-url: url("/assets/icons/view-week.svg?v=4");
}

.icon-view-month {
  --icon-url: url("/assets/icons/view-month.svg?v=4");
}

.icon-calendar {
  --icon-url: url("/assets/icons/calendar.svg?v=4");
}

.icon-students {
  --icon-url: url("/assets/icons/students.svg?v=4");
}

.icon-finances {
  --icon-url: url("/assets/icons/finances.svg?v=4");
}

.icon-profile {
  --icon-url: url("/assets/icons/profile.svg?v=4");
}

.icon-delete {
  --icon-url: url("data:image/svg+xml,%3Csvg width='64' height='64' viewBox='0 0 64 64' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18 20h28l-2 32c0 4-3 7-7 7H27c-4 0-7-3-7-7L18 20Z' fill='none' stroke='white' stroke-width='5' stroke-linejoin='round'/%3E%3Cpath d='M13 20h38M25 20v-5c0-3 2-5 5-5h4c3 0 5 2 5 5v5' fill='none' stroke='white' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M28 31v17M36 31v17' stroke='white' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E");
}

.icon-archive {
  --icon-url: url("data:image/svg+xml,%3Csvg width='64' height='64' viewBox='0 0 64 64' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 18h40v35c0 4-3 7-7 7H19c-4 0-7-3-7-7V18Z' fill='none' stroke='white' stroke-width='5' stroke-linejoin='round'/%3E%3Cpath d='M9 8h46v10H9V8Z' fill='none' stroke='white' stroke-width='5' stroke-linejoin='round'/%3E%3Cpath d='M24 34h16M32 29v18M24 39l8 8 8-8' fill='none' stroke='white' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.brand h1,
.dialog-head h2,
.section-head h2 {
  margin: 0;
}

.brand h1 {
  max-width: 100%;
  overflow: hidden;
  font-size: clamp(16px, 1.45vw, 22px);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.brand .eyebrow {
  display: none;
}

.panel {
  padding: 14px;
}

@media (min-width: 981px) {
  body[data-desktop-layout="custom"] .app-shell {
    display: grid;
    grid-template-columns: minmax(250px, var(--app-side-column-width)) minmax(760px, 1fr) minmax(250px, var(--app-side-column-width));
    gap: 18px;
    align-items: start;
  }

  body[data-desktop-layout="custom"] .desktop-side-left {
    grid-column: 1;
    grid-row: 1;
  }

  body[data-desktop-layout="custom"] .workspace {
    grid-column: 2;
    grid-row: 1;
  }

  body[data-desktop-layout="custom"] .desktop-side-right {
    grid-column: 3;
    grid-row: 1;
  }

  body[data-desktop-layout="custom"] .desktop-side-column {
    height: calc(100vh - 28px);
    min-height: 0;
    max-height: calc(100vh - 28px);
  }

  body.has-right-panel[data-desktop-layout="custom"] .desktop-side-column.has-right-panel-block {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: calc(100vh - 28px);
    max-height: calc(100vh - 28px);
    overflow: hidden;
  }

  body.has-right-panel[data-desktop-layout="custom"] .desktop-side-column.has-right-panel-block .app-right-panel {
    flex: 1 1 0;
    display: grid;
    grid-column: auto;
    grid-row: auto;
    width: 100%;
    min-height: 0;
    max-height: 100%;
  }

  body.has-right-panel[data-desktop-layout="custom"] .desktop-side-column.has-right-panel-block .students-panel.has-custom-layout-height,
  body.has-right-panel[data-desktop-layout="custom"] .desktop-side-column.has-right-panel-block .app-right-panel.has-custom-layout-height {
    flex: 0 0 auto;
  }

  body[data-desktop-layout="custom"] .students-panel,
  body[data-desktop-layout="custom"] .stats-panel,
  body[data-desktop-layout="custom"] .workspace {
    min-width: 0;
  }

  body[data-desktop-layout="custom"] .workspace {
    min-height: calc(100vh - 28px);
  }
}

.section-head,
.topbar,
.dialog-head,
.dialog-actions,
.dialog-main-actions,
.date-controls,
.toolbar,
.calendar-controls {
  display: flex;
  align-items: center;
}

.section-head,
.dialog-head {
  justify-content: space-between;
  gap: 12px;
}

.dialog-actions {
  justify-content: flex-end;
  gap: 10px;
}

.dialog-actions,
.dialog-main-actions {
  align-items: center;
}

.section-head h2 {
  font-size: 15px;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segment,
.today-button,
.primary-button,
.secondary-button,
.danger-button,
.chip-button,
.text-button,
.icon-button {
  border: 0;
  border-radius: var(--radius);
  min-height: 38px;
}

.today-button,
.primary-button,
.secondary-button,
.danger-button,
.chip-button,
.text-button,
.subject-chip,
.paid-toggle,
.finance-chart-range,
.finance-chart-mode-toggle button,
.scope-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.2;
  text-align: center;
  vertical-align: middle;
}

.segment {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.view-option {
  flex: 0 0 48px;
  width: 48px;
  padding: 0;
}

.view-icon {
  display: block;
  width: 25px;
  height: 25px;
  object-fit: contain;
  pointer-events: none;
}

.themed-icon {
  display: block;
  filter: var(--icon-filter);
  pointer-events: none;
}

.mobile-tab-icon .themed-icon,
.view-icon.themed-icon {
  object-fit: contain;
  opacity: 0.92;
}

.mobile-tab-icon .themed-icon {
  width: 22px;
  height: 22px;
}

.mobile-tab.is-active .themed-icon,
.segment.is-active .themed-icon {
  opacity: 1;
  filter: var(--active-icon-filter);
}

.segment.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 8px rgba(32, 38, 42, 0.08);
}

.view-option {
  border: 1px solid transparent;
}

.view-option.is-active {
  background: var(--calendar-view-active-bg);
  border-color: var(--calendar-view-active-border);
  color: var(--calendar-view-active-ink);
  box-shadow: var(--calendar-view-active-shadow);
}

.view-option.is-active .themed-icon {
  filter: var(--calendar-view-active-icon-filter);
}

.metrics {
  display: block;
  margin-top: 12px;
}

.summary-lines {
  display: grid;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.finance-summary-card .summary-lines {
  background: var(--surface);
}

.summary-line {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
}

.summary-line + .summary-line {
  border-top: 1px solid var(--line);
}

.summary-line-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-line-value {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.summary-line-value strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}

.summary-progress {
  height: 3px;
  margin: 5px -12px -12px;
  overflow: hidden;
  background: color-mix(in srgb, var(--line) 78%, transparent);
}

.summary-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 0 999px 999px 0;
  background: var(--accent);
}

.finance-open-button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 900;
}

.setting-line {
  margin-top: 12px;
}

.settings-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.pricing-inline,
.account-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.72fr);
  gap: 10px;
  align-items: end;
}

.date-format-setting {
  max-width: 280px;
}

.setting-control {
  display: grid;
  gap: 7px;
  margin-top: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.setting-control input,
.setting-control select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

select {
  appearance: none;
  background-image: none;
}

.price-input-wrap,
.subject-input-wrap,
.duration-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.duration-input-wrap {
  align-items: center;
}

.duration-input-wrap span {
  display: inline-grid;
  place-items: center;
  min-height: 42px;
  padding: 0 2px;
  color: color-mix(in srgb, var(--ink) 84%, var(--surface));
  font-weight: 900;
}

.price-input-wrap select {
  width: 58px;
  min-width: 58px;
  padding-inline: 6px;
  text-align: center;
}

.theme-choices {
  display: grid;
  gap: 10px;
}

.theme-choice-group {
  display: grid;
  gap: 7px;
}

.theme-choice-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.theme-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.theme-choice {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--ink) 22%, var(--line));
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(20, 26, 28, 0.12);
}

.theme-choice span {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--theme-choice-color);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 18%, transparent);
}

.theme-choice.is-active {
  border-color: color-mix(in srgb, var(--theme-choice-glow) 70%, var(--accent));
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--theme-choice-glow) 42%, transparent),
    0 0 22px color-mix(in srgb, var(--theme-choice-glow) 42%, transparent);
}

.theme-base-choice span {
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--ink) 24%, transparent),
    inset 0 0 0 999px color-mix(in srgb, var(--theme-choice-color) 100%, transparent);
}

input[type="number"] {
  appearance: textfield;
}

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

.subjects-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.subject-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.subject-chip-close {
  width: 10px;
  height: 10px;
  color: var(--muted);
}

.subject-chip-close::before,
.subject-chip-close::after {
  width: 12px;
  height: 1.5px;
}

.layout-editor-open {
  justify-content: center;
}

.settings-dialog .settings-form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  width: 100%;
  height: min(820px, calc(100vh - 28px));
  min-height: 560px;
  padding: 0;
  overflow: hidden;
}

body.is-settings-screen .desktop-side-column {
  display: none;
}

body.is-settings-screen #settingsDialog,
body.is-settings-screen #settingsDialog:not([open]) {
  grid-column: 2 !important;
  width: 100%;
  height: calc(100vh - 28px);
  overflow: hidden;
}

body.is-settings-screen #settingsDialog .student-profile-form {
  max-height: none;
  overflow: hidden;
}

@media (min-width: 761px) {
  body.is-settings-screen #settingsDialog .settings-form,
  body.is-settings-screen #settingsDialog .settings-layout,
  body.is-settings-screen #settingsDialog .settings-sidebar,
  body.is-settings-screen #settingsDialog .settings-content-scroll {
    height: 100%;
    min-height: 0;
  }
}

.settings-dialog-head {
  min-height: 68px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.settings-mobile-home {
  display: none;
}

.settings-title-shell {
  min-width: 0;
}

.settings-title-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: auto;
  min-height: 0;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1.2;
  text-align: left;
}

.settings-title-button:not(:disabled) {
  cursor: pointer;
}

.settings-title-button:disabled {
  cursor: default;
  opacity: 1;
}

.settings-title-back-icon {
  display: none;
}

.settings-title-text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 0;
}

.settings-sidebar {
  min-width: 0;
  padding: 18px 12px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 72%, var(--surface));
}

.settings-nav {
  display: grid;
  gap: 4px;
}

.settings-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 0 14px 0 18px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.settings-nav-item::before {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: transparent;
}

.settings-nav-item:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--ink);
}

.settings-nav-item.is-active {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
  font-weight: 900;
}

.settings-nav-item.is-active::before {
  background: var(--accent);
}

.settings-content-scroll {
  min-width: 0;
  min-height: 0;
  padding: 24px clamp(22px, 4vw, 46px) 34px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.settings-section {
  display: grid;
  align-content: start;
  gap: 14px;
  width: min(100%, 780px);
  margin: 0 auto;
  animation: settings-section-in 0.18s ease both;
}

.settings-section[hidden],
.settings-mobile-home[hidden],
.settings-content-scroll[hidden] {
  display: none !important;
}

@keyframes settings-section-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-section-heading {
  display: grid;
  gap: 4px;
  padding-bottom: 6px;
}

.settings-section-heading h3,
.settings-group-title h4,
.settings-option-group legend {
  margin: 0;
  color: var(--ink);
}

.settings-section-heading h3 {
  font-size: 22px;
  line-height: 1.15;
}

.settings-section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.settings-group {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
}

.settings-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.settings-group-title h4,
.settings-option-group legend {
  padding: 0;
  font-size: 13px;
  font-weight: 900;
}

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

.settings-fields-grid.finance-defaults-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.finance-default-setting {
  min-width: 0;
}

.settings-suffixed-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.settings-suffixed-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 13%, transparent);
}

.setting-control .settings-suffixed-control input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 4px 8px 11px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.setting-control .settings-suffixed-control input:focus {
  outline: 0;
  box-shadow: none;
}

.settings-input-suffix {
  padding: 0 11px 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.duration-combobox .settings-input-suffix {
  min-width: 30px;
}

.settings-action-group {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.settings-action-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.settings-action-copy strong {
  color: var(--ink);
  font-size: 13px;
}

.settings-action-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.settings-action-group .secondary-button,
.settings-action-group .danger-button {
  min-height: 38px;
  padding-inline: 12px;
  font-size: 12px;
  white-space: nowrap;
}

.session-management-group {
  gap: 10px;
}

.current-session-summary,
.active-sessions-list {
  display: grid;
  gap: 8px;
}

.session-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.session-item.is-current {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.session-item-copy,
.session-item-title,
.session-item-meta {
  min-width: 0;
}

.session-item-copy {
  display: grid;
  gap: 5px;
}

.session-item-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.session-item-title strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
}

.current-session-marker {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.session-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.session-expand-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.session-expand-button:hover {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.active-sessions-panel {
  display: grid;
  gap: 10px;
}

.active-sessions-panel[hidden] {
  display: none;
}

.session-remove-button {
  min-height: 34px;
  padding-inline: 9px;
  color: var(--unpaid);
  font-size: 11px;
}

.session-bulk-actions,
.session-current-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.session-bulk-actions .secondary-button,
.session-current-actions .secondary-button {
  min-height: 38px;
  padding-inline: 12px;
  font-size: 12px;
}

.session-management-message {
  margin: 0;
}

.session-empty-state {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 11px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.settings-danger-group {
  margin-top: 8px;
  border-color: color-mix(in srgb, var(--unpaid) 42%, var(--line));
  background: color-mix(in srgb, var(--unpaid) 7%, var(--surface-strong));
}

.settings-danger-group .settings-action-copy strong {
  color: var(--unpaid);
}

.settings-danger-group .danger-button {
  background: color-mix(in srgb, var(--unpaid) 12%, var(--surface));
  color: var(--unpaid);
  border-color: color-mix(in srgb, var(--unpaid) 42%, var(--line));
  font-weight: 800;
}

.settings-danger-group .danger-button:hover {
  background: color-mix(in srgb, var(--unpaid) 20%, var(--surface));
  border-color: color-mix(in srgb, var(--unpaid) 60%, var(--line));
}

.account-only-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.theme-base-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.theme-mode-choice {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.theme-mode-choice > span {
  width: 24px;
  height: 24px;
  border: 1px solid color-mix(in srgb, var(--ink) 24%, var(--line));
  border-radius: 999px;
  background: var(--theme-choice-color);
}

.theme-mode-choice strong {
  font-size: 12px;
}

.theme-mode-choice.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 13%, transparent);
}

.settings-option-group {
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.compact-select-setting {
  padding-block: 12px;
}

.compact-select-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(220px, 300px);
  align-items: center;
  gap: 14px;
}

.compact-select-row strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.compact-select-row select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding-block: 0;
  font-size: 12px;
}

.settings-option-group legend {
  width: 100%;
  padding: 15px 15px 10px;
}

.settings-option-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 50px;
  padding: 9px 15px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
}

.settings-option-row:hover {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.settings-option-row input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.settings-option-row > span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.settings-option-row strong {
  font-size: 12px;
}

.settings-option-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.settings-group .email-verification-row {
  margin: 0;
}

.settings-group .subject-create-line {
  margin-top: 0;
}

.settings-dialog .admin-settings-button {
  min-height: 40px;
}

.account-name-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.layout-editor-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.layout-zone {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 190px;
  padding: 10px;
  border: 1px dashed color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.layout-zone.is-drop-target {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.layout-zone h3 {
  margin: 0;
  font-size: 13px;
}

.layout-zone-items {
  display: grid;
  gap: 8px;
}

.layout-module {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 900;
  cursor: grab;
}

.layout-module.is-dragging {
  position: fixed;
  left: -9999px;
  top: -9999px;
  z-index: -1;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.layout-module b {
  color: var(--muted);
  font-size: 15px;
}

.layout-drop-placeholder {
  display: grid;
  align-items: center;
  min-height: 44px;
  padding: 0 11px;
  border: 1px dashed color-mix(in srgb, var(--accent) 58%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 66%, transparent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  pointer-events: none;
  transition: background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.layout-drop-placeholder.is-source-placeholder,
.student-drop-placeholder.is-source-placeholder {
  margin: 0;
}

.layout-edit-toolbar[hidden],
.mobile-nav-editor[hidden] {
  display: none !important;
}

.layout-edit-toolbar {
  position: absolute;
  z-index: 1150;
  inset: 0 0 auto;
  width: 100%;
  pointer-events: none;
}

.layout-edit-toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 9px 12px 9px 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 18px 42px rgba(25, 32, 34, 0.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  pointer-events: auto;
}

.layout-edit-toolbar-inner strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
}

.layout-edit-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (min-width: 981px) {
  body.is-layout-editing .workspace {
    padding-top: 72px;
  }
}

.is-layout-edit-zone {
  position: relative;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: calc(var(--radius) + 4px);
  outline: 1px dashed color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 3px;
  background: color-mix(in srgb, var(--accent-soft) 22%, transparent);
}

.is-layout-edit-zone.is-drop-target {
  outline-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 46%, transparent);
}

.layout-edit-module {
  position: relative;
  cursor: grab;
  outline: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  outline-offset: 3px;
  transition: outline-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.layout-edit-module:hover {
  outline-color: color-mix(in srgb, var(--accent) 58%, transparent);
  box-shadow: 0 16px 34px color-mix(in srgb, var(--accent) 13%, transparent);
}

.layout-edit-module:active {
  cursor: grabbing;
}

.layout-edit-module.is-dragging {
  position: fixed;
  left: -9999px;
  top: -9999px;
  z-index: -1;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.layout-resize-handle {
  position: absolute;
  z-index: 3;
  left: 18px;
  right: 18px;
  bottom: 5px;
  height: 14px;
  min-height: 14px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: ns-resize;
}

.layout-resize-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 5px;
  width: min(80px, 42%);
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 42%, var(--line));
  transform: translateX(-50%);
}

.layout-resize-handle:hover::before,
.layout-resize-handle:focus-visible::before {
  background: var(--accent);
}

body.is-layout-resizing {
  cursor: ns-resize;
  user-select: none;
}

.students-panel.has-custom-layout-height {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.students-panel.has-custom-layout-height .students-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding-bottom: 18px;
}

.mobile-nav-editor {
  position: fixed;
  z-index: 910;
  left: 50%;
  bottom: calc(var(--mobile-nav-bottom-offset) + 58px);
  width: max-content;
  max-width: calc(100% - 28px);
  transform: translateX(-50%);
  pointer-events: none;
}

.mobile-nav-editor-panel {
  pointer-events: auto;
}

.mobile-nav-editor-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 6px;
  flex-wrap: wrap;
}

.section-head.compact {
  align-items: baseline;
}

.section-head.compact h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.students-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: clamp(190px, calc(100vh - 260px), 640px);
  margin-top: 12px;
  padding-right: 3px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  container-type: inline-size;
  --student-list-color-width: clamp(28px, 12cqw, 56px);
}

.add-entity-button {
  width: auto;
  min-height: 38px;
  margin-top: 0;
  padding: 0 16px;
}

.mobile-add-icon {
  display: none;
}

#addEntityDialog.student-dialog {
  width: min(760px, calc(100vw - 28px));
}

#addEntityDialog .add-entity-form {
  gap: 14px;
}

.add-entity-top-row {
  grid-template-columns: minmax(0, 1fr) 42px minmax(150px, 0.45fr);
}

.add-entity-lesson-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.7fr) minmax(170px, 0.8fr) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.add-entity-type-field,
.add-entity-lesson-row > label {
  min-width: 0;
}

.add-entity-additional {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
}

.add-entity-additional summary {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.add-entity-additional[open] summary {
  margin-bottom: 12px;
}

#studentDialog .student-edit-additional:not([open]) summary {
  padding-block: 8px;
}

.add-entity-form.is-group .add-student-only {
  display: none;
}

.add-entity-form.is-group .add-entity-lesson-row {
  grid-template-columns: minmax(160px, 240px);
}

.auth-mode-tabs .segment {
  min-height: 34px;
}

.auth-page-body {
  min-height: 100dvh;
  overflow: hidden;
}

.auth-page-body.is-auth-page-checking .auth-route-panel {
  visibility: hidden;
}

.auth-route-page {
  display: grid;
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: var(--bg);
}

.auth-route-shell {
  display: grid;
  align-content: center;
  gap: 18px;
  width: min(440px, 100%);
  min-height: calc(100dvh - 48px);
  margin: 0 auto;
}

.auth-route-brand {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.auth-route-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-route-logo {
  display: block;
  width: 34px;
  height: 34px;
}

.auth-route-brand h1 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.auth-route-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-route-tabs {
  width: 100%;
}

.auth-route-tab {
  cursor: pointer;
  user-select: none;
}

#authRouteLogin:checked ~ .auth-route-tabs [for="authRouteLogin"],
#authRouteRegister:checked ~ .auth-route-tabs [for="authRouteRegister"] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 8px rgba(32, 38, 42, 0.08);
}

#authRouteLogin:focus-visible ~ .auth-route-tabs [for="authRouteLogin"],
#authRouteRegister:focus-visible ~ .auth-route-tabs [for="authRouteRegister"] {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.auth-route-form-stack {
  display: grid;
}

.auth-route-form-container {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.auth-route-form {
  align-content: start;
  display: grid;
  gap: 13px;
  padding: 14px;
}

.auth-route-form input {
  min-height: 44px;
}

.auth-route-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.auth-route-strength {
  display: grid;
  gap: 7px;
  margin-top: -5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.auth-route-strength[hidden] {
  display: none;
}

.auth-route-strength-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.auth-route-strength-header strong {
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.auth-route-strength-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.auth-route-strength-segment {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 72%, var(--surface));
}

.auth-route-strength[data-strength="weak"] .auth-route-strength-segment.is-active {
  background: var(--accent-three);
}

.auth-route-strength[data-strength="medium"] .auth-route-strength-segment.is-active {
  background: var(--accent-two);
}

.auth-route-strength[data-strength="strong"] .auth-route-strength-segment.is-active {
  background: var(--accent);
}

.auth-route-consents {
  display: grid;
  gap: 9px;
  min-width: 0;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.auth-route-consent {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.auth-route-consent input {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--accent);
}

.auth-route-consent a {
  color: var(--accent);
  text-decoration: none;
}

.auth-route-consent a:hover {
  text-decoration: underline;
}

.auth-route-actions {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.auth-route-actions .primary-button {
  width: 100%;
  min-height: 44px;
}

.auth-route-actions .primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.auth-route-error {
  margin-top: 0;
}

#authRouteLogin:checked ~ .auth-route-form-stack .auth-route-register-container,
#authRouteRegister:checked ~ .auth-route-form-stack .auth-route-login-container {
  display: none;
}

.auth-route-reset-container {
  display: none;
}

.auth-route-panel.is-reset-mode .auth-route-tabs,
.auth-route-panel.is-reset-mode .auth-route-login-container,
.auth-route-panel.is-reset-mode .auth-route-register-container {
  display: none;
}

.auth-route-panel.is-reset-mode .auth-route-reset-container {
  display: grid;
}


.auth-forgot-button {
  justify-self: start;
  min-height: 28px;
  padding: 0;
}

.auth-forgot-button[hidden] {
  display: none;
}

.auth-privacy-link {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.auth-privacy-link:hover {
  color: var(--accent);
}

.auth-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--unpaid) 38%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--unpaid) 11%, var(--surface));
  color: var(--unpaid);
  font-size: 13px;
  font-weight: 800;
}

.auth-error.is-info {
  border-color: color-mix(in srgb, var(--paid) 38%, var(--line));
  background: color-mix(in srgb, var(--paid) 11%, var(--surface));
  color: var(--paid);
}

.auth-error[hidden] {
  display: none;
}

.autosave-status {
  margin: 0;
  min-height: 18px;
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.autosave-status.is-saving {
  color: var(--muted);
}

.autosave-status.is-saved {
  color: var(--paid);
}

.autosave-status.is-error {
  color: var(--unpaid);
  white-space: normal;
}

.autosave-status[hidden] {
  display: none;
}

.empty-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.student-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  margin-top: 12px;
}

.group-create {
  margin-top: 8px;
}

.student-create input[type="color"],
.student-color {
  min-width: 0;
  height: 38px;
  padding: 4px;
}

.student-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 0;
  overflow: hidden;
  background: var(--student-card-background);
  border: 1px solid var(--student-card-border);
  border-radius: 14px;
  color: var(--ink);
  transition: transform 150ms ease-in-out, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.student-row.is-group-member {
  background: var(--student-card-background);
}

.student-row:not(.is-dragging):hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--student-card-border));
  background: var(--student-card-hover-background);
  box-shadow: var(--student-card-hover-shadow);
}

.student-row:not(.is-dragging):hover .student-link {
  background: var(--student-card-hover-background);
}

.student-row.is-dragging,
.group-row.is-dragging {
  position: fixed;
  left: -9999px;
  top: -9999px;
  z-index: -1;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.native-drag-image {
  box-sizing: border-box;
  opacity: 0.96;
  box-shadow: 0 18px 34px rgba(25, 32, 34, 0.22);
  transform: scale(var(--drag-preview-scale, 0.92)) rotate(0.4deg);
  transform-origin: top left;
}

.student-calendar-drag-preview {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1400;
  box-sizing: border-box;
  pointer-events: none;
  user-select: none;
  will-change: transform;
}

.student-calendar-drag-preview.is-student-preview {
  display: grid;
  gap: 3px;
  width: min(220px, calc(100vw - 28px));
  min-height: 54px;
  padding: 10px 12px 10px 17px;
  border: 1px solid color-mix(in srgb, var(--student-color, var(--accent)) 34%, var(--line));
  border-left: 6px solid var(--student-color, var(--accent));
  border-radius: var(--radius);
  background: var(--student-card-background);
  color: var(--ink);
  box-shadow: 0 16px 30px rgba(32, 38, 42, 0.16);
}

.student-calendar-drag-preview.is-student-preview strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-calendar-drag-preview.is-student-preview span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-row.is-student-drop-target,
.group-row.is-student-drop-target {
  outline: 0;
}

.group-row.is-student-drop-target {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--student-card-border));
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--accent) 34%, transparent),
    var(--student-card-hover-shadow);
}

.group-row:not(.is-expanded).is-student-drop-target .group-content {
  position: relative;
}

.student-drop-placeholder {
  display: grid;
  align-items: center;
  min-height: 56px;
  margin: 1px 0;
  padding: 0 12px;
  border: 1px dashed color-mix(in srgb, var(--accent) 58%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent-soft) 64%, transparent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  pointer-events: none;
  transition: background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.student-drop-placeholder.is-collapsed-group-target {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  min-height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--accent-soft) 82%, var(--group-card-background));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 48%, var(--line));
}

.mobile-archive-row {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 38px;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--accent);
  font-weight: 900;
}

.group-row {
  --group-toggle-width: 46px;
  display: grid;
  grid-template-columns: var(--student-list-color-width) minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--student-card-border);
  border-radius: 14px;
  background: var(--group-card-background);
  color: var(--ink);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.group-color-strip {
  grid-column: 1;
  align-self: stretch;
  min-width: 0;
  min-height: 58px;
  background: var(--student-color, var(--accent));
  box-shadow: inset -1px 0 0 color-mix(in srgb, #ffffff 20%, transparent);
}

.group-content {
  grid-column: 2;
  min-width: 0;
}

.group-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--group-toggle-width);
  gap: 0;
  min-height: 58px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.group-header:hover {
  background: var(--group-card-hover-background);
}

.group-row.is-expanded .group-header {
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 16%, var(--student-card-border));
}

.group-toggle {
  display: grid;
  place-items: center;
  align-self: stretch;
  width: var(--group-toggle-width);
  min-width: var(--group-toggle-width);
  height: 100%;
  min-height: 58px;
  padding: 0;
  border: 0;
  border-left: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.group-toggle:hover {
  background: color-mix(in srgb, var(--accent) 12%, var(--group-card-background));
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
}

.group-toggle-icon {
  display: block;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 140ms ease;
}

.group-toggle.is-expanded .group-toggle-icon {
  transform: rotate(45deg);
}

.group-members {
  --nested-student-color-width: max(16px, calc(var(--student-list-color-width) / 2));
  display: grid;
  gap: 6px;
  padding:
    8px
    10px
    8px
    10px;
  background: color-mix(in srgb, var(--student-card-background) 58%, var(--group-card-background));
}

.students-list .group-members .student-link {
  grid-template-columns: var(--nested-student-color-width) minmax(0, 1fr) auto;
}

.group-members .student-row {
  border-radius: 12px;
  box-shadow: 0 5px 14px rgba(25, 32, 34, 0.08);
}

.student-link {
  display: grid;
  grid-template-columns: var(--student-card-color-width) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  min-height: 58px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.students-list .student-link {
  grid-template-columns: var(--student-list-color-width) minmax(0, 1fr) auto;
}

.student-row .student-link {
  background: var(--student-card-background);
  transition: background 160ms ease;
}

.students-list .group-link {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 58px;
  padding-left: 10px;
  background: transparent;
}

.group-card-price {
  color: var(--ink);
}

.student-dot {
  width: 14px;
  height: 14px;
  border: 1px solid color-mix(in srgb, var(--student-color, var(--accent)) 50%, var(--line));
  border-radius: 50%;
  background: var(--student-color, var(--accent));
}

.student-card-color-strip {
  align-self: stretch;
  width: 100%;
  min-height: 100%;
  border: 0;
  border-radius: 0;
  background: var(--student-color, var(--accent));
  box-shadow: inset -1px 0 0 color-mix(in srgb, #ffffff 20%, transparent);
}

.student-link-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.student-link-text strong,
.student-link-text span,
.student-link-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-link-text strong {
  font-size: 14px;
}

.student-link-text span,
.student-link-text small {
  color: var(--muted);
  font-size: 12px;
}

.student-balance-mini {
  justify-self: end;
  font-size: 12px;
  white-space: nowrap;
}

.student-balance-mini.is-negative {
  color: var(--unpaid);
}

.student-balance-mini.is-positive {
  color: var(--paid);
}

.group-member-item {
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  transition: transform 150ms ease-in-out, box-shadow 160ms ease;
}

.topup-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.icon-button.small {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  font-size: 18px;
}

.lesson-card strong,
.lesson-chip strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: break-word;
  text-overflow: clip;
  white-space: normal;
  word-break: normal;
  hyphens: auto;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
  justify-content: stretch;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.date-controls,
.toolbar,
.calendar-controls,
.dialog-main-actions {
  gap: 8px;
}

.calendar-controls {
  display: contents;
  min-width: 0;
}

.calendar-controls .segmented {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

.calendar-controls .date-controls {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
}

.add-lesson-button {
  grid-column: 3;
  justify-self: end;
}

.range-button {
  min-width: 132px;
  justify-content: center;
  font-weight: 900;
}

.nav-button {
  padding: 0;
  line-height: 1;
}

.settings-trigger {
  justify-self: end;
  width: 38px;
  min-height: 38px;
  font-size: 19px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  aspect-ratio: 1;
  padding: 0;
  background: var(--surface-strong);
  color: var(--ink);
  border: 1px solid var(--line);
  line-height: 1;
}

.icon-button.ghost {
  background: var(--surface-strong);
}

.dialog-head .icon-button.ghost,
.finance-close-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  line-height: 1;
}

.today-button,
.secondary-button,
.chip-button {
  padding: 0 14px;
  background: var(--surface-strong);
  color: var(--ink);
  border: 1px solid var(--line);
}

.primary-button {
  padding: 0 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.add-lesson-button {
  flex: 0 0 auto;
  width: auto;
  min-height: 44px;
  padding: 0 16px;
  font-size: 15px;
  line-height: 1;
}

.danger-button {
  padding: 0 14px;
  background: color-mix(in srgb, var(--accent-three) 14%, var(--surface));
  color: var(--accent-three);
  border: 1px solid color-mix(in srgb, var(--accent-three) 35%, var(--line));
}

.text-button {
  min-height: 30px;
  padding: 0 8px;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.calendar-board {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px;
}

@media (min-width: 981px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .sidebar,
  .desktop-side-column {
    max-height: calc(100vh - 28px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .workspace {
    height: calc(100vh - 28px);
    min-height: 0;
  }

  .calendar-board {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-top: 0;
    scrollbar-gutter: stable;
  }
}

.week-view,
.day-view {
  display: grid;
  width: 100%;
  min-width: 0;
}

.week-view {
  grid-template-columns: 52px repeat(7, minmax(0, 1fr));
  align-items: start;
}

.day-view {
  grid-template-columns: 58px minmax(0, 1fr) minmax(220px, 280px);
  gap: 14px;
}

.time-rail {
  padding-top: 54px;
}

.mobile-time-rail {
  display: none;
}

.time-label {
  height: var(--hour-height);
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  padding: 2px 8px 0 0;
  transition: color 120ms ease, font-weight 120ms ease, transform 120ms ease;
}

.time-label.is-hovered {
  color: var(--accent);
  font-weight: 900;
  transform: translateX(-2px);
}

.day-column,
.day-timeline {
  min-width: 0;
}

.day-column-header {
  position: sticky;
  top: 0;
  z-index: 22;
  height: 54px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 0 6px;
  border-left: 1px solid var(--line);
  background: var(--surface);
  overflow: visible;
}

.day-column-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -16px;
  z-index: 1;
  height: 16px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--surface) 94%, transparent), transparent);
  pointer-events: none;
}

.day-header-button {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 2px;
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.day-header-main {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-weight: 800;
}

.day-header-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.day-column-header.is-today .day-header-main {
  color: var(--accent);
}

.day-track {
  position: relative;
  min-height: calc(var(--hour-height) * var(--visible-hours));
  border-left: 1px solid var(--line);
  cursor: crosshair;
  touch-action: pan-y;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--hour-height) - 1px),
      var(--line) calc(var(--hour-height) - 1px),
      var(--line) var(--hour-height)
    );
}

.day-track.is-create-armed {
  background:
    linear-gradient(color-mix(in srgb, var(--accent) 8%, transparent), color-mix(in srgb, var(--accent) 8%, transparent)),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--hour-height) - 1px),
      var(--line) calc(var(--hour-height) - 1px),
      var(--line) var(--hour-height)
    );
}

.current-time-marker {
  position: absolute;
  z-index: 18;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px solid var(--accent-three);
  pointer-events: none;
}

.current-time-marker::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -5px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent-three);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-three) 16%, transparent);
}

.slot-button {
  display: block;
  width: 100%;
  height: var(--hour-height);
  border: 0;
  background: transparent;
}

.lesson-card {
  position: absolute;
  left: 8px;
  right: 8px;
  box-sizing: border-box;
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--student-color, var(--accent)) 32%, var(--line));
  border-left: 7px solid var(--paid);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--student-color, var(--accent)) 22%, var(--surface));
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 18px rgba(32, 38, 42, 0.08);
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.lesson-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px rgba(32, 38, 42, 0.12);
}

.lesson-card span,
.lesson-chip span,
.agenda-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.lesson-card span {
  min-width: 0;
  overflow: hidden;
  overflow-wrap: break-word;
  text-overflow: clip;
  white-space: normal;
  word-break: normal;
  hyphens: auto;
}

.lesson-card strong {
  font-size: 13px;
  line-height: 1.1;
}

.lesson-card-student {
  max-width: 100%;
  color: var(--ink) !important;
  font-weight: 900;
}

.lesson-card-time {
  color: var(--muted) !important;
  font-size: 10px !important;
  font-weight: 700;
  line-height: 1.1 !important;
}

.lesson-card-price {
  position: absolute;
  right: 7px;
  bottom: 4px;
  max-width: calc(100% - 14px);
  color: var(--ink) !important;
  font-size: 10px !important;
  font-weight: 900;
  line-height: 1.1 !important;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-card.is-paid,
.lesson-chip.is-paid,
.agenda-item.is-paid {
  border-color: color-mix(in srgb, var(--student-color, var(--accent)) 34%, var(--line));
  border-left-color: var(--paid);
  background: color-mix(in srgb, var(--student-color, var(--accent)) 22%, var(--surface));
}

.lesson-card.is-unpaid,
.lesson-chip.is-unpaid,
.agenda-item.is-unpaid {
  border-color: color-mix(in srgb, var(--student-color, var(--accent)) 34%, var(--line));
  border-left-color: var(--unpaid);
  background: color-mix(in srgb, var(--student-color, var(--accent)) 24%, var(--surface));
}

.pay-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 18px;
  padding: 0 6px;
  border: 1px solid color-mix(in srgb, var(--paid) 45%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paid) 13%, var(--surface));
  color: var(--paid) !important;
  font-size: 10.5px !important;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.is-unpaid .pay-badge {
  border-color: color-mix(in srgb, var(--unpaid) 45%, transparent);
  background: color-mix(in srgb, var(--unpaid) 13%, var(--surface));
  color: var(--unpaid) !important;
}

.lesson-card.is-dragging,
.lesson-card.is-dragging:hover,
.lesson-chip.is-dragging {
  position: fixed !important;
  z-index: 1200;
  left: var(--lesson-drag-left) !important;
  top: var(--lesson-drag-top) !important;
  right: auto !important;
  width: var(--lesson-drag-width) !important;
  height: var(--lesson-drag-height) !important;
  margin: 0;
  opacity: 1;
  pointer-events: none;
  outline: none;
  transform: translate3d(var(--lesson-drag-x, 0), var(--lesson-drag-y, 0), 0);
  filter: brightness(1.08);
  box-shadow: none;
  cursor: grabbing;
  transition: none;
  will-change: transform;
}

.lesson-drag-placeholder {
  display: block;
  width: 100%;
  visibility: hidden;
  pointer-events: none;
}

.draft-selection {
  position: absolute;
  left: 8px;
  right: 8px;
  box-sizing: border-box;
  z-index: 6;
  display: grid;
  align-content: center;
  padding: 8px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 78%, transparent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

.paid-toggle {
  align-self: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  min-height: 24px;
  padding: 0 8px;
  color: var(--paid);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
}

.paid-toggle.is-unpaid {
  color: var(--unpaid);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-width: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.weekday {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--surface-strong);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.calendar-day {
  position: relative;
  min-height: 132px;
  padding: 9px;
  background: var(--surface);
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.calendar-day.is-outside {
  background: color-mix(in srgb, var(--surface-strong) 55%, var(--surface));
  color: var(--muted);
}

.calendar-day.is-selected,
.calendar-day.is-today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.day-number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 800;
}

.day-total {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.month-events {
  display: grid;
  gap: 6px;
}

.lesson-chip {
  display: grid;
  gap: 1px;
  width: 100%;
  padding: 7px 8px;
  background: color-mix(in srgb, var(--student-color, var(--accent)) 24%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--student-color, var(--accent)) 30%, var(--line));
  border-left: 5px solid var(--paid);
  border-radius: var(--radius);
  color: var(--ink);
  text-align: left;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}

.more-chip {
  color: var(--muted);
  font-size: 12px;
}

.month-count-badge {
  display: none;
}

.day-details {
  position: sticky;
  top: 0;
  align-self: start;
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.day-details h3 {
  margin: 0;
  font-size: 16px;
}

.agenda-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 7px solid var(--paid);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.agenda-main {
  display: grid;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.repeat-section {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.student-combobox,
.lesson-subject-field,
.student-profile-subject-field {
  position: relative;
}

.student-dropdown,
.subject-dropdown {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  gap: 5px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.student-dropdown[hidden],
.subject-dropdown[hidden] {
  display: none;
}

.student-option,
.subject-option {
  display: grid;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.student-option {
  grid-template-columns: 14px minmax(0, 1fr);
}

.student-option:hover {
  background: color-mix(in srgb, var(--student-color, var(--accent)) 28%, var(--surface));
}

.subject-option:hover {
  background: color-mix(in srgb, var(--accent-soft) 64%, var(--surface));
}

.dropdown-empty {
  padding: 9px;
  color: var(--muted);
  font-size: 12px;
}

.weekday-picker {
  display: grid;
  grid-template-columns: repeat(7, minmax(36px, 1fr));
  gap: 6px;
}

.weekday-picker label {
  position: relative;
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.weekday-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.weekday-picker span {
  display: grid;
  place-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.weekday-picker input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.weekday-picker input:disabled + span,
.repeat-until input:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 280px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.lesson-dialog,
.student-dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: min(92vh, 820px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.lesson-dialog.dialog-fallback-open,
.student-dialog.dialog-fallback-open {
  position: fixed;
  z-index: 1000;
  display: block;
  top: 50%;
  left: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
  box-shadow: var(--shadow), 0 0 0 100vmax rgba(18, 24, 28, 0.38);
}

body.has-fallback-dialog {
  overflow: hidden;
}

.auth-dialog {
  width: min(440px, calc(100vw - 28px));
}

#studentDialog.student-dialog {
  --student-profile-panel-height: 275px;
  width: min(760px, calc(100vw - 28px));
  height: min(var(--student-profile-dialog-height, 820px), calc(100dvh - 28px));
  max-height: calc(100dvh - 28px);
  overflow: hidden;
  transition: height 180ms ease;
}

@media (min-width: 761px) {
  #studentDialog .student-profile-grid {
    height: var(--student-profile-panel-height);
    min-height: var(--student-profile-panel-height);
    max-height: var(--student-profile-panel-height);
  }

  #studentDialog.student-dialog.is-profile-anchored {
    position: fixed;
    inset: var(--student-profile-dialog-top, 14px) 0 auto;
    margin: 0 auto;
  }

  #studentDialog.student-dialog.is-profile-anchored.dialog-fallback-open {
    left: 0;
    transform: none;
  }
}

#studentDialog .student-profile-form {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: stretch;
  gap: 0;
  height: 100%;
  padding: 0;
  overflow: hidden;
}

#studentDialog .dialog-head {
  padding: 18px 18px 14px;
}

#studentDialog .student-profile-scroll {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  padding: 0 18px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

#studentDialog .dialog-actions {
  margin: 0;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 -10px 22px color-mix(in srgb, var(--surface) 84%, transparent);
}

#studentDialog .dialog-head,
#studentDialog .student-profile-top-row,
#studentDialog .student-profile-lesson-row,
#studentDialog .student-edit-additional,
#studentDialog .student-profile-grid,
#studentDialog .dialog-actions {
  grid-column: 1 / -1;
}

#studentDialog .student-profile-top-row,
#studentDialog .student-profile-lesson-row {
  min-width: 0;
}

#studentDialog .student-edit-top-row {
  grid-template-columns: minmax(0, 1fr) 42px minmax(150px, 0.45fr);
}

#studentDialog .student-edit-lesson-row {
  grid-template-columns: minmax(160px, 0.7fr) minmax(170px, 0.8fr) minmax(0, 1fr);
}

#studentDialog .profile-panel {
  box-sizing: border-box;
  height: var(--student-profile-panel-height);
  min-height: var(--student-profile-panel-height);
  max-height: var(--student-profile-panel-height);
  overflow: hidden;
}

#studentDialog .student-account-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
}

#studentDialog .student-upcoming-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

#studentUpcomingLessons,
#studentLedger {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.lesson-dialog::backdrop,
.student-dialog::backdrop {
  background: rgba(18, 24, 28, 0.38);
}

.lesson-form,
.student-profile-form {
  display: grid;
  gap: 16px;
  padding: 18px;
  min-width: 0;
  overflow-x: hidden;
}

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

.lesson-student-field,
.lesson-payment-field,
.lesson-subject-field,
.lesson-topic-field {
  grid-column: span 3;
  min-width: 0;
}

.lesson-date-field {
  grid-column: span 2;
  min-width: 0;
}

.lesson-time-row {
  grid-column: span 4;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.repeat-section,
.lesson-notes-field {
  grid-column: 1 / -1;
}

.app-right-panel .lesson-form,
.app-right-panel .student-profile-form {
  display: grid;
  grid-template-rows: var(--right-panel-chrome-height) minmax(0, 1fr) var(--right-panel-chrome-height);
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  gap: 0;
}

.app-right-panel #studentDialog.student-dialog {
  --student-profile-panel-height: auto;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  transition: none;
}

.app-right-panel #addEntityDialog.student-dialog,
.app-right-panel #groupDialog.student-dialog {
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.app-right-panel #studentDialog .student-profile-form {
  height: 100%;
  overflow: hidden;
}

.app-right-panel .dialog-head {
  position: relative;
  z-index: 2;
  box-sizing: border-box;
  min-height: var(--right-panel-chrome-height);
  height: var(--right-panel-chrome-height);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, var(--bg));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--surface) 86%, transparent);
}

.app-right-panel .dialog-head h2 {
  font-size: 20px;
  line-height: 1.14;
}

.app-right-panel .autosave-status,
.app-right-panel .lesson-main-actions[hidden],
.app-right-panel .student-profile-status-actions[hidden],
.app-right-panel .group-profile-status-actions[hidden],
.app-right-panel #groupDialogEyebrow[hidden] {
  display: none !important;
}

.app-right-panel .form-grid,
.app-right-panel .student-profile-scroll,
.app-right-panel .form-panel-body {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  padding-inline: 16px;
}

.app-right-panel .student-profile-scroll {
  display: grid;
  align-content: start;
  gap: 14px;
  padding-block: 14px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.app-right-panel .form-panel-body {
  align-content: start;
  gap: 14px;
  padding-block: 14px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.app-right-panel .form-grid {
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  padding-block: 14px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.app-right-panel .lesson-student-field,
.app-right-panel .lesson-payment-field,
.app-right-panel .lesson-subject-field,
.app-right-panel .lesson-topic-field,
.app-right-panel .lesson-date-field,
.app-right-panel .lesson-time-row,
.app-right-panel .repeat-section,
.app-right-panel .lesson-notes-field {
  grid-column: 1 / -1;
}

.app-right-panel .repeat-section,
.app-right-panel #studentDialog .student-edit-additional,
.app-right-panel #addEntityForm > .add-entity-additional {
  border-radius: 16px;
  background: var(--surface-strong);
}

.app-right-panel .repeat-section,
.app-right-panel .repeat-until,
.app-right-panel .repeat-until input {
  min-width: 0;
}

.app-right-panel .weekday-picker {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.app-right-panel .weekday-picker span {
  min-height: 34px;
}

.app-right-panel .repeat-until input {
  max-width: 100%;
  min-inline-size: 0;
}

.app-right-panel .lesson-time-row,
.app-right-panel .lesson-payment-row,
.app-right-panel .add-entity-lesson-row,
.app-right-panel .student-profile-lesson-row {
  grid-template-columns: minmax(0, 1fr);
}

.app-right-panel .lesson-payment-row {
  align-items: stretch;
  padding-inline: 0;
}

.app-right-panel .student-profile-top-row,
.app-right-panel .add-entity-top-row {
  grid-template-columns: minmax(0, 1fr) 42px;
  max-width: 100%;
}

.app-right-panel .add-entity-type-field {
  grid-column: 1 / -1;
}

.app-right-panel .student-color-button {
  grid-column: 2;
}

.app-right-panel #studentDialog .student-edit-top-row {
  grid-template-columns: minmax(0, 1fr) 42px;
}

.app-right-panel #studentDialog .student-edit-lesson-row {
  grid-template-columns: minmax(0, 1fr);
}

.app-right-panel .student-profile-grid {
  grid-template-columns: minmax(0, 1fr);
}

.app-right-panel #studentDialog .student-profile-grid {
  height: auto;
  min-height: 0;
  max-height: none;
}

.app-right-panel .profile-panel {
  height: auto;
  min-height: 0;
  max-height: none;
  border-radius: 16px;
  background: var(--surface-strong);
}

.app-right-panel #studentDialog .profile-panel {
  height: auto;
  min-height: 0;
  max-height: none;
}

.app-right-panel #studentLedger,
.app-right-panel #studentUpcomingLessons,
.app-right-panel #groupMembersList,
.app-right-panel #groupUpcomingLessons {
  max-height: 260px;
  overflow-y: auto;
}

.app-right-panel .profile-list-item,
.app-right-panel .profile-list-item > * {
  min-width: 0;
  max-width: 100%;
}

.app-right-panel .profile-list-item strong,
.app-right-panel .profile-list-item span:not(.student-dot) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-right-panel .dialog-actions {
  position: relative;
  z-index: 2;
  box-sizing: border-box;
  min-height: var(--right-panel-chrome-height);
  height: var(--right-panel-chrome-height);
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, var(--bg));
  box-shadow: 0 -10px 22px color-mix(in srgb, var(--surface) 84%, transparent);
}

.app-right-panel #studentDialog .dialog-actions {
  margin: 0;
  padding: 12px 16px;
}

.app-right-panel .lesson-actions,
.app-right-panel #studentProfileForm .dialog-actions,
.app-right-panel #groupProfileForm .dialog-actions,
.app-right-panel #addEntityForm .dialog-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.app-right-panel .lesson-main-actions,
.app-right-panel #studentProfileForm .dialog-main-actions,
.app-right-panel #groupProfileForm .dialog-main-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-self: stretch;
  width: 100%;
}

.app-right-panel #studentProfileForm .student-profile-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-right-panel #addEntityForm .dialog-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.app-right-panel .dialog-actions > button,
.app-right-panel .dialog-main-actions > button {
  width: 100%;
  min-width: 0;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 11px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.checkbox-line input {
  appearance: none;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.checkbox-line input::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--accent);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.checkbox-line input:checked {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

.checkbox-line input:checked::before {
  opacity: 1;
  transform: scale(1);
}

.paid-line {
  min-height: 54px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--paid) 32%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paid) 10%, var(--surface));
  font-size: 15px;
  font-weight: 900;
}

.paid-line input {
  width: auto;
  height: auto;
}

.paid-line input[type="checkbox"] {
  width: 28px;
  height: 28px;
  border-color: color-mix(in srgb, var(--paid) 45%, var(--line));
}

.paid-line input[type="checkbox"]::before {
  width: 15px;
  height: 15px;
  border-radius: 5px;
  background: var(--paid);
}

.paid-line input[type="checkbox"]:checked {
  border-color: var(--paid);
  background: color-mix(in srgb, var(--paid) 16%, var(--surface));
}

.lesson-payment-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  align-self: end;
}

.lesson-payment-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.lesson-payment-row {
  display: grid;
  grid-template-columns: minmax(132px, 15ch) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 42px;
  margin-top: 4px;
  padding: 4px 9px;
}

.lesson-price-input-wrap {
  position: relative;
  display: grid;
  align-items: center;
  min-width: 0;
}

.lesson-payment-row input[name="price"],
.student-profile-price-field input[name="studentProfilePrice"],
#addEntityDialog input[name="entityPrice"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding-right: 44px;
  padding-left: 11px;
  text-align: left;
}

.lesson-price-currency {
  position: absolute;
  right: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  pointer-events: none;
}

.payment-checkbox {
  justify-content: flex-start;
  justify-self: stretch;
  align-self: center;
  min-width: 0;
  min-height: 38px;
  padding: 2px 4px 0 0;
}

.lesson-actions {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lesson-main-actions {
  display: flex;
  grid-column: 2;
  justify-content: flex-end;
  justify-self: end;
  width: auto;
}

.lesson-main-actions > button {
  min-width: 132px;
}

.lesson-delete-icon {
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
}

.lesson-delete-icon .app-icon {
  width: 22px;
  height: 22px;
}

.lesson-delete-label {
  display: none;
}

@media (min-width: 761px) {
  .lesson-actions {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .lesson-delete-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 112px;
    padding-inline: 14px;
  }

  .lesson-delete-icon .app-icon {
    display: block;
  }

  .lesson-delete-icon .lesson-delete-label {
    display: block;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
  }
}

.student-profile-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.student-profile-action-button .app-icon {
  width: 18px;
  height: 18px;
}

.student-profile-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(170px, 0.72fr);
  gap: 10px;
  align-items: end;
}

.student-name-field,
.student-group-field,
.student-profile-price-field,
.student-profile-subject-field {
  min-width: 0;
}

.student-profile-lesson-row {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.student-profile-extra {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.student-profile-notes-field textarea {
  min-height: 74px;
  max-height: 140px;
}

.student-color-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--student-color, var(--accent)) 36%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--student-color, var(--accent)) 14%, var(--surface-strong));
  color: var(--ink);
  cursor: pointer;
}

.student-color-button:hover {
  border-color: color-mix(in srgb, var(--student-color, var(--accent)) 58%, var(--line));
  background: color-mix(in srgb, var(--student-color, var(--accent)) 20%, var(--surface-strong));
}

.student-color-preview {
  width: 22px;
  height: 22px;
  border: 1px solid color-mix(in srgb, var(--student-color, var(--accent)) 48%, var(--line));
  border-radius: 999px;
  background: var(--student-color, var(--accent));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.58);
}

.color-presets {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
}

.color-dialog-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.color-preset {
  position: relative;
  display: block;
}

.color-preset input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.color-preset span {
  position: relative;
  display: block;
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--preset-color);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--preset-color) 62%, #000000);
}

.color-preset input:checked + span {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.color-preset input:checked + span::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.2);
}

.student-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.profile-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.profile-panel h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.profile-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.student-upcoming-panel .profile-list-item {
  align-self: start;
  min-height: 56px;
}

.profile-list-item.student-profile-card {
  grid-template-columns: var(--student-card-color-width) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 0;
  overflow: hidden;
  border-color: var(--student-card-border);
  background: var(--student-card-background);
  transition: transform 150ms ease-in-out, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

button.student-profile-card:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--student-card-border));
  background: var(--student-card-hover-background);
}

.student-profile-card .student-card-color-strip {
  min-height: 100%;
}

.student-card-main,
.student-profile-card-main {
  display: grid;
  align-content: center;
  gap: 3px;
  min-width: 0;
  padding-block: 10px;
}

.student-card-main strong,
.student-card-main small,
.student-profile-card-main strong,
.student-profile-card-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-card-main strong {
  color: var(--ink);
  font-size: 14px;
}

.student-card-main small,
.student-profile-card-main small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.student-card-value,
.student-profile-card-value {
  align-self: center;
  justify-self: end;
  padding-right: 12px;
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
}

.profile-list-item {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

button.profile-list-item {
  cursor: pointer;
}

.profile-list-item strong,
.profile-list-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-list-item span,
.ledger-item span {
  color: var(--muted);
  font-size: 12px;
}

.profile-list-item .student-profile-card-main {
  color: var(--ink);
  font-size: inherit;
}

.student-balance {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.student-balance-head {
  display: contents;
}

.student-balance-head span {
  grid-column: 1;
  grid-row: 1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.student-balance-head .topup-button {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 9px;
  font-size: 11px;
}

.student-balance strong {
  grid-column: 1;
  grid-row: 2;
  font-size: 20px;
  line-height: 1;
}

.is-negative {
  color: var(--unpaid);
}

.is-positive {
  color: var(--paid);
}

.is-neutral {
  color: var(--ink);
}

.ledger-item.student-profile-card {
  min-height: 56px;
  max-height: 56px;
  overflow: hidden;
}

.timeline-lesson-item {
  width: 100%;
}

.timeline-money-item {
  cursor: default;
}

.ledger-item.student-profile-card .student-profile-card-value {
  align-self: center;
}

.archive-student-list {
  container-type: inline-size;
  --student-list-color-width: clamp(28px, 12cqw, 56px);
}

.archive-student-list .student-link {
  grid-template-columns: var(--student-list-color-width) minmax(0, 1fr) auto;
}

.archived-student-row {
  width: 100%;
}

.archived-student-card {
  cursor: default;
}

.archived-student-restore {
  align-self: center;
  min-height: 34px;
  margin-right: 10px;
  padding: 0 10px;
}

.dialog-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.student-action-dialog .dialog-note {
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.compact-action-close {
  display: none;
}

.compact-action-dialog {
  width: min(520px, calc(100vw - 28px));
  max-height: min(80vh, 520px);
  overflow: hidden;
}

.compact-action-dialog .student-profile-form {
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 14px;
  padding: 18px;
  overflow: hidden;
  background: var(--surface);
}

.compact-action-dialog .dialog-head,
.compact-action-dialog .compact-action-actions {
  position: static;
  inset: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.compact-action-dialog .dialog-note {
  min-height: 0;
  max-height: min(32vh, 220px);
  overflow-y: auto;
  overflow-wrap: anywhere;
}

.compact-action-dialog .compact-action-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
}

.compact-action-dialog .compact-action-actions button {
  min-height: 44px;
  padding: 8px 12px;
}

.compact-action-dialog .compact-action-close {
  display: grid;
}

.confirm-action-dialog .dialog-head {
  justify-content: flex-start;
  align-items: flex-start;
}

.confirm-action-dialog .dialog-head h2 {
  text-align: left;
}

.confirm-action-dialog .dialog-note {
  max-width: 56ch;
}

@media (min-width: 761px) {
  .confirm-action-dialog,
  #deleteScopeDialog.confirm-action-dialog.is-series-delete {
    width: fit-content;
    min-width: min(320px, calc(100vw - 28px));
    max-width: min(640px, calc(100vw - 28px));
  }

  .confirm-action-dialog .student-profile-form {
    width: fit-content;
    min-width: min(320px, calc(100vw - 28px));
    max-width: 100%;
  }

  #studentActionDialog .compact-action-actions,
  #deleteScopeDialog #deleteScopeActions.is-compact,
  .account-delete-dialog .account-delete-actions {
    grid-template-columns: repeat(2, max-content);
    justify-content: end;
  }

  .confirm-action-dialog .compact-action-actions,
  #deleteScopeDialog.confirm-action-dialog.is-series-delete #deleteScopeActions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: stretch;
    gap: 10px;
  }

  .confirm-action-dialog .compact-action-actions button,
  #deleteScopeDialog.confirm-action-dialog.is-series-delete #deleteScopeActions button {
    width: auto;
    min-width: 0;
    padding-inline: 14px;
    font-size: 14px;
    white-space: nowrap;
  }
}

.account-delete-dialog {
  width: min(520px, calc(100vw - 28px));
}

.account-delete-dialog .student-profile-form {
  gap: 14px;
}

.account-delete-dialog .dialog-note {
  overflow-wrap: anywhere;
}

.account-delete-dialog .auth-error {
  margin: 0;
}

.account-delete-dialog .account-delete-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-delete-dialog .account-delete-actions .danger-button {
  background: color-mix(in srgb, var(--unpaid) 12%, var(--surface));
  color: var(--unpaid);
  border: 1px solid color-mix(in srgb, var(--unpaid) 42%, var(--line));
  font-weight: 800;
}

.account-delete-dialog .account-delete-actions .danger-button:hover {
  background: color-mix(in srgb, var(--unpaid) 20%, var(--surface));
  border-color: color-mix(in srgb, var(--unpaid) 60%, var(--line));
}

.scope-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.scope-actions.is-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.scope-actions button {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  white-space: normal;
}

.dialog-actions > button,
.dialog-main-actions > button {
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 104px;
  padding: 0 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

#studentDialog .dialog-actions,
#groupDialog .dialog-actions {
  justify-content: space-between;
}

.danger-button[hidden] {
  display: none;
}

.sidebar,
.workspace,
.app-right-panel,
.panel,
.lesson-dialog,
.student-dialog {
  border-radius: 18px;
}

.brand-mark,
.segment,
.today-button,
.primary-button,
.secondary-button,
.danger-button,
.chip-button,
.text-button,
.icon-button,
input,
select,
textarea,
.lesson-card,
.lesson-chip,
.agenda-item,
.student-row,
.group-row,
.profile-list-item,
.student-balance {
  border-radius: 14px;
}

.workspace {
  box-shadow: 0 16px 42px rgba(32, 40, 40, 0.08);
}

body[data-theme="dark"] .workspace {
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

body[data-theme="dark"] .app-right-panel {
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.topbar {
  align-items: center;
}

.toolbar {
  flex-direction: column;
  align-items: stretch;
}

@media (max-width: 980px) {
  .app-right-panel {
    display: none !important;
  }

  .app-shell {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: center;
    grid-template-columns: minmax(120px, 1fr) minmax(180px, auto) minmax(48px, 1fr);
  }

  .calendar-controls {
    display: contents;
  }

  .calendar-controls .segmented {
    width: auto;
  }

  .view-option {
    flex: 1 1 0;
    width: auto;
    min-width: 44px;
  }

  .primary-button {
    flex: 1;
  }

  .add-lesson-button {
    grid-column: 3;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .calendar-controls {
    flex-basis: 100%;
  }

  .date-controls {
    flex: 1 1 100%;
  }

  .range-button {
    flex: 1;
    min-width: 0;
  }

  .calendar-board {
    padding: 10px;
  }

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

  .lesson-payment-row {
    grid-column: 1;
  }

  .student-profile-grid {
    grid-template-columns: 1fr;
  }

  .color-presets {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .scope-actions {
    grid-template-columns: 1fr;
  }

  .dialog-main-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .pricing-inline,
  .account-name-row {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 760px) {
  :root {
    --hour-height: 52px;
  }

  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  body {
    min-height: 100dvh;
    font-size: 14px;
  }

  button,
  input,
  select,
  textarea {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  input[type="checkbox"],
  input[type="radio"],
  input[type="hidden"] {
    min-height: 0;
  }

  .checkbox-line input {
    width: 22px;
    height: 22px;
    min-height: 22px;
  }

  .paid-line input[type="checkbox"] {
    width: 30px;
    height: 30px;
    min-height: 30px;
  }

  .weekday-picker input,
  .color-preset input {
    min-height: 1px;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    max-width: none;
    min-height: 100dvh;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .sidebar,
  .workspace,
  .panel {
    border-radius: 14px;
  }

  .sidebar {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .brand {
    grid-template-columns: 36px minmax(0, 1fr) 40px;
    gap: 9px;
    padding: 0;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand h1 {
    overflow: hidden;
    font-size: 18px;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand .eyebrow {
    margin-bottom: 2px;
    font-size: 10px;
  }

  .settings-trigger,
  .icon-button {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .panel {
    padding: 12px;
  }

  .summary-line-value strong {
    font-size: 18px;
  }

  .students-list {
    max-height: min(36vh, 280px);
  }

  .workspace {
    min-height: 72vh;
    overflow: visible;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 25;
    gap: 8px;
    padding: 10px;
    background: var(--surface);
    border-radius: 14px 14px 0 0;
  }

  .calendar-controls {
    display: contents;
    gap: 8px;
  }

  .date-controls {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    width: 100%;
    min-width: 0;
  }

  .calendar-controls .segmented {
    width: auto;
  }

  .segment {
    min-height: 40px;
    padding: 0 8px;
  }

  .range-button {
    min-width: 0;
    padding: 0 8px;
    font-size: 13px;
  }

  .nav-button {
    width: 42px;
    min-height: 42px;
    font-size: 34px;
  }

  .add-lesson-button {
    grid-column: 3;
    width: 46px;
    min-height: 46px;
  }

  .calendar-board {
    min-height: calc(100dvh - 112px);
    padding: 10px;
    overflow-x: hidden;
  }

  .week-view {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .week-view > .time-rail {
    display: none;
  }

  .day-column {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
  }

  .day-column-header {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 48px;
    height: auto;
    padding: 10px 12px;
    border-left: 0;
    border-bottom: 1px solid var(--line);
    background: var(--surface-strong);
  }

  .day-header-status {
    justify-self: end;
  }

  .mobile-time-rail {
    display: block;
    grid-column: 1;
    background: var(--surface-strong);
    border-right: 1px solid var(--line);
  }

  .mobile-time-rail .time-label,
  .day-view > .time-rail .time-label {
    padding: 2px 6px 0 0;
    font-size: 11px;
  }

  .day-column .day-track {
    grid-column: 2;
    min-height: calc(var(--hour-height) * var(--visible-hours));
    border-left: 0;
  }

  .day-view {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
  }

  .day-view > .time-rail {
    padding-top: 0;
    background: var(--surface-strong);
    border-right: 1px solid var(--line);
  }

  .day-timeline {
    min-width: 0;
  }

  .day-timeline .day-track {
    border-left: 0;
  }

  .day-details {
    position: static;
    grid-column: 1 / -1;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
  }

  .day-track {
    min-height: calc(var(--hour-height) * var(--visible-hours));
  }

  .slot-button {
    height: var(--hour-height);
  }

  .lesson-card {
    left: 6px;
    right: 6px;
    gap: 1px;
    min-height: 46px;
    padding: 5px 7px;
    border-left-width: 6px;
  }

  .lesson-card strong {
    font-size: 12px;
  }

  .lesson-card span {
    font-size: 11px;
  }

  .lesson-card-time,
  .lesson-card-price {
    font-size: 9.5px !important;
  }

  .draft-selection {
    left: 1px;
    right: 1px;
    width: auto;
    padding: 5px 4px;
    border-radius: 8px;
  }

  .month-grid {
    overflow: hidden;
    border-radius: 14px;
  }

  .weekday {
    padding: 7px 2px;
    font-size: 10px;
    text-align: center;
  }

  .calendar-day {
    min-height: 76px;
    padding: 6px 4px 22px;
  }

  .day-number {
    gap: 4px;
    margin-bottom: 4px;
    font-size: 12px;
  }

  .day-total {
    display: none;
  }

  .month-events {
    display: none;
  }

  .month-count-badge {
    position: absolute;
    right: 5px;
    bottom: 5px;
    display: grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
  }

  .lesson-dialog,
  .student-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .lesson-dialog.dialog-fallback-open,
  .student-dialog.dialog-fallback-open {
    inset: 0;
    transform: none;
  }

  .auth-dialog,
  .scope-dialog,
  .color-dialog,
  .topup-dialog {
    width: min(100vw, 460px);
    height: auto;
    max-height: calc(100dvh - 16px);
    margin: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
  }

  .auth-dialog.dialog-fallback-open,
  .scope-dialog.dialog-fallback-open,
  .color-dialog.dialog-fallback-open,
  .topup-dialog.dialog-fallback-open {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(calc(100vw - 16px), 460px);
    max-width: calc(100vw - 16px);
    transform: translate(-50%, -50%);
  }

  .lesson-form,
  .student-profile-form {
    gap: 14px;
    padding: 14px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  #studentDialog .student-profile-form {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-auto-rows: unset;
    align-content: stretch;
    padding: 0;
  }

  #studentDialog.student-dialog {
    --student-profile-panel-height: 200px;
  }

  .student-profile-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #studentDialog .student-profile-grid {
    min-height: auto;
  }

  #studentDialog .profile-panel {
    height: var(--student-profile-panel-height);
    min-height: var(--student-profile-panel-height);
    max-height: var(--student-profile-panel-height);
    overflow: hidden;
  }

  #studentDialog .student-account-panel {
    grid-template-rows: auto auto minmax(0, 1fr);
    height: 336px;
    min-height: 336px;
    max-height: 336px;
  }

  #studentDialog .student-upcoming-panel {
    grid-template-rows: auto minmax(0, 1fr);
  }

  #studentLedger,
  #studentUpcomingLessons {
    min-height: 0;
    max-height: none;
  }

  #studentDialog .student-profile-top-row,
  #studentDialog .student-profile-lesson-row {
    display: grid;
    grid-column: 1;
    grid-row: auto;
  }

  #studentDialog .student-profile-top-row {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  #studentDialog .add-entity-type-field {
    grid-column: 1 / -1;
  }

  #studentDialog .student-profile-lesson-row {
    grid-template-columns: minmax(0, 1fr);
  }

  #studentDialog .dialog-head,
  #studentDialog .student-name-field,
  #studentDialog .student-color-button,
  #studentDialog .student-group-field,
  #studentDialog .student-profile-price-field,
  #studentDialog .student-profile-subject-field,
  #studentDialog .student-profile-grid,
  #studentDialog .student-profile-extra,
  #studentDialog .dialog-actions {
    grid-row: auto;
  }

  #studentDialog .student-name-field,
  #studentDialog .student-color-button,
  #studentDialog .student-group-field,
  #studentDialog .student-profile-price-field,
  #studentDialog .student-profile-subject-field {
    grid-column: auto;
  }

  .student-profile-extra {
    grid-template-columns: minmax(0, 1fr);
  }

  .student-profile-actions {
    display: grid;
    grid-template-columns: repeat(2, 44px);
    justify-content: flex-start;
  }

  #studentDialog .dialog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  #studentDialog .dialog-actions > .dialog-main-actions:last-child {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
  }

  #studentDialog .dialog-actions > .dialog-main-actions:last-child .secondary-button {
    width: auto;
    min-width: 96px;
    padding-inline: 14px;
  }

  .student-profile-action-button {
    width: 44px;
    min-height: 44px;
    padding: 0;
  }

  .student-profile-action-button .student-action-label {
    display: none;
  }

  .student-profile-action-button .app-icon {
    width: 21px;
    height: 21px;
  }

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

  .lesson-student-field,
  .lesson-payment-field,
  .repeat-section,
  .lesson-subject-field,
  .lesson-topic-field,
  .lesson-notes-field {
    grid-column: 1 / -1;
  }

  .lesson-date-field {
    grid-column: 1;
  }

  .lesson-time-row {
    grid-column: 2 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .lesson-payment-row {
    grid-column: 1 / -1;
  }

  .dialog-head {
    position: sticky;
    top: 0;
    z-index: 4;
    margin: -14px -14px 0;
    padding: 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }

  .dialog-head h2 {
    font-size: 20px;
    line-height: 1.1;
  }

  .dialog-actions {
    position: sticky;
    bottom: 0;
    z-index: 4;
    margin: 0 -14px -14px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }

  .dialog-main-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lesson-actions {
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
  }

  .lesson-main-actions {
    width: 100%;
  }

  .weekday-picker {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
  }

  .weekday-picker span {
    min-height: 38px;
    padding: 0;
  }

  .student-dropdown {
    max-height: min(240px, 42dvh);
  }

  .layout-editor-board,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .brand .eyebrow {
    display: none;
  }

  .brand h1 {
    font-size: 17px;
  }

  .section-head {
    align-items: center;
  }

  .email-verification-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .student-row,
  .group-row {
    min-width: 0;
  }

  .lesson-main-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scope-actions button {
    min-height: 46px;
  }

  .calendar-day {
    min-height: 68px;
  }
}

@media (max-width: 980px) and (min-width: 761px) {
  .settings-layout {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  body.is-settings-screen #settingsDialog,
  body.is-settings-screen #settingsDialog:not([open]) {
    grid-column: 1 !important;
  }
}

@media (max-width: 760px) {
  body[data-mobile-screen="profile"] #settingsDialog,
  body[data-mobile-screen="profile"] #settingsDialog:not([open]) {
    box-sizing: border-box;
    height: calc(100dvh - 78px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    max-height: calc(100dvh - 78px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: 0;
    overflow: hidden;
  }

  body[data-mobile-screen="profile"] #settingsDialog .settings-form {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0;
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
    padding: 14px;
    overflow: hidden;
  }

  body[data-mobile-screen="profile"] #settingsDialog .settings-dialog-head {
    position: static;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 42px;
    margin: 0;
    padding: 0 52px 2px 0;
    border-bottom: 0;
    border-radius: 0;
  }

  body[data-mobile-screen="profile"] #settingsDialog .settings-dialog-head > div {
    min-width: 0;
    text-align: left;
  }

  body[data-mobile-screen="profile"] #settingsDialog .settings-dialog-head .eyebrow {
    display: none;
  }

  body[data-mobile-screen="profile"] #settingsDialog .settings-dialog-head .settings-title-text {
    overflow: hidden;
    font-size: 22px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-mobile-screen="profile"] #settingsDialog .settings-dialog-head > .ghost:last-child {
    display: none;
  }

  .settings-layout {
    display: block;
    min-height: 0;
    overflow: hidden;
  }

  .settings-sidebar {
    display: none;
  }

  .settings-mobile-home:not([hidden]) {
    display: grid;
    align-content: start;
    gap: 0;
    height: 100%;
    padding: 8px 8px var(--mobile-nav-clearance);
    overflow-y: auto;
    scroll-padding-bottom: var(--mobile-nav-clearance);
  }

  .settings-mobile-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 0 13px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
    text-align: left;
  }

  .settings-mobile-row:first-child {
    border-radius: 13px 13px 0 0;
  }

  .settings-mobile-row:last-child {
    border-bottom: 0;
    border-radius: 0 0 13px 13px;
  }

  .settings-mobile-row:hover,
  .settings-mobile-row:active {
    background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  }

  .settings-mobile-row .control-icon {
    justify-self: end;
    color: var(--muted);
  }

  .settings-content-scroll {
    height: 100%;
    min-height: 0;
    padding: 12px 10px var(--mobile-nav-clearance);
    overflow-y: auto;
    scroll-padding-bottom: var(--mobile-nav-clearance);
  }

  .settings-section {
    gap: 10px;
    width: 100%;
  }

  .settings-section-heading {
    display: none;
  }

  .settings-group {
    gap: 10px;
    padding: 13px;
    border-radius: 13px;
  }

  .settings-fields-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-action-group {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
  }

  .settings-action-copy span {
    font-size: 11px;
  }

  .settings-action-group .secondary-button,
  .settings-action-group .danger-button {
    max-width: 170px;
    min-height: 40px;
    white-space: normal;
  }

  .compact-select-setting {
    padding: 11px 13px;
  }

  .compact-select-row {
    grid-template-columns: minmax(92px, 0.75fr) minmax(0, 1.25fr);
    gap: 10px;
  }

  .compact-select-row select {
    font-size: 11px;
  }

  .settings-option-row {
    min-height: 54px;
    padding: 9px 13px;
  }

  .settings-option-row > span {
    gap: 8px;
  }

  .settings-option-row strong,
  .settings-option-row small {
    font-size: 12px;
  }

  body[data-mobile-screen="profile"] .desktop-layout-setting {
    display: grid !important;
  }

  .theme-choice-row {
    gap: 9px;
  }

  .theme-choice {
    width: 34px;
    height: 34px;
    min-height: 34px;
  }

  .theme-choice span {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 430px) {
  .settings-action-group {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-action-group .secondary-button,
  .settings-action-group .danger-button {
    width: 100%;
    max-width: none;
  }

  .session-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .session-remove-button,
  .session-bulk-actions .secondary-button,
  .session-current-actions .secondary-button {
    width: 100%;
  }

  .session-bulk-actions,
  .session-current-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-option-row > span {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .settings-section {
    animation: none;
  }
}

.mobile-tabbar {
  display: none;
}

.finance-details {
  display: none;
  gap: 12px;
  margin-top: 12px;
}

body[data-mobile-screen="finances"] .finance-details {
  display: grid;
}

.finance-workspace {
  display: none;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body.is-finance-section-open .workspace {
  grid-template-rows: minmax(0, 1fr);
}

body.is-finance-section-open .topbar,
body.is-finance-section-open .calendar-board {
  display: none;
}

body.is-finance-section-open .finance-workspace {
  display: grid;
  align-content: start;
  gap: 16px;
}

.finance-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.finance-page-head h2 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: clamp(24px, 2vw, 34px);
  line-height: 1.05;
}

.finance-close-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 12px;
}

.finance-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.finance-page-grid .finance-summary-card,
.finance-page-grid .finance-chart-card {
  grid-column: 1 / -1;
}

.finance-summary-card {
  order: 1;
}

.finance-payments-card {
  order: 3;
}

.finance-debtors-card {
  order: 2;
}

.finance-debtors-card:has(.finance-list) {
  align-content: start;
  grid-template-rows: auto auto;
}

.finance-chart-card {
  order: 4;
}

.finance-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
}

.finance-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.finance-card-head,
.finance-chart-head,
.finance-chart-controls,
.finance-chart-title-row,
.finance-chart-mode-toggle {
  display: flex;
  align-items: center;
}

.finance-card-head {
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.finance-card:has(.finance-empty-note) {
  grid-template-rows: auto minmax(0, 1fr);
}

.finance-summary-card {
  gap: 12px;
}

.finance-chart-card {
  overflow: hidden;
}

.finance-chart-head {
  align-items: flex-start;
}

.finance-chart-title-row {
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.finance-chart-title-row h3 {
  white-space: nowrap;
}

.finance-chart-range {
  display: grid;
  place-items: center;
  width: 220px;
  min-width: 220px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.finance-chart-range:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 48%, var(--surface));
  color: var(--accent);
}

.finance-chart-range:disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.58;
}

.finance-chart-range:disabled:hover {
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--muted);
}

.finance-chart-controls {
  display: grid;
  grid-template-columns: 38px 220px 38px;
  align-items: center;
  flex: 0 0 auto;
  justify-content: end;
  gap: 8px;
  width: max-content;
  min-width: 0;
}

.finance-chart-mode-toggle {
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.finance-chart-mode-toggle button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.finance-chart-mode-toggle button.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.finance-chart-nav {
  width: 38px;
  min-height: 38px;
  border-radius: var(--radius);
  padding: 0;
  line-height: 1;
}

.finance-chart-nav:disabled {
  opacity: 0.38;
  cursor: default;
}

.finance-chart {
  display: grid;
  position: relative;
  gap: 6px;
  min-width: 0;
}

.finance-chart-svg {
  width: 100%;
  min-height: 220px;
  overflow: visible;
}

.finance-chart-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.finance-chart-axis {
  stroke: color-mix(in srgb, var(--line) 76%, var(--ink));
  stroke-width: 1.1;
}

.finance-chart-y-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-anchor: end;
}

.finance-chart-area {
  fill: color-mix(in srgb, var(--accent) 13%, transparent);
  opacity: 0;
  animation: finance-chart-area-in 360ms ease 110ms forwards;
}

.finance-chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: finance-chart-line-draw 440ms cubic-bezier(0.2, 0.78, 0.18, 1) forwards;
}

.finance-chart-point {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 3;
  opacity: 0;
  transform: scale(0.55);
  transform-box: fill-box;
  transform-origin: center;
  animation: finance-chart-point-in 220ms cubic-bezier(0.18, 0.9, 0.22, 1.2) forwards;
}

.finance-chart-hit {
  fill: transparent;
  cursor: pointer;
  pointer-events: all;
}

.finance-chart-svg g:hover .finance-chart-point {
  stroke-width: 4;
}

.finance-chart-labels {
  box-sizing: border-box;
  position: relative;
  height: 18px;
  margin-top: -42px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.finance-chart-labels span {
  position: absolute;
  top: 0;
  min-width: 30px;
  transform: translateX(-50%);
}

.finance-chart-tooltip {
  position: absolute;
  z-index: 4;
  display: grid;
  gap: 2px;
  min-width: 112px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, var(--ink));
  box-shadow: 0 14px 30px rgba(25, 32, 34, 0.16);
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
  transition: opacity 120ms ease, transform 120ms ease;
}

.finance-chart-tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 16px));
}

.finance-chart-tooltip strong {
  font-size: 12px;
}

.finance-chart-tooltip span {
  color: var(--accent);
  font-size: 15px;
  font-weight: 900;
}

@keyframes finance-chart-line-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes finance-chart-area-in {
  to {
    opacity: 1;
  }
}

@keyframes finance-chart-point-in {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .finance-chart-area,
  .finance-chart-line,
  .finance-chart-point {
    animation: none;
    opacity: 1;
    stroke-dashoffset: 0;
    transform: none;
  }
}

.finance-list {
  display: grid;
  align-content: start;
  gap: 7px;
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.finance-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-self: start;
  align-items: center;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.finance-row.is-clickable {
  cursor: pointer;
}

.finance-row.is-clickable:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 56%, var(--surface));
}

.finance-row span {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.finance-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.finance-row strong {
  color: var(--ink);
  font-size: 14px;
}

.finance-row strong.is-negative {
  color: var(--unpaid);
}

.finance-row.student-finance-card {
  grid-template-columns: var(--student-card-color-width) minmax(0, 1fr) auto;
  min-height: 58px;
  padding: 0;
  overflow: hidden;
  border-color: var(--student-card-border);
  border-radius: 14px;
  background: var(--student-card-background);
  transition: transform 150ms ease-in-out, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.finance-row.student-finance-card:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--student-card-border));
  background: var(--student-card-hover-background);
  box-shadow: var(--student-card-hover-shadow);
}

.finance-empty-note {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 154px;
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.finance-payment-list {
  display: grid;
  gap: 9px;
  max-height: 390px;
  padding-top: 5px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.finance-payment-card {
  display: grid;
  grid-template-columns: var(--student-card-color-width) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--student-card-border);
  border-radius: 14px;
  background: var(--student-card-background);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease-in-out, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.finance-payment-card:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--student-card-border));
  background: var(--student-card-hover-background);
  box-shadow: var(--student-card-hover-shadow);
}

@media (hover: hover) and (pointer: fine) {
  .student-row:not(.is-dragging):hover,
  .finance-row.student-finance-card:hover,
  .finance-payment-card:hover,
  .student-profile-card:hover,
  .group-member-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--student-card-hover-shadow);
  }
}

@media (prefers-reduced-motion: reduce) {
  .student-row,
  .finance-row.student-finance-card,
  .finance-payment-card,
  .student-profile-card,
  .group-member-item {
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  }

  .student-row:not(.is-dragging):hover,
  .finance-row.student-finance-card:hover,
  .finance-payment-card:hover,
  .student-profile-card:hover,
  .group-member-item:hover {
    transform: none;
  }
}

.finance-payment-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.finance-payment-main strong,
.finance-payment-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-payment-main strong {
  font-size: 13px;
}

.finance-payment-main small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.finance-payment-amount {
  font-size: 15px;
  font-weight: 900;
}

@media (max-width: 760px) {
  body[data-mobile-screen="calendar"] {
    --hour-height: 56px;
    height: 100dvh;
    padding-bottom: 0;
    overflow: hidden;
  }

  body[data-mobile-screen="calendar"] .app-shell {
    height: 100dvh;
    min-height: 0;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
    overflow: hidden;
  }

  body[data-mobile-screen="calendar"] .workspace {
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body[data-mobile-screen="calendar"] .calendar-board {
    height: 100%;
    min-height: 0;
    max-height: none;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--surface);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body[data-mobile-screen="calendar"] .week-view {
    grid-template-columns: 43px repeat(7, minmax(41px, 1fr));
    gap: 0;
    min-width: max(100%, 330px);
    border-top: 1px solid var(--line);
  }

  body[data-mobile-screen="calendar"] .week-view > .time-rail {
    position: sticky;
    left: 0;
    z-index: 3;
    display: block;
    padding-top: 54px;
    background: var(--surface);
    border-right: 1px solid color-mix(in srgb, var(--ink) 20%, var(--line));
  }

  body[data-mobile-screen="calendar"] .time-label {
    position: relative;
    padding: 0 5px 0 0;
    color: var(--ink);
    font-size: clamp(10px, 2.8vw, 13px);
    line-height: 1;
  }

  body[data-mobile-screen="calendar"] .time-label::after {
    content: "";
    position: absolute;
    top: 0;
    right: -5px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--ink);
  }

  body[data-mobile-screen="calendar"] .day-column {
    display: block;
    min-width: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  body[data-mobile-screen="calendar"] .day-column-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: stretch;
    gap: 0;
    height: 54px;
    min-height: 54px;
    padding: 6px;
    border: 0;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  body[data-mobile-screen="calendar"] .day-column-header.is-today {
    background: color-mix(in srgb, var(--accent) 16%, var(--surface));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 42%, transparent);
  }

  body[data-mobile-screen="calendar"] .day-header-button {
    display: grid;
    grid-template-rows: auto auto;
    align-self: stretch;
    justify-self: stretch;
    align-content: center;
    justify-items: center;
    row-gap: 4px;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    line-height: 1;
  }

  body[data-mobile-screen="calendar"] .day-header-main {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
    color: var(--ink);
    font-size: clamp(10px, 2.8vw, 13px);
    font-weight: 900;
  }

  body[data-mobile-screen="calendar"] .day-header-weekday {
    min-width: 0;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
  }

  body[data-mobile-screen="calendar"] .day-column-header.is-today .day-header-main {
    color: var(--accent);
  }

  body[data-mobile-screen="calendar"] .day-header-status {
    justify-self: center;
    align-self: center;
    overflow: visible;
    max-width: none;
    color: var(--muted);
    font-size: clamp(7.5px, 2vw, 9px);
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
  }

  body[data-mobile-screen="calendar"] .mobile-time-rail {
    display: none;
  }

  body[data-mobile-screen="calendar"] .day-column .day-track {
    min-height: calc(var(--hour-height) * var(--visible-hours));
    border-left: 0;
    border-right: 1px solid var(--line);
    background:
      repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent calc(var(--hour-height) - 1px),
        var(--line) calc(var(--hour-height) - 1px),
        var(--line) var(--hour-height)
      );
  }

  body[data-mobile-screen="calendar"] .slot-button {
    height: var(--hour-height);
  }

  body[data-mobile-screen="calendar"] .day-track,
  body[data-mobile-screen="calendar"] .slot-button,
  body[data-mobile-screen="calendar"] .lesson-card {
    touch-action: none;
  }

  body[data-mobile-screen="calendar"] .lesson-card {
    left: 1px;
    right: 1px;
    gap: 1px;
    min-width: 0;
    min-height: 0;
    padding: 5px 4px;
    border-width: 1px;
    border-left-width: 3px;
    border-radius: 8px;
    box-shadow: none;
    transform-origin: center center;
  }

  body[data-mobile-screen="calendar"] .lesson-card:hover {
    transform: none;
    box-shadow: none;
  }

  body[data-mobile-screen="calendar"] .lesson-card.is-drag-armed,
  body[data-mobile-screen="calendar"] .lesson-card.is-dragging {
    z-index: 24;
    outline: none;
    filter: brightness(1.08);
    box-shadow: none;
  }

  body[data-mobile-screen="calendar"] .lesson-card.is-dragging {
    transform: translate3d(var(--lesson-drag-x, 0), var(--lesson-drag-y, 0), 0);
  }

  body[data-mobile-screen="calendar"] .lesson-card strong,
  body[data-mobile-screen="calendar"] .lesson-card-time,
  body[data-mobile-screen="calendar"] .lesson-card-price {
    overflow: hidden;
    overflow-wrap: break-word;
    text-overflow: clip;
    white-space: normal;
    word-break: normal;
    hyphens: auto;
  }

  body[data-mobile-screen="calendar"] .lesson-card strong {
    font-size: clamp(9px, 2.45vw, 11px);
    line-height: 1.1;
  }

  body[data-mobile-screen="calendar"] .lesson-card .lesson-card-student {
    overflow-wrap: normal;
    word-break: normal;
    hyphens: manual;
  }

  body[data-mobile-screen="calendar"] .lesson-card-time {
    font-size: clamp(6px, 1.8vw, 8px) !important;
    line-height: 1.1;
    letter-spacing: -0.04em;
  }

  body[data-mobile-screen="calendar"] .lesson-card-price {
    right: 3px;
    bottom: 3px;
    max-width: calc(100% - 6px);
    font-size: clamp(7px, 1.9vw, 8.5px) !important;
    line-height: 1.1;
    letter-spacing: -0.035em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-mobile-screen="calendar"] .current-time-marker {
    z-index: 8;
  }

  body[data-mobile-screen="calendar"] .current-time-marker::before {
    left: -4px;
  }

  body[data-mobile-screen] {
    padding-bottom: var(--mobile-nav-clearance);
  }

  .mobile-tabbar {
    position: fixed;
    z-index: 900;
    left: 50%;
    right: auto;
    bottom: var(--mobile-nav-bottom-offset);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    width: auto;
    padding: 5px 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    box-shadow: 0 18px 40px rgba(25, 32, 34, 0.2);
    transform: translateX(-50%);
    backdrop-filter: blur(18px);
  }

  .mobile-tab {
    display: grid;
    justify-items: center;
    place-items: center;
    gap: 0;
    min-width: 0;
    min-height: 32px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
  }

  body.is-mobile-nav-editing .mobile-tabbar {
    z-index: 920;
    border-color: color-mix(in srgb, var(--accent) 46%, var(--line));
  }

  body.is-mobile-nav-editing .mobile-tab {
    cursor: grab;
    touch-action: none;
  }

  body.is-mobile-nav-editing .mobile-tab.is-dragging {
    opacity: 0.42;
  }

  body.is-mobile-nav-editing .mobile-tab.is-drop-target .mobile-tab-icon {
    outline: 2px solid color-mix(in srgb, var(--accent) 72%, transparent);
    outline-offset: 2px;
  }

  .mobile-tab > span:not(.mobile-tab-icon) {
    display: none;
  }

  .mobile-tab-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--muted);
    font-size: 10px;
    line-height: 1;
  }

  .mobile-tab-icon .app-icon {
    display: block;
    width: 20px;
    height: 20px;
    pointer-events: none;
  }

  .mobile-tab-icon .themed-icon {
    width: 21px;
    height: 21px;
  }

  .mobile-tab-icon .mobile-settings-icon {
    width: 21px;
    height: 21px;
    font-size: 19px;
  }

  .mobile-tab.is-active {
    background: transparent;
    color: var(--accent);
  }

  .mobile-tab.is-active .mobile-tab-icon {
    background: var(--accent);
    color: var(--accent-ink);
  }

  body[data-mobile-screen="calendar"] .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 42px;
    grid-template-areas:
      "views dates add";
    column-gap: 8px;
    row-gap: 0;
    align-items: center;
    padding: 9px;
  }

  body[data-mobile-screen="calendar"] .calendar-controls {
    display: contents;
  }

  body[data-mobile-screen="calendar"] .calendar-controls .segmented {
    grid-area: views;
    justify-self: start;
    gap: 3px;
    padding: 3px;
    border-radius: 999px;
    flex: 0 0 auto;
    width: auto;
  }

  body[data-mobile-screen="calendar"] .view-option.is-active {
    background: var(--calendar-view-active-bg);
    border-color: var(--calendar-view-active-border);
    color: var(--calendar-view-active-ink);
    box-shadow: var(--calendar-view-active-shadow);
  }

  body[data-mobile-screen="calendar"] .view-option {
    flex: 0 0 auto;
    width: 30px;
    min-width: 30px;
    min-height: 30px;
    border-radius: 999px;
  }

  body[data-mobile-screen="calendar"] .view-icon {
    width: 18px;
    height: 18px;
  }

  body[data-mobile-screen="calendar"] .date-controls {
    grid-area: dates;
    display: grid;
    grid-template-columns: 32px minmax(70px, 1fr) 32px;
    gap: 5px;
    align-items: center;
    width: 100%;
    min-width: 0;
  }

  body[data-mobile-screen="calendar"] .range-button {
    min-width: 0;
    justify-self: center;
    width: 100%;
    min-height: 34px;
    padding: 0 6px;
    font-size: clamp(11px, 2.8vw, 13px);
  }

  body[data-mobile-screen="calendar"] .date-controls .nav-button {
    width: 32px;
    min-width: 32px;
    min-height: 32px;
    font-size: 26px;
  }

  body[data-mobile-screen="calendar"] .day-view {
    grid-template-columns: 43px minmax(0, 1fr);
    gap: 0;
  }

  body[data-mobile-screen="calendar"] .day-view .day-details {
    display: none;
  }

  .mobile-add-action {
    display: grid;
    flex: 0 0 42px;
    place-items: center;
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    margin: 0;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: 0 16px 34px rgba(25, 32, 34, 0.22);
  }

  .mobile-add-action .mobile-add-label {
    display: none;
  }

  .mobile-add-action .mobile-add-icon {
    display: block;
    width: 22px;
    height: 22px;
    background: currentColor;
    -webkit-mask: url("/assets/icons/add.svg?v=1") center / 22px 22px no-repeat;
    mask: url("/assets/icons/add.svg?v=1") center / 22px 22px no-repeat;
  }

  body[data-mobile-screen="calendar"] .add-lesson-button {
    position: static;
    grid-area: add;
    justify-self: end;
    align-self: center;
  }

  body[data-mobile-screen="students"] {
    height: 100dvh;
    overflow: hidden;
  }

  body[data-mobile-screen="finances"] {
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-shell {
    display: block;
    min-height: 100dvh;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) calc(62px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .sidebar,
  .workspace {
    display: block;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .brand,
  .stats-panel,
  .students-panel,
  .workspace {
    display: none;
  }

  body[data-mobile-screen="calendar"] .workspace,
  body[data-mobile-screen="students"] .students-panel,
  body[data-mobile-screen="finances"] .stats-panel {
    display: grid;
  }

  body[data-mobile-screen="students"] .app-shell {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body[data-mobile-screen="finances"] .app-shell {
    min-height: 100dvh;
    overflow: visible;
  }

  body[data-mobile-screen="students"] .sidebar {
    display: grid;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body[data-mobile-screen="finances"] .sidebar {
    display: block;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  body[data-mobile-screen="students"] .students-panel {
    align-content: stretch;
    gap: 10px;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
    position: relative;
  }

  body[data-mobile-screen="finances"] .stats-panel {
    box-sizing: border-box;
    align-content: start;
    grid-template-rows: auto;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  body[data-mobile-screen="finances"] .stats-panel .metrics,
  body[data-mobile-screen="finances"] .finance-open-button {
    display: none;
  }

  body[data-mobile-screen="students"] .students-list {
    display: grid;
    align-content: start;
    gap: 10px;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    margin-top: 8px;
    padding-right: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  body[data-mobile-screen="students"] .student-row,
  body[data-mobile-screen="students"] .group-row {
    width: 100%;
    border-radius: 18px;
    box-shadow: 0 8px 22px rgba(25, 32, 34, 0.08);
  }

  body[data-mobile-screen="students"] .student-row {
    padding: 0;
    background: var(--student-card-background);
  }

  body[data-mobile-screen="students"] .group-row {
    --group-toggle-width: 48px;
    padding: 0;
    border: 1px solid var(--student-card-border);
    border-radius: 18px;
    background: var(--group-card-background);
    box-shadow: 0 8px 22px rgba(25, 32, 34, 0.08);
  }

  body[data-mobile-screen="students"] .group-header {
    border-radius: 0;
    box-shadow: none;
  }

  body[data-mobile-screen="students"] .student-link {
    grid-template-columns: var(--student-list-color-width) minmax(0, 1fr) auto;
  }

  body[data-mobile-screen="students"] .students-list .group-link {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  body[data-mobile-screen="students"] .group-toggle {
    width: var(--group-toggle-width);
    min-width: var(--group-toggle-width);
    min-height: 58px;
  }

  body[data-mobile-screen="students"] .group-members {
    gap: 7px;
    padding-top: 8px;
    padding-right: 8px;
    padding-bottom: 8px;
    padding-left: 8px;
  }

  body[data-mobile-screen="students"] .group-members .student-row {
    border-radius: 14px;
    box-shadow: none;
  }

  body[data-mobile-screen="finances"] .student-finance-card,
  body[data-mobile-screen="finances"] .finance-payment-card {
    padding: 0;
    border-radius: 18px;
  }

  body[data-mobile-screen="students"] .student-link-text strong {
    font-size: 15px;
  }

  body[data-mobile-screen="students"] .student-link-text span {
    font-size: 12px;
  }

  body[data-mobile-screen="students"] .student-balance-mini {
    font-size: 13px;
  }

  body[data-mobile-screen="students"] .add-entity-button {
    position: absolute;
    top: 17px;
    right: 9px;
    z-index: 2;
  }

  body[data-mobile-screen="students"] .students-panel > .section-head {
    min-height: 42px;
    padding-right: 52px;
  }

  body[data-mobile-screen="students"] .students-panel > .section-head [data-action="open-archive"] {
    display: none;
  }

  body[data-mobile-screen="students"] .mobile-archive-row {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 42px;
    margin-top: 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-strong);
  }

  body[data-mobile-screen="profile"] .desktop-layout-setting {
    display: grid;
  }

  body[data-mobile-screen="students"] .sidebar {
    display: grid;
  }

  body[data-mobile-screen="profile"] .app-shell {
    display: none;
  }

  .workspace,
  .panel,
  body[data-mobile-screen="profile"] #settingsDialog {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(25, 32, 34, 0.08);
  }

  .panel {
    gap: 12px;
    min-height: calc(100dvh - 104px);
    padding: 14px;
  }

  .students-panel .section-head,
  .stats-panel .section-head {
    padding-bottom: 2px;
  }

  .students-panel .section-head h2,
  .stats-panel .section-head h2 {
    font-size: 22px;
  }

  .students-list {
    max-height: none;
    margin-top: 4px;
    padding-right: 0;
    overflow: visible;
  }

  body[data-mobile-screen="students"] .app-shell {
    box-sizing: border-box;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    height: 100dvh;
    min-height: 0;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
    overflow: hidden;
  }

  body[data-mobile-screen="students"] .sidebar {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  body[data-mobile-screen="students"] .students-panel {
    box-sizing: border-box;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    margin: 0;
    overflow: hidden;
  }

  body[data-mobile-screen="students"] .students-list {
    align-self: stretch;
    box-sizing: border-box;
    height: auto;
    max-height: none;
    min-height: 0;
    padding-bottom: var(--mobile-nav-clearance);
    overflow-x: hidden;
    overflow-y: auto;
    scroll-padding-bottom: var(--mobile-nav-clearance);
    touch-action: pan-y;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .topbar {
    position: sticky;
    top: max(8px, env(safe-area-inset-top));
    z-index: 30;
    margin: 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
  }

  .calendar-board {
    min-height: calc(100dvh - 176px);
    padding: 10px;
  }

  .finance-details {
    display: grid;
    gap: 10px;
  }

  body[data-mobile-screen="finances"] .finance-details {
    align-content: start;
    box-sizing: border-box;
    height: auto;
    max-height: none;
    min-height: 0;
    padding-bottom: var(--mobile-nav-clearance);
    scroll-padding-bottom: var(--mobile-nav-clearance);
    overflow: visible;
  }

  body[data-mobile-screen="finances"] .finance-list,
  body[data-mobile-screen="finances"] .finance-payment-list {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: auto;
    scrollbar-width: thin;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  body[data-mobile-screen="finances"] .finance-list {
    height: 188px;
    max-height: 188px;
  }

  body[data-mobile-screen="finances"] .finance-payment-list {
    height: 197px;
    max-height: 197px;
  }

  body[data-mobile-screen="finances"] .finance-list > .student-finance-card,
  body[data-mobile-screen="finances"] .finance-payment-list > .finance-payment-card {
    height: 58px;
    min-height: 58px;
  }

  body[data-mobile-screen="finances"] .finance-chart-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    justify-content: stretch;
    justify-items: stretch;
    gap: 10px;
    width: 100%;
    min-width: 0;
  }

  body[data-mobile-screen="finances"] .finance-chart-card {
    padding: 12px 10px;
  }

  body[data-mobile-screen="finances"] .finance-chart-title-row {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    justify-content: stretch;
    justify-items: stretch;
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  body[data-mobile-screen="finances"] .finance-chart-title-row h3 {
    font-size: 15px;
    line-height: 1;
  }

  body[data-mobile-screen="finances"] .finance-chart-controls {
    display: grid !important;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    align-items: center;
    justify-content: stretch;
    justify-items: stretch;
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  body[data-mobile-screen="finances"] .finance-chart-nav {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
  }

  body[data-mobile-screen="finances"] .finance-chart-range {
    display: grid;
    place-items: center;
    justify-self: stretch;
    width: 100%;
    min-width: 0;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
  }

  body[data-mobile-screen="finances"] .finance-chart-mode-toggle {
    display: flex;
    justify-self: stretch;
    min-width: 0;
    width: 100%;
    max-width: none;
    padding: 2px;
  }

  body[data-mobile-screen="finances"] .finance-chart-mode-toggle button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 31px;
    padding: 0 4px;
    font-size: 10px;
  }

  body[data-mobile-screen="finances"] .finance-chart {
    gap: 2px;
  }

  body[data-mobile-screen="finances"] .finance-chart-svg {
    min-height: 190px;
  }

  body[data-mobile-screen="finances"] .finance-chart-y-label {
    font-size: 12px;
  }

  body[data-mobile-screen="finances"] .finance-chart-labels {
    height: 16px;
    margin-top: -12px;
    font-size: 10px;
  }

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

  body:not([data-mobile-screen="finances"]) .finance-details {
    display: none;
  }

  body[data-mobile-screen="profile"] #settingsDialog,
  body[data-mobile-screen="profile"] #settingsDialog:not([open]) {
    position: static;
    display: block;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    margin: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) calc(62px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    padding: 0;
    overflow: visible;
    transform: none;
  }

  body[data-mobile-screen="profile"] #settingsDialog::backdrop {
    display: none;
  }

  body[data-mobile-screen="profile"] #settingsDialog .student-profile-form {
    padding: 14px;
  }

  body[data-mobile-screen="profile"] #settingsDialog .dialog-head {
    position: static;
    margin: -14px -14px 0;
    border-radius: 18px 18px 0 0;
  }

  body[data-mobile-screen="profile"] #settingsDialog .dialog-head .ghost,
  body[data-mobile-screen="profile"] #settingsDialog .dialog-actions {
    display: none;
  }

  body[data-mobile-screen="profile"] #settingsDialog .dialog-head h2 {
    font-size: 22px;
  }

  body[data-mobile-screen="profile"] .customization-block {
    order: 1;
  }

  body[data-mobile-screen="profile"] .pricing-block {
    order: 2;
  }

  body[data-mobile-screen="profile"] .subjects-block {
    order: 3;
  }

  body[data-mobile-screen="profile"] .settings-account-panel {
    order: 4;
  }
}

.auth-actions {
  align-items: center;
  flex-direction: row;
  justify-content: flex-end;
}

.auth-actions .primary-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 104px;
}

.students-inline-archive {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.inline-archive-head {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.inline-archive-head .icon-button {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  font-size: 28px;
  line-height: 1;
}

.inline-archive-head strong {
  color: var(--ink);
  font-size: 18px;
}

.inline-archive-empty {
  display: grid;
  place-items: center;
  min-height: 110px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
}

@media (max-width: 760px) {
  #addEntityDialog.student-dialog {
    box-sizing: border-box;
    width: 100dvw;
    max-width: 100dvw;
  }

  .auth-page-body {
    overflow: auto;
  }

  .auth-route-page {
    align-items: stretch;
    padding: max(14px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .auth-route-shell {
    align-content: start;
    min-height: calc(100dvh - 28px);
  }

  .auth-route-panel {
    padding: 14px;
  }

  .auth-route-brand {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .auth-route-mark {
    width: 48px;
    height: 48px;
  }

  .auth-route-logo {
    width: 30px;
    height: 30px;
  }

  .auth-route-brand h1 {
    font-size: 26px;
  }

  .auth-route-form-container {
    min-height: 0;
  }

  .lesson-dialog,
  .student-dialog,
  .auth-dialog,
  .scope-dialog,
  .color-dialog,
  .topup-dialog,
  .add-entity-dialog,
  .settings-dialog,
  .admin-dialog,
  .layout-dialog,
  .archive-dialog {
    position: fixed;
    inset: 0;
    width: 100dvw;
    max-width: 100dvw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    transform: none;
  }

  .student-dialog.dialog-fallback-open,
  .lesson-dialog.dialog-fallback-open {
    inset: 0;
    left: 0;
    width: 100dvw;
    max-width: 100dvw;
    height: 100dvh;
    max-height: 100dvh;
    transform: none;
  }

  .lesson-form {
    gap: 16px;
    box-sizing: border-box;
    height: 100dvh;
    max-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    padding-top: calc(66px + env(safe-area-inset-top));
    padding-bottom: var(--mobile-dialog-footer-safe-space);
    scroll-padding-bottom: var(--mobile-dialog-footer-safe-space);
    background: var(--surface);
  }

  .lesson-dialog .student-profile-form,
  .student-dialog .student-profile-form {
    box-sizing: border-box;
    height: 100dvh;
    max-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    padding-top: calc(66px + env(safe-area-inset-top));
    padding-bottom: var(--mobile-dialog-footer-safe-space);
    scroll-padding-bottom: var(--mobile-dialog-footer-safe-space);
    background: var(--surface);
  }

  .lesson-dialog .dialog-head,
  .student-dialog .dialog-head {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 6;
    box-sizing: border-box;
    margin: 0;
    padding-top: 10px;
    padding-right: 12px;
    padding-bottom: 10px;
    padding-left: 12px;
    background: var(--surface);
    box-shadow: 0 10px 22px color-mix(in srgb, var(--surface) 86%, transparent);
  }

  .lesson-dialog .dialog-head h2,
  .student-dialog .dialog-head h2 {
    font-size: 18px;
    line-height: 1.12;
  }

  .lesson-dialog .dialog-head .eyebrow,
  .student-dialog .dialog-head .eyebrow {
    font-size: 10px;
  }

  .lesson-dialog .dialog-head .icon-button.ghost,
  .student-dialog .dialog-head .icon-button.ghost {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    border-radius: 12px;
  }

  .lesson-dialog .dialog-actions,
  .student-dialog .dialog-actions {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 6;
    box-sizing: border-box;
    margin: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface);
    box-shadow: 0 -10px 22px color-mix(in srgb, var(--surface) 84%, transparent);
  }

  .lesson-dialog .dialog-actions .primary-button,
  .lesson-dialog .dialog-actions .secondary-button,
  .lesson-dialog .dialog-actions .danger-button,
  .student-dialog .dialog-actions .primary-button,
  .student-dialog .dialog-actions .secondary-button,
  .student-dialog .dialog-actions .danger-button {
    min-height: 44px;
    padding-block: 0;
  }

  #lessonDialog .dialog-head {
    padding-bottom: 10px;
  }

  #lessonDialog .form-grid {
    row-gap: 16px;
    padding: 2px 0 8px;
  }

  #lessonDialog .lesson-date-field,
  #lessonDialog .lesson-time-row {
    grid-column: 1 / -1;
  }

  #lessonDialog .lesson-time-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #lessonDialog .lesson-actions {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding-top: 10px;
  }

  #lessonDialog .lesson-main-actions {
    display: flex;
    justify-content: flex-end;
    width: auto;
  }

  #lessonDialog .lesson-main-actions > button {
    width: auto;
    min-width: 112px;
    padding-inline: 14px;
  }

  #lessonDialog .lesson-delete-icon {
    justify-self: start;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  #studentDialog .student-profile-top-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: end;
    gap: 10px;
  }

  #studentDialog.student-dialog {
    position: fixed;
    inset: 0;
    width: 100dvw;
    max-width: 100dvw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    overflow: hidden;
  }

  #studentDialog .student-profile-form {
    box-sizing: border-box;
    height: 100dvh;
    max-height: 100dvh;
    padding: 0;
    background: var(--surface);
  }

  #studentDialog .student-edit-top-row label,
  #studentDialog .student-edit-lesson-row label,
  #studentDialog .student-profile-extra label {
    gap: 6px;
    min-height: 0;
  }

  #studentDialog select,
  #studentDialog input,
  #studentDialog textarea {
    min-height: 42px;
    font-size: 15px;
  }

  #studentDialog textarea {
    min-height: 82px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  #studentDialog .student-edit-additional {
    padding: 10px;
    border-radius: 16px;
  }

  #studentDialog .dialog-head {
    position: static;
    z-index: 6;
    box-sizing: border-box;
    margin: 0;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    background: var(--surface);
    box-shadow: 0 10px 22px color-mix(in srgb, var(--surface) 86%, transparent);
  }

  #studentDialog .student-profile-scroll {
    gap: 12px;
    padding: 12px;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  #studentDialog .dialog-head h2 {
    font-size: 21px;
  }

  #studentDialog .student-color-button {
    grid-column: 2;
    justify-self: end;
    align-self: end;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  #studentDialog .student-profile-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #studentDialog .profile-panel {
    overflow: hidden;
  }

  #studentDialog #studentLedger,
  #studentDialog #studentUpcomingLessons {
    touch-action: pan-y;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #studentDialog .student-history-list .ledger-item.student-profile-card {
    min-height: 64px;
    max-height: none;
  }

  #studentDialog .student-history-list .student-profile-card-main {
    padding-block: 8px;
  }

  #studentDialog .student-history-list .student-profile-card-main small {
    display: -webkit-box;
    overflow: hidden;
    line-height: 1.25;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  #studentDialog .student-history-list .student-profile-card-value {
    padding-right: 10px;
    font-size: 12px;
  }

  #studentDialog .dialog-actions {
    display: flex;
    position: static;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-sizing: border-box;
    margin: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface);
    box-shadow: 0 -10px 22px color-mix(in srgb, var(--surface) 84%, transparent);
  }

  #studentDialog .student-profile-actions {
    display: grid;
    grid-template-columns: repeat(2, 44px);
    flex: 0 0 auto;
    width: auto;
  }

  #studentDialog .student-profile-action-button {
    display: grid;
    place-items: center;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
  }

  #studentDialog .student-profile-action-button .student-action-label {
    display: none;
  }

  #studentDialog .student-profile-action-button .app-icon {
    display: block;
    width: 21px;
    height: 21px;
  }

  #studentDialog .dialog-actions > .dialog-main-actions:last-child {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    width: auto;
  }

  #studentDialog .dialog-actions > .dialog-main-actions:last-child .secondary-button {
    width: auto;
    min-width: 86px;
    padding-inline: 14px;
  }

  .topup-dialog {
    position: fixed;
    inset: auto;
    top: 50%;
    left: 50%;
    width: min(calc(100dvw - 28px), 430px);
    max-width: calc(100dvw - 28px);
    height: auto;
    max-height: calc(100dvh - 28px);
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    transform: translate(-50%, -50%);
  }

  .topup-dialog.dialog-fallback-open {
    inset: auto;
    top: 50%;
    left: 50%;
    width: min(calc(100dvw - 28px), 430px);
    max-width: calc(100dvw - 28px);
    height: auto;
    max-height: calc(100dvh - 28px);
    transform: translate(-50%, -50%);
  }

  .topup-dialog .student-profile-form {
    align-content: start;
    height: auto;
    max-height: calc(100dvh - 30px);
    padding: 14px;
    overflow-y: auto;
  }

  .topup-dialog .dialog-head,
  .topup-dialog .dialog-actions {
    position: static;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .topup-dialog #topupDialogTitle {
    display: none;
  }

  .topup-dialog .dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .student-action-dialog .dialog-note {
    min-height: 0;
    max-height: 14dvh;
    overflow-y: auto;
  }

  .compact-action-dialog,
  .compact-action-dialog.dialog-fallback-open {
    position: fixed;
    inset: auto;
    top: 50%;
    left: 50%;
    width: min(calc(100dvw - 28px), 430px);
    max-width: calc(100dvw - 28px);
    height: fit-content;
    max-height: min(50dvh, 420px);
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    transform: translate(-50%, -50%);
  }

  .compact-action-dialog .student-profile-form {
    grid-template-rows: auto auto auto;
    align-content: start;
    box-sizing: border-box;
    height: fit-content;
    max-height: min(calc(50dvh - 2px), 418px);
    padding: 14px;
    overflow: hidden;
    background: var(--surface);
  }

  .compact-action-dialog .dialog-head,
  .compact-action-dialog .compact-action-actions {
    position: static;
    inset: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .compact-action-dialog .dialog-note {
    min-height: 0;
    overflow-y: auto;
    overflow-wrap: anywhere;
  }

  .compact-action-dialog .compact-action-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #deleteScopeDialog .compact-action-actions:not(.is-compact) {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .compact-action-dialog .compact-action-actions button {
    min-height: 44px;
    padding: 0 14px;
  }

  .compact-action-dialog .compact-action-close {
    display: grid;
  }

  #deleteScopeDialog .danger-button,
  #studentActionDialog.compact-action-dialog #studentActionConfirmButton {
    background: color-mix(in srgb, var(--unpaid) 12%, var(--surface));
    color: var(--unpaid);
    border: 1px solid color-mix(in srgb, var(--unpaid) 36%, var(--line));
    font-weight: 800;
  }

  #deleteScopeDialog .danger-button:hover,
  #studentActionDialog.compact-action-dialog #studentActionConfirmButton:hover {
    background: color-mix(in srgb, var(--unpaid) 20%, var(--surface));
    border-color: color-mix(in srgb, var(--unpaid) 58%, var(--line));
  }

  body {
    --mobile-nav-height: 56px;
    --mobile-nav-bottom-offset: max(8px, env(safe-area-inset-bottom));
    --mobile-nav-comfort-space: 16px;
    --mobile-nav-safe-space: calc(var(--mobile-nav-height) + var(--mobile-nav-bottom-offset) + var(--mobile-nav-comfort-space));
    --mobile-nav-clearance: var(--mobile-nav-safe-space);
    --mobile-dialog-footer-safe-space: calc(70px + env(safe-area-inset-bottom));
  }

  body[data-mobile-screen] {
    padding-bottom: var(--mobile-nav-clearance);
  }

  body[data-mobile-screen] .app-shell {
    padding-bottom: var(--mobile-nav-clearance);
  }

  .mobile-tabbar {
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
  }

  .mobile-tab {
    grid-template-rows: minmax(0, 1fr);
    align-content: center;
    justify-content: center;
    min-height: 42px;
    line-height: 1;
  }

  .mobile-tab-icon {
    align-self: center;
    justify-self: center;
    width: 42px;
    height: 42px;
  }

  .mobile-tab-icon .app-icon {
    width: 26px;
    height: 26px;
  }

  .mobile-tab-icon .themed-icon {
    width: 27px;
    height: 27px;
  }

  .mobile-tab-icon .mobile-settings-icon {
    width: 27px;
    height: 27px;
    font-size: 24px;
  }

  body[data-mobile-screen="students"] .students-panel {
    gap: 8px;
  }

  body[data-mobile-screen="students"] .students-list {
    gap: 8px;
    margin-top: 0;
    padding-bottom: var(--mobile-nav-clearance);
    scroll-padding-bottom: var(--mobile-nav-clearance);
  }

  body[data-mobile-screen="finances"] .stats-panel {
    min-height: auto;
  }

  body[data-mobile-screen="finances"] .finance-details {
    gap: 8px;
    padding-bottom: var(--mobile-nav-clearance);
    scroll-padding-bottom: var(--mobile-nav-clearance);
  }

  body[data-mobile-screen="finances"] {
    padding-bottom: 0;
  }

  body[data-mobile-screen="finances"] .app-shell {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  body[data-mobile-screen="finances"] .panel {
    min-height: auto;
  }

  body[data-mobile-screen="finances"] .finance-details {
    padding-bottom: var(--mobile-nav-clearance);
    scroll-padding-bottom: var(--mobile-nav-clearance);
  }

  body[data-mobile-screen="profile"] {
    padding-bottom: 0;
  }

  body[data-mobile-screen="profile"] #settingsDialog,
  body[data-mobile-screen="profile"] #settingsDialog:not([open]) {
    margin-bottom: max(8px, env(safe-area-inset-bottom));
  }

  body[data-mobile-screen="profile"] #settingsDialog .student-profile-form {
    gap: 10px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .students-inline-archive {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
  }

  .inline-archive-head {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 42px;
  }

  .inline-archive-head .icon-button {
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    font-size: 28px;
    line-height: 1;
  }

  .inline-archive-head strong {
    color: var(--ink);
    font-size: 18px;
  }

  .inline-archive-empty {
    min-height: 110px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-strong);
  }

  #addEntityDialog .add-entity-form {
    width: 100%;
    max-width: 100%;
    align-content: start;
    gap: 12px;
    padding-top: calc(62px + env(safe-area-inset-top));
    padding-bottom: var(--mobile-dialog-footer-safe-space);
    scroll-padding-bottom: var(--mobile-dialog-footer-safe-space);
    overflow-x: hidden;
  }

  #addEntityDialog .dialog-head {
    min-height: 0;
  }

  #addEntityDialog .dialog-head h2 {
    font-size: 19px;
  }

  #addEntityDialog .add-entity-top-row {
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 10px;
  }

  #addEntityDialog .add-entity-type-field {
    grid-column: 1 / -1;
  }

  #addEntityDialog .add-entity-lesson-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  #addEntityDialog .add-entity-top-row label,
  #addEntityDialog .add-entity-lesson-row label,
  #addEntityDialog .student-profile-extra label {
    gap: 6px;
    min-height: 0;
  }

  #addEntityDialog select,
  #addEntityDialog input,
  #addEntityDialog textarea {
    min-height: 42px;
    padding-top: 0;
    padding-bottom: 0;
    font-size: 15px;
  }

  #addEntityDialog textarea {
    min-height: 82px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  #addEntityDialog .add-entity-additional {
    padding: 10px;
    border-radius: 16px;
  }

  #addEntityDialog .dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 -10px 22px color-mix(in srgb, var(--surface) 84%, transparent);
  }

  #addEntityDialog .dialog-actions .secondary-button,
  #addEntityDialog .dialog-actions .primary-button {
    width: 100%;
    min-height: 44px;
    border-radius: 14px;
  }
}

@media (max-width: 480px) {
  #colorDialog.color-dialog,
  #colorDialog.color-dialog.dialog-fallback-open {
    position: fixed;
    inset: 50% auto auto 50%;
    width: min(calc(100dvw - 24px), 420px);
    max-width: calc(100dvw - 24px);
    min-height: 30dvh;
    height: fit-content;
    max-height: 40dvh;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    transform: translate(-50%, -50%);
  }

  #colorDialog .student-profile-form {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 10px;
    box-sizing: border-box;
    min-height: calc(30dvh - 2px);
    height: auto;
    max-height: calc(40dvh - 2px);
    padding: 12px;
    overflow: hidden;
    background: var(--surface);
  }

  #colorDialog .dialog-head,
  #colorDialog .dialog-actions {
    position: static;
    inset: auto;
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  #colorDialog .dialog-head {
    min-height: 40px;
  }

  #colorDialog .dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #colorDialog .dialog-actions .secondary-button,
  #colorDialog .dialog-actions .primary-button {
    width: 100%;
    min-height: 44px;
  }

  #colorDialog .color-presets {
    grid-template-columns: repeat(5, minmax(36px, 1fr));
    align-content: start;
    min-height: 0;
    padding: 4px;
    overflow-y: auto;
    overscroll-behavior-y: auto;
    scrollbar-width: thin;
  }
}

@media (max-width: 760px) {
  body[data-mobile-screen="profile"] #settingsDialog,
  body[data-mobile-screen="profile"] #settingsDialog:not([open]) {
    height: calc(100dvh - 78px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    max-height: calc(100dvh - 78px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body[data-mobile-screen="profile"] #settingsDialog .settings-form {
    grid-template-rows: auto minmax(0, 1fr) !important;
    gap: 0 !important;
    box-sizing: border-box;
    height: 100% !important;
    max-height: none !important;
    min-height: 0 !important;
    padding: 14px !important;
    overflow: hidden !important;
  }

  body[data-mobile-screen="profile"] #settingsDialog .settings-dialog-head {
    position: static !important;
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    min-height: 42px;
    margin: 0 !important;
    padding: 0 52px 2px 0 !important;
  }

  body[data-mobile-screen="profile"] #settingsDialog .settings-dialog-head > div {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    text-align: left;
  }

  body[data-mobile-screen="profile"] #settingsDialog .settings-dialog-head .settings-title-text {
    font-size: 22px !important;
  }

  body[data-mobile-screen="profile"] #settingsDialog .settings-dialog-head > .ghost:last-child {
    display: none !important;
  }

  body[data-mobile-screen="profile"] #settingsDialog .settings-layout {
    height: 100%;
    min-height: 0;
  }

  body[data-mobile-screen="profile"] #settingsDialog .settings-content-scroll {
    height: 100%;
    padding-bottom: var(--mobile-nav-clearance);
    scroll-padding-bottom: var(--mobile-nav-clearance);
  }
}

@media (max-width: 760px) {
  body {
    --mobile-nav-height: 56px;
    --mobile-nav-bottom-offset: max(8px, env(safe-area-inset-bottom));
    --mobile-nav-comfort-space: 16px;
    --mobile-nav-safe-space: calc(var(--mobile-nav-height) + var(--mobile-nav-bottom-offset) + var(--mobile-nav-comfort-space));
    --mobile-page-top-inset: max(8px, env(safe-area-inset-top));
    --mobile-page-right-inset: max(8px, env(safe-area-inset-right));
    --mobile-page-left-inset: max(8px, env(safe-area-inset-left));
    --mobile-nav-clearance: var(--mobile-nav-safe-space);
    --mobile-dialog-footer-safe-space: calc(70px + env(safe-area-inset-bottom));
  }

  body[data-mobile-screen="calendar"],
  body[data-mobile-screen="students"],
  body[data-mobile-screen="finances"],
  body[data-mobile-screen="profile"] {
    box-sizing: border-box;
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    padding: 0;
    overflow: hidden;
  }

  body[data-mobile-screen="calendar"] .app-shell,
  body[data-mobile-screen="students"] .app-shell,
  body[data-mobile-screen="finances"] .app-shell {
    box-sizing: border-box;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: var(--mobile-page-top-inset) var(--mobile-page-right-inset) 0 var(--mobile-page-left-inset);
    overflow: hidden;
  }

  body[data-mobile-screen="calendar"] .mobile-page--calendar,
  body[data-mobile-screen="students"] .mobile-page--students,
  body[data-mobile-screen="finances"] .mobile-page--finances {
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    margin: 0;
    overflow: hidden;
  }

  body[data-mobile-screen="calendar"] .mobile-page--calendar .mobile-scroll-container,
  body[data-mobile-screen="students"] .mobile-page--students .mobile-scroll-container,
  body[data-mobile-screen="finances"] .mobile-page--finances .mobile-scroll-container,
  body[data-mobile-screen="profile"] .mobile-page--profile .mobile-scroll-container {
    box-sizing: border-box;
    padding-bottom: var(--mobile-nav-clearance);
    scroll-padding-bottom: var(--mobile-nav-clearance);
  }

  body[data-mobile-screen="finances"] .mobile-page--finances {
    grid-template-rows: auto minmax(0, 1fr);
  }

  body[data-mobile-screen="finances"] .mobile-page--finances .mobile-scroll-container {
    align-self: stretch;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  body[data-mobile-screen="profile"] #settingsDialog.mobile-page--profile,
  body[data-mobile-screen="profile"] #settingsDialog.mobile-page--profile:not([open]) {
    box-sizing: border-box;
    height: calc(100dvh - var(--mobile-page-top-inset)) !important;
    max-height: calc(100dvh - var(--mobile-page-top-inset)) !important;
    margin: var(--mobile-page-top-inset) var(--mobile-page-right-inset) 0 var(--mobile-page-left-inset) !important;
  }

  body[data-mobile-screen="profile"] .mobile-page--profile .settings-mobile-home {
    padding-right: 8px;
    padding-left: 8px;
  }

  body[data-mobile-screen="students"] .mobile-page--students > .mobile-page-header,
  body[data-mobile-screen="finances"] .mobile-page--finances > .mobile-page-header {
    display: flex;
    align-items: center;
    min-height: 42px;
    margin: 0;
    padding: 0 52px 2px 0;
  }

  body[data-mobile-screen="finances"] .mobile-page--finances {
    gap: 8px;
  }

  body[data-mobile-screen="students"] .mobile-page--students > .mobile-page-header h2,
  body[data-mobile-screen="finances"] .mobile-page--finances > .mobile-page-header h2,
  body[data-mobile-screen="profile"] .mobile-page--profile .mobile-page-header .settings-title-text {
    margin: 0;
    font-size: 22px !important;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
  }

  body[data-mobile-screen="profile"] .mobile-page--profile .mobile-page-header {
    position: relative !important;
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    min-height: 42px;
    margin: 14px 14px 8px !important;
    padding: 0 52px 2px 0 !important;
    border-bottom: 0;
  }

  body[data-mobile-screen="profile"] .mobile-page--profile:not(.is-mobile-home) .mobile-page-header {
    padding: 0 52px 2px 0 !important;
  }

  body[data-mobile-screen="profile"] .mobile-page--profile .mobile-page-header > div,
  body[data-mobile-screen="profile"] .mobile-page--profile.is-mobile-home .mobile-page-header > div {
    flex: 1 1 auto;
    grid-column: auto;
    grid-row: auto;
    min-width: 0;
    text-align: left;
  }

  body[data-mobile-screen="profile"] .mobile-page--profile .settings-title-button {
    gap: 8px;
    height: auto;
    min-height: 0;
    min-width: 0;
    border-radius: 8px;
  }

  body[data-mobile-screen="profile"] .mobile-page--profile .settings-title-button:not(:disabled):active {
    color: var(--accent);
  }

  body[data-mobile-screen="profile"] .mobile-page--profile:not(.is-mobile-home) .settings-title-back-icon {
    display: block;
    width: 12px;
    height: 12px;
  }
}

@media (max-width: 340px) {
  #studentDialog .dialog-actions,
  #groupDialog .dialog-actions {
    flex-direction: column;
    align-items: stretch;
  }

  #studentDialog .dialog-main-actions,
  #groupDialog .dialog-main-actions {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
