:root {
  --ink: #10213b;
  --ink-soft: #536276;
  --paper: #f7fafc;
  --surface: #ffffff;
  --line: #d7e1e9;
  --line-dark: #bdcad5;
  --cobalt: #1e5eff;
  --cobalt-dark: #1648c8;
  --sky: #a8dafa;
  --orange: #ff6b35;
  --mint: #b9f0d3;
  --danger: #c73535;
  --shadow: 0 24px 60px rgba(16, 33, 59, .1);
  --display: "Avenir Next", "Segoe UI", sans-serif;
  --body: "Avenir Next", "Segoe UI", sans-serif;
  --utility: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid rgba(30, 94, 255, .35);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-decoration: none;
}

.brand--light { color: #fff; }

.brand-mark {
  display: grid;
  grid-template-columns: repeat(4, 4px);
  align-items: end;
  gap: 3px;
  width: 25px;
  height: 25px;
  padding: 4px;
  background: var(--cobalt);
  border-radius: 5px;
}

.brand-mark i { display: block; background: #fff; border-radius: 1px; }
.brand-mark i:nth-child(1) { height: 5px; opacity: .55; }
.brand-mark i:nth-child(2) { height: 9px; opacity: .72; }
.brand-mark i:nth-child(3) { height: 13px; opacity: .88; }
.brand-mark i:nth-child(4) { height: 17px; }

.eyebrow,
.utility-label {
  margin: 0 0 12px;
  color: var(--cobalt);
  font-family: var(--utility);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .11em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow--light { color: var(--sky); }

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}

.button svg,
.search-field svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.button--primary { color: #fff; background: var(--cobalt); box-shadow: 0 9px 24px rgba(30, 94, 255, .2); }
.button--primary:hover { background: var(--cobalt-dark); transform: translateY(-1px); }
.button--secondary { color: var(--ink); border-color: var(--line-dark); background: #fff; }
.button--secondary:hover { border-color: var(--ink); }
.button--full { width: 100%; }
.button:disabled, .button.is-disabled { opacity: .45; pointer-events: none; box-shadow: none; }

.field { display: grid; gap: 8px; }
.field > span { color: var(--ink); font-size: 13px; font-weight: 700; }
.field input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line-dark);
  border-radius: 5px;
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.field input:focus { outline: 0; border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(30, 94, 255, .11); }

/* Login */
.login-page { min-height: 100vh; background: var(--surface); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(400px, 1.08fr) minmax(420px, .92fr); }

.login-story {
  position: relative;
  min-height: 700px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(34px, 5vw, 72px);
  color: #fff;
  overflow: hidden;
  background: var(--ink);
}

.login-story::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .13;
  background-image: linear-gradient(rgba(255,255,255,.22) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.22) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

.login-story::after {
  content: "";
  position: absolute;
  width: min(44vw, 650px);
  aspect-ratio: 1;
  right: -18%;
  top: 11%;
  border: clamp(45px, 6vw, 90px) solid rgba(30, 94, 255, .63);
  border-radius: 50%;
}

.login-story > * { position: relative; z-index: 1; }
.login-story .brand-mark { background: #fff; }
.login-story .brand-mark i { background: var(--cobalt); }
.login-story__copy { max-width: 650px; padding: 80px 0 40px; }
.login-story__copy h1 {
  max-width: 680px;
  margin: 0 0 28px;
  font-family: var(--display);
  font-size: clamp(48px, 5.6vw, 88px);
  font-weight: 650;
  letter-spacing: -.065em;
  line-height: .98;
}
.login-story__copy > p:last-child { max-width: 520px; margin: 0; color: #aebbd0; font-size: 18px; line-height: 1.6; }

.signal-board { width: min(620px, 100%); }
.signal-board__label { font-family: var(--utility); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #8190a7; }
.signal-board__line { position: relative; height: 3px; margin: 16px 0 10px; background: rgba(255,255,255,.16); }
.signal-board__line::before { content: ""; position: absolute; left: 0; width: 68%; height: 100%; background: var(--sky); }
.signal-board__line i { position: absolute; z-index: 1; top: -6px; left: 68%; width: 15px; height: 15px; border: 4px solid var(--ink); border-radius: 50%; background: var(--orange); transform: translateX(-50%); }
.signal-board__scale { display: flex; justify-content: space-between; color: #6e7e96; font-family: var(--utility); font-size: 10px; }

.login-panel { display: grid; place-items: center; padding: 48px; background: #fff; }
.login-form-wrap { width: min(410px, 100%); }
.login-form-wrap h2 { margin: 0 0 12px; font-size: 37px; font-weight: 650; letter-spacing: -.045em; }
.form-intro { margin: 0 0 32px; color: var(--ink-soft); line-height: 1.55; }
.login-form { display: grid; gap: 20px; }
.login-form .button { margin-top: 8px; }

.alert { display: flex; align-items: flex-start; gap: 11px; margin: 0 0 24px; padding: 13px 14px; border-radius: 5px; font-size: 13px; line-height: 1.4; }
.alert span { display: grid; flex: 0 0 20px; height: 20px; place-items: center; border-radius: 50%; font-family: var(--utility); font-size: 11px; font-weight: 700; }
.alert p { margin: 1px 0 0; }
.alert--error { color: #8b2828; background: #fff0ee; border: 1px solid #f2c9c4; }
.alert--error span { color: #fff; background: var(--danger); }
.login-note { display: flex; align-items: center; gap: 8px; margin: 28px 0 0; color: #7a8798; font-size: 11px; }
.login-note span { width: 6px; height: 6px; border-radius: 50%; background: #35a36c; box-shadow: 0 0 0 3px rgba(53,163,108,.13); }

/* Dashboard */
.app-page { min-height: 100vh; background: var(--paper); }
.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(247,250,252,.94);
  backdrop-filter: blur(14px);
}
.topbar__meta { display: flex; align-items: center; gap: 24px; }
.api-state { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); font-family: var(--utility); font-size: 10px; letter-spacing: .03em; }
.api-state i { width: 7px; height: 7px; border-radius: 50%; }
.api-state--ok i { background: #2f9a66; box-shadow: 0 0 0 4px rgba(47,154,102,.12); }
.api-state--warning i { background: var(--orange); box-shadow: 0 0 0 4px rgba(255,107,53,.12); }
.logout-button { padding: 6px 0; color: var(--ink); border: 0; border-bottom: 1px solid var(--line-dark); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
.logout-button:hover { border-color: var(--ink); }

.dashboard { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 74px 0 100px; }
.hero { display: grid; grid-template-columns: 1.55fr .45fr; align-items: end; gap: 80px; margin-bottom: 64px; }
.hero h1 { margin: 0; font-size: clamp(48px, 6.2vw, 84px); font-weight: 650; letter-spacing: -.065em; line-height: .96; }
.hero h1 span { color: var(--cobalt); }
.hero__aside { margin: 0 0 5px; padding-left: 20px; color: var(--ink-soft); border-left: 2px solid var(--orange); font-size: 14px; line-height: 1.65; }

.config-warning { margin: -28px 0 28px; padding: 15px 18px; color: #713e24; border: 1px solid #f4c5ae; border-radius: 6px; background: #fff6ef; font-size: 13px; line-height: 1.6; }
.config-warning strong { margin-right: 4px; }
.config-warning code { padding: 2px 4px; color: #713e24; background: #fbe5d8; border-radius: 3px; font-family: var(--utility); font-size: 11px; }

.workbench { display: grid; grid-template-columns: minmax(0, 1.48fr) minmax(300px, .52fr); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.workbench__input { padding: clamp(28px, 4.2vw, 54px); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 25px; }
.section-heading h2, .results-head h2 { margin: 0; font-size: 28px; font-weight: 650; letter-spacing: -.04em; }
.section-heading .utility-label, .results-head .utility-label { margin-bottom: 9px; }
.counter { color: #798698; font-family: var(--utility); font-size: 11px; }

.domain-field { display: block; border: 1px solid var(--line-dark); border-radius: 6px; overflow: hidden; transition: border-color .16s ease, box-shadow .16s ease; }
.domain-field:focus-within { border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(30,94,255,.1); }
.domain-field textarea { width: 100%; min-height: 235px; display: block; resize: vertical; padding: 20px; color: var(--ink); border: 0; outline: 0; background: #fbfdfe; font-family: var(--utility); font-size: 13px; line-height: 1.8; }
.domain-field textarea::placeholder { color: #a2adba; }
.domain-field__hint { display: block; padding: 11px 20px; color: #7b8898; border-top: 1px solid var(--line); background: #fff; font-size: 11px; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 20px; }
.text-button { padding: 5px 0; color: var(--ink-soft); border: 0; border-bottom: 1px dashed #9cabb8; background: transparent; cursor: pointer; font-size: 12px; }
.text-button:hover { color: var(--cobalt); border-color: var(--cobalt); }

.workbench__readout { display: flex; flex-direction: column; padding: 30px; color: #fff; background: var(--ink); }
.readout-head { display: flex; align-items: center; justify-content: space-between; color: #8391a5; font-family: var(--utility); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; color: #b5c0cf; letter-spacing: .03em; text-transform: none; }
.status-pill i { width: 6px; height: 6px; border-radius: 50%; background: #6d7a8e; }
.status-pill--running i { background: var(--sky); animation: status-pulse 1.2s infinite; }
.status-pill--done i { background: #61d69b; }
.status-pill--error i { background: var(--orange); }
@keyframes status-pulse { 50% { opacity: .35; transform: scale(.65); } }

.authority-dial { position: relative; width: 180px; height: 180px; display: grid; place-items: center; margin: 45px auto 35px; }
.authority-dial::before, .authority-dial::after { content: ""; position: absolute; border-radius: 50%; }
.authority-dial::before { inset: 0; border: 1px solid rgba(255,255,255,.12); }
.authority-dial::after { inset: 16px; border: 1px dashed rgba(255,255,255,.1); }
.authority-dial__track { position: absolute; inset: 5px; border-radius: 50%; transform: rotate(-90deg); }
.authority-dial__track::before { content: ""; position: absolute; left: calc(50% - 2px); top: -6px; width: 4px; height: 14px; border-radius: 3px; background: var(--orange); }
.authority-dial__track i { position: absolute; inset: 0; border: 5px solid transparent; border-top-color: var(--cobalt); border-radius: 50%; opacity: .75; transform: rotate(var(--progress-angle, 0deg)); transition: transform .5s ease; }
.authority-dial__value { display: flex; align-items: flex-start; position: relative; z-index: 1; }
.authority-dial__value strong { font-size: 56px; font-weight: 560; letter-spacing: -.07em; line-height: 1; }
.authority-dial__value span { margin: 5px 0 0 4px; color: var(--sky); font-family: var(--utility); font-size: 13px; }

.live-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border-top: 1px solid rgba(255,255,255,.12); border-bottom: 1px solid rgba(255,255,255,.12); }
.live-stats div { padding: 15px 9px; text-align: center; }
.live-stats div + div { border-left: 1px solid rgba(255,255,255,.12); }
.live-stats dt { margin-bottom: 6px; color: #8391a5; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.live-stats dd { margin: 0; font-family: var(--utility); font-size: 17px; }
.readout-message { margin: auto 0 0; padding-top: 26px; color: #8e9bae; font-size: 11px; line-height: 1.55; }

.results { margin-top: 74px; }
.results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 22px; }
.results-actions { display: flex; gap: 12px; }
.search-field { min-width: 220px; display: flex; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--line-dark); border-radius: 6px; background: #fff; }
.search-field svg { width: 17px; color: #7b899a; }
.search-field input { width: 100%; height: 46px; padding: 0; color: var(--ink); border: 0; outline: 0; background: transparent; font-size: 13px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
table { width: 100%; min-width: 800px; border-collapse: collapse; }
th, td { padding: 16px 18px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: #778597; background: #f5f8fa; font-family: var(--utility); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }
th span { color: #a5afba; font-weight: 400; }
td { color: var(--ink-soft); font-family: var(--utility); font-size: 12px; }
td:first-child { color: var(--ink); font-family: var(--body); font-size: 13px; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9fbfd; }
.metric-cell { display: flex; align-items: center; gap: 9px; }
.metric-cell__bar { width: 38px; height: 3px; overflow: hidden; background: #e4ebf0; }
.metric-cell__bar i { display: block; height: 100%; background: var(--cobalt); }
.result-state { display: inline-flex; align-items: center; gap: 7px; }
.result-state i { width: 6px; height: 6px; border-radius: 50%; background: #35a36c; }
.result-state--error { color: var(--danger); cursor: help; }
.result-state--error i { background: var(--danger); }
.empty-filter { padding: 48px; color: var(--ink-soft); text-align: center; font-size: 13px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: min(380px, calc(100% - 48px)); padding: 14px 18px; color: #fff; border-radius: 6px; background: var(--ink); box-shadow: 0 14px 38px rgba(16,33,59,.24); font-size: 13px; line-height: 1.45; animation: toast-in .22s ease both; }
.toast--error { background: #9f3030; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-story { min-height: 440px; padding: 34px; }
  .login-story__copy { padding: 80px 0 34px; }
  .login-story__copy h1 { max-width: 620px; font-size: clamp(45px, 9vw, 70px); }
  .login-story__copy > p:last-child { display: none; }
  .signal-board { display: none; }
  .login-panel { min-height: 520px; padding: 54px 24px; }
  .hero { grid-template-columns: 1fr; gap: 26px; }
  .hero__aside { max-width: 500px; }
  .workbench { grid-template-columns: 1fr; }
  .workbench__readout { min-height: 420px; }
  .readout-message { margin-top: 25px; }
}

@media (max-width: 620px) {
  .topbar { height: auto; min-height: 70px; padding: 16px 20px; }
  .topbar__meta { gap: 14px; }
  .api-state { max-width: 110px; line-height: 1.35; }
  .dashboard { width: calc(100% - 32px); padding: 48px 0 70px; }
  .hero { margin-bottom: 42px; }
  .hero h1 { font-size: clamp(43px, 13vw, 62px); }
  .workbench__input { padding: 26px 20px; }
  .section-heading { align-items: flex-start; }
  .section-heading h2, .results-head h2 { font-size: 24px; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .text-button { align-self: flex-start; }
  .workbench__readout { padding: 25px 20px; }
  .results { margin-top: 55px; }
  .results-head { align-items: stretch; flex-direction: column; }
  .results-actions { display: grid; }
  .search-field { min-width: 0; }
  .login-story { min-height: 360px; }
  .login-story__copy { padding: 48px 0 10px; }
  .login-story__copy h1 { font-size: clamp(40px, 12vw, 58px); }
}

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