:root {
  --bg: #0B0B0E;
  --bg-elev: #121217;
  --bg-card: #181820;
  --bg-card-hover: #1F1F29;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(229, 169, 82, 0.35);
  --text: #F4F0EA;
  --text-muted: #9A98A6;
  --text-dim: #696775;
  --accent: #E5A952;
  --accent-bright: #F3C172;
  --accent-soft: rgba(229, 169, 82, 0.14);
  --green: #4CC38A;
  --green-soft: rgba(76, 195, 138, 0.14);
  --blue: #6EA8FE;
  --blue-soft: rgba(110, 168, 254, 0.14);
  --danger: #E26D6D;
  --danger-soft: rgba(226, 109, 109, 0.14);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

/* Предотвращаем авто-зум Safari на iPhone при фокусе на полях ввода */
input, textarea, select {
  font-size: 16px;
}

.hidden {
  display: none !important;
}

/* ============================================================================
   Верхняя панель прототипа (скрывается в установленном на iPhone standalone PWA)
============================================================================ */
.proto-toolbar {
  height: 44px;
  background: #070709;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 10px;
  z-index: 40;
}

@media all and (display-mode: standalone) {
  .proto-toolbar {
    display: none;
  }
  .device-stage {
    height: 100dvh !important;
  }
}

.proto-left, .proto-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.proto-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.proto-brand {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
}

.proto-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(76, 195, 138, 0.25);
  white-space: nowrap;
}

.proto-chip.frozen {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: rgba(110, 168, 254, 0.3);
}

.proto-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.proto-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.18);
}

.proto-btn.active, .proto-btn-accent {
  background: var(--accent-soft);
  color: var(--accent-bright);
  border-color: var(--border-strong);
}

/* ============================================================================
   Сцена устройства + Симулятор рамки iPhone 16 Pro на ПК
============================================================================ */
.device-stage {
  height: calc(100dvh - 44px);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background: var(--bg);
}

.iphone-bezel {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.iphone-statusbar,
.iphone-home-indicator {
  display: none;
}

/* Когда включён предпросмотр экрана iPhone на компьютере */
body.phone-preview .device-stage {
  background: radial-gradient(circle at 50% 25%, #1d1b22 0%, #070709 75%);
  padding: 16px;
  align-items: center;
}

body.phone-preview .iphone-bezel {
  width: 393px;
  max-width: 100%;
  height: min(844px, calc(100dvh - 76px));
  border-radius: 46px;
  border: 9px solid #23232B;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.12),
    0 30px 80px rgba(0, 0, 0, 0.78);
  background: var(--bg);
}

body.phone-preview .iphone-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-elev);
  flex-shrink: 0;
}

.dynamic-island {
  width: 104px;
  height: 25px;
  background: #000;
  border-radius: 999px;
}

.iphone-indicators {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

.iphone-bat {
  width: 20px;
  height: 10px;
  border: 1px solid rgba(255,255,255,0.65);
  border-radius: 3px;
  padding: 1px;
  display: inline-flex;
}
.iphone-bat i {
  background: #fff;
  width: 80%;
  border-radius: 1px;
}

body.phone-preview .iphone-home-indicator {
  display: flex;
  justify-content: center;
  padding: 5px 0 7px;
  background: rgba(18, 18, 23, 0.96);
  flex-shrink: 0;
}
.iphone-home-indicator span {
  width: 128px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}

.app-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================================================
   Экран Входа (Login + Демо-карточки в 1 клик)
============================================================================ */
.auth-screen {
  flex: 1;
  overflow-y: auto;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 18px calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(600px circle at 50% 0%, rgba(229, 169, 82, 0.09), transparent 70%),
    var(--bg);
}

.auth-container {
  width: 100%;
  max-width: 440px;
  margin: auto;
}

.auth-hero {
  text-align: center;
  margin-bottom: 22px;
}

.auth-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  border: 1px solid var(--border-strong);
  margin-bottom: 12px;
}

.auth-hero h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.45;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input, .textarea, .select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}

.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
}

.textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.45;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  color: #14110B;
  box-shadow: 0 6px 20px rgba(229, 169, 82, 0.22);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-ghost {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-card-hover);
}

.btn-sm {
  padding: 7px 11px;
  font-size: 12px;
  border-radius: 9px;
}

.btn-full {
  width: 100%;
}

.demo-section {
  margin-top: 18px;
}

.demo-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 10px 4px;
}

.switcher-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.demo-acc-btn {
  width: 100%;
  text-align: left;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.demo-acc-btn:hover {
  background: var(--bg-card);
  border-color: var(--border-strong);
}

.demo-acc-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}

.demo-acc-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-active {
  background: var(--green-soft);
  color: var(--green);
}

.badge-pending {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge-archive {
  background: var(--accent-soft);
  color: var(--accent-bright);
}

.badge-expired {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ============================================================================
   Клиентский кабинет Фотостудии (Desktop 3-col + Mobile PWA Tabs)
============================================================================ */
.studio-header {
  background: rgba(18, 18, 23, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

body.phone-preview .studio-header {
  padding-top: 10px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  color: var(--accent-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.user-meta {
  min-width: 0;
}

.user-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lora-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 2px 6px;
  border-radius: 5px;
}

.session-meters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meter-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.meter-pill strong {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-bright);
}

/* Плашка режима 3-дневного архива или заморозки */
.state-banner {
  padding: 9px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.state-banner.archive {
  background: rgba(229, 169, 82, 0.11);
  color: var(--accent-bright);
}

.state-banner.frozen {
  background: rgba(110, 168, 254, 0.12);
  color: var(--blue);
}

/* Сетка студии на ПК */
.studio-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 370px;
  overflow: hidden;
}

.studio-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.studio-pane:last-child {
  border-right: none;
}

.pane-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.pane-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pane-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  -webkit-overflow-scrolling: touch;
}

/* Пресеты света и сцен */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-bottom: 16px;
}

.preset-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  aspect-ratio: 4 / 4.6;
  cursor: pointer;
  background: var(--bg-card);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.preset-card:hover {
  transform: translateY(-1px);
}

.preset-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(229, 169, 82, 0.25);
}

.preset-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preset-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05) 35%, rgba(8,8,11,0.92) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 9px;
}

.preset-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.preset-sub {
  font-size: 10px;
  color: rgba(244, 240, 234, 0.72);
  margin-top: 2px;
}

/* Формат кадра и режимы проявки ИИ */
.seg-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.seg-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
}

.seg-btn.active {
  background: var(--accent-soft);
  border-color: var(--border-strong);
  color: var(--accent-bright);
  font-weight: 600;
}

.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
}

/* Центральная панель: Видоискатель + Архивная плёнка */
.viewfinder-box {
  background: #08080B;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
  position: relative;
}

.vf-stage {
  position: relative;
  height: 320px;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #17171f 0%, #09090c 100%);
}

.vf-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.vf-job-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 12, 0.84);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.spinner-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(229, 169, 82, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-track {
  width: min(240px, 85%);
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.25s ease;
}

.vf-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Галерея / Архив */
.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.photo-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  aspect-ratio: 3 / 4;
  cursor: pointer;
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.photo-card:hover img {
  transform: scale(1.03);
}

.photo-card-bar {
  position: absolute;
  inset: auto 0 0 0;
  padding: 22px 8px 8px;
  background: linear-gradient(180deg, transparent, rgba(8,8,11,0.92));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.photo-card-title {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-btn {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.fav-btn.is-fav {
  color: #FF6B81;
  border-color: rgba(255, 107, 129, 0.45);
  background: rgba(255, 107, 129, 0.16);
}

/* ============================================================================
   Чат с Личным ИИ-Фотографом
============================================================================ */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.msg-bubble {
  max-width: 92%;
  padding: 11px 13px;
  border-radius: 15px;
  font-size: 13.5px;
  line-height: 1.48;
}

.msg-user {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-bottom-right-radius: 4px;
}

.msg-assistant {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.scene-card {
  margin-top: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  padding: 10px;
}

.scene-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.scene-card-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-bright);
}

.prompt-details {
  margin: 6px 0 9px;
  font-size: 11px;
  color: var(--text-muted);
}

.prompt-details summary {
  cursor: pointer;
  user-select: none;
}

.prompt-code {
  margin-top: 6px;
  padding: 8px;
  background: #09090C;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.4;
  color: #C8C5D4;
  word-break: break-word;
}

.quick-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 12px 4px;
  border-top: 1px solid var(--border);
  scrollbar-width: none;
  flex-shrink: 0;
}
.quick-chips::-webkit-scrollbar {
  display: none;
}

.chip-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  white-space: nowrap;
  cursor: pointer;
}
.chip-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.chat-composer {
  padding: 8px 12px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-composer input {
  flex: 1;
}

/* ============================================================================
   Мобильный Нижний Таб-Бар (iPhone PWA + узкие экраны)
============================================================================ */
.mobile-tabbar {
  display: none;
  background: rgba(16, 16, 21, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  flex-shrink: 0;
}

body.phone-preview .mobile-tabbar {
  padding-bottom: 4px;
}

.tabbar-item {
  background: none;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 4px;
  font-size: 10.5px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
}

.tabbar-item.active {
  color: var(--accent-bright);
}

.tabbar-badge {
  position: absolute;
  top: 2px;
  right: 22%;
  background: var(--accent);
  color: #14110B;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
}

/* Перестроение в мобильный режим (реальный телефон ИЛИ включённая рамка iPhone на ПК) */
@media (max-width: 960px) {
  .proto-brand, #gpuStatusBadge {
    display: none;
  }
}

@media (max-width: 880px) {
  .studio-workspace {
    display: flex;
    flex-direction: column;
  }
  .studio-pane {
    border-right: none;
    flex: 1;
  }
  .studio-pane.mobile-hidden {
    display: none !important;
  }
  .mobile-tabbar {
    display: grid;
  }
  .vf-stage {
    height: 240px;
  }
}

body.phone-preview .studio-workspace {
  display: flex;
  flex-direction: column;
}
body.phone-preview .studio-pane {
  border-right: none;
  flex: 1;
}
body.phone-preview .studio-pane.mobile-hidden {
  display: none !important;
}
body.phone-preview .mobile-tabbar {
  display: grid;
}
body.phone-preview .vf-stage {
  height: 220px;
}
body.phone-preview .session-meters .hide-on-phone {
  display: none;
}

/* ============================================================================
   Админ-панель Владельца Студии
============================================================================ */
.admin-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-nav {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  overflow-x: auto;
  flex-shrink: 0;
}

.admin-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px calc(28px + env(safe-area-inset-bottom, 0px));
}

.admin-container {
  max-width: 1120px;
  margin: 0 auto;
}

.admin-grid-2 {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

@media (max-width: 880px) {
  .admin-grid-2 {
    grid-template-columns: 1fr;
  }
}
body.phone-preview .admin-grid-2 {
  grid-template-columns: 1fr;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.client-admin-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}

.client-admin-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.client-admin-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.client-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.code-block {
  background: #070709;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-bright);
  overflow-x: auto;
  line-height: 1.5;
}

/* ============================================================================
   Модальные шторки (iOS Sheet стиль) + Lightbox + Тосты
============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

@media (max-width: 640px) {
  .modal-backdrop:not(.lightbox-backdrop) {
    align-items: flex-end;
    padding: 0;
  }
  .modal-sheet {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    max-width: 100% !important;
  }
}

.modal-sheet {
  width: 100%;
  max-width: 460px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  max-height: 90dvh;
  overflow-y: auto;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.2);
  margin: 0 auto 12px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-head h3 {
  margin: 0 0 3px;
  font-size: 17px;
}

.modal-head p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.app-icon-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-icon-badge img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
}

.icon-close {
  background: var(--bg-card);
  border: 1px solid var(--border);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
}

.ios-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.ios-step {
  display: flex;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px;
}

.ios-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ios-step strong {
  display: block;
  font-size: 13.5px;
  margin-bottom: 3px;
}

.ios-step p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.inline-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255,255,255,0.12);
  color: var(--text);
  font-weight: 600;
}

.callout {
  padding: 11px 13px;
  border-radius: 11px;
  font-size: 13px;
  margin-bottom: 12px;
}
.callout-success {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(76, 195, 138, 0.3);
}

.lightbox-card {
  width: 100%;
  max-width: 760px;
  max-height: 92dvh;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.lightbox-img-wrap {
  background: #050507;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 68dvh;
  overflow: hidden;
}

.lightbox-img-wrap img {
  max-width: 100%;
  max-height: 68dvh;
  object-fit: contain;
}

.lightbox-meta {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toast-box {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1E1E28;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0,0,0,0.6);
}

/* ==========================================================================
   ЭТАП 0: ПОДГОТОВКА ИИ-ОБРАЗА + ЗАЩИТА ПРИВАТНОСТИ
   ========================================================================== */
.onboarding-shell {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px calc(32px + env(safe-area-inset-bottom, 0px));
}

.onboarding-container {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.privacy-shield-card {
  background: linear-gradient(135deg, rgba(61, 214, 140, 0.08), rgba(229, 169, 82, 0.07));
  border: 1px solid rgba(61, 214, 140, 0.28);
  border-radius: 14px;
  padding: 13px 15px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.privacy-shield-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(61, 214, 140, 0.16);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.tips-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (max-width: 560px) {
  .tips-grid-4 {
    grid-template-columns: 1fr;
  }
}

.tip-mini-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.4;
}

.tip-mini-card strong {
  display: block;
  color: var(--text);
  margin-bottom: 2px;
}

.tip-mini-card span {
  color: var(--text-muted);
}

.upload-dropzone {
  border: 1.5px dashed rgba(229, 169, 82, 0.42);
  background: rgba(229, 169, 82, 0.05);
  border-radius: 14px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-dropzone:hover {
  border-color: var(--accent);
  background: rgba(229, 169, 82, 0.09);
}

.onboarding-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.ob-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #08080B;
}

.ob-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ob-thumb-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.selfie-verify-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px 14px;
}

.selfie-preview-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.selfie-preview-pill img {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  object-fit: cover;
  border: 1.5px solid var(--green);
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.45;
}

.consent-row input[type="checkbox"] {
  margin-top: 3px;
  transform: scale(1.15);
  accent-color: var(--accent);
}

.admin-vault-box {
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(229, 169, 82, 0.06);
  border: 1px solid rgba(229, 169, 82, 0.28);
}

.admin-vault-thumbs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-top: 8px;
}

.admin-vault-thumbs img {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

