/* TNB Discounts admin: TNB Tracking's stylesheet (apps/tnb-tracking/admin/src/admin.css, the same look in every TNB app),
   plus the few rules this app adds at the end. */
:root {
  /* Elevar's palette, measured on app.getelevar.com: grey-blue page, white cards with a faint shadow, indigo actions,
     solid green "Live" pills, Inter at 14/24. */
  --bg: #eff2f5; --surface: #fff; --surface-2: #f4f6f8; --border: #dfe3e8; --border-strong: #c4cdd5;
  --text: #212b36; --body: #454f5a; --muted: #647380; --faint: #929eaa; --accent: #5f5ce7; --accent-soft: rgba(95,92,231,.08); --focus: #5f5ce7;
  --primary: #5f5ce7; --primary-hover: #4e4bd6; --critical: #de3618; --critical-bg: #fbeae5;
  --success: #3f9c2a; --success-bg: #e3f8dc; --live: #56d138; --info: #4b82fb; --info-bg: #ebf1ff; --warn: #8a6116; --warn-bg: #fdf3dc; --shadow-tone: #f49342;
  --radius: 4px; --radius-sm: 4px; --shadow: 0 2px 6px rgba(33,43,54,.04), 0 0 0 1px rgba(33,43,54,.02);
  --flow-live: #56d138; --flow-shadow: #f49342; --flow-idle: #c4cdd5; --series-meta: #5f5ce7; --series-ga4: #47c1bf;
  --font: Inter, -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--body); font: 400 14px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 24px; line-height: 32px; font-weight: 600; color: var(--text); letter-spacing: -.2px; }
h2 { font-size: 16px; line-height: 24px; font-weight: 600; color: var(--text); }
h3 { font-size: 14px; font-weight: 600; color: var(--text); }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; line-height: 16px; } .strong { font-weight: 600; color: var(--text); }
.nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.grow { flex: 1 1 0; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .row.top { align-items: flex-start; } .row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; } .stack.tight { gap: 6px; } .stack.loose { gap: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hidden { display: none !important; }

/* Standalone shell (outside Shopify; inside, Shopify's own sidebar lists the same pages): Elevar's white sidebar with
   grouped links and line icons, the page to its right. */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
@media (min-width: 901px) { .shell { background: linear-gradient(to right, #fff 263px, var(--border) 263px, var(--border) 264px, var(--bg) 264px); } }
.shell-main, .step-content { min-width: 0; }
.sidebar { background: #fff; border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.sidebar .brand-mark { width: 36px; height: 36px; display: block; flex: none; }
.app-mark { display: block; }
.sidebar .brand-name { font-weight: 600; color: var(--text); line-height: 20px; } .sidebar .brand-sub { font-size: 12px; color: var(--muted); line-height: 16px; }
.sidebar nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar .nav-group { font-size: 12px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 20px 12px 8px; }
.sidebar a { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius); color: var(--body); font-size: 15px; text-decoration: none !important; }
.sidebar a svg { color: var(--muted); } .sidebar a:hover { background: var(--surface-2); }
.sidebar a.active { background: var(--accent-soft); color: var(--info); } .sidebar a.active svg { color: var(--info); }
.sidebar .nav-foot { padding: 12px; border-top: 1px solid var(--border); }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 8px 12px; }
  .sidebar .nav-group, .sidebar .nav-foot, .sidebar .brand-sub { display: none; }
  .sidebar a { white-space: nowrap; font-size: 14px; }
  .page { padding: 20px 16px 64px; }
}

/* Page */
.page { max-width: 1040px; margin: 0; padding: 32px 40px 80px; }
.shell .page { max-width: 1240px; } .shell .page.narrow { max-width: 860px; }
.page.narrow { max-width: 760px; } .page.wide { max-width: 1280px; }
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header .titles { flex: 1 1 320px; min-width: 0; } .page-header .sub { color: var(--muted); margin-top: 4px; }
.page-header .head-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--muted); }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 24px; }
.grid2 > .card + .card, .grid3 > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 24px 32px 0; }
.card-head h2 { flex: 1; }
.card-body { padding: 16px 32px 28px; }
.card-section { padding: 20px 32px; border-top: 1px solid var(--border); }
.divider { height: 1px; background: var(--border); margin: 12px 0; border: 0; }

/* Buttons (Elevar: indigo primary, white secondary with a grey border, soft indigo for quiet actions) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none !important; color: var(--text); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); } .btn:active { background: #e6eaee; }
.btn:focus-visible, .input:focus-visible, .select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; } .btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); } .btn.soft:hover { background: rgba(95,92,231,.14); }
.btn.critical { background: var(--critical); border-color: var(--critical); color: #fff; } .btn.critical:hover { background: #c22e12; }
.btn.plain { background: none; border-color: transparent; color: var(--accent); padding: 0 6px; } .btn.plain:hover { background: var(--accent-soft); }
.btn.ghost { background: none; border-color: transparent; } .btn.ghost:hover { background: rgba(33,43,54,.06); }
.btn.icon { padding: 0; min-width: 36px; } .btn.sm { min-height: 28px; padding: 0 10px; font-size: 13px; } .btn.lg { min-height: 40px; padding: 0 20px; }
.btn[disabled] { opacity: .5; cursor: default; pointer-events: none; }
.btn.block { width: 100%; }
.btn svg { flex: none; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .label { font-size: 14px; font-weight: 500; color: var(--text); }
.field .hint { color: var(--muted); font-size: 12px; } .field .err { color: var(--critical); font-size: 12px; }
.input, .select, textarea.input { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; color: var(--text); }
.input:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 64px; line-height: 1.4; }
.select { appearance: none; padding-right: 28px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23647380' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m4.5 6.5 3.5 3.5 3.5-3.5'/%3E%3C/svg%3E") no-repeat right 8px center; cursor: pointer; }
.input.sm, .select.sm { min-height: 28px; padding: 3px 8px; font-size: 12px; } .select.sm { padding-right: 24px; background-position: right 5px center; }
.input-wrap { position: relative; display: flex; align-items: center; } .input-wrap .affix { position: absolute; right: 10px; color: var(--muted); pointer-events: none; font-size: 12px; } .input-wrap .input { padding-right: 34px; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; } .check input { margin: 4px 0 0; width: 16px; height: 16px; accent-color: var(--accent); }
.toggle { position: relative; width: 36px; height: 20px; border-radius: 10px; background: #c4cdd5; border: 0; cursor: pointer; flex: none; transition: background .15s; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle.on { background: var(--accent); } .toggle.on::after { transform: translateX(16px); }
/* Elevar's tick box (Toggle box) */
.tick { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border-radius: 3px; border: 1.5px solid var(--border-strong); background: #fff; color: #fff; cursor: pointer; vertical-align: middle; }
.tick.on { background: var(--accent); border-color: var(--accent); } .tick:hover { border-color: var(--accent); } .tick:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.web-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; } .web-tag svg { color: var(--accent); }
/* Radio choices (Events: recommended or custom) */
.choice-list { display: flex; flex-direction: column; gap: 4px; padding: 0 32px 16px; }
.choice { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 15px; color: var(--text); cursor: pointer; }
.choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.tag-ok { padding: 2px 10px; border-radius: var(--radius); background: var(--success-bg); color: var(--success); font-size: 14px; font-weight: 500; }
.toggle.lg { width: 52px; height: 28px; border-radius: 14px; } .toggle.lg::after { width: 22px; height: 22px; top: 3px; left: 3px; } .toggle.lg.on::after { transform: translateX(24px); }
.segmented { display: inline-flex; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 3px; gap: 2px; }
.segmented button { border: 0; background: none; padding: 5px 12px; border-radius: 3px; cursor: pointer; font-weight: 500; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); white-space: nowrap; }
.segmented button.on { background: var(--accent-soft); color: var(--accent); }
.segmented.block { display: flex; } .segmented.block button { flex: 1; justify-content: center; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; min-height: 40px; cursor: text; }
.tags input { border: 0; outline: 0; background: none; flex: 1; min-width: 90px; padding: 2px 4px; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 4px 2px 8px; font-size: 13px; color: var(--text); }
.tag button { border: 0; background: none; cursor: pointer; padding: 0 2px; color: var(--muted); font-size: 14px; line-height: 1; }

/* Badges, banners */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius); font-size: 12px; line-height: 16px; font-weight: 500; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.success { background: var(--success-bg); color: var(--success); } .badge.info { background: var(--info-bg); color: var(--info); }
.table tr.row-critical td { background: var(--critical-bg); } .text-critical { color: var(--critical); }
.badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.critical { background: var(--critical-bg); color: var(--critical); }
/* Status pills as Elevar draws them: solid, white text, a check for Live. */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: var(--radius); font-size: 14px; line-height: 20px; font-weight: 500; color: #fff; background: var(--faint); white-space: nowrap; }
.pill.live { background: var(--live); } .pill.shadow { background: var(--shadow-tone); } .pill.off, .pill.planned { background: #919eab; } .pill.sm { font-size: 12px; line-height: 16px; padding: 2px 8px 2px 6px; }
.banner { display: flex; gap: 12px; padding: 16px 20px; border-radius: var(--radius); background: var(--info-bg); color: var(--text); margin-bottom: 24px; align-items: flex-start; border-left: 3px solid var(--info); }
.banner.critical { background: var(--critical-bg); border-left-color: var(--critical); } .banner.warn { background: var(--warn-bg); border-left-color: var(--shadow-tone); } .banner.success { background: var(--success-bg); border-left-color: var(--live); }
.banner .grow > strong { display: block; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 8px; background: #fff; box-shadow: var(--shadow); font-size: 12px; font-weight: 550; }
.chip.dark { background: #1f3a5f; color: #fff; }

/* Overlays */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow: auto; }
.modal { background: #fff; border-radius: 6px; width: 100%; max-width: 620px; box-shadow: 0 20px 40px rgba(0,0,0,.25); display: flex; flex-direction: column; max-height: 90vh; }
.modal.lg { max-width: 980px; } .modal.sm { max-width: 440px; }
.modal-head { display: flex; align-items: center; padding: 16px 24px; background: #fff; border-radius: 6px 6px 0 0; border-bottom: 1px solid var(--border); }
.modal-head h2 { flex: 1; }
.modal-body { padding: 16px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.menu-wrap { position: relative; display: inline-flex; }
.menu { position: fixed; z-index: 60; background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.06); padding: 6px; min-width: 200px; max-height: 60vh; overflow: auto; }
.menu button { display: flex; width: 100%; gap: 8px; align-items: flex-start; text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: #f1f1f1; } .menu button.critical { color: var(--critical); } .menu button[disabled] { opacity: .45; pointer-events: none; }
.menu .menu-group { padding: 6px 8px 2px; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.menu .desc { display: block; color: var(--muted); font-size: 12px; font-weight: 450; }
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--text); color: #fff; padding: 10px 16px; border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.3); font-weight: 550; } .toast.error { background: #8e1f0b; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-pad { display: flex; align-items: center; justify-content: center; padding: 60px 20px; flex-direction: column; gap: 10px; text-align: center; color: var(--muted); }
.tabs { display: flex; gap: 32px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tabs button, .tabs a { border: 0; background: none; padding: 10px 0; cursor: pointer; font-weight: 500; font-size: 15px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none !important; }
.tabs button.on, .tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
table.table { width: 100%; border-collapse: collapse; }
/* Number, status and switch columns: the heading centred over its values. */
.table th.num, .table td.num { text-align: center; } .table th { text-align: left; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text); padding: 14px 16px; background: none; border-bottom: 1px solid var(--border); vertical-align: bottom; }
.table th .faint, .table th .muted { font-weight: 400; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--body); } .table tr:last-child td { border-bottom: 0; } .table tr.click:hover td { background: var(--surface-2); cursor: pointer; }
.card > .table th:first-child, .card > .scroll-x > .table th:first-child, .card > .table td:first-child, .card > .scroll-x > .table td:first-child { padding-left: 32px; }
.card > .table th:last-child, .card > .scroll-x > .table th:last-child, .card > .table td:last-child, .card > .scroll-x > .table td:last-child { padding-right: 32px; }

/* Campaigns */
.shortcuts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.shortcut { display: block; padding: 14px 16px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none !important; }
.shortcut:hover { background: #fafafa; } .shortcut .t { font-weight: 650; font-size: 14px; margin-top: 8px; } .shortcut .d { color: var(--muted); font-size: 12px; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; } .filters .input { max-width: 240px; } .filters .select { width: auto; }
.campaign { padding: 16px; } .campaign-head { display: flex; gap: 12px; align-items: center; }
.campaign-head .name { font-size: 15px; font-weight: 650; } .campaign-head .id { color: var(--faint); font-weight: 450; margin-left: 6px; }
.targeting-link { border: 0; background: none; padding: 0; cursor: pointer; border-bottom: 1px dashed #b5b5b5; color: var(--text); text-align: left; }
.popup-row { display: flex; gap: 14px; align-items: center; padding: 12px; background: var(--surface-2); border-radius: 10px; margin-top: 8px; }
.popup-row .thumb { width: 150px; height: 84px; border-radius: 8px; overflow: hidden; background: #e3e3e3; flex: none; position: relative; }
.popup-row .thumb iframe { border: 0; position: absolute; top: 0; left: 0; transform-origin: 0 0; pointer-events: none; }
.traffic { width: 92px; flex: none; text-align: right; color: var(--muted); font-size: 12px; } .traffic b { color: var(--text); font-size: 13px; }
.section-label { font-size: 13px; font-weight: 650; margin-top: 16px; display: flex; align-items: center; gap: 8px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tpl { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; background: #fff; text-align: left; padding: 0; display: flex; flex-direction: column; }
.tpl:hover, .tpl.on { border-color: #303030; box-shadow: 0 0 0 1px #303030; }
/* Brand theme sample: the device-sized preview frame is scaled from its top left corner to fit the box. */
.theme-sample { position: relative; overflow: hidden; border-radius: 8px; background: #ececec; max-width: 100%; } .theme-sample iframe { border: 0; position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.tpl .thumb { height: 150px; position: relative; overflow: hidden; background: #ececec; } .tpl .thumb iframe { border: 0; position: absolute; top: 0; left: 0; transform-origin: 0 0; pointer-events: none; }
.tpl-open { display: block; width: 100%; border: 0; padding: 0; background: none; cursor: pointer; text-align: left; position: relative; }
.tpl-open-hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: #303030; color: #fff; font-weight: 600; font-size: 12px; padding: 5px 12px; border-radius: 8px; opacity: 0; transition: opacity .12s; white-space: nowrap; }
.tpl-open:hover .tpl-open-hint, .tpl-open:focus-visible .tpl-open-hint { opacity: 1; }
.tpl-detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; min-height: min(620px, 68vh); }
.tpl-stage { background: #f1f1f1; border-radius: 10px; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.tpl-stage .stage { min-height: min(520px, 56vh); }
@media (max-width: 760px) { .tpl-detail { grid-template-columns: 1fr; } }
.tpl .meta { padding: 8px 10px; } .tpl .meta .t { font-weight: 650; } .tpl .meta .d { color: var(--muted); font-size: 12px; }

/* Rule builder */
.rule-group { border-left: 2px solid var(--border); padding-left: 12px; margin-left: 6px; display: flex; flex-direction: column; gap: 8px; }
.rule-op { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; }
.cond { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; } .cond .select, .cond .input { width: auto; min-width: 120px; } .cond .tags { min-width: 220px; flex: 1; }
.cond .x { margin-top: 2px; }

/* Editor */
.ed { display: grid; grid-template-columns: 300px minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr); height: 100vh; background: #fafafa; }
.ed.embedded { height: 100vh; }
.ed-top { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--border); min-width: 0; }
.ed-title { min-width: 0; max-width: 210px; } .ed-title .n { font-weight: 700; font-size: 14px; display: flex; gap: 6px; align-items: center; } .ed-title .s { color: var(--muted); font-size: 11px; }
.stepbar { display: flex; gap: 6px; align-items: center; flex: 0 1 auto; min-width: 0; overflow-x: auto; padding: 2px; scrollbar-width: thin; }
.step-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; background: #fff; box-shadow: var(--shadow); cursor: pointer; border: 0; font-weight: 550; white-space: nowrap; }
.step-chip .num { color: var(--faint); font-weight: 450; } .step-chip.on { background: #303030; color: #fff; } .step-chip.on .num { color: #b5b5b5; }
.stepbar .sep { width: 1px; height: 20px; background: var(--border); flex: none; }
.ed-left, .ed-right { background: #fff; overflow-y: auto; min-height: 0; } .ed-left { border-right: 1px solid var(--border); } .ed-right { border-left: 1px solid var(--border); }
.ed-pane { padding: 12px; display: flex; flex-direction: column; gap: 14px; }
.ed-center { position: relative; overflow: hidden; min-height: 0; display: flex; flex-direction: column; }
.ed-center .bar { display: flex; align-items: center; gap: 8px; row-gap: 6px; padding: 8px 12px; justify-content: center; flex-wrap: wrap; }
.ed-center .bar > * { flex: none; white-space: nowrap; }
.stage { flex: 1; position: relative; min-height: 0; }
.device { position: absolute; top: 50%; left: 50%; transform-origin: 0 0; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.14); border-radius: 6px; overflow: hidden; }
.device iframe { border: 0; width: 100%; height: 100%; display: block; }
.pane-title { font-weight: 650; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.pane-title .grow { font-weight: 650; }
.group { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.group > .group-head { display: flex; align-items: center; gap: 6px; font-weight: 650; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; width: 100%; }
.group > .group-head .grow { font-weight: 650; }
.layer { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 8px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; min-width: 0; }
.layer:hover { background: #f3f3f3; } .layer.on { background: #ebebeb; font-weight: 650; }
.layer .acts { display: none; gap: 0; margin-left: auto; flex: none; } .layer:hover .acts, .layer.on .acts { display: inline-flex; }
.layer .acts button { border: 0; background: none; cursor: pointer; padding: 2px; border-radius: 4px; color: var(--muted); display: inline-flex; } .layer .acts button:hover { background: #d9d9d9; color: var(--text); }
.layer-kids { margin-left: 14px; border-left: 1px solid var(--border); padding-left: 4px; }
.swatch-row { display: flex; align-items: center; gap: 10px; }
.swatch { width: 32px; height: 32px; border-radius: 8px; border: 1px solid rgba(0,0,0,.15); flex: none; cursor: pointer; padding: 0; background-clip: padding-box; position: relative; overflow: hidden; }
.swatch.sm { width: 22px; height: 22px; border-radius: 6px; }
.swatch input[type=color] { position: absolute; inset: -4px; width: 150%; height: 150%; opacity: 0; cursor: pointer; }
.color-pop { position: fixed; z-index: 70; background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.06); padding: 10px; width: 250px; display: flex; flex-direction: column; gap: 8px; }
.color-name { display: flex; align-items: center; text-align: left; cursor: pointer; min-width: 0; }
.color-pop .sw-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.kv { display: grid; grid-template-columns: 1fr 1fr auto; gap: 4px; align-items: center; }
.action-row { background: var(--surface-2); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.trigger { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.trigger .t { font-weight: 650; } .trigger .d { color: var(--muted); font-size: 12px; }
.cap { font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.img-grid button { border: 1px solid var(--border); border-radius: 8px; background: #f3f3f3 center/contain no-repeat; height: 100px; cursor: pointer; padding: 0; } .img-grid button:hover { border-color: #303030; }
.drop { border: 1.5px dashed #b5b5b5; border-radius: 10px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; background: #fafafa; } .drop.over { border-color: var(--focus); background: var(--info-bg); }
.img-preview { width: 100%; height: 110px; border-radius: 8px; background: #f3f3f3 center/contain no-repeat; border: 1px solid var(--border); }
.stat { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 110px; } .stat .v { font-size: 20px; font-weight: 700; } .stat .l { color: var(--muted); font-size: 12px; }
@media (max-width: 900px) { .shortcuts { grid-template-columns: repeat(2, 1fr); } .ed { grid-template-columns: 240px minmax(0, 1fr) 280px; } }
/* TNB Tracking: request/response and code blocks */
pre.code { margin: 6px 0 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all; max-height: 420px; overflow: auto; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.segmented.lang { width: auto; } .segmented.lang button { min-width: 36px; padding-inline: 8px; font-size: 12px; }

/* Wide tables scroll inside their card; a short note under a flush card's title. */
.scroll-x { overflow-x: auto; }
.card-note { margin: 0; padding: 4px 32px 16px; color: var(--muted); }

/* Page engagement: the summary figures and the time-in-view bar of each section. */
.eng-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 16px; }
.eng-stats > div { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.eng-stats b { font-size: 22px; line-height: 28px; font-weight: 600; color: var(--text); } .eng-stats span { color: var(--muted); font-size: 12px; }
.eng-bar { height: 8px; background: #eef1f5; border-radius: 4px; overflow: hidden; margin-bottom: 2px; }
.eng-bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* Freshness ("Last event received 2 min ago") in the header's right side, plain text as Elevar has it; only the dot
   carries the tone. */
.fresh { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-right: 8px; white-space: nowrap; }
.fresh .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.fresh.ok .dot { background: var(--live); } .fresh.warn .dot { background: var(--shadow-tone); } .fresh.bad .dot { background: var(--critical); }
.fresh.bad { color: var(--critical); }
/* Page header pieces */
.back-link { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; margin-bottom: 12px; color: var(--text); font-size: 14px; cursor: pointer; }
.back-link svg { transform: rotate(180deg); padding: 3px; box-sizing: content-box; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.page-title { display: flex; align-items: center; gap: 12px; }
.head-actions { gap: 12px; flex-wrap: wrap; justify-content: flex-end; }

/* Overview diagram, as Elevar's My Tracking: white cards on the page background, an indigo hub with a lavender ring,
   right-angled connectors (green live, orange shadow, grey dashed off or planned). */
.flow-section { margin-bottom: 32px; }
.flow { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 190px minmax(0, 1fr); gap: 0 48px; align-items: start; }
.flow-col { display: flex; flex-direction: column; gap: 16px; position: relative; z-index: 1; }
.flow-col-title { display: flex; align-items: center; gap: 8px; height: 40px; font-size: 14px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--text); }
.flow-hint { display: inline-flex; color: var(--muted); cursor: help; }
.flow-wires { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; overflow: visible; }
.wire { fill: none; stroke-width: 1.5; } .wire.live { stroke: var(--flow-live); } .wire.shadow { stroke: var(--flow-shadow); }
.wire.off, .wire.planned { stroke: var(--flow-idle); stroke-dasharray: 5 5; }
.flow-node { display: flex; flex-direction: column; gap: 10px; padding: 24px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--body); text-decoration: none !important; border: 1px solid transparent; transition: border-color .12s, box-shadow .12s; }
a.flow-node:hover { border-color: rgba(95,92,231,.35); box-shadow: 0 4px 12px rgba(33,43,54,.08); }
a.flow-node:focus-visible, a.flow-hub:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.flow-node.planned, .flow-node.off { background: rgba(255,255,255,.6); border: 1px dashed var(--border-strong); box-shadow: none; }
.flow-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flow-name { display: inline-flex; align-items: center; gap: 16px; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--text); min-width: 0; }
.brand-mark-svg, .brand-mark-line { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; }
.brand-mark-line { color: var(--accent); }
.flow-sub { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 12px; padding-left: 44px; font-size: 15px; color: var(--body); }
.flow-extra { color: var(--faint); }
.flow-figure { padding-left: 44px; font-size: 13px; color: var(--muted); } .flow-figure.bad { color: var(--critical); font-weight: 500; }
.flow-hub-slot { z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 40px; }
.flow-hub { display: grid; place-items: center; width: 118px; height: 118px; border-radius: 50%; background: #fff; text-decoration: none !important; box-shadow: 0 0 0 12px #eedfd8; margin: 12px 0; }
.flow-hub-logo { width: 80%; height: auto; display: block; }
.flow-hub.off { box-shadow: 0 0 0 12px #e4e8ec; } .flow-hub.off .flow-hub-logo { filter: grayscale(1); opacity: .6; }
.flow-hub-caption { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; font-size: 13px; color: var(--muted); }
.flow-hub-caption b { color: var(--text); font-size: 14px; font-weight: 600; }
.flow-hub-caption.shadow span { color: var(--shadow-tone); font-weight: 500; } .flow-hub-caption.live span { color: var(--success); font-weight: 500; }
.flow-legend { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-top: 20px; color: var(--muted); font-size: 13px; }
.flow-legend i { display: inline-block; width: 24px; border-top: 2px solid; vertical-align: middle; margin-right: 8px; }
.flow-legend i.live { border-color: var(--flow-live); } .flow-legend i.shadow { border-color: var(--flow-shadow); } .flow-legend i.off { border-color: var(--flow-idle); border-top-style: dashed; }
@media (max-width: 1100px) { .flow { grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr); gap: 0 28px; } .flow-node { padding: 18px; } .flow-sub, .flow-figure { padding-left: 0; } }
@media (max-width: 760px) {
  .flow { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .flow-wires { display: none; }
  .flow-hub-slot { flex-direction: row; justify-content: flex-start; padding: 0 !important; gap: 16px; }
  .flow-hub { width: 64px; height: 64px; box-shadow: 0 0 0 6px #eedfd8; margin: 6px; }
  .flow-hub-caption { align-items: flex-start; text-align: left; }
}

/* Destination pages, as Elevar's: "Back", the brand mark and name, history and log links and the status pill in the
   header; a "Setup steps" card on the left whose checks are joined by an indigo line, the chosen step on the right. */
.dest-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; color: var(--muted); }
.dest-summary b { color: var(--text); font-weight: 600; }
.link-action { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 15px; font-weight: 500; text-decoration: none !important; }
.link-action:hover { color: var(--primary-hover); }
.steps-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 32px; align-items: start; }
.step-list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 16px; position: sticky; top: 24px; }
.step-list-head { display: flex; justify-content: space-between; align-items: center; padding: 0 16px 16px; font-size: 18px; font-weight: 600; color: var(--text); }
.step-progress { font-size: 16px; font-weight: 500; color: var(--faint); }
.step-list ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.step-list li { position: relative; }
/* The line joining one step's mark to the next. */
.step-list li + li::before { content: ""; position: absolute; left: 30px; top: -22px; height: 44px; width: 2px; background: var(--border); z-index: 0; }
.step-list li.done + li::before { background: var(--accent); }
.step-item { position: relative; z-index: 1; display: flex; align-items: center; gap: 16px; width: 100%; min-height: 56px; padding: 8px 14px; border: 0; border-radius: var(--radius); background: none; text-align: left; cursor: pointer; font-size: 16px; font-weight: 500; color: var(--text); }
.step-item:hover { background: var(--surface-2); } .step-item.on { background: #f1f3f6; }
.step-item:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.step-mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-strong); background: #fff; color: var(--muted); font-size: 13px; font-weight: 600; flex: none; }
.step-item.done .step-mark { background: var(--accent); border-color: var(--accent); color: #fff; }
.step-text .muted { font-weight: 400; }
.step-help { display: flex; align-items: center; gap: 12px; margin: 16px 16px 0; padding-top: 20px; border-top: 1px solid var(--border); color: var(--body); }
.step-body { display: flex; flex-direction: column; gap: 24px; } .step-body > * { margin: 0 !important; }
.step-panel { min-width: 0; }
.step-panel > .card, .step-panel .step-body > .card { margin-top: 0; }
.step-panel .card + .card { margin-top: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 1100px) { .steps-layout { grid-template-columns: 280px minmax(0, 1fr); gap: 24px; } }
@media (max-width: 760px) {
  .steps-layout { grid-template-columns: minmax(0, 1fr); }
  .step-list { position: static; padding: 12px 8px; }
  .step-list ol { flex-direction: row; flex-wrap: wrap; } .step-list li + li::before { display: none; }
  .step-item { width: auto; min-height: 40px; font-size: 14px; }
}

/* Accuracy chart: lines per destination, a dashed goal line, axes in the muted text colour. */
.chart { width: 100%; min-width: 0; } .chart svg { display: block; max-width: 100%; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; } .chart-axis.goal { fill: var(--success); font-weight: 500; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.chart-goal { stroke: var(--live); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart-line { fill: none; stroke-width: 2.25; stroke-linejoin: round; } .chart-line.meta { stroke: var(--series-meta); } .chart-line.ga4 { stroke: var(--series-ga4); }
.chart-pt.meta { fill: var(--series-meta); stroke: var(--surface); stroke-width: 1.5; } .chart-pt.ga4 { fill: var(--series-ga4); stroke: var(--surface); stroke-width: 1.5; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.swatch-line { display: inline-block; width: 22px; border-top: 2.5px solid; margin-right: 6px; vertical-align: middle; }
.swatch-line.meta { border-color: var(--series-meta); } .swatch-line.ga4 { border-color: var(--series-ga4); } .swatch-line.goal { border-color: var(--live); border-top-style: dashed; border-top-width: 1.5px; }

/* Server events log matrix: the Shopify baseline row, then one row per destination; red where a cell has failures. */
.matrix th, .matrix td { text-align: center; vertical-align: middle; padding: 8px 10px; }
.matrix thead th { font-size: 12px; line-height: 1.25; }
.matrix tbody th { text-align: left; font-weight: 650; white-space: nowrap; }
.mx-sub { display: block; color: var(--muted); font-size: 11px; font-weight: 450; }
.mx-na { color: var(--faint); } .mx-base b { font-size: 15px; } .mx-zero b { color: var(--faint); font-weight: 500; }
.mx-cell { padding: 0 !important; }
.mx-cell button { display: block; width: 100%; min-height: 48px; padding: 8px 10px; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; }
.mx-cell button:hover { background: #f3f3f3; } .mx-cell button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.mx-cell b { font-size: 15px; }
.mx-bad { background: var(--critical-bg); } .mx-bad button:hover { background: #fbd9d3; } .mx-bad .mx-sub { color: var(--critical); }
.mx-on { box-shadow: inset 0 0 0 2px var(--text); }

/* Settings history: the changed fields of one save, one per line. */
.hist-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.hist-items code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* Order sources pivot: the totals row closes the table. */
.pivot-total td { border-top: 2px solid var(--border-strong, var(--border)); background: var(--surface-2); }

/* Destination connection: "Access token: [set] note" on one line, the note wrapping under itself. */
.secret-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: baseline; gap: 4px 10px; }
.secret-label { white-space: nowrap; font-weight: 500; color: var(--text); }

/* Phones: one column, tighter card padding (Elevar's 32px gutters are for desktop). */
@media (max-width: 760px) {
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .grid2 > .card + .card, .grid3 > .card + .card { margin-top: 16px; }
  .card-head { padding: 18px 18px 0; } .card-body { padding: 14px 18px 20px; } .card-section { padding: 16px 18px; } .card-note { padding: 4px 18px 12px; }
  .card > .table th:first-child, .card > .scroll-x > .table th:first-child, .card > .table td:first-child, .card > .scroll-x > .table td:first-child { padding-left: 18px; }
  .card > .table th:last-child, .card > .scroll-x > .table th:last-child, .card > .table td:last-child, .card > .scroll-x > .table td:last-child { padding-right: 18px; }
  .table th, .table td { padding: 12px 10px; }
  .choice-list { padding: 0 18px 12px; }
  h1 { font-size: 21px; line-height: 28px; }
  .page-header { margin-bottom: 16px; } .head-actions { justify-content: flex-start; }
}

/* ---- TNB Discounts additions ---------------------------------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi .l { color: var(--muted); font-size: 13px; } .kpi .v { font-size: 24px; line-height: 32px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; } .kpi .s { color: var(--faint); font-size: 12px; line-height: 16px; }
.funnel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.funnel-step { padding: 4px 24px; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; } .funnel-step:first-child { border-left: 0; padding-left: 0; }
.funnel-step .v { font-size: 28px; line-height: 36px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; } .funnel-step .l { font-weight: 500; color: var(--text); } .funnel-step .s { color: var(--muted); font-size: 13px; }
.funnel-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 8px 0 4px; } .funnel-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.click { cursor: pointer; } .table tr.click:hover td { background: var(--surface-2); }
.chart-bar { fill: var(--series-meta); } .chart-bar:hover { fill: var(--primary-hover); }
.range { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .range .input { width: 150px; min-height: 36px; }
.badge.src-popup { background: #f1e8fb; color: #6b3fa0; } .badge.src-set_offer { background: var(--warn-bg); color: var(--warn); } .badge.src-campaign { background: var(--info-bg); color: var(--info); }
.badge.src-promotion { background: var(--success-bg); color: var(--success); } .badge.src-test { background: var(--critical-bg); color: var(--critical); }
.rule-row { display: grid; grid-template-columns: 150px repeat(2, minmax(0, 1fr)) 200px minmax(0, 1fr) 36px; gap: 8px; align-items: center; }
.dl { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 10px 16px; align-items: center; } .dl dt { color: var(--muted); } .dl dd { margin: 0; color: var(--text); }
.only-phone { display: none; }
@media (max-width: 760px) {
  .funnel { grid-template-columns: 1fr; gap: 16px; } .funnel-step { border-left: 0; padding: 0; }
  .hide-phone { display: none; } .only-phone { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
  .rule-row { grid-template-columns: 1fr 1fr; } .dl { grid-template-columns: 1fr; gap: 2px; } .dl dd { margin-bottom: 10px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; } .kpi { padding: 14px; } .kpi .v { font-size: 20px; line-height: 26px; }
}
