/* design/editor/editor.css — editor CHROME only (topbar, panel, sheets, dialogs).
   Identity = the PLATFORM dashboard (docs/DESIGN.md). Values below mirror the generated
   packages/design-tokens/dist/tokens.css (read-only copy — dist/ is git-ignored, and this prototype must open from disk).
   The merchant's storefront inside the preview never sees these tokens. */
:root {
  --ds-canvas: #FBFAF8; --ds-surface: #FFFFFF; --ds-surface-muted: #F6F5F2; --ds-surface-raised: #FFFFFF;
  --ds-border: #E2DFD9; --ds-border-strong: #CDC9C1; --ds-input: #8F8A82;
  --ds-fg: #1C1B19; --ds-fg-muted: #5F5B54; --ds-fg-subtle: #736E66; --ds-fg-inverse: #FFFFFF;
  --ds-primary: #3E51A3; --ds-primary-hover: #34448A; --ds-primary-active: #2B3870; --ds-primary-fg: #FFFFFF;
  --ds-primary-subtle: #F2F4FB; --ds-primary-subtle-fg: #34448A;
  --ds-success: #2F7D4F; --ds-success-subtle: #EAF4EE; --ds-success-subtle-fg: #256640;
  --ds-warning: #A86412; --ds-warning-subtle: #FAF2E3; --ds-warning-subtle-fg: #875010;
  --ds-danger: #B93A32; --ds-danger-fg: #FFFFFF; --ds-danger-subtle: #FAECEA; --ds-danger-subtle-fg: #A2322B;
  --ds-info: #2F6F8F; --ds-info-subtle: #E8F1F5; --ds-info-subtle-fg: #285F7B;
  --ds-ring: #5467B8; --ds-overlay: rgb(18 18 17 / 0.45);
  --ds-font-sans: 'IBM Plex Sans Arabic', 'Tajawal', ui-sans-serif, system-ui, 'Segoe UI', Tahoma, Arial, sans-serif;
  --ds-radius-xs: 0.25rem; --ds-radius-sm: 0.375rem; --ds-radius-md: 0.625rem; --ds-radius-lg: 0.875rem; --ds-radius-xl: 1.25rem; --ds-radius-full: 9999px;
  --ds-shadow-xs: 0 1px 2px 0 rgb(28 27 25 / 0.05);
  --ds-shadow-sm: 0 1px 3px 0 rgb(28 27 25 / 0.07), 0 1px 2px -1px rgb(28 27 25 / 0.05);
  --ds-shadow-md: 0 4px 12px -2px rgb(28 27 25 / 0.08), 0 2px 4px -2px rgb(28 27 25 / 0.05);
  --ds-shadow-lg: 0 12px 32px -8px rgb(28 27 25 / 0.12), 0 4px 8px -4px rgb(28 27 25 / 0.06);
  --ds-duration-fast: 120ms; --ds-duration-base: 180ms; --ds-duration-slow: 260ms;
  --ds-ease-standard: cubic-bezier(0.2, 0, 0, 1); --ds-ease-enter: cubic-bezier(0, 0, 0.2, 1);
  --ds-touch-target: 2.75rem;
  --topbar-h: 56px; --panel-w: 340px; --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --ds-canvas: #121211; --ds-surface: #1A1917; --ds-surface-muted: #23221F; --ds-surface-raised: #211F1D;
    --ds-border: #302E2A; --ds-border-strong: #403D38; --ds-input: #76716A;
    --ds-fg: #F3F1EC; --ds-fg-muted: #B7B2A9; --ds-fg-subtle: #99948B; --ds-fg-inverse: #121211;
    --ds-primary: #7788CC; --ds-primary-hover: #8A99D4; --ds-primary-active: #A3B0E0; --ds-primary-fg: #121211;
    --ds-primary-subtle: #20263F; --ds-primary-subtle-fg: #C9D1EE;
    --ds-success: #5FB37F; --ds-success-subtle: #1A2E22; --ds-success-subtle-fg: #8FD1A8;
    --ds-warning: #D99A45; --ds-warning-subtle: #33271A; --ds-warning-subtle-fg: #EFC181;
    --ds-danger: #E0776E; --ds-danger-fg: #121211; --ds-danger-subtle: #3A1F1C; --ds-danger-subtle-fg: #F2A9A2;
    --ds-info: #5AA5C8; --ds-info-subtle: #182B35; --ds-info-subtle-fg: #95CBE3;
    --ds-ring: #8A99D4; --ds-overlay: rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}
@media (prefers-reduced-motion: reduce) { :root { --ds-duration-fast: 0ms; --ds-duration-base: 0ms; --ds-duration-slow: 0ms; } }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 400 14px/1.6 var(--ds-font-sans); color: var(--ds-fg); background: var(--ds-canvas); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ds-ring); outline-offset: 2px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico-sm { width: 16px; height: 16px; }
.ico-flip { transform: scaleX(-1); }
.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- app grid */
.app { height: 100dvh; display: grid; grid-template-columns: var(--panel-w) 1fr; grid-template-rows: var(--topbar-h) 1fr; grid-template-areas: "top top" "panel stage"; }
.topbar { grid-area: top; display: flex; align-items: center; gap: 12px; padding-inline: 12px 16px; background: var(--ds-surface); border-block-end: 1px solid var(--ds-border); position: relative; z-index: 30; }
.panel { grid-area: panel; display: flex; flex-direction: column; min-height: 0; background: var(--ds-surface); border-inline-end: 1px solid var(--ds-border); position: relative; z-index: 20; }
.stage { grid-area: stage; position: relative; min-width: 0; min-height: 0; overflow: hidden;
  background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ds-fg) 7%, transparent) 1px, transparent 0) 0 0 / 20px 20px, var(--ds-surface-muted); }
.tabbar { display: none; }

/* ---------------------------------------------------------------- topbar */
.tb-start { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brandmark { width: 32px; height: 32px; border-radius: var(--ds-radius-md); background: var(--ds-primary); color: var(--ds-primary-fg); display: grid; place-items: center; flex: none; }
.brandmark .ico { width: 18px; height: 18px; }
.tb-title { display: grid; line-height: 1.3; min-width: 0; }
.tb-title b { font-weight: 600; font-size: 14px; }
.tb-title span { font-size: 12px; color: var(--ds-fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-mid { display: flex; justify-content: center; flex: 1; }
.tb-end { display: flex; align-items: center; gap: 6px; flex: 1; justify-content: flex-end; }
.tb-sep { width: 1px; height: 24px; background: var(--ds-border); margin-inline: 4px; }

.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--ds-radius-md); border: 0; background: transparent; color: var(--ds-fg-muted); transition: background var(--ds-duration-fast), color var(--ds-duration-fast); position: relative; }
.icon-btn:hover:not(:disabled) { background: var(--ds-surface-muted); color: var(--ds-fg); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn[aria-pressed="true"] { background: var(--ds-primary-subtle); color: var(--ds-primary-subtle-fg); }

.save { display: inline-flex; align-items: center; gap: 8px; padding: 0 10px; height: 32px; border-radius: var(--ds-radius-full); font-size: 12.5px; color: var(--ds-fg-muted); white-space: nowrap; }
.save .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ds-success); flex: none; }
.save[data-state="saving"] .dot { background: transparent; border: 1.5px solid var(--ds-fg-subtle); border-inline-end-color: transparent; animation: spin .8s linear infinite; }
.save[data-state="offline"], .save[data-state="error"] { background: var(--ds-warning-subtle); color: var(--ds-warning-subtle-fg); }
.save[data-state="offline"] .dot, .save[data-state="error"] .dot { background: var(--ds-warning); border-radius: 2px; transform: rotate(45deg); }
.save .retry { border: 0; background: none; color: inherit; text-decoration: underline; padding: 0 2px; font-size: 12.5px; min-height: 32px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--ds-radius-md); border: 1px solid transparent; font-weight: 600; font-size: 14px; white-space: nowrap; transition: background var(--ds-duration-fast), border-color var(--ds-duration-fast), color var(--ds-duration-fast); text-decoration: none; }
.btn-primary { background: var(--ds-primary); color: var(--ds-primary-fg); }
.btn-primary:hover:not(:disabled) { background: var(--ds-primary-hover); }
.btn-primary:active:not(:disabled) { background: var(--ds-primary-active); }
.btn-secondary { background: var(--ds-surface); color: var(--ds-fg); border-color: var(--ds-border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--ds-surface-muted); }
.btn-ghost { background: transparent; color: var(--ds-fg-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--ds-surface-muted); color: var(--ds-fg); }
.btn-danger { background: var(--ds-danger); color: var(--ds-danger-fg); }
.btn-danger-ghost { background: transparent; color: var(--ds-danger-subtle-fg); }
.btn-danger-ghost:hover { background: var(--ds-danger-subtle); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn .spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.link-btn { border: 0; background: none; color: var(--ds-primary-subtle-fg); font-weight: 600; padding: 0; text-decoration: underline; text-underline-offset: 3px; min-height: 32px; }

/* segmented */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--ds-radius-md); background: var(--ds-surface-muted); border: 1px solid var(--ds-border); }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; min-height: 34px; padding: 0 12px; border: 0; border-radius: calc(var(--ds-radius-md) - 3px); background: transparent; color: var(--ds-fg-muted); font-size: 13px; font-weight: 500; flex: 1; transition: background var(--ds-duration-fast), color var(--ds-duration-fast), box-shadow var(--ds-duration-fast); }
.seg button:hover:not(:disabled) { color: var(--ds-fg); }
.seg button[aria-pressed="true"], .seg button[aria-checked="true"] { background: var(--ds-surface); color: var(--ds-fg); box-shadow: var(--ds-shadow-sm); font-weight: 600; }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.seg.full { display: flex; width: 100%; }

/* menus */
.menu-wrap { position: relative; }
.menu { position: absolute; inset-block-start: calc(100% + 6px); inset-inline-end: 0; min-width: 220px; padding: 6px; background: var(--ds-surface-raised); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); box-shadow: var(--ds-shadow-lg); z-index: 60; }
.menu[hidden] { display: none; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: var(--ds-radius-sm); background: none; text-align: start; font-size: 13.5px; color: var(--ds-fg); }
.menu button:hover, .menu button:focus-visible { background: var(--ds-surface-muted); outline: none; }
.menu button:disabled { opacity: .45; cursor: not-allowed; }
.menu .danger { color: var(--ds-danger-subtle-fg); }
.menu hr { border: 0; border-block-start: 1px solid var(--ds-border); margin: 6px 0; }
.menu .ico { color: var(--ds-fg-subtle); }
.menu .danger .ico { color: inherit; }

/* ---------------------------------------------------------------- panel */
.panel-head { padding: 12px 12px 0; }
.panel-tabs { display: flex; }
.panel-tabs .seg { width: 100%; }
.sheet-grab, .sheet-head { display: none; }
.panel-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px 12px 24px; scrollbar-width: thin; }
.view-head { display: flex; align-items: center; gap: 4px; margin: -4px 0 12px; min-height: 40px; }
.view-head h2 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 8px 0 10px; border: 0; border-radius: var(--ds-radius-md); background: none; color: var(--ds-fg-muted); font-weight: 500; }
.back:hover { background: var(--ds-surface-muted); color: var(--ds-fg); }
.group-label { display: flex; align-items: center; gap: 8px; margin: 18px 4px 8px; font-size: 12px; font-weight: 600; color: var(--ds-fg-subtle); }
.group-label::after { content: ""; flex: 1; height: 1px; background: var(--ds-border); }
.group-label:first-child { margin-block-start: 4px; }
.hint { font-size: 12.5px; color: var(--ds-fg-muted); margin: 6px 4px 0; line-height: 1.7; }

/* section rows */
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.row { display: flex; align-items: center; gap: 2px; min-height: 48px; padding-inline: 2px 4px; border-radius: var(--ds-radius-md); background: var(--ds-surface); position: relative; transition: background var(--ds-duration-fast); }
.row:hover { background: var(--ds-surface-muted); }
.row.is-selected { background: var(--ds-primary-subtle); }
.row.is-selected .r-name { color: var(--ds-primary-subtle-fg); }
.row.is-off .r-name > span:first-child, .row.is-off .r-ico { opacity: .5; }
.row.placeholder { background: var(--ds-primary-subtle); outline: 2px dashed var(--ds-ring); outline-offset: -2px; }
.row.placeholder > * { visibility: hidden; }
.row.picked { outline: 2px solid var(--ds-ring); outline-offset: -2px; background: var(--ds-surface); box-shadow: var(--ds-shadow-md); }
.drag-ghost { position: fixed; z-index: 90; pointer-events: none; box-shadow: var(--ds-shadow-lg); background: var(--ds-surface); border-radius: var(--ds-radius-md); outline: 1px solid var(--ds-border-strong); opacity: .96; }
.grip { width: 28px; height: 40px; display: grid; place-items: center; border: 0; background: none; color: var(--ds-fg-subtle); border-radius: var(--ds-radius-sm); cursor: grab; touch-action: none; flex: none; }
.grip:hover { color: var(--ds-fg); background: var(--ds-surface); }
.grip[aria-pressed="true"] { color: var(--ds-primary); }
.grip.lock { cursor: default; opacity: .55; }
.r-ico { width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--ds-radius-sm); background: var(--ds-surface-muted); color: var(--ds-fg-muted); flex: none; margin-inline-end: 6px; }
.row.is-selected .r-ico { background: var(--ds-surface); color: var(--ds-primary-subtle-fg); }
.r-ico .ico { width: 17px; height: 17px; }
.r-name { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 44px; justify-content: center; padding: 4px 2px; border: 0; background: none; text-align: start; font-weight: 500; font-size: 13.5px; color: var(--ds-fg); border-radius: var(--ds-radius-sm); }
.r-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.r-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.r-rename { flex: 1; min-height: 36px; border: 1px solid var(--ds-ring); border-radius: var(--ds-radius-sm); padding: 0 8px; background: var(--ds-surface); }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: var(--ds-radius-full); font-size: 11px; font-weight: 600; line-height: 1; white-space: nowrap; }
.badge .ico { width: 12px; height: 12px; stroke-width: 2.2; }
.b-sample { background: var(--ds-surface-muted); color: var(--ds-fg-muted); border: 1px solid var(--ds-border); }
.b-warn { background: var(--ds-warning-subtle); color: var(--ds-warning-subtle-fg); }
.b-info { background: var(--ds-info-subtle); color: var(--ds-info-subtle-fg); }
.b-off { background: var(--ds-surface-muted); color: var(--ds-fg-subtle); }
.b-ok { background: var(--ds-success-subtle); color: var(--ds-success-subtle-fg); }
.b-primary { background: var(--ds-primary-subtle); color: var(--ds-primary-subtle-fg); }
.row .icon-btn { width: 36px; height: 36px; }
.fixed-row .r-ico { background: transparent; border: 1px dashed var(--ds-border-strong); }
.add-sec { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; margin: 8px 0; border: 1.5px dashed var(--ds-border-strong); border-radius: var(--ds-radius-md); background: transparent; color: var(--ds-primary-subtle-fg); font-weight: 600; }
.add-sec:hover { background: var(--ds-primary-subtle); border-color: var(--ds-ring); }
.parked { margin-top: 12px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); }
.parked summary { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ds-fg-muted); list-style: none; }
.parked summary::-webkit-details-marker { display: none; }
.parked[open] summary .ico { transform: rotate(-90deg); }
.parked .rows { padding: 0 6px 6px; }
.parked p { margin: 0 12px 8px; font-size: 12.5px; color: var(--ds-fg-muted); }

/* cards / notes */
.card { border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface); padding: 14px; }
.note { display: flex; gap: 10px; padding: 12px; border-radius: var(--ds-radius-md); font-size: 13px; line-height: 1.75; }
.note .ico { margin-top: 2px; }
.note p { margin: 0; }
.note b { font-weight: 700; }
.note-info { background: var(--ds-info-subtle); color: var(--ds-info-subtle-fg); }
.note-warn { background: var(--ds-warning-subtle); color: var(--ds-warning-subtle-fg); }
.note-ok { background: var(--ds-success-subtle); color: var(--ds-success-subtle-fg); }
.note-muted { background: var(--ds-surface-muted); color: var(--ds-fg-muted); }
.note .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* warnings */
.warns { margin-top: 16px; display: grid; gap: 8px; }
.warn-item { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; padding: 10px 12px; border-radius: var(--ds-radius-md); background: var(--ds-surface-muted); font-size: 12.5px; line-height: 1.7; }
.warn-item .ico { width: 16px; height: 16px; margin-top: 3px; }
.warn-item[data-level="warn"] { background: var(--ds-warning-subtle); color: var(--ds-warning-subtle-fg); }
.warn-item[data-level="error"] { background: var(--ds-danger-subtle); color: var(--ds-danger-subtle-fg); }
.warn-item[data-level="info"] { color: var(--ds-fg-muted); }
.warn-item .fix { grid-column: 2; justify-self: start; }
.meter { display: grid; gap: 6px; }
.meter-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--ds-fg-muted); }
.meter-bar { height: 6px; border-radius: 99px; background: var(--ds-border); overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ds-success); transition: width var(--ds-duration-slow) var(--ds-ease-standard); }
.meter[data-level="warn"] .meter-bar i { background: var(--ds-warning); }
.meter[data-level="error"] .meter-bar i { background: var(--ds-danger); }

/* ---------------------------------------------------------------- forms */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > label, .field > .flabel { font-size: 13px; font-weight: 600; color: var(--ds-fg); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.counter { font-size: 11.5px; font-weight: 500; color: var(--ds-fg-subtle); }
.counter.near { color: var(--ds-warning-subtle-fg); }
.input, .textarea, .select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--ds-input); border-radius: var(--ds-radius-md); background: var(--ds-surface); color: var(--ds-fg); transition: border-color var(--ds-duration-fast), box-shadow var(--ds-duration-fast); }
.textarea { min-height: 88px; resize: vertical; line-height: 1.7; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--ds-ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-ring) 25%, transparent); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--ds-danger); }
.err { font-size: 12.5px; color: var(--ds-danger-subtle-fg); display: flex; gap: 6px; align-items: flex-start; }
.help { font-size: 12px; color: var(--ds-fg-muted); line-height: 1.7; }
.is-sample-field .input, .is-sample-field .textarea { background: color-mix(in srgb, var(--ds-surface-muted) 70%, var(--ds-surface)); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.switch-row > span { font-size: 13.5px; font-weight: 500; }
.switch { position: relative; width: 44px; height: 26px; flex: none; border: 0; border-radius: 99px; background: var(--ds-border-strong); transition: background var(--ds-duration-base); padding: 0; }
.switch::before { content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--ds-shadow-sm); transition: transform var(--ds-duration-base) var(--ds-ease-standard); }
.switch[aria-checked="true"] { background: var(--ds-primary); }
.switch[aria-checked="true"]::before { transform: translateX(-18px); }
.switch:disabled { opacity: .5; cursor: not-allowed; }
.switch::after { content: ""; position: absolute; inset: -9px -2px; }
.subgroup { border-block-start: 1px solid var(--ds-border); padding-top: 14px; }
details.subgroup > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; min-height: 40px; font-weight: 600; font-size: 13px; color: var(--ds-fg-muted); }
details.subgroup > summary::-webkit-details-marker { display: none; }
details.subgroup[open] > summary .ico { transform: rotate(-90deg); }
details.subgroup > .form { margin-top: 10px; }

/* image picker */
.img-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.img-opt { position: relative; aspect-ratio: 1; padding: 0; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-sm); background: var(--ds-surface-muted); overflow: hidden; }
.img-opt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-opt[aria-pressed="true"] { outline: 2px solid var(--ds-primary); outline-offset: 1px; }
.img-opt[aria-pressed="true"]::after { content: ""; position: absolute; inset-block-start: 4px; inset-inline-end: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--ds-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center/11px no-repeat; }
.img-opt.none, .img-opt.upload { display: grid; place-items: center; align-content: center; gap: 2px; font-size: 11px; color: var(--ds-fg-muted); text-align: center; line-height: 1.3; }
.img-opt.upload { border-style: dashed; cursor: pointer; }
.img-opt.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.img-opt.upload:focus-within { outline: 2px solid var(--ds-ring); outline-offset: 2px; }

/* item lists (slides, faq…) */
.items { display: grid; gap: 8px; }
.item { border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); }
.item > summary { list-style: none; display: flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 6px 0 12px; cursor: pointer; font-size: 13px; font-weight: 600; }
.item > summary::-webkit-details-marker { display: none; }
.item > summary .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item > summary .chev { transition: transform var(--ds-duration-fast); color: var(--ds-fg-subtle); }
.item[open] > summary .chev { transform: rotate(-90deg); }
.item > .form { padding: 4px 12px 14px; }
.item .icon-btn { width: 36px; height: 36px; }

/* swatches + colour rows */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.preset { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); text-align: start; font-size: 12.5px; font-weight: 500; }
.preset[aria-pressed="true"] { border-color: var(--ds-primary); box-shadow: inset 0 0 0 1px var(--ds-primary); }
.preset .chips { display: flex; height: 28px; border-radius: var(--ds-radius-sm); overflow: hidden; border: 1px solid var(--ds-border); }
.preset .chips i { flex: 1; }
.color-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 8px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); text-align: start; }
.color-row[aria-expanded="true"] { border-color: var(--ds-ring); }
.color-row .sw { width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgb(0 0 0 / .12); box-shadow: inset 0 0 0 2px rgb(255 255 255 / .5); flex: none; }
.color-row .t { flex: 1; display: grid; line-height: 1.4; }
.color-row .t b { font-size: 13.5px; font-weight: 600; }
.color-row .t span { font-size: 12px; color: var(--ds-fg-muted); }
.color-row .hex { font: 500 12px var(--ds-font-sans); color: var(--ds-fg-muted); direction: ltr; }
.pop { margin-top: 8px; padding: 12px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface-muted); display: grid; gap: 12px; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.swatch { aspect-ratio: 1; border-radius: 50%; border: 1px solid rgb(0 0 0 / .12); padding: 0; position: relative; min-width: 32px; }
.swatch[aria-pressed="true"]::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ds-primary); }
.custom-color { display: flex; gap: 8px; align-items: center; }
.custom-color input[type="color"] { width: 44px; height: 44px; padding: 2px; border: 1px solid var(--ds-input); border-radius: var(--ds-radius-md); background: var(--ds-surface); flex: none; }
.custom-color .input { direction: ltr; text-align: start; font-family: ui-monospace, Consolas, monospace; }
.fix-card { display: grid; gap: 10px; padding: 14px; border-radius: var(--ds-radius-lg); background: var(--ds-info-subtle); color: var(--ds-info-subtle-fg); font-size: 13px; line-height: 1.8; }
.fix-card h3 { margin: 0; font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
.fix-card ul { margin: 0; padding-inline-start: 18px; }
.fix-pairs { display: flex; flex-wrap: wrap; gap: 8px; }
.fix-pair { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 6px; border-radius: var(--ds-radius-full); background: var(--ds-surface); color: var(--ds-fg); font-size: 12px; }
.fix-pair i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgb(0 0 0 / .15); display: inline-block; }
.contrast { font-size: 11.5px; font-weight: 600; }

/* font pairs */
.fonts { display: grid; gap: 6px; }
.font-opt { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; padding: 10px 12px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); text-align: start; }
.font-opt[aria-checked="true"] { border-color: var(--ds-primary); box-shadow: inset 0 0 0 1px var(--ds-primary); }
.font-opt .sample { font-size: 17px; font-weight: 700; line-height: 1.5; color: var(--ds-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-opt .meta { grid-column: 1; font-size: 12px; color: var(--ds-fg-muted); }
.font-opt .check { grid-row: 1 / span 2; grid-column: 2; color: var(--ds-primary); visibility: hidden; }
.font-opt[aria-checked="true"] .check { visibility: visible; }

/* visual option tiles (radius, buttons, cards) */
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tiles.t3 { grid-template-columns: repeat(3, 1fr); }
.tile { display: grid; justify-items: center; gap: 6px; padding: 10px 4px 8px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); font-size: 11.5px; color: var(--ds-fg-muted); min-height: 44px; }
.tile[aria-checked="true"] { border-color: var(--ds-primary); color: var(--ds-fg); font-weight: 600; box-shadow: inset 0 0 0 1px var(--ds-primary); }
.tile:disabled { opacity: .45; cursor: not-allowed; }
.tile .shape { width: 34px; height: 26px; border: 2px solid var(--ds-fg-muted); border-inline-end: 0; border-block-end: 0; }
.tile .bshape { height: 22px; min-width: 52px; display: grid; place-items: center; font-size: 10px; font-weight: 700; padding: 0 8px; }
.tile .cshape { width: 40px; height: 30px; border-radius: 4px; display: block; }

/* theme + starter gallery */
.themes { display: grid; gap: 10px; }
.theme-card { display: grid; grid-template-columns: 88px 1fr; gap: 12px; padding: 10px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface); text-align: start; align-items: center; }
.theme-card[aria-current="true"] { border-color: var(--ds-primary); box-shadow: inset 0 0 0 1px var(--ds-primary); }
.theme-card h3 { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.theme-card p { margin: 2px 0 0; font-size: 12.5px; color: var(--ds-fg-muted); line-height: 1.6; }
.theme-card .acts { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.mock { width: 88px; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; border: 1px solid var(--ds-border-strong); display: flex; flex-direction: column; font-size: 6px; line-height: 1.3; }
.mock .m-bar { height: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 5.5px; }
.mock .m-hero { flex: 1.3; margin: 4px; border-radius: var(--mr, 0); display: grid; align-content: end; padding: 5px; gap: 2px; }
.mock .m-hero b { font-size: 8px; line-height: 1.2; }
.mock .m-btn { justify-self: start; padding: 1px 5px; font-size: 5px; border-radius: var(--mbr, 0); }
.mock .m-grid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 0 4px 4px; }
.mock .m-grid i { border-radius: var(--mr, 0); display: block; }
.starters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.starter { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface); text-align: start; align-content: start; min-height: 116px; }
.starter:hover { border-color: var(--ds-border-strong); box-shadow: var(--ds-shadow-sm); }
.starter .s-ico { width: 36px; height: 36px; border-radius: var(--ds-radius-md); display: grid; place-items: center; background: var(--ds-primary-subtle); color: var(--ds-primary-subtle-fg); }
.starter b { font-size: 13.5px; }
.starter span { font-size: 12px; color: var(--ds-fg-muted); line-height: 1.55; }

/* library */
.lib-group { margin-bottom: 4px; }
.lib { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lib-card { display: grid; gap: 6px; align-content: start; padding: 8px 8px 10px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); text-align: start; min-height: 44px; }
.lib-card:hover:not([aria-disabled="true"]) { border-color: var(--ds-ring); box-shadow: var(--ds-shadow-sm); }
.lib-card[aria-disabled="true"] { cursor: not-allowed; background: var(--ds-surface-muted); }
.lib-card[aria-disabled="true"] .lib-art, .lib-card[aria-disabled="true"] b { opacity: .55; }
.lib-art { height: 54px; border-radius: var(--ds-radius-sm); background: var(--ds-surface-muted); display: grid; place-items: center; color: var(--ds-fg-subtle); }
.lib-art svg { width: 72px; height: 40px; }
.lib-card b { font-size: 13px; }
.lib-card span { font-size: 11.5px; color: var(--ds-fg-muted); line-height: 1.55; }
.lib-card .why { color: var(--ds-warning-subtle-fg); font-weight: 500; }
.lib-card .noteln { color: var(--ds-info-subtle-fg); }

/* ---------------------------------------------------------------- stage */
.stage-inner { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px 24px 64px; }
.frame { position: relative; background: var(--ds-surface); border-radius: 28px; box-shadow: 0 0 0 1px var(--ds-border-strong), var(--ds-shadow-lg); overflow: hidden; transition: width var(--ds-duration-slow) var(--ds-ease-standard), height var(--ds-duration-slow) var(--ds-ease-standard), border-radius var(--ds-duration-slow); }
.frame[data-device="desktop"] { border-radius: 12px; }
.frame-scaler { position: absolute; inset-block-start: 0; left: 0; transform-origin: 0 0; }
.frame iframe { display: block; border: 0; width: 100%; height: 100%; background: var(--ds-surface-muted); }
.pv-state { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px; padding: 24px; text-align: center; background: var(--ds-surface-muted); color: var(--ds-fg-muted); font-size: 13.5px; transition: opacity var(--ds-duration-slow); z-index: 5; }
.pv-state[hidden] { display: none; }
.pv-state .skel-lines { display: grid; gap: 8px; width: min(220px, 70%); }
.pv-state .skel-lines i { height: 10px; border-radius: 6px; background: linear-gradient(90deg, var(--ds-border) 0%, var(--ds-surface) 50%, var(--ds-border) 100%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
.pv-state .skel-lines i:nth-child(2) { width: 80%; } .pv-state .skel-lines i:nth-child(3) { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.pv-swap { position: absolute; inset: 0; background: var(--ds-surface); opacity: 0; pointer-events: none; transition: opacity 160ms; z-index: 4; display: grid; place-items: center; font-size: 13px; color: var(--ds-fg-muted); }
.pv-swap.on { opacity: .92; }
.stage-foot { position: absolute; inset-inline: 0; inset-block-end: 14px; display: flex; justify-content: center; gap: 8px; pointer-events: none; }
.weight-pill { pointer-events: auto; display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px; border-radius: var(--ds-radius-full); background: var(--ds-surface); border: 1px solid var(--ds-border); box-shadow: var(--ds-shadow-sm); font-size: 12px; color: var(--ds-fg-muted); }
.weight-pill .meter-bar { width: 90px; }
.weight-pill[data-level="warn"] { color: var(--ds-warning-subtle-fg); }
.weight-pill[data-level="error"] { color: var(--ds-danger-subtle-fg); }

/* floating section toolbar (over the preview) */
.sec-toolbar { position: absolute; z-index: 15; display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--ds-fg); color: var(--ds-fg-inverse); border-radius: var(--ds-radius-lg); box-shadow: var(--ds-shadow-lg); transition: opacity var(--ds-duration-fast); }
.sec-toolbar[hidden] { display: none; }
.sec-toolbar button { display: inline-flex; align-items: center; gap: 6px; min-width: 40px; height: 40px; padding: 0 10px; border: 0; border-radius: var(--ds-radius-md); background: transparent; color: inherit; font-size: 13px; font-weight: 600; justify-content: center; }
.sec-toolbar button:hover:not(:disabled) { background: rgb(255 255 255 / .12); }
.sec-toolbar button:disabled { opacity: .35; cursor: not-allowed; }
.sec-toolbar .tsep { width: 1px; height: 22px; background: rgb(255 255 255 / .2); }
.sec-toolbar :focus-visible { outline-color: var(--ds-fg-inverse); }

/* ---------------------------------------------------------------- toasts / dialogs */
.toasts { position: fixed; z-index: 80; inset-block-end: 20px; inset-inline-start: 50%; transform: translateX(50%); display: grid; gap: 8px; width: min(460px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 8px 8px 16px; padding-inline-start: 16px; border-radius: var(--ds-radius-lg); background: var(--ds-fg); color: var(--ds-fg-inverse); box-shadow: var(--ds-shadow-lg); font-size: 13.5px; animation: toast-in var(--ds-duration-slow) var(--ds-ease-enter); }
.toast .msg { flex: 1; }
.toast .msg small { display: block; opacity: .75; font-size: 12px; }
.toast button { border: 0; background: rgb(255 255 255 / .12); color: inherit; font-weight: 600; min-height: 36px; padding: 0 12px; border-radius: var(--ds-radius-md); white-space: nowrap; }
.toast button:hover { background: rgb(255 255 255 / .2); }
.toast .ok { color: #8FD1A8; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.overlay { position: fixed; inset: 0; z-index: 70; background: var(--ds-overlay); display: grid; place-items: center; padding: 16px; animation: fade var(--ds-duration-base); }
@keyframes fade { from { opacity: 0; } }
.dialog { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--ds-surface); border-radius: var(--ds-radius-xl); box-shadow: var(--ds-shadow-lg); padding: 22px; animation: pop var(--ds-duration-slow) var(--ds-ease-enter); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dialog h2 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.dialog .lead { margin: 0 0 16px; color: var(--ds-fg-muted); }
.dialog .changes { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--ds-radius-md); background: var(--ds-surface-muted); list-style: none; display: grid; gap: 6px; font-size: 13.5px; }
.dialog .changes li { display: flex; gap: 8px; }
.dialog .changes li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ds-fg-subtle); margin-top: 9px; flex: none; }
.dialog .stack { display: grid; gap: 8px; margin-bottom: 16px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-start; margin-top: 18px; flex-wrap: wrap; }
.dialog-actions .btn { min-height: 44px; }
.choice { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 12px 14px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); cursor: pointer; align-items: start; }
.choice:has(input:checked) { border-color: var(--ds-primary); box-shadow: inset 0 0 0 1px var(--ds-primary); background: var(--ds-primary-subtle); }
.choice input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--ds-primary); }
.choice b { font-size: 14px; }
.choice span { grid-column: 2; font-size: 12.5px; color: var(--ds-fg-muted); }
.report { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.report li { display: flex; gap: 10px; align-items: flex-start; }
.report .ok { color: var(--ds-success); }
.report .info { color: var(--ds-info); }

/* ---------------------------------------------------------------- skeleton (first paint) */
.skel { display: grid; gap: 8px; }
.skel i { height: 48px; border-radius: var(--ds-radius-md); background: linear-gradient(90deg, var(--ds-surface-muted) 0%, var(--ds-surface) 50%, var(--ds-surface-muted) 100%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }

/* ---------------------------------------------------------------- tablet 768–1023: narrower panel, phone preview only */
@media (max-width: 1023px) {
  :root { --panel-w: 300px; }
  .device-toggle [data-device="desktop"] { display: none; }
  .tb-mid { display: none; }
}

/* ---------------------------------------------------------------- phone < 768: preview + bottom sheets */
@media (max-width: 767px) {
  :root { --topbar-h: 52px; }
  .app { grid-template-columns: 1fr; grid-template-rows: var(--topbar-h) 1fr var(--tabbar-h); grid-template-areas: "top" "stage" "tabs"; }
  .topbar { padding-inline: 4px 8px; gap: 4px; }
  .tb-title, .brandmark, .tb-sep, .tb-mid { display: none; }
  .tb-start { flex: 0; }
  .tb-end { flex: 1; justify-content: space-between; gap: 2px; }
  .save { padding: 0 6px; font-size: 12px; }
  .save .long { display: none; }
  .icon-btn { width: 44px; height: 44px; }
  .btn { min-height: 44px; }
  .stage-inner { padding: 0; }
  .frame { border-radius: 0; box-shadow: none; width: 100% !important; height: 100% !important; }
  .stage-foot { display: none; }
  .tabbar { grid-area: tabs; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--ds-surface); border-block-start: 1px solid var(--ds-border); padding-block-end: env(safe-area-inset-bottom); z-index: 40; position: relative; }
  .tabbar button { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 64px; border: 0; background: none; color: var(--ds-fg-muted); font-size: 11.5px; font-weight: 500; }
  .tabbar button[aria-pressed="true"] { color: var(--ds-primary-subtle-fg); font-weight: 600; }
  .tabbar button[aria-pressed="true"] .ico { stroke-width: 2.1; }
  .panel { position: fixed; inset-inline: 0; inset-block-end: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); height: var(--sheet-h, 55dvh); border: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -8px 32px -8px rgb(0 0 0 / .25), 0 0 0 1px var(--ds-border); transform: translateY(0); transition: height var(--ds-duration-slow) var(--ds-ease-standard), transform var(--ds-duration-slow) var(--ds-ease-standard); z-index: 35; }
  .panel.dragging { transition: none; }
  .panel[data-snap="closed"] { transform: translateY(calc(100% + 24px)); }
  .panel[data-snap="full"] { inset-block-end: 0; z-index: 45; }
  .panel-head { display: none; }
  .sheet-grab { display: block; height: 22px; position: relative; touch-action: none; cursor: grab; flex: none; }
  .sheet-grab::before { content: ""; position: absolute; inset-block-start: 9px; inset-inline-start: 50%; width: 40px; height: 4px; margin-inline-start: -20px; border-radius: 4px; background: var(--ds-border-strong); }
  .sheet-head { display: flex; align-items: center; gap: 8px; padding: 0 12px 6px 8px; touch-action: none; flex: none; }
  .sheet-head h2 { margin: 0; flex: 1; font-size: 15px; font-weight: 600; padding-inline-start: 4px; }
  .panel-body { padding-top: 4px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .panel .view-head h2 { display: none; }
  .panel .view-head:not(:has(.back)) { display: none; }
  .row { min-height: 52px; }
  .grip, .row .icon-btn { width: 44px; height: 44px; }
  .seg button { min-height: 40px; }
  .sec-toolbar { inset-inline: 8px !important; justify-content: space-between; }
  .toasts { inset-block-end: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); }
  .overlay { place-items: end stretch; padding: 0; }
  .dialog { width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); animation: sheet-up var(--ds-duration-slow) var(--ds-ease-enter); }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .btn { width: 100%; }
  .lib { grid-template-columns: 1fr 1fr; }
  .menu { position: fixed; inset-inline: 8px; inset-block-start: auto; inset-block-end: calc(var(--tabbar-h) + 8px); min-width: 0; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@media (pointer: coarse) { .seg button { min-height: 40px; } .btn-sm { min-height: 40px; } }

/* ---------------------------------------------------------------- UX review pass (mobile speed: colour, add, publish) */
/* brand colour: always-visible quick swatches at the top of «الأنماط» */
.brand-color { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); }
.bc-head { display: flex; align-items: center; gap: 10px; }
.bc-head .sw { width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgb(0 0 0 / .12); box-shadow: inset 0 0 0 2px rgb(255 255 255 / .5); flex: none; }
.bc-head .t { flex: 1; display: grid; line-height: 1.4; }
.bc-head .t b { font-size: 13.5px; font-weight: 600; }
.bc-head .t span { font-size: 12px; color: var(--ds-fg-muted); }
.bc-head .hex { font: 500 12px var(--ds-font-sans); color: var(--ds-fg-muted); direction: ltr; }
.swatches.quick .swatch { min-width: 40px; min-height: 40px; }
.more-colors { justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }
.mini-sw { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgb(0 0 0 / .15); display: inline-block; }
.brand-color .pop { margin-top: 0; }

/* contrast auto-fix card: a <details>, one line on phones */
details.fix-card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; min-height: 32px; }
details.fix-card > summary::-webkit-details-marker { display: none; }
details.fix-card > summary span { flex: 1; }
details.fix-card > summary .chev { transition: transform var(--ds-duration-fast); }
details.fix-card[open] > summary .chev { transform: rotate(-90deg); }

/* library search */
.lib-search .input { width: 100%; }
.lib-card[hidden], .lib-group[hidden] { display: none; }

/* "section added" confirmation card */
.added-card { display: flex; gap: 10px; padding: 14px; border-radius: var(--ds-radius-lg); background: var(--ds-success-subtle); color: var(--ds-success-subtle-fg); font-size: 13.5px; line-height: 1.75; }
.added-card > .ico { margin-top: 3px; flex: none; }
.added-card b { font-weight: 700; }
.added-card p { margin: 2px 0 0; }
.added-acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.added-acts .btn { min-width: 96px; }

/* offer end date: quick choices before the native picker */
.quick-dates { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 40px; padding: 0 14px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-full); background: var(--ds-surface); color: var(--ds-fg); font: 500 13px var(--ds-font-sans); }
.chip:hover { border-color: var(--ds-ring); }

/* publish dialog: action first, details folded */
.dialog-actions.top { margin: 4px 0 16px; }
.changes-fold > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font-size: 13.5px; font-weight: 600; color: var(--ds-primary-subtle-fg); }
.changes-fold > summary::-webkit-details-marker { display: none; }
.changes-fold > summary .chev { transition: transform var(--ds-duration-fast); }
.changes-fold[open] > summary .chev { transform: rotate(-90deg); }
.changes-fold .changes { margin: 4px 0 0; }
.pub-note { margin-top: 12px; }
.pub-note .field[hidden], .pub-note .link-btn[hidden], .lib-empty[hidden] { display: none; }
.pub-note .link-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }

/* publish button after publishing: a state, not an error */
#publish.is-published:disabled { opacity: 1; background: var(--ds-success-subtle); color: var(--ds-success-subtle-fg); gap: 6px; display: inline-flex; align-items: center; }

@media (max-width: 767px) {
  .dialog-actions.top { flex-direction: column; }
  .swatches.quick { grid-template-columns: repeat(6, 1fr); }
}
