/* Общая тема клиента и кабинета: тёмно-синее «стекло», один акцент --brand из настроек бизнеса. */
:root {
  --brand: #5ba2fa;
  --brand-ink: #061022;
  --bg: #0b0f14;
  --sheet: #151a21;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .075);
  --surface-3: rgba(255, 255, 255, .12);
  --solid: #121722;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #f3f6fb;
  --muted: #8f99a7;
  --faint: #6b7487;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --brand-soft: color-mix(in srgb, var(--brand) 16%, transparent);
  --brand-line: color-mix(in srgb, var(--brand) 50%, transparent);
  --glow: 0 0 16px rgba(255, 255, 255, .34), 0 0 2px rgba(255, 255, 255, .25);
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur-fast: 120ms;
  --dur: 240ms;
  --safe-b: env(safe-area-inset-bottom);
  --safe-t: env(safe-area-inset-top);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background:
    radial-gradient(130% 50% at 50% -10%, #11283b 0%, rgba(17, 40, 59, 0) 60%),
    radial-gradient(90% 40% at 100% 100%, rgba(40, 80, 130, .14) 0%, rgba(11, 15, 20, 0) 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 520px; margin: 0 auto; padding: 0 16px; }
.title { font-weight: 700; letter-spacing: -.035em; text-shadow: var(--glow); }

/* стекло */
.glass {
  background: linear-gradient(180deg, rgba(255,255,255,.115) 0%, rgba(255,255,255,.07) 100%);
  border: 1px solid rgba(255,255,255,.11);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), inset 0 -1px 0 rgba(0,0,0,.25), 0 14px 34px -20px rgba(0,0,0,.9);
  border-radius: var(--radius);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border: 0; border-radius: 999px;
  background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 16px; letter-spacing: -.01em;
  text-decoration: none; box-shadow: 0 8px 26px -10px color-mix(in srgb, var(--brand) 80%, transparent), inset 0 1px 0 rgba(255,255,255,.25);
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.btn:active { opacity: .85; transform: scale(.985); }
.btn[disabled] { opacity: .35; pointer-events: none; box-shadow: none; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255,255,255,.05); }
.btn.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); box-shadow: none; }
.btn.sm { min-height: 40px; padding: 0 16px; font-size: 14px; }
.btn .icon { width: 18px; height: 18px; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  display: grid; place-items: center; flex: none; transition: background var(--dur-fast) ease;
}
.icon-btn:active { background: var(--surface-3); }
.link-btn { border: 0; background: none; color: var(--muted); font-weight: 600; padding: 10px 6px; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
.link-btn.brand { color: var(--brand); }

.icon { width: 20px; height: 20px; flex: none; }
.icon.sm { width: 16px; height: 16px; }

/* ---------- поля ---------- */
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.input {
  width: 100%; min-height: 54px; padding: 14px 18px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: rgba(255,255,255,.04); outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
textarea.input { min-height: 88px; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 17px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 44px; }
input[type="date"].input, input[type="time"].input { color-scheme: dark; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.err { color: var(--danger); font-size: 13px; font-weight: 600; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; border: 1px solid var(--line);
}
.status { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.status.new { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.status.confirmed { background: var(--brand-soft); color: var(--brand); }
.status.done { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }

/* верхняя панель с логотипом */
.topbar { display: flex; align-items: center; gap: 12px; padding: calc(12px + var(--safe-t)) 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.mark {
  width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.04)); border: 1px solid var(--line);
  font-weight: 800; font-size: 13px; letter-spacing: -.02em; color: #fff;
}
.topbar .name { font-weight: 700; font-size: 15px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- шторка ---------- */
.backdrop {
  position: fixed; inset: 0; background: rgba(2, 4, 8, .62); z-index: 40;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity var(--dur) ease; pointer-events: none;
}
.backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: 520px; margin: 0 auto; max-height: 92dvh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #151b27 0%, var(--sheet) 40%);
  border-radius: 28px 28px 0 0; border: 1px solid var(--line-strong); border-bottom: 0;
  box-shadow: 0 -20px 60px -20px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.07);
  transform: translateY(105%); transition: transform 340ms var(--ease); visibility: hidden;
}
.sheet.open { transform: translateY(0); visibility: visible; }
.sheet::before { content: ""; display: block; width: 44px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 10px auto 0; flex: none; }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 20px 10px; flex: none; }
.sheet-head .grow { flex: 1; min-width: 0; }
.sheet-head h2 { font-size: 24px; font-weight: 700; letter-spacing: -.035em; text-shadow: var(--glow); }
.sheet-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.sheet-head .icon-btn { width: 36px; height: 36px; }
.sheet-body { overflow-y: auto; padding: 6px 20px 22px; overscroll-behavior: contain; flex: 1; }
.sheet-foot { padding: 12px 20px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); flex: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(104px + var(--safe-b)); transform: translate(-50%, 16px);
  background: #e9eef8; color: #0a0f1a; padding: 12px 18px; border-radius: 999px; z-index: 90;
  font-weight: 600; font-size: 15px; opacity: 0; transition: opacity var(--dur) ease, transform var(--dur) var(--ease);
  pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.spinner {
  width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--brand);
  animation: spin .8s linear infinite; margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-3) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty-state { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty-state .ring { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; background: var(--brand-soft); color: var(--brand); }
.empty-state .ring .icon { width: 28px; height: 28px; }
.empty-state h3 { color: var(--text); font-size: 18px; margin-bottom: 6px; }
.empty-state p { margin: 0 0 18px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
