:root {
  --bg: #080d19;
  --surface: rgba(18, 25, 42, .78);
  --surface-strong: #121a2b;
  --line: rgba(255, 255, 255, .085);
  --muted: #8792a9;
  --text: #edf2ff;
  --accent: #8d7cff;
  --accent-2: #4fe1ba;
  --danger: #ff6f85;
  --warning: #f5bd65;
  --radius: 18px;
  --shadow: 0 28px 80px rgba(0, 0, 0, .28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 55% -15%, #1c2451 0, transparent 38%), var(--bg); }
button, input, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.ambient { position: fixed; border-radius: 50%; filter: blur(110px); opacity: .14; pointer-events: none; }
.ambient-one { width: 420px; height: 420px; background: #806dff; left: -180px; top: 30%; }
.ambient-two { width: 360px; height: 360px; background: #28cfa2; right: -180px; bottom: 5%; }

.brand-lockup { display: flex; align-items: center; gap: 14px; }
.brand-lockup.compact { gap: 11px; }
.brand-mark { width: 42px; height: 42px; display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 4px; padding: 9px; border-radius: 13px; background: linear-gradient(145deg, #9a8cff, #6957e8); box-shadow: 0 8px 30px rgba(125, 105, 255, .32); }
.brand-mark span { display: block; border-radius: 2px; background: white; }
.brand-mark span:nth-child(1) { height: 45%; opacity: .75; }
.brand-mark span:nth-child(2) { height: 100%; }
.brand-mark span:nth-child(3) { height: 70%; opacity: .86; }
.brand-name { font-size: 19px; font-weight: 760; letter-spacing: -.02em; }
.brand-caption { color: var(--muted); font-size: 12px; margin-top: 2px; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.auth-card { width: min(440px, 100%); border: 1px solid var(--line); border-radius: 24px; padding: 30px; background: rgba(12, 18, 31, .82); backdrop-filter: blur(22px); box-shadow: var(--shadow); }
.auth-card .brand-lockup { padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.auth-form h1 { margin: 6px 0 8px; font-size: 30px; letter-spacing: -.04em; }
.auth-form > p { margin: 0 0 24px; color: var(--muted); line-height: 1.55; }
label { display: grid; gap: 8px; margin: 15px 0; color: #b9c2d5; font-size: 13px; font-weight: 650; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; outline: none; color: var(--text); background: rgba(5, 9, 17, .6); transition: border-color .18s, box-shadow .18s; }
input:focus, select:focus { border-color: rgba(141, 124, 255, .72); box-shadow: 0 0 0 3px rgba(141, 124, 255, .13); }
select { cursor: pointer; }

.button { border: 1px solid transparent; border-radius: 10px; padding: 10px 15px; cursor: pointer; font-weight: 700; font-size: 13px; transition: transform .15s, background .15s, border-color .15s, opacity .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.primary { background: linear-gradient(135deg, #927fff, #7562ed); box-shadow: 0 7px 25px rgba(112, 91, 239, .22); }
.button.secondary { border-color: rgba(141, 124, 255, .25); background: rgba(141, 124, 255, .12); color: #d6d0ff; }
.button.ghost { border-color: var(--line); background: rgba(255, 255, 255, .025); color: #acb7ca; }
.button.danger { border-color: rgba(255, 111, 133, .2); background: rgba(255, 111, 133, .08); color: #ff9bab; }
.button.small { padding: 7px 10px; font-size: 12px; }
.button.wide { width: 100%; padding: 12px; margin-top: 8px; }
.form-error { border: 1px solid rgba(255, 111, 133, .22); border-radius: 10px; padding: 10px 12px; color: #ffa6b4; background: rgba(255, 111, 133, .08); font-size: 13px; margin-top: 14px; }
.form-hint { color: var(--muted); font-size: 12px; line-height: 1.5; }

.topbar { height: 68px; padding: 0 max(24px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(8, 13, 25, .72); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 20; }
.topbar .brand-mark { width: 34px; height: 34px; padding: 7px; border-radius: 10px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.user-chip { color: #b8c2d5; font-size: 13px; padding-right: 6px; }
.dashboard { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 70px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.hero h1 { margin: 7px 0 8px; font-size: clamp(34px, 5vw, 52px); line-height: 1; letter-spacing: -.055em; }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }
.eyebrow { text-transform: uppercase; letter-spacing: .15em; font-size: 10px; font-weight: 800; color: #9384f4; }
.live-pill { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 99px; padding: 9px 13px; background: rgba(255, 255, 255, .025); color: var(--muted); font-size: 12px; font-weight: 700; }
.live-pill .pulse { width: 8px; height: 8px; border-radius: 50%; background: #687287; }
.live-pill.live { color: #8ff0d3; border-color: rgba(79, 225, 186, .2); background: rgba(79, 225, 186, .07); }
.live-pill.live .pulse { background: var(--accent-2); box-shadow: 0 0 0 5px rgba(79, 225, 186, .1); animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(79, 225, 186, 0); } }

.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.metric-card, .panel { border: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(18px); box-shadow: 0 10px 42px rgba(0, 0, 0, .12); }
.metric-card { border-radius: 15px; padding: 17px; display: flex; align-items: center; gap: 14px; }
.metric-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 auto; font-size: 9px; font-weight: 900; letter-spacing: .06em; }
.source-icon { color: #9cf0d8; background: rgba(79, 225, 186, .1); }
.outputs-icon { color: #b8adff; background: rgba(141, 124, 255, .12); }
.health-icon { color: #88cfff; background: rgba(87, 177, 255, .1); }
.metric-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 750; }
.metric-value { margin-top: 2px; font-size: 18px; font-weight: 760; }
.metric-detail { color: #707b91; font-size: 11px; margin-top: 2px; }

.panel { border-radius: var(--radius); padding: 22px; margin-bottom: 14px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 19px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 20px; letter-spacing: -.025em; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.soft-badge { border-radius: 99px; padding: 6px 10px; color: #9aa5ba; background: rgba(255, 255, 255, .04); font-size: 11px; }
.credential-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.credential-field { position: relative; min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 12px 92px 12px 13px; background: rgba(4, 8, 16, .44); }
.credential-field > span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 750; margin-bottom: 5px; }
.credential-field code { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #dce4f4; font-size: 12px; }
.copy-button, .credential-field .button { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; color: #abb5c8; background: rgba(255, 255, 255, .04); cursor: pointer; font-size: 11px; font-weight: 700; }
.profile-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 13px; border-top: 1px solid var(--line); padding-top: 13px; color: #8f9ab0; font-size: 11px; }
.profile-strip .profile-title { color: #c6cede; font-weight: 750; }
.profile-strip i { width: 3px; height: 3px; background: #465067; border-radius: 50%; }

.destination-list { display: grid; gap: 10px; }
.destination-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(4, 8, 16, .36); }
.platform-dot { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(145deg, rgba(141, 124, 255, .2), rgba(79, 225, 186, .08)); color: #d9d4ff; font-size: 11px; font-weight: 850; }
.destination-main { min-width: 0; }
.destination-name { font-size: 14px; font-weight: 740; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.destination-meta { margin-top: 4px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 6px 9px; background: rgba(255, 255, 255, .04); color: #909bb0; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .045em; }
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge.sending { color: #65e2bd; background: rgba(79, 225, 186, .08); }
.status-badge.connecting, .status-badge.retrying { color: #f1bd70; background: rgba(245, 189, 101, .08); }
.status-badge.error { color: #ff8598; background: rgba(255, 111, 133, .08); }
.destination-actions { display: flex; gap: 5px; }
.empty-state { text-align: center; padding: 38px 20px 28px; color: var(--muted); }
.empty-state h3 { margin: 15px 0 5px; color: #d8dfec; font-size: 15px; }
.empty-state p { margin: 0; font-size: 12px; }
.empty-orbit { width: 48px; height: 48px; margin: auto; border: 1px solid rgba(141, 124, 255, .3); border-radius: 50%; display: grid; place-items: center; }
.empty-orbit span { width: 9px; height: 9px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 18px var(--accent); }

.lower-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 14px; }
.lower-grid .panel { margin: 0 0 14px; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 15px; }
.checklist li { display: flex; gap: 12px; }
.checklist li > span { width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; color: #9e90fa; font-size: 11px; font-weight: 800; }
.checklist strong { font-size: 13px; }
.checklist p { margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.activity-list { display: grid; gap: 0; max-height: 240px; overflow: auto; }
.activity-item { position: relative; padding: 0 0 14px 18px; border-left: 1px solid var(--line); margin-left: 4px; }
.activity-item::before { content: ''; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #68738b; left: -4px; top: 3px; }
.activity-item.warning::before { background: var(--warning); }
.activity-item .activity-message { color: #bac4d6; font-size: 12px; }
.activity-time { color: #606b81; font-size: 10px; margin-top: 3px; }

.user-list { display: grid; gap: 8px; }
.user-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; }
.user-row strong { font-size: 13px; }
.user-role { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
footer { display: flex; justify-content: space-between; color: #59647a; font-size: 10px; padding: 20px 3px 0; }

.modal { width: min(500px, calc(100% - 30px)); border: 1px solid var(--line); border-radius: 19px; padding: 22px; color: var(--text); background: #11192a; box-shadow: 0 34px 100px rgba(0, 0, 0, .55); }
.modal::backdrop { background: rgba(3, 6, 12, .72); backdrop-filter: blur(7px); }
.modal-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.modal-heading h2 { margin: 5px 0 0; font-size: 21px; }
.icon-button { border: 0; border-radius: 8px; width: 32px; height: 32px; background: rgba(255, 255, 255, .04); color: var(--muted); font-size: 21px; cursor: pointer; }
.info-note { border: 1px solid rgba(141, 124, 255, .15); border-radius: 10px; padding: 10px 11px; background: rgba(141, 124, 255, .06); color: #a9b2c6; font-size: 11px; line-height: 1.45; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.toggle-label { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; margin: 15px 0; }
.toggle-label input { position: absolute; opacity: 0; pointer-events: none; }
.toggle { width: 36px; height: 20px; border-radius: 99px; background: #343e53; position: relative; transition: background .18s; }
.toggle::after { content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%; top: 3px; left: 3px; background: white; transition: left .18s; }
.toggle-label input:checked + .toggle { background: var(--accent); }
.toggle-label input:checked + .toggle::after { left: 19px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 18px; }
.secret-modal > p { color: var(--muted); font-size: 13px; }
.secret-box { position: relative; border: 1px solid rgba(141, 124, 255, .25); border-radius: 12px; background: #080d19; padding: 15px 72px 15px 13px; overflow: hidden; }
.secret-box code { display: block; white-space: nowrap; overflow: auto; color: #dcd6ff; }
.secret-box .copy-button { right: 9px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; z-index: 100; border: 1px solid var(--line); border-radius: 11px; padding: 10px 14px; color: #dce4f2; background: #192236; box-shadow: var(--shadow); font-size: 12px; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 800px) {
  .status-grid { grid-template-columns: 1fr; }
  .credential-grid, .lower-grid { grid-template-columns: 1fr; }
  .hero { align-items: flex-start; flex-direction: column; }
  .destination-card { grid-template-columns: auto minmax(0, 1fr) auto; }
  .destination-actions { grid-column: 2 / -1; }
  .topbar { padding: 0 18px; }
  .dashboard { width: min(100% - 24px, 1180px); padding-top: 30px; }
}

@media (max-width: 520px) {
  .topbar .button { padding: 6px 8px; }
  .user-chip { display: none; }
  .panel { padding: 17px; }
  .panel-heading { flex-direction: column; align-items: stretch; }
  .panel-heading .button { align-self: flex-start; }
  .two-fields { grid-template-columns: 1fr; gap: 0; }
  .destination-card { grid-template-columns: auto minmax(0, 1fr); }
  .destination-card .status-badge { grid-column: 2; justify-self: start; }
  .credential-field { padding-right: 82px; }
  footer { flex-direction: column; gap: 5px; }
}
