:root { --indigo: #4338CA; --mint: #10B981; --mint-light: #D1FAE5; --bg: #F3F4F6; --white: #FFFFFF; --text-main: #111827; --text-muted: #6B7280; --red: #EF4444; --red-light: #FEE2E2; --blue: #3B82F6; --blue-light: #DBEAFE; --border: #E5E7EB; }
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Nunito', sans-serif; -webkit-tap-highlight-color: transparent; }
/* ДАША ФИКС: Возвращаем центрирование body, чтобы #app не вылезал влево */
body { background: #cbd5e1; display: flex; justify-content: center; align-items: center; height: 100vh; height: 100dvh; overflow: hidden; }
#app { width: 100%; height: 100%; background: var(--bg); display: flex; flex-direction: column; position: relative; overflow: hidden; }

@media (min-width: 480px) {
  body { background: #1f2937; }
  #app { width: 402px; height: 874px; border-radius: 55px; box-shadow: 0 25px 50px rgba(0,0,0,0.5), inset 0 0 0 2px #52525b; border: 12px solid #000000; margin-top: 0; }
  #app::before { content: ''; position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 120px; height: 35px; background: #000000; border-radius: 20px; z-index: 99999; }
}

.header { background: var(--white); padding: max(20px, env(safe-area-inset-top)) 20px 15px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); z-index: 10; flex-shrink: 0; }
@media (min-width: 480px) { .header { padding-top: 45px; } }

.logo { font-size: 26px; font-weight: 800; color: var(--indigo); letter-spacing: 0.5px; display: flex; align-items: center; gap: 8px;}
.logo span { color: var(--mint); }
.avatar { width: 40px; height: 40px; background: #E0E7FF; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 20px; }
.content { flex: 1; overflow-y: auto; padding: 20px 20px 100px; scrollbar-width: none; overflow-x: hidden; }
.content::-webkit-scrollbar { display: none; }

.screen { display: none; animation: fadeIn 0.2s ease; width: 100%; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

h2 { font-size: 24px; font-weight: 800; color: var(--text-main); margin-bottom: 16px; }

.kid-tabs { display: flex; gap: 10px; margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; padding-bottom: 5px; width: 100%; }
.kid-tab { padding: 10px 16px; background: var(--white); border-radius: 20px; font-size: 14px; font-weight: 700; color: var(--text-muted); white-space: nowrap; cursor: pointer; border: 1px solid var(--border); transition: 0.2s; }
.kid-tab.active { background: var(--indigo); color: var(--white); border-color: var(--indigo); }
.card { background: var(--white); padding: 20px; border-radius: 24px; margin-bottom: 16px; border: 1px solid var(--border); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02); transition: transform 0.1s; width: 100%; overflow: hidden; }
.card-title { font-size: 18px; font-weight: 800; color: var(--text-main); margin-bottom: 4px; }
.card-sub { font-size: 14px; color: var(--text-muted); }

.btn { width: 100%; padding: 16px; background: var(--indigo); color: var(--white); font-size: 16px; font-weight: 800; border: none; border-radius: 16px; cursor: pointer; text-align: center; transition: 0.2s;}
.btn:active { transform: scale(0.98); }
.btn-danger { background: transparent; border: 2px solid var(--red); color: var(--red); }
.btn-small { padding: 10px; font-size: 14px; border-radius: 12px; }

.auth-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(243, 244, 246, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 9999; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 20px; transition: 0.3s; }
.auth-box { width: 100%; max-width: 350px; background: var(--white); padding: 30px 24px; border-radius: 24px; box-shadow: 0 10px 40px rgba(0,0,0,0.1); border: 1px solid var(--border); }
.auth-input { width: 100%; padding: 16px; border: 1px solid var(--border); border-radius: 14px; font-size: 16px; margin-bottom: 12px; outline: none; background: var(--bg); transition: 0.2s; }
.auth-input:focus { border-color: var(--indigo); background: var(--white); }
.auth-switch { text-align: center; font-size: 14px; color: var(--indigo); font-weight: 700; margin-top: 20px; cursor: pointer; }

.modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 10000; display: none; justify-content: center; align-items: flex-end; }
.modal-overlay.active { display: flex; }
.modal-content { width: 100%; background: var(--white); padding: 30px 24px max(30px, env(safe-area-inset-bottom)); border-radius: 32px 32px 0 0; animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1); max-height: 90%; overflow-y: auto;}

.receipt-row { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 12px; color: var(--text-muted); }
.receipt-row.total { font-size: 20px; font-weight: 800; color: var(--text-main); margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border); }

.nav-bar { position: absolute; bottom: 0; width: 100%; background: var(--white); display: flex; justify-content: space-around; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); z-index: 20; border-radius: 30px 30px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,0.03); }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; color: #9CA3AF; cursor: pointer; width: 25%; transition: 0.2s;}
.nav-item.active { color: var(--indigo); }
.nav-icon { font-size: 24px; filter: grayscale(100%) opacity(0.5); transition: 0.2s; }
.nav-item.active .nav-icon { filter: grayscale(0%) opacity(1); transform: translateY(-2px); }

.disciplines-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; width: 100%; box-sizing: border-box; }
.disc-btn { aspect-ratio: 1; border-radius: 12px; background: rgba(67, 56, 202, 0.08); color: var(--indigo); font-size: 11px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; cursor: pointer; transition: 0.2s; border: 1px solid transparent; padding: 6px; line-height: 1.3; overflow: hidden; }
.disc-btn:active { transform: scale(0.95); }
.disc-btn.selected { background: var(--indigo); color: var(--white); box-shadow: 0 4px 10px rgba(67, 56, 202, 0.3); }

.time-slot { padding: 12px; background: var(--bg); border-radius: 12px; border: 1px solid var(--border); margin-bottom: 8px; font-size: 14px; font-weight: 700; color: var(--text-main); cursor: pointer; transition: 0.2s; text-align: center;}
.time-slot.active { background: var(--mint-light); border-color: var(--mint); color: var(--mint); }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; margin-bottom: 24px; width: 100%; }
.cal-header { font-size: 11px; font-weight: 800; color: var(--text-muted); text-align: center; margin-bottom: 8px; }
.cal-day { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 8px; font-size: 14px; font-weight: 800; border: 1px solid var(--border); transition: 0.2s; position: relative; cursor: pointer; }
.cal-day .cal-time { font-size: 8px; font-weight: 700; margin-top: 2px; }
.cal-day.empty { border: none; background: transparent; cursor: default; }
.cal-day.inactive { background: var(--bg); color: #9CA3AF; filter: grayscale(100%); cursor: default; }
.cal-day.active { background: var(--mint-light); color: var(--mint); border-color: var(--mint); }
.cal-day.frozen { background: var(--blue-light); color: var(--blue); border-color: var(--blue); }

.promo-container { display: flex; gap: 8px; margin-bottom: 16px; width: 100%; }
.promo-input { flex: 1; padding: 12px; border: 1px dashed var(--indigo); border-radius: 12px; font-size: 14px; outline: none; background: #EEF2FF; min-width: 0; }
.promo-btn { padding: 0 16px; background: var(--indigo); color: white; border: none; border-radius: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }

.status-badge { font-size: 11px; padding: 4px 10px; border-radius: 10px; font-weight: 800; display: inline-block; }
.status-paid { background: var(--mint-light); color: var(--mint); }
.status-unpaid { background: #FFEDD5; color: #EA580C; }

.chat-row { display: flex; gap: 16px; padding: 16px; background: var(--white); border-radius: 20px; margin-bottom: 12px; border: 1px solid var(--border); align-items: center; cursor: pointer; transition: 0.1s; }
.chat-row:active { transform: scale(0.98); }
.chat-avatar { width: 52px; height: 52px; background: var(--indigo); color: var(--white); border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 20px; font-weight: 800; flex-shrink: 0;}
.chat-text { flex: 1; overflow: hidden; }
.chat-name { font-weight: 800; font-size: 16px; color: var(--text-main); margin-bottom: 4px; }
.chat-preview { font-size: 14px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-room { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg); z-index: 30; display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.chat-room.active { transform: translateX(0); }
.chat-header { background: var(--white); padding: max(20px, env(safe-area-inset-top)) 20px 15px; display: flex; align-items: center; gap: 15px; border-bottom: 1px solid var(--border); }
@media (min-width: 480px) { .chat-header { padding-top: 45px; } }
.back-btn { font-size: 24px; color: var(--indigo); cursor: pointer; font-weight: 800; padding-right: 10px; }
.chat-msgs { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.bubble { padding: 12px 16px; border-radius: 20px; font-size: 15px; max-width: 80%; line-height: 1.4; position: relative; }
.bubble.in { background: var(--white); color: var(--text-main); align-self: flex-start; border-bottom-left-radius: 4px; border: 1px solid var(--border); }
.bubble.out { background: var(--indigo); color: var(--white); align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-input-bar { background: var(--white); padding: 12px 20px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.chat-input-bar input { flex: 1; background: var(--bg); border: none; padding: 14px 20px; border-radius: 24px; font-size: 15px; outline: none; }
.send-btn { width: 44px; height: 44px; background: var(--indigo); color: white; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 18px; border: none; cursor: pointer; }

.notice { background: var(--white); padding: 16px; border-radius: 20px; border-left: 4px solid var(--indigo); margin-bottom: 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.02); }

#dasha-lesson-modal { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); align-items: center; justify-content: center; z-index: 100000; }
#dasha-lesson-modal.active { display: flex !important; }
.dasha-modal-content { background: var(--white); padding: 30px; border-radius: 24px; width: 90%; max-width: 350px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.3); animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

.legal-footer { margin-top: 40px; padding: 20px 10px; text-align: center; border-top: 1px solid var(--border); width: 100%; }
.legal-footer a { color: var(--indigo); text-decoration: underline; font-weight: 800; font-size: 14px; margin: 0 10px; display: inline-block; }

button, .btn, a, input[type="submit"], input[type="button"] {
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
}
