:root {
  color-scheme: dark;
  --bg: #0b0712;
  --sidebar: #100a19;
  --surface: #15101f;
  --surface-2: #1b1429;
  --surface-3: #100b18;
  --border: #332743;
  --border-soft: rgba(196, 181, 253, 0.12);
  --text: #f8f7fc;
  --muted: #b5adc3;
  --muted-2: #887f98;
  --accent-primary: #8b5cf6;
  --accent-strong: #7c3aed;
  --accent-secondary: #c4b5fd;
  --green: #34d399;
  --orange: #f59e0b;
  --red: #fb7185;
  --shadow: 0 18px 55px rgba(3, 1, 8, 0.32);
  --focus-ring: rgba(139, 92, 246, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 82% 0%, rgba(214, 179, 106, 0.075), transparent 31%), var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }

.sidebar { position: sticky; inset: 0 auto 0 0; height: 100vh; padding: 22px 14px 16px; background: linear-gradient(180deg, rgba(14, 14, 15, 0.99), rgba(7, 7, 8, 0.99)); border-right: 1px solid var(--border-soft); display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 25px; }
.brand strong { display: block; font-size: 16px; letter-spacing: .01em; }
.brand small { display: block; color: var(--muted-2); font-size: 11px; margin-top: 2px; }
.brand-mark { width: 36px; height: 36px; display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 3px; padding: 8px; background: linear-gradient(145deg, rgba(214, 179, 106, .18), rgba(214, 179, 106, .04)); border: 1px solid rgba(214, 179, 106, .34); border-radius: 11px; box-shadow: inset 0 1px rgba(255,255,255,.05); }
.brand-mark span { display: block; border-radius: 2px; background: var(--accent-primary); }
.brand-mark span:nth-child(1) { height: 45%; opacity: .65; }
.brand-mark span:nth-child(2) { height: 75%; }
.brand-mark span:nth-child(3) { height: 100%; background: var(--accent-secondary); }
.main-nav { display: grid; gap: 6px; }
.nav-item { width: 100%; min-height: 44px; border: 0; background: transparent; color: var(--muted); display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; cursor: pointer; text-align: left; font-size: 14px; transition: color .18s ease, background .18s ease, box-shadow .18s ease; }
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.035); }
.nav-item.active { color: #fffaf0; background: linear-gradient(90deg, rgba(214, 179, 106, .18), rgba(214, 179, 106, .035)); box-shadow: inset 3px 0 var(--accent-primary); }
.nav-item.active svg { color: var(--accent-secondary); }
.nav-pill { min-width: 23px; height: 20px; display: grid; place-items: center; padding: 0 6px; color: var(--accent-secondary); background: rgba(214,179,106,.11); border: 1px solid rgba(214,179,106,.22); border-radius: 999px; font-size: 10px; }
.sidebar-footer { margin-top: auto; display: grid; gap: 12px; }
.system-status { display: flex; align-items: center; gap: 10px; margin: 0 8px; padding: 12px; border: 1px solid var(--border-soft); background: rgba(255,255,255,.025); border-radius: 10px; }
.system-status strong, .system-status small { display: block; }
.system-status strong { font-size: 11px; font-weight: 600; }
.system-status small { font-size: 10px; color: var(--muted-2); margin-top: 2px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(66,211,146,.1); }
.profile { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center; width: 100%; padding: 10px 8px; background: transparent; border: 0; text-align: left; cursor: default; }
.profile .avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: #17120a; background: linear-gradient(145deg, var(--accent-secondary), var(--accent-strong)); font-size: 11px; font-weight: 800; }
.profile strong, .profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile strong { font-size: 11px; }
.profile small { color: var(--muted-2); font-size: 10px; margin-top: 2px; }
.profile svg { width: 15px; color: var(--muted-2); }

.main-content { min-width: 0; padding: 0 30px 44px; }
.topbar { min-height: 91px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border-soft); }
.topbar-title { display: flex; align-items: center; gap: 12px; }
.eyebrow { display: block; margin-bottom: 4px; color: var(--accent-primary); font-size: 10px; letter-spacing: .16em; font-weight: 750; }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.topbar-actions { display: flex; align-items: end; gap: 10px; }
.compact-select, .filters label { display: grid; gap: 5px; }
.compact-select span, .filters label > span { color: var(--muted-2); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
select, input { height: 44px; padding: 0 34px 0 12px; color: #eee9df; background: #121213; border: 1px solid var(--border); border-radius: 9px; outline: 0; transition: border-color .18s ease, box-shadow .18s ease; }
input { padding-right: 12px; }
select:focus, input:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--focus-ring); }
.compact-select select { width: 84px; }
.refresh-button, .primary-button, .outline-button, .icon-button, .text-button { border: 0; cursor: pointer; touch-action: manipulation; }
.refresh-button { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 15px; border-radius: 9px; background: linear-gradient(145deg, var(--accent-primary), var(--accent-strong)); color: #17120a; font-size: 12px; font-weight: 750; box-shadow: 0 8px 24px rgba(184,138,50,.16); transition: filter .2s ease, box-shadow .2s ease; }
.refresh-button:hover { filter: brightness(1.08); box-shadow: 0 10px 28px rgba(184,138,50,.22); }
.refresh-button svg { width: 15px; height: 15px; }
.refresh-button.loading svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-button { min-width: 44px; min-height: 44px; padding: 0; background: transparent; display: grid; place-items: center; }
.nav-item:active, .refresh-button:active, .primary-button:active, .outline-button:active, .text-button:active, .integration-action:active { filter: brightness(.9); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent-secondary); outline-offset: 3px; }
.mobile-menu, .close-menu, .sidebar-backdrop { display: none; }


.view { display: none; }
.view.active { display: block; animation: fade-in .25s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(3px); } }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
.section-heading h2, .panel-heading h3 { margin: 0; }
.section-heading h2 { font-size: 17px; letter-spacing: -.01em; }
.section-heading p, .panel-heading p { color: var(--muted); }
.section-heading p { margin: 5px 0 0; font-size: 11px; }
.controls-heading { align-items: end; }
.filters { display: flex; gap: 9px; }
.filters select { min-width: 160px; }
.filters input { width: 210px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.metric-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card { position: relative; min-height: 126px; overflow: hidden; padding: 17px; border: 1px solid var(--border-soft); background: linear-gradient(145deg, rgba(24,24,25,.98), rgba(14,14,15,.98)); border-radius: 13px; box-shadow: var(--shadow); }
.metric-card::after { content: ""; position: absolute; width: 85px; height: 85px; right: -34px; top: -37px; border-radius: 50%; background: var(--accent, rgba(214,179,106,.12)); filter: blur(2px); }
.metric-label { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; font-weight: 600; }
.metric-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--accent, rgba(214,179,106,.1)); color: var(--accent-color, var(--accent-primary)); }
.metric-icon svg { width: 14px; height: 14px; }
.metric-value { margin-top: 13px; font-size: clamp(21px, 2vw, 27px); line-height: 1; font-weight: 760; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.metric-foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--muted-2); font-size: 9px; }
.metric-foot .positive { color: var(--green); }
.metric-foot .warning { color: var(--orange); }

.content-grid { display: grid; gap: 14px; margin-bottom: 14px; }
.chart-grid { grid-template-columns: minmax(0, 1.8fr) minmax(280px, .7fr); }
.lower-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
.panel { border: 1px solid var(--border-soft); background: linear-gradient(160deg, rgba(19,19,20,.98), rgba(12,12,13,.98)); border-radius: 13px; box-shadow: var(--shadow); }
.panel-heading { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 17px; border-bottom: 1px solid var(--border-soft); }
.panel-heading h3 { font-size: 13px; }
.panel-heading p { margin: 4px 0 0; font-size: 9px; }
.legend { display: flex; gap: 12px; color: var(--muted); font-size: 9px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; }
.legend i.revenue { background: var(--accent-primary); }
.legend i.spend { background: var(--accent-secondary); }
.chart-wrap { min-height: 270px; padding: 18px 14px 9px; }
.chart-wrap svg { width: 100%; height: 230px; overflow: visible; }
.chart-gridline { stroke: rgba(148,163,184,.1); stroke-width: 1; }
.chart-label { fill: #65728b; font-size: 9px; }
.chart-bar-revenue { fill: url(#revenueGradient); }
.chart-line-spend { fill: none; stroke: var(--accent-secondary); stroke-width: 2.2; }
.chart-dot { fill: var(--surface); stroke: var(--accent-secondary); stroke-width: 2; }
.score { color: var(--accent-primary); font-size: 19px; font-weight: 750; }
.donut-wrap { display: grid; place-items: center; padding: 25px 0 18px; }
.donut { --rate: 0deg; width: 138px; height: 138px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--accent-primary) var(--rate), #292827 0); position: relative; }
.donut::after { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: #121213; box-shadow: inset 0 0 24px rgba(0,0,0,.34); }
.donut > div { position: relative; z-index: 1; text-align: center; }
.donut strong, .donut span { display: block; }
.donut strong { font-size: 27px; }
.donut span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.coverage-list { display: grid; gap: 10px; padding: 0 18px 18px; }
.coverage-list > div { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 9px; }
.coverage-list span { display: flex; align-items: center; gap: 7px; }
.coverage-list strong { color: #d7dfed; font-size: 10px; }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot.attributed { background: var(--accent-primary); }
.dot.muted { background: #504d48; }
.subtle-pill, .readonly-badge { padding: 5px 8px; color: #dfc68f; background: rgba(214,179,106,.08); border: 1px solid rgba(214,179,106,.18); border-radius: 999px; font-size: 10px; white-space: nowrap; }
.funnel { display: grid; gap: 13px; padding: 20px 18px 23px; }
.funnel-row { display: grid; grid-template-columns: 115px 1fr 55px; align-items: center; gap: 10px; }
.funnel-label strong, .funnel-label span { display: block; }
.funnel-label strong { font-size: 10px; }
.funnel-label span { color: var(--muted-2); font-size: 8px; margin-top: 2px; }
.funnel-track { height: 8px; overflow: hidden; background: #292827; border-radius: 999px; }
.funnel-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-strong), var(--accent-secondary)); }
.funnel-value { text-align: right; font-size: 11px; font-weight: 650; }
.meta-funnel-panel { margin-bottom: 14px; overflow: hidden; }
.meta-funnel-visual { position: relative; min-height: 245px; margin: 0 18px; overflow: hidden; border: 1px solid rgba(214,179,106,.12); border-radius: 12px; background: linear-gradient(180deg, rgba(214,179,106,.035), rgba(214,179,106,.01)); }
.meta-funnel-visual svg { position: absolute; inset: 34px 0 0; width: 100%; height: 190px; filter: drop-shadow(0 12px 22px rgba(181,138,61,.14)); }
.meta-funnel-columns { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.meta-funnel-column { position: relative; display: grid; grid-template-rows: 36px 1fr 34px; justify-items: center; align-items: center; padding: 13px 8px; border-right: 1px solid rgba(148,163,184,.16); text-align: center; }
.meta-funnel-column:last-child { border-right: 0; }
.meta-funnel-column strong { color: var(--muted); font-size: 10px; }
.meta-funnel-column span { align-self: center; color: #fff8e9; font-size: 17px; font-weight: 750; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.meta-funnel-column b { color: var(--text); font-size: 12px; }
.meta-funnel-foot { padding: 12px 20px 18px; color: var(--muted-2); font-size: 9px; }
.source-list { display: grid; gap: 16px; padding: 19px 18px 22px; }
.source-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; }
.source-name { display: flex; align-items: center; gap: 9px; font-size: 10px; }
.source-logo { width: 24px; height: 24px; display: grid; place-items: center; color: #17120a; background: var(--accent-primary); border-radius: 7px; font-size: 10px; font-weight: 800; }
.source-logo.organic { color: #c4beb3; background: #302f2d; }
.source-value { text-align: right; }
.source-value strong, .source-value span { display: block; }
.source-value strong { font-size: 10px; }
.source-value span { color: var(--muted-2); font-size: 8px; margin-top: 2px; }
.source-progress { grid-column: 1 / -1; height: 4px; overflow: hidden; background: #292827; border-radius: 99px; }
.source-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-strong), var(--accent-secondary)); border-radius: inherit; }
.recent-panel { margin-top: 0; }

.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { padding: 11px 16px; color: var(--muted-2); background: rgba(0,0,0,.24); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; text-align: left; white-space: nowrap; }
td { padding: 13px 16px; color: #d0cbc2; border-top: 1px solid rgba(255,255,255,.07); font-size: 11px; }
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: rgba(255,255,255,.018); }
.transaction { color: var(--accent-secondary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.cell-title, .cell-subtitle { display: block; }
.cell-title { color: #eee9df; font-weight: 600; }
.cell-subtitle { margin-top: 3px; color: var(--muted-2); font-size: 8px; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 999px; font-size: 8px; font-weight: 700; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.approved { color: var(--green); background: rgba(66,211,146,.09); }
.status.refunded { color: var(--red); background: rgba(255,107,124,.09); }
.status.pending { color: var(--orange); background: rgba(255,184,92,.09); }
.text-button { min-height: 44px; display: inline-flex; align-items: center; gap: 4px; color: var(--accent-secondary); background: transparent; font-size: 10px; }
.text-button svg { width: 13px; height: 13px; }
.outline-button { min-height: 44px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; color: #c7c1b7; background: transparent; border: 1px solid var(--border); border-radius: 8px; font-size: 10px; }
.outline-button svg { width: 13px; height: 13px; }
.primary-button { min-height: 44px; padding: 9px 14px; color: #17120a; background: var(--accent-primary); border-radius: 8px; font-size: 10px; font-weight: 750; }
.campaign-toggle { width: 44px; height: 44px; position: relative; padding: 0; border: 0; border-radius: 999px; background: transparent; cursor: pointer; }
.campaign-toggle::before { content: ""; position: absolute; width: 33px; height: 19px; left: 5.5px; top: 12.5px; border-radius: 999px; background: #454441; transition: background .18s ease; }
.campaign-toggle::after { content: ""; position: absolute; width: 13px; height: 13px; left: 8.5px; top: 15.5px; border-radius: 50%; background: #fff; transition: transform .18s ease; }
.campaign-toggle.on::before { background: var(--accent-strong); }
.campaign-toggle.on::after { transform: translateX(14px); }
.roas-pill { display: inline-flex; min-width: 42px; justify-content: center; padding: 4px 7px; border-radius: 6px; color: var(--green); background: rgba(66,211,146,.08); font-weight: 700; }
.roas-pill.low { color: var(--orange); background: rgba(255,184,92,.08); }

.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.product-card { padding: 18px; border: 1px solid var(--border-soft); background: linear-gradient(145deg, var(--surface), #0d0d0e); border-radius: 13px; box-shadow: var(--shadow); }
.product-top { display: flex; justify-content: space-between; gap: 12px; }
.product-icon { width: 40px; height: 40px; display: grid; place-items: center; color: var(--accent-secondary); background: rgba(214,179,106,.09); border: 1px solid rgba(214,179,106,.19); border-radius: 11px; }
.product-icon svg { width: 19px; height: 19px; }
.product-state { align-self: flex-start; padding: 4px 7px; color: var(--green); background: rgba(66,211,146,.08); border-radius: 999px; font-size: 8px; }
.product-state.waiting { color: var(--orange); background: rgba(255,184,92,.08); }
.product-card h3 { margin: 14px 0 3px; font-size: 13px; }
.product-code { color: var(--muted-2); font-family: ui-monospace, monospace; font-size: 8px; }
.product-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--border-soft); }
.product-stats span, .product-stats strong { display: block; }
.product-stats span { color: var(--muted-2); font-size: 8px; }
.product-stats strong { margin-top: 4px; font-size: 12px; }

.integration-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.integration-card { min-height: 205px; padding: 18px; border: 1px solid var(--border-soft); background: linear-gradient(145deg, var(--surface), #0d0d0e); border-radius: 13px; box-shadow: var(--shadow); }
.integration-head { display: flex; align-items: center; justify-content: space-between; }
.integration-logo { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; font-size: 15px; font-weight: 800; }
.integration-logo.hotmart { color: #fff; background: linear-gradient(145deg, #ff6644, #f03c20); }
.integration-logo.stripe { color: #fff; background: linear-gradient(145deg, #635bff, #8b5cf6); }
.integration-logo.meta { color: #fff; background: #242426; border: 1px solid #454548; }
.integration-logo.site { color: #17120a; background: linear-gradient(145deg, var(--accent-secondary), var(--accent-strong)); }
.integration-card h3 { margin: 16px 0 5px; font-size: 13px; }
.integration-card p { min-height: 44px; margin: 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.integration-logo.meta-ads { color: #fff; background: #1877f2; border-color: #3186f4; font-family: Arial, sans-serif; font-size: 21px; text-transform: lowercase; }
.integration-action { width: 100%; min-height: 44px; margin-top: 15px; padding: 8px 10px; color: var(--accent-secondary); background: rgba(214,179,106,.06); border: 1px solid rgba(214,179,106,.18); border-radius: 8px; font-size: 10px; cursor: pointer; }
.setup-panel { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 22px; margin-top: 14px; padding: 20px; }
.setup-panel h3 { margin: 0 0 6px; font-size: 12px; }
.setup-panel p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.setup-visual { display: flex; align-items: center; }
.setup-visual span { width: 28px; height: 28px; display: grid; place-items: center; color: var(--accent-secondary); background: rgba(214,179,106,.08); border: 1px solid rgba(214,179,106,.2); border-radius: 50%; font-size: 10px; }
.setup-visual i { width: 28px; height: 1px; background: var(--border); }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; display: flex; align-items: center; gap: 9px; max-width: 360px; padding: 12px 14px; color: #eee9df; background: #1a1a1c; border: 1px solid #3a3937; border-radius: 10px; box-shadow: 0 15px 40px rgba(0,0,0,.45); font-size: 11px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .22s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast svg { width: 15px; color: var(--green); }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid, .lower-grid { grid-template-columns: 1fr; }
  .integration-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; width: 244px; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 20px 0 60px rgba(0,0,0,.35); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 15; width: 100%; height: 100%; border: 0; background: rgba(2,6,16,.65); backdrop-filter: blur(3px); }
  .sidebar-backdrop.open { display: block; }
  .mobile-menu, .close-menu { display: grid; }
  .mobile-menu { width: 44px; height: 44px; color: #d4cec4; border: 1px solid var(--border); border-radius: 8px; }
  .close-menu { margin-left: auto; color: var(--muted); }
  .main-content { padding: 0 18px 35px; }
  .topbar { min-height: 78px; }
  .topbar h1 { font-size: 19px; }
  .compact-select { display: none; }
  .product-grid { grid-template-columns: 1fr; }
}

@media (max-width: 590px) {
  .main-content { padding-inline: 13px; }
  .refresh-button span { display: none; }
  .refresh-button { width: 44px; justify-content: center; padding: 0; }
  .section-heading, .controls-heading { align-items: flex-start; flex-direction: column; }
  .filters { width: 100%; display: grid; grid-template-columns: 1fr; }
  .filters label, .filters select, .filters input { width: 100%; min-width: 0; }
  .metric-grid, .metric-grid.compact { grid-template-columns: 1fr; }
  .metric-card { min-height: 112px; }
  .panel-heading { align-items: flex-start; }
  .legend { display: none; }
  .funnel-row { grid-template-columns: 95px 1fr 45px; }
  .integration-grid { grid-template-columns: 1fr; }
  .setup-panel { grid-template-columns: 1fr; }
  #metaFunnel { overflow-x: auto; }
  .meta-funnel-visual { min-width: 650px; }
  .meta-funnel-foot { min-width: 650px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Real-data access and onboarding */
.app-shell.is-locked { visibility: hidden; }
.login-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; background: radial-gradient(circle at 50% 12%, rgba(214,179,106,.1), transparent 34%), #070707; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s ease; }
.login-screen.visible { opacity: 1; visibility: visible; pointer-events: auto; }
.login-card { width: min(430px, 100%); padding: 34px; border: 1px solid rgba(214,179,106,.22); background: linear-gradient(145deg, #171718, #0b0b0c); border-radius: 18px; box-shadow: 0 32px 90px rgba(0,0,0,.62); }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 30px; font-size: 15px; }
.login-card h1 { margin: 8px 0 10px; font-size: clamp(24px, 5vw, 32px); line-height: 1.12; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 24px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.login-card form, .integration-form { display: grid; gap: 14px; }
.login-card label, .integration-form label, .copy-field, .code-field { display: grid; gap: 7px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .04em; }
.login-card input, .integration-form input, .integration-form select, .copy-field input, .code-field textarea { width: 100%; min-height: 46px; padding: 11px 13px; color: var(--text); background: #0b0b0c; border: 1px solid #343335; border-radius: 9px; outline: none; font: inherit; font-size: 11px; transition: .18s ease; }
.login-card input:focus, .integration-form input:focus, .integration-form select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(214,179,106,.09); }
.integration-form select:disabled { color: var(--muted); opacity: .75; }
.login-card .primary-button, .integration-form .primary-button, .modal-card > .primary-button { justify-content: center; min-height: 46px; }
.form-error { min-height: 16px; color: var(--red); font-size: 10px; }

.setup-banner { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin: 20px 0 26px; padding: 13px 15px; border: 1px solid rgba(226,166,87,.22); background: linear-gradient(90deg, rgba(226,166,87,.09), rgba(214,179,106,.025)); border-radius: 11px; }
.setup-icon { width: 29px; height: 29px; display: grid; place-items: center; color: var(--orange); background: rgba(255,184,92,.1); border-radius: 8px; }
.setup-icon svg { width: 16px; height: 16px; }
.setup-banner strong, .setup-banner span { display: block; }
.setup-banner strong { font-size: 12px; }
.setup-banner div > span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.setup-banner.complete { border-color: rgba(66,211,146,.2); background: linear-gradient(90deg, rgba(66,211,146,.08), rgba(66,211,146,.015)); }
.setup-banner.complete .setup-icon { color: var(--green); background: rgba(66,211,146,.1); }

.loading-overlay { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--text); background: rgba(7,7,7,.72); backdrop-filter: blur(5px); opacity: 0; visibility: hidden; pointer-events: none; transition: .18s ease; font-size: 11px; }
.loading-overlay.visible { opacity: 1; visibility: visible; pointer-events: auto; }
.loading-spinner { width: 20px; height: 20px; border: 2px solid #383638; border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { min-height: 84px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; padding: 18px; color: var(--muted); text-align: center; }
.empty-state > span { width: 28px; height: 28px; display: grid; place-items: center; color: var(--accent); background: rgba(214,179,106,.08); border-radius: 8px; }
.empty-state svg { width: 15px; }
.empty-state p { max-width: 430px; margin: 0; font-size: 10px; line-height: 1.55; }
.empty-card { grid-column: 1 / -1; min-height: 190px; display: grid; place-items: center; }

.modal-backdrop { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.72); backdrop-filter: blur(7px); opacity: 0; visibility: hidden; pointer-events: none; transition: .2s ease; }
.modal-backdrop.visible { opacity: 1; visibility: visible; pointer-events: auto; }
.modal-card { position: relative; width: min(610px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 30px; color: var(--text); background: linear-gradient(150deg, #181819, #0c0c0d); border: 1px solid #343235; border-radius: 17px; box-shadow: 0 35px 100px rgba(0,0,0,.66); }
.modal-card h2 { margin: 8px 42px 10px 0; font-size: 23px; letter-spacing: -.035em; }
.modal-card p { margin: 0 0 20px; color: var(--muted); font-size: 11px; line-height: 1.75; }
.modal-card code { color: var(--accent-secondary); }
.modal-close { position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; display: grid; place-items: center; color: var(--muted); background: #202022; border: 1px solid #39383a; border-radius: 8px; cursor: pointer; }
.modal-close svg { width: 15px; }
.copy-field { margin-bottom: 18px; }
.copy-field > div { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.copy-field button { padding: 0 15px; color: var(--accent-secondary); background: rgba(214,179,106,.08); border: 1px solid rgba(214,179,106,.2); border-radius: 8px; cursor: pointer; font-size: 10px; font-weight: 700; }
.code-field textarea { min-height: 132px; resize: vertical; font-family: Consolas, monospace; line-height: 1.55; }
.modal-note { margin: 18px 0 0; padding: 13px 14px; color: var(--muted); background: rgba(214,179,106,.06); border: 1px solid rgba(214,179,106,.14); border-radius: 9px; font-size: 10px; line-height: 1.6; }
.modal-note.warning { color: #e7d6b2; border-color: rgba(255,184,92,.22); }
.integration-form { padding-top: 4px; }
.integration-form small { color: var(--muted); font-size: 9px; }
.facebook-login-button { background: #1877f2; color: #fff; box-shadow: 0 10px 28px rgba(24,119,242,.22); }
.account-list { display: grid; gap: 8px; max-height: 330px; overflow: auto; padding-right: 4px; }
.account-option { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 11px; margin: 0; padding: 12px; background: #111113; border: 1px solid #323135; border-radius: 9px; cursor: pointer; }
.account-option:has(input:checked) { border-color: rgba(214,179,106,.48); background: rgba(214,179,106,.07); }
.account-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.account-option strong, .account-option small { display: block; }
.account-option strong { font-size: 10px; }
.account-option small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.form-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.form-section-heading strong { font-size: 11px; }
.form-section-heading .outline-button { width: auto; padding: 9px 12px; }
.stripe-link-list { display: grid; gap: 10px; }
.stripe-link-row { display: grid; grid-template-columns: minmax(140px, .72fr) minmax(240px, 1.4fr) auto; gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--border-soft); border-radius: 10px; background: rgba(255,255,255,.02); }
.stripe-link-row label { margin: 0; }
.stripe-link-remove { min-height: 40px; padding: 0 11px; color: #c4b9cc; border: 1px solid var(--border-soft); border-radius: 8px; background: transparent; cursor: pointer; }
.stripe-link-remove:hover { color: #fff; border-color: #6d5b78; }
@media (max-width: 720px) { .stripe-link-row { grid-template-columns: 1fr; } }
.full-button { width: 100%; justify-content: center; margin-top: 10px; }
.custom-period-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.custom-period-form > label { margin: 0; }
.custom-period-form .primary-button { grid-column: 1 / -1; margin-top: 4px; }
.toast.error svg { color: var(--red); }
button:disabled { opacity: .55; cursor: wait; }
.profile-wrap { position: relative; }
.profile-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 30; padding: 10px; background: #181819; border: 1px solid #373638; border-radius: 10px; box-shadow: 0 18px 45px rgba(0,0,0,.48); opacity: 0; visibility: hidden; transform: translateY(5px); transition: .16s ease; }
.profile-menu.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.profile-menu div { padding: 4px 5px 10px; }
.profile-menu strong, .profile-menu small { display: block; }
.profile-menu strong { font-size: 10px; }
.profile-menu small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.profile-menu button { width: 100%; min-height: 36px; color: #ff9ca7; background: rgba(255,107,124,.07); border: 1px solid rgba(255,107,124,.16); border-radius: 7px; cursor: pointer; font-size: 9px; font-weight: 700; }
.profile-menu button + button { margin-top: 7px; }
.profile-menu button.account-button { color: #d8ccff; background: rgba(139,92,246,.09); border-color: rgba(167,139,250,.22); }

@media (max-width: 680px) {
  .login-card, .modal-card { padding: 24px; }
  .setup-banner { grid-template-columns: auto 1fr; }
  .setup-banner > button { grid-column: 1 / -1; width: 100%; justify-content: center; }
  .copy-field > div { grid-template-columns: 1fr; }
  .copy-field button { min-height: 42px; }
  .custom-period-form { grid-template-columns: 1fr; }
  .custom-period-form .primary-button { grid-column: auto; }
}

/* Midnight Violet — TrackFlow 2.0 */
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  background:
    radial-gradient(900px 520px at 52% -170px, rgba(124, 58, 237, .26), transparent 68%),
    radial-gradient(700px 460px at 100% 18%, rgba(67, 56, 202, .10), transparent 72%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
}
.app-shell { grid-template-columns: 252px minmax(0, 1fr); }
.sidebar {
  padding: 24px 16px 18px;
  background: linear-gradient(180deg, rgba(16, 10, 25, .98), rgba(10, 6, 16, .99));
  border-right-color: rgba(196, 181, 253, .10);
  box-shadow: 18px 0 55px rgba(4, 2, 10, .18);
}
.brand { gap: 12px; padding: 0 8px 28px; }
.brand strong { font-size: 17px; letter-spacing: -.02em; }
.brand small { color: #9187a2; font-size: 12px; }
.brand-mark {
  width: 38px;
  height: 38px;
  background: linear-gradient(145deg, rgba(139, 92, 246, .34), rgba(76, 29, 149, .15));
  border-color: rgba(167, 139, 250, .42);
  border-radius: 12px;
  box-shadow: inset 0 1px rgba(255,255,255,.09), 0 10px 28px rgba(76,29,149,.16);
}
.brand-mark span { background: #a78bfa; }
.brand-mark span:nth-child(3) { background: #ddd6fe; }
.main-nav { gap: 5px; }
.nav-item {
  min-height: 46px;
  padding: 11px 13px;
  color: #9e95ad;
  border-radius: 11px;
  font-size: 14px;
}
.nav-item:hover { color: #f5f3ff; background: rgba(139, 92, 246, .07); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(139, 92, 246, .22), rgba(124, 58, 237, .07));
  box-shadow: inset 3px 0 #a78bfa, 0 10px 26px rgba(76,29,149,.08);
}
.nav-item.active svg { color: #c4b5fd; }
.nav-pill {
  color: #ddd6fe;
  background: rgba(139,92,246,.14);
  border-color: rgba(167,139,250,.24);
}
.system-status {
  padding: 13px;
  background: rgba(139,92,246,.035);
  border-color: rgba(196,181,253,.11);
  border-radius: 12px;
}
.system-status strong { font-size: 12px; }
.system-status small { font-size: 11px; }
.profile { padding: 11px 8px; cursor: pointer; border-radius: 11px; }
.profile:hover { background: rgba(139,92,246,.06); }
.profile .avatar {
  color: #fff;
  background: linear-gradient(145deg, #a78bfa, #6d28d9);
  box-shadow: 0 8px 20px rgba(109,40,217,.2);
}
.profile strong { font-size: 12px; }
.profile small { font-size: 11px; }

.main-content { padding: 0 34px 48px; }
.topbar { min-height: 84px; border-bottom-color: rgba(196,181,253,.10); }
.eyebrow { color: #a78bfa; font-size: 10px; letter-spacing: .18em; }
.topbar h1 { font-size: 24px; font-weight: 720; }
.revenue-goal {
  flex: 1 1 390px;
  min-width: 290px;
  max-width: 520px;
  padding: 10px 14px;
  background: linear-gradient(145deg, rgba(28,19,43,.92), rgba(17,12,27,.94));
  border: 1px solid rgba(167,139,250,.17);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(3,1,8,.16);
}
.revenue-goal-copy { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.revenue-goal-copy > div { min-width: 0; }
.revenue-goal-kicker { display: block; color: #8f849f; font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.revenue-goal-copy strong { display: block; margin-top: 3px; color: #f5f3ff; font-size: 11px; }
#revenueGoalValue { color: #c4b5fd; font-size: 10px; font-weight: 750; white-space: nowrap; }
.revenue-goal-track { height: 6px; margin-top: 9px; overflow: hidden; background: rgba(196,181,253,.10); border-radius: 999px; }
.revenue-goal-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #a78bfa 68%, #22d3ee);
  border-radius: inherit;
  box-shadow: 0 0 16px rgba(167,139,250,.55);
  transition: width .55s ease;
}
.revenue-goal.complete { border-color: rgba(52,211,153,.25); }
.revenue-goal.complete .revenue-goal-track span { background: linear-gradient(90deg, #10b981, #22d3ee); }
.compact-select span, .filters label > span { color: #8f849f; font-size: 10px; }
select, input {
  height: 46px;
  color: #f5f3ff;
  background: rgba(21, 16, 31, .92);
  border-color: #382a49;
  border-radius: 11px;
}
select:hover, input:hover { border-color: #4c3863; }
.refresh-button {
  min-height: 46px;
  padding: 0 17px;
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  border-radius: 11px;
  box-shadow: 0 12px 30px rgba(109,40,217,.22);
}
.refresh-button:hover { box-shadow: 0 14px 36px rgba(109,40,217,.32); }
.view.active { animation: violet-fade .24s ease; }
@keyframes violet-fade { from { opacity: 0; transform: translateY(4px); } }
.section-heading { margin: 28px 0 18px; }
.section-heading h2 { font-size: 19px; font-weight: 700; }
.section-heading p { color: #9e95ad; font-size: 12px; line-height: 1.5; }
.summary-heading { margin-bottom: 16px; }
.summary-heading h2 { font-size: 18px; }

.metric-grid { gap: 14px; margin-bottom: 18px; }
.summary-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.metric-card {
  min-height: 116px;
  padding: 17px 18px;
  background: linear-gradient(150deg, rgba(27,20,41,.97), rgba(18,12,28,.98));
  border-color: rgba(196,181,253,.12);
  border-radius: 15px;
  box-shadow: 0 14px 36px rgba(3,1,8,.18);
}
.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--accent-color), transparent);
  opacity: .8;
}
.metric-card::after {
  width: 100px;
  height: 100px;
  right: -46px;
  top: -56px;
  background: color-mix(in srgb, var(--accent-color) 13%, transparent);
  filter: blur(12px);
}
.metric-label { color: #a9a0b7; font-size: 12px; font-weight: 600; }
.metric-icon { background: color-mix(in srgb, var(--accent-color) 12%, transparent); }
.metric-value { margin-top: 18px; font-size: clamp(23px, 2vw, 29px); font-weight: 740; }
.metric-foot { color: #8e849d; font-size: 11px; }

.content-grid { gap: 16px; margin-bottom: 16px; }
.summary-section { margin-bottom: 16px; }
.summary-lists { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.panel {
  overflow: hidden;
  background: linear-gradient(155deg, rgba(24,17,36,.96), rgba(14,9,22,.98));
  border-color: rgba(196,181,253,.12);
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(3,1,8,.20);
}
.panel-heading {
  min-height: 66px;
  padding: 16px 19px;
  border-bottom-color: rgba(196,181,253,.10);
}
.panel-heading h3 { font-size: 14px; font-weight: 680; letter-spacing: -.01em; }
.panel-heading p { color: #91879f; font-size: 11px; }
.legend { color: #a69dad; font-size: 11px; }
.legend i { width: 9px; height: 9px; }
.legend i.revenue { background: #8b5cf6; }
.legend i.spend { background: #22d3ee; }
.chart-wrap { min-height: 290px; padding: 20px 17px 12px; }
.chart-wrap svg { height: 245px; }
.chart-gridline { stroke: rgba(196,181,253,.10); }
.chart-label { fill: #81778f; font-size: 9px; }
.chart-line-spend { stroke: #22d3ee; }
.chart-dot { fill: #15101f; stroke: #22d3ee; }
.subtle-pill, .readonly-badge {
  color: #d8ccff;
  background: rgba(139,92,246,.10);
  border-color: rgba(167,139,250,.22);
  font-size: 10px;
}
.meta-funnel-panel { margin-bottom: 16px; }
.meta-funnel-visual {
  min-height: 245px;
  margin: 16px;
  border-color: rgba(139,92,246,.18);
  background: linear-gradient(180deg, rgba(139,92,246,.07), rgba(67,56,202,.018));
}
.meta-funnel-visual svg { filter: drop-shadow(0 14px 28px rgba(109,40,217,.24)); }
.meta-funnel-column { border-right-color: rgba(196,181,253,.14); }
.meta-funnel-column strong { color: #a69dad; font-size: 11px; }
.meta-funnel-column span { color: #fff; font-size: 18px; }
.meta-funnel-column b { font-size: 13px; }

table { min-width: 720px; }
.sales-filters { flex-wrap: wrap; justify-content: flex-end; }
.sales-table { min-width: 1120px; }
.sales-table th:nth-child(1), .sales-table td:nth-child(1) { width: 125px; }
.sales-table th:nth-child(2), .sales-table td:nth-child(2) { min-width: 225px; }
.sales-table th:nth-child(3), .sales-table td:nth-child(3) { min-width: 205px; }
.sales-table th:nth-child(4), .sales-table td:nth-child(4) { min-width: 185px; }
.sales-table th:nth-child(5), .sales-table td:nth-child(5) { min-width: 205px; }
.sales-table th:nth-child(6), .sales-table td:nth-child(6) { width: 105px; }
.sales-table th:nth-child(7), .sales-table td:nth-child(7) { width: 125px; }
.sale-row { cursor: pointer; }
.sale-row:focus-visible { outline: 2px solid #a78bfa; outline-offset: -2px; background: rgba(139,92,246,.08); }
.ad-name { color: #ddd6fe; }
.summary-campaigns table, .recent-panel table { min-width: 560px; }
th {
  padding: 12px 16px;
  color: #8f859d;
  background: rgba(8,4,14,.32);
  font-size: 10px;
}
td { padding: 14px 16px; color: #c9c3d2; border-top-color: rgba(196,181,253,.075); font-size: 12px; }
tbody tr:hover { background: rgba(139,92,246,.045); }
.transaction { display: block; margin-top: 4px; color: #a78bfa; font-size: 9px; }
.cell-title { color: #f4f1fa; }
.cell-subtitle { color: #83798f; font-size: 9px; }
.status { padding: 5px 8px; font-size: 9px; }
.status.approved { color: #6ee7b7; background: rgba(52,211,153,.10); }
.status.refunded { color: #fda4af; background: rgba(251,113,133,.10); }
.status.pending { color: #fbbf24; background: rgba(245,158,11,.10); }
.text-button { color: #c4b5fd; font-size: 11px; }
.outline-button { color: #d5cfdd; border-color: #3a2d49; font-size: 11px; }
.outline-button:hover { color: #fff; border-color: #6d4c91; background: rgba(139,92,246,.06); }
.primary-button { color: #fff; background: linear-gradient(135deg, #8b5cf6, #6d28d9); font-size: 11px; }
.roas-pill { color: #6ee7b7; background: rgba(52,211,153,.10); }
.roas-pill.low { color: #fbbf24; background: rgba(245,158,11,.10); }

.product-grid, .integration-grid { gap: 16px; }
.product-card, .integration-card {
  background: linear-gradient(150deg, rgba(25,18,38,.98), rgba(14,9,22,.99));
  border-color: rgba(196,181,253,.12);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(3,1,8,.18);
}
.product-card { padding: 20px; }
.product-card h3, .integration-card h3 { font-size: 15px; }
.product-icon { color: #c4b5fd; background: rgba(139,92,246,.10); border-color: rgba(167,139,250,.20); }
.product-state { font-size: 9px; }
.product-code, .product-stats span { font-size: 10px; }
.product-stats strong { font-size: 13px; }
.integration-card { min-height: 220px; padding: 20px; }
.integration-card p { min-height: 48px; color: #a49bac; font-size: 11px; line-height: 1.55; }
.integration-logo.site { color: #fff; background: linear-gradient(145deg, #a78bfa, #6d28d9); }
.integration-logo.meta { background: #201a2a; border-color: #443754; }
.integration-action {
  color: #d8ccff;
  background: rgba(139,92,246,.07);
  border-color: rgba(167,139,250,.20);
  font-size: 11px;
}
.integration-action:hover { color: #fff; background: rgba(139,92,246,.13); border-color: rgba(167,139,250,.35); }
.setup-panel p { color: #a49bac; font-size: 11px; }
.setup-visual span { color: #d8ccff; background: rgba(139,92,246,.10); border-color: rgba(167,139,250,.22); }

.login-screen {
  background:
    radial-gradient(700px 520px at 50% 28%, rgba(139,92,246,.52), transparent 72%),
    radial-gradient(780px 520px at 50% 72%, rgba(76,29,149,.20), transparent 72%),
    #08040e;
}
.login-card {
  width: min(480px, 100%);
  padding: 42px;
  text-align: center;
  background: linear-gradient(155deg, rgba(49,27,72,.90), rgba(18,10,29,.95));
  border-color: rgba(196,181,253,.22);
  border-radius: 22px;
  box-shadow: 0 35px 100px rgba(4,1,10,.7), inset 0 1px rgba(255,255,255,.06);
  backdrop-filter: blur(18px);
}
.login-brand { justify-content: center; margin-bottom: 26px; }
.login-card h1 { margin: 10px 0 8px; font-size: clamp(27px,5vw,34px); }
.login-card > p { margin-bottom: 28px; color: #b9afc5; font-size: 13px; }
.login-card form { text-align: left; }
.login-card label { color: #b9afc5; font-size: 11px; }
.login-card input, .integration-form input, .integration-form select, .copy-field input, .code-field textarea {
  color: #f8f7fc;
  background: rgba(12,7,19,.66);
  border-color: rgba(196,181,253,.18);
  border-radius: 11px;
  font-size: 12px;
}
.login-card input { min-height: 50px; }
.login-card .primary-button { min-height: 50px; margin-top: 4px; font-size: 12px; }
.login-card input:focus, .integration-form input:focus, .integration-form select:focus { border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139,92,246,.18); }

.setup-banner {
  margin: 20px 0 0;
  background: linear-gradient(90deg, rgba(245,158,11,.09), rgba(139,92,246,.025));
  border-color: rgba(245,158,11,.20);
}
.loading-overlay { background: rgba(8,4,14,.74); }
.loading-spinner { border-color: #3b2d4d; border-top-color: #a78bfa; }
.empty-state { color: #9f96ab; }
.empty-state > span { color: #c4b5fd; background: rgba(139,92,246,.10); }
.modal-backdrop { background: rgba(5,2,9,.78); }
.modal-card {
  background: linear-gradient(155deg, #211630, #100a18);
  border-color: #423151;
  border-radius: 19px;
}
.modal-card code { color: #c4b5fd; }
.modal-close { background: #2a2036; border-color: #493958; }
.copy-field button { color: #d8ccff; background: rgba(139,92,246,.09); border-color: rgba(167,139,250,.22); }
.modal-note { background: rgba(139,92,246,.07); border-color: rgba(167,139,250,.16); }
.account-option { background: #171020; border-color: #372940; }
.account-option:has(input:checked) { border-color: rgba(167,139,250,.52); background: rgba(139,92,246,.10); }
.account-option input { accent-color: #8b5cf6; }
.profile-menu { background: #1e1629; border-color: #40324c; }
.toast { color: #f4f1fa; background: #21182d; border-color: #473653; }

body.drawer-open { overflow: hidden; }
.sale-drawer-backdrop { position: fixed; inset: 0; z-index: 95; visibility: hidden; pointer-events: none; }
.sale-drawer-backdrop.visible { visibility: visible; pointer-events: auto; }
.sale-drawer-scrim { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(5,2,9,.68); backdrop-filter: blur(5px); opacity: 0; cursor: default; transition: opacity .2s ease; }
.sale-drawer-backdrop.visible .sale-drawer-scrim { opacity: 1; }
.sale-drawer { position: absolute; top: 0; right: 0; width: min(570px, 94vw); height: 100%; overflow: auto; padding: 28px; color: #f7f3ff; background: linear-gradient(160deg, #1b1128, #0d0814 58%); border-left: 1px solid rgba(196,181,253,.17); box-shadow: -28px 0 80px rgba(3,1,8,.52); transform: translateX(100%); transition: transform .24s ease; }
.sale-drawer-backdrop.visible .sale-drawer { transform: translateX(0); }
.sale-drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 21px; border-bottom: 1px solid rgba(196,181,253,.11); }
.sale-drawer-header h2 { max-width: 430px; margin: 7px 0 0; font-size: 21px; line-height: 1.25; letter-spacing: -.025em; }
.sale-drawer-close { position: static; flex: 0 0 auto; }
.sale-drawer-content { display: grid; gap: 14px; padding-top: 18px; }
.sale-overview, .sale-detail-section { border: 1px solid rgba(196,181,253,.13); background: rgba(139,92,246,.045); border-radius: 15px; }
.sale-overview { padding: 17px; }
.sale-overview-top, .sale-overview-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sale-overview-top > span:last-child, .sale-overview-meta { color: #94899f; font-size: 10px; }
.sale-overview-values { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 17px 0; }
.sale-overview-values div { padding: 12px; background: rgba(6,3,10,.34); border-radius: 10px; }
.sale-overview-values span, .sale-overview-values strong { display: block; }
.sale-overview-values span { margin-bottom: 6px; color: #8f849f; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.sale-overview-values strong { font-size: 16px; }
.sale-overview-meta { padding-top: 13px; border-top: 1px solid rgba(196,181,253,.09); }
.sale-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid rgba(196,181,253,.10); }
.sale-detail-heading > div { display: flex; align-items: center; gap: 10px; }
.sale-detail-heading h3 { margin: 0; font-size: 13px; }
.detail-section-icon { width: 27px; height: 27px; display: grid; place-items: center; color: #ddd6fe; background: rgba(139,92,246,.15); border: 1px solid rgba(167,139,250,.22); border-radius: 8px; font-size: 10px; font-weight: 800; }
.detail-section-icon.meta { color: #fff; background: #1877f2; border-color: rgba(255,255,255,.16); }
.detail-state { color: #a69bad; font-size: 9px; }
.detail-state.found { color: #6ee7b7; }
.sale-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 7px 16px 13px; }
.sale-detail-item { min-width: 0; padding: 11px 10px 11px 0; border-bottom: 1px solid rgba(196,181,253,.065); }
.sale-detail-item > span { display: block; margin-bottom: 6px; color: #877c93; font-size: 9px; }
.sale-detail-item > div { display: flex; align-items: flex-start; gap: 7px; }
.sale-detail-item strong { min-width: 0; color: #e9e4ef; font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.detail-copy { flex: 0 0 auto; padding: 2px 5px; color: #c4b5fd; background: rgba(139,92,246,.10); border: 0; border-radius: 5px; cursor: pointer; font-size: 8px; }
.detail-copy:hover { color: #fff; background: rgba(139,92,246,.2); }

@media (max-width: 1450px) {
  .summary-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .summary-lists { grid-template-columns: 1fr; }
  .summary-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { width: 252px; }
  .main-content { padding: 0 18px 38px; }
  .topbar { flex-wrap: wrap; padding: 13px 0; }
  .revenue-goal { order: 3; flex: 1 0 100%; min-width: 0; max-width: none; }
}
@media (max-width: 590px) {
  .revenue-goal { padding: 10px 12px; }
  .revenue-goal-copy { align-items: flex-start; }
  #revenueGoalValue { font-size: 9px; }
  .summary-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { min-height: 108px; padding: 15px; }
  .metric-value { font-size: 22px; }
  .metric-label { font-size: 11px; }
  .summary-campaigns table, .recent-panel table { min-width: 540px; }
  .login-card { padding: 30px 24px; }
  .sale-drawer { width: 100%; padding: 22px 18px; }
  .sale-detail-grid { grid-template-columns: 1fr; }
  .sale-overview-meta { align-items: flex-start; flex-direction: column; }
}
