:root {
  --navy: #1B2A4A;
  --navy-light: #2C3F66;
  --marigold: #F2A93B;
  --marigold-dark: #D6900F;
  --coral: #E8553D;
  --teal: #2F9E77;
  --paper: #EEF2F6;
  --card: #FFFFFF;
  --ink: #1D2530;
  --ink-soft: #5B6472;
  --border: #DDE3EB;
  --radius: 10px;
  --font-display: 'Baloo 2', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* Гарантируем, что атрибут hidden всегда побеждает — без этого правила
   элементы с явным display:flex/grid (модалка, экран входа, каркас
   приложения) оставались видимыми даже при hidden, что приводило к
   «зависшему» пустому окну поверх интерфейса. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; color: var(--navy); }

button, input, select { font-family: inherit; font-size: 14px; }

/* ---------- Кнопки ---------- */
.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--marigold); color: var(--navy); }
.btn-primary:hover { background: var(--marigold-dark); }
.btn-ghost { background: transparent; color: var(--navy); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-danger { background: #FBE7E3; color: var(--coral); }
.btn-danger:hover { background: #F6D2CB; }
.btn-success { background: #E1F3EB; color: var(--teal); }
.btn-success:hover { background: #CDEBDD; }
.btn-block { width: 100%; }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-icon {
  background: transparent; border: none; font-size: 20px; line-height: 1;
  width: 32px; height: 32px; border-radius: 8px; color: var(--navy); cursor: pointer;
}
.btn-icon:hover { background: rgba(27,42,74,0.08); }

.input, .select {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
}
.input:focus, .select:focus { outline: 2px solid var(--marigold); outline-offset: 1px; }

/* ---------- Фирменные элементы ---------- */
.brand-alpha {
  position: absolute;
  top: 8px;
  left: 22px;
  font-family: var(--font-display);
  font-size: 62px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1;
  z-index: 5;
}
.brand-alpha-sidebar { position: static; margin-bottom: 10px; font-size: 52px; }

.studio-credit {
  text-align: center;
  font-size: 15px;
  color: var(--ink-soft);
  margin: 18px 0 0;
}
.studio-credit a { color: var(--marigold-dark); text-decoration: none; font-weight: 600; }
.studio-credit a:hover { text-decoration: underline; }
.studio-credit-sidebar { color: #8393AE; margin-top: 12px; font-size: 14px; }
.studio-credit-sidebar a { color: #C7D0E0; }
.studio-credit-sidebar a:hover { color: #fff; }

/* ---------- Экран входа ---------- */
.login-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #24365c 0%, var(--navy) 55%, #101c33 100%);
  padding: 20px;
}
.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.brand-mark { display: inline-flex; margin-bottom: 8px; }
.login-brand h1 { font-size: 28px; }
.login-subtitle { color: var(--ink-soft); margin: 4px 0 0; font-size: 14px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.login-form input { padding: 10px 12px; border-radius: 8px; border: 1.5px solid var(--border); font-size: 15px; }
.form-error { color: var(--coral); font-size: 13px; margin: -6px 0 0; }

/* ---------- Каркас приложения ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
  padding: 0 6px 18px; line-height: 1.15;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: none; color: #C7D0E0;
  padding: 10px 12px; border-radius: 8px; text-align: left;
  cursor: pointer; font-weight: 500; font-size: 14px;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--navy-light); color: #fff; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 14px; margin-top: 10px; }
.me-card { margin-bottom: 10px; }
.me-name { font-weight: 600; font-size: 14px; }
.me-role { font-size: 12px; color: #9FAEC7; }
.sidebar-footer .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.25); }

.main-area { flex: 1; padding: 24px 28px; overflow-y: auto; }

.view-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.view-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.calendar-nav { display: flex; align-items: center; gap: 10px; }
.calendar-nav h2 { min-width: 200px; }

.segmented { display: inline-flex; background: #E3E9F0; border-radius: 8px; padding: 3px; }
.segmented button {
  border: none; background: transparent; padding: 6px 14px; border-radius: 6px;
  cursor: pointer; font-weight: 600; color: var(--ink-soft); font-size: 13px;
}
.segmented button.active { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 200;
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 8px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.toast.error { background: var(--coral); }
.toast.success { background: var(--teal); }

/* ---------- Календарь: месяц ---------- */
.calendar-grid { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.month-weekday {
  padding: 10px; text-align: center; font-size: 12px; font-weight: 700;
  color: var(--ink-soft); background: #F7F9FB; border-bottom: 1px solid var(--border);
}
.month-cell {
  min-height: 88px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 6px 6px; cursor: pointer; transition: background .1s;
  display: flex; flex-direction: column; gap: 4px;
}
.month-cell:hover { background: #FAFBFD; }
.month-cell.outside { background: #F7F9FB; color: #B7C0CD; }
.month-cell.today .cell-date { background: var(--marigold); color: var(--navy); }
.cell-date { font-weight: 700; font-size: 13px; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.cell-chip {
  font-size: 11px; padding: 2px 6px; border-radius: 5px; color: #fff; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cell-chip.pending { opacity: 1; }
.cell-chip.status-pending {
  background: #E11D48 !important;
  color: #fff;
  border: 1px solid #BE123C;
}
.cell-chip.status-active {
  background: #F5C518 !important;
  color: #1B2A4A;
  border: 1px solid #D4A017;
}
.cell-chip.status-completed {
  background: #94A3B8 !important;
  color: #fff;
}
.day-booking-row.status-pending {
  background: linear-gradient(90deg, #FEE2E2 0%, #FFFFFF 55%);
  border-left: 3px solid #E11D48;
}
.day-booking-row.status-active {
  background: linear-gradient(90deg, #FEF9C3 0%, #FFFFFF 55%);
  border-left: 3px solid #F5C518;
}
.cell-more { font-size: 11px; color: var(--ink-soft); font-weight: 600; padding-left: 2px; }

/* ---------- Календарь: неделя ---------- */
.week-grid { display: grid; grid-template-columns: 64px repeat(7, 1fr); }
.week-header-cell {
  padding: 10px 6px; text-align: center; font-size: 12px; font-weight: 700;
  background: #F7F9FB; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border);
}
.week-header-cell.today { color: var(--marigold-dark); }
.week-time-col { border-bottom: 1px solid var(--border); font-size: 11px; color: var(--ink-soft); padding: 4px; text-align: right; }
.week-day-col { border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); min-height: 46px; padding: 3px; cursor: pointer; }
.week-day-col:hover { background: #FAFBFD; }

/* ---------- Таблицы / карточки ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--border); }
th { background: #F7F9FB; color: var(--ink-soft); font-weight: 700; font-size: 12px; text-transform: none; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #FAFBFD; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-pending { background: #FCE8E6; color: #B42318; }
.badge-active { background: #FFF3C4; color: #8A6D00; }
.badge-cancelled { background: #FBE7E3; color: var(--coral); }
.badge-completed { background: #E7EAF0; color: var(--ink-soft); }
.badge-role { background: #E3E9F0; color: var(--navy); }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.attraction-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.attraction-card .swatch { width: 32px; height: 8px; border-radius: 4px; margin-bottom: 10px; }
.attraction-card h4 { margin: 0 0 4px; font-family: var(--font-display); color: var(--navy); }
.attraction-card p { margin: 0 0 10px; font-size: 13px; color: var(--ink-soft); }
.attraction-card .meta { font-size: 12px; color: var(--ink-soft); margin-bottom: 10px; }
.attraction-card.inactive { opacity: 0.55; }

/* ---------- Модальное окно ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,22,38,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 300; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(0,0,0,0.35);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff;
}
.modal-body { padding: 20px 22px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.field label { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.field-hint { font-size: 12px; color: var(--ink-soft); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }

.day-booking-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border); gap: 10px;
  flex-wrap: wrap;
}
.day-booking-row:last-child { border-bottom: none; }
.booking-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.attraction-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.booking-time { font-weight: 700; font-family: var(--font-display); color: var(--navy); min-width: 92px; }
.booking-info-title { font-weight: 600; }
.booking-info-sub { font-size: 12px; color: var(--ink-soft); }
.booking-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.empty-state { padding: 40px 20px; text-align: center; color: var(--ink-soft); }

.search-result-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); margin-bottom: 6px; }
.search-result-item:hover { background: #FAFBFD; }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 10px 14px; overflow-x: auto; }
  .sidebar-brand { padding: 0 12px 0 0; }
  .sidebar-nav { flex-direction: row; }
  .sidebar-footer { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .main-area { padding: 16px; }
}

/* Регистрация на стартовой странице */
.login-switch { text-align: center; margin-top: 14px; font-size: 14px; color: var(--ink-soft); }
.link-btn {
  background: none; border: none; color: var(--teal); font-weight: 600;
  cursor: pointer; padding: 0; font-size: inherit; text-decoration: underline;
}
.reg-hint {
  font-size: 12.5px; line-height: 1.45; color: var(--ink-soft);
  background: #F7F9FC; border-radius: 10px; padding: 10px 12px; margin: 4px 0 8px;
}

/* Онлайн-заявки клиентов — заметнее для менеджера */
.day-booking-row.online-booking {
  background: linear-gradient(90deg, #FFF8E8 0%, #FFFFFF 40%);
  border-left: 3px solid var(--marigold-dark, #C9892E);
}
.badge-online {
  background: #FFE8B8; color: #8A5A00; font-size: 11px;
}
.day-booking-row.pending-online {
  box-shadow: inset 0 0 0 1px rgba(201, 137, 46, 0.35);
}

/* Напоминания о днях рождения под календарём */
.birthday-reminders {
  margin-top: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px 12px;
  max-height: 200px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.birthday-reminders-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.birthday-reminders-title .cake {
  font-size: 15px;
}
.birthday-reminders-list {
  overflow-y: auto;
  min-height: 0;
  padding-right: 2px;
}
.bday-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
  background: #FFF9FC;
}
.bday-row:last-child { margin-bottom: 0; }
.bday-row.sent {
  background: #F5F7F9;
  opacity: 0.85;
}
.bday-row .bday-main {
  flex: 1 1 200px;
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
}
.bday-row .bday-main strong { font-weight: 600; }
.bday-row .bday-meta {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 1px;
}
.bday-row .bday-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.badge-bday-pending {
  background: #FCE4EC;
  color: #AD1457;
}
.badge-bday-sent {
  background: #E8F5E9;
  color: #2E7D32;
}

/* Блок детей в форме заказчика */
.children-block {
  margin-top: 8px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #FAFBFC;
}
.children-block h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--ink-soft);
  font-weight: 600;
}
.child-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.child-fields:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.child-fields .child-label {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
}
@media (max-width: 520px) {
  .child-fields { grid-template-columns: 1fr; }
}
