:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0d0819;
  color: #faf9ff;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #0d0819; }
button, input, select { font: inherit; }
button, select, input[type="checkbox"] { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
[hidden] { display: none !important; }

.login-view {
  min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden;
  padding: 24px; background: radial-gradient(circle at 50% -20%, #3f247c 0, #170d31 43%, #0b0715 100%);
}
.login-glow { position: absolute; width: 340px; height: 340px; border-radius: 50%; filter: blur(85px); opacity: .24; }
.login-glow-one { background: #5c6cff; top: -140px; right: -90px; }
.login-glow-two { background: #e7b640; bottom: -200px; left: -100px; }
.login-panel {
  width: min(430px, 100%); position: relative; padding: 36px; border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px; background: rgba(20,12,43,.92); box-shadow: 0 32px 90px rgba(0,0,0,.45);
}
.brand-lockup { display: flex; align-items: center; gap: 11px; letter-spacing: .06em; }
.brand-lockup strong, .brand-lockup small { display: block; }
.brand-lockup strong { font-size: 13px; font-weight: 700; }
.brand-lockup small { margin-top: 1px; color: #f5c451; font-size: 10px; letter-spacing: .22em; }
.brand-lockup-login { margin-bottom: 32px; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  color: #1b1233; background: linear-gradient(135deg,#f5c451,#fff2a9); font-weight: 800; box-shadow: 0 9px 26px rgba(245,196,81,.15);
}
.login-panel h1 { margin: 0; font-size: clamp(28px, 4vw, 38px); letter-spacing: -.04em; }
.muted { margin: 8px 0 28px; color: #aea6c3; }
.login-panel label, .form-stack label, .form-grid label { display: grid; gap: 8px; color: #c9c3d8; font-size: 12px; }
.login-panel label + label { margin-top: 16px; }
input, select {
  min-height: 44px; width: 100%; padding: 0 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 10px;
  outline: none; color: #fff; background: #1c1238;
}
input:focus, select:focus { border-color: #6882ff; box-shadow: 0 0 0 3px rgba(80,104,255,.18); }
.form-error { min-height: 19px; margin: 12px 0; color: #ff8fa7; font-size: 12px; }

.primary-button, .secondary-button, .ghost-button, .small-button, .icon-button {
  min-height: 40px; border-radius: 10px; border: 0; padding: 0 16px; font-weight: 650; transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
.primary-button { color: #fff; background: linear-gradient(135deg,#496dff,#7d3fe4); box-shadow: 0 10px 28px rgba(79,91,236,.26); }
.primary-button.is-live { background: linear-gradient(135deg,#ed4d70,#b81f4b); box-shadow: 0 10px 28px rgba(214,43,89,.22); }
.secondary-button { color: #fff; background: #33245e; border: 1px solid rgba(127,111,208,.42); }
.ghost-button { color: #c6bfd7; background: transparent; border: 1px solid rgba(255,255,255,.12); }
.small-button { min-height: 32px; padding: 0 10px; color: #ddd8eb; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); font-size: 11px; }
.icon-button { width: 38px; padding: 0; color: #bdb6d0; background: transparent; font-size: 24px; }
.primary-button:hover:not(:disabled), .secondary-button:hover:not(:disabled), .ghost-button:hover:not(:disabled), .small-button:hover:not(:disabled) { transform: translateY(-1px); }
.full-button { width: 100%; }
.danger-link { border: 0; padding: 8px; color: #ff90a8; background: transparent; font-size: 12px; }

.app-shell { min-height: 100vh; background: radial-gradient(circle at 60% -15%, #312069 0,#130c2a 36%,#0c0918 75%); }
.topbar {
  height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 20;
  padding: 0 22px; border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(11,7,24,.88); backdrop-filter: blur(18px);
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.status-label { display: inline-flex; align-items: center; gap: 8px; margin-right: 4px; color: #bdb6cf; font-size: 12px; }
.status-label i { width: 8px; height: 8px; border-radius: 50%; background: #8d849f; }
.status-label.online i { background: #35d894; box-shadow: 0 0 0 5px rgba(53,216,148,.12); }
.status-label.live i { background: #ff4e75; box-shadow: 0 0 0 5px rgba(255,78,117,.12); }
.workspace { display: grid; grid-template-columns: 210px minmax(0,1fr); }
.sidebar {
  min-height: calc(100vh - 70px); display: flex; flex-direction: column; position: sticky; top: 70px; align-self: start;
  padding: 25px 15px 18px; border-right: 1px solid rgba(255,255,255,.07); background: rgba(8,5,18,.5);
}
.nav-caption, .eyebrow { margin: 0 0 10px; color: #8f85ad; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 0 12px; border-radius: 11px; color: #afa7c1; text-decoration: none; font-size: 13px; }
.nav-item span { width: 18px; color: #77708c; text-align: center; }
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(79,91,236,.18); }
.nav-item.active span { color: #f5c451; }
.sidebar-footer { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 13px 10px; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar-footer strong, .sidebar-footer small { display: block; }
.sidebar-footer strong { font-size: 11px; }
.sidebar-footer small { margin-top: 3px; color: #80788e; font-size: 9px; }
.gold-dot { width: 8px; height: 8px; border-radius: 50%; background: #f5c451; box-shadow: 0 0 16px rgba(245,196,81,.6); }

.content { width: min(1320px,100%); padding: 30px 32px 60px; }
.notice { position: sticky; top: 82px; z-index: 10; margin-bottom: 14px; padding: 12px 14px; border-radius: 11px; color: #e8e4f1; background: #2f2351; border: 1px solid rgba(139,120,212,.4); font-size: 12px; }
.notice.error { color: #ffdce3; background: #4a1830; border-color: rgba(239,76,116,.4); }
.notice.success { color: #d8ffef; background: #153c34; border-color: rgba(53,216,148,.35); }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-heading h1 { margin: 0; font-size: clamp(25px,3vw,36px); letter-spacing: -.04em; }
.page-heading p:not(.eyebrow) { margin: 7px 0 0; color: #aaa2bd; font-size: 13px; }
.state-chip, .secure-chip, .info-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px; white-space: nowrap; font-size: 10px; font-weight: 700; letter-spacing: .03em; }
.state-chip { color: #c3bbd5; background: rgba(255,255,255,.07); }
.state-chip.live { color: #fff; background: rgba(229,55,99,.28); }
.secure-chip { color: #f5d47e; background: rgba(245,196,81,.1); border: 1px solid rgba(245,196,81,.2); }
.info-chip { color: #a9c8ff; background: rgba(66,113,255,.13); }

.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.metric-card, .panel { border: 1px solid rgba(255,255,255,.095); background: linear-gradient(145deg,rgba(255,255,255,.075),rgba(255,255,255,.038)); box-shadow: 0 18px 45px rgba(0,0,0,.13); }
.metric-card { min-height: 116px; padding: 17px; border-radius: 15px; }
.metric-card span, .metric-card small { display: block; }
.metric-card span { color: #9f96b3; font-size: 11px; }
.metric-card strong { display: block; margin: 9px 0 5px; font-size: 22px; letter-spacing: -.03em; }
.metric-card small { color: #73c9ff; font-size: 10px; }
.two-column-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(300px,.75fr); gap: 16px; margin-bottom: 16px; }
.panel { border-radius: 16px; overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 18px; border-bottom: 1px solid rgba(255,255,255,.075); }
.panel-heading h2 { margin: 0; font-size: 15px; }
.panel-heading p:not(.eyebrow) { margin: 6px 0 0; color: #968ea8; font-size: 11px; }
.panel-heading .eyebrow { margin-bottom: 5px; }
.credential-row { display: grid; grid-template-columns: 80px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid rgba(255,255,255,.06); }
.credential-row > span { color: #9d95b0; font-size: 11px; }
.credential-row code { min-width: 0; overflow: hidden; color: #ebe8f3; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-size: 11px; }
.panel-actions { display: flex; gap: 8px; padding: 15px 18px 0; }
.panel-help { margin: 14px 18px 17px; color: #8f879f; font-size: 10px; line-height: 1.55; }
.warning-text { color: #d4b768; }
.health-list { margin: 0; padding: 7px 18px 12px; }
.health-list div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 11px; }
.health-list div:last-child { border-bottom: 0; }
.health-list dt { color: #9c94aa; }
.health-list dd { margin: 0; color: #c9c4d5; }
.health-list dd.healthy { color: #58dda2; }
.health-list dd.unhealthy { color: #ff819c; }

.section-panel { margin-bottom: 16px; scroll-margin-top: 88px; }
.destination-list { display: grid; }
.destination-row { display: grid; grid-template-columns: minmax(180px,1.5fr) minmax(140px,.8fr) 100px 84px 116px; align-items: center; gap: 12px; min-height: 72px; padding: 10px 18px; border-bottom: 1px solid rgba(255,255,255,.065); }
.destination-row:last-child { border-bottom: 0; }
.platform-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.platform-icon { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 11px; color: #f7e19f; background: linear-gradient(145deg,rgba(80,104,255,.25),rgba(120,61,211,.22)); font-weight: 800; }
.platform-copy { min-width: 0; }
.platform-copy strong, .platform-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.platform-copy strong { font-size: 12px; text-transform: capitalize; }
.platform-copy span { margin-top: 4px; color: #888095; font-size: 10px; }
.destination-server { overflow: hidden; color: #aaa3b9; text-overflow: ellipsis; white-space: nowrap; font: 10px ui-monospace,SFMono-Regular,Menlo,monospace; }
.destination-status { color: #9d95aa; font-size: 10px; }
.destination-status.ready { color: #61dda5; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.empty-state { display: grid; place-items: center; gap: 7px; padding: 44px 20px; color: #877f95; text-align: center; }
.empty-state strong { color: #c8c1d6; font-size: 13px; }
.empty-state span { font-size: 10px; }

.toggle { display: inline-flex !important; grid-template-columns: auto auto auto !important; align-items: center; gap: 8px !important; position: relative; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span { width: 40px; height: 22px; position: relative; border-radius: 999px; background: #5c546f; transition: background .15s ease; }
.toggle span::after { content: ""; width: 16px; height: 16px; position: absolute; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.toggle input:checked + span { background: linear-gradient(90deg,#486cff,#8050e6); }
.toggle input:checked + span::after { transform: translateX(18px); }
.toggle b { color: #c5bed4; font-size: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; padding: 18px; }
.form-stack { display: grid; gap: 14px; padding: 18px; }
.settings-grid .secondary-button { margin: 0 18px 18px; }
.checkbox-line { display: flex !important; grid-template-columns: unset !important; align-items: center; gap: 9px !important; }
.checkbox-line input { width: 17px; min-height: 17px; accent-color: #5d72ff; }

.audit-list { display: grid; }
.audit-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; padding: 12px 18px; border-bottom: 1px solid rgba(255,255,255,.06); }
.audit-row:last-child { border-bottom: 0; }
.audit-row strong { display: block; color: #c8c2d3; font-size: 11px; }
.audit-row span { display: block; margin-top: 3px; color: #777083; font-size: 9px; }
.audit-row time { color: #91899f; font-size: 9px; }

dialog { width: min(540px,calc(100% - 28px)); padding: 0; border: 1px solid rgba(255,255,255,.15); border-radius: 18px; color: #fff; background: #170e32; box-shadow: 0 35px 100px rgba(0,0,0,.65); }
dialog::backdrop { background: rgba(4,2,10,.76); backdrop-filter: blur(5px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.dialog-heading h2 { margin: 0; font-size: 17px; }
.dialog-heading .eyebrow { margin-bottom: 5px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 0 18px 18px; }
#destination-error { margin: 0 18px 8px; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 78px minmax(0,1fr); }
  .sidebar { padding-inline: 10px; }
  .nav-caption, .nav-item:not(.active) { color: transparent; font-size: 0; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-item span { color: #8b829c; font-size: 15px; }
  .nav-item.active { color: transparent; font-size: 0; }
  .sidebar-footer div { display: none; }
  .sidebar-footer { justify-content: center; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .destination-row { grid-template-columns: minmax(150px,1fr) 95px 84px 112px; }
  .destination-server { display: none; }
}

@media (max-width: 720px) {
  .topbar { height: auto; min-height: 66px; padding: 12px 14px; }
  .brand-lockup strong { font-size: 11px; }
  .brand-lockup small { font-size: 8px; }
  .status-label, #logout-button { display: none; }
  .workspace { display: block; }
  .sidebar { display: none; }
  .content { padding: 22px 14px 44px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .two-column-grid { grid-template-columns: 1fr; }
  .destination-row { grid-template-columns: minmax(120px,1fr) 76px 110px; }
  .destination-status { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .login-panel { padding: 26px 20px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 100px; padding: 13px; }
  .metric-card strong { font-size: 17px; }
  .panel-heading { align-items: flex-start; }
  .destination-row { grid-template-columns: minmax(120px,1fr) auto; }
  .credential-row { grid-template-columns: 1fr auto; }
  .credential-row > span { grid-column: 1 / -1; }
  .panel-actions { flex-direction: column; }
}
