:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe4ee;
  --line-strong: #cbd5e1;
  --brand: #2563eb;
  --brand-dark: #1e40af;
  --nav: #0f172a;
  --nav-soft: #1e293b;
  --green: #15803d;
  --green-bg: #dcfce7;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
  --radius: 18px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100%; margin: 0; color: var(--ink); background: radial-gradient(circle at top left, #e0edff, transparent 34rem), var(--bg); }
button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(37, 99, 235, .22); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
code { background: #eef2ff; color: #3730a3; border-radius: 6px; padding: 2px 5px; }
.hidden { display: none !important; }

.auth-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 40px; align-items: center; padding: 48px; }
.auth-hero { max-width: 760px; }
.auth-hero h1 { margin-top: 56px; font-size: clamp(42px, 6vw, 78px); line-height: .95; letter-spacing: -.06em; }
.auth-hero p { max-width: 620px; margin-top: 24px; color: #334155; font-size: 20px; line-height: 1.55; }
.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-lockup strong { display: block; font-size: 18px; }
.brand-lockup small { display: block; color: var(--muted); margin-top: 2px; }
.brand-lockup.compact small { color: #94a3b8; }
.brand-mark { display: grid; place-items: center; flex: 0 0 auto; width: 46px; height: 46px; border-radius: 15px; color: white; font-weight: 850; letter-spacing: -.04em; background: linear-gradient(135deg, #38bdf8, #2563eb 50%, #7c3aed); box-shadow: 0 12px 28px rgba(37, 99, 235, .28); }
.hero-pills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero-pills span { padding: 9px 13px; border: 1px solid rgba(37, 99, 235, .18); background: rgba(255,255,255,.65); border-radius: 999px; color: #1e3a8a; font-weight: 700; }
.auth-card, .card, .metric, .modal-card { background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-card { display: grid; gap: 18px; padding: 24px; }
.auth-card h2 { font-size: 26px; letter-spacing: -.03em; }
.auth-card p { color: var(--muted); line-height: 1.5; }
.form-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 5px; border-radius: 14px; background: #eef2f7; }
.tab { padding: 10px; border-radius: 10px; color: #475569; background: transparent; font-weight: 750; }
.tab.active { color: var(--ink); background: white; box-shadow: 0 6px 18px rgba(15,23,42,.08); }
label { display: grid; gap: 7px; color: #334155; font-size: 13px; font-weight: 750; }
input, select { width: 100%; min-height: 44px; border: 1px solid var(--line-strong); background: white; color: var(--ink); border-radius: 12px; padding: 10px 12px; }
.primary, .ghost, .danger, .soft { min-height: 42px; padding: 10px 14px; border-radius: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.primary { color: white; background: var(--brand); }
.primary:hover { background: var(--brand-dark); }
.ghost { color: #1f2937; background: #eef2f7; }
.soft { color: var(--brand-dark); background: #eff6ff; }
.danger { color: var(--red); background: var(--red-bg); }
.wide { width: 100%; }
.fine-print { font-size: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 292px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 22px; color: white; background: linear-gradient(180deg, var(--nav), #111827); }
.network-picker { display: grid; gap: 10px; padding: 14px; border-radius: 18px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); }
.network-picker label { color: #cbd5e1; }
.network-picker select { border-color: rgba(255,255,255,.12); background: var(--nav-soft); color: white; }
.main-nav { display: grid; gap: 8px; }
.nav-item { width: 100%; text-align: left; padding: 12px 13px; border-radius: 13px; color: #cbd5e1; background: transparent; font-weight: 800; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.10); }
.sidebar-card { margin-top: auto; padding: 15px; border-radius: 16px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.08); }
.sidebar-card p { margin-top: 7px; color: #cbd5e1; font-size: 13px; line-height: 1.45; }
.workspace { min-width: 0; }
.topbar { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 24px 32px; background: rgba(255,255,255,.82); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; color: var(--brand); font-size: 12px; font-weight: 900; }
.topbar h1 { margin-top: 4px; font-size: 30px; letter-spacing: -.04em; }
.topbar p:not(.eyebrow) { margin-top: 5px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.session { display: flex; align-items: center; gap: 10px; color: var(--muted); white-space: nowrap; }
.main-content { padding: 28px 32px 48px; display: grid; gap: 20px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { padding: 18px; display: grid; gap: 8px; }
.metric span { color: var(--muted); font-size: 13px; font-weight: 750; }
.metric strong { font-size: 34px; letter-spacing: -.05em; }
.card { padding: 20px; }
.card-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.card-head h2 { font-size: 20px; letter-spacing: -.03em; }
.card-head p { color: var(--muted); margin-top: 4px; line-height: 1.45; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stack { display: grid; gap: 12px; }
.empty { padding: 28px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 16px; color: var(--muted); background: var(--panel-soft); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; background: #eef2f7; color: #475569; font-size: 12px; font-weight: 850; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue { background: #dbeafe; color: #1d4ed8; }
.network-summary { display: grid; gap: 14px; grid-template-columns: 1.2fr .8fr; align-items: stretch; }
.summary-hero { padding: 24px; border-radius: 22px; background: linear-gradient(135deg, #1e3a8a, #2563eb 62%, #38bdf8); color: white; box-shadow: var(--shadow); }
.summary-hero p { color: rgba(255,255,255,.82); margin-top: 8px; line-height: 1.5; }
.summary-hero h2 { font-size: 34px; letter-spacing: -.05em; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td { color: #1f2937; }
.subtle { color: var(--muted); font-size: 13px; }
.kv { display: grid; gap: 10px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.kv span { color: var(--muted); }
.kv strong { text-align: right; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.inline-form { display: grid; grid-template-columns: minmax(180px,1fr) minmax(180px,1fr) auto; gap: 10px; align-items: end; }
pre { overflow-x: auto; white-space: pre-wrap; margin: 0; padding: 16px; border-radius: 14px; color: #e5e7eb; background: #0b1220; line-height: 1.45; }
.placeholder-note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.asterisk { color: var(--amber); font-weight: 900; }

.modal { width: min(560px, calc(100vw - 28px)); border: 0; padding: 0; background: transparent; }
.modal::backdrop { background: rgba(15,23,42,.52); backdrop-filter: blur(3px); }
.modal-card { padding: 0; overflow: hidden; }
.modal-head { display: flex; justify-content: space-between; gap: 16px; padding: 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 21px; }
.modal-head p { color: var(--muted); margin-top: 4px; line-height: 1.45; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; background: var(--panel-soft); border-top: 1px solid var(--line); }
.icon-button { width: 36px; height: 36px; border-radius: 999px; color: #475569; background: #eef2f7; font-size: 22px; line-height: 1; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 10; display: grid; gap: 10px; }
.toast { width: min(380px, calc(100vw - 36px)); padding: 13px 14px; border-radius: 14px; background: #0f172a; color: white; box-shadow: var(--shadow); }
.toast.error { background: var(--red); }

@media (max-width: 980px) {
  .auth-screen { grid-template-columns: 1fr; padding: 24px; }
  .auth-hero h1 { margin-top: 28px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .network-summary, .grid.two, .grid.three, .form-grid.two, .inline-form { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; padding: 22px; }
  .main-content { padding: 22px; }
  .topbar-actions { width: 100%; justify-content: space-between; }
}
