:root {
  /* Фирменные цвета K2 Concept Place — сняты с логотипа (webapp/static/logo.png),
     не зависят от темы Telegram: хедер/таббар всегда в этих цветах. */
  --brand-burgundy: #4c1517;
  --brand-burgundy-deep: #330e10;
  --brand-burgundy-light: #6d2226;
  --brand-gold: #ccb99a;
  --brand-gold-bright: #e6d6ba;

  --bg: #170a0b;
  --secondary-bg: #261113;
  --section-bg: #261113;
  --text: #f2e8dd;
  --hint: #ad9080;
  --link: var(--brand-gold-bright);
  --button: var(--brand-burgundy);
  --button-text: var(--brand-gold-bright);

  --danger: #b8453f;
  --success: #6f9463;
  --warn: #cc9a3a;
  --info: #b96a3a;

  /* Unbounded/Golos Text — тот же дизайн-язык, что и в гостевом Mini App
     (webapp/static/guest/style.css), продублировано намеренно: независимая
     сборка без общего CSS. */
  --font-display: 'Unbounded', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Golos Text', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --card-border: rgba(204,185,154,0.16);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #faf4ea;
    --secondary-bg: #ffffff;
    --section-bg: #ffffff;
    --text: #2a1214;
    --hint: #8a7263;
    --link: var(--brand-burgundy);
    --button: var(--brand-burgundy);
    --button-text: var(--brand-gold-bright);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  height: 100%;
}

/* Мягкие плывущие золотые/бордовые пятна за стеклянными панелями — та же
   анимация, что и в гостевом приложении, см. webapp/static/guest/style.css. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg);
  background-repeat: no-repeat;
  background-image:
    radial-gradient(circle, rgba(204,185,154,0.16), transparent 62%),
    radial-gradient(circle, rgba(109,34,38,0.38), transparent 58%),
    radial-gradient(circle, rgba(204,185,154,0.09), transparent 60%);
  background-size: 65% 42%, 70% 55%, 55% 45%;
  background-position: 8% -8%, 105% 15%, 15% 105%;
  animation: bgDrift 26s ease-in-out infinite alternate;
}
@keyframes bgDrift {
  0% { background-position: 8% -8%, 105% 15%, 15% 105%; }
  50% { background-position: 22% 4%, 82% 34%, 32% 88%; }
  100% { background-position: 4% 12%, 92% 5%, 45% 96%; }
}
@media (prefers-color-scheme: light) {
  body::before {
    background-image:
      radial-gradient(circle, rgba(204,185,154,0.28), transparent 62%),
      radial-gradient(circle, rgba(76,21,23,0.10), transparent 58%),
      radial-gradient(circle, rgba(204,185,154,0.20), transparent 60%);
  }
}
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: linear-gradient(180deg, rgba(76,21,23,0.65) 0%, rgba(51,14,16,0.75) 100%);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  padding: calc(16px + var(--tg-safe-top, 0px)) 16px 14px;
  border-bottom: 1px solid rgba(230,214,186,0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  z-index: 5;
}
.topbar img.logo {
  display: block;
  height: 26px;
  width: auto;
}
.topbar-role {
  font-size: 12px;
  color: var(--brand-gold);
  opacity: 0.85;
}
.topbar-role:empty {
  display: none;
}

/* --- векторные иконки (icons.js) --- */
.icon {
  display: block;
  flex-shrink: 0;
}
.icon-inline {
  display: inline-block;
  vertical-align: -4px;
  margin-right: 5px;
  flex-shrink: 0;
}
.icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#content {
  flex: 1;
  padding: 8px 12px 90px;
  overflow-x: hidden;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: linear-gradient(0deg, rgba(51,14,16,0.75) 0%, rgba(76,21,23,0.6) 100%);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-top: 1px solid rgba(230,214,186,0.18);
  padding-bottom: calc(env(safe-area-inset-bottom) + var(--tg-safe-bottom, 0px));
  z-index: 5;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: rgba(230,214,186,0.5);
  padding: 9px 2px 8px;
  font-size: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  min-width: 0;
  transition: transform 0.15s ease, color 0.2s ease;
}
.tab-btn span {
  font-family: var(--font-body);
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.tab-btn.active { color: var(--brand-gold-bright); }
.tab-btn:active { transform: scale(0.88); }

/* --- generic UI --- */

.card {
  background: linear-gradient(155deg, rgba(255,255,255,0.09), rgba(255,255,255,0.02));
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(230,214,186,0.16);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 6px 20px rgba(0,0,0,0.18);
  position: relative;
}
@media (prefers-color-scheme: light) {
  .card {
    background: linear-gradient(155deg, rgba(255,255,255,0.6), rgba(255,255,255,0.28));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 6px 20px rgba(76,21,23,0.08);
  }
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }

input[type=text], input[type=date], input[type=tel], input[type=time], input[type=number], select {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(230,214,186,0.22);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  width: 100%;
  color-scheme: dark;
  font-family: inherit;
  transition: border-color 0.15s ease;
}
input:focus, select:focus { border-color: rgba(230,214,186,0.5); outline: none; }

@media (prefers-color-scheme: light) {
  input[type=text], input[type=date], input[type=tel], input[type=time], input[type=number], select {
    color-scheme: light;
    background: rgba(255,255,255,0.4);
  }
}

button.btn {
  background: linear-gradient(155deg, rgba(109,34,38,0.75), rgba(76,21,23,0.62));
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  color: var(--button-text);
  border: 1px solid rgba(230,214,186,0.2);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
button.btn:active { opacity: 0.75; transform: scale(0.96); }
button.btn.secondary {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(230,214,186,0.3);
  color: var(--text);
}
button.btn.danger { background: var(--danger); color: #fff; }
button.btn.success { background: var(--success); color: #fff; }
button.btn.small { padding: 6px 9px; font-size: 12px; }
button.btn[disabled] { opacity: 0.5; cursor: default; }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  transition: opacity 0.15s;
  white-space: nowrap;
}
.status-chip.pending { background: #cc9a3a26; border-color: var(--warn); color: var(--warn); }
.status-chip.confirmed { background: #6f946326; border-color: var(--success); color: var(--success); }
.status-chip.arrived { background: #b96a3a26; border-color: var(--info); color: var(--info); }
.status-chip.completed { background: rgba(204,185,154,0.12); border-color: var(--hint); color: var(--hint); }
.status-chip.no_show { background: #b8453f26; border-color: var(--danger); color: var(--danger); }
.status-chip.cancelled { background: rgba(204,185,154,0.12); border-color: var(--hint); color: var(--hint); }
.status-chip.inactive { opacity: 0.4; }
.status-chip:active { opacity: 0.7; }

.collapse-toggle-btn {
  background: none;
  border: 1px solid rgba(204,185,154,0.3);
  color: var(--hint);
  border-radius: 6px;
  width: 24px;
  height: 24px;
  line-height: 1;
  font-size: 12px;
  cursor: pointer;
}

.badge {
  display: inline-block;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
}
.badge.pending { background: #cc9a3a33; color: var(--warn); }
.badge.confirmed { background: #6f946333; color: var(--success); }
.badge.arrived { background: #b96a3a33; color: var(--info); }
.badge.completed { background: #ad908033; color: var(--hint); }
.badge.no_show { background: #b8453f33; color: var(--danger); }
.badge.cancelled { background: #ad908033; color: var(--hint); }
.badge.neutral { background: rgba(204,185,154,0.15); color: var(--hint); font-weight: 500; }
.badge.regular { background: #cc9a3a33; color: var(--brand-gold-bright); font-weight: 500; }
.badge.authorized { background: #6f946333; color: var(--success); font-weight: 500; }
.badge.unauthorized { background: rgba(204,185,154,0.1); color: var(--hint); font-weight: 500; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.stat-tile {
  background: linear-gradient(155deg, rgba(255,255,255,0.09), rgba(255,255,255,0.02));
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(230,214,186,0.16);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}
@media (prefers-color-scheme: light) {
  .stat-tile {
    background: linear-gradient(155deg, rgba(255,255,255,0.6), rgba(255,255,255,0.28));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
  }
}
.stat-tile-icon { font-size: 17px; opacity: 0.75; margin-bottom: 2px; }
.stat-tile-value { font-family: var(--font-display); font-size: 23px; font-weight: 600; color: var(--text); line-height: 1.15; }
.stat-tile-label { font-size: 11px; color: var(--hint); margin-top: 3px; line-height: 1.3; }

.card.status-pending { border-left: 3px solid var(--warn); }
.card.status-confirmed { border-left: 3px solid var(--success); }
.card.status-arrived { border-left: 3px solid var(--info); }
.card.status-completed { border-left: 3px solid var(--hint); }
.card.status-no_show { border-left: 3px solid var(--danger); }
.card.status-cancelled { border-left: 3px solid var(--hint); }

.section-title {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--brand-gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin: 14px 0 6px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  text-transform: uppercase;
  margin: 4px 0 14px;
}

.empty {
  color: var(--hint);
  text-align: center;
  padding: 30px 10px;
  font-size: 14px;
}

.spinner {
  text-align: center;
  padding: 30px 10px;
  color: var(--hint);
}

pre.report-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0;
}

.toast {
  position: fixed;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand-burgundy);
  color: var(--brand-gold-bright);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  max-width: 85%;
  text-align: center;
}
.toast.show { opacity: 1; }
.toast.error { background: var(--danger); color: #fff; }

/* --- анимации входа --- */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
#content.anim {
  animation: fadeInUp 0.22s ease both;
}
@media (prefers-reduced-motion: reduce) {
  #content.anim { animation: none; }
}
