:root {
  --bg: #0b111b;
  --bg-elevated: #111827;
  --panel: #151e2e;
  --card: #1b2538;
  --card-hover: #222e46;
  --border: #26334a;
  --border-strong: #374868;
  --text: #e6edf7;
  --muted: #8b9bb4;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --cyan: #06b6d4;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
}

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

code, pre, .mono {
  font-family: var(--mono);
}

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

[hidden] {
  display: none !important;
}

/* Login */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
  background: radial-gradient(circle at top, #17233a 0%, var(--bg) 65%);
}

.login-card {
  width: 100%;
  max-width: 410px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.login-brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

.login-brand p {
  margin: 2px 0 0;
  font-size: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: #fff;
  flex-shrink: 0;
}

.brand-mark.sm {
  width: 26px;
  height: 26px;
  font-size: 11px;
  border-radius: 7px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.login-foot {
  margin: 18px 0 0;
  font-size: 11.5px;
  text-align: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field span {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}

.field input,
.field select,
.field textarea,
.input,
.select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

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

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

/* Alerts & Buttons */
.alert-error {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  border-radius: 7px;
  padding: 8px 11px;
  font-size: 12px;
}

.alert-ok {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
  border-radius: 7px;
  padding: 8px 11px;
  font-size: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  border-radius: 7px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover:not(:disabled) {
  background: var(--card-hover);
  border-color: #4f648a;
}

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

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.26);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11.5px;
  border-radius: 6px;
}

.btn-block {
  width: 100%;
  padding: 9px 14px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge.ok {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.badge.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.45);
  color: #a5b4fc;
}

.badge.warn {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fcd34d;
}

.badge.err {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.badge.thought {
  background: rgba(139, 92, 246, 0.16);
  border-color: rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
}

.badge.note {
  background: rgba(6, 182, 212, 0.16);
  border-color: rgba(6, 182, 212, 0.4);
  color: #67e8f9;
}

/* Shell Layout */
.studio-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

.topbar {
  height: 46px;
  flex-shrink: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 10px;
}

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

.brand-title {
  font-weight: 650;
  font-size: 13.5px;
  letter-spacing: 0.2px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 11.5px;
  cursor: pointer;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.status-dot.ok {
  background: var(--green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.status-dot.err {
  background: var(--red);
}

.inspect-banner {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.18), rgba(99, 102, 241, 0.15));
  border-bottom: 1px solid rgba(245, 158, 11, 0.4);
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: #fde68a;
  flex-shrink: 0;
}

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

.segmented button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}

.segmented button.active {
  background: var(--accent);
  color: #fff;
}

.workspace-split {
  flex: 1;
  min-height: 0;
  display: flex;
  width: 100%;
  overflow: hidden;
}

.workspace-split.layout-freecad .pane-left {
  width: 100% !important;
  flex: 1;
}

.workspace-split.layout-freecad .pane-right,
.workspace-split.layout-freecad .splitter {
  display: none;
}

.workspace-split.layout-studio .pane-left,
.workspace-split.layout-studio .splitter {
  display: none;
}

.workspace-split.layout-studio .pane-right {
  width: 100% !important;
  flex: 1;
}

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

.pane-left {
  width: 50%;
  background: #090e17;
}

.pane-right {
  flex: 1;
  min-width: 340px;
}

.splitter {
  width: 6px;
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  cursor: col-resize;
  transition: background 0.15s;
}

.splitter:hover,
.splitter.dragging {
  background: var(--accent);
}

/* Viewport Header */
.pane-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pane-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
}

.toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 3px;
}

.select-sm {
  padding: 3px 6px;
  font-size: 11.5px;
  border-radius: 6px;
}

.iframe-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #090e17;
}

#vnc-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

#vnc-frame.resizing {
  pointer-events: none;
}

/* Tabs */
.tabs-bar {
  display: flex;
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 10px;
  gap: 4px;
  flex-shrink: 0;
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 9px 13px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab-panel {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.tab-panel.active {
  display: flex;
}

/* Chat Tab */
.conv-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.conv-select {
  flex: 1;
  min-width: 120px;
}

.conv-history-drawer {
  max-height: 220px;
  overflow-y: auto;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.conv-history-item {
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  cursor: pointer;
}

.conv-history-item.active {
  border-color: var(--accent);
}

.conv-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 500;
}

.conv-item-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.messages-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state {
  margin: auto;
  max-width: 440px;
  text-align: center;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: rgba(21, 30, 46, 0.5);
}

.msg {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg.user {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
}

.msg-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

.msg-role {
  font-weight: 600;
  color: var(--text);
}

.msg-body {
  word-break: break-word;
}

.msg-body pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px;
  overflow-x: auto;
}

.msg-footer {
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid rgba(38, 51, 74, 0.6);
  padding-top: 5px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.live-run-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 7px;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.35);
  font-size: 11.5px;
}

.live-run-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.plan-card,
.steps-trace-box,
.deliverables-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.plan-header,
.deliverables-header {
  font-size: 11.5px;
  font-weight: 600;
  margin-bottom: 6px;
}

.plan-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.plan-item {
  display: flex;
  gap: 7px;
  font-size: 11.5px;
  color: var(--muted);
}

.plan-item.done { color: #6ee7b7; }
.plan-item.in_progress { color: #a5b4fc; font-weight: 600; }
.plan-item.failed { color: #fca5a5; }

.steps-trace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.steps-trace-toggle {
  border: none;
  background: transparent;
  font-weight: 600;
  font-size: 11.5px;
  cursor: pointer;
  padding: 2px 0;
}

.steps-trace-list {
  max-height: 240px;
  overflow-y: auto;
  margin-top: 6px;
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.step-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.step-card summary {
  list-style: none;
  cursor: pointer;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
}

.step-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.step-summary-text {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-detail {
  padding: 8px;
  border-top: 1px solid var(--border);
  font-size: 11px;
}

.step-detail pre {
  margin: 4px 0 0;
  background: var(--panel);
  padding: 6px;
  border-radius: 5px;
  overflow-x: auto;
  max-height: 220px;
}

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

.render-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}

.render-thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  background: #fff;
}

.render-card-foot {
  padding: 6px;
}

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

.deliverables-section {
  margin-top: 8px;
}

.deliverables-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}

.deliverable-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.deliverable-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
}

.deliverable-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.deliverable-path {
  font-family: var(--mono);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deliverable-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.presets-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  overflow-x: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.preset-chip {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
}

.preset-chip:hover {
  border-color: var(--accent);
}

.composer {
  padding: 8px 10px 10px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}

.composer.dragover,
.dropzone.dragover {
  outline: 2px dashed var(--accent);
  outline-offset: -3px;
}

.composer-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
}

.file-chip button {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  padding: 0 2px;
}

.composer-textarea {
  width: 100%;
  resize: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 44px;
  max-height: 180px;
  outline: none;
}

.composer-textarea:focus {
  border-color: var(--accent);
}

.composer-controls,
.composer-controls-left,
.composer-controls-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.composer-controls {
  justify-content: space-between;
}

/* Files Tab */
.files-toolbar {
  padding: 9px 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.files-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.quota-bar-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}

.quota-bar-top {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  margin-bottom: 4px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  transition: width 0.25s;
}

.progress-fill.warn {
  background: linear-gradient(90deg, var(--amber), var(--red));
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.breadcrumbs button {
  border: none;
  background: var(--card);
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 11.5px;
  cursor: pointer;
}

.recent-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.dropzone {
  margin: 8px 12px;
  padding: 10px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
  flex-shrink: 0;
}

.progress-wrap {
  margin: 0 12px 8px;
  font-size: 11.5px;
  flex-shrink: 0;
}

.files-list-wrap,
.scroll-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 12px 14px;
}

.scroll-panel {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.files-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.files-table th,
.files-table td,
.data-table th,
.data-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.files-table th,
.data-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  position: sticky;
  top: 0;
  background: var(--bg);
}

.file-name-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dir-link {
  border: none;
  background: transparent;
  color: #93c5fd;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}

/* Account & Admin Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
}

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.kpi-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.kpi-value {
  font-size: 18px;
  font-weight: 700;
}

.kpi-sub {
  font-size: 11px;
  color: var(--muted);
}

.section-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 13.5px;
  font-weight: 650;
  margin: 0;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.plan-tile {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-tile.current {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 9, 16, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card.modal-lg {
  max-width: 860px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.modal-body {
  padding: 14px;
  overflow-y: auto;
  flex: 1;
}

.preview-img {
  max-width: 100%;
  max-height: 70vh;
  display: block;
  margin: 0 auto;
  background: #fff;
  border-radius: 6px;
}

.preview-frame {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.preview-code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  overflow: auto;
  max-height: 68vh;
  margin: 0;
}

.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--green);
  padding: 9px 13px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.toast.err {
  border-left-color: var(--red);
  color: #fecaca;
}

@media (max-width: 960px) {
  .form-grid-3,
  .form-grid-2 {
    grid-template-columns: 1fr;
  }

  .workspace-split.layout-split {
    flex-direction: column;
  }

  .workspace-split.layout-split .pane-left {
    width: 100% !important;
    height: 42%;
    min-height: 220px;
    border-bottom: 1px solid var(--border);
  }

  .workspace-split.layout-split .pane-right {
    width: 100% !important;
    min-width: 0;
    height: 58%;
  }

  .workspace-split.layout-split .splitter {
    display: none;
  }
}
