/* ═══════════════════════════════════════════════════════════════════
   TAMATO BUILD — WEBSITE BUILDER
═══════════════════════════════════════════════════════════════════ */
html, body { height: 100%; overflow: hidden; }
.bd-app { display: flex; flex-direction: column; height: 100vh; background: var(--tm-bg); }

/* ── Top bar — borderless, floating ─────────────────────────────── */
.bd-top {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--tm-bg);
  flex-shrink: 0;
  height: 52px;
}

.bd-sitename {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-input);
  padding: 4px var(--sp-2);
  font-weight: 700;
  font-size: 14px;
  max-width: 200px;
  letter-spacing: -0.01em;
  transition: border-color var(--t-micro), background var(--t-micro);
}
.bd-sitename:hover { border-color: var(--tm-border); background: var(--tm-surface); }
.bd-sitename:focus { outline: none; border-color: var(--tm-border); background: var(--tm-surface); box-shadow: 0 0 0 2px var(--tm-accent-glow); }

.bd-viewtoggle {
  display: flex;
  background: var(--tm-surface);
  border: 1px solid var(--tm-border);
  border-radius: var(--r-input);
  padding: 2px;
  gap: 2px;
}
.bd-viewtoggle button {
  padding: 4px 14px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
  color: var(--tm-text-3);
  transition: background var(--t-micro), color var(--t-micro);
}
.bd-viewtoggle button.active {
  background: var(--tm-surface-2);
  color: var(--tm-text);
}
.bd-viewtoggle button:hover:not(.active) { color: var(--tm-text-2); }

.bd-save {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--tm-text-3);
  letter-spacing: 0.01em;
}

/* ── Canvas ──────────────────────────────────────────────────────── */
.bd-canvas-wrap { flex: 1; position: relative; background: var(--tm-bg); overflow: hidden; }

.bd-canvas {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  display: block;
}
.bd-canvas.mobile {
  width: 390px;
  margin: var(--sp-4) auto 0;
  height: calc(100% - var(--sp-4));
  border: 1px solid var(--tm-border);
  border-radius: var(--r-card);
}

.bd-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--tm-text-3);
  gap: var(--sp-4);
  text-align: center;
  padding: var(--sp-8);
}
.bd-empty p {
  font-size: 15px;
  color: var(--tm-text-3);
  max-width: 380px;
  line-height: 1.6;
}

/* ── Split generation panel ──────────────────────────────────────── */
.bd-split {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--tm-border);
}
.bd-split-pane {
  background: var(--tm-bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.bd-split-pane iframe { flex: 1; border: none; background: #fff; }

.bd-stream {
  background: #1C1917;
  color: #6B6460;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  padding: var(--sp-6);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
  border-left: 2px solid #B85C52;
}
.bd-stream .tag   { color: #B85C52; }
.bd-stream .attr  { color: #C87E74; }
.bd-stream .str   { color: #8BAF6E; }

.bd-gen-controls {
  position: absolute;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--sp-2);
  background: var(--tm-surface);
  border: 1px solid var(--tm-border);
  border-radius: var(--r-card);
  padding: var(--sp-2);
  z-index: 5;
}

.bd-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(28,25,23,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
}

/* ── Chat thread ─────────────────────────────────────────────────── */
.bd-chat {
  max-height: 36vh;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-6);
  display: none;
  flex-direction: column;
  gap: var(--sp-3);
  border-top: 1px solid var(--tm-border);
  background: var(--tm-bg);
}
.bd-chat.show { display: flex; }

.bd-chat-msg {
  max-width: 76%;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-card);
  font-size: 14px;
  line-height: 1.55;
}
.bd-chat-msg.user { align-self: flex-end; background: var(--tm-surface); border: 1px solid var(--tm-border); }
.bd-chat-msg.ai   { align-self: flex-start; color: var(--tm-text-2); }

/* ── Prompt bar ──────────────────────────────────────────────────── */
.bd-promptbar {
  border-top: 1px solid var(--tm-border);
  background: var(--tm-bg);
  padding: var(--sp-4) var(--sp-6);
  flex-shrink: 0;
}
.bd-prompt-inner {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-3);
  max-width: 1100px;
  margin: 0 auto;
}
.bd-prompt-col { flex: 1; }

.bd-prompt-textarea {
  width: 100%;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  border: 1px solid var(--tm-border);
  border-radius: var(--r-input);
  padding: 11px var(--sp-3);
  background: var(--tm-surface);
  font-size: 14px;
  line-height: 1.5;
  transition: border-color var(--t-micro), box-shadow var(--t-micro);
}
.bd-prompt-textarea::placeholder { color: var(--tm-text-3); }
.bd-prompt-textarea:focus {
  outline: none;
  border-color: var(--tm-accent-dim);
  box-shadow: 0 0 0 3px var(--tm-accent-glow);
  caret-color: var(--tm-accent);
}

/* ── Model selector ──────────────────────────────────────────────── */
.bd-model-wrap { position: relative; }

.bd-model-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--tm-text-3);
  border: 1px solid var(--tm-border);
  border-radius: var(--r-input);
  padding: 5px 12px;
  display: flex;
  gap: 6px;
  align-items: center;
  transition: color var(--t-micro), border-color var(--t-micro);
  letter-spacing: 0.02em;
}
.bd-model-btn:hover { color: var(--tm-text-2); border-color: var(--tm-border-2); }

.bd-model-menu {
  position: absolute;
  bottom: 110%;
  left: 0;
  width: 320px;
  background: var(--tm-surface);
  border: 1px solid var(--tm-border);
  border-radius: var(--r-card);
  padding: var(--sp-2);
  display: none;
  z-index: 20;
  animation: tm-up 120ms ease forwards;
}
.bd-model-menu.open { display: block; }

.bd-model-row {
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--r-input);
  cursor: pointer;
  transition: background var(--t-micro);
}
.bd-model-row:hover { background: var(--tm-surface-2); }
.bd-model-row.selected { background: var(--tm-surface-2); }
.bd-model-row.disabled { opacity: 0.38; cursor: not-allowed; }

.bd-model-row .mr-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}
.bd-model-row .mr-cost { color: var(--tm-text-3); font-size: 11px; }
.bd-model-row .mr-desc { font-size: 12px; color: var(--tm-text-2); line-height: 1.4; }

/* ── Dev mode ────────────────────────────────────────────────────── */
.bd-dev {
  position: absolute;
  inset: 0;
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--tm-border);
  z-index: 7;
}
.bd-dev.open { display: grid; }

.dev-tabs {
  display: flex;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  background: var(--tm-surface);
  border-bottom: 1px solid var(--tm-border);
  align-items: center;
}
.dev-tab {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px var(--sp-3);
  border-radius: var(--r-input);
  color: var(--tm-text-3);
  transition: background var(--t-micro), color var(--t-micro);
}
.dev-tab.active { background: var(--tm-surface-2); color: var(--tm-text); }
.dev-tab:hover:not(.active) { color: var(--tm-text-2); }

.bd-dev-side { background: var(--tm-surface); display: flex; flex-direction: column; }
.dev-editor  { flex: 1; overflow: hidden; }
.dev-editor .CodeMirror { height: 100%; font-family: var(--font-mono); font-size: 13px; }

/* ── Melio guided form ───────────────────────────────────────────── */
.melio-form {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: var(--sp-16) var(--sp-8);
  background: var(--tm-bg);
}
.melio-form-card { max-width: 600px; margin: 0 auto; }
.melio-step         { display: none; }
.melio-step.active  { display: block; animation: tm-enter 200ms ease forwards; }

/* ── Hosting help panel ──────────────────────────────────────────── */
.hosting-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 380px;
  max-width: 92vw;
  background: var(--tm-surface);
  border-left: 1px solid var(--tm-border);
  transform: translateX(100%);
  transition: transform var(--t-panel);
  z-index: 200;
  display: flex;
  flex-direction: column;
}
.hosting-panel.open { transform: translateX(0); }

.hp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--tm-border);
}
.hp-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.hp-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.hp-msg {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-card);
  font-size: 14px;
  max-width: 90%;
  white-space: pre-wrap;
  line-height: 1.55;
}
.hp-msg.ai   { background: var(--tm-surface-2); align-self: flex-start; }
.hp-msg.user { background: var(--tm-accent-muted); align-self: flex-end; border: 1px solid var(--tm-accent-dim); }
.hp-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 var(--sp-6) var(--sp-3);
}
.hp-quick .tm-pill { cursor: pointer; transition: border-color var(--t-micro), background var(--t-micro); }
.hp-quick .tm-pill:hover { border-color: var(--tm-accent); background: var(--tm-accent-muted); color: var(--tm-accent); }
.hp-input {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border-top: 1px solid var(--tm-border);
}

/* ── Inline error ────────────────────────────────────────────────── */
.inline-error {
  background: var(--tm-accent-muted);
  border: 1px solid var(--tm-accent-dim);
  border-radius: var(--r-card);
  padding: var(--sp-3) var(--sp-4);
  margin: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  font-size: 14px;
  color: var(--tm-text);
  animation: tm-enter 150ms ease forwards;
}
