:root {
  --ink: #101d2c;
  --ink-soft: #2d3b4f;
  --muted: #748095;
  --muted-light: #9ba6b6;
  --canvas: #f3f6fa;
  --card: rgba(255, 255, 255, .94);
  --card-solid: #fff;
  --line: #e3e9f0;
  --line-strong: #d6dee8;
  --nav: #081522;
  --nav-soft: #112438;
  --nav-active: rgba(66, 121, 255, .16);
  --blue: #356df3;
  --blue-dark: #2657cf;
  --blue-soft: #edf3ff;
  --coral: #f2764b;
  --green: #168469;
  --green-soft: #e7f6f1;
  --red: #c64c4c;
  --amber: #a86d16;
  --shadow-sm: 0 1px 2px rgba(15, 31, 51, .04), 0 8px 24px rgba(15, 31, 51, .05);
  --shadow-md: 0 18px 50px rgba(15, 31, 51, .10);
  --shadow-lg: 0 30px 90px rgba(3, 16, 31, .20);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 88% 3%, rgba(53, 109, 243, .07), transparent 28rem),
    var(--canvas);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
code { font-family: "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace; }

.eyebrow {
  margin: 0 0 9px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 10px;
  font-weight: 800;
  color: #8d9aac;
}
.eyebrow.accent { color: var(--blue); }
.eyebrow.pale { color: #a9bddc; }
.muted { color: var(--muted); }

h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -.025em;
  font-weight: 720;
}

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(420px, .8fr);
  background: var(--nav);
}
.login-brand {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(54px, 8vw, 126px);
  color: #fff;
  background:
    linear-gradient(90deg, rgba(4, 15, 30, .94) 0%, rgba(5, 19, 38, .74) 46%, rgba(5, 19, 38, .18) 100%),
    url("/assets/relay-network-v1.png") center / cover no-repeat,
    #071627;
}
.login-brand::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), transparent 30%),
    radial-gradient(circle at 16% 80%, rgba(53,109,243,.22), transparent 34%);
}
.login-brand::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .18;
  background-image: radial-gradient(rgba(255,255,255,.25) .55px, transparent .55px);
  background-size: 7px 7px;
  mask-image: linear-gradient(to bottom, transparent, #000, transparent);
}
.brand-mark {
  width: 60px;
  height: 60px;
  margin-bottom: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 18px;
  background: linear-gradient(145deg, #5a86ff, #2e61e8 58%, #2749ac);
  box-shadow: 0 14px 40px rgba(42, 93, 225, .38), inset 0 1px rgba(255,255,255,.32);
  color: white;
  font: 800 25px/1 "SF Pro Display", -apple-system, sans-serif;
  letter-spacing: -.06em;
}
.brand-mark.small {
  width: 38px;
  height: 38px;
  margin: 0;
  border-radius: 12px;
  font-size: 17px;
  box-shadow: 0 10px 26px rgba(42, 93, 225, .28), inset 0 1px rgba(255,255,255,.25);
}
.login-brand h1 {
  max-width: 690px;
  margin: 0 0 25px;
  font-size: clamp(46px, 5.2vw, 78px);
  line-height: 1.04;
  letter-spacing: -.055em;
  font-weight: 720;
}
.lead {
  max-width: 600px;
  margin: 0;
  color: rgba(220, 232, 247, .74);
  font-size: 17px;
  line-height: 1.85;
}
.signal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 48px;
  color: rgba(203, 220, 241, .65);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .05em;
}
.signal-row i { width: 24px; height: 1px; background: rgba(129, 164, 208, .45); }
.login-panel {
  display: grid;
  place-items: center;
  padding: clamp(28px, 5vw, 72px);
  background:
    radial-gradient(circle at 100% 0, rgba(53,109,243,.09), transparent 20rem),
    #f5f7fb;
}
.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 24px;
  padding: 46px;
  border: 1px solid rgba(213, 222, 233, .82);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
}
.login-card h2 { margin-bottom: 8px; font-size: 34px; }
.login-card p { margin-bottom: 0; }
.local-note { color: #8d98a7; font-size: 11px; line-height: 1.65; text-align: center; }

/* Form controls */
label { display: grid; gap: 8px; color: #465469; font-size: 12px; font-weight: 680; }
label small { color: #8a96a7; font-weight: 450; line-height: 1.45; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  background: #fbfcfe;
  color: var(--ink);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
textarea { resize: vertical; line-height: 1.7; }
input:hover, select:hover, textarea:hover { border-color: #bfcbd9; background: #fff; }
input:focus, select:focus, textarea:focus {
  border-color: #6c94f8;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(53, 109, 243, .11);
}
.button {
  min-height: 42px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 720;
  transition: transform .16s, box-shadow .16s, background .16s, border-color .16s;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: wait; opacity: .62; transform: none; }
.button.primary {
  border-color: #3f73eb;
  background: linear-gradient(180deg, #477cf5, var(--blue));
  color: #fff;
  box-shadow: 0 8px 20px rgba(53, 109, 243, .22), inset 0 1px rgba(255,255,255,.22);
}
.button.primary:hover { box-shadow: 0 12px 28px rgba(53,109,243,.30), inset 0 1px rgba(255,255,255,.22); }
.button.ghost { border-color: rgba(255,255,255,.26); background: rgba(255,255,255,.07); color: #fff; backdrop-filter: blur(8px); }
.button.ghost:hover { border-color: rgba(255,255,255,.42); background: rgba(255,255,255,.12); }
.button.subtle { border-color: var(--line); background: #f7f9fc; color: #44536a; }
.button.subtle:hover { border-color: #cdd7e4; background: #fff; }
.button.danger { background: #b94747; color: #fff; box-shadow: 0 8px 20px rgba(185,71,71,.16); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.text-button { padding: 0; border: 0; background: none; color: #7f94aa; cursor: pointer; font-size: 12px; }
.text-button:hover { color: #d8e6f4; }
.icon-button { width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; color: #748196; cursor: pointer; font-size: 20px; line-height: 1; }

/* App shell and navigation */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 264px 1fr; }
.sidebar {
  position: fixed;
  z-index: 10;
  inset: 0 auto 0 0;
  width: 264px;
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 0 0, rgba(55,112,243,.18), transparent 15rem),
    linear-gradient(180deg, #091827 0%, #07131f 100%);
  color: #fff;
  box-shadow: inset -1px 0 rgba(255,255,255,.04);
}
.sidebar::after {
  content: "";
  position: absolute;
  pointer-events: none;
  right: -90px;
  bottom: 80px;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(86,136,255,.10);
  border-radius: 50%;
  box-shadow: 0 0 0 48px rgba(86,136,255,.035), 0 0 0 96px rgba(86,136,255,.018);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 34px; font-size: 18px; letter-spacing: -.02em; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item {
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #8196aa;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
  transition: color .16s, background .16s, border-color .16s, transform .16s;
}
.nav-item span { display: inline-block; width: 27px; color: #6f87a0; font-family: "SFMono-Regular", monospace; }
.nav-item:hover { color: #e8f1fb; background: rgba(255,255,255,.045); transform: translateX(2px); }
.nav-item.active { border-color: rgba(91,139,255,.12); background: var(--nav-active); color: #fff; box-shadow: inset 3px 0 #5a86ff; }
.nav-item.active span { color: #79a0ff; }
.sidebar-foot { z-index: 1; display: grid; gap: 18px; margin-top: auto; padding: 16px 12px 4px; }
.status { color: #7e95aa; font-size: 11px; }
.status b { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: #3fd0a0; box-shadow: 0 0 0 5px rgba(63,208,160,.10), 0 0 16px rgba(63,208,160,.35); }

.workspace { grid-column: 2; min-width: 0; padding: 35px clamp(28px, 5vw, 74px) 80px; }
.topbar { max-width: 1320px; margin: 0 auto 32px; display: flex; align-items: center; justify-content: space-between; }
.topbar h1 { margin: 0; font-size: 30px; line-height: 1.2; letter-spacing: -.035em; font-weight: 735; }
.user-chip { display: flex; align-items: center; gap: 11px; padding: 6px 9px 6px 6px; border: 1px solid rgba(217,225,235,.8); border-radius: 14px; background: rgba(255,255,255,.68); box-shadow: 0 4px 18px rgba(15,31,51,.04); backdrop-filter: blur(12px); }
.user-chip > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(145deg, #e7edff, #d9e4ff); color: #345cc2; font-weight: 800; }
.user-chip div { display: grid; padding-right: 5px; font-size: 12px; line-height: 1.45; }
.user-chip small { color: var(--muted); }
.page { max-width: 1320px; margin: auto; display: grid; gap: 22px; }

/* Shared cards */
.metric, .content-card, .tip-card, .coming-card {
  border: 1px solid rgba(221, 228, 237, .92);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}
.content-card { padding: 28px 30px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.section-head p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.hero-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 144px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 34px;
  border: 1px solid rgba(119,153,218,.18);
  border-radius: 20px;
  background:
    linear-gradient(90deg, rgba(7,23,42,.97) 0%, rgba(8,27,52,.90) 50%, rgba(8,30,59,.42) 100%),
    url("/assets/relay-network-v1.png") center 48% / cover no-repeat,
    #0a1e35;
  color: #fff;
  box-shadow: 0 18px 46px rgba(8, 28, 53, .16);
}
.hero-card::after { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(120deg, rgba(73,124,245,.10), transparent 55%); }
.hero-card code { font-size: clamp(17px, 2vw, 24px); font-weight: 650; letter-spacing: -.03em; }
.hero-card p:last-child { margin: 12px 0 0; color: #9fb2c8; font-size: 12px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.metric { position: relative; overflow: hidden; display: grid; gap: 4px; min-height: 138px; padding: 23px 24px; transition: transform .18s, box-shadow .18s, border-color .18s; }
.metric::before { content: ""; position: absolute; top: 0; left: 22px; right: 22px; height: 2px; border-radius: 0 0 3px 3px; background: linear-gradient(90deg, var(--blue), #8fa9ff); opacity: .75; }
.metric:hover { transform: translateY(-2px); border-color: #d4dfed; box-shadow: 0 14px 34px rgba(15,31,51,.08); }
.metric span { color: var(--muted); font-size: 11px; font-weight: 720; }
.metric strong { margin-top: 8px; font: 720 30px/1.1 "SF Pro Display", -apple-system, sans-serif; letter-spacing: -.04em; }
.metric small { color: var(--muted-light); font-size: 10px; }

/* Tables and lists */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
th { padding: 12px 14px; border-bottom: 1px solid var(--line); background: #f8fafc; color: #8190a3; text-align: left; text-transform: uppercase; letter-spacing: .065em; font-size: 10px; font-weight: 750; white-space: nowrap; }
td { padding: 15px 14px; border-bottom: 1px solid #edf1f5; background: rgba(255,255,255,.42); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfcff; }
td strong { display: block; color: var(--ink-soft); }
td small { color: var(--muted); }
.multiline { white-space: pre-line; line-height: 1.55; }
.badge { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 9px; border-radius: 99px; background: #f0f3f7; color: #66758a; font-size: 10px; font-weight: 750; white-space: nowrap; }
.badge.good { background: var(--green-soft); color: var(--green); }
.badge.bad { background: #fcecec; color: var(--red); }
.empty { padding: 38px; color: #8b97a7; text-align: center; font-size: 12px; }
.item-list { display: grid; gap: 10px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; transition: border-color .16s, box-shadow .16s; }
.list-item:hover { border-color: #d3ddea; box-shadow: 0 8px 22px rgba(15,31,51,.04); }
.list-main { display: flex; align-items: center; gap: 13px; min-width: 0; }
.key-icon { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--blue-soft); color: var(--blue); }
.list-main strong { display: block; }
.list-main small { display: block; margin-top: 3px; color: var(--muted); overflow-wrap: anywhere; }
.danger-link { padding: 7px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--red); cursor: pointer; font-size: 11px; }
.danger-link:hover { background: #fff0f0; }

.filter-bar { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin: -4px 0 18px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
.filter-bar label { min-width: 150px; }
.filter-bar select { min-height: 39px; padding: 8px 11px; }
.table-actions { display: flex; flex-wrap: wrap; gap: 5px; min-width: 180px; }
.small-button, .card-action { min-height: 32px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: #516077; cursor: pointer; font-size: 10px; font-weight: 700; transition: border-color .16s, color .16s, box-shadow .16s, transform .16s; }
.small-button:hover, .card-action:hover { border-color: #aebeda; color: var(--blue); box-shadow: 0 6px 16px rgba(15,31,51,.06); transform: translateY(-1px); }
.danger-text { color: var(--red) !important; }
td .badge + small { display: block; margin-top: 6px; }

/* Models and providers */
.model-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 14px; }
.model-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 276px;
  height: 100%;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, #fff 0%, #fafcff 100%);
  box-shadow: 0 5px 16px rgba(15,31,51,.025);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.model-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--blue), #92aaff); opacity: .8; }
.model-card:hover { transform: translateY(-3px); border-color: #cfdaea; box-shadow: 0 16px 32px rgba(15,31,51,.08); }
.model-card header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 27px; }
.model-card code { min-width: 0; color: #17263a; font-size: 14px; font-weight: 760; overflow-wrap: anywhere; }
.model-label { display: block; margin-top: 17px; color: #223147; font-size: 15px; line-height: 1.45; font-weight: 720; }
.model-card p { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.model-card > small { display: block; margin-top: 12px; color: #8a96a6; font-size: 11px; line-height: 1.6; }
.model-card .card-action { width: 100%; margin-top: auto; padding: 8px 10px; }
.provider-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.provider { min-height: 78px; display: flex; align-items: center; gap: 13px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.provider-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: #c4ccd7; }
.provider-dot.on { background: #26b388; box-shadow: 0 0 0 5px rgba(38,179,136,.10); }
.provider div { min-width: 0; }
.provider strong, .provider small { display: block; }
.provider strong { color: #2b3a4f; font-size: 12px; }
.provider small { margin-top: 3px; color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provider small + small { margin-top: 4px; }

/* Playground and secondary pages */
.playground-layout { display: grid; grid-template-columns: minmax(360px, .8fr) minmax(420px, 1.2fr); gap: 22px; }
.playground-compose { display: grid; gap: 18px; }
.playground-result { min-height: 570px; }
.playground-result pre { min-height: 430px; margin: 0; padding: 22px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; color: #26364a; font: 13px/1.85 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; white-space: pre-wrap; word-break: break-word; }
.toggle-label { min-height: 48px; align-self: end; display: flex; align-items: center; gap: 9px; }
.toggle-label input { width: auto; min-height: 0; accent-color: var(--blue); }
.tip-card { padding: 19px 22px; border-left: 3px solid #e7ad48; }
.tip-card strong { color: #73521d; }
.tip-card p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.warning-banner { max-width: 1320px; margin: 0 auto 22px; padding: 17px 19px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid #edd49f; border-radius: 14px; background: #fff8e9; box-shadow: 0 8px 24px rgba(116,78,17,.06); }
.warning-banner p { margin: 4px 0 0; color: #806535; font-size: 12px; }
.account-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 22px; }
.stack-form { display: grid; gap: 15px; }
.coming-card { padding: 70px 30px; text-align: center; }
.coming-icon { width: 70px; height: 70px; margin: 0 auto 25px; display: grid; place-items: center; border-radius: 22px; background: var(--blue-soft); color: var(--blue); font-size: 28px; font-weight: 720; }
.coming-card > p:not(.eyebrow) { max-width: 650px; margin: 17px auto; color: var(--muted); line-height: 1.8; }
.roadmap { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 30px; }
.roadmap span { padding: 7px 12px; border: 1px dashed #cfd8e3; border-radius: 99px; color: #7b8798; font-size: 11px; }
.roadmap .done { border-style: solid; border-color: #cce8df; background: var(--green-soft); color: var(--green); }

/* Dialogs */
dialog { width: min(520px, calc(100vw - 30px)); max-height: 90vh; padding: 0; overflow: auto; border: 1px solid rgba(214,223,234,.9); border-radius: 20px; background: #fff; box-shadow: var(--shadow-lg); }
dialog:has(.wide-dialog) { width: min(820px, calc(100vw - 30px)); }
dialog::backdrop { background: rgba(4, 15, 28, .58); backdrop-filter: blur(7px); }
.dialog-card { display: grid; gap: 20px; margin: 0; padding: 30px; }
.dialog-card .section-head { margin: 0; }
.secret-box { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #f6f8fb; }
.secret-box code { flex: 1; overflow: auto; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.limits-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.check-grid { max-height: 180px; margin-top: 9px; overflow: auto; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; font-weight: 500; }
.check-item input { width: auto; min-height: 0; accent-color: var(--blue); }
.field-title { color: #465469; font-size: 12px; }
.wide-dialog { width: 100%; }

.toast { position: fixed; z-index: 30; top: 22px; right: 25px; padding: 13px 18px; pointer-events: none; opacity: 0; transform: translateY(-10px); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: #11263a; box-shadow: var(--shadow-md); color: #fff; font-size: 12px; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .playground-layout, .account-grid { grid-template-columns: 1fr; }
  .playground-result { min-height: auto; }
  .limits-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 940px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 46vh; padding: 56px; }
  .login-brand h1 { max-width: 620px; font-size: 46px; }
  .login-panel { padding: 32px; }
  .app-shell { display: block; width: 100%; max-width: 100vw; overflow-x: hidden; }
  .sidebar { position: sticky; top: 0; width: 100%; max-width: 100vw; height: auto; flex-direction: row; align-items: center; padding: 12px 16px; overflow-x: auto; }
  .sidebar::after { display: none; }
  .sidebar-brand { flex: 0 0 auto; padding: 0 20px 0 0; }
  .sidebar nav { flex: 0 0 auto; display: flex; }
  .nav-item { width: auto; white-space: nowrap; }
  .sidebar-foot { display: none; }
  .workspace { width: 100%; max-width: 100vw; padding: 26px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .provider-list { grid-template-columns: 1fr; }
}

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

@media (max-width: 620px) {
  .login-brand { min-height: 42vh; padding: 40px 27px; }
  .login-brand h1 { font-size: 38px; }
  .login-card { padding: 32px 24px; border-radius: 18px; }
  .signal-row { display: none; }
  .workspace { padding: 22px 15px 50px; }
  .topbar { align-items: flex-start; }
  .user-chip div { display: none; }
  .hero-card { align-items: flex-start; flex-direction: column; gap: 22px; padding: 26px 22px; }
  .metric-grid, .model-grid, .limits-grid, .check-grid { grid-template-columns: 1fr; }
  .content-card { padding: 22px 17px; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .section-head > .button, .section-head > .button-row { width: 100%; }
  .section-head > .button-row .button { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .warning-banner { align-items: flex-start; flex-direction: column; }
  .list-item { align-items: flex-start; flex-direction: column; }
  .model-card { min-height: 250px; }
}

/* RelayHub future identity v4 */
.brand-mark {
  padding: 0;
  overflow: hidden;
  border-color: rgba(93, 137, 255, .28);
  background: #07172e;
}
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sidebar-brand > span {
  margin-left: -5px;
  padding: 3px 5px;
  border: 1px solid rgba(112, 153, 255, .25);
  border-radius: 5px;
  color: #83a4ff;
  font: 700 8px/1 "SFMono-Regular", monospace;
  letter-spacing: .08em;
}

body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: .34;
  background-image:
    linear-gradient(rgba(68, 101, 150, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(68, 101, 150, .045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 70% 5%, #000, transparent 58%);
}
.workspace { position: relative; }
.workspace::before {
  content: "";
  position: fixed;
  z-index: -1;
  top: -18rem;
  right: -12rem;
  width: 45rem;
  height: 45rem;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(91, 112, 255, .10), rgba(137, 91, 255, .045) 36%, transparent 68%);
  filter: blur(18px);
}
.content-card, .metric, .coming-card {
  background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(250,252,255,.91));
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, var(--shadow-sm);
}
.hero-card {
  border-color: rgba(96, 135, 255, .25);
  background:
    linear-gradient(90deg, rgba(5,18,38,.98) 0%, rgba(8,24,52,.90) 46%, rgba(26,22,77,.44) 100%),
    url("/assets/relay-network-v1.png") center 48% / cover no-repeat,
    #081a34;
  box-shadow: 0 20px 55px rgba(20, 43, 88, .18), inset 0 1px rgba(255,255,255,.08);
}
.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 20%, rgba(73, 133, 255, .09) 48%, transparent 62%);
  animation: hero-scan 8s ease-in-out infinite;
}
.metric::before, .model-card::before { background: linear-gradient(90deg, #4d8dff, #785eff 58%, #ff7c69); }
.model-card:hover { box-shadow: 0 16px 34px rgba(65, 86, 169, .11), 0 0 0 1px rgba(101, 126, 255, .08); }
.nav-item.active { border-color: rgba(112, 132, 255, .23); background: linear-gradient(90deg, rgba(67, 109, 244, .20), rgba(119, 79, 245, .10)); box-shadow: inset 3px 0 #7b79ff, 0 8px 28px rgba(21, 49, 110, .16); }
.nav-item.active span { color: #9ca5ff; }

.login-shell {
  grid-template-columns: minmax(0, 1.2fr) minmax(420px, .8fr);
  overflow: hidden;
  background: #f4f7ff;
}
.login-brand {
  isolation: isolate;
  min-height: 100vh;
  padding: clamp(52px, 7vw, 108px);
  justify-content: flex-start;
  color: #111d35;
  background:
    radial-gradient(circle at 10% 5%, rgba(94, 150, 255, .20), transparent 24rem),
    radial-gradient(circle at 92% 40%, rgba(142, 91, 255, .16), transparent 30rem),
    linear-gradient(145deg, #f7faff 0%, #edf3ff 46%, #f5f1ff 100%);
}
.login-brand::before {
  z-index: -2;
  background:
    linear-gradient(rgba(64, 105, 178, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(64, 105, 178, .045) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
}
.login-brand::after {
  z-index: -1;
  inset: auto auto -15rem -14rem;
  width: 48rem;
  height: 48rem;
  border-radius: 50%;
  opacity: 1;
  background: radial-gradient(circle, rgba(69, 129, 255, .14), rgba(117, 90, 255, .06) 44%, transparent 70%);
  filter: blur(12px);
  mask-image: none;
}
.login-copy { position: relative; z-index: 3; max-width: 700px; }
.login-wordmark { display: flex; align-items: center; gap: 11px; margin-bottom: clamp(46px, 7vh, 76px); }
.login-wordmark .brand-mark { width: 46px; height: 46px; margin: 0; border-radius: 14px; box-shadow: 0 12px 30px rgba(55, 93, 215, .24); }
.login-wordmark strong { color: #14213b; font-size: 20px; letter-spacing: -.035em; }
.login-wordmark > span { margin-left: 3px; padding: 4px 7px; border: 1px solid rgba(75, 111, 206, .16); border-radius: 6px; background: rgba(255,255,255,.5); color: #66799b; font: 700 8px/1 "SFMono-Regular", monospace; letter-spacing: .12em; }
.login-brand .eyebrow { color: #55709c; }
.login-brand h1 {
  max-width: 700px;
  margin: 0 0 24px;
  color: #111c32;
  font-size: clamp(48px, 5.1vw, 78px);
  line-height: 1.06;
  letter-spacing: -.06em;
  font-weight: 760;
}
.login-brand h1 em {
  display: block;
  padding-bottom: .09em;
  background: linear-gradient(100deg, #347cf6 4%, #725cff 54%, #e86d88 98%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-style: normal;
}
.login-brand .lead { max-width: 630px; color: #63728b; font-size: 15px; line-height: 1.85; }
.login-brand .signal-row { position: relative; z-index: 4; margin-top: 34px; color: #6f7fa0; font-family: "SFMono-Regular", monospace; }
.login-brand .signal-row i { background: linear-gradient(90deg, rgba(70,123,255,.25), rgba(120,80,255,.55)); }
.login-panel {
  position: relative;
  background:
    radial-gradient(circle at 12% 12%, rgba(94, 147, 255, .13), transparent 19rem),
    radial-gradient(circle at 95% 90%, rgba(151, 97, 255, .12), transparent 20rem),
    rgba(244,247,255,.86);
}
.login-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-left: 1px solid rgba(255,255,255,.82);
  background: linear-gradient(145deg, rgba(255,255,255,.16), transparent 55%);
}
.login-card {
  position: relative;
  z-index: 1;
  border-color: rgba(205, 216, 236, .74);
  background: rgba(255,255,255,.72);
  box-shadow: 0 30px 90px rgba(42, 55, 102, .16), inset 0 1px rgba(255,255,255,.92);
  backdrop-filter: blur(26px) saturate(135%);
}
.login-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(255,255,255,.95), rgba(101,137,255,.28), rgba(180,109,255,.18));
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.orb-stage {
  position: absolute;
  z-index: 1;
  right: clamp(-90px, -4vw, -28px);
  bottom: clamp(-200px, -16vh, -110px);
  width: clamp(410px, 43vw, 650px);
  aspect-ratio: 1;
  pointer-events: none;
  filter: drop-shadow(0 35px 55px rgba(54, 80, 160, .18));
}
.orb-halo {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(92, 147, 255, .18), rgba(122, 91, 255, .08) 36%, transparent 68%);
  filter: blur(12px);
  animation: orb-breathe 5s ease-in-out infinite;
}
.orb-globe {
  position: absolute;
  inset: 20%;
  overflow: hidden;
  border: 1px solid rgba(100, 138, 235, .22);
  border-radius: 50%;
  background:
    radial-gradient(circle at 33% 27%, rgba(255,255,255,.96), rgba(230,239,255,.73) 30%, rgba(174,198,249,.28) 64%, rgba(95,121,203,.12) 100%);
  box-shadow:
    inset -26px -25px 55px rgba(83, 102, 189, .16),
    inset 18px 15px 35px rgba(255,255,255,.92),
    0 0 0 1px rgba(255,255,255,.7),
    0 24px 60px rgba(69, 92, 166, .15);
  animation: orb-float 7s ease-in-out infinite;
  transform-style: preserve-3d;
}
.orb-surface {
  position: absolute;
  inset: -8%;
  border-radius: 50%;
  opacity: .56;
  background-image:
    radial-gradient(circle, #496fcd 1px, transparent 1.6px),
    radial-gradient(circle, #8b65e7 .8px, transparent 1.5px);
  background-position: 0 0, 9px 9px;
  background-size: 18px 18px;
  mask-image: radial-gradient(ellipse at center, #000 26%, rgba(0,0,0,.78) 50%, transparent 74%);
  animation: surface-drift 18s linear infinite;
}
.orb-grid, .orb-lat { position: absolute; border: 1px solid rgba(74, 107, 202, .24); border-radius: 50%; }
.orb-grid { inset: 4% 34%; }
.grid-a { transform: rotate(18deg); animation: grid-spin-a 12s linear infinite; }
.grid-b { transform: rotate(78deg); animation: grid-spin-b 16s linear infinite reverse; }
.grid-c { transform: rotate(138deg); animation: grid-spin-c 20s linear infinite; }
.orb-lat { left: 5%; right: 5%; height: 31%; }
.lat-a { top: 16%; }
.lat-b { top: 34.5%; }
.lat-c { top: 53%; }
.orb-node { position: absolute; width: 9px; height: 9px; border: 2px solid rgba(255,255,255,.85); border-radius: 50%; background: #4f8cff; box-shadow: 0 0 0 5px rgba(79,140,255,.11), 0 0 18px rgba(79,140,255,.45); animation: node-pulse 2.8s ease-in-out infinite; }
.node-a { top: 20%; left: 35%; }
.node-b { top: 39%; right: 13%; animation-delay: -.7s; background: #8567f1; }
.node-c { bottom: 22%; left: 18%; animation-delay: -1.4s; background: #ff7884; }
.node-d { bottom: 12%; right: 34%; animation-delay: -2s; }
.node-e { top: 48%; left: 43%; animation-delay: -.4s; background: #725cff; }
.orb-core-mark { position: absolute; inset: 50% auto auto 50%; width: 58px; height: 58px; padding: 5px; overflow: hidden; border: 1px solid rgba(255,255,255,.84); border-radius: 18px; background: rgba(6,21,49,.90); box-shadow: 0 12px 32px rgba(36,62,139,.30), 0 0 0 8px rgba(255,255,255,.18); transform: translate(-50%,-50%); }
.orb-core-mark img { width: 100%; height: 100%; border-radius: 13px; object-fit: cover; }
.orb-orbit { position: absolute; z-index: 3; border: 1.2px solid rgba(86, 111, 223, .35); border-radius: 50%; }
.orbit-one { inset: 13% 5%; transform: rotate(-15deg); animation: orbit-spin 11s linear infinite; }
.orbit-two { inset: 23% 2%; transform: rotate(44deg); animation: orbit-spin-two 15s linear infinite reverse; }
.orb-orbit b { position: absolute; width: 10px; height: 10px; border: 2px solid #f7faff; border-radius: 50%; background: #5c87ff; box-shadow: 0 0 18px rgba(80,125,255,.5); }
.orbit-one b:first-child { top: 18%; left: 7%; }
.orbit-one b:last-child { right: 9%; bottom: 14%; background: #fa7380; }
.orbit-two b { top: 9%; right: 23%; background: #8b67f0; }
.data-stream { position: absolute; z-index: 0; left: -2%; width: 38%; height: 1px; background: linear-gradient(90deg, transparent, rgba(82,127,243,.45), transparent); transform-origin: right center; animation: stream-flow 4.5s ease-in-out infinite; }
.stream-a { top: 43%; transform: rotate(9deg); }
.stream-b { top: 53%; transform: rotate(-5deg); animation-delay: -1.3s; }
.stream-c { top: 62%; transform: rotate(-18deg); animation-delay: -2.4s; }

@keyframes hero-scan { 0%,100% { transform: translateX(-45%); opacity: 0; } 45%,60% { opacity: 1; } 70% { transform: translateX(55%); opacity: 0; } }
@keyframes orb-breathe { 0%,100% { transform: scale(.96); opacity: .72; } 50% { transform: scale(1.05); opacity: 1; } }
@keyframes orb-float { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-12px) rotate(2deg); } }
@keyframes surface-drift { to { background-position: 36px 0, 45px 9px; transform: rotate(4deg); } }
@keyframes grid-spin-a { to { transform: rotate(378deg); } }
@keyframes grid-spin-b { to { transform: rotate(438deg); } }
@keyframes grid-spin-c { to { transform: rotate(498deg); } }
@keyframes orbit-spin { to { transform: rotate(345deg); } }
@keyframes orbit-spin-two { to { transform: rotate(404deg); } }
@keyframes node-pulse { 0%,100% { transform: scale(.8); opacity: .65; } 50% { transform: scale(1.18); opacity: 1; } }
@keyframes stream-flow { 0%,100% { opacity: .1; clip-path: inset(0 100% 0 0); } 50% { opacity: 1; clip-path: inset(0 0 0 0); } }

@media (max-width: 1180px) and (min-width: 941px) {
  .login-brand { padding: 54px; }
  .login-brand h1 { font-size: 52px; }
  .orb-stage { right: -100px; bottom: -150px; width: 500px; opacity: .9; }
}

@media (max-width: 940px) {
  .login-shell { display: grid; grid-template-columns: 1fr; overflow: visible; }
  .login-brand { min-height: 620px; padding: 46px 50px; }
  .login-wordmark { margin-bottom: 36px; }
  .login-brand h1 { max-width: 560px; font-size: 46px; }
  .login-brand .lead { max-width: 520px; }
  .orb-stage { right: -90px; bottom: -145px; width: 500px; opacity: .72; }
  .login-panel { min-height: 590px; }
}

@media (max-width: 620px) {
  .login-brand { min-height: 650px; padding: 32px 25px; }
  .login-wordmark { margin-bottom: 36px; }
  .login-wordmark > span { display: none; }
  .login-brand h1 { font-size: 39px; }
  .login-brand .lead { font-size: 13px; }
  .login-brand .signal-row { display: flex; max-width: 330px; flex-wrap: wrap; gap: 8px; }
  .login-brand .signal-row i { width: 13px; }
  .orb-stage { right: -95px; bottom: -105px; width: 420px; opacity: .72; }
  .orb-core-mark { width: 48px; height: 48px; border-radius: 15px; }
  .login-panel { min-height: 560px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-card::before, .orb-halo, .orb-globe, .orb-surface, .orb-grid, .orb-orbit, .orb-node, .data-stream { animation: none !important; }
}
