:root {
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --surface: #ffffff;
  --text: #171717;
  --text-secondary: #4d4d4d;
  --text-muted: #666666;
  --border-shadow: rgba(0, 0, 0, 0.08) 0 0 0 1px;
  --card-shadow: rgba(0, 0, 0, 0.08) 0 0 0 1px, rgba(0, 0, 0, 0.04) 0 2px 2px, rgba(0, 0, 0, 0.04) 0 8px 8px -8px;
  --accent-bg: #ebf5ff;
  --accent-text: #0068d6;
  --btn-bg: #171717;
  --btn-text: #ffffff;
  --code-bg: #f5f5f5;
  --err-bg: #fff1f2;
  --err-text: #be123c;
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

body.dark {
  --bg: #0a0a0a;
  --bg-subtle: #111111;
  --surface: #141414;
  --text: #ededed;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border-shadow: rgba(255, 255, 255, 0.12) 0 0 0 1px;
  --card-shadow: rgba(255, 255, 255, 0.12) 0 0 0 1px, rgba(0, 0, 0, 0.5) 0 6px 16px;
  --accent-bg: rgba(10, 114, 239, 0.16);
  --accent-text: #60a5fa;
  --btn-bg: #ededed;
  --btn-text: #0a0a0a;
  --code-bg: #1a1a1a;
  --err-bg: rgba(190, 18, 60, 0.15);
  --err-text: #fda4af;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.font-mono { font-family: var(--font-mono); }

.center-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-subtle);
}

.vercel-card {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 26px;
}

.center-card { width: 100%; max-width: 440px; }
.config-card { width: 100%; max-width: 680px; }
.config-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

.brand-row { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; letter-spacing: -0.02em; }
.brand-tri {
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 12px solid var(--text);
  display: inline-block;
}

.heading-md { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.2; }
.muted-text { margin: 0; font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; }
.mono-micro { font-family: var(--font-mono); font-size: 11px; }

.pill-blue {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: 9999px; background: var(--accent-bg); color: var(--accent-text);
  font-size: 11px; font-weight: 500; font-family: var(--font-mono); white-space: nowrap;
}
.pill-mono {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: 9999px; box-shadow: var(--border-shadow); font-size: 11px; color: var(--text-secondary);
}

.stack-form { display: flex; flex-direction: column; gap: 12px; }
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }

.v-input, .v-textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 0;
  box-shadow: var(--border-shadow); border-radius: 6px; font-family: inherit; font-size: 13.5px;
  outline: none; transition: box-shadow 0.15s;
}
.v-input { height: 38px; padding: 0 11px; }
select.v-input {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.v-textarea { padding: 10px 11px; resize: vertical; line-height: 1.45; }
.v-input:focus, .v-textarea:focus { box-shadow: hsla(212, 100%, 48%, 1) 0 0 0 2px; }

.v-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 6px; border: 0; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.v-btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.v-btn.full { width: 100%; }
.v-btn.primary { background: var(--btn-bg); color: var(--btn-text); }
.v-btn.ghost { background: var(--surface); color: var(--text); box-shadow: var(--border-shadow); }
.v-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.err-box { padding: 9px 12px; border-radius: 6px; background: var(--err-bg); color: var(--err-text); font-size: 12.5px; }
.cfg-limits-strip { font-size: 12px; color: var(--text-secondary); padding: 10px 12px; border-radius: 6px; background: var(--bg-subtle); }
.cfg-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* WORKSPACE SHELL */
.studio-shell { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.studio-topbar {
  height: 52px; flex-shrink: 0; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); box-shadow: var(--border-shadow); z-index: 5;
}
.topbar-left, .topbar-meters, .topbar-actions { display: flex; align-items: center; gap: 8px; }
.meter-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 6px;
  background: var(--bg-subtle); box-shadow: var(--border-shadow); font-size: 11px; line-height: 1.2;
}
.meter-lbl { font-weight: 600; color: var(--accent-text); }

.mob-pane-bar { display: none; }
.split-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 420px minmax(0, 1fr); }

.pane-chat {
  display: flex; flex-direction: column; min-height: 0; background: var(--surface);
  border-right: 1px solid rgba(127, 127, 127, 0.14);
}
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg-bubble { flex: 0 0 auto; padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.msg-user { align-self: flex-end; max-width: 88%; background: var(--btn-bg); color: var(--btn-text); }
.msg-ai { align-self: flex-start; max-width: 96%; background: var(--bg-subtle); box-shadow: var(--border-shadow); color: var(--text); }
.trace-card {
  align-self: stretch; padding: 7px 10px; border-radius: 6px; font-family: var(--font-mono); font-size: 11px;
  background: var(--code-bg); color: var(--text-secondary); box-shadow: var(--border-shadow);
}
.trace-ok { color: #059669; }
.trace-err { color: var(--err-text); }

.chat-composer { padding: 10px 12px; border-top: 1px solid rgba(127, 127, 127, 0.14); display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.v-textarea.compact { min-height: 54px; max-height: 140px; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; }

.pane-preview { display: flex; flex-direction: column; min-height: 0; background: var(--bg-subtle); }
.preview-toolbar {
  min-height: 44px; padding: 6px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border-bottom: 1px solid rgba(127, 127, 127, 0.14);
}
.subtab-group, .preview-controls { display: flex; align-items: center; gap: 6px; }
.subtab {
  height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-secondary); font-family: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
}
.subtab.active { background: var(--code-bg); color: var(--text); box-shadow: var(--border-shadow); }
.port-input { width: 70px; height: 30px; padding: 0 8px; font-size: 12px; text-align: center; }

.rtab-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.iframe-stage { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: stretch; padding: 10px; }
.iframe-stage iframe { width: 100%; height: 100%; border: 0; border-radius: 8px; background: #fff; box-shadow: var(--card-shadow); transition: width 0.2s; }
.iframe-stage.mobile-mode iframe { width: 390px; max-width: 100%; }

.files-split { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.file-tree { overflow-y: auto; padding: 10px; background: var(--surface); border-right: 1px solid rgba(127, 127, 127, 0.14); font-size: 12px; display: flex; flex-direction: column; gap: 3px; }
.file-item { padding: 5px 8px; border-radius: 5px; cursor: pointer; color: var(--text-secondary); word-break: break-all; }
.file-item:hover, .file-item.active { background: var(--code-bg); color: var(--text); }
.file-viewer { margin: 0; padding: 14px; overflow: auto; font-size: 12px; line-height: 1.5; background: var(--bg-subtle); color: var(--text); }

.media-grid { padding: 14px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; align-content: start; }
.media-card { background: var(--surface); border-radius: 8px; box-shadow: var(--card-shadow); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.media-card video, .media-card img { width: 100%; border-radius: 6px; background: #000; max-height: 220px; object-fit: contain; }

@media (max-width: 900px) {
  .field-row-2 { grid-template-columns: 1fr; }
  .studio-topbar { height: auto; flex-wrap: wrap; padding: 8px 10px; }
  .brand-txt { display: none; }
  .mob-pane-bar {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px 10px;
    background: var(--surface); border-bottom: 1px solid rgba(127, 127, 127, 0.14);
  }
  .mob-pane-btn {
    height: 32px; border: 0; border-radius: 6px; background: var(--bg-subtle); color: var(--text-secondary);
    font-family: inherit; font-size: 12px; font-weight: 500;
  }
  .mob-pane-btn.active { background: var(--btn-bg); color: var(--btn-text); }
  .split-main { grid-template-columns: 1fr; }
  .pane-chat.mob-hidden, .pane-preview.mob-hidden { display: none; }
  .files-split { grid-template-columns: 1fr; grid-template-rows: 160px 1fr; }
}

/* ---- Model chip + bottom sheet ---- */
.model-chip{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line,#e5e5e5);background:transparent;border-radius:999px;padding:4px 10px;font-size:11px;color:inherit;cursor:pointer;max-width:52%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.model-chip:hover{background:rgba(0,0,0,.04)}
.model-dot{width:6px;height:6px;border-radius:50%;background:#16a34a;flex:0 0 auto}
.model-caret{opacity:.55;font-size:9px}
.sheet-scrim{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:90;display:flex;align-items:flex-end;justify-content:center}
.sheet-card{width:100%;max-width:520px;background:var(--paper,#fff);border-radius:16px 16px 0 0;padding:10px 14px 18px;box-shadow:0 -12px 40px rgba(0,0,0,.18)}
.sheet-grab{width:36px;height:4px;border-radius:99px;background:rgba(0,0,0,.18);margin:0 auto 12px}
.sheet-title{font-size:12px;letter-spacing:.08em;text-transform:uppercase;opacity:.55;margin-bottom:8px}
.sheet-list{display:flex;flex-direction:column;gap:2px}
.sheet-item{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;text-align:left;background:transparent;border:0;border-radius:10px;padding:10px 8px;cursor:pointer;color:inherit}
.sheet-item:hover{background:rgba(0,0,0,.04)}
.sheet-item.active{background:rgba(0,0,0,.06)}
.si-main{display:flex;flex-direction:column;gap:2px;min-width:0}
.si-name{font-size:13px}
.si-desc{font-size:11px;opacity:.6}
.si-check{font-size:13px;opacity:.8}
.sheet-note{font-size:10px;opacity:.55;margin-top:10px;line-height:1.5}

/* ---- Ringkasan langkah ---- */
.steps-group{flex:0 0 auto;flex-shrink:0;align-self:stretch;border:1px solid var(--line,#e8e8e8);border-radius:10px;background:rgba(0,0,0,.02);margin:2px 0 8px;overflow:hidden}
.steps-head{display:flex;align-items:center;gap:8px;width:100%;background:transparent;border:0;padding:8px 10px;font-size:11px;color:inherit;cursor:pointer;text-align:left}
.steps-ico{font-size:9px;opacity:.6;width:10px}
.steps-label{font-weight:500;letter-spacing:.01em}
.steps-body{display:none;padding:0 10px 8px;border-top:1px solid var(--line,#eee)}
.steps-group.open .steps-body{display:block}
.step-row{display:flex;align-items:baseline;gap:6px;padding:5px 0;font-size:11px;flex-wrap:wrap}
.step-name{font-size:10px;padding:1px 5px;border-radius:4px;background:rgba(0,0,0,.06)}
.step-arg{flex:1 1 120px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:.7}
.step-state{font-size:9px;letter-spacing:.05em;text-transform:uppercase;padding:1px 5px;border-radius:3px}
.step-state.running{background:rgba(37,99,235,.12);color:#1d4ed8}
.step-state.ok{background:rgba(22,163,74,.14);color:#15803d}
.step-state.fail{background:rgba(220,38,38,.14);color:#b91c1c}
.step-preview{flex:1 1 100%;font-size:10px;opacity:.6;padding:2px 0 0}

/* ---- Galeri preset ---- */
.preset-gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:8px;margin-top:2px}
.preset-card{display:flex;flex-direction:column;gap:6px;padding:6px;border:1px solid var(--line,#e6e6e6);border-radius:9px;background:transparent;cursor:pointer;text-align:left;color:inherit}
.preset-card:hover{border-color:rgba(0,0,0,.25)}
.preset-card.active{border-color:#111;box-shadow:0 0 0 1px #111 inset}
.pc-swatch{display:block;height:34px;border-radius:5px;background:#f2f2f2}
.pc-vercel{background:linear-gradient(135deg,#fff 0 50%,#111 50% 100%)}
.pc-linear{background:linear-gradient(135deg,#0b0b0f,#2b2b35)}
.pc-editorial{background:linear-gradient(135deg,#f7f3ea,#c9bfa6)}
.pc-neo{background:linear-gradient(135deg,#ffe14d,#111)}
.pc-name{font-size:10px;line-height:1.3;opacity:.8}
@media (max-width:520px){.preset-gallery{grid-template-columns:repeat(2,1fr)}}

.md-pre{margin:6px 0;padding:8px 10px;border-radius:6px;background:rgba(0,0,0,.05);font-family:"IBM Plex Mono",monospace;font-size:11px;line-height:1.5;overflow-x:auto;white-space:pre}
.md-code{font-family:"IBM Plex Mono",monospace;font-size:11px;padding:1px 4px;border-radius:3px;background:rgba(0,0,0,.06)}
.md-h{font-weight:600;margin-top:6px}
