@font-face {
  font-family: "Geist";
  src: url("/assets/geist.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 100 900;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/assets/geist-mono.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 100 900;
}

/* AI Visibility dashboard tokens */

:root {
  color-scheme: light;
  --font-sans: Inter, "Geist", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  --bg: #f7f7f8;
  --bg-subtle: #f7f7f8;
  --surface: #ffffff;
  --hover: #f4f4f5;
  --active: #ffffff;
  --line: #e8e8ec;
  --line-strong: #d4d4d8;
  --line-hover: #a1a1aa;
  --ink: #18181b;
  --muted: #575761;
  --faint: #8a8a94;
  --blue: #2563eb;
  --blue-soft: #eef3ff;
  --blue-line: #bfdbfe;
  --green: #297a3a;
  --green-dot: #45a557;
  --green-soft: #ebfaee;
  --green-line: #c8f0d1;
  --amber: #a35200;
  --amber-dot: #f5a623;
  --amber-soft: #fff6e5;
  --amber-line: #ffe1a8;
  --red: #cb2a2f;
  --red-dot: #e5484d;
  --red-soft: #ffeeef;
  --red-line: #ffd1d3;
  --purple: #7820bc;
  --purple-soft: #f9f0ff;
  --purple-line: #ecd9fb;
  --focus: 0 0 0 1px var(--line-hover), 0 0 0 4px rgb(161 161 170 / 16%);
  --shadow-card: 0 1px 2px rgb(16 24 40 / 4%);
  --shadow-active: 0 1px 2px rgb(16 24 40 / 8%);
  --shadow-menu: 0 4px 12px rgb(0 0 0 / 8%), 0 0 0 1px rgb(0 0 0 / 8%);
  --chevron: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  --sidebar-width: 248px;
  --topbar-height: 48px;
  --radius-card: 12px;
  --radius-control: 8px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-subtle: #0a0a0a;
  --surface: #0a0a0a;
  --hover: #1a1a1a;
  --active: #1f1f1f;
  --line: #2e2e2e;
  --line-strong: #3d3d3d;
  --line-hover: #525252;
  --ink: #ededed;
  --muted: #a1a1a1;
  --faint: #7c7c7c;
  --blue: #47a8ff;
  --blue-soft: #06193a;
  --blue-line: #0d3868;
  --green: #62c073;
  --green-dot: #45a557;
  --green-soft: #0b2211;
  --green-line: #13401d;
  --amber: #ffb224;
  --amber-dot: #f5a623;
  --amber-soft: #291800;
  --amber-line: #4a2b00;
  --red: #ff6166;
  --red-dot: #e5484d;
  --red-soft: #2e0d0f;
  --red-line: #5c1a1d;
  --purple: #bf7af0;
  --purple-soft: #1f0d2e;
  --purple-line: #3d1a5c;
  --focus: 0 0 0 1px var(--line-hover), 0 0 0 4px rgb(255 255 255 / 8%);
  --shadow-menu: 0 4px 12px rgb(0 0 0 / 50%), 0 0 0 1px var(--line);
  --chevron: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.43;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "liga", "calt";
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
summary,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

code,
pre,
kbd {
  font-family: var(--font-mono);
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

/* Application frame: sidebar, topbar, content */

.dashboard-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
}

.top-nav {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  height: 100vh;
  grid-column: 1;
  grid-row: 1 / span 2;
  flex-direction: column;
  gap: 2px;
  padding: 0 16px 16px;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.brand-link {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 0 4px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  background: var(--ink);
  color: var(--surface);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-card);
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 8px;
}

.brand-copy strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0 7px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
}

.brand-link::after {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background: var(--muted);
  content: "";
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m7 15 5 5 5-5'/><path d='m7 9 5-5 5 5'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m7 15 5 5 5-5'/><path d='m7 9 5-5 5 5'/></svg>") center / contain no-repeat;
}

.nav-links {
  display: grid;
  gap: 3px;
}

.nav-group-label {
  display: block;
  margin: 18px 10px 5px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  min-height: 32px;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-control);
  padding: 0 10px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease;
}

.nav-link::before {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background: currentColor;
  content: "";
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.nav-link[href="/"] {
  --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='4 17 10 11 4 5'/><line x1='12' x2='20' y1='19' y2='19'/></svg>");
}

.nav-link[href="/suggestions"] {
  --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='22 12 16 12 14 15 10 15 8 12 2 12'/><path d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/></svg>");
}

.nav-link[href="/ppc-demand"] {
  --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 3v18h18'/><path d='m7 16 4-5 4 3 5-7'/></svg>");
}

.nav-link[href="/reports"] {
  --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/><path d='M14 2v6h6'/><path d='M8 13h8'/><path d='M8 17h8'/></svg>");
}

.nav-link[href="/sessions"] {
  --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='6' cy='19' r='3'/><path d='M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15'/><circle cx='18' cy='5' r='3'/></svg>");
}

.nav-link[href="/logs"] {
  --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M13 12h8'/><path d='M13 18h8'/><path d='M13 6h8'/><path d='M3 12h1'/><path d='M3 18h1'/><path d='M3 6h1'/><path d='M8 12h1'/><path d='M8 18h1'/><path d='M8 6h1'/></svg>");
}

.nav-link:hover {
  background: var(--hover);
  color: var(--ink);
}

.nav-link.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-active);
  outline: 1px solid var(--line);
}

.sidebar-footer {
  display: grid;
  gap: 2px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sidebar-environment {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}

.sidebar-environment > span:last-child {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.sidebar-environment strong {
  font-size: 13px;
  font-weight: 500;
}

.sidebar-environment small {
  color: var(--muted);
  font-size: 12px;
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green-dot);
}

.theme-toggle {
  display: flex;
  width: 100%;
  min-height: 32px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius-control);
  padding: 0 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  text-align: left;
}

.theme-toggle:hover {
  background: var(--hover);
  color: var(--ink);
}

.theme-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background: currentColor;
  font-size: 0;
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 18a6 6 0 0 0 0-12v12z'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 18a6 6 0 0 0 0-12v12z'/></svg>") center / contain no-repeat;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: var(--topbar-height);
  grid-column: 2;
  grid-row: 1;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.breadcrumb {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--ink);
}

.breadcrumb [aria-current="page"] {
  overflow: hidden;
  color: var(--ink);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crumb-separator {
  color: var(--line-hover);
  font-size: 18px;
  font-weight: 300;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.topbar-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: var(--bg);
  white-space: nowrap;
}

.page-content {
  width: 100%;
  min-width: 0;
  max-width: 1440px;
  grid-column: 2;
  grid-row: 2;
  margin: 0 auto;
  padding: 28px 32px 64px;
}

.page-logs .page-content {
  max-width: none;
}

body > footer {
  margin-left: var(--sidebar-width);
  padding: 20px 24px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 13px;
}

/* Page header */

.dashboard-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 24px;
}

.dashboard-hero > div:first-child {
  min-width: 0;
}

.dashboard-title {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.lede {
  max-width: 768px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.hero-context {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.hero-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.eyebrow {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.5;
}

.section-title {
  margin-bottom: 12px;
}

.panel-description {
  max-width: 680px;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.step-label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Buttons and form controls */

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-control);
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.primary-button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.primary-button:hover {
  border-color: #383838;
  background: #383838;
}

:root[data-theme="dark"] .primary-button:hover {
  border-color: #cccccc;
  background: #cccccc;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}

.secondary-button:hover {
  border-color: var(--line-strong);
  background: var(--hover);
}

.primary-button:disabled,
.secondary-button:disabled {
  border-color: var(--line);
  background: var(--hover);
  color: var(--faint);
  cursor: not-allowed;
}

.icon-button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 0 10px;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.icon-button:hover {
  background: var(--hover);
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--bg);
  color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input,
select {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: var(--chevron);
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 16px;
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--line-hover);
  outline: 0;
  box-shadow: var(--focus);
}

.field-label,
.filter-control > span,
.access-form > label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.field-label > span {
  color: var(--faint);
}

.search-field {
  position: relative;
  display: block;
  min-width: 0;
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 2;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  padding-left: 36px;
}

/* Cards, banners and status */

.card,
.table-card,
.service-status {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--muted);
  font-size: 13px;
}

.access-panel {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) minmax(300px, 420px);
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.access-panel::before {
  width: 18px;
  height: 18px;
  align-self: start;
  margin-top: 2px;
  background: var(--muted);
  content: "";
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect width='18' height='11' x='3' y='11' rx='2' ry='2'/><path d='M7 11V7a5 5 0 0 1 10 0v4'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect width='18' height='11' x='3' y='11' rx='2' ry='2'/><path d='M7 11V7a5 5 0 0 1 10 0v4'/></svg>") center / contain no-repeat;
}

.access-panel h2 {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
}

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

.access-panel .step-label {
  display: none;
}

.access-form .field-label {
  display: none;
}

.access-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.access-input-row input {
  width: 100%;
}

.access-panel-connected {
  border-color: var(--green-line);
  background: var(--green-soft);
}

.access-panel-connected::before {
  background: var(--green);
  -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='m9 12 2 2 4-4'/></svg>");
  mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='m9 12 2 2 4-4'/></svg>");
}

.access-panel-connected h2 {
  color: var(--green);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--faint);
}

.status-ok {
  background: var(--green-dot);
}

.status-error {
  background: var(--red-dot);
}

.tier-status,
.badges,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge,
.tier-pill {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--hover);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
}

.badge-green,
.tier-enabled {
  background: var(--green-soft);
  color: var(--green);
}

.badge-amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge-red {
  background: var(--red-soft);
  color: var(--red);
}

.keyword {
  background: var(--purple-soft);
  color: var(--purple);
}

.term-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.help-tip-trigger {
  display: inline-grid;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: var(--faint);
  font: 600 9px/1 var(--font-sans);
  text-transform: none;
}

.help-tip-trigger:hover,
.help-tip-trigger:focus-visible {
  border-color: var(--muted);
  color: var(--ink);
}

.help-tip-panel {
  border: 0;
  border-radius: var(--radius-control);
  padding: 8px 10px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-menu);
  font: 400 13px/1.45 var(--font-sans);
}

/* Metric cards */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 0 0 32px;
}

.summary-card {
  display: flex;
  min-width: 0;
  min-height: 112px;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.summary-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.summary-value {
  margin-top: auto;
  color: var(--ink);
  font-size: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.summary-value-compact {
  font-size: 24px;
}

.summary-note {
  color: var(--muted);
  font-size: 12px;
}

.summary-value-accent {
  color: var(--blue);
}

.summary-note-action {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 500;
}

.summary-note-action:hover {
  text-decoration: underline;
}

.page-logs .logs-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.page-logs .logs-summary .summary-card {
  min-height: 96px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 14px 16px;
}

.page-logs .logs-summary .summary-card:last-child {
  border-right: 0;
}

.page-logs .summary-value {
  font-size: 24px;
}

.journey-kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Section headings and toolbars */

.queue-panel + .queue-panel {
  margin-top: 40px;
}

.queue-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.queue-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.filter-bar,
.journey-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

.filter-bar .search-field,
.journey-search-query {
  min-width: 240px;
  flex: 1 1 280px;
}

.sort-field,
.journey-search .filter-control {
  position: relative;
  display: flex;
  min-height: 36px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--bg);
}

.journey-search .filter-control:not(.journey-search-query) {
  flex: 0 0 auto;
}

.sort-field:hover,
.journey-search .filter-control:hover {
  border-color: var(--line-strong);
}

.sort-field:focus-within,
.journey-search .filter-control:focus-within {
  border-color: var(--line-hover);
  box-shadow: var(--focus);
}

.sort-field > span,
.journey-search .filter-control > span {
  margin: 0;
  padding: 0 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.sort-field select,
.journey-search .filter-control select,
.journey-search .filter-control input {
  min-width: 0;
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  box-shadow: none;
  font-weight: 500;
}

.sort-field select {
  min-width: 190px;
}

.journey-search .filter-control input[type="date"] {
  padding-right: 10px;
}

.journey-search .journey-search-query > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  padding: 0;
  clip-path: inset(50%);
  white-space: nowrap;
}

.journey-search-query::before {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-left: 12px;
  background: var(--muted);
  content: "";
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") center / contain no-repeat;
}

.journey-search-query input {
  flex: 1;
  font-weight: 400 !important;
}

/* Data tables */

.table-card:not(.journey-browser) {
  display: flex;
  flex-direction: column;
}

.table-card:not(.journey-browser) > .notice {
  order: 1;
}

.table-card:not(.journey-browser) > .pagination {
  order: 2;
}

.table-card > .notice,
.session-picker > .notice,
#common-inputs-list > .notice {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  scrollbar-color: var(--line-strong) transparent;
}

.data-table {
  width: 100%;
  min-width: 960px;
}

.suggestion-table .data-table-head,
.suggestion-table .data-table-row {
  grid-template-columns:
    104px minmax(180px, 1.15fr) minmax(220px, 1.55fr) 104px 104px 104px
    132px 112px 76px;
}

.trace-table {
  min-width: 1180px;
}

.trace-table .data-table-head,
.trace-table .data-table-row {
  grid-template-columns:
    112px 150px minmax(190px, 1fr) minmax(200px, 1.4fr) 92px
    minmax(160px, 1fr) 84px 112px 76px;
}

.common-inputs-table {
  min-width: 680px;
}

.common-inputs-table .data-table-head,
.common-inputs-table .data-table-row {
  grid-template-columns: minmax(260px, 1fr) repeat(3, 104px) 200px;
}

.data-table-head,
.data-table-row {
  display: grid;
  align-items: center;
}

.data-table-head {
  position: sticky;
  z-index: 2;
  top: 0;
  min-height: 40px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.data-table-head > span,
.table-cell {
  min-width: 0;
  padding: 10px 16px;
}

.data-table-head > span {
  white-space: nowrap;
}

.data-table-row {
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: 14px;
  transition: background-color 120ms ease;
}

.data-table-row:last-child {
  border-bottom: 0;
}

.data-table-row:hover {
  background: var(--bg-subtle);
}

.table-cell {
  overflow: hidden;
}

.table-primary {
  display: grid;
  gap: 2px;
}

.table-primary strong {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-primary code,
.table-mono {
  overflow: hidden;
  color: var(--muted);
  font: 400 13px/1.4 var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-truncate,
.table-input {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.table-status .badge {
  min-height: 0;
  gap: 8px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: 500 13px/20px var(--font-mono);
}

.table-status .badge::before {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--faint);
  content: "";
}

.table-status .badge-green::before {
  background: var(--green-dot);
}

.table-status .badge-amber::before {
  background: var(--amber-dot);
}

.table-status .badge-red::before {
  background: var(--red-dot);
}

.table-status .badge-red {
  color: var(--red);
}

.confidence-value,
.metric-value {
  color: var(--ink);
  font: 500 13px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.suggestion-details,
.trace-details {
  min-width: 0;
  padding: 10px 16px;
}

.suggestion-details summary,
.trace-details summary {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 0 10px;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  list-style: none;
}

.suggestion-details summary:hover,
.trace-details summary:hover {
  background: var(--hover);
}

.suggestion-details[open],
.trace-details[open] {
  grid-column: 1 / -1;
  width: 100%;
  padding: 0;
  border-top: 1px solid var(--line);
  background: var(--bg-subtle);
}

.suggestion-details[open] summary,
.trace-details[open] summary {
  margin: 12px 16px 0;
}

.record-detail-body {
  padding: 8px 16px 20px;
}

.suggestion-reason {
  max-width: 820px;
  margin: 8px 0 12px;
  color: var(--muted);
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.suggestion-detail-grid,
.sense-check-grid {
  display: grid;
  gap: 16px 24px;
  margin: 0;
}

.suggestion-detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sense-check-label,
.suggestion-detail-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sense-check-value,
.suggestion-detail-value {
  overflow-wrap: anywhere;
  margin: 4px 0 0;
  font-size: 14px;
}

.trace-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 16px 16px;
}

.trace-data-block {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--bg);
}

.trace-data-block h4 {
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.trace-data-block pre {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  color: var(--ink);
  font: 400 12.5px/1.6 var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.pagination {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-subtle);
}

.pagination .secondary-button {
  min-height: 32px;
}

#page-status,
#logs-page-status,
#sessions-page-status {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* Notices and empty states */

.notice {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 40px 24px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.notice-loading {
  color: var(--faint);
}

.notice-error {
  border-color: var(--red-line);
  background: var(--red-soft);
  color: var(--red);
}

.table-card > .notice-error,
.session-picker > .notice-error {
  margin: 12px;
  border: 1px solid var(--red-line);
  border-radius: var(--radius-control);
  padding: 12px 16px;
  background: var(--red-soft);
  text-align: left;
}

/* Workbench: Observability "Run Query" layout */

.service-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 24px;
  padding: 14px 20px;
}

.service-status h2 {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
}

#status-content {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.service-status .tier-status {
  flex: 1;
}

.workspace {
  margin-bottom: 24px;
}

.shortcut-hint {
  color: var(--muted);
  font-size: 13px;
}

kbd {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  background: var(--bg-subtle);
  color: var(--ink);
  font-size: 11px;
}

.query-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.query-label {
  padding-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.query-control {
  min-width: 0;
}

.input-frame {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--bg);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.input-frame:hover {
  border-color: var(--line-strong);
}

.input-frame:focus-within {
  border-color: var(--line-hover);
  box-shadow: var(--focus);
}

.input-control {
  position: relative;
}

.input-control textarea {
  display: block;
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 0;
  border-radius: 0;
  padding: 12px 40px 8px 12px;
  background: transparent;
  box-shadow: none;
  font-size: 15px;
  line-height: 1.55;
}

.input-status {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  color: transparent;
  font-size: 11px;
  font-weight: 700;
}

.input-status-valid {
  background: var(--green-dot);
  color: #ffffff;
}

.input-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--muted);
  font-size: 13px;
}

#character-count {
  font-family: var(--font-mono);
  font-size: 12px;
}

.sample-row .chips {
  padding-top: 4px;
}

.chip {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.chip:hover {
  border-color: var(--line-strong);
  background: var(--hover);
}

.token-disclosure summary {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  list-style: none;
}

.token-disclosure summary::after {
  width: 16px;
  height: 16px;
  background: var(--muted);
  content: "";
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>") center / contain no-repeat;
  transition: transform 120ms ease;
}

.token-disclosure[open] summary::after {
  transform: rotate(180deg);
}

.token-disclosure .field-label {
  display: grid;
  gap: 2px;
  margin: 8px 0;
  color: var(--ink);
  font-weight: 500;
}

.token-disclosure .field-label > span {
  color: var(--muted);
  font-weight: 400;
}

.token-disclosure input {
  width: 100%;
  max-width: 480px;
}

.match-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg-subtle);
}

.match-actions .primary-button {
  min-width: 120px;
}

.request-summary {
  max-width: 60%;
  overflow: hidden;
  color: var(--muted);
  font: 400 12px/1.4 var(--font-mono);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results-section > .notice {
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 64px 24px;
}

.results-section > .notice-error {
  margin: 16px 20px;
  border: 1px solid var(--red-line);
  border-radius: var(--radius-control);
  padding: 12px 16px;
  text-align: left;
}

.result-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.segment-card {
  display: grid;
}

.segment-title {
  margin: 0;
  padding: 8px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--muted);
  font: 500 12px/1.5 var(--font-mono);
}

.result-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 24px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  transition: background-color 120ms ease;
}

.result-list > .result-card:last-child,
.segment-card:last-child .result-card:last-child {
  border-bottom: 0;
}

.result-card:hover {
  background: var(--bg-subtle);
}

.result-topline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-rank {
  color: var(--muted);
  font: 500 12px/1.5 var(--font-mono);
}

.result-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.result-reason {
  max-width: 760px;
  margin: 8px 0 10px;
  color: var(--muted);
}

.score {
  min-width: 88px;
  text-align: right;
}

.score strong {
  display: block;
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.score span {
  color: var(--muted);
  font-size: 12px;
}

.sense-check,
.degradation {
  grid-column: 1 / -1;
}

.sense-check {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 14px 16px;
  background: var(--bg);
}

.sense-check-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 500;
}

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

.sense-check-row:first-child,
.sense-check-row:last-child {
  grid-column: 1 / -1;
}

.degradation {
  border: 1px solid var(--amber-line);
  border-radius: var(--radius-control);
  padding: 10px 14px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 13px;
}

/* Logs explorer */

.explorer {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}

.explorer-filters {
  position: sticky;
  top: calc(var(--topbar-height) + 24px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.filter-panel-header {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--line);
}

.filter-panel-header h2 {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
}

.filter-panel-header .secondary-button {
  min-height: 28px;
  border-color: transparent;
  padding: 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.filter-panel-header .secondary-button:hover {
  color: var(--ink);
}

.facet {
  display: grid;
  min-width: 0;
  gap: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.facet .field-label,
.facet > span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.facet input,
.facet select {
  width: 100%;
  min-height: 32px;
  font-size: 13px;
}

.facet-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.facet-pair label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.explorer-filters .filter-actions {
  padding: 12px 16px;
  background: var(--bg-subtle);
}

.explorer-filters .filter-actions .primary-button {
  width: 100%;
  min-height: 32px;
}

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

.explorer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.explorer-toolbar .search-field {
  flex: 1;
}

.explorer-toolbar .search-field input {
  font-family: var(--font-mono);
  font-size: 13px;
}

.trace-card .table-primary strong {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Sessions: Speed Insights + list/detail */

.common-input-action {
  max-width: 100%;
  overflow: hidden;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.common-input-action:hover {
  color: var(--blue);
}

.common-input-rate {
  display: grid;
  grid-template-columns: 44px minmax(60px, 1fr);
  align-items: center;
  gap: 10px;
  font: 500 13px/1 var(--font-mono);
}

.common-input-rate-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--hover);
}

.common-input-rate-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.journey-browser {
  display: grid;
  min-height: 560px;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
}

.session-picker {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--bg-subtle);
}

.session-list {
  max-height: 720px;
  flex: 1;
  overflow-y: auto;
}

.session-option {
  position: relative;
  display: grid;
  width: 100%;
  gap: 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: background-color 120ms ease;
}

.session-option:hover {
  background: var(--hover);
}

.session-option.is-selected {
  background: var(--bg);
}

.session-option.is-selected::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--ink);
  content: "";
}

.session-option-heading {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-option-time,
.session-option-meta {
  color: var(--muted);
  font-size: 13px;
}

.session-option-time {
  font-family: var(--font-mono);
  font-size: 12px;
}

.session-option-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.session-option .badges {
  margin-top: 2px;
}

.session-pagination {
  margin-top: auto;
}

.journey-detail {
  min-width: 0;
  padding: 24px 28px;
}

.journey-detail > .notice {
  border: 0;
  padding: 120px 24px;
}

.journey-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.journey-header h3 {
  margin: 4px 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.journey-session-id,
.journey-request-id {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.journey-metrics {
  margin: 8px 0 0;
  color: var(--muted);
}

.journey-attribution {
  display: grid;
  grid-template-columns: auto minmax(120px, 220px);
  align-content: start;
  gap: 6px 16px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 12px 14px;
  font-size: 13px;
}

.journey-attribution dt {
  color: var(--muted);
}

.journey-attribution dd {
  overflow: hidden;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.journey-event {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 16px;
}

.journey-event:not(:last-child)::before {
  position: absolute;
  top: 18px;
  bottom: 0;
  left: 9px;
  width: 1px;
  background: var(--line);
  content: "";
}

.journey-marker {
  z-index: 1;
  width: 10px;
  height: 10px;
  margin: 8px 0 0 5px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 4px var(--bg);
}

.journey-options-event .journey-marker {
  background: var(--blue);
}

.journey-event-body {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 12px 16px;
  background: var(--surface);
}

.journey-event-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.journey-event-top time {
  flex: 0 0 auto;
  color: var(--muted);
  font: 400 12px/1.4 var(--font-mono);
}

.journey-event-heading {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.journey-answers {
  display: grid;
  grid-template-columns: minmax(100px, auto) minmax(0, 1fr);
  gap: 6px 16px;
  margin: 10px 0 0;
  font-size: 13px;
}

.journey-answers dt {
  color: var(--muted);
  text-transform: capitalize;
}

.journey-answers dd {
  margin: 0;
  font-weight: 500;
}

.journey-api {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.journey-api summary {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.journey-api summary:hover {
  color: var(--ink);
}

.journey-api .trace-data-block {
  margin-top: 8px;
}

.journey-options {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.journey-options-empty {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.journey-option-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.journey-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 8px 12px;
  background: var(--bg);
  font-size: 13px;
}

.journey-option.is-selected {
  border-color: var(--blue-line);
  background: var(--blue-soft);
}

.journey-option-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.journey-option-tags {
  flex: 0 0 auto;
  justify-content: flex-end;
}

/* Accessibility and native element resets */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 0;
}

[hidden] {
  display: none !important;
}

summary::-webkit-details-marker {
  display: none;
}

/* Popover help anchors */

[popovertarget="help-observability"] { anchor-name: --help-observability; }
#help-observability { position-anchor: --help-observability; }
[popovertarget="help-viewer-token"] { anchor-name: --help-viewer-token; }
#help-viewer-token { position-anchor: --help-viewer-token; }
[popovertarget="help-matching-traces"] { anchor-name: --help-matching-traces; }
#help-matching-traces { position-anchor: --help-matching-traces; }
[popovertarget="help-errors"] { anchor-name: --help-errors; }
#help-errors { position-anchor: --help-errors; }
[popovertarget="help-summary-degraded"] { anchor-name: --help-summary-degraded; }
#help-summary-degraded { position-anchor: --help-summary-degraded; }
[popovertarget="help-latency"] { anchor-name: --help-latency; }
#help-latency { position-anchor: --help-latency; }
[popovertarget="help-cost"] { anchor-name: --help-cost; }
#help-cost { position-anchor: --help-cost; }
[popovertarget="help-journey-sessions"] { anchor-name: --help-journey-sessions; }
#help-journey-sessions { position-anchor: --help-journey-sessions; }
[popovertarget="help-journey-quotes"] { anchor-name: --help-journey-quotes; }
#help-journey-quotes { position-anchor: --help-journey-quotes; }
[popovertarget="help-time-to-quote"] { anchor-name: --help-time-to-quote; }
#help-time-to-quote { position-anchor: --help-time-to-quote; }
[popovertarget="help-backs"] { anchor-name: --help-backs; }
#help-backs { position-anchor: --help-backs; }
[popovertarget="help-llm-response"] { anchor-name: --help-llm-response; }
#help-llm-response { position-anchor: --help-llm-response; }
[popovertarget="help-matches"] { anchor-name: --help-matches; }
#help-matches { position-anchor: --help-matches; }
[popovertarget="help-trace-id"] { anchor-name: --help-trace-id; }
#help-trace-id { position-anchor: --help-trace-id; }
[popovertarget="help-environment"] { anchor-name: --help-environment; }
#help-environment { position-anchor: --help-environment; }
[popovertarget="help-route"] { anchor-name: --help-route; }
#help-route { position-anchor: --help-route; }
[popovertarget="help-status"] { anchor-name: --help-status; }
#help-status { position-anchor: --help-status; }
[popovertarget="help-degraded"] { anchor-name: --help-degraded; }
#help-degraded { position-anchor: --help-degraded; }
[popovertarget="help-capture"] { anchor-name: --help-capture; }
#help-capture { position-anchor: --help-capture; }
[popovertarget="help-provider"] { anchor-name: --help-provider; }
#help-provider { position-anchor: --help-provider; }
[popovertarget="help-col-status"] { anchor-name: --help-col-status; }
#help-col-status { position-anchor: --help-col-status; }
[popovertarget="help-col-request"] { anchor-name: --help-col-request; }
#help-col-request { position-anchor: --help-col-request; }
[popovertarget="help-col-input"] { anchor-name: --help-col-input; }
#help-col-input { position-anchor: --help-col-input; }
[popovertarget="help-col-duration"] { anchor-name: --help-col-duration; }
#help-col-duration { position-anchor: --help-col-duration; }
[popovertarget="help-col-provider"] { anchor-name: --help-col-provider; }
#help-col-provider { position-anchor: --help-col-provider; }
[popovertarget="help-col-cost"] { anchor-name: --help-col-cost; }
#help-col-cost { position-anchor: --help-col-cost; }
[popovertarget="help-col-environment"] { anchor-name: --help-col-environment; }
#help-col-environment { position-anchor: --help-col-environment; }
[popovertarget="help-tier3"] { anchor-name: --help-tier3; }
#help-tier3 { position-anchor: --help-tier3; }
[popovertarget="help-awaiting"] { anchor-name: --help-awaiting; }
#help-awaiting { position-anchor: --help-awaiting; }
[popovertarget="help-unique"] { anchor-name: --help-unique; }
#help-unique { position-anchor: --help-unique; }
[popovertarget="help-avg-confidence"] { anchor-name: --help-avg-confidence; }
#help-avg-confidence { position-anchor: --help-avg-confidence; }
[popovertarget="help-providers"] { anchor-name: --help-providers; }
#help-providers { position-anchor: --help-providers; }
[popovertarget="help-queue"] { anchor-name: --help-queue; }
#help-queue { position-anchor: --help-queue; }
[popovertarget="help-sug-status"] { anchor-name: --help-sug-status; }
#help-sug-status { position-anchor: --help-sug-status; }
[popovertarget="help-proposed"] { anchor-name: --help-proposed; }
#help-proposed { position-anchor: --help-proposed; }
[popovertarget="help-source-input"] { anchor-name: --help-source-input; }
#help-source-input { position-anchor: --help-source-input; }
[popovertarget="help-input-volume"] { anchor-name: --help-input-volume; }
#help-input-volume { position-anchor: --help-input-volume; }
[popovertarget="help-suggestion-count"] { anchor-name: --help-suggestion-count; }
#help-suggestion-count { position-anchor: --help-suggestion-count; }
[popovertarget="help-confidence"] { anchor-name: --help-confidence; }
#help-confidence { position-anchor: --help-confidence; }
[popovertarget="help-sug-provider"] { anchor-name: --help-sug-provider; }
#help-sug-provider { position-anchor: --help-sug-provider; }

.help-tip-panel {
  inset: unset;
  top: calc(anchor(bottom) + 6px);
  left: anchor(center);
  translate: -50% 0;
  width: min(280px, calc(100vw - 24px));
  margin: 0;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  white-space: normal;
}

@supports not (top: anchor(bottom)) {
  .help-tip-panel {
    top: max(12px, 50%);
    left: 50%;
    translate: -50% -50%;
  }
}

/* Responsive */

@media (max-width: 1200px) {
  .explorer {
    grid-template-columns: 1fr;
  }

  .explorer-filters {
    position: static;
  }

  .filter-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-panel-header,
  .explorer-filters .filter-actions {
    grid-column: 1 / -1;
  }

  .facet {
    border-right: 1px solid var(--line);
  }

  .page-logs .logs-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-logs .logs-summary .summary-card {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 0px;
  }

  .dashboard-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto var(--topbar-height) minmax(0, 1fr);
  }

  .top-nav {
    position: static;
    display: grid;
    height: auto;
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0 12px;
    padding: 0 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand-link {
    margin: 0;
  }

  .brand-link::after {
    display: none;
  }

  .nav-links {
    display: flex;
    grid-column: 1 / -1;
    gap: 2px;
    overflow-x: auto;
    margin: 0 -8px;
    padding: 0 0 8px;
  }

  .nav-link {
    flex: 0 0 auto;
  }

  .nav-group-label,
  .sidebar-environment {
    display: none;
  }

  .sidebar-footer {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .theme-toggle {
    width: auto;
  }

  .topbar,
  .page-content {
    grid-column: 1;
  }

  .topbar {
    grid-row: 2;
    padding: 0 16px;
  }

  .page-content {
    grid-row: 3;
    padding: 24px 16px 48px;
  }

  body > footer {
    margin-left: 0;
    padding-inline: 16px;
  }

  .access-panel {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .access-form {
    grid-column: 1 / -1;
  }

  .journey-browser {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .dashboard-hero {
    flex-direction: column;
    gap: 16px;
  }

  .dashboard-title {
    font-size: 24px;
  }

  .lede {
    font-size: 15px;
  }

  .topbar-meta {
    display: none;
  }

  .summary-grid,
  .journey-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .summary-card {
    min-height: 104px;
    padding: 14px 16px;
  }

  .summary-value {
    font-size: 22px;
  }

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

  .filter-panel {
    grid-template-columns: 1fr 1fr;
  }

  .query-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .query-label {
    padding-top: 0;
  }

  .shortcut-hint {
    display: none;
  }

  .card-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .request-summary {
    max-width: 100%;
    text-align: left;
  }

  .result-card {
    grid-template-columns: 1fr;
  }

  .score {
    text-align: left;
  }

  .sense-check-grid,
  .suggestion-detail-grid,
  .trace-detail-grid {
    grid-template-columns: 1fr;
  }

  .sense-check-row {
    grid-column: 1 !important;
  }

  .queue-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .filter-bar > *,
  .journey-search > * {
    flex: 1 1 100%;
  }

  .sort-field select,
  .journey-search .filter-control select,
  .journey-search .filter-control input {
    flex: 1;
  }

  .journey-browser {
    grid-template-columns: 1fr;
  }

  .session-picker {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .session-list {
    max-height: 360px;
  }

  .journey-detail {
    padding: 20px 16px;
  }

  .journey-header {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .brand-copy small,
  #theme-label {
    display: none;
  }

  .summary-grid,
  .journey-kpis,
  .page-logs .logs-summary,
  .filter-panel {
    grid-template-columns: 1fr;
  }

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

  .journey-option,
  .journey-event-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .journey-option-tags {
    justify-content: flex-start;
  }
}

/* Admin sign-in */

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px 16px;
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.login-card h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.login-card .lede {
  margin: -8px 0 0;
}

.login-card .notice {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  font-size: 13px;
  text-align: left;
}

.login-form {
  display: grid;
  gap: 8px;
}

.login-form input {
  width: 100%;
}

.login-form .primary-button {
  margin-top: 8px;
}

.logout-form {
  margin: 0;
}

/* Weekly executive report */

.page-reports .page-content {
  max-width: 1240px;
}

.page-reports .access-panel {
  margin-bottom: 24px;
}

.weekly-report {
  display: grid;
  gap: 40px;
}

.executive-readout {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) minmax(0, 1fr);
  gap: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 24px;
  background: var(--surface);
}

.executive-readout h2 {
  margin: 6px 0 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.executive-readout p {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.6;
}

.report-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.report-kpis .summary-card {
  min-height: 104px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
}

.report-kpis .summary-card:last-child {
  border-right: 0;
}

.report-split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 24px;
}

.report-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 20px;
  background: var(--surface);
}

.report-panel .section-title {
  margin: 0;
}

.product-volume {
  display: grid;
  gap: 20px;
}

.product-volume-row {
  display: grid;
  gap: 8px;
}

.product-volume-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
}

.product-volume-label strong {
  font-size: 14px;
  font-weight: 500;
}

.product-volume-label span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.product-volume-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-subtle);
}

.product-volume-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.report-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
}

.product-table-panel .report-table {
  border: 0;
}

.report-data-table {
  min-width: 720px;
}

.product-table-panel .report-data-table {
  min-width: 0;
}

.report-columns-3 .data-table-head,
.report-columns-3 .data-table-row {
  grid-template-columns: minmax(140px, 1fr) 100px 90px;
}

.report-columns-4 .data-table-head,
.report-columns-4 .data-table-row {
  grid-template-columns: minmax(180px, 1fr) 100px minmax(220px, 1.2fr) minmax(150px, 0.8fr);
}

.report-columns-5 .data-table-head,
.report-columns-5 .data-table-row {
  grid-template-columns: 72px 100px minmax(320px, 1fr) 120px 140px;
}

.cell-numeric {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.report-footnote {
  max-width: 880px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.report-controls {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) minmax(0, 1fr);
  gap: 32px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.report-controls ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 900px) {
  .report-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-kpis .summary-card:nth-child(2) {
    border-right: 0;
  }

  .report-kpis .summary-card:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .report-split,
  .executive-readout,
  .report-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .report-kpis {
    grid-template-columns: 1fr;
  }

  .report-kpis .summary-card {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .report-kpis .summary-card:last-child {
    border-bottom: 0;
  }
}

/* AI Visibility reporting surfaces */

.page-reports .page-content,
.page-ppc-demand .page-content {
  max-width: 1440px;
}

.weekly-report,
.ppc-demand-dashboard {
  display: grid;
  gap: 20px;
}

.headline-strip,
.executive-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 12px 20px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.headline-copy {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
}

.headline-prefix {
  flex: 0 0 auto;
  color: var(--muted);
}

.headline-copy strong {
  font-weight: 500;
}

.headline-metrics {
  display: flex;
  flex: 0 0 auto;
  gap: 18px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.headline-metrics strong {
  color: var(--ink);
  font-weight: 600;
}

.executive-readout {
  grid-template-columns: none;
}

.executive-readout > div {
  flex: 0 0 auto;
}

.executive-readout h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.executive-readout p {
  max-width: 920px;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.ppc-kpis,
.report-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  overflow: visible;
  margin: 0;
  border: 0;
  background: transparent;
}

.ppc-kpis .summary-card,
.report-kpis .summary-card {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  box-shadow: var(--shadow-card);
}

.report-kpis .summary-card:last-child {
  border-right: 1px solid var(--line);
}

.ppc-primary-grid,
.ppc-secondary-grid,
.report-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 1fr);
  align-items: start;
  gap: 20px;
}

.section-card,
.report-panel,
.page-reports .queue-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.report-panel,
.page-reports .queue-panel {
  padding: 20px;
}

.page-reports .queue-panel + .queue-panel {
  margin-top: 0;
}

.section-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
}

.section-card-header h2 {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.section-card-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.section-card-body {
  padding: 0 20px 20px;
}

.section-card-footer {
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--line);
  padding: 12px 20px;
}

.ppc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ppc-table th {
  padding: 10px 12px;
  border-block: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-subtle) 60%, transparent);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.ppc-table td {
  max-width: 280px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.ppc-proposed-table td {
  max-width: none;
}

.ppc-proposed-table td:last-child {
  max-width: 420px;
}

.ppc-table tbody tr:last-child td {
  border-bottom: 0;
}

.ppc-table tbody tr:hover {
  background: var(--hover);
}

.ppc-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ppc-table .table-rank {
  width: 42px;
  color: var(--faint);
}

.ppc-table .table-primary {
  font-weight: 500;
}

.ppc-table .table-secondary {
  color: var(--muted);
}

.inline-bar {
  display: flex;
  min-width: 130px;
  align-items: center;
  gap: 10px;
}

.inline-bar-track,
.metric-bar-track {
  height: 6px;
  flex: 1;
  overflow: hidden;
  border-radius: 999px;
  background: var(--hover);
}

.inline-bar-fill,
.metric-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.inline-bar-value {
  width: 46px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-good {
  background: var(--green-soft);
  color: var(--green);
}

.status-progress {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-warning {
  border: 1px solid var(--amber-line);
  background: var(--amber-soft);
  color: var(--amber);
}

.status-error {
  border: 1px solid var(--red-line);
  background: var(--red-soft);
  color: var(--red);
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 2px 6px;
  background: var(--hover);
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.ppc-bar-list {
  display: grid;
  gap: 18px;
}

.metric-bar-row {
  display: grid;
  gap: 8px;
}

.metric-bar-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.metric-bar-label {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.metric-bar-label strong {
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-bar-detail {
  color: var(--muted);
  font-size: 12px;
}

.metric-bar-value {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.metric-bar-good .metric-bar-fill {
  background: #1baf7a;
}

.metric-bar-warning .metric-bar-fill {
  background: #eda100;
}

.metric-bar-error .metric-bar-fill {
  background: #d03b3b;
}

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

.section-card-subsection {
  margin-top: 2px;
  border-top: 1px solid var(--line);
  padding: 16px 20px 20px;
}

.subsection-heading {
  margin-bottom: 12px;
}

.subsection-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.subsection-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.demand-gap-list {
  display: grid;
  gap: 8px;
}

.demand-gap-row {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 10px 12px;
}

.demand-gap-row .demand-gap-volume {
  font-size: 16px;
}

.ppc-outcome-section .ppc-bar-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.demand-gap-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 14px;
  background: var(--surface);
}

.demand-gap-focus {
  background: color-mix(in srgb, var(--blue-soft) 60%, var(--surface));
}

.demand-gap-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.demand-gap-heading strong {
  font-size: 14px;
  font-weight: 600;
}

.demand-gap-volume {
  color: var(--blue);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.demand-gap-description,
.demand-gap-examples {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.demand-gap-examples span {
  color: var(--ink);
}

.demand-gap-card .status-badge {
  width: max-content;
  margin-top: auto;
}

.page-ppc-demand .report-controls,
.page-reports .report-controls {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

@media (max-width: 1100px) {
  .ppc-primary-grid,
  .ppc-secondary-grid,
  .report-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .ppc-kpis,
  .report-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .headline-strip,
  .executive-readout {
    align-items: flex-start;
    flex-direction: column;
  }

  .headline-metrics {
    flex-wrap: wrap;
  }

  .ppc-outcome-section .ppc-bar-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .ppc-kpis,
  .report-kpis,
  .demand-gap-grid {
    grid-template-columns: 1fr;
  }

  .ppc-outcome-section .ppc-bar-list {
    grid-template-columns: 1fr;
  }

  .ppc-table {
    min-width: 840px;
  }
}

#funnel-filters .filter-control[hidden] {
  display: none;
}

.funnel-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.funnel-step {
  display: grid;
  grid-template-columns: 28px minmax(180px, 280px) minmax(160px, 1fr) 72px;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
}

.funnel-step:first-child {
  border-top: 0;
}

.funnel-index {
  color: var(--faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.funnel-label {
  display: block;
  font-weight: 500;
}

.funnel-hint {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.funnel-bar {
  min-width: 0;
}

.funnel-track {
  height: 28px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--hover);
}

.funnel-rates {
  display: block;
  min-height: 16px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.funnel-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.funnel-count {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.funnel-count strong {
  display: block;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.funnel-footnote {
  margin: 0;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 860px) {
  .funnel-step {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    grid-template-areas:
      "index copy count"
      "bar bar bar";
    align-items: start;
    gap: 8px 12px;
  }

  .funnel-index {
    grid-area: index;
    padding-top: 2px;
  }

  .funnel-copy {
    grid-area: copy;
  }

  .funnel-bar {
    grid-area: bar;
  }

  .funnel-count {
    grid-area: count;
  }
}

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