/* ============================================================
   Прототип мобильной админки CIGI · оболочка и общие куски интерфейса.
   Вид — ТОЛЬКО из токенов и классов среднего прода (tokens.css, glass.css, glass-badge.css, kpi-tile.css, glass-stepper.css).
   Здесь — геометрия (--p-*, шаблон «Админка телефон» из DESIGN_SYSTEM §4) и раскладка; цвета, стекло, тени, радиусы — переменные --cigi-* / --glass-* / --rim-* / --r-*.
   Свои градиенты, цвета и тени не вводить.
   ============================================================ */

:root {
  --p-screen-w: 390px; --p-screen-h: 844px; --p-screen-radius: 44px;
  --p-pad: 16px;                 /* поля экрана (шаблон: поля 16) */
  --p-status: 54px;              /* зона статус-бара */
  --p-btn: 44px;                 /* круглая кнопка шапки (шаблон: кнопки 44) */
  --p-gap: 8px;                  /* между рядами шапки */
  --p-bottom-safe: 34px;         /* зона home indicator */
  --p-menu-h: 68px;              /* нижнее меню (шаблон: 68) */
  --p-tab: 60px;                 /* круг вкладки (--bm-tab среднего прода) */
  --p-sub-gap: 12px;             /* саб-боттом-бар над нижним меню */
  --p-content-top: 114px;        /* 54 + 44 + 16 (саб-бара нет) */
  --p-content-bottom: 190px;     /* 34 + 68 + 12 + 44 + 32 */
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font-ui); font-size: 14px; line-height: 20px; display: flex; justify-content: center; align-items: center; min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- экран ---------- */
.screen { position: relative; flex: none; width: var(--p-screen-w); height: var(--p-screen-h); border-radius: var(--p-screen-radius); overflow: hidden; background: var(--bg); box-shadow: 0 0 0 1px var(--border); isolation: isolate; }
/* фон админки = AtmosphereBackground (чёрное полотно + текстура янтарного дыма, opacity .85) — статичная картинка из public/images/bg */
.screen::before { content: ""; position: absolute; inset: 0; z-index: 0; background: url(../assets/bg/amber-smoke.webp) center / cover no-repeat; opacity: .85; pointer-events: none; }
.chrome-scroll { position: absolute; inset: 0; z-index: 1; overflow-x: hidden; overflow-y: auto; padding: var(--p-content-top) var(--p-pad) var(--p-content-bottom); scrollbar-width: none; overscroll-behavior: contain; outline: 0; }
.chrome-scroll::-webkit-scrollbar { display: none; }
.page { display: flex; flex-direction: column; gap: 12px; }
.page > .page__section { display: flex; flex-direction: column; gap: 12px; }
.page-enter { animation: p-fade .25s ease both; }
@keyframes p-fade { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }
.home-indicator { position: absolute; left: 50%; bottom: 8px; width: 134px; height: 5px; margin-left: -67px; border-radius: 3px; background: var(--text); z-index: 20; pointer-events: none; }

/* ---------- статус-бар (имитация iOS) ---------- */
.status-bar { position: absolute; left: 0; top: 0; width: 100%; height: var(--p-status); z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 12px 30px 0 40px; color: var(--text); pointer-events: none; }
.status-bar__time { font: 600 15px/20px var(--font-ui); font-variant-numeric: tabular-nums; }
.status-bar__icons { display: flex; align-items: center; gap: 6px; }
.status-bar svg { display: block; fill: currentColor; }

/* ---------- иконки ---------- */
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.rbtn .ic { width: 22px; height: 22px; stroke-width: 1.5; }

/* ---------- круглая кнопка = .glass-btn.glass-round (GlassIconButton) ---------- */
.rbtn { position: relative; width: var(--p-btn); height: var(--p-btn); border-radius: 50%; padding: 0; border: 0; display: inline-grid; place-items: center; flex: none; cursor: pointer; color: var(--text); overflow: visible; -webkit-tap-highlight-color: transparent; }
.rbtn.rbtn--sm { width: 36px; height: 36px; }
.rbtn.rbtn--accent { --rim-rgb: var(--cigi-accent-rgb); --round-tint: rgba(var(--cigi-accent-rgb), .15); color: var(--cigi-accent); }
.rbtn.rbtn--danger { --rim-rgb: var(--red-rgb); --round-tint: rgba(var(--red-rgb), .14); color: var(--red); }
.rbtn.rbtn--success { --rim-rgb: var(--green-rgb); --round-tint: rgba(var(--green-rgb), .14); color: var(--green); }
.rbtn[hidden], .rbtn.is-ghost { visibility: hidden; pointer-events: none; }
.rbtn.is-on { --rim-rgb: var(--cigi-accent-rgb); --round-tint: rgba(var(--cigi-accent-rgb), .15); color: var(--cigi-accent); }

/* ---------- верхнее меню: слева Меню + Уведомления, по центру часы, справа Сообщения + Віолетта ---------- */
.top-menu { position: absolute; z-index: 10; left: var(--p-pad); top: var(--p-status); width: calc(var(--p-screen-w) - 2 * var(--p-pad)); height: var(--p-btn); display: grid; grid-template-columns: auto auto 1fr auto auto; align-items: center; column-gap: var(--p-gap); }
.top-menu__clock { justify-self: center; font: 600 24px/29px var(--font-ui); font-variant-numeric: tabular-nums; color: var(--text2); text-shadow: var(--text-shadow-glass); user-select: none; white-space: nowrap; }

/* ---------- саб-бар: ситуативная кнопка | плашка | ситуативная кнопка (SubBar среднего прода) ---------- */
.sub-bar { position: absolute; z-index: 10; left: var(--p-pad); top: calc(var(--p-status) + var(--p-btn) + var(--p-gap)); width: calc(var(--p-screen-w) - 2 * var(--p-pad)); height: var(--p-btn); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.sub-bar > .sub-bar__slot:has(~ .cigi-sub-title) { justify-self: start; }
.sub-bar > .cigi-sub-title ~ .sub-bar__slot { justify-self: end; }
.sub-bar__slot { display: flex; align-items: center; gap: var(--p-gap); min-width: var(--p-btn); }
.cigi-sub-title ~ .sub-bar__slot { justify-content: flex-end; }
.cigi-sub-title { height: 36px; border-radius: 30px; display: flex; align-items: center; justify-content: center; gap: .35em; padding: 0 18px; font-size: 14px; font-weight: 700; text-transform: uppercase; color: var(--text); letter-spacing: .04em; position: relative; background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur)) var(--glass-dim); -webkit-backdrop-filter: blur(var(--glass-blur)) var(--glass-dim); box-shadow: var(--glass-shadow); max-width: 220px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: default; }
.cigi-sub-title::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: var(--glass-border); background: var(--rim-white); -webkit-mask: var(--rim-mask); mask: var(--rim-mask); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; opacity: .6; }
.cigi-sub-title .accent { color: var(--cigi-accent); }

/* ---------- саб-боттом-бар: кнопка | поле/переключатель | кнопка ---------- */
.sub-bottom-bar { position: absolute; z-index: 10; left: var(--p-pad); bottom: calc(var(--p-bottom-safe) + var(--p-menu-h) + var(--p-sub-gap)); width: calc(var(--p-screen-w) - 2 * var(--p-pad)); height: var(--p-btn); display: grid; grid-template-columns: var(--p-btn) 1fr var(--p-btn); column-gap: var(--p-gap); align-items: center; }
.sub-bottom-bar[hidden] { display: none; }
.sub-bottom-bar.is-two-left { grid-template-columns: var(--p-btn) 1fr; }
.sub-bottom-bar.is-two-right { grid-template-columns: 1fr var(--p-btn); }
.sub-bottom-bar .cigi-field-wrap { height: var(--p-btn); }
.sub-bottom-bar .cigi-field-wrap .cigi-field-input { height: 100%; }

/* ---------- нижнее меню = LiquidSegmented bottom-menu: стекло капсулы, круг-вкладка, активная в акценте ---------- */
.bottom-bar { position: absolute; z-index: 10; left: var(--p-pad); bottom: var(--p-bottom-safe); width: calc(var(--p-screen-w) - 2 * var(--p-pad)); height: var(--p-menu-h); display: flex; justify-content: space-between; align-items: center; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, .05); overflow: visible; }
.p-tab { position: relative; flex: 0 0 var(--p-tab); width: var(--p-tab); height: var(--p-tab); padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: transparent; color: var(--text2); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .35s cubic-bezier(.4, 0, .2, 1), background .35s cubic-bezier(.4, 0, .2, 1), color .35s cubic-bezier(.4, 0, .2, 1); }
.p-tab .ic { width: 28px; height: 28px; stroke-width: 1.5; }
@media (hover: hover) {
  .p-tab:hover { transform: translateY(-1px) scale(1.03); }
  .p-tab:active { transform: translateY(1px) scale(.96); }
  .p-tab:not(.is-active):is(:hover, :active) { background: rgba(255, 255, 255, .10); color: var(--text); }
}
@media (hover: none) {
  .p-tab:active { transform: scale(1.25); z-index: 2; }
  .p-tab:not(.is-active):active { background: rgba(255, 255, 255, .10); color: var(--text); }
}
/* активная вкладка = «Скло v2 · Акцент» (круглая .glass-round в цвет акцента) */
.p-tab.is-active { --rim-rgb: var(--cigi-amber-rgb); --round-tint: rgba(var(--cigi-amber-rgb), .2); color: var(--cigi-accent); }
.p-tab:focus-visible { outline: 2px solid var(--cigi-accent); outline-offset: 2px; }
.p-tab .dv-badge { right: 4px; top: 4px; }

/* ---------- типографика ролей (CIGI_TYPOGRAPHY): заголовок 16/700, значение 14/600, подпись 12 капс, пояснение 12/400 ---------- */
.t-title { font-size: 16px; line-height: 22px; font-weight: 700; color: var(--text); text-shadow: var(--text-shadow-glass); }
.t-value { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text); }
.t-label { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--cigi-ink-2); }
.t-cap { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--cigi-ink-2); }
.t-dim { color: var(--cigi-ink-2); }
.t-accent { color: var(--cigi-text-accent); }
.t-ell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- деньги = Money: «грн» золотом .75em, копейки белым/40 ---------- */
.money { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text); }
.money__cur { font-size: .75em; color: var(--cigi-gold); text-transform: none; letter-spacing: 0; }

/* ---------- блок-карточка (.glass-nested, блок ≥ 60px — r26, внутренний отступ 16) ---------- */
.p-card { padding: 16px; border-radius: 26px; display: flex; flex-direction: column; gap: 12px; min-width: 0; text-align: left; color: var(--text); width: 100%; border: 0; font: inherit; }
button.p-card { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.p-card.p-card--tight { gap: 8px; }
.p-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.p-card.is-press { transition: transform .35s cubic-bezier(.4, 0, .2, 1), background .35s; }
@media (hover: none) { .p-card.is-press:active { transform: scale(.97); background: rgba(255, 255, 255, .10); } }
@media (hover: hover) { .p-card.is-press:hover { transform: translateY(-1px); } .p-card.is-press:active { transform: translateY(1px); } }

/* строка «подпись — значение» (CalcRow): подпись капсом, акцентный amber-400; значение справа */
.p-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 12px 0; min-width: 0; }
.p-row + .p-row { position: relative; }
.p-row + .p-row::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--border); }
.p-row__label { min-width: 0; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--cigi-text-accent); }
.p-row__value { margin-left: auto; font-size: 14px; line-height: 20px; font-weight: 600; text-align: right; color: var(--text); min-width: 0; }
.p-rows { display: flex; flex-direction: column; }

/* заголовок секции = SectionLabel (.cigi-sec-lbl из glass.css) */
.page > .cigi-sec-lbl { margin: 20px 0 0; }

/* ---------- список ---------- */
.p-list { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }

/* ---------- капсула (Capsule): плитка 44 + два ряда ---------- */
.p-capsule { display: flex; align-items: center; gap: 12px; min-width: 0; width: 100%; padding: 8px 16px 8px 8px; border-radius: 9999px; text-align: left; border: 0; }
.p-capsule__body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.p-capsule__value { font-size: 16px; line-height: 22px; font-weight: 700; color: var(--text); }
.p-capsule__caption { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--cigi-ink-2); }
.p-capsule.is-danger .p-capsule__value { color: var(--red); }
.icon-tile { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; color: rgb(var(--tint-rgb)); }

/* ---------- бейджи: .cigi-glass-badge из glass-badge.css; тут только ряд ---------- */
.p-badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- пустое состояние = CigiEmptyState ---------- */
.p-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 0; }
.p-empty__ic { width: 108px; height: 108px; border-radius: 50%; margin-bottom: 24px; display: flex; align-items: center; justify-content: center; flex: none; pointer-events: none; --rim-rgb: var(--cigi-accent-rgb); --round-tint: rgba(var(--cigi-accent-rgb), .1); color: var(--cigi-accent); }
.p-empty__ic .ic { width: 48px; height: 48px; stroke-width: 1.5; }
.p-empty h3 { margin: 0 0 8px; font-size: 20px; line-height: 25px; font-weight: 700; color: var(--text); text-shadow: var(--text-shadow-glass); }
.p-empty p { margin: 0; max-width: 260px; font-size: 14px; line-height: 22px; color: var(--text2); text-shadow: var(--text-shadow-glass); text-wrap: balance; }
.p-empty__action { margin-top: 28px; }

/* ---------- капсула-кнопка с текстом (.glass-btn / .glass-btn-gold) ---------- */
.p-btn { height: 44px; padding: 0 20px; border: 0; border-radius: 9999px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; color: var(--text); text-transform: uppercase; letter-spacing: .04em; }
.p-btn.glass-btn-gold { color: var(--cigi-accent); }
.p-btn .ic { width: 18px; height: 18px; }
.p-btn.is-block { width: 100%; }

/* ---------- фильтр-пилюли (FilterPill из glass-chips.css, перенесено без изменений значений) ---------- */
.p-chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 calc(-1 * var(--p-pad)); padding: 4px var(--p-pad); scrollbar-width: none; }
.p-chips::-webkit-scrollbar { display: none; }
.cigi-chip-glass { --tone-rgb: var(--cigi-accent-rgb); position: relative; background: rgba(0, 0, 0, .55); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.cigi-chip-glass::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: var(--glass-border); background: var(--rim-white-soft); -webkit-mask: var(--rim-mask); mask: var(--rim-mask); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.cigi-chip-glass.is-tone { background: linear-gradient(rgba(var(--tone-rgb), var(--f-tone-fill, .1)), rgba(var(--tone-rgb), var(--f-tone-fill, .1))), rgba(0, 0, 0, .55); }
.cigi-chip-glass.is-tone::before { background: linear-gradient(var(--rim-a), rgba(var(--tone-rgb), .6) 0%, rgba(var(--tone-rgb), .23) 25%, rgba(var(--tone-rgb), .23) 75%, rgba(var(--tone-rgb), .6) 100%); }
.cigi-filter-pill { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border: 0; border-radius: 9999px; font-size: 14px; font-weight: 600; white-space: nowrap; flex-shrink: 0; cursor: pointer; transition: color .2s ease, transform .2s ease; color: rgba(var(--tone-rgb), .6); }
.cigi-filter-pill:active { transform: scale(.97); }
.cigi-filter-pill::before { background: linear-gradient(var(--rim-a), rgba(var(--tone-rgb), .3) 0%, rgba(var(--tone-rgb), .11) 25%, rgba(var(--tone-rgb), .11) 75%, rgba(var(--tone-rgb), .3) 100%); }
.cigi-filter-pill.is-tone { color: rgb(var(--tone-rgb)); }
.cigi-filter-pill:focus-visible { outline: 2px solid rgba(var(--tone-rgb), .6); outline-offset: 2px; }
.cigi-counter { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 9999px; font-size: 12px; font-weight: 500; color: var(--text); }

/* ---------- KPI: сетка 2 колонки (админка телефон) ---------- */
.p-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- заказ в списке ---------- */
.p-order { gap: 8px; }
.p-order__meta { display: flex; align-items: baseline; gap: 6px; min-width: 0; font-size: 14px; line-height: 20px; color: var(--cigi-ink-2); white-space: nowrap; }
.p-order__meta > .p-order__name { color: var(--text); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.p-order__meta > span:not(.p-order__name) { flex: none; }
.p-order__meta .sep { color: var(--cigi-ink-3); }

/* позиция в заказе / упаковке */
.p-line { display: flex; align-items: center; gap: 12px; padding: 8px 0; min-width: 0; }
.p-line + .p-line { position: relative; }
.p-line + .p-line::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--border); }
.p-line__img { width: 40px; height: 40px; border-radius: 12px; flex: none; object-fit: contain; display: block; }
.p-line__name { min-width: 0; flex: 1; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-line__qty { flex: none; font-size: 14px; font-weight: 600; color: var(--cigi-text-accent); font-variant-numeric: tabular-nums; }

/* меню разделов */
.p-menu-item { display: flex; align-items: center; gap: 12px; padding: 8px 16px 8px 8px; border-radius: 9999px; border: 0; width: 100%; text-align: left; cursor: pointer; color: var(--text); }
.p-menu-item__title { flex: 1; min-width: 0; font-size: 16px; line-height: 22px; font-weight: 700; }
.p-menu-item .chev { color: var(--cigi-ink-3); }

/* чат-страница Віолетты */
.p-bubble { max-width: 86%; padding: 12px 16px; border-radius: 20px; font-size: 14px; line-height: 20px; }
.p-bubble--me { align-self: flex-end; border-bottom-right-radius: 6px; }
.p-bubble--v { align-self: flex-start; border-bottom-left-radius: 6px; }

@media (prefers-reduced-motion: reduce) { .page-enter { animation: none; } }
.cigi-field-icon-btn[hidden] { display: none; }

/* Затемнение под шапкой и под нижними панелями: лента уходит под хром в темноту,
   текст карточек не налезает на плашку и поле поиска. Чёрный из --bg, без цвета и свечения. */
.screen::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(to bottom, rgb(0 0 0 / .92) 0, rgb(0 0 0 / .78) 96px, rgb(0 0 0 / 0) 150px) top / 100% 150px no-repeat,
    linear-gradient(to top, rgb(0 0 0 / .95) 0, rgb(0 0 0 / .8) 120px, rgb(0 0 0 / 0) 190px) bottom / 100% 190px no-repeat; }
.sub-bottom-bar.is-one { grid-template-columns: 1fr; }
