:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  background: #10131a;
  color: #f4f5f7;
  font-smooth: always;
  --muted: #9299a7;
  --line: #292e39;
  --surface: #171b24;
  --surface-raised: #1c212c;
  --green: #83e0b1;
  --red: #ff8c8c;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at 50% -30%, #283949 0%, transparent 54%), #10131a;
}

button, textarea, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }

.shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { display: inline-flex; gap: 10px; align-items: center; color: #f4f5f7; font-size: 14px; font-weight: 650; letter-spacing: .01em; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: #10131a; background: #a3f5c9; font-size: 20px; font-weight: 800; }
.badge, .state-pill { display: inline-flex; gap: 8px; align-items: center; color: #b6bdc9; font-size: 12px; }
.badge { padding: 8px 11px; border: 1px solid var(--line); border-radius: 100px; background: rgba(23,27,36,.75); }
.badge-dot, .state-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(131,224,177,.6); }
.intro { padding: 54px 0 32px; }
.eyebrow { margin: 0 0 9px; color: #88d8b0; font-size: 10px; font-weight: 750; letter-spacing: .17em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 11px; font-size: clamp(34px, 5vw, 48px); line-height: 1.1; letter-spacing: -.045em; }
.lede { max-width: 620px; margin: 0; color: #9ca4b2; font-size: 15px; line-height: 1.65; }
.workspace { display: grid; grid-template-columns: minmax(310px, .9fr) minmax(400px, 1.1fr); gap: 16px; align-items: start; }
.panel { border: 1px solid #2b303b; border-radius: 14px; background: linear-gradient(145deg, rgba(27,32,43,.96), rgba(20,24,32,.96)); box-shadow: 0 18px 50px rgba(0,0,0,.16); }
.config-panel { padding: 24px; }
.status-panel { padding: 24px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 25px; }
h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.limit { margin-top: 4px; color: #88909f; font-size: 11px; white-space: nowrap; }
label { display: block; margin: 20px 0 8px; color: #c9ced8; font-size: 12px; font-weight: 650; }
fieldset.endpoint-controls { min-width: 0; margin: 0; padding: 0; border: 0; }
.endpoint-controls legend { margin: 20px 0 8px; color: #c9ced8; font-size: 12px; font-weight: 650; }
.endpoint-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid #343b48; border-radius: 8px; background: #11151c; }
.endpoint-option + .endpoint-option { margin-top: 8px; }
.endpoint-choice { min-width: 0; display: flex; align-items: flex-start; gap: 10px; margin: 0; cursor: pointer; }
.endpoint-checkbox { flex: none; width: 15px; height: 15px; margin: 2px 0 0; accent-color: #9ce9bf; }
.endpoint-checkbox:disabled { cursor: not-allowed; }
.endpoint-description { min-width: 0; display: grid; gap: 6px; }
.endpoint-description strong { color: #e4e8ee; font-size: 12px; }
.endpoint-description code { overflow-wrap: anywhere; font-size: 10px; }
.connection-count-label { flex: none; display: flex; align-items: center; gap: 7px; margin: 0; color: #9ca4b2; font-size: 10px; }
.endpoint-count { width: 56px; min-height: 32px; border: 1px solid #343b48; border-radius: 6px; padding: 0 7px; color: #e4e8ee; background: #1c212c; font-size: 12px; }
.endpoint-count:disabled { opacity: .45; }
.endpoint-tools { flex: none; display: flex; align-items: center; gap: 8px; }
.remove-endpoint-button { border: 0; padding: 5px; color: #ff9a9a; background: transparent; font-size: 10px; }
.remove-endpoint-button:disabled { cursor: not-allowed; opacity: .45; }
.add-endpoint-row { display: flex; align-items: stretch; gap: 8px; }
.endpoint-input { width: 100%; min-width: 0; border: 1px solid #343b48; border-radius: 8px; outline: none; padding: 0 11px; color: #e4e8ee; background: #11151c; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.endpoint-input:focus { border-color: #72c99b; box-shadow: 0 0 0 3px rgba(114,201,155,.12); }
.endpoint-input:disabled { opacity: .62; }
.add-endpoint-row .button { flex: none; }
textarea { width: 100%; resize: vertical; border: 1px solid #343b48; border-radius: 8px; outline: none; padding: 12px 13px; color: #e4e8ee; background: #11151c; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.6; transition: border-color .15s, box-shadow .15s; }
textarea:focus { border-color: #72c99b; box-shadow: 0 0 0 3px rgba(114,201,155,.12); }
textarea:disabled { opacity: .62; }
.message-input { min-height: 86px; }
.hint, .runtime-note { margin: 8px 0 0; color: #838b99; font-size: 11px; line-height: 1.65; }
code { padding: 2px 4px; border-radius: 4px; color: #c0e8d2; background: #252c34; font-size: .95em; }
.actions { display: flex; gap: 9px; margin-top: 23px; }
.button { min-height: 40px; padding: 0 15px; border: 1px solid transparent; border-radius: 7px; font-size: 12px; font-weight: 700; transition: filter .15s, border-color .15s; }
.button:hover:not(:disabled) { filter: brightness(1.1); }
.button-primary { color: #102118; background: #9ce9bf; }
.button-secondary { border-color: #444b58; color: #d1d6de; background: #242a35; }
.runtime-note { margin-top: 13px; }
.form-error { margin: 14px 0 0; color: var(--red); font-size: 12px; line-height: 1.5; }
.state-pill { padding: 7px 10px; border: 1px solid #333a46; border-radius: 100px; white-space: nowrap; }
.state-idle .state-dot { background: #727a88; box-shadow: none; }
.state-error .state-dot { background: var(--red); box-shadow: 0 0 10px rgba(255,140,140,.45); }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.summary-card { min-height: 73px; display: flex; flex-direction: column; justify-content: center; gap: 7px; padding: 12px; border: 1px solid #2d333e; border-radius: 8px; background: rgba(15,18,24,.52); }
.summary-label { color: #8e96a4; font-size: 10px; }
.summary-card strong { font-size: 22px; line-height: 1; letter-spacing: -.04em; }
.connection-list { display: grid; gap: 7px; margin-top: 12px; }
.empty-state { margin: 0; padding: 14px 2px; color: #79818f; font-size: 11px; }
.connection-row { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 12px; border: 1px solid #2d333e; border-radius: 8px; background: rgba(15,18,24,.44); }
.connection-details { min-width: 0; display: grid; gap: 5px; }
.connection-label { color: #c8ced8; font-size: 10px; }
.connection-url { overflow: hidden; color: #c8ced8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.connection-metrics { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 12px; margin: 0; padding-top: 11px; border-top: 1px solid rgba(255,255,255,.06); }
.connection-metrics div { min-width: 0; }
.connection-metrics dt { margin-bottom: 4px; color: #838b99; font-size: 9px; }
.connection-metrics dd { margin: 0; color: #aeb5c0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.connection-status { flex: none; color: #9ca4b2; font-size: 10px; }
.connection-status.open { color: var(--green); }
.connection-status.error, .connection-status.closed { color: var(--red); }
.log-header { display: flex; justify-content: space-between; align-items: end; margin-top: 24px; padding-top: 19px; border-top: 1px solid var(--line); }
.log-header .eyebrow { margin-bottom: 7px; }
h3 { margin: 0; font-size: 14px; }
.text-button { border: 0; padding: 4px 0; color: #9ca4b2; background: transparent; font-size: 11px; }
.text-button:hover { color: #e3e7ec; }
.event-log { display: flex; flex-direction: column; gap: 0; max-height: 190px; overflow: auto; margin: 12px 0 0; padding: 0; list-style: none; }
.event-log li { display: grid; grid-template-columns: 63px 1fr; gap: 10px; padding: 8px 2px; border-bottom: 1px solid rgba(255,255,255,.055); color: #aab1bc; font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.event-time { color: #6f7784; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.empty-log { display: block !important; color: #78808d !important; }
.visibility-log-header { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.visibility-log-header .eyebrow { margin-bottom: 7px; }
.visibility-log { display: block; min-height: 92px; margin-top: 12px; resize: vertical; white-space: pre; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
.footer { display: flex; justify-content: space-between; gap: 14px; padding: 21px 1px 30px; color: #6f7784; font-size: 10px; }

@media (max-width: 760px) {
  .shell { width: min(100% - 28px, 560px); }
  .intro { padding: 42px 0 25px; }
  .workspace { grid-template-columns: 1fr; }
  .config-panel, .status-panel { padding: 20px; }
  .footer { flex-direction: column; }
}

@media (max-width: 430px) {
  .endpoint-option { align-items: flex-start; flex-direction: column; }
  .endpoint-tools { align-self: flex-end; }
  .connection-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .add-endpoint-row { align-items: stretch; flex-direction: column; }
  .endpoint-input { min-height: 40px; }
}

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