/* ==========================================================================
   RASIK AI — design system «Галерея» (docs/DESIGN_GALLERY.md, вариант №2 «С чистого листа»)
   Owner: foundation. Contents:
     1. self-hosted fonts (Manrope 400–800 variable, Prata 400; latin + latin-ext + cyrillic)
     2. --g-* tokens: light on :root (default for everyone), dark «Вечерняя» on :root[data-theme="dark"]
     3. base: typography scale, focus ring, selection, phone inputs 16px, reduced motion
     4. components (.g-*): buttons, fields, segmented, panel, media card, tag, status, tile, steps,
        pipeline, chips, notes, empty, skeleton, table, menu, modal (#modal), toasts (#toasts)
     5. legacy bridge: .btn / .card / .badge … re-skinned so not-yet-restyled screens match
     6. app shell (app.html): header, demo strip, studio sidebar, view, footer, phone bottom bar
     7. short screens (zoom 200–400 %), forced colors (Windows high contrast), reduced motion
   Sticky header / sticky bars and focus (WCAG 2.4.11) — one global mechanism, screens rely on it:
     html { scroll-padding-top: var(--g-sticky-top); scroll-padding-bottom: var(--g-sticky-bottom) } keeps any focused
     or scrolled-to element clear of the sticky header and of the bottom bars. --g-sticky-top = header + safe area;
     --g-sticky-bottom = max(phone tab bar, --g-bar-h) + 12px. --g-bar-h is published on <html> by platform.js: it
     measures the sticky/fixed bottom action bar of the current view ([data-sticky-bar], .gs-launch, .wz-bar) as its
     `bottom` offset + height. A screen with a new sticky bottom bar only adds data-sticky-bar to it. Toasts never sit
     over bars: top right under the header (phones: full width under the header). On short screens (≤ 560 px tall,
     e.g. 200–400 % zoom) the header, tab bar and bottom bars stop sticking (section 7) so content keeps the screen.
   Old «Монтажный стол» tokens (--paper, --ink, --acc …) are re-pointed to --g-* in site.css.
   Per-area files load after this one: g-home.css · g-studio.css · g-account.css · g-wizard.css.
   ========================================================================== */

/* ---------- 1. fonts (OFL, /static/fonts/OFL-*.txt) ---------- */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("../fonts/manrope-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("../fonts/manrope-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("../fonts/manrope-latin.woff2") format("woff2"); 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+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Prata"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/prata-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Prata"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/prata-latin.woff2") format("woff2"); 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+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- 2. tokens ---------- */
:root {
  color-scheme: light;
  --g-paper: #FCFAF7;
  --g-soft: #F1EDE5;
  --g-soft-2: #EAE5DC;
  --g-ink: #24231F;
  --g-muted: #67625A;        /* AA (≥ 4.8:1) on paper and on every soft surface */
  --g-faint: #766E62;        /* AA 4.8:1 on paper: minor captions, pending step numbers, placeholders icons */
  --g-line: #E1DCD3;         /* decorative dividers and card borders */
  --g-line-strong: #CFC8BC;
  --g-field-line: #988F82;   /* boundary of form fields: 3:1 on paper (WCAG 1.4.11) */
  --g-accent: #9C4B32;
  --g-accent-hover: #813D29;
  --g-accent-soft: #F3E6DF;
  --g-on-accent: #FFFAF5;
  --g-ok: #4E6A3D;
  --g-ok-soft: #E8EBDF;
  --g-warn: #8A6116;
  --g-warn-soft: #F5ECD7;
  --g-danger: #B42335;
  --g-danger-soft: #F7E1E3;
  --g-info: #3D5A73;
  --g-info-soft: #E4EAEF;
  --g-shadow-pop: 0 20px 60px #29231b14;
  --g-shadow-sm: 0 1px 4px #29231b0c;
  --g-scrim: rgba(36, 35, 31, .42);
  /* media overlays are theme-independent: white text on a dark shade, light chips on photos */
  --g-media-shade: linear-gradient(180deg, transparent, rgba(26, 16, 12, .62));
  --g-media-chip: rgba(252, 250, 247, .92);
  --g-media-chip-ink: #24231F;
  --g-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%2367625A' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --g-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 11.5l7-7M6 4.5h5.5V10'/%3E%3C/svg%3E");

  --g-r-xs: 2px;
  --g-r-sm: 3px;
  --g-r-md: 4px;
  --g-r-pill: 999px;
  --g-s-1: 4px; --g-s-2: 8px; --g-s-3: 12px; --g-s-4: 16px; --g-s-5: 20px; --g-s-6: 24px;
  --g-s-7: 28px; --g-s-8: 32px; --g-s-9: 42px; --g-s-10: 54px; --g-s-11: 72px;

  --g-font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --g-font-display: "Prata", Georgia, "Times New Roman", serif;
  --g-ease: cubic-bezier(.2, .7, .2, 1);
  --g-dur: 180ms;

  /* shell metrics (app.html) */
  --g-header-h: 70px;
  --g-side-w: 216px;
  --g-content-max: 1200px;
  --g-gutter: 28px;
  --g-tabbar-h: 0px;
  --g-tabbar-space: 0px;   /* bottom offset for sticky bars: phone bottom bar + safe area, 0 elsewhere */
  --g-bar-h: 0px;          /* reach of the current view's sticky bottom bar (platform.js measures it) */
  --g-sticky-top: calc(var(--g-header-h) + env(safe-area-inset-top));
  --g-sticky-bottom: calc(max(var(--g-tabbar-space), var(--g-bar-h)) + 12px);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --g-paper: #1B1916;
  --g-soft: #25221E;
  --g-soft-2: #2F2B26;
  --g-ink: #F1EBE3;
  --g-muted: #A69E92;
  --g-faint: #918A7F;
  --g-line: #36312B;
  --g-line-strong: #4A443C;
  --g-field-line: #726B61;
  --g-accent: #D9805F;
  --g-accent-hover: #E6957A;
  --g-accent-soft: #3A2820;
  --g-on-accent: #1B1916;
  --g-ok: #9DBA86;
  --g-ok-soft: #26301F;
  --g-warn: #E0B860;
  --g-warn-soft: #352B17;
  --g-danger: #F08A93;
  --g-danger-soft: #3A1E22;
  --g-info: #9DB6CC;
  --g-info-soft: #1F2730;
  --g-shadow-pop: 0 20px 60px #00000066;
  --g-shadow-sm: 0 1px 4px #00000040;
  --g-scrim: rgba(0, 0, 0, .6);
  --g-media-chip: rgba(27, 25, 22, .86);
  --g-media-chip-ink: #F1EBE3;
  --g-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23A69E92' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
@media (max-width: 767px) {
  :root { --g-header-h: 62px; --g-gutter: 16px; }
  :root:has(> body.app-body), .app-body { --g-tabbar-h: 62px; --g-tabbar-space: calc(62px + env(safe-area-inset-bottom)); }
  :root.kb-open:has(> body.app-body), html.kb-open .app-body { --g-tabbar-space: 0px; }
}

/* ---------- 3. base ---------- */
html { font-synthesis: style; } /* Prata has one weight: never fake a bold */
/* app: focus and in-page jumps never end up under the sticky header or a sticky bottom bar (see the header comment).
   Public pages keep their own `section[id] { scroll-margin-top }` (public.css) and may switch to this later. */
html:has(> body.app-body) { scroll-padding-top: calc(var(--g-sticky-top) + 12px); scroll-padding-bottom: var(--g-sticky-bottom); }
body { font-family: var(--g-font-ui); color: var(--g-ink); background-color: var(--g-paper); background-image: none; font-feature-settings: normal; }
::selection { background: color-mix(in srgb, var(--g-accent) 24%, transparent); color: var(--g-ink); }
:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; border-radius: var(--g-r-xs); }
input[type="checkbox"], input[type="radio"], input[type="range"], progress { accent-color: var(--g-accent); }
.g-num, .num { font-variant-numeric: tabular-nums; }
.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; }

/* typography scale */
.g-eyebrow { display: block; margin: 0 0 10px; font: 600 11.5px/1.4 var(--g-font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--g-muted); }
.g-eyebrow--accent { color: var(--g-accent); }
/* page heads and recaps: the caps line keeps the 11.5 px scale even where older `.page-head p` rules exist */
:is(.page-head, .g-page-head, .recap, .idea-card) :is(p, span, div).g-eyebrow { max-width: none; margin: 0 0 10px; font-size: 11.5px; line-height: 1.4; }
:is(.page-head, .g-page-head, .recap, .idea-card) :is(p, span, div).g-eyebrow--accent { color: var(--g-accent); }
.g-h1 { margin: 0; font: 400 clamp(34px, 5.4vw, 58px)/1.12 var(--g-font-display); letter-spacing: -.03em; color: var(--g-ink); text-wrap: balance; }
.g-h2 { margin: 0 0 11px; font: 400 clamp(28px, 3.6vw, 43px)/1.2 var(--g-font-display); letter-spacing: -.03em; color: var(--g-ink); text-wrap: balance; }
.g-h3 { margin: 0; font: 700 16px/1.35 var(--g-font-ui); letter-spacing: -.005em; color: var(--g-ink); }
.g-h4 { margin: 0; font: 600 14px/1.4 var(--g-font-ui); color: var(--g-ink); }
.g-display-sm { font: 400 24px/1.25 var(--g-font-display); letter-spacing: -.02em; }
.g-lead { margin: 0; max-width: 62ch; font-size: 15px; line-height: 1.65; color: var(--g-muted); text-wrap: pretty; }
.g-text { max-width: 65ch; font-size: 15px; line-height: 1.65; }
.g-small { font-size: 13px; line-height: 1.5; }
.g-caption { display: block; font-size: 12px; line-height: 1.45; color: var(--g-muted); }
.g-muted { color: var(--g-muted); }
.g-accent { color: var(--g-accent); }
.g-big-num { font: 800 clamp(34px, 5vw, 52px)/1 var(--g-font-ui); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* page head: eyebrow → h2 → lead (P.head renders it) */
.g-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin: 0 0 28px; }
.g-page-head > div:first-child { min-width: 0; max-width: 760px; }
.g-page-head .g-h2, .g-page-head .g-h1 { margin-bottom: 10px; }
.g-page-head--center { justify-content: center; text-align: center; }
.g-page-head--center .g-lead { margin-inline: auto; }

/* layout helpers */
.g-stack { display: grid; gap: 18px; min-width: 0; }
.g-stack > * { min-width: 0; }
.g-stack--sm { gap: 10px; }
.g-stack--lg { gap: 32px; }
.g-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.g-row--between { justify-content: space-between; }
.g-row--end { justify-content: flex-end; }
.g-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; align-items: start; }
.g-grid { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: var(--gap, 12px); }
.g-grid--auto { grid-template-columns: repeat(auto-fill, minmax(var(--min, 220px), 1fr)); }
.g-divider { height: 1px; border: 0; margin: 22px 0; background: var(--g-line); }
.g-section { margin-top: 42px; }
.g-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
@media (max-width: 899px) { .g-cols { grid-template-columns: minmax(0, 1fr); gap: 22px; } }
@media (max-width: 767px) { .g-grid { grid-template-columns: repeat(var(--cols-sm, 2), minmax(0, 1fr)); } .g-grid--auto { grid-template-columns: repeat(auto-fill, minmax(min(var(--min-sm, 150px), 100%), 1fr)); } }

/* ---------- 4. components ---------- */
/* buttons: .g-btn (main) · .g-btn-secondary · .g-link (text) · .g-icon-btn; add .g-arr for the ↗ arrow */
.g-btn, .g-btn-secondary, .g-btn-danger, .g-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 11px 18px; border: 1px solid transparent; border-radius: var(--g-r-sm);
  font: 600 14px/1.2 var(--g-font-ui); letter-spacing: 0; text-align: center; text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--g-dur), border-color var(--g-dur), color var(--g-dur), transform var(--g-dur) var(--g-ease);
}
.g-btn { background: var(--g-accent); color: var(--g-on-accent); }
.g-btn:hover { background: var(--g-accent-hover); }
.g-btn-secondary { background: var(--g-paper); color: var(--g-ink); border-color: var(--g-line); }
.g-btn-secondary:hover { background: var(--g-soft); border-color: var(--g-line-strong); }
.g-link { background: transparent; color: var(--g-accent); padding: 10px 10px; }
.g-link:hover { color: var(--g-accent-hover); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.g-btn:active, .g-btn-secondary:active, .g-btn-danger:active { transform: translateY(1px); }
.g-btn svg, .g-btn-secondary svg, .g-btn-danger svg, .g-link svg { width: 17px; height: 17px; flex: none; }
.g-btn--sm, .g-btn-secondary.g-btn--sm, .g-link.g-btn--sm { min-height: 40px; padding: 8px 14px; font-size: 13.5px; }
.g-btn--lg { min-height: 52px; padding: 14px 24px; font-size: 15px; }
.g-btn--block { display: flex; width: 100%; white-space: normal; }
.g-link--inline { min-height: 0; padding: 0; }
.g-btn-danger { background: var(--g-paper); color: var(--g-danger); border-color: color-mix(in srgb, var(--g-danger) 45%, var(--g-line)); }
.g-btn-danger:hover { background: var(--g-danger-soft); }
.g-arr::after { content: ""; flex: none; width: 13px; height: 13px; background: currentColor; -webkit-mask: var(--g-arrow) center / contain no-repeat; mask: var(--g-arrow) center / contain no-repeat; transition: transform var(--g-dur) var(--g-ease); }
.g-arr:hover::after { transform: translate(2px, -2px); }
.g-arr.is-loading::after, .g-arr[aria-busy="true"]::after { display: none; }
.g-btn[disabled], .g-btn[aria-disabled="true"] { background: var(--g-soft-2); color: var(--g-muted); cursor: not-allowed; transform: none; }
.g-btn-secondary[disabled], .g-link[disabled], .g-btn-secondary[aria-disabled="true"], .g-link[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.g-btn.is-loading, .g-btn-secondary.is-loading, .g-link.is-loading, .g-btn[aria-busy="true"] { pointer-events: none; cursor: progress; }
.spinner { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; opacity: .85; animation: g-spin .8s linear infinite; }
@keyframes g-spin { to { transform: rotate(360deg); } }
@media (pointer: coarse) { .g-btn--sm, .g-btn-secondary.g-btn--sm, .g-link.g-btn--sm { min-height: 44px; } }
@media (max-width: 767px) { .g-btn, .g-btn-secondary, .g-btn-danger { min-height: 46px; } }

.g-icon-btn { position: relative; flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--g-line); border-radius: 50%; background: var(--g-paper); color: var(--g-ink); cursor: pointer; transition: background-color var(--g-dur), border-color var(--g-dur), color var(--g-dur); -webkit-tap-highlight-color: transparent; }
.g-icon-btn:hover { background: var(--g-soft); }
.g-icon-btn svg { width: 19px; height: 19px; }
.g-icon-btn--square { border-radius: var(--g-r-sm); }
.g-icon-btn--ghost { border-color: transparent; background: transparent; }
.g-icon-btn--ghost:hover { background: var(--g-soft); }
.g-icon-btn[aria-expanded="true"] { background: var(--g-soft); }

/* fields */
.g-field { display: grid; gap: 8px; min-width: 0; }
.g-field > * { min-width: 0; }
.g-label { font: 600 13px/1.35 var(--g-font-ui); color: var(--g-ink); }
.g-label .g-opt { font-weight: 500; color: var(--g-muted); margin-left: 4px; }
.g-hint { margin: 0; font-size: 12px; line-height: 1.45; color: var(--g-muted); }
.g-error { margin: 0; font-size: 12.5px; line-height: 1.45; font-weight: 600; color: var(--g-danger); }
.g-input, .g-select, .g-textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--g-field-line); border-radius: var(--g-r-xs);
  background: var(--g-paper); color: var(--g-ink); font: 500 14px/1.5 var(--g-font-ui);
  transition: border-color var(--g-dur), box-shadow var(--g-dur); outline: none;
}
.g-input::placeholder, .g-textarea::placeholder { color: var(--g-muted); opacity: 1; }
.g-input:hover, .g-select:hover, .g-textarea:hover { border-color: var(--g-muted); }
.g-input:focus-visible, .g-select:focus-visible, .g-textarea:focus-visible { border-color: var(--g-accent); outline: 2px solid var(--g-accent); outline-offset: 1px; }
.g-textarea { min-height: 112px; padding: 14px; line-height: 1.7; resize: vertical; }
.g-select { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: var(--g-chevron); background-repeat: no-repeat; background-position: right 14px center; cursor: pointer; }
.g-select option { background: var(--g-paper); color: var(--g-ink); }
.g-input[aria-invalid="true"], .g-textarea[aria-invalid="true"], .g-select[aria-invalid="true"], .g-field.is-error .g-input, .g-field.is-error .g-textarea, .g-field.is-error .g-select { border-color: var(--g-danger); }
.g-input:disabled, .g-select:disabled, .g-textarea:disabled { background: var(--g-soft); color: var(--g-muted); cursor: not-allowed; }
.g-field-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 359px) { .g-field-pair { grid-template-columns: minmax(0, 1fr); } }
.g-check { display: inline-flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 0; font-size: 14px; line-height: 1.45; cursor: pointer; }
.g-check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; }
/* phones and touch tablets: 16px in every text field so iOS does not zoom (id-level specificity on purpose) */
@media (max-width: 767px), (pointer: coarse) {
  :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]), select, textarea):not(#g-no-zoom) { font-size: 16px; }
}

/* segmented control: <div class="g-seg" role="radiogroup"><button role="radio" aria-checked="true">… */
.g-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; max-width: 100%; background: var(--g-soft); border-radius: var(--g-r-xs); }
.g-seg > button, .g-seg > a, .g-seg > label {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 9px 14px;
  border: 0; border-radius: var(--g-r-xs); background: transparent; color: var(--g-ink);
  font: 500 14px/1.2 var(--g-font-ui); white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color var(--g-dur), color var(--g-dur), box-shadow var(--g-dur);
}
.g-seg > :hover { color: var(--g-accent); }
.g-seg > [aria-checked="true"], .g-seg > [aria-pressed="true"], .g-seg > [aria-selected="true"], .g-seg > [aria-current="page"], .g-seg > .is-active {
  background: var(--g-paper); color: var(--g-accent); box-shadow: var(--g-shadow-sm); font-weight: 600;
}
.g-seg > button:disabled { opacity: .5; cursor: not-allowed; }
.g-seg svg { width: 16px; height: 16px; flex: none; }
.g-seg small, .g-seg .g-count { font-size: 12px; font-weight: 500; color: var(--g-muted); font-variant-numeric: tabular-nums; }
.g-seg--block { display: flex; width: 100%; }
.g-seg--block > * { flex: 1 1 0; }
.g-seg--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.g-seg--scroll::-webkit-scrollbar { display: none; }
.g-seg--plain { background: transparent; padding: 0; gap: 8px; }

/* chips (suggestions, filters): <button class="g-chip" aria-pressed="false"> */
.g-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px; border: 1px solid var(--g-line); border-radius: var(--g-r-xs); background: var(--g-paper); color: var(--g-ink); font: 500 13.5px/1.25 var(--g-font-ui); text-align: left; cursor: pointer; transition: border-color var(--g-dur), color var(--g-dur), background-color var(--g-dur); }
.g-chip:hover { border-color: var(--g-accent); color: var(--g-accent); }
.g-chip[aria-pressed="true"], .g-chip[aria-checked="true"], .g-chip.is-active { border-color: var(--g-accent); background: var(--g-accent-soft); color: var(--g-ink); font-weight: 600; }
.g-chip svg { width: 15px; height: 15px; flex: none; }
.g-chip .g-chip-x { display: inline-grid; place-items: center; width: 28px; height: 28px; margin: -6px -8px -6px 0; border-radius: 50%; color: var(--g-muted); }
.g-chip .g-chip-x:hover { background: var(--g-soft); color: var(--g-ink); }
@media (pointer: coarse) { .g-chip { min-height: 44px; } }

/* panel */
.g-panel { min-width: 0; padding: 20px; background: var(--g-paper); border: 1px solid var(--g-line); border-radius: var(--g-r-xs); }
.g-panel--soft { background: var(--g-soft); border-color: transparent; }
.g-panel--flush { padding: 0; }
.g-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
@media (max-width: 767px) { .g-panel { padding: 16px; } }

/* media card .g-art (P.art() renders it): honest caption «Пример: …» / «Иллюстрация» */
.g-art { position: relative; display: block; width: 100%; margin: 0; aspect-ratio: var(--ratio, 4 / 5); overflow: hidden; isolation: isolate; container-type: inline-size; border-radius: var(--g-r-xs); background: var(--g-soft-2); color: var(--g-muted); }
.g-art > img, .g-art > video, .g-art > picture, .g-art > picture > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.g-art--contain > img, .g-art--contain > video { object-fit: contain; }
a.g-art > img, a .g-art > img, button .g-art > img { transition: transform .5s var(--g-ease); }
a.g-art:hover > img, a:hover .g-art > img, button:hover .g-art > img { transform: scale(1.025); }
.g-art-cap { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 32px 14px 12px; background: var(--g-media-shade); color: #fff; font: 500 12px/1.4 var(--g-font-ui); text-shadow: 0 1px 8px rgba(25, 16, 20, .55); }
.g-art-cap b { display: block; font-size: 13px; font-weight: 700; }
.g-art-tag, .g-art-badge, .g-art-dur { position: absolute; z-index: 3; max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-art-tag { top: 10px; right: 10px; padding: 3px 8px; border-radius: var(--g-r-xs); background: var(--g-media-chip); color: var(--g-media-chip-ink); font: 600 11px/1.4 var(--g-font-ui); letter-spacing: .02em; }
.g-art-badge { top: 10px; left: 10px; }
.g-art-badge { display: flex; }
.g-art-badge .g-status { display: flex; max-width: 100%; min-width: 0; padding: 4px 9px 4px 8px; border-radius: var(--g-r-xs); background: var(--g-media-chip); }
.g-art-badge .g-status-t, .g-status-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-st-short { display: none; }
.g-art-dur { right: 10px; bottom: 10px; padding: 2px 7px; border-radius: var(--g-r-xs); background: rgba(26, 16, 12, .62); color: #fff; font: 600 11.5px/1.5 var(--g-font-ui); font-variant-numeric: tabular-nums; }
.g-art-cap ~ .g-art-dur { bottom: auto; top: 10px; }
.g-art-play { position: absolute; z-index: 2; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: var(--g-media-chip); box-shadow: 0 4px 18px rgba(0, 0, 0, .18); pointer-events: none; }
.g-art-play::after { content: ""; position: absolute; left: 18px; top: 14px; border-style: solid; border-width: 9px 0 9px 14px; border-color: transparent transparent transparent var(--g-accent); }
.g-art-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--g-faint); }
.g-art-ph svg { width: 28px; height: 28px; }
.g-art--audio { background: var(--g-soft); }
.g-art-wave { position: absolute; inset: 28% 12%; color: var(--g-accent); }
.g-art-wave svg { width: 100%; height: 100%; fill: currentColor; }
.g-art--text { background: var(--g-paper); box-shadow: inset 0 0 0 1px var(--g-line); }
.g-art-text { position: absolute; inset: 0; padding: 14px; overflow: hidden; font-size: 12.5px; line-height: 1.5; color: var(--g-muted); }
.g-art.is-busy::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--g-paper) 55%, transparent) 50%, transparent 70%); transform: translateX(-100%); animation: g-shimmer 1.6s infinite; }
.g-art.is-fail { box-shadow: inset 0 0 0 1px var(--g-danger); }
.g-art.is-on { outline: 2px solid var(--g-accent); outline-offset: 3px; }
@container (max-width: 200px) {
  /* narrow cards (phones, history strips): long statuses switch to their short twin («Кредиты возвращены» → «Возврат»);
     the long text stays for screen readers */
  .g-art-badge .g-st-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .g-art-badge .g-st-short { display: inline; }
}
@container (max-width: 128px) {
  /* tiny thumbnails: the badge keeps only its coloured dot; the status text stays for screen readers */
  .g-art-tag, .g-art-cap { display: none; }
  .g-art-badge .g-status-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .g-art-badge { top: 6px; left: 6px; }
  .g-art-badge .g-status { padding: 4px; }
  .g-art-dur { right: 6px; bottom: 6px; font-size: 11px; padding: 1px 5px; }
  .g-art-play { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
  .g-art-play::after { left: 12px; top: 9px; border-width: 6px 0 6px 9px; }
}

/* tag and status */
.g-tag { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 3px 8px; border: 1px solid var(--g-line); border-radius: var(--g-r-xs); color: var(--g-muted); font: 500 12px/1.3 var(--g-font-ui); white-space: nowrap; }
.g-tag--accent { color: var(--g-accent); border-color: color-mix(in srgb, var(--g-accent) 40%, var(--g-line)); }
.g-tag--solid { border-color: transparent; background: var(--g-soft); color: var(--g-ink); }
.g-tag--warn { color: var(--g-warn); border-color: color-mix(in srgb, var(--g-warn) 45%, var(--g-line)); background: var(--g-warn-soft); }
.g-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.g-status { display: inline-flex; align-items: center; gap: 7px; color: var(--g-muted); font: 600 12.5px/1.3 var(--g-font-ui); white-space: nowrap; font-variant-numeric: tabular-nums; }
.g-status::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.g-status--queue { color: var(--g-muted); }
.g-status--run { color: var(--g-accent); }
.g-status--run::before { animation: g-pulse 1.4s ease-in-out infinite; }
.g-status--ok { color: var(--g-ok); }
.g-status--err { color: var(--g-danger); }
.g-status--review { color: var(--g-warn); }
.g-status--refund { color: var(--g-info); }
.g-status--chip { padding: 4px 9px 4px 8px; border-radius: var(--g-r-xs); background: var(--g-soft); }
.g-progress { position: relative; display: block; height: 4px; overflow: hidden; border-radius: 2px; background: var(--g-soft-2); }
.g-progress > i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--g-accent); transition: width .6s var(--g-ease); }
@keyframes g-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* task tile: <button class="g-tile" aria-pressed="false"><span class="g-tile-ic">svg</span><span class="g-tile-t"><strong>…</strong><small>…</small></span></button> */
.g-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; min-width: 0; min-height: 116px; padding: 18px 16px; border: 1px solid var(--g-line); border-radius: var(--g-r-md); background: var(--g-paper); color: var(--g-ink); text-align: left; text-decoration: none; cursor: pointer; transition: border-color var(--g-dur), background-color var(--g-dur); }
.g-tile:hover { border-color: var(--g-accent); }
.g-tile[aria-pressed="true"], .g-tile[aria-checked="true"], .g-tile[aria-current="true"], .g-tile.is-active { border-color: var(--g-accent); background: var(--g-accent-soft); }
.g-tile-ic { display: inline-grid; place-items: center; color: var(--g-accent); }
.g-tile-ic svg { width: 20px; height: 20px; }
.g-tile-t { display: grid; gap: 5px; min-width: 0; }
.g-tile-t strong, .g-tile strong { font: 600 14.5px/1.3 var(--g-font-ui); overflow-wrap: break-word; hyphens: auto; }
.g-tile-t small, .g-tile small { font-size: 12.5px; line-height: 1.45; color: var(--g-muted); }
.g-tile-meta { margin-top: auto; font: 600 13px/1.3 var(--g-font-ui); color: var(--g-accent); font-variant-numeric: tabular-nums; }
.g-tile--row { flex-direction: row; align-items: center; gap: 16px; min-height: 0; padding: 18px; }
.g-tile:disabled, .g-tile[aria-disabled="true"] { opacity: .55; cursor: not-allowed; border-color: var(--g-line); }
@media (max-width: 767px) { .g-tile { min-height: 104px; padding: 15px 13px; gap: 10px; } }

/* numbered steps «01 Идея · 02 Герои …» */
.g-steps { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; counter-reset: none; }
.g-steps > li { min-width: 0; }
.g-steps > li > a, .g-steps > li > span, .g-steps > li > button { display: block; width: 100%; min-height: 44px; padding: 10px 4px 12px; border: 0; border-bottom: 2px solid var(--g-line); background: none; color: var(--g-muted); font: 500 13px/1.3 var(--g-font-ui); text-align: left; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-steps-n { display: block; margin-bottom: 6px; color: var(--g-muted); font: 600 11.5px/1 var(--g-font-ui); letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.g-steps > li.is-done > * { color: var(--g-ink); border-bottom-color: var(--g-line-strong); }
.g-steps > li.is-done .g-steps-n { color: var(--g-accent); }
.g-steps > li.is-done > a:hover { color: var(--g-accent); border-bottom-color: var(--g-accent); }
.g-steps > li.is-current > *, .g-steps > li[aria-current="step"] > * { color: var(--g-accent); border-bottom-color: var(--g-accent); font-weight: 600; }
.g-steps > li.is-skip > * { opacity: .55; }
@media (max-width: 639px) {
  .g-steps { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(68px, 1fr); overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
  .g-steps::-webkit-scrollbar { display: none; }
  .g-steps > li { scroll-snap-align: start; }
}

/* production pipeline: rows «номер · заголовок + описание · статус/действие» */
.g-pipeline { display: grid; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--g-line); }
.g-pipeline > li, .g-pipe-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 17px 0; border-bottom: 1px solid var(--g-line); }
.g-pipe-n { font: 600 12px/1 var(--g-font-ui); letter-spacing: .08em; color: var(--g-accent); font-variant-numeric: tabular-nums; }
.g-pipe-body { min-width: 0; }
.g-pipe-body strong { display: block; font: 600 14px/1.35 var(--g-font-ui); }
.g-pipe-body p { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--g-muted); }
.g-pipe-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.g-pipeline > li.is-wait .g-pipe-body strong, .g-pipe-row.is-wait .g-pipe-body strong { color: var(--g-muted); font-weight: 500; }
.g-pipeline > li.is-current, .g-pipe-row.is-current { background: linear-gradient(90deg, var(--g-accent-soft), transparent 70%); }
@media (max-width: 767px) {
  .g-pipeline > li, .g-pipe-row { grid-template-columns: 26px minmax(0, 1fr); gap: 6px 10px; }
  .g-pipe-side { grid-column: 2; justify-content: flex-start; }
}

/* numbered list «01 02 03» (terracotta numbers): <ol class="g-numlist"><li>…</li></ol> */
.g-numlist { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: g-n; }
.g-numlist > li { display: flex; gap: 12px; counter-increment: g-n; font-size: 14.5px; line-height: 1.55; }
.g-numlist > li::before { content: counter(g-n, decimal-leading-zero); flex: none; min-width: 20px; font: 600 12px/1.95 var(--g-font-ui); letter-spacing: .06em; color: var(--g-accent); font-variant-numeric: tabular-nums; }

/* notes / inline messages */
.g-note { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-left: 2px solid var(--g-line-strong); background: var(--g-soft); color: var(--g-ink); font-size: 13.5px; line-height: 1.55; }
.g-note svg { flex: none; width: 17px; height: 17px; margin-top: 1px; color: var(--g-accent); }
.g-note--warn { border-left-color: var(--g-warn); background: var(--g-warn-soft); }
.g-note--warn svg { color: var(--g-warn); }
.g-note--ok { border-left-color: var(--g-ok); background: var(--g-ok-soft); }
.g-note--ok svg { color: var(--g-ok); }
.g-note--err { border-left-color: var(--g-danger); background: var(--g-danger-soft); }
.g-note--err svg { color: var(--g-danger); }
.g-cost { font: 500 13px/1.45 var(--g-font-ui); color: var(--g-muted); font-variant-numeric: tabular-nums; }
.g-cost b, .g-cost strong { color: var(--g-ink); font-weight: 700; }

/* empty / error states: short Prata phrase + one button (P.empty renders it) */
.g-empty { display: grid; justify-items: center; gap: 12px; padding: clamp(36px, 6vw, 60px) 20px; text-align: center; grid-column: 1 / -1; }
.g-empty-ic { display: inline-grid; place-items: center; color: var(--g-accent); }
.g-empty-ic svg { width: 24px; height: 24px; }
.g-empty-title { margin: 0; font: 400 clamp(22px, 2.6vw, 26px)/1.25 var(--g-font-display); letter-spacing: -.02em; color: var(--g-ink); text-wrap: balance; }
.g-empty p { margin: 0; max-width: 46ch; font-size: 14px; line-height: 1.6; color: var(--g-muted); }
.g-empty .btns, .g-empty .g-row { justify-content: center; margin-top: 6px; }
.g-empty--err .g-empty-ic { color: var(--g-danger); }
.g-empty--boxed { border: 1px dashed var(--g-line-strong); border-radius: var(--g-r-xs); }

/* skeletons */
.g-skel, .skel { position: relative; overflow: hidden; border-radius: var(--g-r-xs); background: var(--g-soft-2); }
.g-skel::after, .skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--g-paper) 45%, transparent), transparent); animation: g-shimmer 1.5s infinite; }
.g-skel-line { height: 13px; margin: 6px 0; }
@keyframes g-shimmer { to { transform: translateX(100%); } }

/* tables */
.g-table-wrap { overflow-x: auto; border-top: 1px solid var(--g-line); }
.g-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.g-table th, .g-table td { padding: 13px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--g-line); }
.g-table thead th { padding-top: 10px; padding-bottom: 10px; font: 600 11px/1.3 var(--g-font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--g-muted); white-space: nowrap; }
.g-table th:first-child, .g-table td:first-child { padding-left: 0; }
.g-table th:last-child, .g-table td:last-child { padding-right: 0; }
.g-table .num, .g-table .g-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.g-table .plus { color: var(--g-ok); font-weight: 600; }
.g-table .minus { color: var(--g-ink); }
.g-table small { display: block; font-size: 12px; color: var(--g-muted); }

/* popover menu (avatar menu, «ещё»): <div class="g-menu" role="menu"> */
.g-menu, .menu { position: fixed; z-index: 300; min-width: 248px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 6px; border: 1px solid var(--g-line); border-radius: var(--g-r-md); background: var(--g-paper); color: var(--g-ink); box-shadow: var(--g-shadow-pop); animation: g-pop .16s var(--g-ease) both; }
.g-menu-head { display: grid; gap: 2px; margin: 0 0 6px; padding: 10px 12px 12px; border-bottom: 1px solid var(--g-line); }
.g-menu-head b { font: 700 14.5px/1.3 var(--g-font-ui); }
.g-menu-head span { font-size: 12.5px; color: var(--g-muted); }
.g-menu [role^="menuitem"], .menu [role^="menuitem"] { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 40px; padding: 9px 12px; border: 0; border-radius: var(--g-r-md); background: none; color: var(--g-ink); font: 500 14px/1.3 var(--g-font-ui); text-align: left; text-decoration: none; cursor: pointer; }
.g-menu [role^="menuitem"]:hover, .g-menu [role^="menuitem"]:focus-visible, .menu [role^="menuitem"]:hover, .menu [role^="menuitem"]:focus-visible { background: var(--g-soft); outline-offset: -2px; }
.g-menu [role^="menuitem"] svg, .menu [role^="menuitem"] svg { flex: none; width: 17px; height: 17px; color: var(--g-muted); }
.g-menu [role="menuitemradio"]::after, .menu [role="menuitemradio"]::after { content: ""; margin-left: auto; width: 14px; height: 14px; flex: none; }
.g-menu [role="menuitemradio"][aria-checked="true"], .menu [role="menuitemradio"][aria-checked="true"] { color: var(--g-accent); font-weight: 600; }
.g-menu [role="menuitemradio"][aria-checked="true"]::after, .menu [role="menuitemradio"][aria-checked="true"]::after { background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.g-menu-sep, .menu .g-menu-sep { height: 1px; margin: 6px 4px; background: var(--g-line); }
.g-menu-label, .menu .g-menu-label { padding: 8px 12px 4px; font: 600 11px/1.3 var(--g-font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--g-muted); }
.g-menu .is-danger, .menu .is-danger { color: var(--g-danger); }
.g-menu .is-danger svg, .menu .is-danger svg { color: var(--g-danger); }
@media (pointer: coarse) { .g-menu [role^="menuitem"], .menu [role^="menuitem"] { min-height: 44px; } }
@keyframes g-pop { from { opacity: 0; transform: translateY(-4px); } }

/* modal (#modal is a <dialog class="modal">; native showModal = focus trap + Esc) */
dialog.modal { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--g-line); border-radius: var(--g-r-md); background: var(--g-paper); color: var(--g-ink); box-shadow: var(--g-shadow-pop); overflow: auto; overscroll-behavior: contain; }
dialog.modal::backdrop { background: var(--g-scrim); }
dialog.modal[open] { animation: g-modal-in .22s var(--g-ease) backwards; } /* backwards: no transform stays after the entry, so fixed children (toasts) keep the viewport */
dialog.modal[open]::backdrop { animation: g-fade .2s ease both; }
.modal-body { display: grid; gap: 18px; padding: 28px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-head > div { min-width: 0; }
.modal-head h3 { margin: 0; font: 400 27px/1.2 var(--g-font-display); letter-spacing: -.02em; color: var(--g-ink); text-wrap: balance; }
.modal-head p { margin: 8px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--g-muted); }
.modal-head p b { color: var(--g-ink); font-variant-numeric: tabular-nums; }
.modal-x { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--g-line); border-radius: 50%; background: var(--g-paper); color: var(--g-ink); cursor: pointer; transition: background-color var(--g-dur); }
.modal-x:hover { background: var(--g-soft); }
.modal-x svg { width: 18px; height: 18px; }
.modal-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
@keyframes g-modal-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes g-fade { from { opacity: 0; } }
@media (max-width: 767px) {
  dialog.modal { width: 100%; max-width: 100%; margin: auto 0 0; max-height: calc(100dvh - 16px - env(safe-area-inset-top)); border-bottom: 0; border-radius: var(--g-r-md) var(--g-r-md) 0 0; }
  dialog.modal[open] { animation: g-sheet-in .26s var(--g-ease) backwards; }
  .modal-body { padding: 22px max(18px, env(safe-area-inset-right)) calc(22px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
  .modal-head h3 { font-size: 24px; }
  .modal-actions > * { flex: 1 1 auto; }
  @keyframes g-sheet-in { from { transform: translateY(100%); } }
}

/* side sheet (#drawer, P.openDrawer) */
dialog.drawer { position: fixed; inset: 0 0 0 auto; width: min(520px, 100%); max-width: 100%; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--g-line); background: var(--g-paper); color: var(--g-ink); box-shadow: var(--g-shadow-pop); overflow-y: auto; overscroll-behavior: contain; }
dialog.drawer.drawer-wide { width: min(980px, 100%); }
dialog.drawer::backdrop, dialog.nav-drawer::backdrop { background: var(--g-scrim); }
dialog.drawer[open] { animation: g-drawer-in .22s var(--g-ease) backwards; }
@keyframes g-drawer-in { from { transform: translateX(28px); opacity: 0; } }
.drawer-body { display: grid; gap: 18px; padding: 24px; }
/* the scroller is dialog.drawer itself (no padding): head and foot stick at 0 and cancel .drawer-body's padding with margins */
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: -24px -24px 0; padding: 20px 24px 16px; border-bottom: 1px solid var(--g-line); background: var(--g-paper); }
.drawer-head h2 { margin: 0; font: 400 24px/1.25 var(--g-font-display); letter-spacing: -.02em; }
.drawer-head p { margin: 4px 0 0; font-size: 13.5px; color: var(--g-muted); }
.drawer-foot { position: sticky; bottom: 0; z-index: 2; margin: 0 -24px -24px; padding: 14px 24px 20px; border-top: 1px solid var(--g-line); background: var(--g-paper); }
@media (max-width: 767px) {
  dialog.drawer { width: 100%; border-left: 0; }
  .drawer-body { padding: 20px 16px calc(24px + env(safe-area-inset-bottom)); }
  .drawer-head { margin: -20px -16px 0; padding: 14px 16px; }
  .drawer-foot { margin: 0 -16px calc(-24px - env(safe-area-inset-bottom)); padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
}

/* toasts (#toasts, aria-live; while a modal dialog is open — .toasts--dlg inside it, see app.js toast()).
   Rule: never over primary actions or sticky bars — desktop: top right under the header; phones: full width under
   the header (the id selector wins over older per-screen bottom offsets). */
.toasts { position: fixed; z-index: 500; top: calc(var(--g-sticky-top) + 12px); right: max(16px, env(safe-area-inset-right)); bottom: auto; left: auto; transform: none; display: grid; align-content: start; gap: 8px; width: min(400px, calc(100% - 32px)); pointer-events: none; }
.toast { --tone: var(--g-accent); pointer-events: auto; cursor: pointer; display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px; border: 1px solid var(--g-line); border-left: 3px solid var(--tone); border-radius: var(--g-r-xs); background: var(--g-paper); color: var(--g-ink); box-shadow: var(--g-shadow-pop); font: 500 14px/1.45 var(--g-font-ui); animation: g-toast-in .26s var(--g-ease) both; }
.toast.ok { --tone: var(--g-ok); }
.toast.err { --tone: var(--g-danger); }
.toast.info { --tone: var(--g-info); }
.toast .ti { flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; background: color-mix(in srgb, var(--tone) 14%, transparent); color: var(--tone); font-size: 12px; font-weight: 800; }
.toast.out { animation: g-toast-out .22s var(--g-ease) both; }
@keyframes g-toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes g-toast-out { to { opacity: 0; transform: translateY(-6px); } }
@media (max-width: 767px) {
  #toasts, .toasts { top: calc(var(--g-sticky-top) + 8px); bottom: auto; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); width: auto; }
}

/* ---------- 5. legacy bridge: old classes take the gallery look ---------- */
.btn { --h: 46px; height: auto; min-height: var(--h); padding: 0 20px; gap: 9px; border: 1px solid transparent; border-radius: var(--g-r-sm); box-shadow: none; font: 600 14.5px/1.2 var(--g-font-ui); letter-spacing: 0; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-lg { --h: 52px; padding: 0 24px; font-size: 15.5px; }
.btn-primary, .tg-btn { background: var(--g-accent); color: var(--g-on-accent); box-shadow: none; }
.btn-primary:hover, .tg-btn:hover { background: var(--g-accent-hover); box-shadow: none; transform: none; }
.btn-ghost { background: var(--g-paper); color: var(--g-ink); border-color: var(--g-line); }
.btn-ghost:hover { background: var(--g-soft); border-color: var(--g-line-strong); }
.btn[disabled], .btn.is-loading { opacity: .5; }
.card { border-radius: var(--g-r-xs); background: var(--g-paper); border-color: var(--g-line); box-shadow: none; }
.badge { border-radius: var(--g-r-xs); }
.page-head h1 { font-family: var(--g-font-display); font-weight: 400; letter-spacing: -.03em; line-height: 1.2; text-wrap: balance; }
.empty h2, .state h2, .sc-title, .done-title, .invite-hero h2 { font-family: var(--g-font-display); font-weight: 400; letter-spacing: -.02em; }

/* ---------- 6. app shell ---------- */
.app-body { min-height: 100dvh; background: var(--g-paper); }
.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--g-paper); color: var(--g-ink); }
.boot[hidden] { display: none; }
.boot-mark { width: 52px; height: 52px; color: var(--g-accent); animation: g-boot 1.4s var(--g-ease) infinite; }
.boot-word { font: 800 19px/1 var(--g-font-ui); letter-spacing: -.02em; }
@keyframes g-boot { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.skip-link { position: absolute; left: 16px; top: -80px; z-index: 1000; padding: 12px 16px; border-radius: var(--g-r-sm); background: var(--g-ink); color: var(--g-paper); font-weight: 700; }
.skip-link:focus { top: calc(env(safe-area-inset-top) + 12px); }
/* the page heading takes focus after a route change (app.js) — programmatic focus, no ring */
#view h1[tabindex="-1"]:focus { outline: none; }
/* /api/me did not answer: neither «Войти» nor the balance — we do not know yet (app.js renderBootError) */
html.is-offline .g-guest-only, html.is-offline .g-user-only { display: none !important; }
.g-boot-err { margin-top: 8vh; }

.g-shell { display: flex; flex-direction: column; min-height: 100dvh; }
/* header */
.g-top { position: sticky; top: 0; z-index: 80; flex: none; padding-top: env(safe-area-inset-top); background: var(--g-paper); border-bottom: 1px solid var(--g-line); }
.g-top-in { display: flex; align-items: center; gap: 16px; height: var(--g-header-h); padding: 0 max(var(--g-gutter), env(safe-area-inset-right)) 0 max(var(--g-gutter), env(safe-area-inset-left)); }
.g-logo { display: inline-flex; align-items: center; gap: 10px; flex: none; min-width: 44px; min-height: 44px; color: var(--g-ink); font: 800 20px/1 var(--g-font-ui); letter-spacing: -.02em; white-space: nowrap; text-decoration: none; }
.g-logo-mark { width: 28px; height: 28px; flex: none; color: var(--g-accent); }
.g-nav { display: flex; align-items: center; gap: 2px; margin-inline: auto; }
.g-nav a { position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 8px 13px; border-radius: var(--g-r-sm); color: var(--g-muted); font: 500 14.5px/1 var(--g-font-ui); white-space: nowrap; text-decoration: none; transition: color var(--g-dur); }
.g-nav a:hover { color: var(--g-ink); }
.g-nav a.active, .g-nav a[aria-current="page"] { color: var(--g-accent); font-weight: 600; }
.g-nav a.active::after, .g-nav a[aria-current="page"]::after { content: ""; position: absolute; left: 13px; right: 13px; bottom: 6px; height: 2px; background: currentColor; }
.g-top-right { position: relative; display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; }
.g-nav + .g-top-right, .g-nav ~ .g-top-right { margin-left: 0; }
.g-credits { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 10px; border-radius: var(--g-r-sm); color: var(--g-accent); font: 600 14px/1 var(--g-font-ui); font-variant-numeric: tabular-nums; white-space: nowrap; text-decoration: none; }
.g-credits:hover { color: var(--g-accent-hover); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.g-credits.bump { animation: g-bump .6s var(--g-ease); }
@keyframes g-bump { 30% { transform: scale(1.06); } }
.g-credits-short { display: none; }
.g-ava { position: relative; isolation: isolate; flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--g-ink); font: 700 12.5px/1 var(--g-font-ui); letter-spacing: .02em; cursor: pointer; }
.g-ava::before { content: ""; position: absolute; inset: 4px; z-index: -1; border-radius: 50%; background: var(--g-soft); border: 1px solid var(--g-line); transition: border-color var(--g-dur), background-color var(--g-dur); }
.g-ava:hover::before, .g-ava[aria-expanded="true"]::before { border-color: var(--g-line-strong); background: var(--g-soft-2); }
.g-top .g-btn--sm { margin-left: 4px; }
@media (min-width: 1024px) { .g-lt-desk { display: none !important; } }
html.is-guest .g-user-only { display: none !important; }
html:not(.is-guest) .g-guest-only { display: none !important; }
.dot-count { position: absolute; top: 5px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--g-accent); color: var(--g-on-accent); font: 700 10.5px/17px var(--g-font-ui); text-align: center; font-variant-numeric: tabular-nums; }
#topTitle { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* search popover (#search, opened by #searchOpen or «/») */
.g-search { position: absolute; top: calc(100% + 12px); right: 0; z-index: 90; display: none; width: min(440px, calc(100vw - 24px)); padding: 10px; border: 1px solid var(--g-line); border-radius: var(--g-r-md); background: var(--g-paper); box-shadow: var(--g-shadow-pop); }
.g-search.is-open { display: block; animation: g-pop .16s var(--g-ease) both; }
.g-search-field { position: relative; }
.g-search .search-ic { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--g-muted); pointer-events: none; }
.g-search .search-in { width: 100%; min-height: 46px; padding: 0 44px 0 40px; border: 1px solid var(--g-field-line); border-radius: var(--g-r-xs); background: var(--g-paper); color: var(--g-ink); font: 500 15px/1.4 var(--g-font-ui); outline: none; }
.g-search .search-in:focus-visible { border-color: var(--g-accent); outline: 2px solid var(--g-accent); outline-offset: 1px; }
.g-search .search-in::placeholder { color: var(--g-muted); }
.g-search .search-in::-webkit-search-cancel-button { display: none; }
.g-search .search-kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border: 1px solid var(--g-line); border-radius: var(--g-r-xs); color: var(--g-muted); font: 600 12px/1 var(--g-font-ui); }
.g-search .search-pop { position: static; max-height: min(60dvh, 480px); margin-top: 8px; padding: 0; overflow-y: auto; border: 0; box-shadow: none; background: none; }
.sp-g { padding: 12px 10px 6px; font: 600 11px/1.3 var(--g-font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--g-muted); }
.sp-item { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 7px 10px; border-radius: var(--g-r-md); color: var(--g-ink); text-decoration: none; }
.sp-item[aria-selected="true"], .sp-item:hover { background: var(--g-soft); }
.sp-e { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--g-line); border-radius: var(--g-r-xs); background: var(--g-paper); color: var(--g-accent); }
.sp-e svg { width: 16px; height: 16px; color: currentColor; }
.sp-t { display: grid; min-width: 0; }
.sp-t b { font: 600 14px/1.3 var(--g-font-ui); }
.sp-t small { overflow: hidden; font-size: 12.5px; color: var(--g-muted); text-overflow: ellipsis; white-space: nowrap; }
.sp-empty { margin: 0; padding: 14px 10px; font-size: 14px; color: var(--g-muted); }

/* notifications popover (#notesPop) */
.notes-wrap { position: relative; }
.notes-pop { position: absolute; top: calc(100% + 12px); right: 0; z-index: 90; width: min(380px, calc(100vw - 24px)); max-height: min(70dvh, 560px); overflow-y: auto; padding: 6px; border: 1px solid var(--g-line); border-radius: var(--g-r-md); background: var(--g-paper); box-shadow: var(--g-shadow-pop); }
.np-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 8px 10px; }
.np-head b { font: 700 14.5px/1.3 var(--g-font-ui); }
.np-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px; border-radius: var(--g-r-md); color: var(--g-ink); text-decoration: none; }
.np-item:hover { background: var(--g-soft); }
.np-item > span:last-child { display: grid; gap: 2px; min-width: 0; }
.np-item b { font: 600 14px/1.35 var(--g-font-ui); }
.np-item small { font-size: 12.5px; line-height: 1.4; color: var(--g-muted); }
.np-item.unread b::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 7px; border-radius: 50%; background: var(--g-accent); vertical-align: middle; }
.np-ic { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; }
.np-ic svg { width: 14px; height: 14px; }
.np-ic.ok { background: var(--g-ok-soft); color: var(--g-ok); }
.np-ic.err { background: var(--g-danger-soft); color: var(--g-danger); }
.np-ic.run { background: var(--g-accent-soft); color: var(--g-accent); }
.np-ic.run::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: g-pulse 1.4s ease-in-out infinite; }
.np-run { margin-bottom: 4px; padding-bottom: 4px; border-bottom: 1px solid var(--g-line); }
.np-empty { margin: 0; padding: 12px 10px 14px; font-size: 13.5px; line-height: 1.55; color: var(--g-muted); }

/* demo strip (#demoBanner) */
.g-demo { display: flex; align-items: center; gap: 12px; padding: 9px max(var(--g-gutter), env(safe-area-inset-right)) 9px max(var(--g-gutter), env(safe-area-inset-left)); border-bottom: 1px solid color-mix(in srgb, var(--g-warn) 22%, transparent); background: var(--g-warn-soft); color: var(--g-ink); font-size: 13px; line-height: 1.45; }
.g-demo b { font-weight: 600; }
.g-demo-tag { flex: none; padding: 2px 7px; border: 1px solid currentColor; border-radius: var(--g-r-xs); color: var(--g-warn); font: 700 11px/1.4 var(--g-font-ui); letter-spacing: .14em; text-transform: uppercase; }
.g-demo .db-sub { color: var(--g-ink); font-weight: 400; opacity: .82; }

/* body: optional studio sidebar + view */
.g-body { flex: 1 0 auto; display: flex; align-items: stretch; width: 100%; min-width: 0; }
.g-side { display: none; flex: none; width: var(--g-side-w); border-right: 1px solid var(--g-line); }
.g-side > nav { position: sticky; top: calc(var(--g-header-h) + env(safe-area-inset-top)); display: grid; align-content: start; gap: 3px; max-height: calc(100dvh - var(--g-header-h) - env(safe-area-inset-top)); overflow-y: auto; padding: 24px 14px; }
.g-side-item { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 10px 12px; border-radius: var(--g-r-md); color: var(--g-ink); font: 500 14px/1.2 var(--g-font-ui); text-decoration: none; transition: background-color var(--g-dur), color var(--g-dur); }
.g-side-item svg { width: 18px; height: 18px; flex: none; color: var(--g-muted); }
.g-side-item:hover { background: var(--g-soft); }
.g-side-item.active, .g-side-item[aria-current="page"] { background: var(--g-soft); color: var(--g-accent); font-weight: 600; }
.g-side-item.active svg, .g-side-item[aria-current="page"] svg { color: var(--g-accent); }
.g-side-label { margin: 22px 12px 6px; font: 600 11px/1.3 var(--g-font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--g-muted); }
@media (min-width: 1024px) {
  html:is([data-route="image"], [data-route="video"], [data-route="audio"], [data-route="text"], [data-route="models"]) .g-side { display: block; }
}
.view { position: relative; flex: 1 1 auto; width: 100%; min-width: 0; max-width: var(--g-content-max); margin: 0 auto; padding: 36px var(--g-gutter) 64px; }
.view[data-route="create"], .view[data-route="order"], .view[data-route="orders"], .view[data-route="balance"], .view[data-route="help"], .view[data-route="invite"], .view[data-route="heroes"], .view[data-route="plan"] { max-width: 960px; }
.view-enter { animation: g-view-in .3s var(--g-ease) both; }
@keyframes g-view-in { from { opacity: 0; transform: translateY(6px); } }
#view:focus { outline: none; }

/* footer */
.g-foot { flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 24px; padding: 14px max(var(--g-gutter), env(safe-area-inset-right)) calc(14px + var(--g-tabbar-space)) max(var(--g-gutter), env(safe-area-inset-left)); border-top: 1px solid var(--g-line); color: var(--g-muted); font-size: 12.5px; line-height: 1.4; }
.g-foot-motto { color: var(--g-ink); font: 400 15px/1.3 var(--g-font-display); }
.g-foot nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.g-foot nav a, .g-foot-theme button { display: inline-flex; align-items: center; min-height: 40px; padding: 0 8px; color: var(--g-muted); text-decoration: none; }
.g-foot nav a:hover { color: var(--g-ink); text-decoration: underline; text-underline-offset: 3px; }
.g-foot-theme { display: inline-flex; align-items: center; gap: 2px; }
.g-foot-theme > span { margin-right: 4px; }
.g-foot-theme .g-foot-radios { display: inline-flex; margin-right: 0; }
.g-foot-theme button { border: 0; border-radius: var(--g-r-xs); background: none; font: 500 12.5px/1 var(--g-font-ui); cursor: pointer; }
.g-foot-theme button:hover { color: var(--g-ink); }
.g-foot-theme button[aria-checked="true"] { color: var(--g-accent); font-weight: 700; }
@media (pointer: coarse) { .g-foot nav a, .g-foot-theme button { min-height: 44px; } }

/* phone bottom bar (#tabbar) */
.g-tabbar { display: none; }
@media (max-width: 767px) {
  .g-tabbar { position: fixed; z-index: 70; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); border-top: 1px solid var(--g-line); background: var(--g-paper); transition: transform .2s var(--g-ease), visibility .2s; }
  .g-tabbar .tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 62px; padding: 8px 2px; border: 0; background: none; color: var(--g-muted); font: 600 11.5px/1.1 var(--g-font-ui); text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .g-tabbar .tab svg { width: 21px; height: 21px; }
  .g-tabbar .tab.active, .g-tabbar .tab[aria-current="page"] { color: var(--g-accent); }
  .g-tabbar .tab.active::before, .g-tabbar .tab[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 50%; width: 24px; height: 2px; margin-left: -12px; background: currentColor; }
  .g-tabbar .tab:focus-visible { outline-offset: -3px; }
  html.kb-open .g-tabbar { transform: translateY(110%); visibility: hidden; }
}

/* shell responsive */
@media (max-width: 1023px) {
  .g-credits-long { display: none; }
  .g-credits-short { display: inline; }
  .g-nav a { padding: 8px 10px; }
  .g-nav a.active::after, .g-nav a[aria-current="page"]::after { left: 10px; right: 10px; }
}
@media (min-width: 768px) and (max-width: 899px) {
  /* «Ролик под ключ» in the header: keep the row inside 768 px */
  .g-top-in { gap: 8px; }
  .g-nav a { padding: 8px 8px; }
  .g-nav a.active::after, .g-nav a[aria-current="page"]::after { left: 8px; right: 8px; }
}
@media (max-width: 767px) {
  .g-top-in { gap: 8px; }
  .g-nav { display: none; }
  .g-logo { font-size: 19px; gap: 9px; }
  .g-logo-mark { width: 26px; height: 26px; }
  .g-top-right, .g-nav ~ .g-top-right { gap: 2px; margin-left: auto; margin-right: -6px; }
  .g-credits { padding: 0 6px; font-size: 13.5px; }
  .g-search, .notes-pop { position: fixed; top: calc(var(--g-header-h) + env(safe-area-inset-top) + 8px); left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); width: auto; }
  .g-search .search-kbd { display: none; }
  .g-demo { padding-top: 8px; padding-bottom: 8px; font-size: 12.5px; }
  .g-demo .db-sub { display: none; }
  .view { padding: 24px var(--g-gutter) 40px; }
  .g-foot { flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 16px; }
  .g-foot nav { margin-left: -8px; }
  /* «Тема:» lines up with the motto; the buttons' own 8px padding stays as their hit area */
  .g-foot-theme .g-foot-radios { margin-left: -4px; }
}
@media (max-width: 379px) {
  .g-logo-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .g-top .g-btn--sm { padding: 8px 12px; }
}

/* nav drawer «Все разделы» (#navDrawer, phone & tablet; opened from the avatar menu) */
dialog.nav-drawer { position: fixed; inset: 0 auto 0 0; width: min(320px, 88%); height: 100dvh; max-height: none; margin: 0; padding: 14px 12px calc(16px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); border: 0; border-right: 1px solid var(--g-line); background: var(--g-paper); color: var(--g-ink); box-shadow: var(--g-shadow-pop); overflow-y: auto; }
dialog.nav-drawer[open] { animation: g-nd-in .22s var(--g-ease) backwards; }
@keyframes g-nd-in { from { transform: translateX(-20px); opacity: 0; } }
.nd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 12px 6px; }
.nd-balance { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 8px; padding: 12px 14px; border: 1px solid var(--g-line); border-radius: var(--g-r-md); color: var(--g-ink); text-decoration: none; }
.nd-balance span { font-size: 12.5px; color: var(--g-muted); }
.nd-balance b { font: 700 16px/1.2 var(--g-font-ui); color: var(--g-accent); font-variant-numeric: tabular-nums; }
.nd-nav { display: grid; gap: 2px; }
.nd-nav .nav-sep { margin: 16px 12px 6px; font: 600 11px/1.3 var(--g-font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--g-muted); }
.nd-nav .nav-item, .nd-nav .g-side-item { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 10px 12px; border-radius: var(--g-r-md); color: var(--g-ink); font: 500 14.5px/1.2 var(--g-font-ui); text-decoration: none; }
.nd-nav .nav-item svg { width: 18px; height: 18px; flex: none; color: var(--g-muted); }
.nd-nav .nav-item:hover { background: var(--g-soft); }
.nd-nav .nav-item.active { background: var(--g-soft); color: var(--g-accent); font-weight: 600; }
.nd-nav .nav-item.active svg { color: var(--g-accent); }
.nd-nav .nav-item.active::before { display: none; }

/* 402 «Не хватает кредитов» (P.need402) */
.g-packs { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.g-pack { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; width: 100%; min-height: 56px; padding: 12px 16px; border: 1px solid var(--g-line); border-radius: var(--g-r-md); background: var(--g-paper); color: var(--g-ink); text-align: left; cursor: pointer; transition: border-color var(--g-dur), background-color var(--g-dur); }
.g-pack:hover { border-color: var(--g-accent); }
.g-pack.is-fit { border-color: var(--g-accent); background: var(--g-accent-soft); }
.g-pack-cr { font: 700 16px/1.3 var(--g-font-ui); font-variant-numeric: tabular-nums; }
.g-pack-cr em { margin-left: 6px; font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--g-ok); }
.g-pack-price { font: 600 15px/1.3 var(--g-font-ui); font-variant-numeric: tabular-nums; text-align: right; }
.g-pack-tag { grid-column: 1 / -1; justify-self: start; font: 600 11px/1.3 var(--g-font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--g-accent); }

/* login sheet (app.js openLoginSheet) */
.g-login { display: grid; gap: 18px; }
.g-login .ls-main { display: grid; gap: 14px; }
.g-login-points { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 14px; line-height: 1.5; color: var(--g-ink); }
.g-login-points li { display: flex; gap: 10px; align-items: flex-start; }
.g-login-points li::before { content: ""; flex: none; width: 14px; height: 14px; margin-top: 4px; background: var(--g-accent); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.g-login .tg-btn { width: 100%; }
.g-login .or { margin: 2px 0; }
.g-login .login-wait { display: grid; gap: 14px; justify-items: center; text-align: center; }
.g-login .login-code { display: inline-block; padding: 12px 26px; border: 1px solid var(--g-line); border-radius: var(--g-r-md); background: var(--g-soft); color: var(--g-ink); font: 800 64px/1 var(--g-font-ui) !important; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.g-login .qr-box { padding: 10px; border: 1px solid var(--g-line); border-radius: var(--g-r-md); background: #fff; }
.g-login .qr-box svg { width: 168px; height: 168px; image-rendering: pixelated; }
.g-login .wait-line { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14.5px; color: var(--g-accent); }
.g-login .login-fine { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--g-muted); }
.g-login .login-fine a { color: var(--g-ink); text-decoration: underline; text-underline-offset: 2px; }
.typing-dots { display: inline-flex; gap: 4px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .3; animation: g-dots 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes g-dots { 30% { opacity: 1; transform: translateY(-3px); } }

/* ---------- 7. short screens: 200–400 % zoom, phones in landscape ----------
   Header, phone tab bar and sticky bottom bars would take 44–90 % of a ≤ 560 px tall screen: they stop sticking and
   scroll with the page (the tab bar moves to the end of the page). Bars that are static count as 0 in --g-bar-h. */
@media (max-height: 560px) {
  .app-body .g-top { position: static; }
  .app-body .g-side > nav { position: static; max-height: none; }
  .app-body .g-tabbar { position: static; }
  :root:has(> body.app-body), .app-body { --g-tabbar-space: 0px; }
  html:has(> body.app-body) { scroll-padding-top: 12px; }
  #toasts, .toasts { top: calc(env(safe-area-inset-top) + 8px); }
  html body.app-body :is([data-sticky-bar], .gs-launch, .wz-bar, .se-actions, .gc-tray) { position: static; box-shadow: none; }
  html body.app-body :is(.gs-side.is-sticky, .player) { position: static; }
  /* side sheets: a sticky head + foot took 183 of 450 px at 200 % and left ~20 px of 256 at 400 % — both scroll
     with the sheet's content (Esc and the head's «×» still close it) */
  html body dialog.drawer :is(.drawer-head, .drawer-foot) { position: static; }
}

/* ---------- forced colors (Windows high contrast): selected and current states keep a visible mark ---------- */
@media (forced-colors: active) {
  .g-seg > :is([aria-checked="true"], [aria-pressed="true"], [aria-selected="true"], [aria-current="page"], .is-active),
  .g-chip:is([aria-pressed="true"], [aria-checked="true"], .is-active),
  .g-tile:is([aria-pressed="true"], [aria-checked="true"], [aria-current="true"], .is-active),
  .g-pack.is-fit, .g-art.is-on { outline: 2px solid Highlight; outline-offset: -2px; }
  .g-side-item:is(.active, [aria-current="page"]), .nd-nav .nav-item.active { outline: 2px solid Highlight; outline-offset: -2px; }
  .g-nav a:is(.active, [aria-current="page"])::after, .g-tabbar .tab:is(.active, [aria-current="page"])::before,
  .g-progress > i, .g-status::before { forced-color-adjust: none; background: CanvasText; }
  .g-arr::after, .g-menu [role="menuitemradio"][aria-checked="true"]::after, .g-login-points li::before { forced-color-adjust: none; background: ButtonText; }
  .g-foot-theme button[aria-checked="true"], .g-menu [role="menuitemradio"][aria-checked="true"] { text-decoration: underline; text-underline-offset: 3px; }
  .g-btn, .g-btn-secondary, .g-icon-btn, .g-input, .g-select, .g-textarea { border: 1px solid ButtonText; }
  .toast { border: 1px solid CanvasText; }
  /* the wizard stepper: the step on screen is framed (completed steps share its 2px underline in this mode) */
  :root body .g-steps > li:is(.is-current, [aria-current="step"]) > :not(:focus-visible) { outline: 2px solid Highlight; outline-offset: -2px; }
  :root body .g-steps > li:is(.is-current, [aria-current="step"]) > * { border-bottom-width: 4px; border-bottom-color: Highlight; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .g-skel::after, .skel::after, .g-art.is-busy::after { display: none; }
  a.g-art:hover > img, a:hover .g-art > img, button:hover .g-art > img { transform: none; }
}
