/* ================================================================
   Image → HTML Studio · Workbench
   Warm-neutral SaaS tool, scoped to #app
================================================================ */

:root{
  --bg:        #FBFAF7;
  --panel:     #FFFFFF;
  --panel-2:   #F6F4EF;
  --ink:       #16181D;
  --ink-2:     #2A2D34;
  --muted:     #6B7079;
  --muted-2:   #A0A4AB;
  --hair:      rgba(20,22,28,0.08);
  --hair-2:    rgba(20,22,28,0.14);
  --accent:    oklch(0.68 0.15 38);
  --accent-2:  oklch(0.62 0.16 38);
  --accent-bg: oklch(0.96 0.025 50);
  --success:   oklch(0.62 0.13 150);
  --warning:   oklch(0.72 0.14 75);
  --danger:    oklch(0.58 0.18 25);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --shadow-sm: 0 1px 2px rgba(20,22,28,0.04);
  --shadow-md: 0 2px 8px rgba(20,22,28,0.05), 0 1px 2px rgba(20,22,28,0.04);
  --shadow-pop: 0 12px 40px -8px rgba(20,22,28,0.18), 0 4px 12px rgba(20,22,28,0.06);
  --shadow-focus: 0 0 0 4px oklch(0.68 0.15 38 / 0.18);

  --ease-out: cubic-bezier(.22,.61,.36,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);

  font-feature-settings: "ss01","cv11";
}

*,*::before,*::after { box-sizing: border-box; }
html,body { margin:0; padding:0; height:100%; }

body{
  background: var(--bg);
  color: var(--ink);
  font-family: "Geist", ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* ----------------------------- App shell ----------------------------- */

#app{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar{
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(251,250,247,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hair);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 14.5px;
}

.brand-mark{
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background:
    radial-gradient(110% 110% at 0% 0%, oklch(0.78 0.12 55) 0%, oklch(0.62 0.16 38) 65%, oklch(0.45 0.13 30) 100%);
  position: relative;
  overflow: hidden;
}
.brand-mark::after{
  content:"";
  position: absolute; inset: 4px;
  border: 1.5px solid rgba(255,255,255,0.85);
  border-radius: 3px;
  border-right-color: transparent;
  border-bottom-color: transparent;
}
.brand-sub{
  color: var(--muted);
  font-weight: 400;
  font-size: 12.5px;
  margin-left: 4px;
}

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

.project-menu{
  position: relative;
}

.project-dropdown{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(340px, calc(100vw - 24px));
  max-height: min(460px, calc(100vh - 76px));
  overflow: hidden;
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.98);
  box-shadow: var(--shadow-lg);
  z-index: 60;
}

.project-dropdown-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 8px 12px;
  border-bottom: 1px solid var(--hair);
  color: var(--muted);
  font: 600 12px/1 "Geist", sans-serif;
}

.project-dropdown-head .btn{
  height: 26px;
  padding: 0 9px;
  font-size: 12px;
}

.project-options{
  max-height: 390px;
  overflow-y: auto;
  padding: 6px;
}

.project-option{
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.project-option:hover{
  background: var(--panel);
  border-color: var(--hair);
}

.project-title{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 600 13px/1.25 "Geist", sans-serif;
}

.project-meta,
.project-empty{
  color: var(--muted);
  font: 500 11.5px/1.3 "Geist Mono", ui-monospace, monospace;
}

.project-empty{
  padding: 18px 14px;
  text-align: center;
}

.kbd{
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--panel-2);
  border: 1px solid var(--hair);
  font: 500 11px/1 "Geist Mono", ui-monospace, monospace;
  color: var(--muted);
}

.account-chip{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--hair);
  cursor: pointer;
  transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.account-chip:hover{ border-color: var(--hair-2); background: var(--panel-2); }
.account-chip .av{
  width: 22px; height: 22px; border-radius: 999px;
  background: linear-gradient(135deg, oklch(0.78 0.08 60), oklch(0.62 0.13 38));
  color: white; display: grid; place-items: center;
  font: 600 10px/1 "Geist", sans-serif;
}
.account-chip .credits{
  font: 500 12.5px/1 "Geist Mono", monospace;
  color: var(--ink);
}
.account-chip .credits b{ color: var(--accent-2); font-weight: 600; }

/* ----------------------------- Layout ----------------------------- */

.workspace{
  flex: 1;
  display: grid;
  grid-template-columns: minmax(360px, 420px) 1fr;
  gap: 0;
  overflow: hidden;
}

.col-left{
  border-right: 1px solid var(--hair);
  padding: 24px 24px 64px;
  overflow-y: auto;
  background: var(--bg);
}

.col-right{
  padding: 24px 28px 64px;
  overflow-y: auto;
  background:
    radial-gradient(900px 600px at 100% 0%, oklch(0.95 0.025 50 / 0.5), transparent 60%),
    var(--bg);
}

@media (max-width: 900px){
  .workspace{ grid-template-columns: 1fr; }
  .col-left{ border-right: none; border-bottom: 1px solid var(--hair); }
}

/* ----------------------------- Section labels ----------------------------- */

.label-row{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.label{
  font: 500 11px/1 "Geist Mono", monospace;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.label .num{
  display: inline-block;
  width: 18px; height: 18px;
  margin-right: 6px;
  background: var(--ink);
  color: white;
  border-radius: 4px;
  text-align: center;
  font: 600 10px/18px "Geist Mono", monospace;
  letter-spacing: 0;
  vertical-align: -3px;
}
.label-aside{
  font: 400 11px/1 "Geist Mono", monospace;
  color: var(--muted-2);
}

.section{ margin-bottom: 22px; }
.section-title{
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
}
.section-desc{
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 18px;
}

/* ----------------------------- Drop zones ----------------------------- */

.drop{
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px dashed var(--hair-2);
  border-radius: var(--r-md);
  background: var(--panel);
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out), transform .2s var(--ease-out);
  overflow: hidden;
  cursor: pointer;
}
.drop:hover{
  border-color: var(--accent);
  background: var(--panel);
}
.drop.is-drag{
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-bg);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.drop-preview{
  width: 76px;
  min-height: 76px;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(45deg, var(--panel-2) 0 6px, var(--panel) 6px 12px);
  border-right: 1px dashed var(--hair-2);
  flex: 0 0 auto;
}
.drop.is-tall .drop-preview{
  width: 100px;
  min-height: 130px;
}
.drop-preview img{
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 8px;
}

.drop-body{
  flex: 1;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}
.drop-title{
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}
.drop-hint{
  font: 400 12px/1.4 "Geist Mono", monospace;
  color: var(--muted);
}
.drop-meta{
  display: flex;
  gap: 8px;
  align-items: center;
  font: 500 11px/1 "Geist Mono", monospace;
  color: var(--success);
}
.drop-meta .dot{
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 3px oklch(0.62 0.13 150 / 0.18);
  animation: ping 2s var(--ease-out) infinite;
}
@keyframes ping{
  0%{ box-shadow: 0 0 0 0 oklch(0.62 0.13 150 / 0.4); }
  70%{ box-shadow: 0 0 0 6px oklch(0.62 0.13 150 / 0); }
  100%{ box-shadow: 0 0 0 0 oklch(0.62 0.13 150 / 0); }
}

.drop-clear{
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  border: none; background: var(--ink);
  color: white; border-radius: 999px;
  cursor: pointer;
  display: grid; place-items: center;
  opacity: 0; transform: scale(0.8);
  transition: opacity .15s var(--ease-out), transform .15s var(--ease-spring);
}
.drop:hover .drop-clear,
.drop.has-file .drop-clear{ opacity: 1; transform: scale(1); }
.drop-clear:hover{ background: var(--danger); }
.drop-clear svg{ width: 10px; height: 10px; }

/* ----------------------------- Form inputs ----------------------------- */

.input, .textarea, .select{
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  padding: 11px 12px;
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out), background .15s var(--ease-out);
}
.input:hover, .textarea:hover, .select:hover{ border-color: var(--hair-2); }
.input:focus, .textarea:focus, .select:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}
.textarea{
  resize: vertical;
  min-height: 96px;
  font-size: 13.5px;
  line-height: 1.55;
  font-family: "Geist", sans-serif;
}
.textarea::placeholder, .input::placeholder{ color: var(--muted-2); }

.field-pair{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.select-wrap{ position: relative; }
.select-wrap::after{
  content:"";
  position: absolute;
  right: 14px; top: 50%;
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select{
  appearance: none;
  padding-right: 32px;
  cursor: pointer;
}

.field-label{
  display: block;
  font: 500 11px/1 "Geist Mono", monospace;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ----------------------------- Buttons ----------------------------- */

.btn{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .08s var(--ease-out), background .15s var(--ease-out), border-color .15s var(--ease-out), box-shadow .15s var(--ease-out), color .15s var(--ease-out);
  user-select: none;
}
.btn:active:not(:disabled){ transform: translateY(1px) scale(0.99); }
.btn:disabled{ opacity: 0.5; cursor: not-allowed; }

.btn-primary{
  background: var(--ink);
  color: white;
  border-color: var(--ink);
  box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, var(--shadow-sm);
}
.btn-primary:hover:not(:disabled){
  background: #000;
  box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, var(--shadow-md);
}

.btn-accent{
  background: var(--accent);
  color: white;
  border-color: var(--accent-2);
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, var(--shadow-sm);
}
.btn-accent:hover:not(:disabled){
  background: var(--accent-2);
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 4px 12px oklch(0.62 0.16 38 / 0.25);
}

.btn-ghost{
  background: transparent;
  color: var(--ink);
  border-color: var(--hair);
}
.btn-ghost:hover:not(:disabled){
  background: var(--panel);
  border-color: var(--hair-2);
}

.btn-icon{
  width: 32px; height: 32px;
  padding: 0;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--hair);
  color: var(--muted);
}
.btn-icon:hover{ background: var(--panel); color: var(--ink); border-color: var(--hair-2); }
.btn-icon svg{ width: 14px; height: 14px; }

.btn .arrow{
  width: 12px; height: 12px;
  transition: transform .2s var(--ease-out);
}
.btn-accent:hover .arrow{ transform: translateX(2px); }

/* ----------------------------- Action row ----------------------------- */

.action-row{
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.action-row .btn{ flex: 1; }

/* ----------------------------- Total progress ----------------------------- */

.total-prog{
  margin-top: 18px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
}
.total-prog-head{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.total-prog-title{
  font-size: 12.5px;
  font-weight: 500;
}
.total-prog-num{
  font: 500 12.5px/1 "Geist Mono", monospace;
  color: var(--muted);
}
.total-prog-num b{ color: var(--ink); font-weight: 600; }

.bar{
  position: relative;
  height: 6px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill{
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--accent), oklch(0.72 0.14 55));
  border-radius: 999px;
  transition: width .5s var(--ease-out);
}
.bar-fill.bar-running::after{
  content:"";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.5) 50%, transparent 100%);
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer{
  from{ transform: translateX(-100%); }
  to{ transform: translateX(100%); }
}

/* ----------------------------- Right column ----------------------------- */

.right-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.right-head-l{
  display: flex; align-items: baseline; gap: 10px;
}
.right-head h2{
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.tag-count{
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font: 500 11px/1 "Geist Mono", monospace;
}

.right-head-r{
  display: flex; align-items: center; gap: 8px;
}

.view-toggle{
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: var(--r-sm);
  padding: 2px;
}
.view-toggle button{
  border: none;
  background: transparent;
  padding: 4px 10px;
  font: 500 12px/1 "Geist", sans-serif;
  color: var(--muted);
  border-radius: 5px;
  cursor: pointer;
  height: 26px;
  transition: background .15s var(--ease-out), color .15s var(--ease-out);
}
.view-toggle button.active{
  background: var(--ink);
  color: white;
}

/* ----------------------------- Empty state ----------------------------- */

.empty{
  margin-top: 60px;
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  border: 1px dashed var(--hair-2);
  border-radius: var(--r-lg);
  background: var(--panel);
}
.empty-art{
  width: 92px; height: 92px;
  margin: 0 auto 16px;
  border-radius: var(--r-lg);
  background:
    repeating-linear-gradient(45deg, var(--panel-2) 0 8px, transparent 8px 16px),
    var(--panel);
  border: 1px solid var(--hair);
  display: grid; place-items: center;
  position: relative;
  overflow: hidden;
}
.empty-art::after{
  content:"";
  position: absolute;
  inset: -50% -50%;
  background: linear-gradient(45deg, transparent 40%, oklch(0.95 0.03 50 / 0.7) 50%, transparent 60%);
  animation: sweep 3s linear infinite;
}
@keyframes sweep{
  0%{ transform: translateX(-30%) translateY(-30%); }
  100%{ transform: translateX(30%) translateY(30%); }
}
.empty h3{
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}
.empty p{
  margin: 0;
  font-size: 13px;
}

/* ----------------------------- Step cards ----------------------------- */

.step-list{
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.step-card{
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color .2s var(--ease-out), box-shadow .25s var(--ease-out), transform .2s var(--ease-out);
  animation: card-in .42s var(--ease-out) both;
}
.step-card:hover{
  border-color: var(--hair-2);
  box-shadow: var(--shadow-md);
}
.step-card.is-open{
  border-color: var(--hair-2);
  box-shadow: var(--shadow-pop);
}
.step-card.is-generating{
  border-color: var(--accent);
}
.step-card.is-done{
  border-color: oklch(0.62 0.13 150 / 0.3);
}

@keyframes card-in{
  from{ opacity: 0; transform: translateY(8px); }
  to{ opacity: 1; transform: translateY(0); }
}

.step-head{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}
.step-num{
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
  display: grid; place-items: center;
  font: 600 12px/1 "Geist Mono", monospace;
  border: 1px solid var(--hair);
  transition: all .2s var(--ease-out);
}
.step-card.is-generating .step-num{
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.step-card.is-done .step-num{
  background: oklch(0.62 0.13 150);
  color: white;
  border-color: oklch(0.62 0.13 150);
}

.step-info{ flex: 1; min-width: 0; }
.step-title-line{
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.step-title-line .title{
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.step-type-tag{
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--panel-2);
  font: 500 10.5px/1 "Geist Mono", monospace;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}
.step-reason{
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-status{
  display: flex; align-items: center; gap: 8px;
  flex: 0 0 auto;
}
.status-pill{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--panel-2);
  font: 500 11.5px/1 "Geist Mono", monospace;
  color: var(--muted);
  border: 1px solid var(--hair);
  white-space: nowrap;
}
.status-pill.generating{
  background: oklch(0.96 0.025 50);
  color: var(--accent-2);
  border-color: oklch(0.72 0.14 55 / 0.3);
}
.status-pill.done{
  background: oklch(0.96 0.04 145);
  color: oklch(0.42 0.1 150);
  border-color: oklch(0.62 0.13 150 / 0.2);
}
.status-pill .lil{ width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.status-pill.generating .lil{ animation: pulse 1s var(--ease-out) infinite alternate; }
@keyframes pulse{
  from{ opacity: 0.3; transform: scale(0.8); }
  to{ opacity: 1; transform: scale(1.1); }
}

.chev{
  width: 24px; height: 24px;
  display: grid; place-items: center;
  color: var(--muted-2);
  transition: transform .25s var(--ease-out);
}
.step-card.is-open .chev{ transform: rotate(180deg); color: var(--ink); }
.chev svg{ width: 12px; height: 12px; }

.step-body{
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .35s var(--ease-out);
}
.step-card.is-open .step-body{ grid-template-rows: 1fr; }
.step-body > .inner{
  overflow: hidden;
  border-top: 1px solid var(--hair);
}
.step-body-pad{
  padding: 16px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}
@media (max-width: 1100px){
  .step-body-pad{ grid-template-columns: 1fr; }
}

.edit-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.edit-grid .full{ grid-column: 1 / -1; }

/* fields editor */

.fields-block{
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  background: var(--panel);
  overflow: hidden;
}
.fields-head{
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 8px 12px;
  border-bottom: 1px solid var(--hair);
  background: var(--panel-2);
}
.fields-head .lbl{
  font: 500 11px/1 "Geist Mono", monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.fields-list{
  list-style: none;
  padding: 8px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-row{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px;
  border-radius: 7px;
  transition: background .15s var(--ease-out);
  animation: field-in .25s var(--ease-out) both;
}
.field-row:hover{ background: var(--panel-2); }
@keyframes field-in{
  from{ opacity: 0; transform: translateX(-4px); }
  to{ opacity: 1; transform: translateX(0); }
}
.field-handle{
  flex: 0 0 auto;
  color: var(--muted-2);
  font: 600 11px/1 "Geist Mono", monospace;
  width: 22px;
  text-align: center;
}
.field-input{
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 8px;
  font: 500 12.5px/1 "Geist Mono", monospace;
  color: var(--ink);
  border-radius: 5px;
}
.field-input:focus{ outline: none; background: var(--panel); box-shadow: inset 0 0 0 1px var(--accent); }
.field-del{
  width: 22px; height: 22px;
  border: none; background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  border-radius: 5px;
  display: grid; place-items: center;
  opacity: 0;
  transition: opacity .15s var(--ease-out), background .15s var(--ease-out), color .15s var(--ease-out);
}
.field-row:hover .field-del{ opacity: 1; }
.field-del:hover{ background: oklch(0.95 0.05 25); color: var(--danger); }
.field-del svg{ width: 10px; height: 10px; }

.field-add{
  margin: 0 8px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px dashed var(--hair-2);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: 500 12px/1 "Geist", sans-serif;
  cursor: pointer;
  transition: all .15s var(--ease-out);
  width: calc(100% - 16px);
  justify-content: center;
}
.field-add:hover{
  border-color: var(--accent);
  color: var(--accent-2);
  background: var(--accent-bg);
}
.field-add svg{
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
}
.local-text-panel{
  max-height: 260px;
  display: flex;
  flex-direction: column;
}
.local-text-panel .fields-list{
  overflow-y: auto;
  max-height: 218px;
  overscroll-behavior: contain;
}
.local-text-panel .field-row{
  align-items: center;
}
.local-text-panel input[type="color"]{
  flex: 0 0 28px;
  width: 28px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--hair);
  border-radius: 5px;
  background: transparent;
}

/* preview pane */

.preview-block{
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.preview-head{
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.preview-device-control{
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.preview-device-control .select-wrap{
  min-width: 154px;
}
.preview-device-control .select{
  height: 28px;
  font-size: 12px;
  padding-right: 28px;
}
.preview-device-control span{
  white-space: nowrap;
  font: 400 11px/1 "Geist Mono", monospace;
  color: var(--muted-2);
}
.preview-frame{
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  min-height: 560px;
  position: relative;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 20px;
  overscroll-behavior: contain;
}
.device-frame{
  flex: 0 0 auto;
  position: relative;
  margin: 0 auto;
  background: white;
  border: none;
  box-shadow: none;
}
.device-screen{
  width: 100%;
  height: 100%;
  overflow: auto;
  background: white;
  position: relative;
}
.device-screen iframe{
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}
.preview-placeholder{
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 24px;
}
.preview-placeholder code{
  font: 500 11px/1.4 "Geist Mono", monospace;
  color: var(--muted-2);
  display: block;
  margin-top: 6px;
}

/* step-level progress */

.step-progress{
  height: 3px;
  background: var(--panel-2);
  position: relative;
  overflow: hidden;
}
.step-progress .bar-fill{
  background: var(--accent);
}

/* step action row inside card */

.step-actions{
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.step-actions .grow{ flex: 1; }

/* ----------------------------- Modal ----------------------------- */

.modal-bg{
  position: fixed; inset: 0;
  background: rgba(20,22,28,0.45);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 100;
  animation: bg-in .2s var(--ease-out);
}
@keyframes bg-in{ from{ opacity: 0; } to{ opacity: 1; } }
.modal{
  width: min(420px, 92vw);
  background: var(--panel);
  border-radius: var(--r-xl);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-pop);
  padding: 26px;
  animation: modal-in .35s var(--ease-spring);
}
@keyframes modal-in{
  from{ opacity: 0; transform: translateY(10px) scale(0.97); }
  to{ opacity: 1; transform: translateY(0) scale(1); }
}
.modal h3{
  margin: 0 0 4px;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.modal p{
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}
.modal-tabs{
  display: inline-flex;
  background: var(--panel-2);
  border-radius: var(--r-sm);
  padding: 3px;
  margin-bottom: 18px;
}
.modal-tabs button{
  border: none; background: transparent;
  padding: 6px 14px;
  font: 500 12.5px/1 "Geist", sans-serif;
  color: var(--muted);
  border-radius: 5px;
  cursor: pointer;
  transition: background .15s var(--ease-out), color .15s var(--ease-out);
}
.modal-tabs button.active{
  background: white;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.modal-form{ display: flex; flex-direction: column; gap: 10px; }
.modal-footer{
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-footer .meta{
  font: 400 11.5px/1.4 "Geist Mono", monospace;
  color: var(--muted-2);
}

/* ----------------------------- Toast ----------------------------- */

.toast-wrap{
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column-reverse;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: white;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-pop);
  animation: toast-in .3s var(--ease-spring);
}
.toast.success .dot{ background: oklch(0.78 0.13 150); }
.toast.error .dot{ background: oklch(0.7 0.16 25); }
.toast .dot{
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--accent);
}
@keyframes toast-in{
  from{ opacity: 0; transform: translate(-50%, 12px) scale(0.95); }
  to{ opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* ----------------------------- Help / Guide modal ----------------------------- */

.help-btn .help-q{
  display: inline-grid;
  place-items: center;
  width: 16px; height: 16px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font: 600 10px/1 "Geist Mono", monospace;
}

.help-modal{
  width: min(520px, 94vw);
  padding: 22px 24px 20px;
}
.help-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.help-head h3{ margin-bottom: 2px; }

.guide-list{
  list-style: none;
  padding: 0;
  margin: 0 0 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.guide-item{
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 10px;
  border-radius: var(--r-md);
  transition: background .15s var(--ease-out);
  animation: guide-in .45s var(--ease-out) both;
}
.guide-item:hover{
  background: var(--panel-2);
}
@keyframes guide-in{
  from{ opacity: 0; transform: translateX(-6px); }
  to{ opacity: 1; transform: translateX(0); }
}

.guide-num{
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  display: grid; place-items: center;
  font: 600 11px/1 "Geist Mono", monospace;
  margin-top: 2px;
  position: relative;
  overflow: hidden;
}
.guide-num::after{
  content:"";
  position: absolute;
  inset: -50% -50%;
  background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.18) 50%, transparent 60%);
  animation: sweep 3s linear infinite;
}

.guide-body{ flex: 1; min-width: 0; }
.guide-title{
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin-bottom: 2px;
}
.guide-desc{
  font-size: 12.8px;
  line-height: 1.55;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.guide-tip{
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent-2);
  font: 500 11px/1 "Geist Mono", monospace;
  letter-spacing: 0.02em;
}

.help-foot{
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hair);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.help-foot .meta{ flex: 1; }

/* ----------------------------- Misc ----------------------------- */

.row{ display: flex; align-items: center; gap: 8px; }
.spacer{ flex: 1; }
.hide-scrollbar::-webkit-scrollbar{ display: none; }

/* App initial mount stagger */
.stagger-1{ animation: stagger .5s .04s var(--ease-out) both; }
.stagger-2{ animation: stagger .5s .12s var(--ease-out) both; }
.stagger-3{ animation: stagger .5s .2s var(--ease-out) both; }
.stagger-4{ animation: stagger .5s .28s var(--ease-out) both; }
.stagger-5{ animation: stagger .5s .36s var(--ease-out) both; }
.stagger-6{ animation: stagger .5s .44s var(--ease-out) both; }
@keyframes stagger{
  from{ opacity: 0; transform: translateY(6px); }
  to{ opacity: 1; transform: translateY(0); }
}
