:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --ink: #15171a;
  --muted: #667085;
  --line: #d6dbe1;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --accent: #1f5fbf;
  --accent-2: #7a4f01;
  --danger: #b42318;
  --warn: #8a4b00;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.probe-shell {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 20px;
}

.dashboard-shell {
  display: grid;
  gap: 12px;
}

.probe-hero,
.dashboard-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.2rem, 4.6vw, 5rem);
  line-height: 0.96;
}

.dashboard-header h1 {
  font-size: clamp(1.6rem, 2.5vw, 2.4rem);
  line-height: 1.1;
}

h2 {
  font-size: 1rem;
}

.hero-text {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

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

.status-panel {
  width: min(100%, 360px);
  display: grid;
  gap: 2px;
  padding: 14px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 10px;
  border-radius: 6px;
  background: var(--surface-2);
}

.status-row span {
  color: var(--muted);
}

.status-row strong {
  text-align: right;
}

.surface {
  padding: 14px;
}

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

.text-link,
.text-button {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.text-button {
  border: 0;
  background: transparent;
  padding: 0;
}

.text-button.danger {
  color: var(--danger);
}

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

.snapshot-grid div {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.header-actions,
.filters {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.token-field {
  min-width: 230px;
}

input,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 11px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(23, 107, 91, 0.22);
  outline-offset: 2px;
}

.button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  padding: 0 16px;
}

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

.plain-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.plain-stats span {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.plain-stats strong {
  color: var(--ink);
  font-size: 1rem;
}

.simple-dashboard .surface,
.simple-dashboard .status-panel,
.simple-dashboard .metric {
  box-shadow: none;
}

.metric {
  min-height: 96px;
  padding: 16px;
  display: grid;
  align-content: space-between;
}

.metric span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  font-size: 2.1rem;
  line-height: 1;
}

.metric.highlight {
  border-color: rgba(180, 95, 53, 0.42);
  background: #fff8f3;
}

.filters {
  align-items: center;
}

.filters label:not(.checkbox-field) {
  min-width: 150px;
  flex: 1;
}

.filters label:first-child {
  min-width: 260px;
  flex: 2;
}

.checkbox-field {
  min-height: 40px;
  grid-auto-flow: column;
  align-items: center;
  align-self: end;
  gap: 8px;
  color: var(--ink);
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  min-height: auto;
  accent-color: var(--accent);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(24, minmax(4px, 1fr));
  align-items: end;
  gap: 4px;
  min-height: 84px;
  padding-top: 4px;
}

.timeline-bar {
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
  position: relative;
}

.timeline-bar[data-bot="true"] {
  background: var(--accent-2);
}

.timeline-empty {
  color: var(--muted);
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

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

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

td {
  font-size: 0.9rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.event-list {
  display: grid;
  gap: 10px;
}

.event-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.raw-field {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.raw-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.raw-value {
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
  padding: 8px;
  color: var(--ink);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
  font-size: 0.86rem;
  line-height: 1.45;
}

.ua-value .raw-value {
  border-color: #9db7dd;
  background: #f3f7fd;
  color: #0f2f5f;
  font-size: 0.95rem;
  font-weight: 700;
}

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

.raw-details {
  max-width: none;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.pill.warn {
  background: #fff1d5;
  color: var(--warn);
}

.pill.ok {
  background: #e1f4ed;
  color: var(--accent);
}

.ua-cell {
  max-width: 360px;
  overflow-wrap: anywhere;
}

details {
  max-width: 320px;
}

summary {
  color: var(--accent);
  cursor: pointer;
  font-weight: 800;
}

pre {
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border-radius: 8px;
  background: #111817;
  color: #d8eee8;
  font-size: 0.78rem;
  line-height: 1.5;
}

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

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

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 160px) 1fr minmax(36px, auto);
  gap: 10px;
  align-items: center;
}

.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 9px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: var(--width, 0%);
  background: var(--accent);
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

@media (max-width: 840px) {
  .shell {
    width: min(100vw - 20px, 720px);
    padding: 18px 0 40px;
  }

  .probe-hero,
  .dashboard-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .status-panel,
  .token-field {
    width: 100%;
  }

  .snapshot-grid,
  .metric-grid,
  .split-grid,
  .request-grid {
    grid-template-columns: 1fr;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .button {
    flex: 1;
  }

  .filters label:not(.checkbox-field),
  .filters label:first-child {
    min-width: 100%;
  }

  .timeline {
    grid-template-columns: repeat(12, minmax(4px, 1fr));
  }
}
