/* Дизайн-система «Янтарь» — изумрудно-чёрный бренд (токены из ./tokens/). */
@import url("./tokens/fonts.css");
@import url("./tokens/colors.css");
@import url("./tokens/typography.css");
@import url("./tokens/spacing.css");
@import url("./tokens/effects.css");
@import url("./tokens/base.css");

:root { --slot: var(--slot-h); }

body { margin: 0; font-family: var(--font-ui); font-size: var(--text-md); background: var(--bg-app); color: var(--text-primary); }
#app {
  padding: 16px 16px 130px;
  max-width: var(--app-max);
  margin: 0 auto;
  background-image: var(--light-emerald);
  background-repeat: no-repeat;
  background-size: 100% 320px;
}
.view { display: flex; flex-direction: column; gap: 14px; }

/* На ПК Telegram открывает Mini App маленьким окном — уменьшаем общий масштаб,
   чтобы в окно помещалось больше формы без прокрутки. Класс .tg-desktop вешает
   app.js по tg.platform (tdesktop/macos). На мобиле зум НЕ применяется. */
body.tg-desktop { zoom: 0.8; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.small { font-size: var(--text-sm); }
.with-ic { display: inline-flex; align-items: center; gap: 6px; }
.with-ic svg { width: 14px; height: 14px; }
.pad-x { padding: 0 4px; }
.pad-y { padding: 6px 0; }
.overflow-visible { overflow: visible; }
.accent { color: var(--emerald-400); }
.error { color: var(--red-400); font-size: var(--text-sm); min-height: 18px; text-align: center; }

.eyebrow { font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.eyebrow.accent { color: var(--emerald-400); }

/* ── верхняя панель ── */
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-glass); backdrop-filter: var(--blur-glass);
  border-bottom: 1px solid var(--border-subtle);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-brand img { width: 26px; height: 26px; display: block; }
.topbar-title { font-family: var(--font-display); font-weight: var(--fw-black); font-size: var(--text-lg); letter-spacing: -0.02em; }
.iconbtn { width: 44px; height: 44px; border: none; background: transparent; color: var(--text-secondary); border-radius: var(--r-pill); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.iconbtn svg { width: 20px; height: 20px; }

/* ── меню ── */
.menu {
  position: fixed; right: 12px; top: 58px; z-index: var(--z-menu);
  display: flex; flex-direction: column; min-width: 200px;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-pop);
}
.menu-item { display: flex; align-items: center; gap: 12px; border: none; background: transparent; color: var(--text-primary); text-align: left; padding: 13px 16px; font-size: var(--text-md); font-weight: var(--fw-medium); cursor: pointer; }
.menu-item svg { width: 18px; height: 18px; color: var(--text-muted); }
.menu-item:active { background: var(--accent-soft); }

/* ── карточки ── */
.card { position: relative; background: var(--surface-1); border: 1px solid var(--border-subtle); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--edge-top); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title { font-family: var(--font-ui); font-size: var(--text-lg); font-weight: var(--fw-semibold); margin: 0; color: var(--text-primary); }
.card-hint { font-size: var(--text-xs); color: var(--text-muted); }

/* ── поля ── */
.field { width: 100%; height: var(--control-md); padding: 0 14px; background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border-soft); border-radius: var(--r-md); font-family: var(--font-mono); font-size: var(--text-md); outline: none; color-scheme: dark; }
.field::placeholder { color: var(--text-muted); font-family: var(--font-ui); }
.field:focus { border-color: var(--border-emerald); box-shadow: var(--ring); }
.field-label { font-size: var(--text-2xs); color: var(--text-muted); margin-bottom: 6px; }
.two-col { display: flex; gap: 10px; }
.two-col .tf { flex: 1; min-width: 0; }

/* ── DateStrip ── */
.datestrip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.datestrip::-webkit-scrollbar { height: 0; }
.day { flex: none; width: 56px; padding: 10px 0; border-radius: var(--r-md); text-align: center; cursor: pointer; background: var(--surface-2); border: 1px solid var(--border-subtle); box-shadow: var(--edge-top); color: var(--text-primary); transition: background var(--dur-base), box-shadow var(--dur-base); }
.day-wd { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; opacity: .6; }
.day-dd { font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--fw-bold); line-height: 1.2; margin-top: 2px; }
.day-mon { font-size: 9px; font-family: var(--font-mono); opacity: .5; }
.day.on { background: var(--grad-emerald); border-color: transparent; box-shadow: var(--glow-sm); color: var(--text-on-emerald); }
.day.on .day-wd, .day.on .day-mon { opacity: .8; }

/* ── TimeCombo ── */
.time-fields { display: flex; gap: 10px; margin-top: 12px; }
.time-fields .tf { flex: 1; min-width: 0; }
.time-hint { margin-top: 10px; min-height: 22px; }
.tc { position: relative; min-width: 0; }
.tc-row { position: relative; display: flex; align-items: center; }
.tc-input { width: 100%; height: var(--control-md); padding: 0 36px 0 14px; background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border-soft); border-radius: var(--r-md); font-family: var(--font-mono); font-size: var(--text-md); outline: none; }
.tc-input:focus { border-color: var(--border-emerald); box-shadow: var(--ring); }
.tc-input:disabled { opacity: .45; }
.tc-chev { position: absolute; right: 4px; top: 4px; bottom: 4px; width: 30px; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--emerald-400); cursor: pointer; }
.tc-chev svg { transition: transform var(--dur-base); }
.tc-chev.open svg { transform: rotate(180deg); }
.tc-pop { position: absolute; z-index: var(--z-menu); top: calc(100% + 4px); left: 0; right: 0; max-height: 196px; overflow-y: auto; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 4px; }
.tc-opt { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 8px 12px; border: none; border-radius: var(--r-sm); background: transparent; color: var(--text-primary); font-family: var(--font-mono); font-size: var(--text-sm); cursor: pointer; text-align: left; }
.tc-opt.on { background: var(--accent-soft); color: var(--emerald-300); }
.tc-opt svg { width: 14px; height: 14px; color: var(--emerald-400); }
.tc-empty { padding: 10px 12px; font-size: var(--text-sm); color: var(--text-muted); }

/* ── DateField: выпадающий календарь ── */
.cal-pop { left: 0; right: auto; width: min(290px, calc(100vw - 40px)); max-height: none; overflow: visible; padding: 8px; }
.cal-pop.cal-right { left: auto; right: 0; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-title { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--text-sm); letter-spacing: -.01em; }
.cal-nav { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: var(--r-sm); background: var(--surface-3); color: var(--emerald-400); cursor: pointer; }
.cal-nav svg { width: 16px; height: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-wd { text-align: center; font-family: var(--font-mono); font-size: var(--text-3xs); color: var(--text-muted); text-transform: uppercase; padding-bottom: 2px; }
.cal-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border: none; border-radius: var(--r-sm); background: transparent; color: var(--text-primary); font-family: var(--font-mono); font-size: var(--text-sm); cursor: pointer; }
.cal-cell.empty { visibility: hidden; }
.cal-cell:disabled { color: var(--text-muted); opacity: .3; cursor: default; }
.cal-cell.today { box-shadow: inset 0 0 0 1px var(--border-emerald); }
.cal-cell.sel { background: var(--grad-emerald); color: var(--text-on-emerald); font-weight: var(--fw-semibold); }

/* ── лента времени ── */
.tl-scroll { max-height: 320px; overflow-y: auto; border-radius: var(--r-md); background: var(--bg-sunken); border: 1px solid var(--border-subtle); }
.tl-grid { position: relative; background-image: repeating-linear-gradient(to bottom, var(--border-subtle) 0, var(--border-subtle) 1px, transparent 1px, transparent calc(2 * var(--slot))); }
.tl-hour { position: absolute; left: 0; padding-left: 8px; width: 44px; font-size: var(--text-3xs); font-family: var(--font-mono); color: var(--text-muted); }
.tl-past { position: absolute; left: 0; right: 0; top: 0; background: var(--slot-past); pointer-events: none; }
.tl-busy { position: absolute; left: 50px; right: 8px; overflow: hidden; padding: 3px 8px; border-radius: var(--r-xs); background: var(--slot-busy); border-left: 2px solid var(--slot-busy-line); pointer-events: none; }
.tl-busy.block { border-left-color: var(--text-muted); }
.tl-busy b { font-family: var(--font-mono); font-size: var(--text-2xs); font-weight: 500; color: var(--text-secondary); }
.tl-busy span { font-size: var(--text-2xs); color: var(--text-muted); margin-left: 6px; }
.tl-sel { position: absolute; left: 50px; right: 8px; border-radius: var(--r-xs); border: 2px solid var(--accent); background: var(--slot-selected); box-shadow: var(--glow-sm); pointer-events: none; transition: top .15s var(--ease-out), height .15s var(--ease-out); }
.tl-now { position: absolute; left: 44px; right: 0; height: 2px; background: var(--now-line); pointer-events: none; }
.tl-now span { position: absolute; left: -3px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--now-line); }

/* ── оборудование (строка с иконкой) ── */
.equipment { display: flex; flex-direction: column; gap: 8px; }
.eq { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--r-md); text-align: left; background: var(--surface-2); border: 1px solid var(--border-subtle); box-shadow: var(--edge-top); color: var(--text-primary); cursor: pointer; }
.eq.selected { background: var(--accent-soft-2); border-color: var(--border-emerald); box-shadow: var(--glow-sm); }
.eq[aria-disabled="true"] { opacity: .4; text-decoration: line-through; cursor: default; }
.eq-icon { width: 36px; height: 36px; flex: none; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--text-secondary); }
.eq-icon.on { background: var(--emerald-400); color: var(--text-on-emerald); }
.eq-icon svg { width: 19px; height: 19px; }
.eq-name-lbl { flex: 1; min-width: 0; font-size: var(--text-md); font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eq .rate { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-muted); flex: none; }
.eq.selected .rate { color: var(--emerald-200); }
.eq-check { color: var(--emerald-400); flex: none; }
.eq-check svg, .eq svg { width: 17px; height: 17px; }

/* ── футер брони ── */
.booking-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky); padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--bg-app); border-top: 1px solid var(--border-subtle); max-width: var(--app-max); margin: 0 auto; }
.footer-line { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; padding: 0 2px; }
.footer-total { font-family: var(--font-mono); font-size: var(--text-lg); font-weight: var(--fw-semibold); color: var(--emerald-300); }

/* ── главная кнопка ── */
.main-btn { width: 100%; height: var(--control-lg); border: none; border-radius: var(--r-md); background: var(--grad-emerald); color: var(--text-on-emerald); font-family: var(--font-ui); font-size: var(--text-md); font-weight: var(--fw-semibold); cursor: pointer; box-shadow: var(--glow-sm); display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform var(--dur-fast) var(--ease-out); }
.main-btn svg { width: 19px; height: 19px; }
.main-btn:active { transform: scale(.975); }
.main-btn:disabled { opacity: .45; box-shadow: none; }
.main-btn.static { position: static; margin-top: 14px; }
.main-btn.secondary { background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border-soft); box-shadow: none; }
.main-btn.danger-btn { background: var(--red-bg); color: var(--red-400); border: 1px solid rgba(240, 88, 74, .3); box-shadow: none; }

/* ── админ ── */
.admin-only { display: none; }
body.admin .admin-only { display: flex; }
body.admin .menu-item.admin-only { display: flex; }
.admin-head { display: flex; align-items: center; gap: 8px; }
.admin-head svg { width: 18px; height: 18px; }
.accent-ic { color: var(--emerald-400); }
.admin-head-title { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--text-xl); letter-spacing: -.02em; }

.rec-list { display: flex; flex-direction: column; gap: 8px; }
.rec { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-subtle); }
.rec-left { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.rec-time { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); }
.rec-label { font-size: var(--text-sm); color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.confirm-actions { display: inline-flex; gap: 14px; flex: none; }
.link-btn { border: none; background: transparent; color: var(--emerald-400); cursor: pointer; font-family: var(--font-ui); font-size: var(--text-sm); font-weight: var(--fw-semibold); }
.link-btn.danger { color: var(--red-400); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-secondary); font-size: var(--text-2xs); font-weight: var(--fw-semibold); }
.badge.busy { background: var(--slot-busy); color: var(--text-muted); }
.badge.amber { background: var(--accent-soft); color: var(--emerald-300); }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ── формы закрытия ── */
.close-form { display: flex; flex-direction: column; gap: 14px; }

/* ── справочник ── */
.icon-tile { width: 44px; height: 44px; flex: none; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; background: var(--surface-3); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.icon-tile svg { width: 20px; height: 20px; }
.icon-tile.on { background: var(--accent-soft-2); color: var(--emerald-400); border-color: var(--border-emerald); }
.icon-tile.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.icon-grid { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border-radius: var(--r-md); background: var(--bg-sunken); border: 1px solid var(--border-subtle); }
.eqm-item { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-subtle); margin-bottom: 12px; }
.eqm-top { display: flex; align-items: center; gap: 8px; }
.eqm-bot { display: flex; align-items: center; gap: 10px; }
.rate-wrap { position: relative; display: flex; align-items: center; flex: none; }
.eqm-rate { width: 110px; padding-right: 34px; }
.rate-suf { position: absolute; right: 12px; color: var(--text-muted); font-family: var(--font-mono); font-size: var(--text-sm); pointer-events: none; }
.spacer { flex: 1; }
.eqm-new { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: var(--r-md); background: var(--bg-sunken); border: 1px dashed var(--border-soft); }

/* ── О студии ── */
.hero { overflow: hidden; }
.hero-wordmark { position: relative; width: 100%; height: 96px; background-image: url("/assets/logo-wordmark.png"); background-repeat: no-repeat; background-size: auto 168px; background-position: left center; margin-bottom: 6px; }
.about-text { font-size: var(--text-md); line-height: 1.55; color: var(--text-secondary); margin: 6px 0 0; }
.about-sub { color: var(--text-secondary); font-size: var(--text-sm); margin-bottom: 12px; }
.pay-about .pay-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.pay-phone { font-size: var(--text-2xl); color: var(--text-primary); }
.pay-meta { margin-top: 10px; color: var(--text-secondary); font-size: var(--text-md); }
.credit { margin-top: 8px; padding: 0 4px; color: var(--text-muted); font-size: var(--text-xs); line-height: 1.6; }
.credit a { color: var(--emerald-400); text-decoration: none; }
.credit a:active { opacity: .7; }

/* ── оверлей успеха ── */
.overlay { position: fixed; inset: 0; z-index: var(--z-overlay); background: var(--bg-app); background-image: var(--light-emerald); background-repeat: no-repeat; display: flex; align-items: center; justify-content: center; padding: 24px; }
.success-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.success-bead { position: relative; width: 96px; height: 96px; margin-bottom: 8px; }
.success-bead img { width: 96px; height: 96px; animation: ds-pop .5s var(--ease-spring); }
.success-check { position: absolute; right: -2px; bottom: -2px; width: 34px; height: 34px; border-radius: 50%; background: var(--green-400); display: flex; align-items: center; justify-content: center; border: 3px solid var(--bg-app); }
.success-check svg { width: 18px; height: 18px; color: #0c2912; }
.success-title { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--text-2xl); margin: 8px 0 2px; letter-spacing: -.02em; }
.success-when { font-size: var(--text-md); color: var(--text-secondary); }
.success-price { font-family: var(--font-mono); font-size: var(--text-xl); font-weight: var(--fw-semibold); color: var(--emerald-300); margin: 12px 0 4px; }
.pay-card { width: 100%; margin-top: 18px; text-align: left; }
.card.raised { background: var(--surface-2); border-color: var(--border-soft); box-shadow: var(--shadow-md); }
@keyframes ds-pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ── оплата ── */
.pay-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0; }
.pay-line .mono { font-size: var(--text-lg); color: var(--text-primary); }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; border: none; border-radius: var(--r-sm); padding: 8px 12px; background: var(--accent); color: var(--text-on-emerald); font-family: var(--font-ui); font-size: var(--text-sm); font-weight: var(--fw-semibold); cursor: pointer; flex: none; }
.copy-btn svg { width: 15px; height: 15px; }
