:root {
  color-scheme: light;
  --ink: #2b1722;
  --muted: #695662;
  --paper: #ffffff;
  --bg: #f9f5f5;
  --border: #e9dfe3;
  --accent: #802650;
  --accent-dark: #62203e;
  --accent-wash: #f8eef3;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Avenir Next", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; color: var(--ink); background: var(--bg); font: 500 0.9375rem/1.5 var(--sans); }
button, input, textarea, select { font: inherit; }
button, summary, .file-button { cursor: pointer; }
button { color: inherit; }
button:disabled { opacity: 0.5; cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.visually-hidden, .skip:not(:focus) { position: absolute; overflow: hidden; width: 1px; height: 1px; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: absolute; top: 0.5rem; left: 0.5rem; z-index: 5; padding: 0.5rem 1rem; color: var(--ink); background: var(--paper); }

.app-bar { background: var(--paper); border-bottom: 1px solid var(--border); }
.bar-inner { max-width: 1500px; margin: auto; padding: 0.88rem clamp(1rem, 4.2vw, 3.75rem); display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.app-brand { display: inline-flex; align-items: center; gap: 0.72rem; font-family: var(--serif); font-weight: 700; font-size: 1.23rem; line-height: 1.17; }
.brand-caption { display: block; color: var(--muted); font: 600 0.69rem/1.2 var(--sans); margin-top: 0.23rem; }
.brand-icon { position: relative; display: grid; place-items: center; width: 2.55rem; height: 2.55rem; border-radius: 0.77rem; color: var(--paper); background: var(--accent); }
.brand-icon span { position: relative; width: 1.19rem; height: 1rem; margin-top: 0.22rem; border: 1.45px solid; border-radius: 0.13rem; }
.brand-icon span::before { content: ""; position: absolute; top: -0.34rem; left: -0.12rem; width: 1.27rem; height: 0.35rem; border: 1.45px solid; border-radius: 0.2rem; background: var(--accent); transform: perspective(8px) rotateX(17deg); }
.brand-icon span::after { content: ""; position: absolute; right: 0.17rem; bottom: 0; width: 0.34rem; height: 0.56rem; border: 1px solid; border-bottom-width: 0; border-radius: 0.13rem 0.13rem 0 0; }
.bar-actions { display: flex; align-items: center; gap: 0.55rem; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 0.45rem; min-height: 2.62rem; padding: 0.53rem 0.86rem; border: 1px solid transparent; border-radius: 0.58rem; font-size: 0.82rem; font-weight: 700; line-height: 1.28; white-space: nowrap; }
.button.secondary { background: var(--paper); border-color: var(--border); }
.button.secondary:hover, .file-button:hover { background: var(--accent-wash); }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-dark); }
.action-icon { font-size: 1.08rem; line-height: 1; }

.workspace { max-width: 1500px; margin: auto; padding: 2.15rem clamp(1rem, 4.2vw, 3.75rem) 3rem; }
.workspace-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.55rem; }
h1, h2, h3, p { margin: 0; }
.workspace-intro h1 { color: #41182e; font: 700 clamp(2.02rem, 4vw, 3.48rem)/1.02 var(--serif); letter-spacing: -0.055em; }
.workspace-intro p { margin-top: 0.5rem; color: var(--muted); }
.jump-preview { display: none; }
.project-tools { display: flex; align-items: center; gap: 0.75rem; }
.project-tools .storage-status { margin: 0; font-size: 0.74rem; font-weight: 650; white-space: nowrap; color: #5c6154; }
.storage-status::before { content: ""; display: inline-block; width: 0.43rem; height: 0.43rem; border-radius: 50%; margin-right: 0.38rem; background: #69916a; vertical-align: 0.045rem; }
.storage-status[data-state="error"]::before, .storage-status[data-state="pending"]::before { background: #b17a43; }
.file-menu { position: relative; z-index: 2; flex: none; }
.file-menu summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 0.45rem; border: 1px solid var(--border); padding: 0.43rem 0.65rem; border-radius: 0.5rem; background: var(--paper); font-size: 0.78rem; font-weight: 700; }
.file-menu summary::-webkit-details-marker, .product-editor summary::-webkit-details-marker { display: none; }
.file-menu-actions { position: absolute; min-width: 13rem; right: 0; top: calc(100% + 0.38rem); padding: 0.3rem; background: var(--paper); border: 1px solid var(--border); border-radius: 0.65rem; box-shadow: 0 0.45rem 1.3rem #38132a18; }
.file-menu-actions > * { position: relative; display: block; width: 100%; padding: 0.54rem 0.64rem; border: 0; border-radius: 0.35rem; background: transparent; text-align: left; font-size: 0.83rem; white-space: nowrap; }
.file-menu-actions > *:hover, .file-menu-actions > *:focus-within { background: var(--accent-wash); }

.workspace-grid { display: grid; grid-template-columns: clamp(18.5rem, 29vw, 22.5rem) minmax(0, 1fr); align-items: start; gap: clamp(0.9rem, 2vw, 1.5rem); }
.editor-card, .preview-card { min-width: 0; background: var(--paper); border: 1px solid var(--border); border-radius: 1rem; box-shadow: 0 0.22rem 1rem #3e142109; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; padding: 0.62rem; border-bottom: 1px solid var(--border); }
.tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 0.44rem; padding: 0.54rem 0.44rem; min-height: 2.55rem; border: 0; border-radius: 0.53rem; background: transparent; color: var(--muted); font-size: 0.84rem; font-weight: 700; }
.tabs button:hover, .tabs button[aria-selected="true"] { background: var(--accent-wash); color: var(--accent-dark); }
.count { min-width: 1.35rem; padding: 0.08rem 0.29rem; border-radius: 99px; font-size: 0.66rem; background: #efe4eb; color: var(--accent-dark); text-align: center; }
.panel { padding: clamp(0.95rem, 2vw, 1.4rem); }
.panel-heading { margin-bottom: 1rem; }
.panel-heading h2 { font: 700 1.45rem/1.1 var(--serif); letter-spacing: -0.022em; }
.panel-heading p { padding-top: 0.33rem; color: var(--muted); font-size: 0.8rem; }
.fields { display: grid; gap: 0.77rem; }
.kind-field { display: grid; gap: 0.33rem; }
.kind-demo { justify-self: start; padding: 0.34rem 0.54rem; color: var(--accent-dark); background: var(--accent-wash); border: 1px solid #ead5e0; border-radius: 0.37rem; font-size: 0.73rem; font-weight: 700; }
.kind-demo:hover { background: #f3e2ec; }
.field { display: grid; gap: 0.32rem; min-width: 0; font-weight: 700; font-size: 0.79rem; }
.field :is(input, textarea, select) { min-width: 0; width: 100%; padding: 0.62rem 0.67rem; border: 1px solid #ded2d8; border-radius: 0.47rem; background-color: #fff; color: var(--ink); line-height: 1.32; font-size: 0.875rem; font-weight: 500; }
.field select { cursor: pointer; }
.field textarea { resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #7a6873; }
.field small { color: var(--muted); font-size: 0.72rem; font-weight: 500; }
.field :is(input, textarea)[aria-invalid="true"] { border-color: #a42b35; }
.theme-field { border: 0; padding: 0; margin: 1.2rem 0; }
.theme-field legend, .media-fields h3 { font-weight: 700; font-size: 0.81rem; margin-bottom: 0.46rem; }
.theme-set + .theme-set { margin-top: 0.55rem; }
.palette-label { margin-bottom: 0.25rem; color: var(--muted); font-size: 0.72rem; font-weight: 650; }
.theme-options { display: flex; flex-wrap: wrap; gap: 0.42rem; }
.swatch { --swatch: #802650; position: relative; cursor: pointer; display: grid; place-items: center; width: 2.16rem; height: 2.16rem; }
.swatch.terracotta { --swatch: #a44430; }
.swatch.green { --swatch: #42614b; }
.swatch.violet { --swatch: #604577; }
.swatch.blue { --swatch: #315384; }
.swatch.rose { --swatch: #963d62; }
.swatch.graphite { --swatch: #444857; }
.swatch.petrol { --swatch: #1e6570; }
.swatch.mustard { --swatch: #8a6018; }
.swatch.cacao { --swatch: #654537; }
.swatch.coral { --swatch: #a43d52; }
.swatch.olive { --swatch: #596229; }
.swatch.aurora { --swatch: linear-gradient(135deg, #fff1ee 10%, #e9dbf8 92%); }
.swatch.sand { --swatch: linear-gradient(135deg, #fff8df 10%, #f5d2b7 92%); }
.swatch.breeze { --swatch: linear-gradient(135deg, #e4efff 10%, #d0eddd 92%); }
.swatch.garden { --swatch: linear-gradient(135deg, #fff7df 10%, #d6e5c8 92%); }
.swatch.petals { --swatch: linear-gradient(135deg, #fff7f3, #f8e5e4 55%, #f5d0d6); }
.swatch.atlantic { --swatch: linear-gradient(135deg, #f1f9ff, #e5e8fc 55%, #dce0fa); }
.swatch.honey { --swatch: linear-gradient(135deg, #fffdf0, #fff4cf 55%, #f8e7a7); }
.swatch.coffee { --swatch: linear-gradient(135deg, #fff6eb, #efe4d8 55%, #dfcbbc); }
.swatch.lagoon { --swatch: linear-gradient(135deg, #f0fff7, #dbf3e9 55%, #c9e9eb); }
.swatch input, .file-button input, .file-upload input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.color-dot { display: block; width: 1.68rem; height: 1.68rem; border-radius: 50%; background: var(--swatch); border: 1px solid #32132226; }
.swatch input:checked + .color-dot { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch input:focus-visible + .color-dot { outline: 2px dashed var(--accent); outline-offset: 3px; }

.media-fields { display: grid; gap: 0.48rem; }
.media-fields h3 { margin-bottom: 0; }
.media-row { display: flex; align-items: center; gap: 0.52rem; padding: 0.5rem; border: 1px solid var(--border); border-radius: 0.52rem; min-width: 0; }
.media-row > div { display: grid; min-width: 0; flex: 1; }
.media-row strong { font-size: 0.75rem; }
.media-row div span { color: var(--muted); font-size: 0.68rem; overflow-wrap: anywhere; }
.media-thumb { width: 2rem; height: 2rem; border-radius: 0.3rem; object-fit: cover; }
.file-button { position: relative; flex: none; padding: 0.32rem 0.52rem; border: 1px solid var(--border); border-radius: 0.37rem; font-weight: 700; font-size: 0.73rem; }
.file-button:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.remove-media { display: grid; place-items: center; width: 1.68rem; height: 1.68rem; background: transparent; border: 0; border-radius: 0.3rem; color: var(--muted); font-size: 1.17rem; }
.remove-media:hover { background: var(--accent-wash); color: var(--accent-dark); }

.review-setting { display: flex; align-items: center; justify-content: space-between; gap: 0.72rem; margin-top: 1.15rem; padding: 0.72rem; border: 1px solid var(--border); border-radius: 0.56rem; cursor: pointer; }
.review-setting strong { display: block; font-size: 0.8rem; }
.review-setting small { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.71rem; line-height: 1.4; }
.toggle-control { position: relative; flex: 0 0 2.48rem; height: 1.42rem; }
.toggle-control input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.toggle-track { display: block; width: 100%; height: 100%; padding: 0.18rem; border-radius: 1rem; background: #a797a0; }
.toggle-track::after { content: ""; display: block; width: 1.06rem; height: 1.06rem; border-radius: 50%; background: var(--paper); }
.toggle-control input:checked + .toggle-track { background: var(--accent); }
.toggle-control input:checked + .toggle-track::after { transform: translateX(1.06rem); }
.toggle-control input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 3px; }

.products-list { display: grid; gap: 0.62rem; padding-bottom: 0.74rem; }
.products-list:empty { display: none; }
.product-editor { border: 1px solid var(--border); border-radius: 0.6rem; min-width: 0; }
.product-editor summary { list-style: none; display: flex; align-items: center; gap: 0.43rem; padding: 0.6rem; border-radius: 0.56rem; font-size: 0.77rem; font-weight: 700; }
.product-editor[open] summary { border-bottom: 1px solid var(--border); border-radius: 0.56rem 0.56rem 0 0; background: #fdf9fb; }
.product-summary-image { width: 1.95rem; height: 1.95rem; border-radius: 0.3rem; object-fit: cover; }
.product-summary-name { flex: 1; overflow-wrap: anywhere; }
.product-summary-price { flex: none; color: var(--accent-dark); }
.product-arrow { color: var(--muted); }
.product-editor[open] .product-arrow { transform: rotate(180deg); }
.product-fields { padding: 0.68rem; }
.add-product { width: 100%; color: var(--accent-dark); background: var(--accent-wash); border-color: #ead5e0; }
.add-product:hover { background: #f3e2ec; }
.delete-product { justify-self: start; margin-left: -0.3rem; padding: 0.28rem 0.3rem; border: 0; border-radius: 0.25rem; background: transparent; color: #992735; font-weight: 700; font-size: 0.75rem; }
.delete-product:hover { background: #fff0f1; }

.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.66rem 0.93rem; border-bottom: 1px solid var(--border); }
.preview-title { display: flex; align-items: center; gap: 0.47rem; }
.preview-title h2 { font-size: 0.81rem; font-weight: 750; white-space: nowrap; }
.live-dot { background: #65896b; width: 0.45rem; height: 0.45rem; border-radius: 50%; box-shadow: 0 0 0 3px #edf4ee; }
.view-toggle { display: flex; gap: 0.11rem; padding: 0.19rem; border: 1px solid var(--border); border-radius: 0.52rem; background: #fcf8fa; }
.view-toggle button { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 1.81rem; padding: 0.27rem 0.54rem; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 0.36rem; font-size: 0.72rem; font-weight: 700; }
.view-toggle button[aria-pressed="true"] { color: var(--accent-dark); border-color: #eadce3; background: var(--paper); }
.device-icon { display: inline-block; position: relative; border: 1.2px solid; border-radius: 2px; }
.desktop-icon { width: 0.82rem; height: 0.57rem; margin-bottom: 0.1rem; }
.desktop-icon::after { content: ""; position: absolute; width: 0.38rem; height: 1px; left: calc(50% - 0.19rem); bottom: -3px; background: currentColor; }
.mobile-icon { width: 0.42rem; height: 0.72rem; }
.preview-stage { background: #eee5e7; padding: clamp(0.48rem, 1.55vw, 1.1rem); }
.preview-frame { margin: 0 auto; max-width: 100%; overflow: hidden; border-radius: 0.6rem; box-shadow: 0 0.15rem 0.65rem #39233014; background: #fff8f0; }
.preview-frame.is-mobile { max-width: 23rem; }
.preview-note { padding: 0.72rem 0.95rem; color: var(--muted); font-size: 0.73rem; }
.edit-status { position: fixed; bottom: 1rem; right: 1rem; z-index: 4; max-width: min(28rem, calc(100vw - 2rem)); padding: 0.76rem 0.95rem; color: #fff; background: #4d2138; border-radius: 0.62rem; box-shadow: 0 0.4rem 1.6rem #29121930; font-size: 0.88rem; }
.edit-status.is-error { background: #802837; }
.edit-status a { color: inherit; font-weight: 750; }
.edit-status a:focus-visible { outline-color: currentColor; }
.edit-status:empty { padding: 0; box-shadow: none; background: transparent; pointer-events: none; }
.no-script { margin-bottom: 0.6rem; padding: 0.6rem; background: #fff8da; border-radius: 0.4rem; }

@media (max-width: 805px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .workspace-intro { align-items: flex-start; }
  .jump-preview { display: inline-block; margin-top: 0.5rem; color: var(--accent-dark); font-size: 0.8rem; font-weight: 700; text-underline-offset: 0.15rem; }
  .project-tools { flex-direction: column-reverse; align-items: flex-end; gap: 0.29rem; }
  .field :is(input, textarea, select) { font-size: 1rem; }
}

@media (max-width: 510px) {
  .bar-inner { flex-wrap: wrap; }
  .bar-actions { margin-left: auto; }
  .workspace { padding-top: 1.42rem; }
  .workspace-intro { flex-wrap: wrap; gap: 0.66rem; margin-bottom: 1rem; }
  .project-tools { flex-direction: row; justify-content: space-between; align-items: center; width: 100%; }
  .project-tools .storage-status { white-space: normal; }
  .preview-toolbar { padding-inline: 0.62rem; }
  .view-toggle button { padding-inline: 0.37rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
