@font-face {
  font-family: "Unbounded";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/assets/fonts/unbounded-latin.woff2") format("woff2");
}

:root {
  --paper: #f1f3f0;
  --paper-deep: #e5e9e7;
  --paper-bright: #fafbf8;
  --ink: #171b22;
  --ink-soft: #58616a;
  --rule: #aeb5b8;
  --rule-dark: #727b83;
  --cobalt: #174fc9;
  --cobalt-dark: #103a94;
  --cobalt-wash: #dbe5ff;
  --vermilion: #d9412c;
  --vermilion-wash: #f8ded8;
  --amber: #d39717;
  --amber-wash: #f5e7bd;
  --success: #176d53;
  --success-wash: #dcece6;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI Variable", Aptos, "Segoe UI", sans-serif;
  font-synthesis: none;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(23, 27, 34, 0.027) 1px, transparent 1px) 0 0 / 46px 100%,
    var(--paper);
}

button,
input,
select { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
::selection { background: var(--cobalt); color: #fff; }

.skip-link {
  position: fixed;
  z-index: 50;
  top: 8px;
  left: 8px;
  padding: 9px 12px;
  color: #fff;
  background: var(--ink);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
.auth-pending .handoff-shell { visibility: hidden; }

.handoff-header {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto minmax(310px, 1fr);
  align-items: center;
  min-height: 74px;
  padding: 0 20px;
  border-bottom: 1px solid var(--ink);
  background: rgba(250, 251, 248, 0.97);
}

.handoff-brand {
  display: inline-flex;
  align-items: center;
  width: max-content;
  gap: 9px;
  text-decoration: none;
}
.handoff-brand img { display: block; }
.brand-name {
  font-family: "Unbounded", "Segoe UI Variable", sans-serif;
  font-size: 11px;
  font-weight: 720;
  letter-spacing: -0.025em;
}
.brand-section {
  color: var(--cobalt);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.product-nav {
  display: flex;
  align-self: stretch;
  border-inline: 1px solid var(--rule);
}
.product-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 0 13px;
  border-right: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 760;
  text-decoration: none;
}
.product-nav a:last-child { border-right: 0; }
.product-nav a:hover { color: var(--ink); background: var(--paper-deep); }
.product-nav a[aria-current="page"] {
  color: var(--cobalt-dark);
  background: var(--cobalt-wash);
  box-shadow: inset 0 -3px 0 var(--cobalt);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.connection-state {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  color: var(--ink-soft);
  gap: 7px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
}
.connection-state > span { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.connection-state[data-state="online"] > span { background: var(--success); }
.connection-state[data-state="error"] > span { background: var(--vermilion); }

.utility-button,
.primary-action,
.secondary-action,
.job-action,
.close-button {
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper-bright);
  font-size: 12px;
  font-weight: 780;
}
.utility-button { padding: 0 13px; }
.primary-action { padding: 0 18px; color: #fff; background: var(--cobalt); border-color: var(--cobalt); }
.primary-action:hover:not(:disabled) { background: var(--cobalt-dark); }
.secondary-action { padding: 0 18px; }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 70px; }
h1,
h2,
p { margin-top: 0; }
h1,
h2 { font-family: "Segoe UI Variable", Aptos, "Segoe UI", sans-serif; font-weight: 820; letter-spacing: -0.035em; }
h1 { margin-bottom: 12px; font-size: clamp(30px, 4vw, 56px); line-height: 0.98; }
h2 { margin-bottom: 8px; font-size: clamp(18px, 2vw, 26px); line-height: 1.05; }

.relay-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto minmax(320px, 0.9fr);
  align-items: end;
  min-height: 180px;
  border-bottom: 1px solid var(--ink);
  padding: 0 0 28px;
  gap: 30px;
}
.hero-copy > p:last-child { max-width: 620px; margin-bottom: 0; color: var(--ink-soft); line-height: 1.55; }
.hero-count { min-width: 150px; padding-left: 24px; border-left: 1px solid var(--rule); }
.hero-count strong { display: block; color: var(--cobalt); font-size: 48px; font-weight: 850; line-height: 1; }
.hero-count span { display: block; margin-top: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.hero-facts { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border: 1px solid var(--rule-dark); }
.hero-facts div { min-width: 0; padding: 13px 12px; border-right: 1px solid var(--rule); }
.hero-facts div:last-child { border-right: 0; }
.hero-facts dt { color: var(--ink-soft); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.08em; }
.hero-facts dd { overflow: hidden; margin: 5px 0 0; font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }

.global-relay {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 28px 0;
  border-bottom: 1px solid var(--rule-dark);
  gap: 26px;
}
.global-relay > div:first-child p:last-child { max-width: 650px; margin-bottom: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.global-controls { display: grid; grid-template-columns: minmax(180px, 1fr) 94px auto; align-items: end; gap: 8px; }
label > span { display: block; margin-bottom: 6px; color: var(--ink-soft); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
select,
input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--rule-dark);
  border-radius: 0;
  background: var(--paper-bright);
  padding: 0 11px;
}

.relay-register { padding-top: 30px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; gap: 16px; }
.section-heading > p { margin-bottom: 3px; color: var(--ink-soft); font-family: "Cascadia Mono", Consolas, monospace; font-size: 10px; }
.run-list { display: grid; gap: 12px; }

.run-card {
  display: grid;
  grid-template-columns: minmax(210px, 1.25fr) minmax(280px, 1.35fr) minmax(310px, 1fr);
  min-height: 146px;
  border: 1px solid var(--rule-dark);
  background: rgba(250, 251, 248, 0.92);
}
.run-card > section { min-width: 0; padding: 18px; border-right: 1px solid var(--rule); }
.run-card > section:last-child { border-right: 0; }
.run-identity { display: flex; flex-direction: column; justify-content: space-between; }
.run-identity h3 { margin: 0; font-size: 19px; font-weight: 820; letter-spacing: -0.03em; }
.run-identity p { margin: 6px 0 0; color: var(--ink-soft); font-size: 11px; }
.run-code { font-family: "Cascadia Mono", Consolas, monospace; font-size: 9px; color: var(--ink-soft); }
.run-badge { display: inline-flex; align-items: center; min-height: 24px; width: max-content; margin-bottom: 11px; padding: 0 8px; border: 1px solid var(--cobalt); color: var(--cobalt-dark); background: var(--cobalt-wash); font-size: 9px; font-weight: 850; letter-spacing: 0.08em; }

.run-counts { display: grid; grid-template-columns: repeat(3, 1fr); align-content: center; margin: 0; }
.run-counts div { min-width: 0; padding: 5px 12px; border-right: 1px solid var(--rule); }
.run-counts div:first-child { padding-left: 0; }
.run-counts div:last-child { padding-right: 0; border-right: 0; }
.run-counts dt { color: var(--ink-soft); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.run-counts dd { margin: 5px 0 0; font-size: 24px; font-weight: 850; }
.run-counts .ready dd { color: var(--cobalt); }

.run-actions { display: flex; flex-direction: column; justify-content: center; gap: 9px; }
.run-form { display: grid; grid-template-columns: minmax(150px, 1fr) 86px; gap: 7px; }
.run-send { grid-column: 1 / -1; width: 100%; }
.run-help { margin: 0; color: var(--ink-soft); font-size: 10px; line-height: 1.4; }
.job-strip { padding: 11px 10px 9px; border: 1px solid var(--amber); background: var(--amber-wash); box-shadow: inset 0 3px 0 var(--amber); }
.job-strip[data-tone="active"] { border-color: var(--rule-dark); background: var(--cobalt-wash); box-shadow: inset 0 3px 0 var(--cobalt); }
.job-strip[data-tone="done"] { border-color: var(--rule-dark); background: var(--success-wash); box-shadow: inset 0 3px 0 var(--success); }
.completed-history { border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: 10px; }
.completed-history summary { padding: 8px 0; cursor: pointer; list-style-position: inside; }
.completed-list { padding: 0 0 5px 13px; }
.completed-list p { margin: 0 0 4px; line-height: 1.35; }
.job-copy { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.job-copy strong { font-size: 10px; }
.job-copy span { color: var(--ink-soft); font-family: "Cascadia Mono", Consolas, monospace; font-size: 9px; }
.job-action { width: 100%; min-height: 44px; margin-top: 7px; padding: 0 10px; background: transparent; font-size: 10px; }

.empty-state { padding: 50px 20px; border: 1px dashed var(--rule-dark); text-align: center; }
.empty-state img { margin-bottom: 15px; }
.empty-state p { color: var(--ink-soft); }
.empty-state a { display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; color: #fff; background: var(--cobalt); text-decoration: none; font-weight: 750; }

.confirm-dialog {
  width: min(640px, calc(100% - 28px));
  max-height: min(760px, calc(100dvh - 24px));
  margin: auto;
  padding: 0;
  border: 1px solid var(--ink);
  background: var(--paper-bright);
  color: var(--ink);
}
.confirm-dialog::backdrop { background: rgba(13, 21, 29, 0.72); backdrop-filter: blur(3px); }
.confirm-frame { padding: 22px; }
.confirm-frame > header { display: flex; align-items: start; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--ink); }
.close-button { width: 44px; padding: 0; }
.close-button svg,
.pool-icon,
.exit-icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.confirm-summary { display: flex; align-items: baseline; justify-content: space-between; padding: 20px 0 8px; gap: 12px; }
.confirm-summary strong { font-size: 23px; font-weight: 850; }
.confirm-summary span { color: var(--ink-soft); font-size: 12px; }
#confirmCopy { color: var(--ink-soft); font-size: 12px; }
.confirm-runs { max-height: min(420px, 48dvh); overflow: auto; border-block: 1px solid var(--rule); }
.confirm-run-group { border-bottom: 1px solid var(--rule); }
.confirm-run-group:last-child { border-bottom: 0; }
.confirm-run { display: grid; grid-template-columns: 1fr auto; padding: 13px 3px; border-bottom: 1px solid var(--rule); gap: 16px; }
.confirm-run strong { display: block; font-size: 13px; }
.confirm-run small { color: var(--ink-soft); }
.confirm-run b { color: var(--cobalt); font-size: 17px; font-weight: 850; }
.confirm-reference-list { background: var(--paper); }
.confirm-reference-list > summary { min-height: 44px; padding: 13px 4px; color: var(--cobalt-dark); cursor: pointer; font-size: 11px; font-weight: 780; }
.confirm-reference-rows { border-top: 1px solid var(--rule); }
.confirm-reference { display: grid; grid-template-columns: 58px minmax(0, 1fr) minmax(90px, auto); align-items: baseline; min-height: 44px; padding: 10px 4px; border-bottom: 1px solid var(--rule); gap: 10px; }
.confirm-reference:last-child { border-bottom: 0; }
.confirm-reference > strong { font-family: "Cascadia Mono", Consolas, monospace; font-size: 9px; }
.confirm-reference > span { font-size: 11px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.confirm-reference > small { color: var(--ink-soft); font-size: 9px; text-align: right; }
.confirm-reference-empty { margin: 0; padding: 13px 4px; color: var(--ink-soft); font-size: 11px; }
.confirm-warning { margin: 16px 0; padding: 13px 11px 11px; border: 1px solid var(--rule-dark); background: var(--cobalt-wash); box-shadow: inset 0 3px 0 var(--cobalt); font-size: 11px; line-height: 1.45; }
.confirm-frame > footer { display: flex; justify-content: flex-end; gap: 8px; }

.toast-region { position: fixed; z-index: 60; right: 16px; bottom: 16px; display: grid; width: min(380px, calc(100% - 32px)); gap: 8px; pointer-events: none; }
.toast { padding: 12px 14px; border: 1px solid var(--ink); color: #fff; background: var(--ink); font-size: 12px; line-height: 1.45; box-shadow: 4px 4px 0 rgba(23, 27, 34, 0.16); }
.toast[data-tone="error"] { border-color: var(--vermilion); background: var(--ink); }

@media (max-width: 980px) {
  .handoff-header { grid-template-columns: 1fr auto; padding-inline: 14px; }
  .product-nav { grid-row: 2; grid-column: 1 / -1; min-height: 44px; margin-inline: -14px; border-top: 1px solid var(--rule); border-inline: 0; }
  .product-nav a { flex: 1; min-width: 0; }
  .header-actions { grid-column: 2; }
  .relay-hero { grid-template-columns: 1fr auto; }
  .hero-facts { grid-column: 1 / -1; }
  .run-card { grid-template-columns: 1fr 1fr; }
  .run-card > section:nth-child(2) { border-right: 0; }
  .run-card > section:last-child { grid-column: 1 / -1; border-top: 1px solid var(--rule); }
}

@media (max-width: 700px) {
  .handoff-header { min-height: auto; padding: 12px 12px 0; }
  .brand-section { display: none; }
  .header-actions { gap: 5px; }
  .connection-state { display: none; }
  .utility-button { min-height: 44px; padding-inline: 9px; font-size: 10px; }
  .product-nav { margin: 11px -12px 0; }
  .product-nav a { min-height: 44px; padding-inline: 4px; font-size: 10px; }
  main { width: calc(100% - 24px); padding: 24px 0 46px; }
  .relay-hero { grid-template-columns: 1fr auto; min-height: 0; padding-bottom: 20px; gap: 16px; }
  h1 { font-size: 31px; }
  .hero-copy > p:last-child { font-size: 12px; }
  .hero-count { min-width: 90px; padding-left: 14px; }
  .hero-count strong { font-size: 36px; }
  .hero-facts { grid-column: 1 / -1; }
  .hero-facts div { padding: 11px 8px; }
  .hero-facts dt { font-size: 8px; }
  .hero-facts dd { font-size: 10px; }
  .global-relay { grid-template-columns: 1fr; padding: 22px 0; gap: 17px; }
  .global-controls { grid-template-columns: 1fr 82px; }
  .global-controls .primary-action { grid-column: 1 / -1; width: 100%; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 10px; }
  .run-card { display: block; }
  .run-card > section { padding: 15px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .run-card > section:last-child { border-bottom: 0; }
  .run-identity { min-height: 78px; }
  .run-counts div { padding-block: 3px; }
  .run-counts dd { font-size: 22px; }
  .confirm-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); }
  .confirm-frame { padding: 16px; }
  .confirm-summary { display: block; }
  .confirm-summary span { display: block; margin-top: 4px; }
  .confirm-reference { grid-template-columns: 54px minmax(0, 1fr); }
  .confirm-reference > small { grid-column: 2; text-align: left; }
  .confirm-frame > footer { display: grid; grid-template-columns: 1fr 1.35fr; }
  .toast-region { right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); width: calc(100% - 16px); }
}

@media (max-width: 360px) {
  .handoff-brand img { width: 25px; height: 25px; }
  .brand-name { font-size: 10px; }
  .utility-button:first-of-type { display: none; }
  .product-nav a { font-size: 9px; }
  main { width: calc(100% - 18px); }
  .hero-copy > p:last-child { display: none; }
  .hero-facts dt { letter-spacing: 0; }
  .global-controls { grid-template-columns: 1fr 76px; }
  .run-form { grid-template-columns: 1fr 76px; }
}

@media (prefers-reduced-motion: no-preference) {
  .primary-action,
  .job-action,
  .run-card { transition: background 140ms ease, border-color 140ms ease, transform 140ms ease; }
  .run-card:hover { border-color: var(--ink); }
}
