/* Karst tokens, mirrored from the Figma file (Karst · Color / Spacing & Shape) */
:root {
  --surface-base: #ffffff;
  --surface-raised: #f4f4f2;
  --surface-accent: #dee23f;
  --surface-inverse: #000000;
  --surface-placeholder: #ededeb;
  --text-primary: #111111;
  --text-secondary: #5e5e5e;
  --text-muted: #a3a3a3;
  --text-inverse: #ffffff;
  --border-subtle: #e6e6e4;
  --border-strong: #111111;
  --accent-pop: #ee2c7b;
  --citron-ink: #3d3e12;
  --space-2xs: 4px; --space-xs: 8px; --space-sm: 12px; --space-md: 16px; --space-lg: 20px;
  --space-xl: 24px; --space-2xl: 32px; --space-3xl: 40px;
  --radius-sm: 12px; --radius-md: 20px; --radius-full: 999px;
  --tap-sm: 44px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 96px; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45;
  color: var(--text-primary); background: var(--surface-raised);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-md) var(--space-2xl); background: var(--surface-base); border-bottom: 1px solid var(--border-subtle);
}
.brandmark { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brandmark .mark { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-accent); }
.brandmark b { font-size: 18px; }
.brandmark span { color: var(--text-secondary); font-weight: 500; }
.topbar .spacer { flex: 1; }
.save-status { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.save-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--surface-accent); }
.save-status.saving::before { background: var(--text-muted); }
.save-status.error::before { background: var(--accent-pop); }
.user-chip { font-size: 13px; color: var(--text-secondary); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap-sm);
  padding: var(--space-sm) var(--space-xl); border-radius: var(--radius-full); border: 1.5px solid transparent;
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .12s ease, background-color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: #000; color: #fff; }
.btn-accent { background: var(--surface-accent); color: #000; }
.btn-secondary { background: var(--surface-base); border-color: var(--border-strong); }
.btn-ghost { background: none; padding-inline: var(--space-sm); color: var(--text-secondary); }
.btn-sm { min-height: 36px; padding: 6px var(--space-md); font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.linkbtn { background: none; border: 0; padding: 0; font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---- Tags ---- */
.tag {
  display: inline-flex; align-items: center; padding: var(--space-2xs) var(--space-xs); border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-placeholder);
}
.tag.accent { background: var(--surface-accent); }
.tag.pop { background: var(--accent-pop); color: #fff; }

/* ---- Layout ---- */
.layout {
  display: grid; grid-template-columns: 260px minmax(0, 1fr) 360px; gap: var(--space-2xl);
  padding: var(--space-2xl); max-width: 1440px; margin: 0 auto; align-items: start;
}
.sidebar, .preview-col { position: sticky; top: 104px; display: flex; flex-direction: column; gap: var(--space-xl); }
.main { display: flex; flex-direction: column; gap: var(--space-xl); min-width: 0; }

.shop-title { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.shop-title h1 { font-size: 20px; font-weight: 600; line-height: 1.25; }
.shop-title p { font-size: 13px; color: var(--text-secondary); }

.steps { display: flex; flex-direction: column; gap: 4px; }
.step-link {
  display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm); text-decoration: none; font-size: 14px; font-weight: 500; color: var(--text-secondary);
}
.step-link:hover { background: rgba(0,0,0,.04); }
.step-link .marker {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 12px; font-weight: 600; border: 1.5px solid var(--text-muted); color: var(--text-primary);
}
.step-link .t { flex: 1; }
.step-link .p { font-size: 12px; }
.step-link.done { color: var(--text-primary); }
.step-link.done .marker { background: var(--surface-accent); border-color: var(--surface-accent); }
.step-link.current { background: var(--surface-base); color: var(--text-primary); font-weight: 600; }
.step-link.current .marker { background: #000; border-color: #000; color: #fff; }

.panel { background: var(--surface-base); border-radius: var(--radius-sm); padding: var(--space-md); display: flex; flex-direction: column; gap: 10px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--text-secondary); text-transform: uppercase; }
.who-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }

/* ---- Cards ---- */
.card {
  background: var(--surface-base); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  padding: var(--space-2xl); display: flex; flex-direction: column; gap: var(--space-xl);
}
.card-head { display: flex; flex-direction: column; gap: 6px; }
.card-head .row { display: flex; align-items: center; gap: 10px; }
.card-head h2 { font-size: 20px; font-weight: 600; line-height: 1.3; }
.card-head p { color: var(--text-secondary); font-size: 14px; }
.card.collapsed { flex-direction: row; align-items: center; padding-block: var(--space-xl); }
.card.collapsed .card-head { flex: 1; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }

/* ---- Fields ---- */
.field { display: flex; flex-direction: column; gap: var(--space-xs); min-width: 0; }
.field label, .field .label { display: flex; align-items: baseline; gap: 8px; font-weight: 600; font-size: 15px; }
.field .req { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.field .help { font-size: 13px; color: var(--text-secondary); margin-top: -4px; }
.input, .textarea, .select {
  width: 100%; min-height: var(--tap-sm); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-subtle); background: var(--surface-base); font-size: 15px;
  transition: border-color .15s ease;
}
.textarea { resize: vertical; min-height: 120px; }
.input:hover, .textarea:hover { border-color: var(--text-muted); }
.input:focus, .textarea:focus { outline: none; border-color: var(--border-strong); }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.field.over .input, .field.over .textarea { border-color: var(--accent-pop); }
.field.flash .input, .field.flash .textarea { animation: flash 1.2s ease; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 4px rgba(222,226,63,.7); } 100% { box-shadow: none; } }

.meter { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.meter .track { width: 120px; height: 6px; border-radius: var(--radius-full); background: var(--surface-placeholder); overflow: hidden; }
.meter .fill { height: 100%; width: 0; border-radius: inherit; background: var(--surface-accent); transition: width .2s ease, background-color .2s ease; }
.field.tight .meter .fill { background: var(--citron-ink); }
.field.short .meter .fill { background: var(--text-muted); }
.field.over .meter .fill { background: var(--accent-pop); }
.field.over .meter { color: var(--accent-pop); }

.note-accent { background: var(--surface-accent); color: var(--citron-ink); font-weight: 500; font-size: 13px; padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-sm); }

/* Dashed zones */
.zone {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-sm); text-align: center;
  padding: var(--space-xl); border: 1.5px dashed var(--text-muted); border-radius: var(--radius-sm); background: var(--surface-raised);
}
.zone strong { font-size: 15px; }
.zone p { font-size: 13px; color: var(--text-secondary); }
.zone.drag { border-color: var(--border-strong); background: #fafae6; }
.zone .actions { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-secondary); }
.paste-area { width: 100%; min-height: 110px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* Gift table */
.gift-table { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); overflow: hidden; }
.gift-row {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) 130px 32px; gap: var(--space-sm); align-items: start;
  padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--border-subtle);
}
.gift-row:last-child { border-bottom: 0; }
.gift-row.head { background: var(--surface-raised); font-size: 12px; font-weight: 600; color: var(--text-secondary); align-items: center; }
.gift-row .n { font-size: 14px; color: var(--text-secondary); padding-top: 10px; }
.gift-row .cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gift-row .input { min-height: 38px; padding: 7px 10px; font-size: 14px; }
.gift-row .input.name { font-weight: 500; }
.gift-row .sub { display: grid; grid-template-columns: 1.4fr 1fr; gap: 6px; }
.gift-row .check { display: flex; flex-wrap: wrap; gap: 4px; }
.gift-row .rm { padding-top: 6px; }
.icon-btn { width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; color: var(--text-secondary); cursor: pointer; font-size: 18px; }
.icon-btn:hover { background: var(--surface-raised); color: var(--text-primary); }
.empty { padding: var(--space-xl); text-align: center; color: var(--text-secondary); font-size: 14px; }

/* Files */
.files { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.file-chip { display: flex; align-items: center; gap: 10px; padding: var(--space-xs) var(--space-sm); background: var(--surface-raised); border-radius: var(--radius-sm); font-size: 13px; }
.file-chip .thumb { width: 32px; height: 32px; border-radius: 6px; background: var(--surface-placeholder) center/contain no-repeat; flex: none; }
.file-chip small { display: block; color: var(--text-secondary); font-size: 12px; }
.add-dashed { border: 1.5px dashed var(--text-muted); border-radius: var(--radius-sm); background: none; padding: var(--space-sm) var(--space-md); color: var(--text-secondary); font-weight: 500; cursor: pointer; }

/* Segmented */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--space-2xs); padding: var(--space-2xs); background: var(--surface-raised); border-radius: var(--radius-sm); }
.segmented button { border: 0; background: none; padding: var(--space-xs) var(--space-md); border-radius: 10px; font-weight: 500; color: var(--text-secondary); cursor: pointer; min-height: 38px; }
.segmented button[aria-pressed=true] { background: var(--surface-base); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.segmented button { white-space: normal; line-height: 1.3; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; min-height: var(--tap-sm); padding: var(--space-xs) var(--space-md); border: 1.5px solid var(--border-subtle); border-radius: var(--radius-sm); }
.check-row:has(input:checked) { border-color: var(--border-strong); }
.check-row input { width: 20px; height: 20px; accent-color: #000; margin: 0; flex: none; }
.sub-field { margin-top: var(--space-xs); padding-left: var(--space-md); border-left: 3px solid var(--surface-accent); }
.meter a { color: var(--text-primary); font-weight: 600; }

/* Standard wording */
details.std { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
details.std > summary { list-style: none; cursor: pointer; padding: var(--space-sm) var(--space-md); font-weight: 600; display: flex; gap: 8px; align-items: center; }
details.std > summary::-webkit-details-marker { display: none; }
details.std > summary::before { content: '▸'; transition: transform .15s ease; color: var(--text-secondary); }
details.std[open] > summary::before { transform: rotate(90deg); }
details.std .changed { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
details.std .body { padding: 0 var(--space-md) var(--space-md); display: flex; flex-direction: column; gap: var(--space-md); }

/* Review */
.issues { display: flex; flex-direction: column; gap: 8px; }
.issue { display: flex; align-items: center; gap: 10px; font-size: 14px; text-align: left; background: none; border: 0; padding: 2px 0; cursor: pointer; }
.issue:hover span:last-child { text-decoration: underline; }
.all-good { font-weight: 500; }
.next-box { background: var(--surface-raised); border-radius: var(--radius-sm); padding: var(--space-lg) var(--space-xl); display: flex; flex-direction: column; gap: 10px; }
.next-box li { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.next-box ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.next-box li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--surface-accent); flex: none; transform: translateY(-1px); }
.actions-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.actions-row p { font-size: 13px; color: var(--text-secondary); }

/* Preview */
.preview { background: var(--surface-base); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-lg); display: flex; flex-direction: column; gap: var(--space-md); }
.preview header { display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.phone { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-raised); }
.phone .ann { background: #000; color: #fff; font-size: 11px; font-weight: 500; text-align: center; padding: var(--space-xs) var(--space-sm); }
.phone .welcome { padding: var(--space-lg); display: flex; flex-direction: column; gap: 8px; }
.phone .welcome h3 { font-size: 20px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.phone .welcome p { font-size: 12px; color: var(--text-secondary); overflow-wrap: anywhere; }
.phone .gift { background: #fff; border-radius: var(--radius-sm); padding: var(--space-sm); display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.phone .gift .img { height: 110px; border-radius: 8px; background: var(--surface-placeholder); }
.phone .gift .gname { font-size: 13px; font-weight: 600; width: 170px; overflow-wrap: anywhere; }
.phone .foot { text-align: center; font-size: 10px; color: var(--text-secondary); padding: var(--space-sm); overflow-wrap: anywhere; }
.preview .hint { font-size: 12px; color: var(--text-secondary); }
.clickable { cursor: pointer; border-radius: 6px; }
.clickable:hover { outline: 2px dashed var(--surface-accent); outline-offset: 3px; }

/* Banners, toasts, dialogs */
.banner { margin: var(--space-md) var(--space-2xl) 0; padding: var(--space-sm) var(--space-md); border-radius: var(--radius-sm); background: var(--accent-pop); color: #fff; font-weight: 500; display: flex; gap: 12px; align-items: center; }
.banner .btn { min-height: 32px; padding: 4px 14px; font-size: 13px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; background: #000; color: #fff; padding: 10px 18px; border-radius: var(--radius-full); font-size: 14px; font-weight: 500; transition: opacity .2s ease, transform .2s ease; z-index: 50; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
dialog { border: 0; border-radius: var(--radius-md); padding: var(--space-2xl); width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog form { display: flex; flex-direction: column; gap: var(--space-xl); }

/* Sign-in gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: var(--space-md); }
.gate .card { width: min(440px, 100%); align-items: flex-start; }
.gate .err { color: var(--accent-pop); font-size: 14px; font-weight: 500; }

/* Dashboard */
.page { max-width: 960px; margin: 0 auto; padding: var(--space-2xl); display: flex; flex-direction: column; gap: var(--space-xl); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-md); flex-wrap: wrap; }
.page-head h1 { font-size: 30px; font-weight: 600; }
.page-head p { color: var(--text-secondary); }
.brief-list { background: var(--surface-base); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; }
.brief-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--space-md); align-items: center; padding: var(--space-md) var(--space-xl); border-bottom: 1px solid var(--border-subtle); text-decoration: none; }
.brief-item:last-child { border-bottom: 0; }
.brief-item:hover { background: var(--surface-raised); }
.brief-item b { display: block; font-weight: 600; }
.brief-item small { color: var(--text-secondary); font-size: 13px; }
.filters { display: flex; gap: 8px; }

/* Submitted view */
.done-wrap { max-width: 680px; margin: 0 auto; padding: var(--space-3xl) var(--space-md); display: flex; flex-direction: column; gap: var(--space-2xl); }
.done-wrap .card { padding: var(--space-3xl); }
.badge-ok { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-accent); display: grid; place-items: center; font-size: 24px; font-weight: 700; }
.done-wrap h1 { font-size: 30px; font-weight: 600; }
.results { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); overflow: hidden; }
.result { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-md) var(--space-lg); border-bottom: 1px solid var(--border-subtle); }
.result:last-child { border-bottom: 0; }
.result .ico { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--surface-raised); display: grid; place-items: center; font-weight: 700; flex: none; }
.result .txt { flex: 1; min-width: 0; }
.result .txt b { display: block; }
.result .txt small { color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.result a { font-weight: 600; font-size: 13px; white-space: nowrap; }
.result .pending { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
pre.payload { background: var(--surface-raised); border-radius: var(--radius-sm); padding: var(--space-md); font-size: 12px; overflow: auto; max-height: 320px; }

/* ---- Responsive ---- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr); }
  .preview-col { position: static; grid-column: 2; }
}
@media (max-width: 860px) {
  .topbar { padding: var(--space-sm) var(--space-md); gap: var(--space-sm); }
  .topbar .save-status { font-size: 0; gap: 0; } /* keep the dot, drop the words */
  html { scroll-padding-top: 72px; }
  .topbar .hide-sm { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: var(--space-md); gap: var(--space-md); }
  .sidebar { position: static; }
  .sidebar .steps { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .sidebar .step-link { flex: none; }
  .sidebar .step-link .p { display: none; }
  .sidebar .panel { display: none; }
  .preview-col { grid-column: 1; }
  .card { padding: var(--space-lg); }
  .card.collapsed { flex-direction: column; align-items: stretch; }
  .grid2 { grid-template-columns: 1fr; }
  .gift-row { grid-template-columns: 20px minmax(0, 1fr) 32px; }
  .gift-row.head { display: none; }
  .gift-row .rm { grid-column: 3; grid-row: 1; }
  .gift-row .sku { grid-column: 2; }
  .gift-row .sub { grid-template-columns: 1fr; }
  .brief-item { grid-template-columns: minmax(0, 1fr); }
  .page { padding: var(--space-md); }
  .banner { margin: var(--space-sm) var(--space-md) 0; }
}
