    :root {
      --bg: #f8f8f4;
      --bg-warm: #f8f8f4;
      --bg-card: #ffffff;
      --bg2: #f3f1ed;
      --accent: #d4a843;
      --accent-hover: #c49a38;
      --accent-soft: rgba(212, 168, 67, 0.12);
      --text: #2a2a2a;
      --text-muted: #6b6b6b;
      --text3: #a0a0a0;
      --border: rgba(0, 0, 0, 0.08);
      --border-soft: rgba(0, 0, 0, 0.05);
      --error: #b8503a;
      --error-soft: #fbeae5;
      --success: #4a7c59;
      --success-soft: #e6f0e9;
      --radius: 16px;
      --radius-btn: 14px;
      --shadow: 0 2px 8px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.04);
      --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.06);
    }

    *, *::before, *::after {
      box-sizing: border-box; margin: 0; padding: 0;
      -webkit-tap-highlight-color: transparent;
    }

    html, body {
      background: var(--bg);
      color: var(--text);
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
      font-size: 16px;
      line-height: 1.6;
      -webkit-font-smoothing: antialiased;
      min-height: 100vh;
      min-height: 100dvh;
      overscroll-behavior-y: none;
    }

    body { display: flex; flex-direction: column; }

    #app {
      flex: 1;
      display: flex;
      flex-direction: column;
      padding-top: env(safe-area-inset-top);
      padding-bottom: env(safe-area-inset-bottom);
    }

    .screen {
      flex: 1;
      display: flex;
      flex-direction: column;
      padding: 24px 20px 32px;
      max-width: 560px;
      width: 100%;
      margin: 0 auto;
    }

    /* ── Topbar ── */
    .topbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding-bottom: 24px;
      min-height: 48px;
    }

    .topbar .brand {
      display: block;
      height: 32px;
      width: auto;
      background: var(--bg-warm);
      border: none;
      padding: 0;
      cursor: pointer;
      border-radius: 8px;
    }
    .topbar .brand img { display: block; height: 32px; width: auto; }

    .topbar .balance {
      font-size: 13px;
      color: var(--text-muted);
      background: var(--bg2);
      padding: 6px 12px;
      border-radius: 999px;
      font-weight: 500;
    }

    /* Иконка "Войти" для гостя — в topbar справа вместо balance-чипа. */
    .topbar .login-btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: var(--bg2);
      border: 1px solid var(--border-soft);
      color: var(--text-muted);
      font-family: inherit;
      font-size: 13px;
      font-weight: 500;
      padding: 6px 12px 6px 10px;
      border-radius: 999px;
      cursor: pointer;
      transition: all .15s;
    }
    .topbar .login-btn:hover { color: var(--accent); border-color: var(--accent); }
    .topbar .login-btn svg { width: 14px; height: 14px; }

    .back-btn {
      background: none;
      border: none;
      padding: 8px 12px 8px 0;
      font-size: 15px;
      color: var(--text-muted);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-family: inherit;
      font-weight: 500;
      transition: color .15s;
    }
    .back-btn:hover { color: var(--accent); }

    /* ── Typography ── */
    h1 {
      font-size: 28px;
      font-weight: 700;
      letter-spacing: -0.02em;
      line-height: 1.2;
      margin-bottom: 8px;
      color: var(--text);
    }

    .subtitle {
      color: var(--text-muted);
      margin-bottom: 24px;
      font-size: 16px;
      line-height: 1.6;
    }

    .hint {
      font-size: 13px;
      color: var(--text3);
      text-align: center;
      margin-top: 12px;
    }

    /* ── Cards ── */
    .card {
      background: var(--bg-card);
      border-radius: var(--radius);
      padding: 24px;
      box-shadow: var(--shadow);
      border: 1px solid var(--border-soft);
    }

    .card + .card { margin-top: 12px; }

    /* ── Buttons ── */
    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      width: 100%;
      padding: 16px 28px;
      background: var(--accent);
      color: #fff;
      border: none;
      border-radius: var(--radius-btn);
      font-size: 16px;
      font-weight: 600;
      font-family: inherit;
      cursor: pointer;
      transition: all .2s;
      text-decoration: none;
      text-align: center;
    }
    .btn:hover:not(:disabled) {
      background: var(--accent-hover);
      transform: translateY(-1px);
    }
    .btn:active:not(:disabled) { transform: translateY(0); }
    .btn:disabled {
      opacity: 0.45;
      cursor: not-allowed;
      transform: none;
    }

    .btn-secondary {
      background: transparent;
      color: var(--text);
      border: 1px solid var(--border);
    }
    .btn-secondary:hover:not(:disabled) {
      background: var(--bg2);
      border-color: var(--text3);
      transform: translateY(-1px);
    }

    .btn + .btn { margin-top: 10px; }

    /* ── Inputs ── */
    .input {
      width: 100%;
      padding: 16px 18px;
      background: var(--bg-card);
      color: var(--text);
      border: 1px solid var(--border);
      border-radius: var(--radius-btn);
      font-size: 16px;
      font-family: inherit;
      outline: none;
      transition: border-color .15s, box-shadow .15s;
    }
    .input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 4px var(--accent-soft);
    }

    .input.code {
      font-size: 28px;
      letter-spacing: 0.4em;
      text-align: center;
      padding: 20px 16px;
      font-weight: 600;
    }

    textarea.input {
      resize: none;
      min-height: 96px;
      line-height: 1.5;
    }

    .label {
      display: block;
      font-size: 13px;
      font-weight: 500;
      color: var(--text-muted);
      margin-bottom: 8px;
      margin-top: 4px;
    }

    /* ── Status messages ── */
    .status {
      margin: 8px 0 16px;
      padding: 10px 14px;
      border-radius: 10px;
      font-size: 13px;
      line-height: 1.4;
      text-align: center;
    }
    .status.error {
      background: var(--error-soft);
      color: var(--error);
      border: 1px solid rgba(184, 80, 58, 0.18);
    }
    .status.info {
      background: var(--accent-soft);
      color: var(--text);
      border: 1px solid rgba(212, 168, 67, 0.24);
    }
    .status.success {
      background: var(--success-soft);
      color: var(--success);
      border: 1px solid rgba(74, 124, 89, 0.18);
    }
    .status:empty { display: none; }

    /* ── Empty / focus state ── */
    .empty-state {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: 40px 20px;
      gap: 8px;
    }
    .empty-icon {
      width: 96px;
      height: 96px;
      border-radius: 28px;
      background: var(--accent-soft);
      color: var(--accent);
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 20px;
    }
    .empty-icon svg { width: 48px; height: 48px; }
    .empty-state h1 { font-size: 26px; margin-bottom: 4px; }
    .empty-state .subtitle {
      max-width: 340px;
      margin-bottom: 28px;
      font-size: 15px;
    }
    .empty-state .btn { max-width: 320px; }

    /* ── Category list ── */
    .category-list { display: flex; flex-direction: column; gap: 12px; }
    .category-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 20px 22px;
      background: var(--bg-card);
      border: 1px solid var(--border-soft);
      border-radius: var(--radius);
      cursor: pointer;
      transition: all .2s;
      box-shadow: var(--shadow);
    }
    .category-row:hover {
      border-color: var(--accent);
      transform: translateY(-1px);
      box-shadow: var(--shadow-lg);
    }
    .category-row .name {
      font-weight: 600;
      font-size: 16px;
      color: var(--text);
    }
    .category-row .count {
      font-size: 13px;
      color: var(--text-muted);
      background: var(--bg2);
      padding: 4px 10px;
      border-radius: 999px;
      font-weight: 500;
    }
    .category-row::after {
      content: "→";
      color: var(--text3);
      font-size: 18px;
      margin-left: 12px;
      transition: transform .2s, color .2s;
    }
    .category-row:hover::after {
      color: var(--accent);
      transform: translateX(2px);
    }
    .category-row .count + .arrow, .category-row .name + .count { flex: none; }
    .category-row > div:first-child {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    /* ── Item grid ── */
    .item-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
    }

    .item-card {
      background: var(--bg-card);
      border: 2px solid var(--border-soft);
      border-radius: var(--radius);
      padding: 10px;
      cursor: pointer;
      transition: all .2s;
      display: flex;
      flex-direction: column;
      box-shadow: var(--shadow);
    }
    .item-card:hover {
      border-color: var(--accent);
      transform: translateY(-2px);
      box-shadow: var(--shadow-lg);
    }
    .item-card:active { transform: translateY(0); }
    .item-card.selected {
      border-color: var(--accent);
      background: var(--accent-soft);
    }

    .item-card img {
      width: 100%;
      aspect-ratio: 1;
      object-fit: cover;
      border-radius: 10px;
      background: var(--bg2);
      display: block;
    }
    .item-card .item-placeholder {
      width: 100%;
      aspect-ratio: 1;
      border-radius: 10px;
      background: linear-gradient(135deg, var(--bg2) 0%, #e8e4de 100%);
    }

    .item-card .item-name {
      font-size: 13px;
      font-weight: 500;
      margin-top: 10px;
      color: var(--text);
      line-height: 1.4;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .item-card .item-price {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 4px;
      font-weight: 500;
    }

    /* ── Sticky CTA ── */
    .cta-bar {
      position: sticky;
      bottom: 0;
      background: linear-gradient(180deg, rgba(250, 249, 247, 0) 0%, var(--bg) 40%);
      padding: 24px 0 env(safe-area-inset-bottom);
      margin-top: auto;
    }

    /* ── Generation progress ── */
    .progress-screen {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: 32px;
    }
    .spinner {
      width: 56px;
      height: 56px;
      border-radius: 50%;
      border: 4px solid var(--accent-soft);
      border-top-color: var(--accent);
      animation: spin 0.9s linear infinite;
      margin-bottom: 28px;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    .progress-hint {
      color: var(--text-muted);
      font-size: 15px;
      margin-top: 12px;
      max-width: 320px;
      line-height: 1.6;
    }

    /* ── Result screen ── */
    .result-image {
      width: 100%;
      border-radius: var(--radius);
      border: 1px solid var(--border-soft);
      background: var(--bg-card);
      display: block;
      margin-bottom: 20px;
      box-shadow: var(--shadow-lg);
    }

    /* ── Selection toolbar ── */
    .selection-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16px;
    }
    .selection-count {
      font-size: 14px;
      color: var(--text-muted);
      font-weight: 500;
    }
    .selection-clear {
      background: none;
      border: none;
      color: var(--accent);
      font-size: 14px;
      cursor: pointer;
      font-family: inherit;
      font-weight: 500;
      padding: 4px 8px;
      border-radius: 8px;
      transition: background .15s;
    }
    .selection-clear:hover { background: var(--accent-soft); }

    /* ── Paging ── */
    .loadmore { margin-top: 16px; }

    /* ── Inspiration: search + chips + try-on ── */
    .inspire-search {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 14px;
    }
    .inspire-search .input { flex: 1; margin: 0; }

    .chip-row {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      padding: 2px 0 14px;
      margin: 0 -4px 4px;
      padding-left: 4px;
      padding-right: 4px;
      scrollbar-width: none;
    }
    .chip-row::-webkit-scrollbar { display: none; }

    .chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
      padding: 7px 14px;
      background: var(--bg-card);
      border: 1px solid var(--border-soft);
      border-radius: 999px;
      font-size: 13px;
      font-weight: 500;
      color: var(--text-muted);
      cursor: pointer;
      font-family: inherit;
      transition: all .15s;
      white-space: nowrap;
    }
    .chip:hover { color: var(--text); border-color: var(--text3); }
    .chip.active {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff;
    }

    /* Try-on card: отличается от select-card (на screens.items). Там клик
       = выбор, здесь клик по карточке ничего не делает (preview), а внизу
       есть явная кнопка "Примерить". */
    .tryon-card {
      background: var(--bg-card);
      border: 1px solid var(--border-soft);
      border-radius: var(--radius);
      padding: 10px;
      display: flex;
      flex-direction: column;
      box-shadow: var(--shadow);
    }
    .tryon-card img, .tryon-card .item-placeholder {
      width: 100%;
      aspect-ratio: 1;
      object-fit: cover;
      border-radius: 10px;
      background: var(--bg2);
      display: block;
    }
    .tryon-card .item-name {
      font-size: 13px;
      font-weight: 500;
      margin-top: 10px;
      color: var(--text);
      line-height: 1.4;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      min-height: 2.8em;
    }
    .tryon-card .item-price {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 4px;
      font-weight: 500;
    }
    .tryon-btn {
      margin-top: 10px;
      padding: 9px 12px;
      background: var(--accent);
      color: #fff;
      border: none;
      border-radius: 10px;
      font-weight: 600;
      font-size: 13px;
      cursor: pointer;
      font-family: inherit;
      transition: background .15s;
    }
    .tryon-btn:hover { background: var(--accent-hover); }
    .tryon-btn:disabled { opacity: .6; cursor: not-allowed; }

    /* ── Modal (room picker) ── */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(20, 15, 12, 0.55);
      display: flex;
      align-items: flex-end;
      justify-content: center;
      z-index: 1000;
      animation: fadeIn .15s ease-out;
    }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    .modal-sheet {
      background: var(--bg-card);
      width: 100%;
      max-width: 560px;
      max-height: 88vh;
      border-radius: 20px 20px 0 0;
      padding: 20px 20px 28px;
      box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.24);
      overflow-y: auto;
      animation: slideUp .2s ease-out;
    }
    @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
    .modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16px;
    }
    .modal-header h2 { margin: 0; font-size: 18px; font-weight: 600; }
    .modal-close {
      background: var(--bg2);
      border: none;
      width: 32px;
      height: 32px;
      border-radius: 50%;
      font-size: 18px;
      cursor: pointer;
      color: var(--text-muted);
    }
    .modal-close:hover { color: var(--text); }

    /* ── Lightbox (fullscreen превью карточки каталога) ── */
    .lightbox-overlay {
      position: fixed;
      inset: 0;
      background: rgba(20, 15, 12, 0.88);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1100;
      padding: 24px 16px 16px;
      animation: fadeIn .15s ease-out;
    }
    .lightbox-close {
      position: absolute;
      top: max(12px, env(safe-area-inset-top));
      right: 12px;
      width: 40px;
      height: 40px;
      border-radius: 50%;
      border: none;
      background: rgba(255, 255, 255, 0.14);
      color: #fff;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 2;
    }
    .lightbox-close svg { width: 20px; height: 20px; }
    .lightbox-close:hover { background: rgba(255, 255, 255, 0.24); }
    .lightbox-body {
      width: 100%;
      max-width: 560px;
      max-height: 100%;
      display: flex;
      flex-direction: column;
      gap: 14px;
      align-items: stretch;
    }
    .lightbox-img {
      width: 100%;
      max-height: 70vh;
      object-fit: contain;
      border-radius: 14px;
      background: #fff;
    }
    .lightbox-info { color: #fff; text-align: center; }
    .lightbox-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
    .lightbox-price { font-size: 14px; color: rgba(255, 255, 255, 0.7); }
    .lightbox-actions {
      display: flex;
      gap: 10px;
      align-items: center;
    }
    .lightbox-actions .btn { flex: 1; margin: 0; }
    .lightbox-source {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 10px 14px;
      border-radius: var(--radius-btn);
      background: rgba(255, 255, 255, 0.12);
      color: #fff;
      text-decoration: none;
      font-size: 13px;
      font-weight: 500;
      white-space: nowrap;
    }
    .lightbox-source:hover { background: rgba(255, 255, 255, 0.2); }
    .lightbox-source-arrow svg { width: 14px; height: 14px; display: block; }

    /* Маленькая стрелка-бейдж на карточке — ссылка на источник. */
    .card-source-link {
      position: absolute;
      top: 8px;
      left: 8px;
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.92);
      color: var(--text);
      display: flex;
      align-items: center;
      justify-content: center;
      text-decoration: none;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
      z-index: 2;
    }
    .card-source-link svg { width: 14px; height: 14px; }
    .card-source-link:hover { background: #fff; }

    .room-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      margin-bottom: 16px;
    }
    .room-choice {
      background: var(--bg2);
      border: 2px solid var(--border-soft);
      border-radius: 12px;
      padding: 6px;
      cursor: pointer;
      transition: border-color .15s;
      position: relative;
    }
    .room-choice:hover { border-color: var(--text3); }
    .room-choice.selected { border-color: var(--accent); }
    .room-choice img {
      width: 100%;
      aspect-ratio: 1;
      object-fit: cover;
      border-radius: 8px;
      display: block;
    }
    .room-choice .room-label {
      font-size: 11px;
      color: var(--text-muted);
      padding: 6px 4px 2px;
      text-align: center;
    }
    .room-choice.upload {
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      min-height: 140px;
      color: var(--text-muted);
      font-size: 13px;
      font-weight: 500;
      background: var(--accent-soft);
      border-color: var(--accent);
      border-style: dashed;
    }
    .room-choice.upload svg { width: 28px; height: 28px; margin-bottom: 6px; stroke: var(--accent); }

    @media (min-width: 860px) {
      .chip-row { padding-bottom: 18px; }
      .chip { font-size: 14px; padding: 8px 16px; }
      .modal-overlay { align-items: center; }
      .modal-sheet { border-radius: 20px; max-height: 82vh; }
      .room-grid { grid-template-columns: repeat(3, 1fr); }
    }

    /* ── Responsive ── */
    @media (max-width: 380px) {
      .screen { padding: 20px 16px 28px; }
      h1 { font-size: 24px; }
      .item-grid { gap: 10px; }
    }

    /* ── Bottom tab bar ── */
    .tab-bar {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      display: flex;
      background: var(--bg-card);
      border-top: 1px solid var(--border-soft);
      padding-bottom: env(safe-area-inset-bottom);
      z-index: 100;
      box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
    }
    .tab-bar .tab {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-end;
      gap: 4px;
      padding: 10px 4px 12px;
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text-muted);
      font-family: inherit;
      font-size: 11px;
      font-weight: 500;
      transition: color .15s;
    }
    /* Фиксированная высота зоны иконки — все лейблы на одной линии
       независимо от размера иконки (center-glow побольше). */
    .tab-bar .tab span:first-child {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 30px;
    }
    .tab-bar .tab svg { width: 22px; height: 22px; }
    .tab-bar .tab.active { color: var(--accent); }
    /* Центральный таб — иконка крупнее + свечение, без подписи. */
    .tab-bar .tab.center-glow svg {
      width: 36px;
      height: 36px;
      filter: drop-shadow(0 0 6px rgba(212, 168, 67, 0.55));
    }
    .tab-bar .tab.center-glow.active svg {
      filter: drop-shadow(0 0 12px rgba(212, 168, 67, 0.85));
    }

    /* Screen c tab-баром нужно резервировать место снизу, иначе CTA упирается в tab bar */
    .screen.with-tabs {
      padding-bottom: calc(84px + env(safe-area-inset-bottom));
    }

    /* ── Hero (inspiration landing) ── */
    .hero {
      background: var(--bg-card);
      border-radius: var(--radius);
      padding: 28px 24px;
      box-shadow: var(--shadow);
      border: 1px solid var(--border-soft);
      margin-bottom: 16px;
    }
    .hero h1 { margin-bottom: 8px; font-size: 24px; }
    .hero .subtitle { margin-bottom: 20px; }

    /* ── History grid (Примерки / Комнаты) ── */
    .history-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
    }
    .history-card {
      background: var(--bg-card);
      border-radius: var(--radius);
      overflow: hidden;
      box-shadow: var(--shadow);
      border: 1px solid var(--border-soft);
      cursor: pointer;
      transition: all .2s;
      position: relative;
    }
    .history-card:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-lg);
    }
    .history-card img {
      width: 100%;
      aspect-ratio: 1;
      object-fit: cover;
      display: block;
      background: var(--bg2);
    }
    .history-card .meta {
      padding: 10px 12px;
      font-size: 12px;
      color: var(--text-muted);
    }
    .history-card .room-type {
      position: absolute;
      top: 10px;
      left: 10px;
      background: rgba(255, 255, 255, 0.92);
      padding: 4px 10px;
      border-radius: 999px;
      font-size: 11px;
      font-weight: 500;
      color: var(--text);
    }

    /* ── Room sections (grouped rooms) ── */
    .room-section { margin-bottom: 20px; }
    .room-section + .room-section { margin-top: 8px; }
    .room-section .section-label {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-muted);
      margin-bottom: 10px;
      margin-top: 12px;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }
    .room-section:first-child .section-label { margin-top: 0; }
    .room-card {
      background: var(--bg-card);
      border-radius: var(--radius);
      overflow: hidden;
      box-shadow: var(--shadow);
      border: 1px solid var(--border-soft);
      position: relative;
    }
    .room-card img {
      width: 100%;
      aspect-ratio: 1;
      object-fit: cover;
      display: block;
      background: var(--bg2);
    }
    .room-card .room-footer {
      padding: 8px 10px;
    }
    .room-card .room-footer select {
      width: 100%;
      font-family: inherit;
      font-size: 12px;
      padding: 6px 12px;
      border: 1px solid var(--border-soft);
      border-radius: 999px;
      background: var(--bg);
      color: var(--text-muted);
      cursor: pointer;
      -webkit-appearance: none;
      appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 10px center;
      padding-right: 26px;
    }
    .room-card .room-footer select.has-value {
      background-color: var(--accent-soft);
      border-color: var(--accent);
      color: var(--accent);
      font-weight: 500;
    }
    .room-card .meta {
      padding: 0 10px 8px;
      font-size: 11px;
      color: var(--text-muted);
    }
    .upload-placeholder {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      aspect-ratio: 1;
      background: var(--bg2);
      border-radius: 12px 12px 0 0;
      border: 2px dashed var(--border);
    }
    .upload-icon {
      width: 36px;
      height: 36px;
      color: var(--text-muted);
    }
    .upload-label {
      font-size: 13px;
      color: var(--text-muted);
      margin-top: 8px;
    }
    .upload-card:hover .upload-placeholder {
      border-color: var(--accent);
    }
    .upload-card:hover .upload-icon,
    .upload-card:hover .upload-label {
      color: var(--accent);
    }
    .fab-btn {
      position: fixed;
      bottom: calc(84px + env(safe-area-inset-bottom) + 8px);
      right: 20px;
      width: 52px;
      height: 52px;
      border-radius: 50%;
      border: none;
      background: var(--accent);
      color: #fff;
      font-size: 28px;
      font-weight: 300;
      line-height: 1;
      cursor: pointer;
      box-shadow: 0 4px 12px rgba(0,0,0,0.3);
      z-index: 10;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .fab-btn:active { transform: scale(0.92); }
    .upload-cta {
      margin: 0 0 20px;
      padding: 20px;
      background: linear-gradient(135deg, rgba(212, 168, 67,0.12), rgba(212, 168, 67,0.04));
      border: 1.5px solid rgba(212, 168, 67,0.3);
      border-radius: 16px;
      text-align: center;
    }
    .upload-cta h2 {
      font-size: 18px;
      margin-bottom: 6px;
      color: var(--heading);
    }
    .upload-cta p {
      font-size: 14px;
      color: var(--text-muted);
      margin-bottom: 14px;
    }
    .upload-cta .btn {
      font-size: 16px;
      padding: 14px 28px;
      width: 100%;
    }
    .upload-cta .divider {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-top: 14px;
      color: var(--text-muted);
      font-size: 13px;
    }
    .upload-cta .divider::before,
    .upload-cta .divider::after {
      content: "";
      flex: 1;
      height: 1px;
      background: var(--border);
    }
    .card-delete-btn {
      position: absolute;
      top: 6px;
      right: 6px;
      width: 24px;
      height: 24px;
      border-radius: 50%;
      border: none;
      background: rgba(0,0,0,0.55);
      color: #fff;
      font-size: 16px;
      line-height: 1;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 2;
      opacity: 0.7;
    }
    .card-delete-btn:hover { opacity: 1; }
    .result-sources {
      display: flex;
      gap: 12px;
      padding: 10px 0;
      overflow-x: auto;
      align-items: center;
    }
    .result-source-item {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 13px;
      color: var(--text-muted);
      flex-shrink: 0;
    }
    .result-source-thumb {
      width: 40px;
      height: 40px;
      border-radius: 6px;
      object-fit: cover;
    }
    .result-actions {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 12px;
    }
    .install-hint {
      background: var(--accent-soft);
      border: 1px solid var(--accent);
      border-radius: 12px;
      padding: 14px 16px;
      margin-bottom: 12px;
      font-size: 14px;
      line-height: 1.5;
      color: var(--text);
    }
    .install-hint .install-hint-title {
      font-weight: 600;
      margin-bottom: 6px;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .install-hint .install-hint-steps {
      margin: 8px 0 12px;
      padding-left: 20px;
    }
    .install-hint .install-hint-steps li {
      margin-bottom: 4px;
    }
    .install-hint .install-hint-dismiss {
      background: none;
      border: 1px solid var(--border-soft);
      color: var(--text-muted);
      font-size: 13px;
      padding: 6px 14px;
      border-radius: 8px;
      cursor: pointer;
      font-family: inherit;
    }
    .install-banner-profile {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 12px 16px;
      background: var(--accent-soft);
      border: 1px solid var(--accent);
      border-radius: 12px;
      margin-top: 12px;
      cursor: pointer;
      font-family: inherit;
      font-size: 14px;
      color: var(--text);
      border: 1px solid var(--accent);
      width: 100%;
      text-align: left;
    }
    .install-banner-profile .install-emoji { font-size: 20px; flex-shrink: 0; }
    @keyframes pulseBanner {
      0%, 100% { box-shadow: 0 0 0 0 rgba(0,122,255,0.3); }
      50% { box-shadow: 0 0 0 4px rgba(0,122,255,0); }
    }

    /* ── Profile rows ── */
    .profile-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 0;
      border-bottom: 1px solid var(--border-soft);
    }
    .profile-row:last-child { border-bottom: none; }
    .profile-row .key { color: var(--text-muted); font-size: 14px; }
    .profile-row .val { color: var(--text); font-size: 14px; font-weight: 500; }
    .profile-collapse-btn {
      display: flex;
      align-items: center;
      width: 100%;
      padding: 12px 16px;
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 14px;
      cursor: pointer;
      text-align: left;
    }
    .profile-collapse-btn:hover { color: var(--text); }

    /* ── Desktop sidebar (≥860px) ─────────────────────────────────────────
       Рендерится всегда внутри tab-экранов, но скрыт на мобиле через
       display:none. position:fixed — значит место в DOM неважно, можно
       держать рядом со screen'ом без обёртки. CSS-переключатель дешевле,
       чем условный JS-рендер, и позволяет не знать про viewport в коде.
    */
    .desktop-nav { display: none; }

    @media (min-width: 860px) {
      /* При sidebar-экранах сдвигаем контент вправо и гасим bottom tab-bar */
      body.with-sidebar #app { padding-left: 240px; }
      body.with-sidebar .tab-bar { display: none; }
      /* На desktop brand и balance в sidebar — в топбаре они дублируются,
         убираем "refurn" слева, balance оставляем в шапке контента */
      body.with-sidebar .topbar .brand { display: none; }

      .desktop-nav {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        width: 240px;
        background: var(--bg-warm);
        border-right: 1px solid var(--border-soft);
        display: flex;
        flex-direction: column;
        padding: 36px 16px 24px;
        z-index: 100;
      }
      .desktop-nav .sidebar-brand {
        display: block;
        width: 140px;
        height: auto;
        padding: 0 14px 6px;
        box-sizing: content-box;
      }
      .desktop-nav .sidebar-sub {
        font-size: 12px;
        color: var(--text3);
        padding: 0 14px 32px;
        font-weight: 500;
      }
      .desktop-nav .sidebar-tab {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 12px 14px;
        margin-bottom: 4px;
        border-radius: 12px;
        background: none;
        border: none;
        color: var(--text-muted);
        font-family: inherit;
        font-size: 15px;
        font-weight: 500;
        cursor: pointer;
        text-align: left;
        width: 100%;
        transition: all .15s;
      }
      .desktop-nav .sidebar-tab:hover { background: var(--bg2); color: var(--text); }
      .desktop-nav .sidebar-tab.active { background: var(--accent-soft); color: var(--accent); }
      .desktop-nav .sidebar-tab svg { width: 22px; height: 22px; flex-shrink: 0; }
      .desktop-nav .sidebar-tab.center-glow svg {
        filter: drop-shadow(0 0 6px rgba(212, 168, 67, 0.5));
      }
      .desktop-nav .sidebar-brand {
        cursor: pointer;
      }
      .desktop-nav button.sidebar-brand {
        background: none;
        border: none;
        padding: 0;
        text-align: left;
      }
      .desktop-nav .sidebar-spacer { flex: 1; }
      .desktop-nav .sidebar-foot {
        font-size: 12px;
        color: var(--text3);
        padding: 0 14px;
        line-height: 1.5;
      }

      /* Все screen'ы: шире и с большими отступами */
      .screen { padding: 48px 40px; max-width: 760px; }
      .screen.with-tabs {
        max-width: 960px;
        padding: 48px 56px;
      }
      /* На desktop tab-экранах mobile-only reservation под bottom-bar
         больше не нужен */
      body.with-sidebar .screen.with-tabs {
        padding-bottom: 48px;
      }

      h1 { font-size: 32px; }
      .subtitle { font-size: 17px; }

      /* Шире сетки, когда есть место */
      .item-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
      .history-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
      .category-list { gap: 14px; }
      .hero { padding: 40px 44px; }
      .hero h1 { font-size: 30px; }

      /* Sticky CTA градиент должен совпадать с фоном — на десктопе тот же bg */
      .cta-bar { padding: 32px 0 8px; }
    }

    @media (min-width: 1200px) {
      .screen.with-tabs { max-width: 1120px; }
      .item-grid { grid-template-columns: repeat(4, 1fr); }
      .history-grid { grid-template-columns: repeat(4, 1fr); }
    }

    /* ── Splash ── */
    .splash {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 24px;
      text-align: center;
      background: var(--bg-warm);
    }
    /* Splash-логотип — горизонтальный PNG с лендинга. Используется тот же
       файл что на refurn.ru, чтобы сохранить узнаваемость бренда. */
    .splash-logo {
      width: 200px;
      height: auto;
      max-height: 90px;
      margin-bottom: 12px;
      object-fit: contain;
    }
    .splash-title { display: none; }
    .splash-subtitle {
      color: var(--text-muted);
      font-size: 14px;
    }

    /* ── Skeleton shimmer ── */
    @keyframes skeleton-shimmer {
      0%   { background-position: -400px 0; }
      100% { background-position: 400px 0; }
    }
    .skeleton {
      background: linear-gradient(
        90deg,
        var(--bg2) 0%,
        var(--bg-warm) 40%,
        var(--bg2) 80%
      );
      background-size: 800px 100%;
      animation: skeleton-shimmer 1.4s ease-in-out infinite;
      border-radius: 12px;
      display: block;
    }
    .skeleton-card {
      aspect-ratio: 1 / 1;
      border-radius: var(--radius);
    }
    .skeleton-line {
      height: 14px;
      border-radius: 7px;
      margin: 8px 0;
    }
    .skeleton-line.sm { height: 10px; width: 60%; }

    /* Disabled / focus-visible для доступности */
    button:disabled,
    .btn:disabled,
    .btn[aria-disabled="true"] {
      opacity: 0.5;
      cursor: not-allowed;
      pointer-events: none;
    }
    :focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
      border-radius: 6px;
    }

    /* ── Room thumb на гостевом экране загрузки мебели ── */
    .room-thumb-wrap {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      margin-bottom: 16px;
    }
    .room-thumb {
      width: 120px;
      height: 90px;
      object-fit: cover;
      border-radius: 12px;
      border: 1px solid var(--border-soft);
      box-shadow: var(--shadow);
    }
    .room-thumb-caption {
      font-size: 12px;
      color: var(--text-muted);
    }

    /* ── Кнопка-карандаш на экране результата ── */
    .result-image-wrap {
      position: relative;
    }
    .result-refine-btn {
      position: absolute;
      top: 12px;
      right: 12px;
      width: 40px;
      height: 40px;
      border-radius: 50%;
      border: none;
      background: rgba(255, 255, 255, 0.92);
      color: var(--accent);
      cursor: pointer;
      box-shadow: var(--shadow);
      display: flex;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(4px);
      transition: transform .15s, background .15s;
    }
    .result-refine-btn:hover { background: #fff; transform: scale(1.05); }
    .result-refine-btn:active { transform: scale(0.95); }
    .result-refine-btn svg { width: 20px; height: 20px; }

    /* ── Modal actions row (refine модалка) ── */
    .modal-actions {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 16px;
    }

    /* ── Balance history (раскрывающаяся история по клику на баланс) ── */
    .balance-history-list {
      display: flex;
      flex-direction: column;
      gap: 2px;
      max-height: 60vh;
      overflow-y: auto;
      margin: 0 -4px;
    }
    .balance-history-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 10px 4px;
      border-bottom: 1px solid var(--border-soft);
    }
    .balance-history-row:last-child { border-bottom: none; }
    .bh-label {
      font-size: 14px;
      color: var(--text);
      font-weight: 500;
    }
    .bh-date {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 2px;
    }
    .bh-amount {
      font-size: 15px;
      font-weight: 600;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }
    .bh-amount.pos { color: var(--success); }
    .bh-amount.neg { color: var(--text-muted); }

    /* ── Кнопка-карандаш на карточке в истории примерок ── */
    .card-refine-btn {
      position: absolute;
      top: 8px;
      right: 44px;
      width: 30px;
      height: 30px;
      border-radius: 50%;
      border: none;
      background: rgba(255, 255, 255, 0.92);
      color: var(--accent);
      cursor: pointer;
      box-shadow: var(--shadow);
      display: flex;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(4px);
      transition: transform .15s, background .15s;
      z-index: 2;
    }
    .card-refine-btn:hover { background: #fff; transform: scale(1.05); }
    .card-refine-btn:active { transform: scale(0.95); }
    .card-refine-btn svg { width: 15px; height: 15px; }

    /* ── Fitting source picker (3 варианта после клика на комнату) ── */
    .fitting-source-options {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-bottom: 16px;
    }
    .fitting-source-opt {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 4px;
      background: var(--bg2);
      border: 1px solid var(--border-soft);
      border-radius: var(--radius);
      padding: 18px 12px;
      cursor: pointer;
      color: var(--text);
      font-family: inherit;
      text-align: center;
      transition: transform .1s, border-color .15s, background .15s;
    }
    .fitting-source-opt:hover { background: var(--bg-warm); border-color: var(--accent); }
    .fitting-source-opt:active { transform: scale(0.98); }
    .fs-icon { color: var(--accent); margin-bottom: 6px; }
    .fs-icon svg { width: 26px; height: 26px; }
    .fs-label { font-weight: 600; font-size: 14px; }
    .fs-hint { font-size: 11px; color: var(--text-muted); }

    .fitting-source-divider {
      display: flex;
      align-items: center;
      gap: 10px;
      color: var(--text-muted);
      font-size: 12px;
      margin: 10px 0 8px;
      text-transform: lowercase;
    }
    .fitting-source-divider::before,
    .fitting-source-divider::after {
      content: "";
      flex: 1;
      height: 1px;
      background: var(--border-soft);
    }

    /* ── Доработка прямо из карточки истории ── */
    .history-card .card-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 8px 10px 10px;
      min-width: 0;
    }
    .history-card .meta {
      font-size: 12px;
      color: var(--text-muted);
      margin: 0;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .card-refine-chip {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 5px 10px 5px 8px;
      background: var(--accent-soft);
      color: var(--accent);
      border: none;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 600;
      font-family: inherit;
      cursor: pointer;
      transition: background .15s;
      flex-shrink: 0;
    }
    .card-refine-chip:hover { background: rgba(212, 168, 67, 0.22); }
    .card-refine-chip svg { width: 13px; height: 13px; }
    /* Узкие карточки (2-колоночная сетка на мобиле) — оставляем только
       иконку без подписи, чтобы chip не обрезался. */
    @media (max-width: 600px) {
      .card-refine-chip {
        padding: 6px;
        width: 28px;
        height: 28px;
        justify-content: center;
      }
      .card-refine-chip span:last-child { display: none; }
      .card-refine-chip svg { width: 14px; height: 14px; }
    }
    .card-refine-inline {
      display: flex;
      gap: 8px;
      align-items: flex-end;
      padding: 0 10px 12px;
    }
    .card-refine-inline .input {
      flex: 1;
      min-width: 0;
      padding: 10px 12px;
      font-size: 14px;
      line-height: 1.35;
      resize: vertical;
      min-height: 72px;
    }
    .card-refine-send {
      width: 42px;
      min-width: 42px;
      height: 42px;
      border-radius: 50%;
      border: none;
      background: var(--accent);
      color: #fff;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background .15s;
    }
    .card-refine-send:hover:not(:disabled) { background: var(--accent-hover); }
    .card-refine-send:disabled { opacity: 0.5; cursor: not-allowed; }
    .card-refine-send svg { width: 20px; height: 20px; }
    .card-refine-send svg.spin { animation: spin-ccw 0.9s linear infinite; }
    @keyframes spin-ccw { to { transform: rotate(360deg); } }

    /* ── Истёкшая картинка результата ── */
    .item-placeholder.expired {
      aspect-ratio: 1 / 1;
      background: var(--bg2);
      color: var(--text-muted);
      font-size: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: 12px;
    }
    .result-image.expired {
      aspect-ratio: 16 / 9;
      background: var(--bg2);
      color: var(--text-muted);
      font-size: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: 24px;
      border-radius: 12px;
    }
