:root {
  --bg: #f3f2ee;
  --surface: #ffffff;
  --surface-soft: #f8f7f4;
  --surface-warm: #fff8f5;
  --ink: #17191d;
  --ink-soft: #34383f;
  --muted: #6c7078;
  --muted-strong: #565b64;
  --line: #deded9;
  --line-strong: #c9cac5;
  --accent: #d43f35;
  --accent-dark: #ae2f28;
  --accent-soft: #fde9e6;
  --navy: #132329;
  --navy-soft: #1d333b;
  --success: #19714f;
  --success-soft: #e6f5ee;
  --warning: #a8650e;
  --warning-soft: #fff2d8;
  --danger: #b52e2e;
  --danger-soft: #fbe7e5;
  --focus: #206cd4;
  --shadow-sm: 0 1px 2px rgb(17 24 28 / 5%), 0 4px 16px rgb(17 24 28 / 4%);
  --shadow-md: 0 16px 50px rgb(17 24 28 / 14%);
  --radius-sm: 9px;
  --radius-md: 15px;
  --radius-lg: 22px;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
summary,
label,
input[type="checkbox"] {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  color: inherit;
}

svg {
  display: block;
}

button svg path,
.confirm-icon svg path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
  line-height: 1.16;
  text-wrap: balance;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 150ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid rgb(32 108 212 / 30%);
  outline-offset: 2px;
}

.shell {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.muted-copy {
  color: var(--muted);
  font-size: 0.8rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: max-content;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  overflow: hidden;
  place-items: center;
  border-radius: 12px;
  background: var(--navy);
}

.brand-mark__sun {
  position: absolute;
  top: 8px;
  left: 11px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #f05a4e;
}

.brand-mark__wave,
.brand-mark__wave::before {
  position: absolute;
  right: -5px;
  bottom: 6px;
  width: 34px;
  height: 13px;
  border: 2px solid #fff;
  border-right: 0;
  border-bottom: 0;
  border-radius: 55% 0 0;
  content: "";
  transform: rotate(-7deg);
}

.brand-mark__wave::before {
  right: 5px;
  bottom: 5px;
  width: 29px;
  opacity: 0.65;
}

.brand-copy {
  display: grid;
  line-height: 1;
}

.brand-copy strong {
  font-size: 0.98rem;
  letter-spacing: -0.02em;
}

.brand-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

.brand--large .brand-mark {
  width: 48px;
  height: 48px;
  border: 1px solid rgb(255 255 255 / 16%);
  background: rgb(255 255 255 / 8%);
}

.brand--large .brand-mark__sun {
  top: 9px;
  left: 14px;
  width: 19px;
  height: 19px;
}

.brand--large .brand-mark__wave {
  bottom: 8px;
  width: 41px;
}

.brand--large .brand-copy strong {
  font-size: 1.1rem;
}

.brand--large .brand-copy span {
  color: rgb(255 255 255 / 58%);
}

.button {
  position: relative;
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.15;
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease,
    color 150ms ease, transform 100ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.button--primary {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 4px 12px rgb(212 63 53 / 18%);
  color: #fff;
}

.button--primary:hover:not(:disabled) {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  box-shadow: 0 6px 16px rgb(174 47 40 / 22%);
}

.button--secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
}

.button--secondary:hover:not(:disabled),
.button--quiet:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.button--quiet {
  border-color: transparent;
  color: var(--muted-strong);
}

.button--danger,
.button--danger-soft {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.button--danger:hover:not(:disabled) {
  background: #952424;
}

.button--danger-soft {
  border-color: var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger);
}

.button--danger-soft:hover:not(:disabled) {
  border-color: #f5d5d1;
  background: #f5d5d1;
}

.button--small {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 0.8rem;
}

.button--wide {
  width: 100%;
  min-height: 48px;
}

.button__loader {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.button[aria-busy="true"] .button__loader {
  display: inline-block;
}

.button[aria-busy="true"] .button__label {
  opacity: 0.78;
}

.icon-button,
.text-icon-button,
.modal__close {
  display: inline-grid;
  min-width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.icon-button:hover,
.text-icon-button:hover,
.modal__close:hover {
  background: #ecebe7;
  color: var(--ink);
}

.icon-button--plain {
  min-width: 36px;
  height: 36px;
  background: transparent;
}

.icon-button--danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.text-icon-button {
  width: auto;
  min-width: 78px;
  padding-inline: 9px;
  font-size: 0.72rem;
  font-weight: 750;
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.connection-field label {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 750;
}

.field input,
.connection-field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.93rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input:hover {
  border-color: #aaaca6;
}

.field input:focus,
.connection-field input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgb(32 108 212 / 12%);
  outline: 0;
}

.field input:user-invalid {
  border-color: var(--danger);
}

.field__help {
  margin: -1px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input {
  padding-right: 92px;
}

.password-toggle {
  position: absolute;
  right: 4px;
  min-height: 38px;
  border-radius: 8px;
  background: transparent;
}

.form-alert {
  padding: 11px 13px;
  border: 1px solid #f4c7c2;
  border-radius: 10px;
  background: var(--danger-soft);
  color: #8f2727;
  font-size: 0.84rem;
}

/* Login */
.login-page {
  overflow-x: hidden;
  background: var(--surface);
}

.login-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(420px, 0.95fr) minmax(430px, 1.05fr);
}

.login-intro {
  position: relative;
  display: flex;
  min-height: 100%;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(32px, 5vw, 68px);
  isolation: isolate;
  background: var(--navy);
  color: #fff;
}

.login-intro::before {
  position: absolute;
  z-index: -2;
  width: 520px;
  height: 520px;
  border: 1px solid rgb(255 255 255 / 7%);
  border-radius: 50%;
  content: "";
  inset: auto -180px -180px auto;
  box-shadow: 0 0 0 90px rgb(255 255 255 / 2%), 0 0 0 180px rgb(255 255 255 / 1.5%);
}

.login-intro::after {
  position: absolute;
  z-index: -1;
  top: 16%;
  right: -13%;
  width: 310px;
  height: 310px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 40%, #e34b40 0 28%, #d33e34 29% 57%, transparent 58%);
  content: "";
  filter: saturate(0.95);
  opacity: 0.94;
}

.login-intro__copy {
  width: min(510px, 92%);
  margin-block: auto;
  padding-block: 12vh 8vh;
}

.login-intro__copy .eyebrow {
  color: #ff8c82;
}

.login-intro__copy h1 {
  margin-bottom: 24px;
  color: #fff;
  font-size: clamp(2.45rem, 5vw, 4.8rem);
  font-weight: 730;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.login-intro__copy > p:last-child {
  max-width: 430px;
  margin-bottom: 0;
  color: rgb(255 255 255 / 66%);
  font-size: 1rem;
}

.login-signal {
  display: flex;
  height: 28px;
  align-items: end;
  gap: 5px;
}

.login-signal span {
  width: 3px;
  border-radius: 3px;
  background: #fff;
  opacity: 0.4;
}

.login-signal span:nth-child(1) { height: 8px; }
.login-signal span:nth-child(2) { height: 16px; }
.login-signal span:nth-child(3) { height: 26px; background: #f26055; opacity: 1; }
.login-signal span:nth-child(4) { height: 19px; }
.login-signal span:nth-child(5) { height: 11px; }

.login-panel {
  display: grid;
  min-height: 100%;
  padding: 40px;
  place-items: center;
  background: var(--surface);
}

.login-card {
  width: min(410px, 100%);
}

.login-card__heading {
  margin-bottom: 30px;
}

.login-card__heading h2 {
  margin-bottom: 10px;
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  letter-spacing: -0.04em;
}

.login-card__heading > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 20px;
  margin-top: 18px;
}

.auth-form .button {
  margin-top: 3px;
}

.login-note {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.login-footer {
  position: absolute;
  right: 40px;
  bottom: 28px;
  margin: 0;
  color: #a0a2a4;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

/* Dashboard */
.dashboard-page {
  padding-bottom: 60px;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgb(222 222 217 / 86%);
  background: rgb(255 255 255 / 90%);
  backdrop-filter: blur(14px);
}

.site-header__inner {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-signal {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 650;
}

.header-user {
  color: var(--muted-strong);
  font-size: 0.8rem;
  font-weight: 700;
}

.dashboard {
  padding-top: 42px;
}

.page-heading,
.section-heading,
.panel__heading,
.panel__heading-group,
.heading-with-count {
  display: flex;
  align-items: center;
}

.page-heading {
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.page-heading h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.045em;
}

.page-heading__lead {
  margin-bottom: 0;
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  gap: 20px;
}

.dashboard-grid--top {
  grid-template-columns: minmax(0, 1.18fr) minmax(350px, 0.82fr);
}

.panel {
  padding: clamp(22px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel__heading {
  gap: 13px;
}

.panel__heading h2,
.section-heading h2 {
  margin-bottom: 0;
  font-size: 1.3rem;
  letter-spacing: -0.025em;
}

.panel__heading .eyebrow {
  margin-bottom: 4px;
}

.panel__heading--split {
  justify-content: space-between;
}

.panel__heading-group {
  gap: 13px;
}

.panel__intro {
  margin: 19px 0 22px;
  color: var(--muted);
  font-size: 0.88rem;
}

.section-icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--navy);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.03em;
}

.connection-fields {
  display: grid;
  gap: 17px;
}

.connection-field {
  display: grid;
  gap: 7px;
}

.copy-field {
  display: flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.copy-field input {
  min-width: 0;
  border: 0;
  background: transparent;
}

.copy-field input:focus {
  box-shadow: none;
}

.mono-input {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.8rem !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 17px;
}

.setup-guide {
  margin-top: 23px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.setup-guide summary {
  width: fit-content;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 750;
}

.setup-guide ol {
  margin: 14px 0 0;
  padding-left: 23px;
  color: var(--muted-strong);
  font-size: 0.82rem;
}

.setup-guide li + li {
  margin-top: 5px;
}

.signal-panel {
  display: flex;
  flex-direction: column;
}

.signal-orbit {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--success-soft);
}

.signal-orbit span:first-child {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.signal-orbit span:nth-child(2),
.signal-orbit span:nth-child(3) {
  position: absolute;
  border: 1.5px solid var(--success);
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
}

.signal-orbit span:nth-child(2) {
  width: 22px;
  height: 22px;
}

.signal-orbit span:nth-child(3) {
  width: 34px;
  height: 34px;
  opacity: 0.5;
}

.signal-state {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 24px 0 20px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}

.signal-state > div {
  display: grid;
  gap: 2px;
}

.signal-state strong {
  font-size: 0.94rem;
}

.signal-state span:last-child {
  color: var(--muted);
  font-size: 0.76rem;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #989da2;
}

.status-dot--large {
  width: 11px;
  height: 11px;
}

.status-dot--success,
.status-pill[data-state="running"] .status-dot,
.status-pill[data-state="live"] .status-dot {
  background: #28a06f;
  box-shadow: 0 0 0 4px rgb(40 160 111 / 12%);
}

.status-dot--warning,
.status-pill[data-state="starting"] .status-dot,
.status-pill[data-state="connecting"] .status-dot,
.status-pill[data-state="reconnecting"] .status-dot,
.status-pill[data-state="waiting_for_input"] .status-dot,
.status-pill[data-state="stopping"] .status-dot {
  background: #d48a25;
  box-shadow: 0 0 0 4px rgb(212 138 37 / 12%);
}

.status-dot--danger,
.status-pill[data-state="error"] .status-dot,
.status-pill[data-state="failed"] .status-dot {
  background: #cf3e3e;
  box-shadow: 0 0 0 4px rgb(207 62 62 / 12%);
}

.status-dot--neutral {
  background: #989da2;
}

.signal-state[data-tone="success"] {
  border-color: #cbe8dd;
  background: var(--success-soft);
}

.signal-state[data-tone="warning"] {
  border-color: #f0dbb1;
  background: var(--warning-soft);
}

.signal-state[data-tone="danger"] {
  border-color: #f1c8c4;
  background: var(--danger-soft);
}

.signal-metadata {
  display: grid;
  margin: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}

.signal-metadata > div {
  min-width: 0;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.signal-metadata > div:nth-child(even) {
  border-right: 0;
}

.signal-metadata > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.signal-metadata dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.69rem;
}

.signal-metadata dd {
  margin: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-placeholder {
  display: flex;
  min-height: 104px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 13px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.signal-placeholder span {
  color: #a4a7aa;
  font-size: 1.2rem;
}

.updated-at {
  margin: auto 0 0;
  padding-top: 15px;
  color: #989b9e;
  font-size: 0.68rem;
}

.destinations-section {
  margin-top: 42px;
}

.section-heading {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: 1.55rem;
}

.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.heading-with-count {
  gap: 9px;
}

.count-badge {
  display: inline-grid;
  min-width: 25px;
  height: 25px;
  padding-inline: 7px;
  place-items: center;
  border-radius: 999px;
  background: #e4e3df;
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 800;
}

.destination-list {
  display: grid;
  gap: 10px;
}

.destination-card {
  display: grid;
  min-width: 0;
  align-items: center;
  gap: 20px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  grid-template-columns: minmax(220px, 1.35fr) minmax(140px, 0.75fr) auto auto;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.destination-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 5px 20px rgb(17 24 28 / 6%);
}

.destination-card[data-busy="true"] {
  opacity: 0.7;
  pointer-events: none;
}

.destination-card__identity,
.destination-card__actions,
.destination-card__toggle {
  display: flex;
  min-width: 0;
  align-items: center;
}

.destination-card__identity {
  gap: 12px;
}

.destination-avatar {
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
}

.destination-card__identity > div {
  min-width: 0;
}

.destination-card__identity h3 {
  margin-bottom: 4px;
  overflow: hidden;
  font-size: 0.96rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.destination-card__identity p {
  max-width: 340px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.destination-card__status {
  display: grid;
  justify-items: start;
  gap: 5px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 750;
  white-space: nowrap;
}

.destination-stat,
.destination-hint {
  color: var(--muted);
  font-size: 0.68rem;
}

.destination-hint {
  color: var(--danger);
}

.destination-card__actions {
  justify-content: flex-end;
  gap: 5px;
}

.destination-card__actions form {
  margin: 0;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch__track {
  position: relative;
  display: block;
  width: 36px;
  height: 21px;
  border-radius: 999px;
  background: #caccc9;
  transition: background 150ms ease;
}

.switch__track span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 18%);
  transition: transform 150ms ease;
}

.switch input:checked + .switch__track {
  background: var(--success);
}

.switch input:checked + .switch__track span {
  transform: translateX(15px);
}

.switch input:focus-visible + .switch__track {
  outline: 3px solid rgb(32 108 212 / 30%);
  outline-offset: 2px;
}

.switch__label {
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 650;
}

.empty-state {
  display: grid;
  min-height: 320px;
  padding: 42px 24px;
  place-items: center;
  align-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 52%);
  text-align: center;
}

.empty-state__art {
  position: relative;
  width: 82px;
  height: 58px;
  margin-bottom: 18px;
}

.empty-state__art span {
  position: absolute;
  top: 9px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.empty-state__art span:first-child { left: 0; transform: rotate(-9deg); }
.empty-state__art span:nth-child(2) { right: 0; transform: rotate(9deg); }
.empty-state__art span:last-child { top: 0; left: 21px; border-color: #efb7b2; background: var(--accent-soft); transform: none; }

.empty-state h3 {
  margin-bottom: 7px;
  font-size: 1.15rem;
}

.empty-state p {
  max-width: 410px;
  margin-bottom: 19px;
  color: var(--muted);
  font-size: 0.84rem;
}

.loading-state {
  display: flex;
  min-height: 100px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #d8d8d3;
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.inline-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 17px;
  border: 1px solid #efcac5;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: #862828;
}

.inline-alert > div {
  display: grid;
  gap: 2px;
}

.inline-alert strong {
  font-size: 0.84rem;
}

.inline-alert span,
.inline-alert--notice {
  font-size: 0.76rem;
}

.inline-alert--notice {
  margin-top: 14px;
  border-color: #efddb8;
  background: var(--warning-soft);
  color: #795018;
}

/* Modal */
.modal {
  width: min(530px, calc(100% - 28px));
  max-height: min(760px, calc(100vh - 28px));
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--ink);
}

.modal::backdrop {
  background: rgb(13 25 30 / 54%);
  backdrop-filter: blur(3px);
}

.modal[open] {
  animation: modal-in 170ms ease-out;
}

.modal__header,
.modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 23px;
}

.modal__header {
  border-bottom: 1px solid var(--line);
}

.modal__header .eyebrow {
  margin-bottom: 4px;
}

.modal__header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.modal__close {
  width: 38px;
  min-width: 38px;
  height: 38px;
}

.modal__body {
  display: grid;
  gap: 18px;
  padding: 23px;
}

.modal__footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
}

.check-row input {
  width: 17px;
  height: 17px;
  margin: 3px 0 0;
  accent-color: var(--success);
}

.check-row span {
  display: grid;
  gap: 2px;
}

.check-row strong {
  font-size: 0.82rem;
}

.check-row small {
  color: var(--muted);
  font-size: 0.72rem;
}

.modal--confirm {
  width: min(440px, calc(100% - 28px));
  padding: 30px 30px 24px;
  text-align: center;
}

.modal--confirm h2 {
  margin-bottom: 10px;
  font-size: 1.35rem;
}

.modal--confirm p {
  margin-bottom: 24px;
  color: var(--muted-strong);
  font-size: 0.84rem;
}

.modal--confirm .modal__footer {
  padding: 0;
  border: 0;
  background: transparent;
}

.modal__footer--centered {
  justify-content: center;
}

.confirm-icon {
  display: grid;
  width: 50px;
  height: 50px;
  margin: 0 auto 17px;
  place-items: center;
  border-radius: 15px;
  font-size: 1.25rem;
  font-weight: 850;
}

.confirm-icon--warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.confirm-icon--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Toasts */
.toast-region {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(370px, calc(100% - 40px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid #303f45;
  border-radius: 12px;
  background: var(--navy);
  box-shadow: 0 12px 30px rgb(13 25 30 / 24%);
  color: #fff;
  font-size: 0.82rem;
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast__icon {
  display: grid;
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #3e9d78;
  font-size: 0.72rem;
  font-weight: 850;
}

.toast--error .toast__icon {
  background: #cf4c47;
}

.toast--warning .toast__icon {
  background: #c9852d;
}

.toast__content {
  display: grid;
  flex: 1;
  gap: 2px;
}

.toast__content strong {
  font-size: 0.82rem;
}

.toast__content span {
  color: rgb(255 255 255 / 72%);
  font-size: 0.74rem;
}

.toast__close {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  background: transparent;
  color: rgb(255 255 255 / 65%);
  cursor: pointer;
}

.toast__close:hover {
  background: rgb(255 255 255 / 10%);
  color: #fff;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1060px) {
  .dashboard-grid--top {
    grid-template-columns: minmax(0, 1fr) minmax(315px, 0.82fr);
  }

  .destination-card {
    gap: 14px;
    grid-template-columns: minmax(205px, 1.1fr) minmax(125px, 0.7fr) auto;
  }

  .destination-card__toggle {
    display: none;
  }

  .switch__label {
    display: none;
  }
}

@media (max-width: 860px) {
  .login-layout {
    grid-template-columns: minmax(300px, 0.8fr) minmax(390px, 1.2fr);
  }

  .login-intro {
    padding: 35px;
  }

  .login-intro__copy h1 {
    font-size: 2.8rem;
  }

  .dashboard-grid--top {
    grid-template-columns: 1fr;
  }

  .signal-panel {
    min-height: 390px;
  }

  .destination-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .destination-card__status {
    justify-items: end;
  }

  .destination-card__toggle {
    display: flex;
  }

  .destination-card__actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 28px, 1180px);
  }

  .login-layout {
    display: block;
    min-height: 100vh;
  }

  .login-intro {
    min-height: auto;
    padding: 24px 24px 44px;
  }

  .login-intro::after {
    top: -65px;
    right: -115px;
    width: 240px;
    height: 240px;
    opacity: 0.65;
  }

  .login-intro::before,
  .login-signal {
    display: none;
  }

  .login-intro__copy {
    width: 100%;
    padding: 54px 0 0;
  }

  .login-intro__copy h1 {
    margin-bottom: 15px;
    font-size: clamp(2.2rem, 12vw, 3.2rem);
  }

  .login-intro__copy > p:last-child {
    font-size: 0.9rem;
  }

  .login-panel {
    display: block;
    min-height: auto;
    padding: 34px 24px 78px;
  }

  .login-card {
    margin-inline: auto;
  }

  .login-footer {
    right: 24px;
    bottom: 20px;
  }

  .site-header__inner {
    min-height: 62px;
  }

  .brand-copy {
    display: none;
  }

  .header-user {
    display: none;
  }

  .header-actions {
    gap: 7px;
  }

  .header-signal {
    border: 0;
    background: transparent;
  }

  .dashboard {
    padding-top: 28px;
  }

  .page-heading {
    align-items: flex-start;
    margin-bottom: 22px;
  }

  .page-heading h1 {
    font-size: 2rem;
  }

  .page-heading__lead {
    font-size: 0.86rem;
  }

  .page-heading > .button {
    display: none;
  }

  .panel {
    padding: 20px;
    border-radius: 18px;
  }

  .copy-field--secret {
    flex-wrap: wrap;
  }

  .copy-field--secret input {
    flex-basis: calc(100% - 47px);
  }

  .copy-field--secret .text-icon-button {
    order: 3;
    width: 100%;
  }

  .connection-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .signal-metadata {
    grid-template-columns: 1fr;
  }

  .signal-metadata > div,
  .signal-metadata > div:nth-child(even),
  .signal-metadata > div:nth-last-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .signal-metadata > div:last-child {
    border-bottom: 0;
  }

  .destinations-section {
    margin-top: 34px;
  }

  .section-heading {
    align-items: flex-end;
  }

  .section-heading > div > p {
    display: none;
  }

  .section-add-button {
    min-height: 38px;
    padding: 7px 10px;
    font-size: 0.76rem;
  }

  .destination-card {
    padding: 15px;
    gap: 14px 10px;
  }

  .destination-card__status {
    justify-items: end;
  }

  .destination-card__status .destination-stat {
    display: none;
  }

  .destination-card__toggle {
    display: none;
  }

  .destination-card__actions {
    overflow-x: auto;
    padding-bottom: 1px;
  }

  .destination-card__actions .button {
    white-space: nowrap;
  }

  .modal__header,
  .modal__body,
  .modal__footer {
    padding-inline: 18px;
  }

  .modal__footer {
    gap: 8px;
  }

  .modal__footer .button {
    flex: 1;
  }

  .toast-region {
    right: 14px;
    bottom: 14px;
    width: calc(100% - 28px);
  }
}

@media (max-width: 420px) {
  .header-signal span:last-child {
    display: none;
  }

  .destination-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .destination-card__status {
    justify-items: start;
  }

  .destination-card__actions {
    grid-column: 1;
  }

  .modal--confirm {
    padding: 25px 20px 20px;
  }
}

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