:root {
  color-scheme: dark;
  --bg: #08090c;
  --panel: #11141b;
  --panel-2: #171b24;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f6fb;
  --muted: #8d94a6;
  --accent: #8be0c7;
  --accent-2: #d8b36a;
  --bad: #ff7b7b;
  --warn: #f0bd62;
  --ok: #71d991;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  width: 100%;
  height: 100%;
  min-height: var(--tg-viewport-stable-height, var(--tg-viewport-height, 100vh));
  margin: 0;
  padding: 0;
  overscroll-behavior-y: none;
}

html {
  background: var(--bg);
}

body {
  position: relative;
  isolation: isolate;
  min-height: var(--tg-viewport-stable-height, var(--tg-viewport-height, 100vh));
  background: transparent;
  color: var(--text);
  overflow-x: hidden;
  touch-action: pan-y;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(circle at 20% -10%, rgba(139, 224, 199, 0.18), transparent 34%),
    radial-gradient(circle at 110% 12%, rgba(216, 179, 106, 0.16), transparent 30%),
    var(--bg);
  content: "";
  pointer-events: none;
}

body.modal-open {
  position: fixed;
  width: 100%;
  overflow: hidden;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: var(--tg-viewport-stable-height, var(--tg-viewport-height, 100vh));
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) clamp(16px, 3vw, 40px) calc(108px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  z-index: 5;
  top: max(8px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid rgba(139, 224, 199, 0.12);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(139, 224, 199, 0.1), rgba(216, 179, 106, 0.045)),
    #0b0d12;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 16px 44px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
}

body.tg-webapp .app-shell {
  width: min(980px, 100%);
  padding-top: calc(max(100px, var(--tg-content-safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px), env(safe-area-inset-top)) + 8px);
  padding-inline: 10px;
}

body.tg-webapp .topbar {
  position: relative;
  top: auto;
  width: min(560px, calc(100% - 108px));
  min-height: 46px;
  margin-right: auto;
  margin-left: auto;
  padding: 8px 9px;
  border-radius: 16px;
}

body.tg-webapp .brand-lockup {
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 0 8px;
}

body.tg-webapp .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  font-size: 14px;
}

body.tg-webapp .brand-lockup p {
  display: none;
}

body.tg-webapp .brand-lockup h1 {
  align-self: center;
  font-size: 16px;
}

body.tg-webapp .icon-button {
  width: 32px;
  height: 32px;
}

body.tg-fullscreen .app-shell {
  padding-top: calc(max(108px, var(--tg-content-safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px), env(safe-area-inset-top)) + 8px);
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.topbar-submit-button {
  min-width: 72px;
  border: 1px solid rgba(139, 224, 199, 0.36);
  background: rgba(139, 224, 199, 0.14);
  color: var(--accent);
}

.topbar h1,
h2,
h3,
p {
  margin: 0;
}

.topbar h1 {
  font-size: 22px;
  letter-spacing: 0;
  line-height: 1.12;
}

.brand-lockup {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 2px 9px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  display: grid;
  grid-row: 1 / span 2;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(139, 224, 199, 0.3);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(139, 224, 199, 0.24), rgba(216, 179, 106, 0.12));
  color: var(--accent);
  cursor: pointer;
  font-size: 16px;
  font-weight: 950;
}

.brand-mark.active {
  border-color: rgba(139, 224, 199, 0.65);
  background: rgba(139, 224, 199, 0.18);
  box-shadow: 0 0 0 2px rgba(139, 224, 199, 0.08);
}

.brand-mark:disabled {
  cursor: default;
}

.brand-lockup p {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1.12;
  text-transform: uppercase;
}

.brand-lockup h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.icon-button,
.mini-button,
.primary-button,
.fab,
.fab-menu button,
.tabbar button,
.student-card,
.metric-button {
  border: 0;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.icon-button:active,
.mini-button:active,
.primary-button:active,
.fab:active,
.tabbar button:active,
.student-card:active {
  transform: scale(0.98);
}

.icon-button {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.hero-crm {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
  padding: 18px;
  border: 1px solid rgba(139, 224, 199, 0.14);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(139, 224, 199, 0.14), rgba(216, 179, 106, 0.08)),
    rgba(17, 20, 27, 0.86);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.24);
}

.hero-crm h2 {
  max-width: 620px;
  font-size: clamp(30px, 8vw, 52px);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-crm p {
  margin-top: 12px;
  color: var(--muted);
}

.hero-income {
  display: grid;
  gap: 6px;
  min-width: 124px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
}

.hero-income span,
.metric span,
.section-head span,
.item-subtitle,
.calendar-day h3,
label span {
  color: var(--muted);
  font-size: 12px;
}

.hero-income strong {
  font-size: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.metric {
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 20, 27, 0.92);
  color: var(--text);
  text-align: left;
}

.metric-button {
  width: 100%;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  line-height: 1.1;
}

.panel,
.drawer-panel {
  margin: 10px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 20, 27, 0.92);
}

.drawer-panel {
  scroll-margin-top: 86px;
}

.section-head,
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

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

.section-head h2,
.detail-head h2 {
  font-size: 20px;
}

.stack,
.student-grid {
  display: grid;
  gap: 8px;
}

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

.student-card,
.problem-card,
.lesson-row,
.homework-row,
.finance-row {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  text-align: left;
}

.student-card.selected {
  border-color: rgba(139, 224, 199, 0.55);
  background: rgba(139, 224, 199, 0.08);
}

.student-card strong,
.problem-card strong,
.lesson-row strong,
.homework-row strong,
.finance-row strong {
  font-size: 16px;
}

.student-card span,
.student-card em,
.problem-card p,
.lesson-row p,
.homework-row p,
.homework-row span,
.finance-row p {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.student-card em {
  color: var(--accent-2);
  font-weight: 800;
}

.problem-card,
.finance-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.lesson-row {
  grid-template-columns: 58px 1fr;
  align-items: start;
}

.lesson-row time {
  color: var(--accent);
  font-weight: 900;
}

.lesson-statuses,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  grid-column: 2;
}

.detail-head .row-actions,
.section-head .section-actions {
  grid-column: auto;
}

.detail-head .row-actions {
  flex-wrap: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  color: var(--muted);
  font-size: 11px;
}

.status.ok {
  color: var(--ok);
}

.status.warn {
  color: var(--warn);
}

.status.bad {
  color: var(--bad);
}

.calendar-day {
  display: grid;
  gap: 8px;
  padding: 4px 0 10px;
}

.calendar-day h3 {
  letter-spacing: 0.08em;
}

.calendar-panel {
  overflow: hidden;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  margin-bottom: 9px;
}

.calendar-title-block {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.calendar-title-block h2 {
  font-size: 22px;
  line-height: 1;
}

.calendar-title-block span {
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid rgba(139, 224, 199, 0.16);
  border-radius: 999px;
  background: rgba(139, 224, 199, 0.07);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.calendar-ghost-action,
.calendar-action {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  font-weight: 850;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.calendar-ghost-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: 12px;
}

.calendar-ghost-action span,
.calendar-action span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.calendar-ghost-action span {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
  font-size: 13px;
}

.calendar-action-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 14px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.18);
}

.calendar-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 36px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.calendar-action span {
  width: 20px;
  height: 20px;
  border-radius: 8px;
  background: rgba(139, 224, 199, 0.1);
  color: var(--accent);
  font-size: 13px;
  font-weight: 950;
}

.calendar-action.primary {
  border-color: rgba(139, 224, 199, 0.38);
  background: linear-gradient(135deg, rgba(139, 224, 199, 0.22), rgba(139, 224, 199, 0.1));
  color: var(--accent);
}

.calendar-action.primary span {
  background: var(--accent);
  color: #07100d;
}

.calendar-ghost-action:active,
.calendar-action:active {
  transform: scale(0.98);
}

.calendar-ghost-action:hover,
.calendar-action:hover {
  border-color: rgba(139, 224, 199, 0.34);
}

.filters {
  display: grid;
  grid-template-columns: 1fr 0.8fr 0.6fr;
  gap: 8px;
  margin: 0 0 10px;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  outline: none;
  padding: 11px;
}

input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="number"] {
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
}

input::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

select option {
  background: #11141b;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(139, 224, 199, 0.68);
  box-shadow: 0 0 0 3px rgba(139, 224, 199, 0.12);
}

.edit-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.edit-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.weekday-field {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.weekday-field legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.weekday-field label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.weekday-field input {
  width: auto;
}

.button-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.button-field legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.button-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.button-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.button-options label {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
}

.button-options input:checked + label {
  border-color: rgba(139, 224, 199, 0.48);
  background: rgba(139, 224, 199, 0.16);
  color: var(--accent);
}

.schedule-slots {
  display: grid;
  gap: 8px;
}

.schedule-slot-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 120px) 42px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  overflow: hidden;
}

.schedule-slot-row label,
.schedule-slot-row input,
.schedule-slot-row select {
  min-width: 0;
}

.edit-form .full,
.primary-button {
  grid-column: 1 / -1;
}

.primary-button,
.danger-button,
.mini-button {
  min-height: 38px;
  border-radius: var(--radius);
  font-weight: 850;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #5abda5);
  color: #07100d;
}

.mini-button {
  align-self: center;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.075);
  color: var(--text);
}

.danger-button {
  grid-column: 1 / -1;
  border: 1px solid rgba(255, 123, 123, 0.38);
  background: rgba(255, 123, 123, 0.1);
  color: var(--bad);
}

.mini-button:hover,
.student-card:hover {
  border-color: rgba(139, 224, 199, 0.28);
}

.detail-section {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.info-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.info-item span {
  color: var(--muted);
  font-size: 12px;
}

.info-item strong {
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.25;
}

.subsection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.subsection-head h3 {
  font-size: 15px;
}

.plan-list {
  display: grid;
  gap: 6px;
}

.plan-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 9px;
  align-items: start;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.plan-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.plan-row span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.plan-row small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.homework-row {
  grid-template-columns: 1fr auto;
}

.homework-row a {
  color: var(--accent);
  font-size: 13px;
}

.homework-detail {
  display: grid;
  gap: 12px;
}

.homework-detail p,
.homework-text {
  color: var(--muted);
  line-height: 1.45;
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.attachment-link {
  display: grid;
  place-items: center;
  min-height: 76px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--accent);
  font-size: 13px;
  overflow: hidden;
}

.attachment-preview {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
}

.empty-state,
.error-state,
.auth-panel {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
  text-align: center;
}

.empty-state h3,
.error-state h2,
.auth-panel h2 {
  font-size: 18px;
}

.empty-state p,
.error-state p,
.auth-panel p {
  max-width: 360px;
  color: var(--muted);
  font-size: 14px;
}

.auth-panel {
  max-width: 560px;
  margin-inline: auto;
}

.auth-panel .edit-form {
  width: min(100%, 440px);
  margin-top: 8px;
}

.auth-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.auth-divider {
  display: grid;
  width: min(100%, 440px);
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  background: var(--line);
  content: "";
}

.telegram-auth {
  display: grid;
  width: min(100%, 440px);
  gap: 10px;
  place-items: center;
}

.empty-mark {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(139, 224, 199, 0.18), rgba(216, 179, 106, 0.12));
}

.progress-chart-shell {
  --progress-plot-bottom: 38px;
  --progress-plot-top: 12px;
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  height: 184px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.progress-axis {
  position: relative;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.progress-axis-scale {
  position: absolute;
  inset: var(--progress-plot-top) 0 var(--progress-plot-bottom);
}

.progress-axis-scale span {
  position: absolute;
  right: 0;
  left: 0;
  line-height: 1;
  transform: translateY(-50%);
}

.progress-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 28px;
  align-items: end;
  gap: 7px;
  height: 100%;
  padding: var(--progress-plot-top) 12px 12px 4px;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.11) 0,
    rgba(255, 255, 255, 0.11) 1px,
    transparent 1px,
    transparent 20%
  );
  background-position: 0 var(--progress-plot-top);
  background-size: 100% calc(100% - var(--progress-plot-top) - var(--progress-plot-bottom));
  background-repeat: no-repeat;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 224, 199, 0.42) transparent;
}

.bar-wrap {
  display: grid;
  grid-template-rows: 1fr 20px;
  align-items: end;
  gap: 6px;
  height: 100%;
  min-width: 0;
}

.bar {
  justify-self: stretch;
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent), rgba(139, 224, 199, 0.36));
}

.bar-wrap span {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-chart.custom-progress {
  grid-auto-columns: 36px;
  gap: 7px;
}

.custom-progress .bar-wrap {
  grid-template-rows: 1fr 20px;
}

.custom-progress .bar {
  justify-self: stretch;
  width: auto;
  border-radius: 6px 6px 2px 2px;
}

.custom-progress .bar-wrap span {
  font-size: 10px;
  line-height: 1;
}

.progress-task-list {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.progress-notes {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.progress-notes summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  list-style: none;
}

.progress-notes summary::-webkit-details-marker {
  display: none;
}

.progress-notes summary::after {
  color: var(--muted);
  content: "+";
  font-size: 18px;
}

.progress-notes[open] summary::after {
  content: "−";
}

.progress-notes summary strong {
  margin-left: auto;
  margin-right: 10px;
  color: var(--accent);
  font-size: 12px;
}

.progress-task-row {
  display: grid;
  grid-template-columns: minmax(42px, auto) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.progress-task-row .micro {
  align-self: center;
}

.progress-task-row strong {
  color: var(--accent);
  font-size: 13px;
}

.progress-task-row span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
}

.progress-ruler-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.progress-ruler-field legend {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.progress-ruler {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(38px, 1fr);
  gap: 4px;
  overflow-x: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}

.progress-ruler::-webkit-scrollbar {
  display: none;
}

.progress-ruler-option {
  position: relative;
  display: block;
  min-width: 38px;
  scroll-snap-align: center;
}

.progress-ruler-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.progress-ruler-option span {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.progress-ruler-option input:checked + span {
  background: var(--accent);
  color: #07100d;
  transform: scale(1.06);
}

.progress-ruler-option input:checked + span::before,
.progress-ruler-option input:checked + span::after {
  position: absolute;
  left: 50%;
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: #07100d;
  content: "";
  transform: translateX(-50%);
}

.progress-ruler-option input:checked + span::before {
  top: 4px;
}

.progress-ruler-option input:checked + span::after {
  bottom: 4px;
}

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

.free-slots-view {
  display: grid;
  gap: 10px;
}

.slot-warning {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 123, 123, 0.34);
  border-radius: 14px;
  background: rgba(255, 123, 123, 0.08);
  color: var(--bad);
  font-size: 13px;
  font-weight: 800;
}

.slot-day {
  display: grid;
  gap: 7px;
}

.slot-day h3 {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.slot-chip {
  display: grid;
  gap: 2px;
  min-height: 48px;
  padding: 8px;
  border: 1px solid rgba(139, 224, 199, 0.22);
  border-radius: 14px;
  background: rgba(139, 224, 199, 0.08);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.slot-chip strong {
  color: var(--accent);
  font-size: 15px;
}

.slot-chip span {
  color: var(--muted);
  font-size: 11px;
}

.fab-wrap {
  position: fixed;
  z-index: 16;
  right: 16px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  display: grid;
  justify-items: end;
  gap: 8px;
}

.fab {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background: var(--accent);
  color: #07100d;
  font-size: 28px;
  font-weight: 700;
  box-shadow: 0 16px 42px rgba(139, 224, 199, 0.22);
}

.fab-menu {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 20, 27, 0.96);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.38);
}

.fab-menu button {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  text-align: left;
}

.tabbar {
  position: fixed;
  z-index: 14;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 4px;
  width: min(680px, calc(100% - 24px));
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(17, 20, 27, 0.92);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.tabbar button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 42px;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.05;
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
}

.tabbar button.active {
  background: rgba(139, 224, 199, 0.14);
  color: var(--accent);
}

.modal-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, 0.58);
  overscroll-behavior: none;
  transition: background-color 0.18s ease;
}

.modal {
  --modal-drag-y: 0px;
  width: min(760px, 100%);
  max-height: 88vh;
  margin: 0 auto;
  padding: 8px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  background: #10131a;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  transform: translateY(var(--modal-drag-y));
  transition: transform 0.18s ease;
  will-change: transform;
  -webkit-overflow-scrolling: touch;
}

.modal-drag-handle {
  position: sticky;
  z-index: 3;
  top: 0;
  width: 42px;
  height: 5px;
  margin: 0 auto 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  touch-action: none;
}

.modal.modal-dragging {
  transition: none;
  user-select: none;
}

.modal-backdrop.modal-closing {
  background: transparent;
  pointer-events: none;
}

.modal-backdrop.modal-closing .modal {
  --modal-drag-y: 100%;
}

.modal .detail-head {
  position: sticky;
  z-index: 2;
  top: 5px;
  min-height: 48px;
  margin: 0 -16px 12px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 19, 26, 0.96);
  backdrop-filter: blur(18px);
  touch-action: pan-y;
}

.modal-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.modal-submit-button {
  min-width: 72px;
  min-height: 34px;
  border: 1px solid rgba(139, 224, 199, 0.36);
  background: rgba(139, 224, 199, 0.14);
  color: var(--accent);
}

.modal-submit-source,
.topbar-submit-source {
  display: none;
}

body.tg-fullscreen .modal {
  max-height: calc(var(--tg-viewport-stable-height, var(--tg-viewport-height, 100vh)) - 28px);
}

.skeleton-stack {
  display: grid;
  gap: 10px;
}

.skeleton-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.skeleton {
  min-height: 94px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  background-size: 240% 100%;
  animation: shimmer 1.2s infinite;
}

.hero-skeleton {
  min-height: 180px;
}

.marketing-hero {
  position: relative;
  display: grid;
  min-height: min(720px, calc(100vh - 132px));
  overflow: hidden;
  align-items: end;
  margin: 8px calc(50% - 50vw) 18px;
  padding: clamp(24px, 6vw, 76px) max(24px, calc((100vw - 1320px) / 2));
  border-bottom: 1px solid rgba(139, 224, 199, 0.18);
  background: #07090b;
}

.marketing-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center right;
  opacity: 0.92;
}

.marketing-hero::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 9, 11, 0.98) 0%, rgba(7, 9, 11, 0.84) 34%, rgba(7, 9, 11, 0.16) 72%),
    linear-gradient(0deg, rgba(7, 9, 11, 0.94) 0%, rgba(7, 9, 11, 0.08) 42%, rgba(7, 9, 11, 0.2) 100%);
  content: "";
}

.marketing-hero-copy,
.hero-proof-strip {
  position: relative;
  z-index: 1;
}

.marketing-hero-copy {
  display: grid;
  max-width: 650px;
  gap: 18px;
  padding-bottom: 96px;
}

.marketing-hero-copy h2 {
  max-width: 620px;
  font-size: clamp(44px, 7vw, 86px);
  line-height: 0.9;
}

.marketing-hero-copy p:not(.eyebrow) {
  max-width: 560px;
  color: rgba(238, 242, 246, 0.74);
  font-size: clamp(16px, 2vw, 21px);
  line-height: 1.42;
}

.marketing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.marketing-actions .primary-button,
.marketing-actions .mini-button {
  min-height: 48px;
  padding-inline: 18px;
}

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

.hero-proof-strip span {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  background: rgba(9, 12, 16, 0.68);
  color: var(--muted);
  font-size: 12px;
  backdrop-filter: blur(12px);
}

.hero-proof-strip strong {
  color: var(--text);
  font-size: 18px;
}

.marketing-proof-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.marketing-proof-grid article,
.pricing-row article {
  display: grid;
  gap: 8px;
  min-height: 154px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.052);
}

.marketing-proof-grid span,
.pricing-row span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.marketing-proof-grid strong,
.pricing-row strong {
  font-size: 19px;
  line-height: 1.08;
}

.marketing-proof-grid p,
.marketing-split p,
.pricing-row small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.marketing-split {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
  padding: 22px;
  border-block: 1px solid rgba(139, 224, 199, 0.12);
}

.marketing-split h2 {
  margin: 6px 0 10px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 0.98;
}

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

.pricing-row article {
  min-height: 122px;
}

.pricing-row strong {
  font-size: 26px;
}

@media (max-width: 980px) {
  .marketing-hero {
    min-height: 660px;
  }

  .marketing-hero-copy {
    max-width: 540px;
    padding-bottom: 44px;
  }

  .marketing-hero-copy h2 {
    max-width: 520px;
    font-size: clamp(34px, 8vw, 56px);
    line-height: 0.96;
  }
}

@media (max-width: 1100px) {
  .marketing-hero {
    min-height: 560px;
    margin-inline: 0;
    padding: 28px 24px;
    border: 1px solid rgba(139, 224, 199, 0.16);
    border-radius: 18px;
  }

  .marketing-hero img {
    object-position: 70% center;
    opacity: 0.52;
  }

  .marketing-hero::after {
    background:
      linear-gradient(90deg, rgba(7, 9, 11, 0.98) 0%, rgba(7, 9, 11, 0.86) 58%, rgba(7, 9, 11, 0.36) 100%),
      linear-gradient(0deg, rgba(7, 9, 11, 0.96) 0%, rgba(7, 9, 11, 0.22) 54%, rgba(7, 9, 11, 0.34) 100%);
  }

  .marketing-hero-copy {
    max-width: 470px;
    gap: 12px;
    padding-bottom: 24px;
  }

  .marketing-hero-copy h2 {
    max-width: 460px;
    font-size: clamp(32px, 5vw, 42px);
    line-height: 1;
  }

  .marketing-hero-copy p:not(.eyebrow) {
    max-width: 450px;
    font-size: 15px;
  }
}

.register-hero {
  display: grid;
  gap: 8px;
  margin: 8px 0;
  padding: 16px;
  border: 1px solid rgba(139, 224, 199, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(139, 224, 199, 0.14), rgba(216, 179, 106, 0.06)),
    rgba(17, 20, 27, 0.82);
}

.register-hero h2 {
  font-size: 30px;
  line-height: 1;
}

.register-hero p:not(.eyebrow) {
  max-width: 520px;
  color: var(--muted);
  font-size: 14px;
}

.role-card-grid,
.plan-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

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

.role-card,
.plan-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.role-card:hover,
.plan-card:hover,
.role-card.selected {
  border-color: rgba(139, 224, 199, 0.44);
  background: rgba(139, 224, 199, 0.12);
  transform: translateY(-1px);
}

.role-card span,
.plan-card span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.role-card strong,
.plan-card strong {
  font-size: 18px;
  line-height: 1.05;
}

.role-card small,
.plan-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.quick-login-panel,
.onboarding-form {
  margin-top: 10px;
}

.quick-login-panel h2 {
  font-size: 16px;
}

.choice-field {
  min-width: 0;
  padding: 0;
  border: 0;
}

.choice-field legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-chip input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.choice-chip span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.choice-chip input:checked + span {
  border-color: rgba(139, 224, 199, 0.48);
  background: rgba(139, 224, 199, 0.16);
  color: var(--accent);
}

.onboarding-back {
  margin-top: 10px;
}

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

.register-card {
  align-content: start;
}

.register-card h2 {
  font-size: 18px;
}

[hidden] {
  display: none !important;
}

@keyframes shimmer {
  to {
    background-position: -240% 0;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding-inline: 10px;
  }

  .hero-crm,
  .metric-grid,
  .filters,
  .edit-form,
  .info-grid,
  .student-grid,
  .register-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
  }

  .section-actions {
    justify-content: flex-end;
  }

  .hero-crm h2 {
    font-size: 34px;
  }

  .metric-grid.compact {
    grid-template-columns: repeat(2, 1fr);
  }

  .lesson-row,
  .homework-row,
  .finance-row,
  .schedule-slot-row,
  .problem-card {
    grid-template-columns: 1fr;
  }

  .lesson-statuses,
  .row-actions {
    grid-column: 1;
  }

  .tabbar {
    width: calc(100% - 24px);
    border-radius: 24px;
  }

  .tabbar button {
    min-height: 40px;
    padding: 0 2px;
    font-size: 10px;
    border-radius: 17px;
  }
}

@media (max-width: 360px) {
  .tabbar {
    gap: 3px;
    width: calc(100% - 18px);
    padding: 5px;
  }

  .tabbar button {
    border-radius: 16px;
    font-size: 9px;
  }
}

/* Dense CRM redesign */
.app-shell {
  padding: max(8px, env(safe-area-inset-top)) clamp(16px, 3vw, 40px) calc(82px + env(safe-area-inset-bottom));
}

.topbar {
  padding: 10px;
  border-radius: 18px;
}

.topbar h1 {
  font-size: 18px;
}

.brand-lockup p {
  font-size: 10px;
}

.icon-button {
  width: 36px;
  height: 36px;
}

.dashboard-top {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
  margin-bottom: 8px;
}

.hello-block,
.top-stat,
.metric,
.panel,
.drawer-panel {
  border: 1px solid rgba(255, 255, 255, 0.075);
  background: rgba(17, 20, 27, 0.78);
  backdrop-filter: blur(16px);
}

.hello-block,
.top-stat {
  min-height: 56px;
  padding: 10px;
  border-radius: 12px;
  color: var(--text);
  text-align: left;
}

.hello-block h2 {
  font-size: 25px;
  line-height: 1;
}

.top-stat {
  display: grid;
  align-content: space-between;
  min-width: 0;
}

.top-stat.wide {
  grid-column: 1 / -1;
}

.top-stat span {
  color: var(--muted);
  font-size: 11px;
}

.top-stat strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-crm {
  padding: 12px;
  min-height: 92px;
}

.hero-crm h2 {
  font-size: 26px;
}

.hero-crm p {
  margin-top: 6px;
  font-size: 13px;
}

.hero-income {
  min-width: 104px;
  padding: 10px;
}

.metric-grid {
  gap: 7px;
  margin: 8px 0;
}

.metric-grid.compact,
.kpi-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric {
  min-height: 58px;
  padding: 9px 10px;
  border-radius: 12px;
}

.metric strong {
  margin-top: 4px;
  font-size: 18px;
}

.metric span {
  font-size: 11px;
}

.panel,
.drawer-panel {
  margin: 8px 0;
  padding: 10px;
  border-radius: 14px;
}

.dense-panel {
  padding: 10px;
}

.section-head,
.detail-head,
.student-profile-head {
  margin-bottom: 8px;
}

.compact-head h2,
.section-head h2,
.detail-head h2 {
  font-size: 17px;
}

.section-actions {
  gap: 5px;
}

.stack,
.student-grid {
  gap: 6px;
}

.crm-toolbar {
  display: grid;
  grid-template-columns: 1.2fr 0.85fr 0.8fr;
  gap: 7px;
  margin-bottom: 8px;
}

.crm-toolbar input,
.crm-toolbar select,
.filters select {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 13px;
}

.crm-list {
  grid-template-columns: 1fr;
}

.student-card.compact-student {
  position: relative;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  min-height: 74px;
  padding: 9px 10px;
  border-radius: 12px;
}

.compact-student strong {
  font-size: 15px;
}

.compact-student span,
.compact-student small {
  grid-column: 1;
  color: var(--muted);
  font-size: 12px;
}

.compact-student em {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  color: var(--accent-2);
  font-size: 12px;
}

.payment-dot {
  grid-column: 2;
  align-self: end;
  justify-self: end;
  min-width: 50px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-style: normal;
  text-align: center;
}

.payment-dot.ok {
  background: rgba(113, 217, 145, 0.14);
  color: var(--ok);
}

.payment-dot.warn {
  background: rgba(240, 189, 98, 0.14);
  color: var(--warn);
}

.payment-dot.bad {
  background: rgba(255, 123, 123, 0.14);
  color: var(--bad);
}

.attention-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.compact-lessons {
  display: grid;
  gap: 6px;
}

.compact-lesson {
  display: grid;
  grid-template-columns: 42px 1fr auto auto;
  gap: 7px;
  align-items: center;
  min-height: 42px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
}

.compact-lesson.ok {
  border-left-color: var(--ok);
}

.compact-lesson.warn {
  border-left-color: var(--warn);
}

.compact-lesson.bad {
  border-left-color: var(--bad);
}

.compact-lesson time {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.compact-lesson strong {
  font-size: 13px;
}

.compact-lesson span {
  color: var(--muted);
  font-size: 11px;
}

.attention-item {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
}

.attention-item span {
  color: var(--muted);
  font-size: 11px;
}

.attention-item strong {
  font-size: 19px;
}

.attention-item.bad strong {
  color: var(--bad);
}

.attention-item.warn strong {
  color: var(--warn);
}

.student-profile-head {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  padding-right: 42px;
}

.student-profile-head h2 {
  font-size: 22px;
}

.student-profile-head p:not(.eyebrow) {
  color: var(--muted);
  font-size: 12px;
}

.student-profile-head .student-head-actions {
  grid-column: 2 / -1;
  justify-content: flex-start;
}

.student-edit-button {
  min-height: 34px;
  border: 1px solid rgba(139, 224, 199, 0.34);
  background: rgba(139, 224, 199, 0.12);
  color: var(--accent);
}

.student-edit-cancel-button {
  min-height: 34px;
  color: var(--muted);
}

.student-edit-done-button {
  min-height: 34px;
  border: 1px solid rgba(139, 224, 199, 0.44);
  background: rgba(139, 224, 199, 0.18);
  color: var(--accent);
}

.student-submit-source {
  display: none;
}

.student-close-button {
  position: absolute;
  top: 0;
  right: 0;
}

.avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(139, 224, 199, 0.35);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(139, 224, 199, 0.28), rgba(216, 179, 106, 0.12));
  color: var(--accent);
  font-size: 22px;
  font-weight: 900;
}

.profile-sections {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.profile-block {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.profile-block h3 {
  font-size: 14px;
}

.compact-info {
  grid-template-columns: 1fr;
}

.compact-info .info-item {
  padding: 8px;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mini-metric {
  display: grid;
  gap: 3px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.mini-metric span {
  color: var(--muted);
  font-size: 10px;
}

.mini-metric strong {
  font-size: 16px;
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.link-list a,
.muted-link {
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(139, 224, 199, 0.1);
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
}

.muted-link {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.timeline-list {
  position: relative;
  display: grid;
  gap: 6px;
  padding-left: 10px;
}

.timeline-list::before {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 1px;
  content: "";
  background: rgba(139, 224, 199, 0.2);
}

.lesson-row {
  grid-template-columns: 48px 1fr auto;
  gap: 6px 9px;
  padding: 9px;
  border-radius: 12px;
  cursor: pointer;
}

.lesson-row:hover {
  border-color: rgba(139, 224, 199, 0.28);
  background: rgba(255, 255, 255, 0.06);
}

.timeline-event {
  position: relative;
}

.timeline-event::before {
  position: absolute;
  left: -14px;
  top: 17px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  content: "";
  background: var(--muted);
}

.timeline-event.ok::before {
  background: var(--ok);
}

.timeline-event.warn::before {
  background: var(--warn);
}

.timeline-event.bad::before {
  background: var(--bad);
}

.lesson-row time {
  font-size: 13px;
}

.lesson-row p {
  font-size: 12px;
}

.lesson-statuses {
  grid-column: 2;
  gap: 4px;
}

.lesson-menu {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
}

.closed-slots-panel {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.closed-slot-list {
  display: grid;
  gap: 6px;
}

.closed-slot-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 8px 9px;
  border: 1px solid rgba(255, 123, 123, 0.22);
  border-left: 3px solid var(--bad);
  border-radius: 12px;
  background: rgba(255, 123, 123, 0.06);
}

.closed-slot-row time {
  color: var(--bad);
  font-size: 12px;
  font-weight: 900;
}

.closed-slot-row strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.closed-slot-row p {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-button.micro {
  min-width: 32px;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 10px;
  font-size: 12px;
}

.status {
  min-height: 20px;
  padding: 2px 7px;
  font-size: 10px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.segmented button {
  min-height: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.segmented button.active {
  background: rgba(139, 224, 199, 0.15);
  color: var(--accent);
}

.homework-row {
  grid-template-columns: 1fr auto;
  min-height: 72px;
  padding: 9px;
  border-radius: 12px;
}

.homework-row strong {
  font-size: 14px;
}

.homework-row p,
.homework-row span,
.homework-row small {
  font-size: 12px;
}

.finance-screen {
  background:
    linear-gradient(180deg, rgba(139, 224, 199, 0.08), transparent 180px),
    rgba(17, 20, 27, 0.9);
}

.finance-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  margin-bottom: 9px;
}

.finance-kpis article {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.finance-kpis span {
  color: var(--muted);
  font-size: 11px;
}

.finance-kpis strong {
  font-size: 18px;
}

.income-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 6px;
  height: 118px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.2);
}

.income-chart div {
  display: grid;
  grid-template-rows: 1fr 18px;
  gap: 5px;
  height: 100%;
  align-items: end;
}

.income-chart span {
  display: block;
  width: 100%;
  min-height: 6px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--accent), rgba(139, 224, 199, 0.28));
}

.income-chart small {
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.fab-wrap {
  right: 14px;
  bottom: calc(74px + env(safe-area-inset-bottom));
}

.fab {
  width: 44px;
  height: 44px;
  font-size: 24px;
}

.fab-menu button {
  padding: 9px 11px;
  font-size: 13px;
}

.tabbar {
  bottom: calc(8px + env(safe-area-inset-bottom));
  width: min(640px, calc(100% - 22px));
  padding: 5px;
  border-radius: 22px;
}

.tabbar button {
  min-height: 36px;
  border-radius: 16px;
  font-size: 10px;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.tabbar button.active {
  position: relative;
  background: rgba(139, 224, 199, 0.18);
  color: var(--accent);
  transform: translateY(-1px);
}

.tabbar button.active::before {
  position: absolute;
  top: 5px;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  content: "";
  background: var(--accent);
}

@media (max-width: 760px) {
  .topbar {
    gap: 8px;
    padding: 9px;
  }

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

  .brand-lockup {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 2px 8px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 11px;
  }

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

  .top-stat.wide {
    grid-column: 1 / -1;
  }

  .marketing-hero {
    min-height: 640px;
    margin-inline: 0;
    padding: 24px 16px;
    border: 1px solid rgba(139, 224, 199, 0.16);
    border-radius: 18px;
  }

  .marketing-hero img {
    object-position: 68% center;
    opacity: 0.58;
  }

  .marketing-hero::after {
    background:
      linear-gradient(90deg, rgba(7, 9, 11, 0.98) 0%, rgba(7, 9, 11, 0.76) 58%, rgba(7, 9, 11, 0.28) 100%),
      linear-gradient(0deg, rgba(7, 9, 11, 0.97) 0%, rgba(7, 9, 11, 0.34) 52%, rgba(7, 9, 11, 0.38) 100%);
  }

  .marketing-hero-copy {
    max-width: 100%;
    gap: 12px;
    padding-bottom: 22px;
  }

  .marketing-hero-copy h2 {
    max-width: 430px;
    font-size: 34px;
    line-height: 0.98;
  }

  .marketing-hero-copy p:not(.eyebrow) {
    max-width: 430px;
    font-size: 15px;
  }

  .marketing-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: min(100%, 360px);
  }

  .marketing-actions .primary-button,
  .marketing-actions .mini-button {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .hero-proof-strip,
  .marketing-proof-grid,
  .marketing-split,
  .pricing-row {
    grid-template-columns: 1fr;
  }

  .crm-toolbar {
    grid-template-columns: 1fr;
  }

  .profile-sections,
  .attention-grid {
    grid-template-columns: 1fr;
  }

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

  .plan-card-grid {
    grid-template-columns: 1fr;
  }

  .lesson-row {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .lesson-menu {
    grid-column: 2;
    grid-row: auto;
    justify-content: flex-start;
  }

  .lesson-statuses {
    grid-column: 2;
  }

  .schedule-slot-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .calendar-toolbar {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .calendar-title-block h2 {
    font-size: 19px;
  }

  .calendar-title-block span {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .calendar-action-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border-radius: 16px;
  }

  .calendar-action {
    gap: 4px;
    min-height: 34px;
    padding: 0 5px;
    font-size: 11px;
  }

  .calendar-action span {
    width: 18px;
    height: 18px;
    border-radius: 7px;
    font-size: 12px;
  }

  .lesson-statuses {
    grid-column: 2 / -1;
  }

  .lesson-menu {
    grid-column: 3;
  }

  .homework-row,
  .finance-row {
    grid-template-columns: 1fr auto;
  }

  .closed-slot-row {
    grid-template-columns: 78px minmax(0, 1fr) auto;
  }

  .tabbar {
    width: calc(100% - 18px);
  }
}

@media (max-width: 380px) {
  .calendar-action {
    font-size: 10px;
  }

  .calendar-action span {
    display: none;
  }
}

/* Stable mobile layout and unified icon system */
html,
body,
#root,
.app-shell,
#app {
  max-width: 100%;
  overflow-x: hidden;
}

#app > *,
.panel,
.drawer-panel,
.student-profile-head,
.section-head,
.detail-head,
.homework-row,
.lesson-row,
.finance-row,
.row-actions {
  min-width: 0;
  max-width: 100%;
}

p,
span,
strong,
small,
a,
.homework-text {
  overflow-wrap: anywhere;
}

.ui-icon,
.icon-button svg {
  display: block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-text-button,
.admin-quick-grid button,
.calendar-action,
.calendar-ghost-action,
.homework-duration {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.danger-icon {
  color: var(--bad);
}

.topbar {
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  border-color: rgba(139, 224, 199, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(115deg, rgba(139, 224, 199, 0.16), rgba(139, 224, 199, 0.03) 48%, rgba(216, 179, 106, 0.1)),
    rgba(11, 13, 18, 0.94);
}

.topbar-actions {
  margin-right: 4px;
}

body.tg-webapp .topbar {
  width: 100%;
  min-height: 64px;
  margin-right: 0;
  margin-left: 0;
  padding: 10px 12px;
  border-radius: 18px;
}

body.tg-webapp .topbar-actions {
  margin-right: 4px;
}

body.tg-webapp .topbar .icon-button {
  width: 36px;
  height: 36px;
}

#refresh-button {
  display: grid;
  place-items: center;
  padding: 0;
}

#refresh-button svg {
  width: 20px;
  height: 20px;
  transform: none;
}

body.tg-webapp .brand-lockup {
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 1px 10px;
}

body.tg-webapp .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  font-size: 17px;
}

body.tg-webapp .brand-lockup p {
  display: block;
}

.brand-lockup p {
  color: var(--text);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.brand-lockup p span {
  color: var(--accent);
}

body.tg-webapp .brand-lockup h1 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.admin-quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.admin-quick-grid button {
  justify-content: flex-start;
  min-width: 0;
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(139, 224, 199, 0.07);
  color: var(--text);
  font-weight: 800;
  text-align: left;
}

.admin-quick-grid .ui-icon {
  color: var(--accent);
}

.homework-duration {
  width: fit-content;
  color: var(--accent);
  font-size: 12px;
}

.homework-duration .ui-icon {
  width: 14px;
  height: 14px;
}

.modal-submit-source,
.topbar-submit-source {
  display: block;
}

.modal {
  overflow-x: hidden;
}

.modal .detail-head {
  width: auto;
  max-width: none;
  padding-right: 8px;
}

.modal .modal-head-actions {
  margin-left: auto;
}

.modal .edit-form {
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.modal .primary-button {
  position: sticky;
  bottom: 0;
  z-index: 2;
  min-height: 48px;
  box-shadow: 0 -12px 28px rgba(16, 19, 26, 0.88);
}

body.tg-webapp .modal,
body.tg-fullscreen .modal {
  max-height: calc(
    var(--tg-viewport-stable-height, var(--tg-viewport-height, 100vh)) -
    max(140px, calc(var(--tg-content-safe-area-inset-top, 0px) + 32px), calc(var(--tg-safe-area-inset-top, 0px) + 32px))
  );
}

.tabbar button {
  flex-direction: column;
  gap: 3px;
  white-space: normal;
}

.tabbar button .ui-icon {
  width: 16px;
  height: 16px;
}

.tabbar button span {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-ghost-action > span,
.calendar-action > span {
  width: auto;
  height: auto;
  background: transparent;
}

.product-hero {
  min-height: 260px;
  align-content: end;
  background:
    linear-gradient(140deg, rgba(139, 224, 199, 0.18), rgba(216, 179, 106, 0.08)),
    #0b0d12;
}

.product-hero h2 {
  max-width: 760px;
  font-size: clamp(30px, 7vw, 64px);
  line-height: 0.98;
}

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

.register-card {
  min-height: 100%;
}

.tutor-profile-panel {
  display: grid;
  gap: 14px;
}

.profile-kpi-grid,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-kpi-grid span,
.tag-row span {
  border: 1px solid rgba(139, 224, 199, 0.16);
  border-radius: 999px;
  background: rgba(139, 224, 199, 0.08);
  color: var(--text);
  padding: 8px 10px;
  font-size: 12px;
}

.telegram-connect {
  display: grid;
  gap: 14px;
}

.telegram-link {
  text-align: center;
  text-decoration: none;
}

@media (max-width: 760px) {
  .app-shell {
    width: 100%;
    padding-inline: 8px;
  }

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

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

  .homework-row .row-actions {
    grid-column: 1;
    justify-content: flex-start;
  }

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

  .tabbar button {
    min-height: 47px;
    font-size: 9px;
  }

  .tabbar button.active::before {
    top: 3px;
  }
}
