:root {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #dbeafe;
  --green: #059669;
  --amber: #d97706;
  --rose: #e11d48;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 12px 32px rgba(15, 23, 42, .06);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--border);
  background: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  color: var(--text);
  font-size: 18px;
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
}

.sidebar-nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: #334155;
  text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a:focus {
  background: var(--panel-soft);
  color: var(--text);
}

.main-shell {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(226, 232, 240, .9);
  background: rgba(248, 250, 252, .86);
  backdrop-filter: blur(16px);
}

.topbar strong {
  display: block;
  font-size: 16px;
}

.topbar-label,
.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.content-shell {
  padding: 28px;
}

.account-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.account-link {
  max-width: 220px;
  overflow: hidden;
  color: #334155;
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .18);
}

.primary-button:hover,
.primary-button:focus {
  background: var(--accent-strong);
}

.primary-button.small {
  min-height: 34px;
  padding: 7px 12px;
}

.ghost-button {
  background: #fff;
  color: #334155;
  border-color: var(--border);
}

.dashboard-header,
.install-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.dashboard-header h1,
.install-header h1,
.privacy-panel h1 {
  max-width: 760px;
  margin: 4px 0 8px;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0;
}

.dashboard-subtitle,
.install-header p,
.privacy-panel p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
}

.site-picker {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.analytics-filters {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.analytics-filters label {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.analytics-filters span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.site-picker label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.site-picker select,
.site-picker input,
.analytics-filters select {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric-card,
.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px;
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card span {
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 30px;
  line-height: 1;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(420px, .92fr) minmax(460px, 1.08fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.panel-heading h2 {
  margin: 0;
  font-size: 17px;
}

.panel-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: #334155;
  font-size: 12px;
  font-weight: 750;
}

.visitors-list {
  display: grid;
}

.visitor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}

.visitor-row:hover,
.visitor-row.active {
  background: #f8fbff;
}

.visitor-row.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.visitor-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.visitor-main strong,
.visitor-main small {
  display: block;
}

.visitor-main small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
}

.source-google {
  background: var(--green);
}

.source-chatgpt {
  background: var(--accent);
}

.source-social {
  background: var(--rose);
}

.source-direct {
  background: var(--amber);
}

.visitor-meta {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0 18px;
}

.detail-list div {
  min-width: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.detail-list div:nth-child(odd) {
  padding-right: 14px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.detail-list dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.detail-list a,
.timeline a {
  color: var(--accent);
  text-decoration: none;
}

.detail-list a:hover,
.timeline a:hover {
  text-decoration: underline;
}

.timeline-section {
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h3 {
  margin: 0;
  font-size: 15px;
}

.section-title span,
.muted-line {
  color: var(--muted);
  font-size: 13px;
}

.timeline {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
}

.timeline time {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.timeline strong,
.timeline a {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.timeline strong {
  font-size: 13px;
}

.timeline a {
  margin-top: 2px;
  font-size: 13px;
}

.inline-outbound-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.inline-outbound {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.inline-outbound span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.inline-outbound strong {
  color: #1e3a8a;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.report-table-wrap {
  overflow-x: auto;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
}

.report-table th,
.report-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.report-table th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-table td {
  font-size: 14px;
}

.report-table td strong,
.report-table td a {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.report-table td a {
  margin-top: 3px;
  color: var(--accent);
  text-decoration: none;
}

.report-table td a:hover {
  text-decoration: underline;
}

.empty-state {
  display: grid;
  gap: 8px;
  margin: 18px;
  padding: 24px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.empty-state.compact {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.empty-state h3 {
  margin: 0;
  font-size: 16px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.empty-state code,
.code-block {
  overflow-x: auto;
  border-radius: 8px;
  background: #0f172a;
  color: #dbeafe;
}

.empty-state code {
  padding: 12px;
}

.install-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
  gap: 18px;
}

.difference-band {
  display: grid;
  grid-template-columns: minmax(280px, .72fr) minmax(0, 1.28fr);
  gap: 22px;
  margin-bottom: 18px;
  padding: 24px;
}

.difference-band h2 {
  margin: 6px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

.difference-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.difference-grid article {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.difference-grid strong {
  display: block;
  margin-bottom: 6px;
}

.difference-grid p {
  margin: 0;
  color: var(--muted);
}

.code-block {
  margin: 18px;
  padding: 18px;
}

.feature-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 18px 18px 22px;
  list-style: none;
}

.feature-list li {
  padding-left: 20px;
  position: relative;
}

.feature-list li::before {
  position: absolute;
  left: 0;
  color: var(--green);
  content: "✓";
  font-weight: 800;
}

.privacy-panel {
  max-width: 840px;
  padding: 24px;
}

.contact-panel {
  max-width: 840px;
  padding: 24px;
}

.contact-panel h1 {
  margin: 4px 0 10px;
  font-size: 30px;
  line-height: 1.15;
}

.contact-panel p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

.contact-card {
  display: grid;
  gap: 4px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.contact-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.contact-card a {
  color: var(--accent);
  font-size: 18px;
  font-weight: 750;
  text-decoration: none;
}

.contact-card a:hover {
  text-decoration: underline;
}

.auth-page {
  display: grid;
  min-height: calc(100vh - 128px);
  place-items: center;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(280px, .88fr) minmax(360px, 1.12fr);
  width: min(980px, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-panel.register-panel {
  width: min(1080px, 100%);
}

.auth-panel.auth-panel-narrow {
  width: min(860px, 100%);
}

.auth-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 500px;
  padding: 42px;
  background: #0f172a;
  color: #fff;
}

.auth-copy h1 {
  margin: 6px 0 12px;
  font-size: 32px;
  line-height: 1.1;
}

.auth-copy p:not(.eyebrow) {
  margin: 0;
  color: #cbd5e1;
}

.auth-form,
.website-form {
  display: grid;
  gap: 16px;
}

.auth-form {
  align-content: center;
  padding: 42px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span:first-child {
  color: #334155;
  font-size: 13px;
  font-weight: 750;
}

.field input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-error,
.validation-summary {
  color: var(--rose);
  font-size: 13px;
}

.validation-summary ul {
  margin: 0;
  padding-left: 18px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #334155;
  font-weight: 650;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.wide {
  width: 100%;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent);
  font-weight: 650;
}

.auth-links a {
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

.form-section-title {
  padding-top: 6px;
}

.form-section-title h2 {
  margin: 0;
  font-size: 14px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.snippet-preview {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.snippet-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.snippet-preview code,
.website-row code {
  overflow-wrap: anywhere;
  color: var(--accent);
  font-size: 13px;
}

.websites-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 18px;
}

.website-list {
  display: grid;
}

.website-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.website-row strong,
.website-row small,
.website-row a,
.website-row code {
  display: block;
}

.website-row small {
  margin-top: 2px;
  color: var(--muted);
}

.website-row div:last-child {
  text-align: right;
}

.website-row a {
  margin-top: 4px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.website-form {
  padding: 18px;
}

.inline-test-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.inline-test-form input {
  min-width: min(260px, 100%);
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

@media (max-width: 1180px) {
  .analytics-grid,
  .install-grid,
  .difference-band,
  .report-grid,
  .websites-grid {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand {
    margin-bottom: 12px;
  }

  .sidebar-nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
  }

  .topbar,
  .dashboard-header,
  .install-header {
    align-items: stretch;
    flex-direction: column;
  }

  .content-shell {
    padding: 18px;
  }

  .visitor-row {
    grid-template-columns: 1fr;
  }

  .visitor-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .metrics-grid,
  .detail-list,
  .difference-grid,
  .field-grid,
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-copy {
    min-height: auto;
    padding: 28px;
  }

  .auth-form {
    padding: 28px;
  }

  .dashboard-header h1,
  .install-header h1,
  .privacy-panel h1 {
    font-size: 25px;
  }

  .account-nav {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .timeline li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
