/* CartRise admin
   Layout: barra superior fixa · coluna de edição com abas à esquerda · prévia ao vivo fixa à direita. */
:root {
  --bg: #f1f1f1;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --fg: #303030;
  --muted: #616161;
  --line: #e3e3e3;
  --primary: #303030;
  --primary-fg: #ffffff;
  --focus: #2c6ecb;
  --selected: #ebf3ff;
  --success: #29845a;
  --success-bg: #e3f8ec;
  --warn-bg: #fff5d6;
  --warn-fg: #6b4c00;
  --critical: #c70a24;
  --stage: #e9e8e4;
  --font: -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 12px;
  --shadow: 0 1px 0 rgba(26, 26, 26, .07), 0 1px 2px rgba(26, 26, 26, .08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1a1a; --surface: #262626; --surface-2: #2f2f2f; --fg: #e8e8e8; --muted: #a8a8a8; --line: #3a3a3a;
    --primary: #f0f0f0; --primary-fg: #1a1a1a; --focus: #6ea2ff; --selected: #22324a; --success: #5fd09a; --success-bg: #173826;
    --warn-bg: #3b3115; --warn-fg: #f2d68a; --critical: #ff7b8a; --stage: #121212;
    --shadow: 0 1px 0 rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1a1a; --surface: #262626; --surface-2: #2f2f2f; --fg: #e8e8e8; --muted: #a8a8a8; --line: #3a3a3a;
  --primary: #f0f0f0; --primary-fg: #1a1a1a; --focus: #6ea2ff; --selected: #22324a; --success: #5fd09a; --success-bg: #173826;
  --warn-bg: #3b3115; --warn-fg: #f2d68a; --critical: #ff7b8a; --stage: #121212;
  --shadow: 0 1px 0 rgba(0, 0, 0, .4); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 13.5px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
.cl-loading { padding: 40px 16px; text-align: center; color: var(--muted); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Barra superior */
.cl-top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.cl-brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.cl-brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: var(--primary-fg); display: grid; place-items: center; flex: none; }
.cl-brand h1 { margin: 0; font-size: 15px; font-weight: 650; white-space: nowrap; }
.cl-status { font-size: 12px; color: var(--muted); }
.cl-status.is-dirty { color: var(--warn-fg); background: var(--warn-bg); padding: 2px 8px; border-radius: 999px; }
.cl-status.is-saved { color: var(--success); }

.cl-btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 8px;
  padding: 6px 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; box-shadow: var(--shadow);
  white-space: nowrap;
}
.cl-btn:hover { background: var(--surface-2); }
.cl-btn:disabled { opacity: .45; cursor: default; }
.cl-btn--primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.cl-btn--primary:hover { background: var(--primary); opacity: .88; }
.cl-btn--plain { border-color: transparent; box-shadow: none; background: none; color: var(--focus); padding: 4px 6px; }
.cl-btn--plain:hover { background: var(--selected); }
.cl-btn--danger { color: var(--critical); }
.cl-btn--sm { padding: 4px 9px; font-size: 12.5px; }

.cl-demo {
  margin: 12px 20px 0; padding: 10px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-fg); font-size: 13px;
}

/* Grade principal */
.cl-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); gap: 20px; padding: 16px 20px 40px; align-items: start; }
.cl-editor { min-width: 0; display: flex; flex-direction: column; gap: 14px; }

/* Abas */
.cl-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; background: var(--surface); padding: 4px; border-radius: 10px; box-shadow: var(--shadow); }
.cl-tabs::-webkit-scrollbar { display: none; }
.cl-tab {
  appearance: none; border: 0; background: none; padding: 7px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--muted);
  white-space: nowrap; display: inline-flex; gap: 6px; align-items: center;
}
.cl-tab:hover { background: var(--surface-2); color: var(--fg); }
.cl-tab[aria-selected="true"] { background: var(--selected); color: var(--fg); }
.cl-tab .cl-count { font-size: 11px; background: var(--line); border-radius: 999px; padding: 0 6px; color: var(--fg); }

/* Cartões e campos */
.cl-card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 14px; transition: box-shadow .15s; }
.cl-card.is-focus { box-shadow: var(--shadow), 0 0 0 2px var(--focus); }
.cl-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cl-card h2 { margin: 0; font-size: 14px; font-weight: 650; text-wrap: balance; }
.cl-card .cl-sub { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; max-width: 60ch; }
.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cl-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cl-field > label, .cl-label { font-weight: 550; font-size: 13px; }
.cl-help { color: var(--muted); font-size: 12px; }
.cl-input, .cl-select, .cl-textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 10px; min-height: 34px;
}
.cl-input:hover, .cl-select:hover { border-color: var(--muted); }
.cl-input:focus, .cl-select:focus, .cl-textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.cl-input--mono { font-family: var(--mono); font-size: 12.5px; }
.cl-textarea { min-height: 64px; resize: vertical; }

.cl-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.cl-check input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.cl-check span { display: flex; flex-direction: column; }

.cl-switch { position: relative; width: 36px; height: 20px; flex: none; }
.cl-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.cl-switch i { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .15s; }
.cl-switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 999px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.cl-switch input:checked + i { background: var(--success); }
.cl-switch input:checked + i::after { transform: translateX(16px); }
.cl-switch input:focus-visible + i { outline: 2px solid var(--focus); outline-offset: 2px; }

.cl-color { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px 3px 3px; background: var(--surface); }
.cl-color input[type="color"] { width: 28px; height: 26px; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 6px; }
.cl-color input[type="text"] { border: 0; background: none; width: 100%; min-width: 0; font-family: var(--mono); font-size: 12.5px; outline: none; }
.cl-range { display: flex; align-items: center; gap: 10px; }
.cl-range input { flex: 1; accent-color: var(--primary); }
.cl-range output { font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; color: var(--muted); }

/* Segmentado */
.cl-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; }
.cl-seg button { appearance: none; border: 0; background: none; padding: 6px 11px; border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--muted); }
.cl-seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }

/* Regras de upsell */
.cl-rules { display: flex; flex-direction: column; gap: 10px; }
.cl-rule { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.cl-rule.is-open { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.cl-rule.is-off .cl-rule-flow { opacity: .55; }
.cl-rule-row { display: flex; align-items: center; gap: 12px; padding: 12px; }
.cl-rule-order { display: flex; flex-direction: column; gap: 2px; }
.cl-rule-order button { appearance: none; border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 4px; line-height: 1; font-size: 11px; }
.cl-rule-order button:disabled { opacity: .25; cursor: default; }
.cl-rule-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cl-rule-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-rule-flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.cl-rule-flow b { color: var(--fg); font-weight: 600; }
.cl-arrow { color: var(--muted); }
.cl-rule-actions { display: flex; align-items: center; gap: 6px; }
.cl-rule-body { border-top: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 16px; }
.cl-step { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; }
.cl-step-n { width: 22px; height: 22px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.cl-step-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); max-width: 100%; }
.cl-chip img, .cl-chip .cl-ph { width: 26px; height: 26px; border-radius: 5px; object-fit: cover; flex: none; background: var(--line); }
.cl-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.cl-chip button { appearance: none; border: 0; background: none; cursor: pointer; color: var(--muted); padding: 2px 5px; border-radius: 5px; font-size: 14px; line-height: 1; }
.cl-chip button:hover { background: var(--line); color: var(--fg); }
.cl-empty-rules { text-align: center; padding: 26px 16px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cl-confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; background: var(--warn-bg); color: var(--warn-fg); border-radius: 8px; }
.cl-pill { font-size: 11.5px; font-weight: 650; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.cl-pill--on { background: var(--success-bg); border-color: transparent; color: var(--success); }
.cl-pill--match { background: var(--selected); border-color: transparent; color: var(--focus); }

/* Níveis de recompensa */
.cl-tier { display: grid; grid-template-columns: 90px minmax(0, 1fr) 150px 32px; gap: 8px; align-items: end; }
.cl-note { padding: 10px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-fg); font-size: 12.5px; }

/* Prévia */
.cl-preview { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 70px); display: flex; flex-direction: column; gap: 10px; }
.cl-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cl-preview-head h2 { margin: 0; font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.cl-live { width: 8px; height: 8px; border-radius: 999px; background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.cl-stage { background: var(--stage); border-radius: var(--r); padding: 14px; display: flex; justify-content: center; }
.cl-device { width: 100%; max-width: 390px; height: min(720px, calc(100vh - 240px)); min-height: 480px; border-radius: 26px; overflow: hidden; background: #fff; box-shadow: 0 0 0 8px #1b1b1b, 0 12px 30px rgba(0,0,0,.25); }
.cl-device--desktop { max-width: 440px; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.15), 0 12px 30px rgba(0,0,0,.18); }
.cl-device iframe { width: 100%; height: 100%; border: 0; display: block; }
.cl-testcart { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.cl-testcart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cl-testcart-head strong { font-size: 12.5px; }
.cl-zone-hint { font-size: 12px; color: var(--muted); min-height: 1.4em; }
.cl-zone-hint b { color: var(--focus); }

/* Seletor (modo demonstração) */
.cl-modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.cl-modal { width: min(520px, 100%); max-height: min(640px, 90vh); background: var(--surface); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.cl-modal header, .cl-modal footer { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cl-modal header { border-bottom: 1px solid var(--line); }
.cl-modal header h3 { margin: 0; font-size: 15px; }
.cl-modal footer { border-top: 1px solid var(--line); justify-content: flex-end; }
.cl-modal-search { padding: 12px 16px 4px; }
.cl-modal-list { overflow-y: auto; padding: 6px 8px 10px; }
.cl-pick { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; }
.cl-pick:hover { background: var(--surface-2); }
.cl-pick img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; }
.cl-pick span { flex: 1; min-width: 0; }
.cl-pick small { display: block; color: var(--muted); }

.cl-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: #1a1a1a; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.cl-toast.is-error { background: var(--critical); }

@media (max-width: 1080px) {
  .cl-main { grid-template-columns: minmax(0, 1fr); }
  .cl-preview { position: static; order: -1; }
  .cl-device { height: 560px; }
}
@media (max-width: 560px) {
  .cl-top, .cl-main { padding-left: 16px; padding-right: 16px; }
  .cl-demo { margin-left: 16px; margin-right: 16px; }
  .cl-tier { grid-template-columns: 70px minmax(0, 1fr) 32px; }
  .cl-tier .cl-tier-gift { grid-column: 1 / -1; }
  .cl-rule-row { flex-wrap: wrap; align-items: flex-start; }
  .cl-rule-main { flex-basis: calc(100% - 40px); }
  .cl-rule-actions { margin-left: 32px; width: 100%; }
  .cl-device { height: 520px; min-height: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* CartRise brand + plan screen */
.cl-brand-mark { background: linear-gradient(135deg, #6d5dfc, #4f46e5); color: #fff; }
.cl-btn--lg { padding: 10px 18px; font-size: 14px; }
.cl-paywall { display: grid; place-items: start center; padding: 32px 16px 48px; }
.cl-paywall-card { width: min(560px, 100%); gap: 14px; }
.cl-paywall-card h2 { margin: 0; font-size: 20px; line-height: 1.25; }
.cl-feats { margin: 4px 0 6px; padding: 0; list-style: none; display: grid; gap: 8px; }
.cl-feats li { position: relative; padding-left: 26px; }
.cl-feats li::before { content: ""; position: absolute; left: 0; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--success-bg); box-shadow: inset 0 0 0 1px var(--success); }
.cl-feats li::after { content: ""; position: absolute; left: 5px; top: 6px; width: 6px; height: 3px; border-left: 2px solid var(--success); border-bottom: 2px solid var(--success); transform: rotate(-45deg); }
.cl-paywall-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Custom code */
.cl-code { font-family: var(--mono); font-size: 12.5px; min-height: 96px; white-space: pre; tab-size: 2; }
.cl-help code { font-family: var(--mono); background: var(--surface-2); padding: 0 4px; border-radius: 4px; }

/* Analytics */
:root { --chart: #4f46e5; --chart-hover: #3730a3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --chart: #8b84ff; --chart-hover: #b3aeff; } }
:root[data-theme="dark"] { --chart: #8b84ff; --chart-hover: #b3aeff; }
.cl-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.cl-stat { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cl-stat-label { font-size: 12px; color: var(--muted); }
.cl-stat-value { font-size: 22px; font-weight: 650; line-height: 1.15; overflow-wrap: anywhere; }
.cl-stat-sub { font-size: 12px; color: var(--muted); }
.cl-chart { position: relative; }
.cl-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.cl-grid-line { stroke: var(--line); stroke-width: 1; }
.cl-axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.cl-bar path { fill: var(--chart); }
.cl-bar.is-hover path { fill: var(--chart-hover); }
.cl-tip { position: absolute; transform: translateX(-50%); background: var(--fg); color: var(--bg); font-size: 12px; padding: 5px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; }
.cl-table-wrap { overflow-x: auto; }
.cl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cl-table th, .cl-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.cl-table th { font-weight: 600; color: var(--muted); font-size: 12px; }
.cl-table .cl-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Dashboard (home) */
.cl-main.is-dash { grid-template-columns: minmax(0, 1fr); max-width: 1120px; margin: 0 auto; }
.cl-main.is-dash .cl-preview { display: none; }
.cl-dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 4px 2px 2px; }
.cl-dash-head h2 { margin: 0 0 2px; font-size: 20px; line-height: 1.25; font-weight: 650; }
.cl-dash-head .cl-sub { margin: 0; }
.cl-stats--hero { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.cl-stat--hero { background: var(--surface); box-shadow: var(--shadow); border-color: transparent; padding: 16px; }
.cl-stat--hero .cl-stat-value { font-size: 26px; }
.cl-stat-sub b { font-weight: 650; }
.cl-up { color: var(--success); }
.cl-down { color: var(--critical); }
.cl-info { position: relative; display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--line); font-size: 10px; font-weight: 650; color: var(--muted); cursor: help; vertical-align: 1px; }
.cl-info::after { content: attr(data-tip-text); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); width: max-content; max-width: 240px; white-space: normal; text-align: left; background: var(--fg); color: var(--bg); font-size: 12px; font-weight: 400; line-height: 1.4; padding: 6px 8px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 5; }
.cl-info:hover::after, .cl-info:focus::after { opacity: 1; }
.cl-seg--wrap { flex-wrap: wrap; }
.cl-dash-note { margin: 0 2px; }
.cl-skel { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.cl-skel i { height: 76px; border-radius: 10px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: cl-shine 1.2s linear infinite; }
@keyframes cl-shine { to { background-position: -200% 0; } }

/* Get started checklist */
.cl-setup { gap: 10px; }
.cl-progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.cl-progress i { display: block; height: 100%; background: var(--chart); border-radius: inherit; transition: width .3s; }
.cl-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cl-step { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--line); }
.cl-step:first-child { border-top: 0; }
.cl-step-dot { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1.5px dashed var(--muted); display: grid; place-items: center; font-size: 12px; font-weight: 650; color: var(--muted); position: relative; }
.cl-step.is-done .cl-step-dot { border: 0; background: var(--success); }
.cl-step.is-done .cl-step-dot::after { content: ""; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-1px) rotate(-45deg); }
.cl-step-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.cl-step-body span { color: var(--muted); font-size: 12.5px; }
.cl-step.is-done .cl-step-body strong { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.cl-step-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cl-step-ok { font-size: 12px; color: var(--success); font-weight: 600; }
@media (max-width: 560px) {
  .cl-step { flex-wrap: wrap; }
  .cl-step-act { width: 100%; justify-content: flex-start; padding-left: 36px; }
}

/* Language toggle */
.cl-lang button { min-width: 38px; font-weight: 600; }

/* First run: welcome + language */
.cl-onb { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: radial-gradient(1200px 500px at 50% -10%, rgba(99, 88, 252, .14), transparent 70%), var(--bg); }
.cl-onb-card { width: min(480px, 100%); padding: 32px 28px 28px; align-items: center; text-align: center; gap: 6px; }
.cl-onb-logo .cl-brand-mark { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 10px 30px rgba(79, 70, 229, .35); }
.cl-onb-logo .cl-brand-mark svg { width: 36px; height: 36px; }
.cl-onb-title { margin: 14px 0 0; font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
.cl-onb-tag { margin: 0; color: var(--muted); font-size: 14px; }
.cl-onb-by { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.cl-onb-by strong { color: var(--fg); font-weight: 600; }
.cl-onb-by a { color: var(--focus); text-decoration: none; }
.cl-onb-by a:hover { text-decoration: underline; }
.cl-onb-hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 18px 0 12px; }
.cl-onb-q { margin: 0 0 8px; font-size: 15px; font-weight: 650; }
.cl-onb-langs { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cl-onb-lang { appearance: none; display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.cl-onb-lang:hover { border-color: var(--muted); }
.cl-onb-lang[aria-checked="true"] { border-color: var(--chart); box-shadow: 0 0 0 1px var(--chart); background: var(--selected); }
.cl-onb-lang strong { display: block; font-size: 14px; }
.cl-onb-lang small { display: block; color: var(--muted); font-size: 12px; }
.cl-onb-code { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; font-size: 12px; letter-spacing: .04em; }
.cl-onb-lang[aria-checked="true"] .cl-onb-code { background: var(--chart); color: #fff; }
.cl-onb .cl-help { margin: 8px 0 4px; }
.cl-onb-go { width: 100%; margin-top: 6px; justify-content: center; text-align: center; }
@media (max-width: 400px) { .cl-onb-langs { grid-template-columns: 1fr; } }

@media (max-width: 700px) { .cl-card-head:has(.cl-seg--wrap) { flex-direction: column; } }
@media (max-width: 560px) { .cl-stats:not(.cl-stats--hero) { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cl-stat-value { font-size: 19px; } }
.cl-btn--icon { padding: 6px 8px; }
:root[data-theme="dark"] .cl-onb { background: radial-gradient(1200px 500px at 50% -10%, rgba(139, 132, 255, .18), transparent 70%), var(--bg); }
:root[data-theme="dark"] .cl-stat--hero { border-color: var(--line); }

/* ===== Dashboard: futuristic layer ===== */
:root { --accent2: #0891b2; --glow: rgba(79, 70, 229, .16); --up-bg: rgba(41, 132, 90, .12); --down-bg: rgba(199, 10, 36, .1); --edge: rgba(79, 70, 229, .45); }
:root[data-theme="dark"] { --accent2: #22d3ee; --glow: rgba(139, 132, 255, .22); --up-bg: rgba(95, 208, 154, .14); --down-bg: rgba(255, 123, 138, .14); --edge: rgba(139, 132, 255, .7); }
.cl-stat-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cl-stat-value { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.cl-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 650; padding: 2px 7px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cl-delta i { font-style: normal; font-size: 11px; }
.cl-delta.is-up { color: var(--success); background: var(--up-bg); }
.cl-delta.is-down { color: var(--critical); background: var(--down-bg); }
.cl-delta.is-flat { color: var(--muted); background: var(--surface-2); }
.cl-compare { margin: -4px 2px 0; }

.cl-main.is-dash { position: relative; }
:root[data-theme="dark"] .cl-main.is-dash::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 520px; pointer-events: none; z-index: 0;
  background:
    radial-gradient(700px 260px at 20% 0%, rgba(139, 132, 255, .13), transparent 70%),
    radial-gradient(600px 240px at 85% 10%, rgba(34, 211, 238, .08), transparent 70%),
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px) 0 0 / 32px 100%;
  -webkit-mask-image: linear-gradient(#000 40%, transparent); mask-image: linear-gradient(#000 40%, transparent);
}
.cl-main.is-dash > * { position: relative; z-index: 1; }
:root[data-theme="dark"] .is-dash .cl-card { border: 1px solid rgba(255, 255, 255, .06); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }

.cl-stat--hero {
  position: relative; overflow: hidden; padding: 16px 16px 0; gap: 6px;
  border: 1px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
              linear-gradient(135deg, var(--edge), rgba(34, 211, 238, .35) 45%, var(--line) 80%) border-box;
  box-shadow: 0 0 0 1px transparent, 0 10px 30px -12px var(--glow);
}
:root[data-theme="dark"] .cl-stat--hero { border-color: transparent; }
.cl-stat--hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(var(--glow), transparent 70%); pointer-events: none; }
.cl-stat--hero .cl-stat-label { text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-weight: 600; }
.cl-stat--hero .cl-stat-value { font-size: 28px; }
.cl-spark { display: block; width: calc(100% + 32px); height: 34px; margin: 6px -16px 0; }
.cl-spark-line { fill: none; stroke: var(--chart); stroke-width: 1.8; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.cl-spark-area { fill: var(--glow); }

.cl-grad-a { stop-color: var(--chart); }
.cl-grad-b { stop-color: var(--chart); stop-opacity: .35; }
.cl-bar path { fill: url(#cl-bar-grad); }
.cl-bar.is-hover path { fill: var(--accent2); }
.cl-avg-line { stroke: var(--accent2); stroke-width: 1.2; stroke-dasharray: 4 4; }
.cl-avg-label { fill: var(--accent2); font-size: 11px; font-weight: 650; font-family: var(--font); paint-order: stroke; stroke: var(--surface); stroke-width: 5px; stroke-linejoin: round; }

/* Top products: table on desktop, cards on phones */
.cl-pcards { display: none; flex-direction: column; gap: 8px; }
.cl-pcard { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; }
.cl-pcard-rank { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: var(--chart); background: var(--glow); }
.cl-pcard-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-pcard-val { font-weight: 650; font-variant-numeric: tabular-nums; }
.cl-pcard-meta { grid-column: 1 / -1; display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.cl-pcard-meta b { color: var(--fg); font-weight: 600; }
.cl-pcard-bar { grid-column: 1 / -1; height: 4px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.cl-pcard-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--chart), var(--accent2)); }
@media (max-width: 640px) {
  .cl-table-wrap { display: none; }
  .cl-pcards { display: flex; }
}

.cl-wait { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.cl-wait i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--chart); animation: cl-spin .8s linear infinite; }
@keyframes cl-spin { to { transform: rotate(360deg); } }
