:root {
  color-scheme: dark;
  --bg: #080a08;
  --surface: #0d100d;
  --surface-2: #111510;
  --raised: #151a13;
  --line: #252a22;
  --line-accent: #45531a;
  --accent: #c1ef1a;
  --accent-dim: #28330f;
  --text: #f4f6f1;
  --muted: #a3a99d;
  --muted-2: #7d8477;
  --danger: #ffb4a8;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.skip-link { position: fixed; left: 12px; top: -50px; z-index: 99; background: var(--accent); color: #080a08; padding: 10px 14px; border-radius: 8px; font-weight: 800; }
.skip-link:focus { top: 12px; }
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: 248px;
  display: flex;
  flex-direction: column;
  padding: 24px 18px 18px;
  background: #090b09;
  border-right: 1px solid var(--line);
}
.brand-lockup { display: flex; align-items: center; gap: 11px; width: fit-content; text-decoration: none; padding: 4px 6px 22px; }
.brand-lockup > span:last-child { display: grid; gap: 3px; }
.brand-lockup b { font-size: 16px; letter-spacing: 4px; }
.brand-lockup small { font-size: 8px; letter-spacing: 2.1px; color: var(--muted-2); }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; overflow: hidden; }
.brand-mark img { width: 39px; height: 39px; object-fit: contain; }
.nav-list { display: grid; gap: 6px; padding-top: 22px; border-top: 1px solid var(--line); }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 0 12px; border: 1px solid transparent; border-radius: var(--radius-sm); text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 650; }
.nav-item:hover, .nav-item:focus-visible { color: var(--text); border-color: var(--line); outline: none; }
.nav-item.is-active { color: var(--accent); background: #1b220e; border-color: #29370d; }
.nav-icon { width: 20px; text-align: center; color: inherit; font-size: 17px; }
.sidebar-spacer { flex: 1; }
.system-card { border: 1px solid var(--line-accent); border-radius: var(--radius); padding: 17px; background: #0b0e0a; }
.system-head { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 9px; letter-spacing: 1.5px; font-weight: 800; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(193,239,26,.1); }
.system-card strong { display: block; margin: 18px 0 8px; font-size: 15px; line-height: 1.35; }
.system-card p { margin: 0; color: var(--muted-2); font-size: 11px; line-height: 1.55; }
.sidebar-meta { display: flex; justify-content: space-between; margin-top: 17px; padding: 0 4px; color: #656c61; font-size: 9px; letter-spacing: 1px; }
main { margin-left: 248px; padding: 0 38px 30px; max-width: 1680px; }
.topbar { min-height: 186px; display: flex; justify-content: space-between; gap: 48px; align-items: flex-end; padding: 44px 0 31px; border-bottom: 1px solid var(--line); }
.eyebrow { display: flex; align-items: center; gap: 9px; margin: 0 0 15px; color: var(--accent); font-size: 10px; letter-spacing: 1.7px; font-weight: 800; }
.eyebrow-line { width: 22px; height: 1px; background: var(--accent); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(32px, 3.2vw, 48px); letter-spacing: -1.7px; line-height: 1; }
.lede { max-width: 670px; margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.topbar-actions { display: flex; gap: 10px; align-items: center; padding-bottom: 4px; }
.mode-switch { display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: #0b0e0b; }
.mode-button { min-height: 38px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; color: var(--muted-2); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.mode-button:hover { color: var(--text); }
.mode-button.is-active { background: #222a11; color: var(--accent); }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 26px; min-height: 48px; padding: 0 16px 0 19px; border-radius: 10px; background: var(--accent); color: #080a08; text-decoration: none; font-size: 12px; font-weight: 850; }
.primary-button:hover { background: #d0ff24; }
.primary-button span { font-size: 17px; }
.config-banner { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 15px; margin-top: 22px; padding: 15px 17px; border: 1px solid #5d4b23; border-radius: 12px; background: #17140c; }
.config-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: #352c17; color: #f7ce6a; font-weight: 900; }
.config-banner strong { font-size: 12px; }
.config-banner p { margin: 3px 0 0; color: #afa487; font-size: 11px; }
.config-banner a { color: #f7ce6a; font-size: 11px; font-weight: 750; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin: 0 0 24px; }
.compact-heading { margin-top: 32px; }
.section-kicker { display: block; color: var(--accent); font-size: 9px; line-height: 1; letter-spacing: 1.6px; font-weight: 850; }
.section-heading h2, .panel-head h2 { margin: 10px 0 0; font-size: 20px; letter-spacing: -.35px; }
.section-heading p { max-width: 660px; margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.data-stamp { display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 8px; color: var(--muted); font-size: 9px; letter-spacing: 1.1px; font-weight: 800; }
.data-stamp small { grid-column: 2; margin-top: 3px; color: #666d62; font-size: 9px; letter-spacing: 0; font-weight: 500; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(193,239,26,.08); }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.metric-card { min-width: 0; padding: 20px 20px 18px; border-right: 1px solid var(--line); }
.metric-card:last-child { border-right: 0; }
.metric-card.is-primary { background: #10150b; box-shadow: inset 0 2px 0 var(--accent); }
.metric-label { color: var(--muted-2); font-size: 10px; letter-spacing: .7px; font-weight: 700; text-transform: uppercase; }
.metric-value { margin: 13px 0 12px; font-variant-numeric: tabular-nums; font-size: clamp(26px, 2.2vw, 36px); line-height: 1; font-weight: 760; letter-spacing: -1.2px; }
.is-primary .metric-value { color: var(--accent); }
.metric-meta { display: flex; align-items: center; gap: 7px; color: #697065; font-size: 10px; }
.mini-signal { width: 16px; height: 5px; border-left: 2px solid var(--accent); border-right: 5px solid var(--accent); }
.analysis-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr); gap: 16px; margin-top: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px 17px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 17px; }
.panel-note, .privacy-badge { align-self: center; border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; color: var(--muted-2); font-size: 8px; letter-spacing: 1px; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th { padding: 10px 13px; border-bottom: 1px solid var(--line); color: #6c7368; font-size: 8px; letter-spacing: 1px; text-align: left; text-transform: uppercase; }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 22px; text-align: right; }
td { padding: 14px 13px; border-bottom: 1px solid #1d211b; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.rank { color: #62685f; }
.template-cell { min-width: 185px; }
.template-title { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 12px; font-weight: 720; }
.leader-tag { border-radius: 999px; padding: 3px 6px; background: var(--accent-dim); color: var(--accent); font-size: 7px; letter-spacing: .8px; }
.template-sub { margin-top: 5px; color: #686f64; font-size: 9px; }
.ctr-cell { min-width: 102px; }
.ctr-number { color: var(--text); font-weight: 750; }
.ctr-track { width: 78px; height: 3px; margin: 7px 0 0 auto; background: #252a22; }
.ctr-fill { display: block; height: 100%; background: var(--accent); }
.link-panel { min-height: 360px; }
.link-performance { padding: 14px 20px 8px; }
.link-row { display: grid; grid-template-columns: 25px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; }
.link-rank { color: #596057; font-size: 9px; }
.link-info { min-width: 0; }
.link-title { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: var(--text); font-size: 11px; font-weight: 650; }
.link-title small { color: var(--muted-2); font-weight: 500; }
.link-track { height: 4px; background: #23281f; }
.link-track span { display: block; height: 100%; background: var(--accent); }
.link-count { color: var(--accent); font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 700; }
.link-insight { display: flex; gap: 10px; margin: 8px 20px 19px; padding: 12px; border: 1px solid #303a16; border-radius: 9px; background: #11150b; }
.link-insight span { color: var(--accent); }
.link-insight p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.feed-grid { display: grid; grid-template-columns: minmax(280px, .62fr) minmax(0, 1.38fr); gap: 16px; margin-top: 16px; }
.winner-panel { position: relative; min-height: 263px; padding: 21px 22px; background: #11160b; border-color: #344112; }
.winner-index { position: absolute; right: 18px; top: 12px; color: rgba(193,239,26,.09); font-size: 84px; line-height: 1; font-weight: 900; letter-spacing: -7px; }
.winner-panel h2 { position: relative; margin: 55px 0 7px; font-size: 22px; }
.winner-panel > p { position: relative; max-width: 280px; color: var(--muted); font-size: 11px; }
.winner-score { position: absolute; right: 22px; bottom: 20px; display: grid; text-align: right; }
.winner-score span { color: var(--accent); font-size: 26px; font-weight: 800; }
.winner-score small { color: #69705f; font-size: 7px; letter-spacing: 1px; }
.winner-panel > a { position: absolute; left: 22px; bottom: 21px; display: flex; gap: 18px; color: var(--accent); font-size: 10px; font-weight: 750; }
.recent-clicks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 7px 18px 14px; }
.click-event { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 13px 7px; border-bottom: 1px solid #1e221c; }
.click-event:nth-last-child(-n + 2) { border-bottom: 0; }
.event-icon { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid #354014; border-radius: 8px; color: var(--accent); background: #11150c; font-size: 12px; }
.event-copy { min-width: 0; }
.event-copy b { display: block; overflow: hidden; color: var(--text); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.event-copy small { color: #697066; font-size: 8px; }
.event-time { color: #697066; font-size: 8px; white-space: nowrap; }
.templates-section { margin-top: 74px; scroll-margin-top: 26px; }
.template-count { display: flex; align-items: flex-end; gap: 8px; }
.template-count b { color: var(--accent); font-size: 46px; line-height: .8; letter-spacing: -2px; }
.template-count span { color: var(--muted-2); font-size: 8px; letter-spacing: 1.5px; }
.template-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.template-card { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.template-card:first-child { border-color: #46551a; }
.template-viewport { position: relative; height: 328px; overflow: hidden; background: #161a15; border-bottom: 1px solid var(--line); }
.template-viewport iframe { position: absolute; left: 50%; top: 0; width: 640px; height: 850px; border: 0; transform: translateX(-50%) scale(.43); transform-origin: top center; pointer-events: none; background: white; }
.template-number { position: absolute; top: 14px; left: 14px; z-index: 2; display: grid; place-items: center; width: 31px; height: 25px; border: 1px solid #4b5b1a; border-radius: 7px; background: rgba(8,10,8,.92); color: var(--accent); font-size: 9px; font-weight: 800; }
.template-content { padding: 20px; }
.template-meta { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.template-meta h3 { margin: 5px 0 0; font-size: 17px; }
.template-angle { color: var(--accent); font-size: 8px; letter-spacing: 1.2px; text-transform: uppercase; }
.template-audience { max-width: 190px; color: var(--muted-2); font-size: 9px; line-height: 1.5; text-align: right; }
.subject-box { min-height: 53px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #0a0d0a; }
.subject-box small { display: block; margin-bottom: 5px; color: #666d62; font-size: 7px; letter-spacing: 1px; }
.subject-box p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.template-actions { display: flex; gap: 8px; margin-top: 13px; }
.template-actions a { flex: 1; display: flex; justify-content: space-between; align-items: center; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 9px; font-weight: 700; }
.template-actions a:first-child { border-color: #46551a; color: var(--accent); }
.template-actions a:hover { background: #161b11; color: var(--text); }
.method-section { margin-top: 74px; }
.method-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 14px; align-items: center; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.method-flow article { display: grid; grid-template-columns: auto 1fr; gap: 13px; align-items: start; padding: 8px; }
.method-flow article > span { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid #45521b; border-radius: 8px; color: var(--accent); font-size: 9px; }
.method-flow b { font-size: 12px; }
.method-flow p { margin: 7px 0 0; color: var(--muted-2); font-size: 10px; line-height: 1.55; }
.method-flow > i { color: #4e554a; font-style: normal; }
.setup-section { display: flex; justify-content: space-between; gap: 30px; align-items: center; margin-top: 54px; padding: 27px 28px; border: 1px solid #584b24; border-radius: var(--radius); background: #15130d; }
.setup-section h2 { margin: 11px 0 8px; font-size: 21px; }
.setup-section p { max-width: 680px; margin: 0; color: #aaa18b; font-size: 11px; line-height: 1.6; }
.setup-section code { padding: 12px 14px; border: 1px solid #5e5129; border-radius: 9px; color: #f6cd66; background: #0f0e0a; font-size: 11px; white-space: nowrap; }
.footer { display: flex; justify-content: space-between; margin-top: 64px; padding: 24px 0 6px; border-top: 1px solid var(--line); color: #5d645a; font-size: 9px; letter-spacing: 1px; }
.footer p { margin: 0; }
.empty-row td { padding: 34px 22px; color: var(--muted-2); text-align: center !important; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .metric-card:nth-child(3) { border-right: 0; }
  .metric-card:nth-child(-n + 3) { border-bottom: 1px solid var(--line); }
  .analysis-grid { grid-template-columns: 1fr; }
  .template-gallery { grid-template-columns: 1fr; }
  .template-viewport { height: 370px; }
  .template-viewport iframe { transform: translateX(-50%) scale(.5); }
}
@media (max-width: 860px) {
  .sidebar { position: static; width: auto; height: 68px; flex-direction: row; align-items: center; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand-lockup { padding: 0; }
  .nav-list { display: flex; margin-left: auto; padding: 0; border: 0; }
  .nav-item { min-height: 39px; padding: 0 10px; font-size: 0; }
  .nav-icon { font-size: 16px; }
  .sidebar-spacer, .system-card, .sidebar-meta { display: none; }
  main { margin-left: 0; padding: 0 20px 24px; }
  .topbar { align-items: flex-start; flex-direction: column; padding-top: 38px; }
  .topbar-actions { width: 100%; }
  .mode-switch { flex: 1; }
  .mode-button { flex: 1; }
  .feed-grid { grid-template-columns: 1fr; }
  .method-flow { grid-template-columns: 1fr; }
  .method-flow > i { transform: rotate(90deg); justify-self: center; }
}
@media (max-width: 620px) {
  main { padding-inline: 14px; }
  .topbar-actions { align-items: stretch; flex-direction: column; }
  .primary-button { justify-content: space-between; }
  .config-banner { grid-template-columns: auto 1fr; }
  .config-banner a { grid-column: 2; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-card { border-bottom: 1px solid var(--line); }
  .metric-card:nth-child(2n) { border-right: 0; }
  .metric-card:nth-child(3) { border-right: 1px solid var(--line); }
  .metric-card:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .recent-clicks { grid-template-columns: 1fr; }
  .click-event:nth-last-child(-n + 2) { border-bottom: 1px solid #1e221c; }
  .click-event:last-child { border-bottom: 0; }
  .template-viewport { height: 292px; }
  .template-viewport iframe { transform: translateX(-50%) scale(.38); }
  .template-meta { flex-direction: column; }
  .template-audience { max-width: none; text-align: left; }
  .setup-section { align-items: flex-start; flex-direction: column; }
  .section-heading { align-items: flex-start; }
  .template-count { display: none; }
  .footer { gap: 10px; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
