@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@200;300;400;500;600;700&display=swap');

.ss-hidden { display: none !important; }

:root {
  --bg:           #000000;
  --surface:      #1f1f1f;
  --sep:          #313131;
  --t1:           #ffffff;
  --t2:           #f1f1f1;
  --t3:           #969593;
  --btn-bg:       #2e2e2e;
  --purple:       #7b5cdc;
  --upgrade-bg:   #d4c5fe;
  --upgrade-text: #1a0840;
  --up-color:     #4ade80;
  --dn-color:     #f87171;
}

/* ── Light theme overrides ── */
body.light {
  --bg:           #F9F9F9;
  --surface:      #ffffff;
  --sep:          #e4e4e7;
  --t1:           #1E1E2F;
  --t2:           #1E1E2F;
  --t3:           #54595F;
  --btn-bg:       #efefef;
  --purple:       #7b5cdc;
  --upgrade-bg:   #ede9fe;
  --upgrade-text: #1a0840;
  --up-color:     #16a34a;
  --dn-color:     #dc2626;
  background: linear-gradient(180deg, #D7282800 0%, #F9F9F9 80%);
}
body.light .app-wrap,
body.light .app          { background: transparent; }
body.light .topbar select option { background: #ffffff; }
body.light .add-site-btn:hover   { background: #e2e2e2; }
body.light .avatar               { background: #d4d4d8; }
body.light .card                 { box-shadow: 0 1px 3px rgba(0,0,0,.07); }
body.light .login-page           { background: linear-gradient(180deg, #D7282800 0%, #F9F9F9 80%); }

/* Theme toggle button */
.theme-toggle {
  background: none; border: 0;
  color: var(--t3);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; font-size: .9rem;
  transition: color .2s;
}
.theme-toggle:hover { color: var(--t1); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--t1);
}

a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ── Outer wrapper ── */
.app-wrap { min-height: 100vh; background: var(--surface); }
.app {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

/* ── TOP BAR ── */
.topbar {
  display: grid;
  grid-template-columns: 175px 1fr 260px;
  align-items: center;
  padding: .875rem 1.5rem;
}
.logo { display: flex; align-items: center; gap: .65rem; }
.logo-mark {
  width: 26px; height: 26px;
  flex-shrink: 0; display: block; object-fit: contain;
}
.logo-name { font-size: .85rem; font-weight: 600; }

.topbar-mid {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}
.topbar-mid-left  { display: flex; align-items: center; gap: 1rem; }
.topbar-mid-right { display: flex; align-items: center; gap: .75rem; }

.site-select-wrap { display: flex; align-items: center; gap: .4rem; font-size: .9rem; font-weight: 500; }
.site-select-wrap select,
.site-select-wrap .site-caret { display: inline; }
.site-caret { color: var(--t3); font-size: .75rem; }

.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  padding: .6rem 1.5rem;
  background: var(--bg2); border-bottom: 1px solid var(--sep);
}
.filter-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--btn-bg); border: 0;
  color: var(--t2); font-size: .8rem; font-weight: 500;
  padding: .35rem .9rem; border-radius: 5px; white-space: nowrap;
}
.filter-chip-x {
  display: inline-flex; align-items: center;
  color: var(--t3); font-size: .9rem; text-decoration: none; flex-shrink: 0;
  transition: color .15s;
}
.filter-chip-x:hover { color: var(--t1); }

.pub-theme-toggle {
  display: inline-flex; align-items: center;
  color: var(--t3); opacity: .7; transition: opacity .15s, color .15s;
  text-decoration: none;
}
.pub-theme-toggle:hover { opacity: 1; color: var(--t1); }

.site-settings-gear {
  display: inline-flex; align-items: center;
  color: var(--t3); opacity: .6; transition: opacity .15s, color .15s;
  line-height: 1;
}
.site-settings-gear:hover { opacity: 1; color: var(--t1); }

.online-badge {
  display: flex; align-items: center; gap: .4rem;
  font-size: .8rem; color: var(--t3); white-space: nowrap;
}
.green-dot {
  width: 7px; height: 7px;
  border-radius: 50%; background: #45ffbc; flex-shrink: 0;
}

.date-select {
  display: flex; align-items: center; gap: .5rem;
  color: var(--t3); font-size: .82rem;
}
.date-select select {
  background: transparent; border: 0;
  color: var(--t3); font-size: .82rem;
  appearance: none; padding-right: .4rem;
}
.topbar select {
  background: transparent; border: 0;
  color: var(--t1); appearance: none;
  outline: none;
}
.topbar select option { background: var(--surface); }

/* ── PERIOD PICKER ── */
.period-wrap { display: flex; align-items: center; gap: .25rem; }
.period-arrow {
  background: none; border: none; color: var(--t3); font-size: 1.25rem;
  cursor: pointer; padding: 0 .15rem; line-height: 1;
  display: none;
}
.period-arrow:hover:not(:disabled) { color: var(--t1); }
.period-arrow:disabled { color: var(--sep); cursor: default; }
.period-picker { position: relative; }
.period-trigger {
  background: none; border: none; color: var(--t3); font-size: .82rem;
  cursor: pointer; padding: 0; display: flex; align-items: center; gap: .25rem;
  white-space: nowrap;
}
.period-trigger:hover { color: var(--t1); }
.period-trigger-caret { font-size: .7rem; color: var(--t3); }
.period-menu {
  display: none; position: absolute; right: 0; top: calc(100% + .4rem);
  background: var(--surface); border: 1px solid var(--sep); border-radius: 7px;
  min-width: 200px; z-index: 200; padding: .3rem 0;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.period-picker.open .period-menu { display: block; }
.period-opt {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; background: none; border: none; text-align: left;
  color: var(--t1); font-size: .82rem; padding: .35rem .9rem; cursor: pointer;
}
.period-opt:hover { background: var(--btn-bg); }
.period-opt.active { color: var(--purple); font-weight: 600; }
.period-opt-shortcut { color: var(--t3); font-size: .72rem; }
.period-sep { height: 1px; background: var(--sep); margin: .3rem 0; }


.add-site-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--btn-bg); border: 0;
  color: var(--t2); font-size: .8rem; font-weight: 500;
  padding: .35rem .9rem; border-radius: 5px; white-space: nowrap;
  cursor: pointer; text-decoration: none;
}
.add-site-btn:hover { background: #3a3a3a; }

.topbar-user {
  display: flex; align-items: center; gap: .75rem;
  justify-content: flex-end; padding-right: .5rem;
}
.user-name { font-size: .82rem; color: var(--t3); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #444; overflow: hidden; flex-shrink: 0;
  border: 1px solid var(--sep);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── BODY GRID ── */
.body {
  display: grid;
  grid-template-columns: 175px 1fr 260px;
  column-gap: 0;
  flex: 1;
}

/* ── LEFT NAV ── */
.left-nav {
  padding: 2rem 1.5rem;
  display: flex; flex-direction: column;
}
.nav-links { display: flex; flex-direction: column; gap: 1.2rem; color: var(--t3); }
.nav-links a {
  display: flex; align-items: center; gap: .7rem;
  font-size: .875rem; transition: color .2s, transform .2s;
}
.nav-links a.active { color: var(--t1); }
.nav-links a:hover  { color: var(--t1); transform: translateX(4px); }
.nav-ico {
  width: 14px; height: 14px;
  flex-shrink: 0; opacity: .6;
}
.nav-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--sep);
  font-size: .72rem; color: var(--t3);
}
.nav-logout {
  display: flex; align-items: center; gap: .7rem;
  font-size: .875rem; color: var(--t3);
  background: none; border: 0; padding: 0; cursor: pointer;
  transition: color .2s, transform .2s;
  margin-bottom: .75rem; width: 100%; text-align: left;
}
.nav-logout:hover { color: var(--t1); transform: translateX(4px); }
.nav-footer b { display: block; color: var(--t2); font-size: .78rem; margin-bottom: .25rem; }

/* ── MAIN ── */
.main { padding: 2rem 2.5rem; overflow-y: auto; }

/* ── STATS + CHART WIDGET ── */
.stats-chart { margin-bottom: 1.5rem; }
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin-bottom: 1.25rem;
}
.stat-tile {
  padding: .75rem .875rem .65rem;
  cursor: pointer; transition: opacity .15s;
}
.stat-tile.active { border-bottom: 2px solid var(--purple); }
.stat-tile:hover { opacity: .8; }
.s-lbl {
  font-size: .6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--t3); margin-bottom: .2rem;
}
.s-val { font-size: 1.35rem; font-weight: 300; color: var(--t1); line-height: 1.1; }
.s-chg { font-size: .68rem; font-weight: 700; margin-top: .2rem; }
.change-up   { color: var(--up-color); }
.change-down { color: var(--dn-color); }
.metric-change { font-size: .68rem; font-weight: 700; }

.chart-wrap {
  position: relative;
  height: 200px;
  padding: 0 .5rem .5rem;
}
.chart-wrap canvas { position: absolute; inset: 0; }

/* ── DATA PANELS ── */
.data-row-panels {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 2rem; margin-bottom: 1.5rem;
}
.panel-group { min-width: 0; display: flex; flex-direction: column; height: 340px; }
.panel-hdr {
  display: flex; align-items: baseline; gap: 1rem;
  border-bottom: 1px solid var(--sep);
  margin-bottom: .75rem; padding-bottom: 0;
  flex-shrink: 0;
}
.p-tab {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--t3); padding: .4rem 0; margin-bottom: -1px;
  border-bottom: 2px solid transparent; cursor: pointer;
}
.p-tab.active { color: var(--t1); border-bottom-color: var(--t1); }
.p-row {
  display: flex; align-items: center;
  padding: .42rem 0; border-bottom: 1px solid var(--sep);
  position: relative;
}
.p-row:last-child { border-bottom: 0; }
.p-row[data-filter-key] { cursor: pointer; }
.p-row[data-filter-key]:hover .p-name { text-decoration: underline; }
.p-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(123,92,220,.1); border-radius: 2px; z-index: 0;
}
.p-name {
  position: relative; z-index: 1; font-size: .82rem; color: var(--t1); flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.p-val  { font-size: .78rem; color: var(--t3); margin-left: .75rem; flex-shrink: 0; }
/* Second value column (views) */
.p-val2 { font-size: .78rem; color: var(--t3); margin-left: .5rem; flex-shrink: 0; min-width: 2.5rem; text-align: right; }

/* Column header row above rows that have two value columns */
.p-col-hdr {
  display: flex; align-items: center;
  padding: .25rem 0 .2rem; border-bottom: 1px solid var(--sep);
  margin-bottom: .1rem;
}
.p-col-hdr-name { flex: 1; }
.p-col-hdr-val  { font-size: .62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--t3); margin-left: .75rem; flex-shrink: 0; min-width: 2.5rem; text-align: right; }

/* Expand icon button in panel header */
.expand-btn {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  color: var(--t3); font-size: .85rem; padding: .2rem .3rem;
  border-radius: 4px; line-height: 1; flex-shrink: 0;
  transition: color .15s, background .15s;
}
.expand-btn:hover { color: var(--t1); background: var(--btn-bg); }

/* Campaign widget: fixed height matching other panel-groups */
.campaign-widget .tab-panel { overflow-y: auto; flex: 1; }
.campaign-widget-footer {
  padding: .65rem 0 .25rem;
  border-top: 1px solid var(--sep);
  flex-shrink: 0;
}

/* ── EXPAND MODAL ── */
.expand-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.65); z-index: 1000;
  align-items: center; justify-content: center;
}
.expand-modal-overlay.open { display: flex; }
.expand-modal-box {
  background: var(--surface); border: 1px solid var(--sep);
  border-radius: 10px; padding: 1.5rem;
  width: calc(100% - 2rem); max-width: 820px;
  max-height: 80vh; display: flex; flex-direction: column;
}
.expand-modal-title {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; flex-shrink: 0;
}
.expand-modal-title h3 { font-size: .9rem; font-weight: 600; margin: 0; }
#expand-modal-content { overflow-y: auto; flex: 1; }
.expand-table {
  width: 100%; border-collapse: collapse; font-size: .82rem;
}
.expand-table th {
  text-align: left; padding: .4rem 0; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--t3);
  border-bottom: 1px solid var(--sep);
}
.expand-table th:not(:first-child) { text-align: right; padding-left: 1rem; }
.expand-table td { padding: .45rem 0; border-bottom: 1px solid var(--sep); color: var(--t1); }
.expand-table td:not(:first-child) { text-align: right; padding-left: 1rem; color: var(--t3); }
.expand-table tr:last-child td { border-bottom: 0; }
.expand-td-name { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Follow-cursor tooltip for breakdown row change % */
#row-tip {
  position: fixed; pointer-events: none; display: none;
  background: #1f1f1f; border: 1px solid #313131;
  font-size: .72rem; font-weight: 700;
  padding: .28rem .6rem; border-radius: 5px;
  white-space: nowrap; z-index: 9999;
  transform: translate(14px, -50%);
}
#row-tip.tip-up   { color: var(--up-color); }
#row-tip.tip-down { color: var(--dn-color); }

.tab-panel { flex: 1; overflow-y: auto; min-height: 0; min-width: 0; }

/* ── MAP ROW ── */
.map-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 2rem; margin-bottom: 1.5rem;
}
.map-svg { width: 100%; display: block; margin-bottom: .75rem; }
.map-legend-row {
  display: flex; align-items: center;
  padding: .38rem 0; border-bottom: 1px solid var(--sep);
}
.map-legend-row:last-child { border-bottom: 0; }
.ml-name { font-size: .82rem; color: var(--t1); flex: 1; }
.ml-val  { font-size: .78rem; color: var(--t3); }

/* ── RIGHT PANEL ── */
.right-panel {
  padding: 2rem 1.5rem;
  display: flex; flex-direction: column;
}
.rp-title { font-size: 1rem; font-weight: 600; margin-bottom: .25rem; }
.rp-sub   { font-size: .78rem; color: var(--t3); margin-bottom: 1.5rem; }
.upgrade-tile {
  background: var(--upgrade-bg);
  border-radius: 8px; padding: 1.1rem;
  margin-bottom: 1.5rem; cursor: pointer;
  transition: transform .2s;
}
.upgrade-tile:hover { transform: translateY(-3px); }
.ut-label {
  font-size: .6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: #5a4080; margin-bottom: .4rem;
}
.ut-plan  { font-size: 1.4rem; font-weight: 300; color: var(--upgrade-text); line-height: 1; }
.ut-price { font-size: .8rem; color: #5a4080; margin-top: .25rem; }
.ut-sites { font-size: .72rem; color: #5a4080; margin-top: .3rem; font-weight: 600; }
.ut-cta {
  display: block; margin-top: .875rem; padding: .45rem .875rem;
  background: rgba(26,8,64,.15); border: 1px solid rgba(26,8,64,.25);
  color: var(--upgrade-text); font-size: .78rem; font-weight: 600;
  border-radius: 4px; text-align: center; width: 100%;
  text-decoration: none; cursor: pointer;
}
.ut-cta:hover { background: rgba(26,8,64,.25); }
.sites-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: .75rem 0; border-bottom: 1px solid var(--sep);
  font-size: .82rem;
}
.sites-row span:first-child { color: var(--t3); }
.sites-row span:last-child  { font-weight: 500; }
.progress-bar  { height: 2px; background: var(--btn-bg); margin: .5rem 0 1.25rem; }
.progress-fill { height: 100%; background: var(--purple); }
.billing-btn {
  background: transparent; border: 1px solid var(--sep);
  color: var(--t3); font-size: .8rem; font-weight: 500;
  padding: .45rem 1.1rem; border-radius: 5px;
  display: inline-block; margin-top: .5rem;
  transition: border-color .15s, color .15s; cursor: pointer;
}
.billing-btn:hover { border-color: var(--t3); color: var(--t1); }

/* ── FORMS + INPUTS ── */
label {
  display: block; font-size: .75rem; font-weight: 600;
  color: var(--t3); margin: 1rem 0 .4rem;
  text-transform: uppercase; letter-spacing: .04em;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], .input {
  width: 100%; padding: .5rem .75rem;
  border: 1px solid var(--sep); border-radius: 6px;
  font-size: 14px; outline: none;
  background: var(--bg); color: var(--t1);
}
input[type="text"]:focus, input[type="email"]:focus,
input[type="password"]:focus, input[type="number"]:focus,
.input:focus { border-color: var(--purple); }

/* ── BUTTONS ── */
.btn {
  display: inline-block; padding: .55rem 1.1rem;
  border-radius: 6px; font-size: .875rem; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none;
}
.btn-primary         { background: var(--purple); color: #fff; }
.btn-primary:hover   { background: #6a4cc4; }
.btn-secondary       { background: transparent; border: 1px solid var(--sep); color: var(--t2); }
.btn-secondary:hover { border-color: var(--t3); color: var(--t1); }
.btn-full            { width: 100%; text-align: center; margin-top: 1.25rem; }
.link-btn {
  background: none; border: none;
  color: var(--t3); cursor: pointer; font-size: .8rem; padding: 0;
}
.link-btn:hover { color: var(--t1); }
.inline-form { display: inline-flex; }

/* ── ALERTS ── */
.alert       { padding: .65rem .875rem; border-radius: 6px; margin-bottom: 1rem; font-size: .8rem; }
.alert-error { background: rgba(248,113,113,.1); color: #f87171; border: 1px solid rgba(248,113,113,.25); }
.alert-info  { background: rgba(123,92,220,.12); color: #b39dff; border: 1px solid rgba(123,92,220,.3); }

/* ── CARDS (Sites + Billing tabs) ── */
.card {
  background: var(--surface);
  border: 1px solid var(--sep);
  border-radius: 8px; padding: 1.25rem; margin-bottom: 1.25rem;
}
.tab-header    { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab-header h1 { font-size: 1.375rem; font-weight: 700; }

/* ── TABLES ── */
table           { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: .68rem; color: var(--t3);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 0 0 .625rem; border-bottom: 1px solid var(--sep); font-weight: 700;
}
td {
  padding: .5625rem 0; border-bottom: 1px solid var(--sep);
  font-size: .8rem; color: var(--t1);
}
tr:last-child td         { border-bottom: 0; }
td:last-child, th:last-child { text-align: right; padding-right: 1.25rem; }
.td-num   { text-align: right; }
th.td-num { text-align: right; }
.td-page  { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── BILLING ── */
.billing-card { max-width: 480px; }
.billing-row {
  display: flex; justify-content: space-between;
  padding: .75rem 0; border-bottom: 1px solid var(--sep); color: var(--t3);
}
.billing-row strong { color: var(--t1); }

/* ── SNIPPET CARD ── */
.snippet-card pre {
  background: var(--bg); padding: .75rem; border-radius: 6px;
  font-size: .75rem; overflow-x: auto; white-space: pre-wrap;
  margin: .75rem 0; border: 1px solid var(--sep);
}

/* ── LOCKED OVERLAY ── */
.locked-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.85); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.locked-card {
  background: var(--surface); border-radius: 10px; padding: 2.5rem;
  max-width: 400px; text-align: center; border: 1px solid var(--sep);
}
.locked-card h2 { margin-bottom: .75rem; }
.locked-card p  { color: var(--t3); margin-bottom: 1.5rem; }

/* ── MISC ── */
.empty-state { text-align: center; padding: 3.75rem 1.25rem; color: var(--t3); }
.hint        { color: var(--t3); font-size: .75rem; margin-top: .5rem; }
.hidden      { display: none; }
.devices-sub {
  font-size: .68rem; font-weight: 700; color: var(--t3);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem;
}
.devices-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

/* ── LOGIN PAGE ── */
.login-page {
  display: flex; justify-content: center; align-items: center;
  min-height: 100vh; background: var(--surface);
}
.login-box { width: 340px; }
.login-logo {
  display: flex; align-items: center; gap: .65rem;
  padding-bottom: 1.5rem; border-bottom: 1px solid var(--sep); margin-bottom: 2rem;
}
.fl {
  font-size: .62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--t3); margin: 1.1rem 0 .35rem;
}
input.fi {
  width: 100%; padding: .45rem 0;
  border: 0; border-bottom: 1px solid var(--sep);
  border-radius: 0; background: transparent; color: var(--t1);
  font-size: .875rem; outline: none;
}
input.fi:focus { border-bottom-color: var(--purple); }
.btn-login {
  width: 100%; margin-top: 1.75rem; padding: .7rem;
  background: var(--purple); border: 0; color: #fff;
  font-size: .875rem; font-weight: 600; border-radius: 5px;
}
.btn-login:hover { background: #6a4cc4; }
.forgot {
  display: block; margin-top: .875rem; text-align: center;
  font-size: .75rem; color: var(--t3); cursor: pointer;
  background: none; border: none; width: 100%;
}
.forgot:hover { color: var(--t1); }

/* ── RESPONSIVE (tablet) ── */
@media (max-width: 900px) {
  .body { grid-template-columns: 1fr; }
  .left-nav { display: none; }
  .right-panel { display: none; }
  .data-row-panels { grid-template-columns: 1fr; }
  .map-row { grid-template-columns: 1fr; }
}

/* ── Mobile burger (hidden on desktop) ── */
.mob-burger {
  display: none;
  align-items: center; justify-content: center;
  background: none; border: none;
  color: var(--t3); cursor: pointer;
  width: 32px; height: 32px;
  padding: 0; flex-shrink: 0;
  transition: color .2s;
}
.mob-burger:hover { color: var(--t1); }

/* ── Mobile drawer overlay ── */
.mob-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 400;
}
.mob-overlay.open { display: block; }

/* ── Mobile drawer panel ── */
.mob-drawer {
  flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0;
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--sep);
  z-index: 500;
  transform: translateX(-100%);
  transition: transform .25s ease;
  display: none; /* flex only on mobile */
}
.mob-drawer.open { transform: translateX(0); }
.mob-drawer-head {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--sep);
}
.mob-drawer-close {
  background: none; border: none; color: var(--t3);
  cursor: pointer; font-size: 1.5rem; line-height: 1; padding: 0;
  transition: color .2s;
}
.mob-drawer-close:hover { color: var(--t1); }
.mob-drawer-nav {
  display: flex; flex-direction: column;
  padding: .75rem 0; flex: 1; overflow-y: auto;
}
.mob-drawer-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .65rem 1.25rem; font-size: .875rem;
  color: var(--t3); text-decoration: none;
  transition: background .15s, color .15s;
}
.mob-drawer-link:hover  { background: var(--btn-bg); color: var(--t1); }
.mob-drawer-link.active { color: var(--t1); font-weight: 600; }
.mob-drawer-foot {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--sep);
}
.mob-drawer-plan {
  font-size: .75rem; color: var(--t3);
  margin-bottom: .75rem; line-height: 1.5;
}
.mob-drawer-plan strong { color: var(--t2); }
.mob-drawer-logout {
  display: flex; align-items: center; gap: .6rem;
  background: none; border: none;
  color: var(--t3); font-size: .875rem; cursor: pointer; padding: 0;
  transition: color .2s;
}
.mob-drawer-logout:hover { color: var(--t1); }

/* ── Mobile plan strip (hidden on desktop) ── */
.mob-plan-strip {
  display: none;
  background: var(--surface);
  border: 1px solid var(--sep);
  border-radius: 8px;
  padding: .75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: .82rem;
}
.mob-plan-row  { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.mob-plan-label { font-weight: 600; color: var(--t1); }
.mob-plan-sub   { font-size: .75rem; color: var(--t3); }
.mob-plan-upgrade { color: var(--purple); font-size: .78rem; text-decoration: none; }
.mob-plan-sites   { color: var(--t3); font-size: .78rem; }
.mob-plan-usage   { color: var(--t3); font-size: .72rem; margin-bottom: .3rem; }
.mob-plan-bar { height: 3px; background: var(--btn-bg); border-radius: 2px; }
.mob-plan-bar div { height: 100%; background: var(--purple); border-radius: 2px; }

/* ── Mobile footer (hidden on desktop) ── */
.mob-footer {
  display: none;
  align-items: center; justify-content: space-between;
  padding: 1.25rem 0 .5rem;
  margin-top: 2rem;
  border-top: 1px solid var(--sep);
}
.mob-footer-logout {
  display: inline-flex; align-items: center; gap: .5rem;
  background: none; border: 1px solid var(--sep); color: var(--t3);
  border-radius: 6px; padding: .45rem .875rem;
  font-size: .82rem; cursor: pointer; transition: color .2s, border-color .2s;
}
.mob-footer-logout:hover { color: var(--t1); border-color: var(--t3); }
.mob-footer-copy { font-size: .7rem; color: var(--t3); }

/* Hide text on mobile (keep dot + number in online badge) */
.mob-txt-hide { } /* visible on desktop, hidden on mobile via media query */

/* ── Mobile (phone) ── */
@media (max-width: 768px) {
  /* Topbar: 2-row flex layout */
  .topbar {
    display: flex; flex-wrap: wrap;
    align-items: center;
    padding: .5rem .875rem;
    gap: 0; column-gap: .5rem;
  }
  .logo { order: 1; flex: 0 0 auto; }
  .logo-name { display: none; }
  /* User section pushed to the right of logo on row 1 */
  .topbar-user {
    order: 2;
    margin-left: auto;
    padding-right: 0;
    gap: .4rem;
  }
  /* Hide name/email text block in topbar */
  .topbar-user > div:first-child { display: none; }
  /* Show hamburger */
  .mob-burger { display: inline-flex; }
  /* Topbar mid: second row, full width */
  .topbar-mid {
    order: 3;
    flex: 0 0 100%;
    padding: .45rem 0 .25rem;
    border-top: 1px solid var(--sep);
    margin-top: .4rem;
    justify-content: space-between;
  }
  .topbar-mid-left { flex: 1; min-width: 0; gap: .6rem; }
  /* Hide calendar icon in date picker (keep just the label) */
  .date-select > svg:first-child { display: none; }
  /* Hide + Add site btn from topbar (accessible via Sites tab) */
  .topbar-mid-right .add-site-btn { display: none; }
  /* Truncate "currently online" to just number + dot */
  .mob-txt-hide { display: none; }

  /* Main: reduced padding + extra bottom space for footer */
  .main { padding: 1rem .875rem 1.5rem; }

  /* Stats: 3 columns */
  .stat-tiles { grid-template-columns: repeat(3, 1fr); }
  .stat-tile  { padding: .6rem .5rem .5rem; }
  .s-val      { font-size: 1.1rem; }

  /* Show mobile-only elements */
  .mob-plan-strip { display: block; }
  .mob-footer     { display: flex; }
  .mob-drawer     { display: flex; }

  /* Panel groups: slightly reduced height on phone */
  .panel-group { height: 280px; }

  /* Tables on mobile: hide some columns, shrink padding */
  .main table td, .main table th { font-size: .75rem; padding: .4rem .25rem; }
}

/* ── SNIPPET MODAL ── */
.snippet-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.65); z-index: 1000;
  align-items: center; justify-content: center;
}
.snippet-modal-overlay.open { display: flex; }
.snippet-modal-box {
  background: var(--surface); border: 1px solid var(--sep);
  border-radius: 10px; padding: 1.5rem;
  max-width: 560px; width: calc(100% - 2rem);
}
.snippet-modal-title {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
.snippet-modal-title h3 { font-size: .9rem; font-weight: 600; margin: 0; }
.snippet-modal-close {
  background: none; border: 0; color: var(--t3);
  cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 0;
}
.snippet-modal-close:hover { color: var(--t1); }
.snippet-modal-box pre {
  background: var(--bg); padding: 12px 14px; border-radius: 6px;
  font-size: 12px; white-space: pre-wrap; border: 1px solid var(--sep);
  margin: 0;
}

/* Snippet feature toggles */
.snippet-features {
  margin: .875rem 0;
  padding: .75rem .875rem;
  background: var(--bg);
  border: 1px solid var(--sep);
  border-radius: 6px;
}
.snippet-feat-title {
  font-size: .62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--t3); margin-bottom: .6rem;
}
.snippet-feat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .25rem;
}
.snippet-feat-opt {
  display: flex; align-items: flex-start; gap: .5rem;
  padding: .35rem .4rem; border-radius: 4px;
  cursor: pointer; transition: background .12s;
}
.snippet-feat-opt:hover { background: var(--btn-bg); }
.snippet-feat-opt input[type=checkbox] {
  margin-top: .15rem; flex-shrink: 0;
  width: 13px; height: 13px; cursor: pointer;
  accent-color: var(--purple);
}
.snippet-feat-opt strong { display: block; font-size: .8rem; color: var(--t1); font-weight: 600; }
.snippet-feat-opt small  { display: block; font-size: .7rem; color: var(--t3); line-height: 1.45; margin-top: .15rem; }
.snippet-feat-opt code   { font-size: .66rem; background: var(--bg); padding: .1rem .25rem; border-radius: 3px; }

/* Snippet "Optional measurements" collapse toggle */
.snippet-feat-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: 0; text-align: left; cursor: pointer;
  font-size: .62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--t3); padding: 0;
}
.snippet-feat-toggle:hover { color: var(--t1); }
.snippet-feat-arrow { display: inline-block; transition: transform .2s; margin-left: .4rem; }

/* ── UTM Builder form (site-settings section) ── */
.utm-builder { max-width: 580px; }
.utm-field { margin-bottom: 1rem; }
.utm-field label { display: block; font-size: .78rem; font-weight: 600; color: var(--t2); margin-bottom: .3rem; }
.utm-field label span { font-weight: 400; color: var(--t3); }
.utm-field input { width: 100%; box-sizing: border-box; }
.utm-output {
  background: var(--bg); border: 1px solid var(--sep);
  border-radius: 6px; padding: .75rem 1rem;
  font-family: monospace; font-size: .8rem; color: var(--t1);
  word-break: break-all; margin-bottom: .75rem; min-height: 2.4rem;
}

/* ══ Site Settings page ═══════════════════════════════════════════════════ */
.ss-layout {
  display: flex; gap: 2rem; align-items: flex-start;
  padding: 2rem; max-width: 960px; margin: 0 auto;
}
.ss-sidebar {
  width: 190px; flex-shrink: 0;
  position: sticky; top: 1.5rem;
}
.ss-sidebar-title {
  font-size: .7rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--t3); padding: 0 .75rem .6rem;
}
.ss-nav { display: flex; flex-direction: column; }
.ss-nav-item {
  display: block; padding: .5rem .75rem; border-radius: 6px;
  font-size: .85rem; color: var(--t2); text-decoration: none;
  transition: background .15s, color .15s;
}
.ss-nav-item:hover  { background: var(--surface); color: var(--t1); }
.ss-nav-item.active { background: var(--surface); color: var(--t1); font-weight: 600; }

.ss-main { flex: 1; min-width: 0; }

.ss-section-title {
  font-size: .875rem; font-weight: 700; margin-bottom: 1rem;
}

/* Inline back link + domain badge in topbar */
.ss-back-link {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .8rem; color: var(--t3); text-decoration: none;
  transition: color .15s;
}
.ss-back-link:hover { color: var(--t1); }
.ss-domain-badge {
  font-size: .82rem; font-weight: 600; color: var(--t2);
  background: var(--surface); border: 1px solid var(--sep);
  padding: .2rem .6rem; border-radius: 20px;
}

/* Tables inside settings sections */
.ss-table {
  width: 100%; border-collapse: collapse; font-size: .85rem;
}
.ss-table th {
  text-align: left; font-weight: 600; font-size: .75rem;
  color: var(--t3); padding: .5rem .75rem;
  border-bottom: 1px solid var(--sep);
}
.ss-table td {
  padding: .65rem .75rem; border-bottom: 1px solid var(--sep);
  vertical-align: middle;
}
.ss-table tr:last-child td { border-bottom: 0; }

/* Role badges */
.ss-role-badge {
  display: inline-block; font-size: .7rem; font-weight: 700;
  padding: .15rem .5rem; border-radius: 12px; text-transform: uppercase;
  letter-spacing: .04em;
}
.ss-role-badge.owner  { background: #3b2fa0; color: #c4b5fd; }
.ss-role-badge.admin  { background: #1e3a2e; color: #4ade80; }
.ss-role-badge.viewer { background: var(--btn-bg); color: var(--t3); }
.ss-role-badge.event  { background: #1e2a3a; color: #60a5fa; }
.ss-role-badge.page   { background: #2a1e3a; color: #c084fc; }

/* Goal modal */
.goal-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.65); z-index: 1000;
  align-items: center; justify-content: center;
}
.goal-modal-overlay.open { display: flex; }
.goal-modal-box {
  background: #1a1a1a; border: 1px solid var(--sep);
  border-radius: 10px; padding: 1.75rem;
  width: calc(100% - 2rem); max-width: 480px;
}
.goal-modal-title { font-size: 1.05rem; font-weight: 700; color: var(--t1); margin: 0 0 1.25rem; }
.goal-modal-tabs {
  display: flex; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--sep); margin-bottom: 1rem;
}
.goal-modal-tab {
  flex: 1; padding: .55rem 1rem; text-align: center;
  font-size: .85rem; font-weight: 500; cursor: pointer;
  color: var(--t2); background: transparent; border: none;
  transition: background .15s, color .15s;
}
.goal-modal-tab.active { background: var(--purple); color: #fff; }
.goal-modal-desc { font-size: .82rem; color: var(--t3); margin: 0 0 1.1rem; line-height: 1.55; }
.goal-modal-field { margin-bottom: .9rem; }
.goal-modal-field label { display: block; font-size: .82rem; font-weight: 600; color: var(--t1); margin-bottom: .4rem; }
.goal-modal-actions { margin-top: 1.25rem; }
.goal-modal-actions .btn { width: 100%; justify-content: center; padding: .7rem; font-size: .9rem; }

/* Toggle row (checkbox + label side by side) */
.ss-toggle-row {
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; font-size: .9rem; color: var(--t2);
}
.ss-toggle-row input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

/* Code block for embed snippet */
.ss-code {
  background: var(--bg); border: 1px solid var(--sep); border-radius: 6px;
  padding: 1rem; font-size: .78rem; white-space: pre-wrap; color: var(--t2);
  font-family: 'Courier New', monospace; margin: 0;
}

/* Shared link URL truncation */
.ss-link {
  color: var(--purple); font-size: .8rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 280px; display: inline-block; vertical-align: middle;
}

/* Small input variant */
.input-sm { padding: .25rem .5rem; font-size: .8rem; }

/* Radio role selector in invite form */
.ss-role-option {
  display: flex; align-items: flex-start; gap: .35rem;
  padding: .6rem .75rem; border-radius: 6px;
  border: 1px solid var(--sep); cursor: pointer;
  transition: border-color .15s;
}
.ss-role-option:has(input:checked) { border-color: var(--purple); }
.ss-role-option input[type=radio] { margin-top: .2rem; flex-shrink: 0; }

/* Thin separator in site-settings left nav */
.nav-sep {
  height: 1px; background: var(--sep);
  margin: .5rem 0;
}

/* Tiny uppercase domain label above site-settings section tabs */
.nav-site-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--t3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

@media (max-width: 640px) {
  .ss-layout { flex-direction: column; padding: 1rem; }
  .ss-sidebar { width: 100%; position: static; }
  .ss-nav { flex-direction: row; flex-wrap: wrap; gap: .35rem; }
}
