:root {
  --tg-bg: #050608;
  --tg-bg-soft: rgba(10, 10, 15, 0.85);
  --tg-accent: #ff2c40;
  --tg-accent-soft: rgba(255, 44, 64, 0.12);
  --tg-accent-strong: #ff3347;
  --tg-text: #ffffff;
  --tg-text-muted: #9a9aa0;
  --tg-border-subtle: rgba(255, 255, 255, 0.06);
  --glass-bg: rgba(15, 15, 20, 0.9);
  --glass-border: rgba(255, 255, 255, 0.06);
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.45);
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-pill: 999px;
  --transition-fast: 150ms ease-out;
  --transition-med: 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
  --slot-free: #29d344;
  --slot-busy: #ff4d4f;
  --slot-disabled: #7a7a7a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont,
    "SF Pro Text", "Segoe UI", sans-serif;
  color: var(--tg-text);
  background: radial-gradient(circle at top left, #2b0008 0, #050608 40%, #000 100%);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    calc(env(safe-area-inset-bottom) + 8px) env(safe-area-inset-left);
}

.app-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 8px;
}

.glass-card {
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.06),
      rgba(255, 255, 255, 0.02)
    );
  border-radius: var(--radius-xl);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: var(--shadow-soft);
}

.app-header {
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-circle {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: radial-gradient(circle at 30% 0, #ff9a9e, #ff2c40);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(255, 44, 64, 0.65);
}

.logo-car-emoji {
  font-size: 22px;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-title {
  font-size: 15px;
  font-weight: 600;
}

.logo-subtitle {
  font-size: 12px;
  color: var(--tg-text-muted);
}

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.step-indicator-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--tg-text-muted);
  padding: 6px 8px;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

.step-indicator-item span {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.step-indicator-item.active {
  color: #fff;
  background: radial-gradient(circle at top left, #ff2c40, rgba(255, 44, 64, 0.1));
}

.step-indicator-item.active span {
  background: #ff2c40;
  border-color: transparent;
}

.app-main {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  padding: 10px 2px 2px;
  opacity: 0;
  transform: translateX(16px);
  pointer-events: none;
  transition: opacity var(--transition-med), transform var(--transition-med);
}

.screen-active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.screen-content {
  height: 100%;
  padding: 14px 12px 74px;
  border-radius: var(--radius-xl);
  background: radial-gradient(circle at top left, rgba(255, 44, 64, 0.3), transparent),
    radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.04), transparent),
    rgba(5, 5, 10, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.screen-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
}

.screen-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--tg-text-muted);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.nav-item,
.category-card,
.tab-btn {
  border: none;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast), opacity var(--transition-fast);
}

.primary-btn {
  background: linear-gradient(135deg, var(--tg-accent), var(--tg-accent-strong));
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 16px 35px rgba(255, 44, 64, 0.55);
}

.primary-btn.large-btn {
  margin-top: auto;
  width: 100%;
}

.primary-btn:active {
  transform: scale(0.97) translateY(1px);
  box-shadow: 0 8px 20px rgba(255, 44, 64, 0.4);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.secondary-btn.full-width {
  width: 100%;
}

.secondary-btn:active {
  transform: scale(0.98) translateY(1px);
}

.ghost-btn {
  align-self: flex-start;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.02);
  color: var(--tg-text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ghost-btn:active {
  transform: translateY(1px);
  background: rgba(255, 255, 255, 0.06);
}

.ghost-icon-btn {
  border-radius: 999px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 14px;
}

.ghost-icon-btn:active {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.08);
}

.categories-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.category-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 12px 12px 10px;
  border-radius: 18px;
  background: radial-gradient(circle at top left, #ff2c40, rgba(255, 44, 64, 0.05)),
    rgba(12, 12, 18, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);
}

.category-card .category-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 16px;
  font-weight: 600;
}

.category-card .category-text {
  margin-top: 6px;
  font-size: 12px;
  color: var(--tg-text-muted);
  text-align: left;
}

.category-card:active {
  transform: translateY(1px) scale(0.98);
}

.category-card.selected {
  border-color: var(--tg-accent);
  box-shadow: 0 12px 30px rgba(255, 44, 64, 0.6);
}

.instructors-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-bottom: 10px;
}

.instructor-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 18px;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.04),
      rgba(255, 255, 255, 0.01)
    );
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.instructor-avatar {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: radial-gradient(circle at top left, #ff2c40, #111117);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
}

.instructor-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.instructor-name {
  font-size: 14px;
  font-weight: 500;
}

.instructor-meta {
  font-size: 11px;
  color: var(--tg-text-muted);
}

.instructor-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.chip {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 10px;
  color: var(--tg-text-muted);
}

.chip-accent {
  border-color: rgba(255, 44, 64, 0.7);
  color: #ffd6db;
}

.instructor-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.instructor-actions .secondary-btn {
  padding: 6px 10px;
  font-size: 12px;
}

.instructor-badge {
  font-size: 10px;
  color: var(--tg-text-muted);
}

.calendar-header {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calendar-title {
  font-size: 14px;
  font-weight: 500;
}

.calendar-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px 4px;
  overflow-y: auto;
  padding-right: 2px;
  padding-bottom: 8px;
}

.calendar-day {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-day-label {
  font-size: 11px;
  text-align: center;
  color: var(--tg-text-muted);
}

.calendar-day-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  margin: 0 auto;
  border-radius: 14px;
  font-size: 13px;
}

.calendar-day-number.today {
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.calendar-slots {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slot-pill {
  border-radius: 999px;
  padding: 4px 4px;
  font-size: 10px;
  text-align: center;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    border-color var(--transition-fast), background var(--transition-fast),
    opacity var(--transition-fast);
}

.slot-free {
  background: rgba(41, 211, 68, 0.18);
  color: #b9ffd0;
  border-color: rgba(41, 211, 68, 0.4);
}

.slot-busy {
  background: rgba(255, 77, 79, 0.18);
  color: #ffd4d5;
  border-color: rgba(255, 77, 79, 0.45);
  opacity: 0.55;
  cursor: default;
}

.slot-disabled {
  background: rgba(120, 120, 120, 0.16);
  color: #9b9b9b;
  border-color: rgba(120, 120, 120, 0.35);
  opacity: 0.4;
  cursor: default;
}

.slot-pill.slot-selected {
  box-shadow: 0 8px 18px rgba(41, 211, 68, 0.55);
  background: linear-gradient(135deg, var(--slot-free), #54f37b);
  color: #021105;
  border-color: transparent;
  transform: translateY(-1px);
}

.slot-free:active {
  transform: translateY(1px) scale(0.97);
}

.legend {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  color: var(--tg-text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.dot-free {
  background: var(--slot-free);
}

.dot-busy {
  background: var(--slot-busy);
}

.dot-disabled {
  background: var(--slot-disabled);
}

.summary-card {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.summary-label {
  color: var(--tg-text-muted);
}

.summary-value {
  font-weight: 500;
}

.hint-text {
  margin-top: 10px;
  font-size: 11px;
  color: var(--tg-text-muted);
}

.bottom-nav {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  padding: 6px 8px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.08),
      rgba(255, 255, 255, 0.02)
    );
}

.nav-item {
  flex: 1;
  border-radius: 999px;
  padding: 6px 4px;
  font-size: 12px;
  color: var(--tg-text-muted);
  background: transparent;
}

.nav-item-active {
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
}

.nav-item:active {
  transform: translateY(1px);
}

.nav-label {
  display: block;
}

.info-block {
  padding: 10px 10px 8px;
  border-radius: 16px;
  background: rgba(5, 5, 10, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
}

.info-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.info-text {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--tg-text-muted);
  line-height: 1.4;
}

.info-text a {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.4);
}

.tabs {
  margin-top: 10px;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--tg-text-muted);
}

.tab-active {
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
}

.tab-content {
  margin-top: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tab-title {
  margin: 0;
  font-size: 14px;
}

.filters-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select,
.input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(5, 5, 10, 0.9);
  color: #fff;
  padding: 7px 9px;
  font-size: 12px;
}

.admin-list {
  margin-top: 6px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-record {
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(10, 10, 14, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.admin-record-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-record-instructor {
  font-weight: 500;
}

.admin-record-time {
  font-size: 11px;
  color: var(--tg-text-muted);
}

.admin-record-meta {
  font-size: 11px;
  color: var(--tg-text-muted);
}

.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.label {
  font-size: 12px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-separator {
  font-size: 13px;
  color: var(--tg-text-muted);
}

.toggle-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.toggle input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transition: background var(--transition-fast);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #fff;
  transition: transform var(--transition-fast);
}

.toggle input:checked + .toggle-slider {
  background: var(--tg-accent);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(14px);
}

.toggle-label {
  font-size: 12px;
  color: var(--tg-text-muted);
}

.form-field-group {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hidden {
  display: none !important;
}

/* Экран успеха перед закрытием Mini App */
.success-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
}

.success-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.success-card {
  margin: 20px;
  padding: 28px 24px;
  text-align: center;
  max-width: 340px;
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--slot-free), #54f37b);
  color: #021105;
  font-size: 32px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 30px rgba(41, 211, 68, 0.5);
}

.success-title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 600;
}

.success-text {
  margin: 0;
  font-size: 15px;
  color: var(--tg-text-muted);
  line-height: 1.4;
}

@media (max-height: 640px) {
  .screen-content {
    padding-bottom: 80px;
  }

  .logo-subtitle {
    display: none;
  }
}

