:root {
  --neutral-1: #0e1116;
  --neutral-2: #161b22;
  --neutral-3: #1d232b;
  --neutral-4: #2a313a;
  --neutral-5: #88949e;
  --neutral-6: #e6ebf1;
  --blue: #3b82f6;
  --green: #22c55e;
  --red: #ef4444;
  --surface: rgba(22, 27, 34, 0.88);
  --surface-strong: rgba(29, 35, 43, 0.96);
  --line: rgba(136, 148, 158, 0.22);
  --line-strong: rgba(136, 148, 158, 0.35);
  --glow: rgba(59, 130, 246, 0.25);
  --shadow: 0 18px 50px rgba(4, 8, 14, 0.35);
  --radius-panel: 22px;
  --radius-control: 14px;
  --radius-chip: 999px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 40px;
  --font-ui: "IBM Plex Sans", system-ui, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, monospace;
}

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

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 28%),
    radial-gradient(circle at right center, rgba(34, 197, 94, 0.08), transparent 18%),
    linear-gradient(180deg, #0a0f17 0%, #0d1320 100%);
  color: var(--neutral-6);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-shell {
  min-height: 100vh;
}

.page-shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.page-shell--public {
  width: min(1320px, calc(100vw - 32px));
  padding-top: 24px;
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.top-rail {
  width: min(1240px, calc(100vw - 32px));
  margin: 18px auto 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(17, 23, 31, 0.78);
  backdrop-filter: blur(10px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
}

.top-rail__brand,
.top-rail__actions,
.top-rail__nav {
  display: flex;
  align-items: center;
}

.top-rail__brand {
  gap: 14px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.08));
  display: grid;
  place-items: center;
  font-size: 18px;
}

.brand-wordmark {
  font-size: 1.2rem;
  letter-spacing: 0.2em;
  font-weight: 700;
}

.brand-subtitle,
.eyebrow,
.panel__hint,
.metric-strip__label,
.checkpoint-card__note,
.landing-hero__orbit {
  color: var(--neutral-5);
  font-family: var(--font-data);
  font-size: 0.78rem;
}

.top-rail__nav {
  justify-content: center;
  gap: 10px;
}

.top-rail__nav a {
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--neutral-5);
}

.top-rail__nav a.is-active,
.top-rail__nav a:hover {
  color: var(--neutral-6);
  background: rgba(59, 130, 246, 0.08);
}

.top-rail__actions {
  gap: 12px;
}

.top-rail__actions form {
  margin: 0;
}

.user-chip {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(29, 35, 43, 0.8);
  font-size: 0.9rem;
}

.button {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button--primary {
  color: white;
  background: linear-gradient(180deg, #4a8cff 0%, #2f68ee 100%);
  box-shadow: 0 8px 24px rgba(47, 104, 238, 0.22);
}

.button--ghost {
  color: var(--neutral-6);
  border-color: var(--line);
  background: rgba(29, 35, 43, 0.7);
}

.button--small {
  padding: 8px 12px;
}

.button--full,
.button--hero {
  width: 100%;
  justify-content: center;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 22px;
}

.page-head h1,
.landing-hero h1 {
  margin: 4px 0 10px;
  font-size: clamp(2rem, 4vw, 3.6rem);
  letter-spacing: -0.03em;
}

.page-head p,
.landing-hero__note {
  margin: 0;
  color: var(--neutral-5);
}

.status-chip {
  padding: 10px 14px;
  border-radius: var(--radius-chip);
  border: 1px solid rgba(34, 197, 94, 0.24);
  background: rgba(34, 197, 94, 0.08);
  color: #82f1a6;
  font-size: 0.9rem;
}

.landing-shell {
  width: 100%;
  display: grid;
  place-items: center;
}

.landing-hero {
  position: relative;
  width: min(540px, calc(100vw - 48px));
  min-height: min(540px, calc(100vw - 48px));
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(17, 26, 39, 0.94), rgba(15, 22, 35, 0.92)),
    radial-gradient(circle at top center, rgba(59, 130, 246, 0.22), transparent 36%);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 56px 40px;
}

.landing-hero__badge {
  width: 78px;
  height: 78px;
  margin-bottom: 20px;
  border-radius: 28px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.2), rgba(255, 255, 255, 0.02));
  font-size: 30px;
}

.landing-hero__tagline {
  font-size: clamp(1.25rem, 2.2vw, 2rem);
  margin: 0 0 18px;
}

.landing-hero__tagline span {
  color: #7eb2ff;
}

.landing-hero__note {
  max-width: 280px;
  line-height: 1.6;
}

.checkpoint-shell {
  min-height: 80vh;
  display: grid;
  place-items: center;
  position: relative;
}

.checkpoint-shell__flourish {
  position: absolute;
  inset: 20% 15% auto auto;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.1), transparent 65%);
  pointer-events: none;
}

.checkpoint-card,
.panel,
.ledger-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: linear-gradient(180deg, rgba(17, 24, 36, 0.95), rgba(13, 19, 30, 0.95));
  box-shadow: var(--shadow);
}

.checkpoint-card {
  width: min(460px, 100%);
  padding: 36px 32px;
  display: grid;
  gap: 18px;
}

.checkpoint-card__badge {
  width: 74px;
  height: 74px;
  border-radius: 26px;
  margin: 0 auto 8px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(59, 130, 246, 0.08);
  font-size: 32px;
}

.checkpoint-card__title {
  text-align: center;
  font-size: 1.5rem;
}

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

.field span,
.history-table__head,
.ledger-head {
  font-family: var(--font-data);
  font-size: 0.78rem;
  color: var(--neutral-5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: rgba(12, 17, 25, 0.82);
  color: var(--neutral-6);
  padding: 13px 14px;
  outline: none;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(59, 130, 246, 0.58);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.field--inline {
  min-width: 240px;
}

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  margin-bottom: 20px;
}

.form-message {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.95rem;
}

.form-message--error {
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.08);
  color: #ff9a9a;
}

.form-message--success {
  border: 1px solid rgba(34, 197, 94, 0.22);
  background: rgba(34, 197, 94, 0.08);
  color: #8cf0a6;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric-strip {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 20px;
  background: rgba(17, 24, 36, 0.84);
}

.metric-strip__value {
  margin-top: 12px;
  font-size: 2rem;
  font-family: var(--font-data);
}

.metric-strip__meta {
  margin-top: 8px;
  color: #7ec895;
  font-size: 0.92rem;
}

.dashboard-grid,
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.panel,
.ledger-panel {
  padding: 18px;
}

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

.panel__head h2 {
  margin: 0;
  font-size: 1rem;
}

.panel__stack {
  display: grid;
  gap: 12px;
}

.route-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(12, 17, 25, 0.62);
}

.route-row__title,
.ledger-row__title {
  font-weight: 600;
}

.route-row__url,
.ledger-row__target,
.back-link {
  color: #7eb2ff;
  font-size: 0.92rem;
}

.route-row__meta {
  text-align: right;
  font-family: var(--font-data);
  color: var(--neutral-5);
  display: grid;
  gap: 4px;
}

.route-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.12);
  padding: 8px 10px;
  color: #a9c9ff;
  font-family: var(--font-data);
  font-size: 0.82rem;
}

.route-tag__value {
  display: inline-block;
}

.route-tag--copy {
  position: relative;
  cursor: pointer;
  min-width: 74px;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.route-tag--copy::after {
  content: "";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: none;
}

.route-tag--copy:hover,
.route-tag--copy:focus-visible {
  border-color: rgba(59, 130, 246, 0.42);
  background: rgba(59, 130, 246, 0.18);
}

.route-tag--copy:hover .route-tag__value,
.route-tag--copy:focus-visible .route-tag__value {
  opacity: 0;
}

.route-tag--copy:hover::after,
.route-tag--copy:focus-visible::after {
  content: "Copy";
  opacity: 1;
}

.route-tag--copy[data-copy-state="copied"]::after {
  content: "Copied";
  opacity: 1;
}

.route-tag--copy[data-copy-state="copied"] .route-tag__value,
.route-tag--copy[data-copy-state="failed"] .route-tag__value {
  opacity: 0;
}

.route-tag--copy[data-copy-state="failed"]::after {
  content: "Failed";
  opacity: 1;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  text-transform: lowercase;
}

.status-pill--ok {
  background: rgba(34, 197, 94, 0.12);
  color: #8cf0a6;
}

.status-pill--danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ff9a9a;
}

.activity-tape {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.activity-tape__row,
.history-table__row {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(12, 17, 25, 0.58);
  color: var(--neutral-6);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  text-align: left;
  cursor: pointer;
}

.note-stack {
  display: grid;
  gap: 10px;
}

.note-tile {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(12, 17, 25, 0.6);
}

.note-tile--danger {
  border-color: rgba(239, 68, 68, 0.2);
}

.note-tile--info {
  border-color: rgba(59, 130, 246, 0.2);
}

.ledger-panel {
  overflow: hidden;
}

.ledger-head,
.ledger-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1.8fr) 110px 90px 140px 90px;
  gap: 14px;
  align-items: center;
}

.history-table__head,
.history-table__row {
  display: grid;
  grid-template-columns: 150px 90px 80px 80px 110px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.ledger-head,
.history-table__head {
  padding: 0 10px 14px;
}

.ledger-row,
.history-table__row {
  padding: 14px 10px;
  border-top: 1px solid var(--line);
}

.history-table__row {
  border-radius: 14px;
  border: 1px solid var(--line);
  margin-bottom: 10px;
}

.history-table__row > span,
.history-table__head > span {
  min-width: 0;
}

.history-table__request-id {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-table__row span,
.ledger-row div,
.detail-list dd,
.preview-short-url,
.activity-tape__row span,
.route-row__count,
.route-row__last {
  font-family: var(--font-data);
}

.detail-list {
  display: grid;
  gap: 12px;
}

.detail-list div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
}

.detail-list dt {
  color: var(--neutral-5);
  font-size: 0.82rem;
}

.detail-list dd {
  margin: 0;
}

.preview-short-url {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(59, 130, 246, 0.24);
  background: rgba(59, 130, 246, 0.1);
  color: #9fc1ff;
  font-size: 0.95rem;
  margin-bottom: 16px;
  word-break: break-all;
}

.preview-note,
.empty-note {
  color: var(--neutral-5);
}

.form-panel {
  display: grid;
  gap: 16px;
}

.form-actions,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-actions form {
  margin: 0;
}

.modal-sheet {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 24px 24px;
  background: rgba(17, 24, 36, 0.98);
  color: var(--neutral-6);
  box-shadow: 0 24px 80px rgba(4, 8, 14, 0.5);
}

.modal-sheet::backdrop {
  background: rgba(2, 6, 14, 0.68);
}

.modal-sheet__close {
  position: absolute;
  top: 10px;
  right: 14px;
  border: 0;
  background: transparent;
  color: var(--neutral-5);
  font-size: 1.6rem;
  cursor: pointer;
}

.click-detail-sheet h2 {
  margin-top: 0;
}

@media (max-width: 980px) {
  .top-rail,
  .page-head,
  .dashboard-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .top-rail {
    gap: 16px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .ledger-head {
    display: none;
  }

  .ledger-row,
  .history-table__head,
  .history-table__row,
  .activity-tape__row {
    grid-template-columns: 1fr;
  }
}
