:root {
  color-scheme: light;
  --ink: #20242c;
  --muted: #646c79;
  --white: #fff;
  --canvas: #f6f7f9;
  --rail: #fbfbfc;
  --border: #e3e6ec;
  --field: #dbe0e7;
  --hover: #f0f2f6;
  --accent: #3959a4;
  --accent-strong: #304a88;
  --selected: #edf1fa;
  --focus: #6684c5;
  --toolbar-height: 48px;
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
[hidden], :is(p, small):empty { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button, summary, .file-button { cursor: pointer; }
button:disabled { opacity: .46; cursor: default; }
button, input, select, summary { border-radius: 5px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button, .file-button {
  min-height: 29px;
  padding: 4px 9px;
  border: 1px solid transparent;
  font-weight: 525;
}
.soft, .file-button { background: var(--white); border-color: var(--field); }
.soft:hover:not(:disabled), .file-button:hover { background: var(--hover); }
.primary { color: white; background: var(--accent); border-color: var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-strong); }
.quiet { background: transparent; color: var(--muted); }
.quiet:hover:not(:disabled) { color: var(--ink); background: var(--hover); }
input:not([type="range"]), select {
  width: 100%;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--field);
  background: var(--white);
}
input[type="range"] { width: 100%; min-width: 26px; margin: 0; accent-color: var(--accent); }
input[type="number"] { appearance: textfield; font-variant-numeric: tabular-nums; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { appearance: none; margin: 0; }

.top { position: relative; z-index: 2; background: white; border-bottom: 1px solid var(--border); }
.top-content {
  min-height: calc(var(--toolbar-height) - 1px);
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.top h1 { font-size: 15px; font-weight: 650; letter-spacing: -.025em; }
.store-controls, .downloads { display: flex; align-items: center; min-width: 0; gap: 6px; }
.downloads { margin-left: auto; flex: none; }
.store-controls select { min-width: 92px; max-width: min(19vw, 210px); }
#choose-store { max-width: min(29vw, 345px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.connection-menu { position: relative; }
.connection-menu summary {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  padding: 5px 7px;
  white-space: nowrap;
  font-size: 12px;
}
.connection-menu summary::-webkit-details-marker { display: none; }
.connection-menu summary:hover, .connection-menu[open] summary { background: var(--hover); }
.connection-dot { width: 6px; height: 6px; border-radius: 50%; background: #9ba3af; }
.connection-menu[data-connected="true"] .connection-dot { background: #3a8b66; }
.connection-popover {
  position: absolute;
  z-index: 3;
  top: calc(100% + 5px);
  left: 0;
  min-width: 155px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: 0 6px 20px #20263812;
  background: white;
}
.connection-popover p { padding: 5px 8px 6px; color: var(--muted); font-size: 11px; }
.connection-popover button { display: block; width: 100%; padding-inline: 8px; text-align: left; }

.layout { min-height: calc(100dvh - var(--toolbar-height)); display: grid; grid-template-columns: 216px minmax(0, 1fr); }
.sidebar { min-width: 0; background: var(--rail); border-right: 1px solid var(--border); }
.library-head { padding: 13px 11px 6px; }
.library-head h2 { font-size: 12px; font-weight: 650; margin: 0 0 7px 2px; }
#product-search { min-height: 27px; font-size: 12px; }
#products { display: grid; align-content: start; gap: 1px; max-height: calc(100dvh - var(--toolbar-height) - 73px); overflow: auto; scrollbar-width: thin; padding: 2px 6px 8px; }
.product, .view { background: transparent; color: var(--ink); border: 1px solid transparent; }
.product {
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 35px;
  padding: 2px 5px;
  text-align: left;
  font-size: 12px;
  line-height: 1.17;
}
.product:hover, .view:hover { background: var(--hover); }
.product[aria-current="true"], .view[aria-current="true"] { background: var(--selected); color: #2d4380; }
.product img, .view img {
  display: block;
  width: 29px;
  height: 29px;
  background: white;
  border: 1px solid #edf0f4;
  border-radius: 4px;
  object-fit: contain;
}
.product small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
main { min-width: 0; max-width: 1720px; margin: 0 auto; width: 100%; padding: 15px 22px 12px; }
.preview-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.preview-header h2 { font-size: clamp(15px, 1.45vw, 21px); font-weight: 620; letter-spacing: -.025em; }
#sku { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.switch {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  white-space: nowrap;
  color: var(--muted);
  background: transparent;
  border-color: var(--border);
}
.switch:hover { background: var(--hover); }
.switch span:last-child {
  min-width: 26px;
  border-radius: 4px;
  text-align: center;
  color: #566070;
  background: #e9ecf1;
  font-size: 11px;
}
.switch[aria-checked="true"] span:last-child { color: var(--accent-strong); background: #e3eafb; }
#status { padding: 5px 8px; margin-bottom: 8px; border-radius: 4px; background: var(--hover); }
#status[data-error="true"], #picker-status[data-error="true"], #connection-status { color: #842d28; }
#status[data-error="true"] { background: #fff0ee; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 12px; }
.workspace:has(#editor:not([hidden])) { grid-template-columns: minmax(0, 1fr) 226px; }
.preview { min-width: 0; }
.stage { min-width: 0; display: grid; place-items: center; }
#artboard {
  position: relative;
  width: min(100%, 780px, max(295px, calc(100dvh - 184px)));
  min-width: 0;
  aspect-ratio: 1;
  background: white;
  box-shadow: 0 0 0 1px #e5e8ee, 0 2px 6px #181e2e0a;
}
#artboard[aria-busy="true"] { opacity: .78; }
#preview { display: block; width: 100%; height: 100%; }
#spots { position: absolute; inset: 0; pointer-events: none; }
.spot { position: absolute; padding: 0; min-width: 25px; min-height: 24px; pointer-events: auto; touch-action: none; border: 1px solid transparent; background: transparent; cursor: grab; }
.spot:active { cursor: grabbing; }
#spots.show .spot { border-color: #5e7db5; border-style: dashed; box-shadow: 0 0 0 1px #fff8; }
#spots.show .spot[aria-pressed="true"], .spot:focus-visible { border: 2px solid var(--accent); }
.spot:disabled { pointer-events: none; }
.preview-footer, .preview-details {
  max-width: min(100%, 780px, max(295px, calc(100dvh - 184px)));
  margin-inline: auto;
}
.preview-footer { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-top: 5px; }
.preview-details { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 2px 1px 0; }
.reset-actions { display: flex; align-items: center; white-space: nowrap; }
#hint, .notice { color: var(--muted); font-size: 11px; }
#views { display: flex; gap: 3px; flex-wrap: wrap; }
.view { display: flex; gap: 5px; align-items: center; min-height: 32px; padding: 2px 6px 2px 3px; font-size: 12px; }
.view img { width: 24px; height: 24px; }
#editor { min-width: 0; padding: 10px 9px 7px 11px; background: white; border: 1px solid var(--border); border-radius: 6px; }
.selection-title { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.selection-title h3 { font-size: 13px; font-weight: 625; }
.current-logo { display: grid; grid-template-columns: 39px minmax(0, 1fr) auto; align-items: center; gap: 6px; margin: 6px 0 8px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.current-logo img, .logo-choice img {
  width: 38px;
  height: 24px;
  object-fit: contain;
  border-radius: 3px;
  background: repeating-conic-gradient(#a9b3c3 0% 25%, #c1cad6 0% 50%) 50% / 8px 8px;
}
.current-logo p { font-size: 11px; line-height: 1.2; overflow-wrap: anywhere; }
.current-logo button, #editor .quiet, .reset-actions .quiet { min-height: 25px; padding: 3px 5px; font-size: 11px; white-space: nowrap; }
#change-logo { color: var(--accent); }
#transforms fieldset { min-inline-size: 0; border: 0; margin: 0 0 5px; padding: 0; }
#transforms legend:not(.sr-only) { font-size: 11px; font-weight: 620; padding: 2px 0 3px; }
.control { display: grid; grid-template-columns: 73px minmax(0, 1fr); align-items: center; gap: 5px; min-height: 27px; font-size: 11px; color: var(--muted); }
.control > span { white-space: nowrap; }
.control-line { display: grid; align-items: center; grid-template-columns: minmax(0, 1fr) 39px; gap: 6px; }
.control input[type="number"] { min-height: 23px; padding: 2px 3px; text-align: right; font-size: 11px; }
.move-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.move-grid .control { grid-template-columns: 1fr; gap: 1px; min-width: 0; padding-bottom: 3px; }
#reset-spot { margin-top: 1px; }

dialog { width: min(92vw, 380px); max-height: 85vh; padding: 15px 16px 13px; border: 1px solid var(--border); border-radius: 8px; color: var(--ink); box-shadow: 0 15px 46px #1f273829; }
dialog::backdrop { background: #20273835; }
dialog h2 { font-size: 16px; font-weight: 650; margin-bottom: 7px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.dialog-heading h2 { margin: 0; }
dialog p { font-size: 12px; color: var(--muted); margin: 5px 0 10px; }
dialog label:not(.file-button) { font-size: 12px; }
dialog input:not([type="file"]) { margin-top: 4px; }
.store-list, .logo-list { display: grid; gap: 1px; margin-top: 7px; overflow: auto; max-height: min(47vh, 350px); }
.store-choice, .logo-choice { text-align: left; display: flex; align-items: center; gap: 8px; border-color: transparent; background: #f7f8fa; }
.logo-choice { min-height: 34px; }
.logo-choice img { flex: none; width: 51px; height: 26px; }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 9px; }
.file-button { display: inline-flex; align-items: center; position: relative; overflow: hidden; border-radius: 5px; }
.file-button:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.file-button input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1060px) { .layout { grid-template-columns: 183px minmax(0, 1fr); } main { padding-inline: 13px; } }
@media (max-width: 820px) { .workspace:has(#editor:not([hidden])) { grid-template-columns: minmax(0, 1fr); } #editor { max-width: 400px; } }
@media (max-width: 580px) {
  .top-content { flex-wrap: wrap; gap: 6px; padding-inline: 9px; }
  #choose-store { max-width: 41vw; }
  .connection-popover { left: auto; right: 0; }
  .downloads { width: 100%; justify-content: flex-end; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .library-head { padding-top: 8px; }
  #products { max-height: 110px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-header { align-items: flex-start; }
  #artboard, .preview-footer, .preview-details { width: 100%; max-width: 100%; }
  .preview-footer { flex-wrap: wrap; }
}
