@property --fade-start {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@property --fade-end {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

:root {
  /* Light Warm Neutral Ramp (low saturation, calm paper surfaces) */
  --bg-page: #F7F4EE;
  --bg-app: #FDFBF7;
  --surface: #FFFFFF;
  --surface-raised: #F3EFE8;
  --surface-hover: #ECE6DC;

  /* 3 Text Roles */
  --text-primary: #1F1B16;
  --text-secondary: #5E554A;
  --text-muted: #7B7266;

  /* Quiet Hairlines (primary ink at 8% & 14%) */
  --border: rgba(31, 27, 22, 0.08);
  --border-strong: rgba(31, 27, 22, 0.14);

  /* Single Accent (roasted terracotta walnut, >= 5.2:1 contrast with white) */
  --accent: #A04E2A;
  --accent-hover: #874021;
  --accent-soft: #F6ECE6;
  --accent-ink: #8C3F1E;

  /* Semantic (quiet, muted inside ramp) */
  --ok-dot: #3D7A4A;
  --ok-text: #2F633A;
  --warn-dot: #B87B1E;
  --warn-text: #855812;
  --err-bg: #FCF0EE;
  --err-text: #B4382C;

  /* Type */
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;

  /* Nested Radii (4px grid) */
  --r-phone: 36px;
  --r-panel: 16px;
  --r-card: 12px;
  --r-control: 8px;
  --r-tag: 6px;

  /* One Easing Curve */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 140ms;
  --dur-med: 200ms;

  /* Soft Neutral Depth */
  --shadow-phone: 0 20px 56px rgba(31, 27, 22, 0.10), 0 2px 8px rgba(31, 27, 22, 0.05);
  --shadow-sm: 0 1px 2px rgba(31, 27, 22, 0.04);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

img {
  display: block;
  max-width: 100%;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Status dot signature (replaces loud pills) */
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
  display: inline-block;
}
.status-dot.ok { background: var(--ok-dot); }
.status-dot.warn { background: var(--warn-dot); }
.status-dot.muted { background: var(--text-muted); }
.status-dot.accent { background: var(--accent); }

/* ===========================
   Desktop Workbench Split
   =========================== */
.workbench {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 392px minmax(360px, 504px);
  justify-content: center;
  align-items: start;
  gap: 48px;
  padding: 32px 32px 64px;
}

.phone-column {
  position: sticky;
  top: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Realistic WeChat Mini Program Frame */
.phone-frame {
  width: 392px;
  height: 824px;
  max-height: calc(100vh - 64px);
  background: var(--bg-app);
  border-radius: var(--r-phone);
  border: 8px solid #1F1B16;
  box-shadow: var(--shadow-phone);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* WeChat Mini Program Top Bar */
.wx-topbar {
  flex: none;
  height: 52px;
  background: var(--bg-app);
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.wx-brand-mini {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.wx-title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  white-space: nowrap;
}

.wx-capsule-wrap {
  display: flex;
  justify-content: flex-end;
}

.wx-capsule {
  display: inline-flex;
  align-items: center;
  height: 28px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.85);
  padding: 0 8px;
  gap: 8px;
}

.wx-capsule-divider {
  width: 1px;
  height: 12px;
  background: var(--border-strong);
}

.wx-capsule-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  width: 20px;
  height: 20px;
}

/* LocalStorage Failure Banner */
.storage-banner {
  flex: none;
  background: var(--err-bg);
  color: var(--err-text);
  border-bottom: 1px solid rgba(180, 56, 44, 0.2);
  padding: 8px 16px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.storage-banner[hidden] {
  display: none;
}

/* Main Scrollable Content */
.app-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  padding-bottom: 24px;
}

.screen {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.screen[hidden] {
  display: none;
}

/* Customer-Only 3-Tab Navigation (<nav>) */
.wx-tabbar {
  flex: none;
  height: 60px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px 8px 8px;
  z-index: 10;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
  border-radius: var(--r-tag);
  position: relative;
  transition: color var(--dur-fast) var(--ease);
}

.nav-item:hover {
  color: var(--text-secondary);
}

.nav-item[aria-current="page"] {
  color: var(--text-primary);
  font-weight: 500;
}

.nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: -4px;
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
}

.nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 500;
  line-height: 16px;
  text-align: center;
}

.nav-badge[hidden] {
  display: none;
}

/* ===========================
   Quiet Surfaces & Controls
   =========================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-control);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ink {
  background: var(--text-primary);
  color: #FFFFFF;
}

.btn-ink:hover {
  background: #332D26;
}

.btn-secondary {
  background: var(--surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface-raised);
  color: var(--text-primary);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.section-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===========================
   Screen 1: Storefront Showcase
   =========================== */
.studio-banner {
  overflow: hidden;
  border-radius: var(--r-panel);
}

/* Unobstructed real handmade photo — zero text/pills stamped on top */
.studio-hero-media {
  aspect-ratio: 16 / 10;
  background: var(--surface-raised);
  overflow: hidden;
}

.studio-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.studio-hero-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.studio-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.studio-brand-card {
  width: 64px;
  height: 36px;
  border-radius: var(--r-tag);
  overflow: hidden;
  border: 1px solid var(--border);
  flex: none;
}

.studio-brand-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.studio-brand-text h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
}

.studio-brand-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.studio-hero-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

/* Filter Bar (scroll edge fade) */
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-scroller {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: inline proximity;
  scroll-padding-inline: 24px;
  --fade-size: 24px;
  mask:
    linear-gradient(black, black) no-clip subtract,
    linear-gradient(to right, black, transparent) 0 0 / var(--fade-start) 100% no-repeat no-clip,
    linear-gradient(to right, transparent, black) 100% 0 / var(--fade-end) 100% no-repeat no-clip;
  animation: reveal-fade-start linear both, hide-fade-end linear both;
  animation-timeline: scroll(self inline);
  animation-range: 0 var(--fade-size), calc(100% - var(--fade-size)) 100%;
  transition: --fade-start 0.2s, --fade-end 0.2s;
}

.filter-scroller::-webkit-scrollbar {
  display: none;
}

.filter-scroller.more-start { --fade-start: var(--fade-size); }
.filter-scroller.more-end { --fade-end: var(--fade-size); }

@keyframes reveal-fade-start { to { --fade-start: var(--fade-size); } }
@keyframes hide-fade-end { from { --fade-end: var(--fade-size); } }

.chip {
  flex: none;
  scroll-snap-align: start;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-control);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.chip[aria-pressed="true"] {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #FFFFFF;
  font-weight: 500;
}

.stock-toggle {
  flex: none;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-control);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stock-toggle[aria-pressed="true"] {
  border-color: rgba(47, 99, 58, 0.35);
  color: var(--ok-text);
  background: #EFF6F0;
}

/* 2-Column Product Grid — Clean unobstructed photos */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.product-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-align: left;
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.product-card:hover {
  border-color: var(--border-strong);
}

.product-card:active {
  transform: scale(0.985);
}

.product-img-wrap {
  aspect-ratio: 1 / 1;
  background: var(--surface-raised);
  overflow: hidden;
}

.product-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.product-meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.product-mode-text {
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-ink);
}

.product-mode-text.fixed {
  color: var(--text-muted);
  font-weight: 400;
}

.product-name {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
}

.product-foot {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.product-price {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.product-price small {
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 1px;
}

.product-action-hint {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ===========================
   Screen 2: Customizer & Bag
   =========================== */
.custom-block {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.custom-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.custom-block-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.field textarea {
  resize: vertical;
  min-height: 68px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--text-primary);
  outline: none;
}

.field :is(input, textarea, select):is(:user-invalid, .user-invalid-fallback) {
  border-color: var(--err-text);
  background: var(--err-bg);
}

.field :is(input, textarea, select):is(:user-valid, .user-valid-fallback) {
  border-color: var(--ok-dot);
}

.error-msg {
  display: none;
  font-size: 11px;
  color: var(--err-text);
  align-items: center;
  gap: 6px;
}

.field :is(input, textarea, select):is(:user-invalid, .user-invalid-fallback) + .error-msg {
  display: flex;
}

/* 4-Dimension Configurator */
.dim-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dim-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.dim-head strong {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.dim-val {
  font-size: 12px;
  color: var(--text-secondary);
}

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

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

.skin-pill {
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--surface);
  padding: 8px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.skin-pill strong {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.skin-pill span {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.skin-pill[aria-pressed="true"] {
  border-color: var(--text-primary);
  background: var(--surface-raised);
}

.color-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.color-pill {
  height: 34px;
  min-width: 58px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  white-space: nowrap;
  color: var(--text-primary);
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.color-pill[aria-pressed="true"] {
  border-color: var(--text-primary);
  background: var(--surface-raised);
  font-weight: 500;
}

.swatch-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(31, 27, 22, 0.16);
  flex: none;
}

.fixed-notice {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  padding: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.paste-addr-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.paste-addr-box[hidden] {
  display: none;
}

.qty-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  overflow: hidden;
}

.stepper-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--surface-raised);
}

.stepper-btn:hover {
  background: var(--surface-hover);
}

.stepper-val {
  min-width: 36px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
}

.stepper-sm .stepper-btn {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

.stepper-sm .stepper-val {
  min-width: 28px;
  font-size: 12px;
}

/* Bag List Items */
.bag-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
}

.bag-item img {
  width: 52px;
  height: 52px;
  border-radius: var(--r-tag);
  object-fit: cover;
  flex: none;
}

.bag-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bag-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.bag-item-top strong {
  font-weight: 500;
}

.bag-item-body p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.bag-item-foot {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bag-del-btn {
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
}

.bag-del-btn:hover {
  color: var(--err-text);
  background: var(--err-bg);
}

/* Signature Artisanal Bakery Ticket */
.ticket-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-strong);
}

.ticket-head strong {
  font-size: 14px;
  font-weight: 500;
}

.ticket-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}

.ticket-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
}

.ticket-row span:last-child {
  color: var(--text-primary);
  text-align: right;
  font-weight: 500;
}

.ticket-item-line {
  padding: 8px 10px;
  background: var(--surface-raised);
  border-radius: var(--r-tag);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ticket-item-line strong {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.ticket-item-line span {
  font-size: 11px;
  color: var(--text-secondary);
}

.ticket-foot {
  padding-top: 12px;
  border-top: 1px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ticket-total small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.ticket-total strong {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

/* ===========================
   Screen 3: Order Tracking
   =========================== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-control);
  padding: 0 12px;
  height: 40px;
  color: var(--text-muted);
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
}

.order-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.order-id {
  font-size: 12px;
  color: var(--text-muted);
}

.order-main {
  display: flex;
  gap: 12px;
  align-items: center;
}

.order-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--r-control);
  object-fit: cover;
  flex: none;
  border: 1px solid var(--border);
}

.order-info {
  min-width: 0;
  flex: 1;
}

.order-info h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

.order-info p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-rail {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.stage-seg {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-hover);
}

.stage-seg.done { background: var(--accent); }
.stage-seg.current { background: var(--text-primary); }

.order-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===========================
   Native Dialog Sheets
   =========================== */
dialog.sheet-dialog {
  margin: auto;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-panel);
  background: var(--bg-app);
  color: var(--text-primary);
  width: min(376px, calc(100vw - 24px));
  max-height: min(760px, calc(100vh - 36px));
  box-shadow: var(--shadow-phone);
  overflow: auto;
}

dialog.sheet-dialog:modal {
  overscroll-behavior: contain;
}

dialog.sheet-dialog::backdrop {
  background: rgba(31, 27, 22, 0.42);
  backdrop-filter: blur(2px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.sheet-head {
  position: sticky;
  top: 0;
  background: var(--bg-app);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 2;
}

.sheet-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
}

.sheet-close {
  width: 32px;
  height: 32px;
  border-radius: var(--r-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.sheet-close:hover {
  background: var(--surface-raised);
  color: var(--text-primary);
}

.sheet-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Tactile Squish Pad */
.squish-box {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.squish-pad {
  flex: none;
  height: 40px;
  padding: 0 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: 0 2px 0 rgba(31, 27, 22, 0.10);
  user-select: none;
  -webkit-user-select: none;
  transition: transform var(--rebound-ms, 650ms) var(--ease), box-shadow var(--rebound-ms, 650ms) var(--ease);
}

.squish-pad.squishing {
  transform: scale(1.06, 0.82) translateY(2px);
  box-shadow: 0 0 0 rgba(31, 27, 22, 0.06);
  transition-duration: 90ms;
}

/* 6-Stage Craft Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  padding-left: 4px;
}

.tl-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 12px;
  padding-bottom: 16px;
  position: relative;
}

.tl-item:last-child { padding-bottom: 0; }

.tl-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 16px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.tl-item.done:not(:last-child)::before {
  background: var(--accent);
}

.tl-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  margin-top: 2px;
  position: relative;
  z-index: 1;
}

.tl-item.done .tl-dot {
  background: var(--accent);
  border-color: var(--accent);
}

.tl-item.current .tl-dot {
  background: var(--text-primary);
  border-color: var(--text-primary);
}

.tl-content strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.tl-item.pending .tl-content strong {
  color: var(--text-muted);
  font-weight: 400;
}

.tl-content p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.batch-proof {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--surface);
}

.batch-proof img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.batch-proof-meta {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===========================
   Right Companion Editorial Spec Panel
   =========================== */
.companion {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 8px;
}

.companion-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.companion-kicker {
  font-size: 12px;
  color: var(--text-muted);
}

.companion-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.companion-header p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.companion-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.spec-block {
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spec-block h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.spec-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spec-item strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.spec-item p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.gap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.gap-table th,
.gap-table td {
  text-align: left;
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.gap-table th {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
}

.gap-table td:first-child,
.gap-table td:nth-child(2) {
  white-space: nowrap;
}

.gap-table td:first-child {
  font-weight: 500;
  color: var(--text-primary);
}

.gap-table td {
  color: var(--text-secondary);
}

.gap-table tr:last-child td {
  border-bottom: none;
}

/* Toast inside phone */
.toast {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 60px;
  background: var(--text-primary);
  color: #FFFFFF;
  padding: 10px 14px;
  border-radius: var(--r-control);
  font-size: 12px;
  text-align: center;
  z-index: 30;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity var(--dur-med) var(--ease), transform var(--dur-med) var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 920px) {
  .workbench {
    display: block;
    padding: 0;
    background: var(--bg-app);
  }
  .phone-column {
    position: static;
    width: 100%;
  }
  .phone-frame {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  .companion {
    padding: 24px 16px 48px;
    background: var(--bg-page);
    border-top: 1px solid var(--border);
  }
}
