:root {
  color-scheme: dark;
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
  background: #11141b;
  color: #f6f7fb;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top right, #252b46 0, #11141b 48%); }
button, input { font: inherit; }
button { cursor: pointer; border: 1px solid #586078; border-radius: 10px; padding: .65rem 1rem; background: #272c39; color: inherit; }
button:disabled { cursor: not-allowed; opacity: .55; }
button.primary { background: #6c5ce7; border-color: #8578ef; }
body[aria-busy] button:not(:disabled) { cursor: progress; }
button.danger-link { color: #ffb4b4; }

.connections-shell { width: min(760px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 64px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { margin: .25rem 0 .5rem; font-size: clamp(2rem, 7vw, 3.2rem); }
.page-head p { color: #c7cbda; }
.back-link { color: #c7c2ff; text-decoration: none; }
.eyebrow { color: #9f95ff !important; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.auth-status { margin-inline-start: auto; color: #adb3c4; font-size: .88rem; }
.message { min-height: 1.5rem; color: #c7cbda; }
.message[data-tone="error"] { color: #ffb4b4; }
.message[data-tone="success"] { color: #9ee6b6; }
.connection-list { display: grid; gap: 14px; }
.empty-state, .connection-card { border: 1px solid #343a4b; border-radius: 16px; background: rgba(24, 28, 38, .92); padding: 22px; }
.empty-state { text-align: center; padding-block: 44px; }
.empty-state h2, .connection-card h2 { margin: 0; }
.empty-state p, .connection-label, .muted { color: #adb3c4; }
.connection-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.connection-label { margin: .35rem 0 0; }
.status { border-radius: 999px; padding: .35rem .7rem; background: #393f50; white-space: nowrap; font-size: .86rem; }
.status-connected { background: #174b35; color: #b7f4cf; }
.status-connecting, .status-connecting-relay, .status-subscribing, .status-reconnecting { background: #504515; color: #ffe7a0; }
.status-error, .status-degraded { background: #572a2a; color: #ffc0c0; }
.connection-details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 18px 0; }
.connection-details dt { color: #9da4b8; }
.connection-details dd { margin: 0; }
.safe-error { color: #ffb4b4; }
.card-actions, .dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; }

dialog { width: min(520px, calc(100% - 28px)); padding: 0; border: 1px solid #4b5369; border-radius: 18px; background: #191d27; color: inherit; }
dialog::backdrop { background: rgba(4, 6, 10, .76); }
.dialog-card { padding: 22px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-head h2 { margin: 0; }
#closeAddDialog { border: 0; background: transparent; font-size: 1.6rem; padding: .25rem .5rem; }
.platform-catalog { display: grid; gap: 10px; }
.platform-option { text-align: start; display: grid; gap: 4px; padding: 16px; }
.platform-option span { color: #b9becc; font-size: .9rem; }
.configuration-fields { display: grid; gap: 12px; margin: 18px 0; }
.configuration-fields label { display: grid; gap: 7px; }
.configuration-fields input { width: 100%; border: 1px solid #4b5369; border-radius: 9px; background: #10131a; color: inherit; padding: .7rem .8rem; }

@media (max-width: 540px) {
  .connections-shell { width: min(100% - 20px, 760px); padding-top: 22px; }
  .auth-status { width: 100%; margin-inline-start: 0; }
  .connection-head { align-items: center; }
}
.device-authorization {
  margin: 14px 0;
  border: 1px solid #514b76;
  border-radius: 12px;
  background: #17182a;
  padding: 14px;
}
.device-authorization p { margin: 0 0 10px; }
.device-code {
  display: inline-block;
  direction: ltr;
  margin: 2px 0 14px;
  border-radius: 8px;
  background: #0e1018;
  padding: .55rem .8rem;
  color: #fff;
  font-size: 1.15rem;
  letter-spacing: .12em;
}
.authorize-link {
  display: inline-block;
  margin-inline-start: 10px;
  border-radius: 10px;
  background: #6c5ce7;
  padding: .65rem 1rem;
  color: #fff;
  text-decoration: none;
}
.status-waiting-for-user, .status-authentication-required, .status-authorization-required, .status-authorization-expired { background: #504515; color: #ffe7a0; }
.platform-option small { display: block; }


