:root {
  --bg: #f6f6f9;
  --surface: #ffffff;
  --surface-2: #fafafc;
  --border: #e6e6ee;
  --border-strong: #d4d4de;
  --text: #1b1a2e;
  --text-2: #55546b;
  --muted: #8a899e;
  --accent: #2c20df;
  --accent-soft: #eeedfd;
  --accent-ink: #2419c4;
  --sidebar: #1f1d36;
  --sidebar-text: #c9c8dc;
  --sidebar-active: #2f2c52;

  --good: #12805c;   --good-bg: #e6f5ee;
  --warn: #9a6200;   --warn-bg: #fff3dc;
  --bad: #c62828;    --bad-bg: #fdecec;
  --info: #1d5fd1;   --info-bg: #e7effd;
  --neutral: #5c5b70; --neutral-bg: #efeff4;
  --violet: #6b3fc9; --violet-bg: #f1ebfd;

  --chart-bar: #2c20df;
  --chart-grid: #ececf2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 18, 50, .06), 0 1px 1px rgba(20, 18, 50, .03);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12111c;
    --surface: #1a1928;
    --surface-2: #201f30;
    --border: #2c2b40;
    --border-strong: #3a3953;
    --text: #ecebf7;
    --text-2: #b4b3c9;
    --muted: #84839b;
    --accent: #8f88ff;
    --accent-soft: #26244a;
    --accent-ink: #b3aeff;
    --sidebar: #0e0d17;
    --sidebar-text: #b9b8cf;
    --sidebar-active: #22213a;
    --good: #4cc79a;   --good-bg: #13302a;
    --warn: #e6b04d;   --warn-bg: #33270f;
    --bad: #f27474;    --bad-bg: #3a1a1e;
    --info: #79a6ff;   --info-bg: #182747;
    --neutral: #a9a8bd; --neutral-bg: #272637;
    --violet: #b496ff; --violet-bg: #2a2147;
    --chart-bar: #8f88ff;
    --chart-grid: #2a2940;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: Figtree, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
button { font: inherit; }
svg { fill: currentColor; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-danger { color: var(--bad); }
.btn-danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-block { width: 100%; height: 42px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }

.input, .select {
  height: 38px; width: 100%;
  padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit;
}
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-label { display: block; margin: 0 0 6px; font-weight: 600; font-size: 13px; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; }
.error-text { color: var(--bad); margin: 8px 0 0; font-size: 13px; }
.muted { color: var(--muted); }

/* ---------- Login ---------- */
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 28px; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 22px; margin: 22px 0 6px; }
.login-card .muted { margin: 0 0 20px; }
.login-card .btn { margin-top: 16px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.brand em { font-style: normal; font-weight: 500; opacity: .7; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 12px; letter-spacing: .04em;
}

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--sidebar); color: #fff; padding: 20px 14px;
}
.sidebar .brand { padding: 0 8px 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--sidebar-text); text-decoration: none; font-weight: 500;
}
.nav a svg { width: 18px; height: 18px; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; }
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding: 0 2px; }
.side-link {
  background: none; border: 0; text-align: left; cursor: pointer;
  color: var(--sidebar-text); text-decoration: none; padding: 8px; border-radius: 8px; font-size: 13px;
}
.side-link:hover { background: rgba(255,255,255,.05); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 28px; background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.menu-btn { display: none; background: none; border: 0; color: var(--text); padding: 4px; cursor: pointer; }
.menu-btn svg { width: 24px; height: 24px; }
.view { padding: 24px 28px 48px; max-width: 1280px; width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-header h2 { margin: 0; font-size: 15px; font-weight: 700; }
.card-header .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Banner ---------- */
.banner {
  display: flex; gap: 12px; align-items: center;
  padding: 14px 16px; border-radius: var(--radius); margin-bottom: 16px;
  background: var(--warn-bg); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}
.banner strong { display: block; }
.banner .btn { margin-left: auto; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; }
.kpi .label { color: var(--text-2); font-size: 13px; font-weight: 500; }
.kpi .value { font-size: 26px; font-weight: 700; margin: 6px 0 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .delta { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center; }
.delta-up { color: var(--good); font-weight: 600; white-space: nowrap; }
.delta-down { color: var(--bad); font-weight: 600; white-space: nowrap; }

/* ---------- Segmented control ---------- */
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 2px; }
.segmented button {
  border: 0; background: none; color: var(--text-2); font-weight: 600; font-size: 13px;
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
}
.segmented button.active { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- Chart ---------- */
.chart-wrap { position: relative; padding: 8px 18px 14px; }
.chart-title-value { font-size: 13px; color: var(--text-2); }
.chart svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .bar { fill: var(--chart-bar); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.hover { fill: var(--accent-ink); }
.chart .hover-bg { fill: var(--accent-soft); opacity: .6; }
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--text); color: var(--surface);
  padding: 8px 10px; border-radius: 8px; font-size: 12.5px; white-space: nowrap;
  transform: translate(-50%, -100%); margin-top: -10px; box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.chart-tooltip strong { display: block; font-size: 14px; }
.chart-empty { height: 260px; display: grid; place-items: center; color: var(--muted); }
.chart-table summary { cursor: pointer; color: var(--muted); font-size: 12.5px; padding: 0 18px 14px; }

/* ---------- Status breakdown ---------- */
.breakdown { list-style: none; margin: 0; padding: 6px 0; }
.breakdown li { display: flex; align-items: center; gap: 10px; padding: 9px 18px; }
.breakdown .count { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.breakdown .amount { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 90px; text-align: right; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 18px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 600; }
.cell-sub { display: block; color: var(--muted); font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); }
.empty { padding: 40px 18px; text-align: center; color: var(--muted); }

/* ---------- Toolbar & tabs ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.toolbar .input { max-width: 300px; }
.toolbar .select { width: auto; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 12px; border-bottom: 1px solid var(--border); }
.tabs button {
  border: 0; background: none; padding: 12px 8px; margin: 0 4px; cursor: pointer;
  color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button.active { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tabs .tab-count { color: var(--muted); font-weight: 500; margin-left: 4px; }
.pagination { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); }
.pagination .right { margin-left: auto; display: flex; gap: 6px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.good { color: var(--good); background: var(--good-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.bad { color: var(--bad); background: var(--bad-bg); }
.badge.info { color: var(--info); background: var(--info-bg); }
.badge.neutral { color: var(--neutral); background: var(--neutral-bg); }
.badge.violet { color: var(--violet); background: var(--violet-bg); }
.badge.plain::before { display: none; }

/* ---------- Detail pages ---------- */
.back-link { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); text-decoration: none; font-weight: 600; margin-bottom: 14px; }
.back-link:hover { color: var(--text); }
.detail-hero { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 20px 18px; }
.detail-hero .amount { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.detail-hero .meta { color: var(--muted); }
.detail-hero .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.address { white-space: pre-line; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 44px;
  display: grid; place-items: center; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-ink);
}
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 16px; bottom: 0; width: 1px; background: var(--border-strong); }
.timeline li:last-child::after { display: none; }
.timeline .when { color: var(--muted); font-size: 12.5px; }

/* ---------- Integrations ---------- */
.integration-head { display: flex; gap: 14px; align-items: center; }
.integration-logo {
  width: 44px; height: 44px; border-radius: 10px; flex: 0 0 44px;
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 18px;
}
.integration-head h2 { margin: 0; font-size: 17px; }
.integration-head p { margin: 2px 0 0; color: var(--muted); }
.integration-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; gap: 16px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.steps { margin: 0; padding-left: 18px; color: var(--text-2); }
.steps li { margin-bottom: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-family: ui-monospace, Menlo, monospace; font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.coming-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.coming { padding: 16px 18px; display: flex; gap: 12px; align-items: center; opacity: .85; }
.coming h3 { margin: 0; font-size: 14px; }
.coming p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 28px 0 12px; font-weight: 600; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat-row .stat { padding: 12px 14px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .val { font-weight: 700; font-size: 16px; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------- Modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 14, 30, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: 100%; max-width: 420px; background: var(--surface); border-radius: 14px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal p { margin: 0 0 16px; color: var(--text-2); }
.modal .form-actions { justify-content: flex-end; margin-top: 18px; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px;
  font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: calc(100% - 32px);
}
.toast.error { background: var(--bad); color: #fff; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 60px; display: grid; place-items: center; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .app.menu-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(10, 10, 20, .4); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .page-actions { margin-left: 0; width: 100%; justify-content: flex-start; }
  .page-actions:empty { display: none; }
  .view { padding: 16px 16px 40px; }
  .kpi .value { font-size: 22px; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 10px; }
  .toolbar .input { max-width: none; }
  .table th, .table td { padding: 10px 12px; }
}

/* =====================================================================
   Store screens: products, checkouts editor, settings
   ===================================================================== */
.nav-label {
  margin: 16px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--sidebar-text); opacity: .55;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input-affix {
  display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); overflow: hidden;
}
.input-affix > span {
  display: flex; align-items: center; padding: 0 10px; background: var(--surface-2);
  color: var(--muted); font-size: 12.5px; border-right: 1px solid var(--border); white-space: nowrap;
  max-width: 55%; overflow: hidden; text-overflow: ellipsis;
}
.input-affix .input { border: 0; border-radius: 0; min-width: 0; }
.input-affix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-affix .input:focus { box-shadow: none; }
.warn-text { color: var(--warn); }

/* switch */
.switch-row { display: flex; align-items: center; gap: 16px; justify-content: space-between; cursor: pointer; }
.switch-row > span { min-width: 0; }
.switch-row strong { font-weight: 600; }
.switch {
  appearance: none; -webkit-appearance: none; flex: 0 0 38px;
  width: 38px; height: 22px; border-radius: 999px; margin: 0;
  background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.switch:disabled { opacity: .6; cursor: not-allowed; }
.switch:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* image picker */
.image-picker { display: grid; gap: 10px; }
.image-preview {
  display: grid; place-items: center; overflow: hidden;
  border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface-2);
  min-height: 90px;
}
.image-picker.wide .image-preview { aspect-ratio: 994 / 222; min-height: 0; }
.image-picker.mobile .image-preview { aspect-ratio: 940 / 420; max-width: 260px; min-height: 0; }
.image-picker.square .image-preview { aspect-ratio: 4 / 3; max-width: 320px; min-height: 0; }
.image-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.image-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.image-picker .hint { margin: 0; }
label.btn.is-busy { opacity: .6; pointer-events: none; }

/* product list */
.product-cell { display: flex; gap: 12px; align-items: center; min-width: 220px; }
.thumb { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.truncate { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.link-list { list-style: none; margin: 0; padding: 6px 0; }
.link-list li { padding: 8px 18px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-list .mono { margin-left: auto; }

/* checkout editor */
body.wide-view .view { max-width: none; }
.editor { display: grid; grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); gap: 20px; align-items: start; }
.editor-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.section > summary { list-style: none; cursor: pointer; user-select: none; }
.section > summary::-webkit-details-marker { display: none; }
.section > summary h2::before { content: "▸"; display: inline-block; margin-right: 8px; color: var(--muted); transition: transform .15s; }
.section[open] > summary h2::before { transform: rotate(90deg); }
.section:not([open]) > summary { border-bottom: 0; }
.color-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.color-field { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.color-field input[type=color] {
  width: 38px; height: 38px; flex: 0 0 38px; padding: 0; border: 1px solid var(--border-strong);
  border-radius: 8px; background: none; cursor: pointer;
}
.color-field input[type=color]::-webkit-color-swatch-wrapper { padding: 3px; }
.color-field input[type=color]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.color-field strong { display: block; font-weight: 500; font-size: 13.5px; }
.danger-zone { box-shadow: none; background: transparent; border-style: dashed; }
.dirty-flag { color: var(--warn); font-size: 12.5px; font-weight: 600; }

.editor-preview { position: sticky; top: 76px; min-width: 0; }
.preview-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.preview-note { font-size: 12.5px; }
.preview-stage {
  position: relative; overflow: hidden; height: calc(100vh - 150px); min-height: 480px;
  border: 1px solid var(--border); border-radius: 12px; background: #e9e9ef;
}
.preview-stage iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; background: #fff; }
.preview-stage.is-mobile { background: var(--surface-2); }
.preview-stage.is-mobile iframe { left: 50%; transform-origin: 0 0; translate: -50% 0; box-shadow: 0 0 0 1px var(--border-strong); }

@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .editor-preview { position: static; order: -1; }
  .preview-stage { height: 70vh; }
}
@media (max-width: 760px) {
  .row-actions { justify-content: flex-start; }
  .link-list .mono { margin-left: 0; width: 100%; }
}

/* Meta pixel section */
.pixel-list { display: flex; flex-direction: column; gap: 12px; }
.pixel-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: grid; gap: 12px; background: var(--surface-2); }
.pixel-card-head { display: flex; align-items: center; gap: 12px; }
.pixel-card-head .btn { margin-left: auto; }
.switch-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.events-grid { display: grid; grid-template-columns: 1fr auto auto; gap: 10px 14px; align-items: start; }
.events-grid .eg-head { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.events-grid .eg-name { min-width: 0; display: grid; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.events-grid .eg-check { display: flex; justify-content: center; padding-top: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.select-sm { height: 32px; font-size: 13px; margin-top: 4px; }
.table-compact th, .table-compact td { padding: 8px 10px; font-size: 12.5px; }
.cell-sub.wrap { white-space: normal; max-width: 240px; }
.meta-log { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.meta-log > p { padding: 12px; }
