/* SNAUT Web — тёмная визуальная система (см. DESIGN.md). Нейтральный фон, тонкие границы, акцент только у первичных действий. */
:root {
  color-scheme: dark;
  --bg: #0e0e10;
  --surface: #141417;
  --surface-2: #1a1a1e;
  --surface-3: #232328;
  --hover: rgba(255, 255, 255, 0.05);
  --active: rgba(255, 255, 255, 0.08);
  --border: #25252a;
  --border-strong: #34343b;
  --text: #ececef;
  --muted: #9b9ba4;
  --faint: #686871;
  --accent: #8d9bff;
  --accent-soft: rgba(141, 155, 255, 0.14);
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  font-family: Inter, 'Segoe UI Variable Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
}

::selection {
  background: rgba(141, 155, 255, 0.35);
}

.icon {
  flex: none;
}

button,
.button {
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

button:hover:not(:disabled),
.button:hover:not(.disabled) {
  background: var(--surface-3);
}

button:disabled,
.button.disabled {
  opacity: 0.45;
  cursor: default;
}

button.primary {
  background: var(--text);
  border-color: var(--text);
  color: #0e0e10;
  font-weight: 500;
}

button.primary:hover:not(:disabled) {
  background: #fff;
}

button.danger {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.35);
  background: var(--danger-soft);
}

button.danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.2);
}

button.danger-solid {
  background: #dc4c4c;
  border-color: #dc4c4c;
  color: #fff;
  font-weight: 500;
}

button.danger-solid:hover:not(:disabled) {
  background: #e45d5d;
}

button.link {
  border: none;
  background: none;
  min-height: 0;
  padding: 2px 4px;
  color: var(--muted);
}

.icon-button {
  width: 32px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover:not(:disabled) {
  color: var(--text);
  background: var(--hover);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
  z-index: 50;
  background: var(--surface-2);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.center {
  text-align: center;
}

.badge {
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
}

.skeleton {
  display: block;
  height: 30px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton.short {
  width: 60%;
}

.skeleton.wide {
  height: 64px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- menus & dialog ---------- */

.menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  box-shadow: var(--shadow);
  display: grid;
  gap: 2px;
}

.menu-up {
  top: auto;
  bottom: calc(100% + 6px);
}

.menu-item {
  width: 100%;
  justify-content: flex-start;
  border: none;
  background: transparent;
  padding: 6px 10px;
  text-align: left;
}

.menu-item:hover:not(:disabled) {
  background: var(--hover);
}

.menu-item-stacked {
  display: grid;
  gap: 1px;
}

.menu-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.menu-item-note {
  font-size: 12px;
  color: var(--muted);
}

.menu-item .check {
  color: var(--accent);
}

.menu-foot {
  margin: 4px 10px 2px;
  font-size: 11px;
  color: var(--faint);
}

.menu-section {
  display: grid;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.danger-text {
  color: var(--danger);
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
}

.dialog {
  width: min(420px, 100%);
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

.dialog h2 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
}

.dialog p {
  margin: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ---------- layout ---------- */

.app {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  height: 100%;
}

.app.sidebar-collapsed {
  grid-template-columns: 60px minmax(0, 1fr);
}

.main {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
  min-width: 0;
}

.brand-mark {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--text);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}

/* ---------- sidebar ---------- */

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 10px;
  min-height: 0;
  min-width: 0;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 2px 2px 4px;
}

.new-project {
  justify-content: flex-start;
  background: transparent;
  border-color: var(--border-strong);
}

.new-project .icon {
  display: none;
}

.projects {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.sidebar-section {
  margin: 4px 8px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.sidebar-empty {
  margin: 4px 8px;
}

.skeleton-list {
  display: grid;
  gap: 6px;
  padding: 0 4px;
}

.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
}

.project-row {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
}

.project-row:hover,
.project-row.menu-open {
  background: var(--hover);
}

.project-row.selected {
  background: var(--active);
}

.project-item {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 1px;
  justify-content: stretch;
  text-align: left;
  border: none;
  background: transparent;
  padding: 7px 4px 7px 10px;
  white-space: normal;
}

.project-item:hover:not(:disabled) {
  background: transparent;
}

.project-name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-weight: 500;
}

.project-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-meta {
  font-size: 12px;
  color: var(--faint);
}

.row-menu-button {
  flex: none;
  width: 28px;
  min-height: 28px;
  padding: 0;
  margin-right: 4px;
  border: none;
  background: transparent;
  color: var(--muted);
  opacity: 0;
}

.project-row:hover .row-menu-button,
.project-row.selected .row-menu-button,
.project-row.menu-open .row-menu-button,
.row-menu-button:focus-visible {
  opacity: 1;
}

.row-menu {
  left: auto;
  right: 4px;
  min-width: 170px;
}

.rename-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  margin: 3px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.pulse {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

.sidebar-footer {
  position: relative;
}

.sidebar-footer .menu {
  left: 0;
  right: 0;
}

.account-button {
  width: 100%;
  justify-content: flex-start;
  gap: 9px;
  border-color: transparent;
  background: transparent;
  padding: 6px;
  color: var(--muted);
}

.account-avatar {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.account-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

/* свернутая панель: только знак, кнопки-иконки */
.sidebar.collapsed {
  align-items: center;
  padding-inline: 8px;
}

.sidebar.collapsed .sidebar-head {
  flex-direction: column;
  padding: 2px 0;
}

.sidebar.collapsed .brand-name,
.sidebar.collapsed .projects,
.sidebar.collapsed .new-project-label,
.sidebar.collapsed .account-name,
.sidebar.collapsed .account-button .icon {
  display: none;
}

.sidebar.collapsed .new-project {
  width: 36px;
  padding: 0;
  justify-content: center;
}

.sidebar.collapsed .new-project .icon {
  display: block;
}

.sidebar.collapsed .sidebar-footer {
  margin-top: auto;
}

.sidebar.collapsed .account-button {
  justify-content: center;
}

.sidebar.collapsed .settings-menu {
  right: auto;
  min-width: 220px;
}

/* ---------- home ---------- */

.home {
  flex: 1;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 48px 24px;
  background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(141, 155, 255, 0.07), transparent 70%), var(--bg);
}

.home-inner {
  width: min(720px, 100%);
  display: grid;
  gap: 18px;
  margin-top: -8vh;
}

.home-title {
  margin: 0;
  text-align: center;
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.home-subtitle {
  margin: -4px auto 10px;
  max-width: 520px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

.scenarios {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.scenario {
  border-radius: 999px;
  background: transparent;
  border-color: var(--border-strong);
  color: var(--muted);
  padding: 5px 13px;
}

.scenario:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-2);
}

/* ---------- composer ---------- */

.composer {
  display: grid;
  gap: 6px;
}

.composer-box {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.composer-box:focus-within {
  border-color: #4a4a54;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.03);
}

.composer textarea {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 15px;
  resize: none;
  min-height: 52px;
  max-height: 240px;
  padding: 14px 16px 6px;
  border: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: transparent;
  color: var(--text);
  outline: none;
  field-sizing: content;
}

.composer textarea::placeholder {
  color: var(--faint);
}

.composer-home textarea {
  min-height: 96px;
}

.composer-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 8px;
}

.composer-spacer {
  flex: 1;
}

.picker {
  position: relative;
}

.chip-button,
.chip-static {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.chip-static {
  cursor: help;
}

.chip-button:hover:not(:disabled) {
  color: var(--text);
  background: var(--hover);
}

.platform-menu {
  min-width: 250px;
}

.send-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.send-button:hover:not(:disabled) {
  background: #fff;
}

.send-button:disabled {
  background: var(--surface-3);
  border-color: var(--surface-3);
  color: var(--faint);
  opacity: 1;
}

.stop-button {
  border-radius: 999px;
}

.composer-hint {
  margin: 0 6px;
  font-size: 11px;
  color: var(--faint);
}

/* ---------- workspace ---------- */

.workspace {
  --preview-fraction: 0.5;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(340px, 1fr) 7px minmax(320px, calc(var(--preview-fraction) * 100%));
  grid-template-rows: minmax(0, 1fr);
}

.workspace-tabs {
  display: none;
}

.workspace.dragging {
  cursor: col-resize;
  user-select: none;
}

.workspace.dragging iframe {
  pointer-events: none;
}

.splitter {
  position: relative;
  cursor: col-resize;
  background: var(--bg);
  touch-action: none;
}

.splitter::after {
  content: '';
  position: absolute;
  inset: 0 3px;
  background: var(--border);
  transition: background 0.12s;
}

.splitter:hover::after,
.splitter:focus-visible::after,
.dragging .splitter::after {
  inset: 0 2px;
  background: var(--accent);
}

.splitter:focus-visible {
  outline: none;
}

/* ---------- chat ---------- */

.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--bg);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}

.chat-header h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version-badge {
  flex: none;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
}

.messages {
  flex: 1;
  overflow: auto;
  padding: 22px 20px;
  display: grid;
  align-content: start;
  gap: 22px;
}

.chat-loading {
  display: grid;
  gap: 10px;
}

.empty-chat {
  max-width: 440px;
  margin: 14vh auto 0;
  text-align: center;
}

.empty-chat h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.turn {
  display: grid;
  gap: 12px;
}

.bubble {
  border-radius: var(--radius-lg);
  max-width: 92%;
}

.bubble.user {
  justify-self: end;
  padding: 10px 15px;
  background: var(--surface-3);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble.user .answer {
  margin: 6px 0 0;
  color: var(--muted);
}

.bubble.snaut {
  padding: 2px 2px 2px 0;
}

.snaut-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.headline {
  font-weight: 500;
}

.avatar {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--text);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.steps {
  list-style: none;
  margin: 10px 0 0 5px;
  padding: 2px 0 2px 20px;
  border-left: 1px solid var(--border-strong);
  display: grid;
  gap: 6px;
}

.step {
  display: flex;
  gap: 9px;
  color: var(--muted);
}

.step-icon {
  flex: none;
  width: 16px;
  text-align: center;
}

.step-running {
  color: var(--text);
}

.step-running .step-icon {
  color: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.step-done .step-icon {
  color: var(--success);
}

.step-warning .step-icon {
  color: var(--warning);
}

.step-failed .step-icon {
  color: var(--danger);
}

.step-skipped,
.step-pending {
  color: var(--faint);
}

/* чек-лист критериев готовности внутри шага «Проверяю приложение» */
.criteria {
  list-style: none;
  margin: 6px 0 2px;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.criterion {
  display: flex;
  gap: 8px;
  color: var(--muted);
}

.criterion-done .step-icon {
  color: var(--success);
}

.criterion-failed {
  color: var(--text);
}

.criterion-failed .step-icon {
  color: var(--danger);
}

.criterion-warning .step-icon {
  color: var(--warning);
}

.criterion-group {
  margin-right: 6px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.app-summary {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 2px;
  font-size: 13px;
  color: var(--muted);
}

.app-summary p {
  margin: 0;
}

.app-summary strong {
  color: var(--text);
  font-weight: 600;
}

.completion-report {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.completion-report .result {
  margin: 0;
  font-weight: 500;
}

.completion-report p.muted {
  margin: 0;
}

.failed-criteria {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.failed-criteria li {
  display: flex;
  gap: 8px;
}

.failed-criteria .step-icon {
  color: var(--danger);
}

.step-detail {
  color: var(--faint);
}

.result-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.result-row .result {
  margin: 0;
}

.result {
  margin: 10px 0 0;
}

.result.done {
  font-weight: 500;
}

.result.done::before {
  content: '✓';
  color: var(--success);
  margin-right: 8px;
}

.result.warn {
  color: var(--warning);
}

.open-app {
  border-radius: 999px;
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
  font-weight: 500;
}

.open-app:hover:not(.disabled) {
  background: #fff;
}

.reconnect {
  margin: 10px 0 0;
  color: var(--warning);
}

.questions {
  margin-top: 10px;
}

.questions p {
  margin: 0;
}

.questions ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.details {
  margin-top: 10px;
}

.details summary {
  cursor: pointer;
  color: var(--faint);
  font-size: 12px;
}

.tech {
  list-style: none;
  padding: 8px 10px;
  margin: 6px 0 0;
  max-height: 220px;
  overflow: auto;
  font-size: 11px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.tech code {
  white-space: pre-wrap;
  word-break: break-word;
}

.chat .composer {
  padding: 10px 16px 14px;
}

.notice {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: calc(100% - 32px);
  padding: 8px 10px 8px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}

.notice-error {
  border-color: rgba(248, 113, 113, 0.4);
}

/* ---------- preview ---------- */

.preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--surface);
}

.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.preview-status {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-status::before {
  content: '●';
  margin-right: 7px;
  color: var(--faint);
}

.status-ready::before {
  color: var(--success);
}

.status-starting::before {
  color: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.status-failed::before {
  color: var(--danger);
}

.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.segmented button {
  min-height: 28px;
  padding: 3px 9px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}

.segmented button[aria-pressed='true'] {
  background: var(--surface-3);
  color: var(--text);
}

.toolbar-actions {
  display: flex;
  gap: 6px;
}

/* Переход из Builder в Marketplace единого сайта SNAUT. */
.market-link {
  margin-left: auto;
  margin-right: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.market-link:hover {
  color: var(--text);
  background: var(--hover);
}
a.brand {
  color: inherit;
  text-decoration: none;
}

.toolbar-actions button,
.toolbar-actions .button {
  background: transparent;
  border-color: var(--border-strong);
}

/* «Опубликовать в Marketplace» — первичное действие готовой версии: акцентный цвет, как у главных кнопок. */
.toolbar-actions .publish-button {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  white-space: nowrap;
}

.preview-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: stretch;
  padding: 14px;
  overflow: auto;
}

.preview-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.preview-empty p {
  margin: 0;
}

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--surface-3);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

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

.frame-wrap {
  height: 100%;
  min-height: 0;
  display: grid;
  justify-items: center;
  align-items: stretch;
}

.device {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #fff;
}

.device iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.viewport-tablet .device,
.viewport-mobile .device {
  border: 10px solid #26262c;
  border-radius: 26px;
  box-shadow: 0 0 0 1px #3a3a42, var(--shadow);
}

.viewport-tablet .device {
  width: 788px;
  max-width: 100%;
}

.viewport-mobile .device {
  width: 410px;
  max-width: 100%;
  max-height: 880px;
  align-self: center;
  border-radius: 36px;
}

/* ---------- login ---------- */

.login {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 16px;
}

.login-card {
  width: min(400px, 100%);
  display: grid;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.login-card h1 {
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 10px 0;
}

.login-card input {
  font: inherit;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
}

/* ---------- responsive ---------- */

/* подписи кнопок панели preview зависят от ширины самой панели (граница перетаскивается) */
.preview {
  container-type: inline-size;
}

.preview-status {
  min-width: 90px;
}

@container (max-width: 760px) {
  .action-label {
    display: none;
  }
}

@container (max-width: 620px) {
  .segment-label {
    display: none;
  }
}

/* узкий экран: чат и preview — вкладки */
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .workspace-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
  }

  .workspace-tabs button {
    flex: 1;
    border-color: transparent;
    background: transparent;
    color: var(--muted);
  }

  .workspace-tabs button[aria-selected='true'] {
    background: var(--surface-3);
    color: var(--text);
  }

  .splitter {
    display: none;
  }

  .workspace.tab-chat .preview,
  .workspace.tab-preview .chat {
    display: none;
  }
}

@media (max-width: 720px) {
  .app,
  .app.sidebar-collapsed {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .sidebar {
    align-items: center;
    padding-inline: 8px;
  }

  .sidebar .sidebar-head {
    flex-direction: column;
  }

  .sidebar .brand-name,
  .sidebar .projects,
  .sidebar .new-project-label,
  .sidebar .account-name,
  .sidebar .account-button .icon,
  .sidebar .collapse-button {
    display: none;
  }

  .sidebar .new-project {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .sidebar .new-project .icon {
    display: block;
  }

  .sidebar .sidebar-footer {
    margin-top: auto;
  }

  .home {
    padding: 28px 16px;
  }

  .chip-static {
    display: none;
  }
}
