/* ===== Tokens ===== */
@font-face {
  font-family: 'Manrope Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/fonts/manrope-cyrillic-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/fonts/manrope-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg-0: #050B16;
  --bg-1: #0A1A33;
  --glass: rgba(255, 255, 255, 0.05);
  --glass-2: rgba(255, 255, 255, 0.08);
  --glass-3: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #F4F7FF;
  --muted: #93A3BF;
  --muted-2: #7F8FAB;
  --accent: #3D8BFF;
  --accent-hi: #5C9DFF;
  --accent-lo: #2C6FE0;
  --accent-soft: rgba(61, 139, 255, 0.16);
  --accent-glow: rgba(61, 139, 255, 0.45);
  --ok: #3DD68C;
  --warn: #FFB547;
  --danger: #FF6B78;

  --r-xl: 28px;
  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 12px;
  --pill: 999px;

  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 40px; --s6: 48px; --s8: 64px;

  --font: 'Manrope Variable', 'Manrope', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --blur: blur(20px) saturate(140%);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);

  --tabbar-h: 72px;
  --rail-w: 248px;
  --panel-w: 420px;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: radial-gradient(120% 80% at 50% -10%, var(--bg-1) 0%, var(--bg-0) 60%) fixed, var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body.scroll-lock { overflow: hidden; }

/* Technical grid + glow */
.bg-fx { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.bg-fx::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(120, 160, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 160, 255, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(90% 70% at 50% 20%, #000 20%, transparent 80%);
  -webkit-mask-image: radial-gradient(90% 70% at 50% 20%, #000 20%, transparent 80%);
}
.bg-fx::after {
  content: ''; position: absolute; width: 900px; height: 900px; left: 50%; top: -420px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(var(--accent-rgb), 0.22), transparent);
}

h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent); color: #fff; }

:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; border-radius: 8px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }

/* ===== Glass ===== */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.card { padding: var(--s3); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border-radius: var(--pill); border: 1px solid transparent;
  font-weight: 700; font-size: 16px; text-decoration: none; white-space: nowrap;
  transition: transform .18s var(--ease), background-color .18s, border-color .18s, box-shadow .18s, opacity .18s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 10px 30px rgba(var(--accent-rgb), 0.35); }
.btn-primary:hover { background: var(--accent-hi); }
.btn-glass { background: var(--glass-2); border-color: var(--line-2); color: var(--text); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.btn-glass:hover { background: var(--glass-3); }
.btn-ghost { background: transparent; color: var(--muted); padding: 0 12px; }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: rgba(255, 107, 120, 0.12); color: var(--danger); border-color: rgba(255, 107, 120, 0.25); }
.btn-danger:hover { background: rgba(255, 107, 120, 0.2); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 14px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 50%; border: 1px solid var(--line); background: var(--glass);
  color: var(--text); transition: background-color .18s, transform .18s var(--ease);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.icon-btn:hover { background: var(--glass-3); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; }

/* ===== Chips ===== */
.chips { display: flex; flex-wrap: wrap; gap: var(--s1); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border-radius: var(--pill); border: 1px solid var(--line-2); background: var(--glass);
  font-size: 14px; font-weight: 600; color: var(--text);
  transition: background-color .2s, border-color .2s, transform .2s var(--ease), color .2s;
}
.chip:hover { background: var(--glass-3); }
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ===== Forms ===== */
.field { display: grid; gap: 6px; }
.field > span, .field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 12px 16px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04);
  color: var(--text); outline: none; transition: border-color .18s, background-color .18s;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.06); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
.select option { background: #0B1830; }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.7); cursor: pointer; }
.form-grid { display: grid; gap: var(--s2); }
.form-row { display: grid; gap: var(--s2); grid-template-columns: 1fr 1fr; }
.field-error { color: var(--danger); font-size: 13px; }

.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { appearance: none; flex: none; width: 24px; height: 24px; margin: 0; border-radius: 8px; border: 1.5px solid var(--line-2); background: var(--glass); display: grid; place-items: center; transition: background-color .18s, border-color .18s; cursor: pointer; }
.check input::after { content: ''; width: 10px; height: 6px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform .18s var(--ease); }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.check a { color: var(--accent-hi); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.switch input { appearance: none; width: 48px; height: 28px; margin: 0; border-radius: var(--pill); background: var(--glass-3); border: 1px solid var(--line-2); position: relative; transition: background-color .2s; cursor: pointer; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .22s var(--ease); }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }

/* ===== Badges ===== */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--pill); font-size: 12px; font-weight: 700; background: var(--glass-2); color: var(--muted); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge-confirmed { background: rgba(var(--accent-rgb), 0.16); color: var(--accent-hi); }
.badge-pending { background: rgba(255, 181, 71, 0.14); color: var(--warn); }
.badge-completed { background: rgba(61, 214, 140, 0.14); color: var(--ok); }
.badge-cancelled { background: rgba(255, 107, 120, 0.12); color: var(--danger); }
.badge-example { background: rgba(255, 181, 71, 0.14); color: var(--warn); }

/* ===== Sheet / modal ===== */
.sheet-layer { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(2, 6, 14, 0.62); opacity: 0; transition: opacity .3s var(--ease); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet {
  position: relative; width: 100%; max-height: 92dvh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(20, 34, 62, 0.92), rgba(8, 16, 32, 0.96));
  border: 1px solid var(--line-2); border-bottom: 0; border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow);
  transform: translateY(100%); transition: transform .42s var(--ease-out);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-layer.open .sheet-backdrop { opacity: 1; }
.sheet-layer.open .sheet { transform: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 10px auto 0; flex: none; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s2); padding: var(--s2) var(--s3) var(--s1); flex: none; }
.sheet-head h2 { font-size: 22px; }
.sheet-head p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.sheet-body { padding: var(--s1) var(--s3) var(--s3); overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.sheet-foot { padding: var(--s2) var(--s3) var(--s3); border-top: 1px solid var(--line); flex: none; display: flex; gap: var(--s1); }
.sheet-foot .btn { flex: 1; }

@media (min-width: 768px) {
  .sheet-layer { align-items: center; padding: var(--s3); }
  .sheet { max-width: 560px; max-height: min(86dvh, 860px); border-radius: var(--r-xl); border-bottom: 1px solid var(--line-2); transform: translateY(24px) scale(.97); opacity: 0; transition: transform .32s var(--ease-out), opacity .24s var(--ease); }
  .sheet.wide { max-width: 760px; }
  .sheet-layer.open .sheet { opacity: 1; }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: var(--s3); }
  /* Drawer variant (admin booking details) */
  .sheet-layer.drawer { justify-content: flex-end; align-items: stretch; padding: 0; }
  .sheet-layer.drawer .sheet { max-width: 460px; max-height: none; height: 100%; border-radius: var(--r-xl) 0 0 var(--r-xl); transform: translateX(100%); opacity: 1; }
  .sheet-layer.drawer.open .sheet { transform: none; }
}

/* ===== Toast ===== */
.toast-root { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 14px 18px; border-radius: var(--r-md); background: rgba(16, 28, 52, 0.96); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; font-weight: 600; opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .3s var(--ease-out); }
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: rgba(255, 107, 120, 0.4); }
.toast.ok { border-color: rgba(61, 214, 140, 0.35); }
@media (min-width: 768px) { .toast-root { bottom: 32px; } }

/* ===== Misc ===== */
.skeleton { background: linear-gradient(90deg, var(--glass) 25%, var(--glass-2) 50%, var(--glass) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; border-radius: var(--r-md); }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: var(--s5) var(--s3); color: var(--muted); }
.empty svg { width: 44px; height: 44px; margin: 0 auto var(--s2); opacity: .6; }
.divider { height: 1px; background: var(--line); margin: var(--s2) 0; border: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
