:root {
  --bg: #07101d;
  --surface: #0c1726;
  --surface-2: #101e30;
  --line: rgba(151, 172, 199, .14);
  --text: #edf4fc;
  --muted: #8090a5;
  --teal: #36d6b0;
  --blue: #668cff;
  --red: #ff667f;
  --amber: #f5bd59;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 55% 10%, #10233a 0, transparent 32%), var(--bg); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.hidden { display: none !important; }
.ambient { position: fixed; border-radius: 50%; filter: blur(100px); opacity: .13; pointer-events: none; }
.ambient-one { width: 500px; height: 500px; background: var(--blue); right: -220px; top: -220px; }
.ambient-two { width: 420px; height: 420px; background: var(--teal); left: -250px; bottom: -250px; }
.eyebrow { margin: 0 0 10px; color: var(--teal); font-size: 11px; font-weight: 750; letter-spacing: .19em; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, .9fr) minmax(500px, 1.1fr); }
.auth-brand { display: flex; flex-direction: column; justify-content: center; padding: clamp(48px, 8vw, 130px); border-right: 1px solid var(--line); position: relative; overflow: hidden; }
.auth-brand::before { content: ""; position: absolute; width: 400px; height: 400px; border: 1px solid var(--line); border-radius: 50%; right: -260px; top: 20%; box-shadow: 0 0 0 70px rgba(255,255,255,.018), 0 0 0 140px rgba(255,255,255,.01); }
.brand-mark { width: 46px; height: 38px; display: flex; align-items: end; gap: 5px; margin-bottom: 50px; transform: skewY(-12deg); }
.brand-mark span { width: 9px; border-radius: 3px; background: linear-gradient(180deg, #76f2d2, #1d9c82); box-shadow: 0 0 24px rgba(54,214,176,.25); }
.brand-mark span:nth-child(1) { height: 18px; }
.brand-mark span:nth-child(2) { height: 30px; }
.brand-mark span:nth-child(3) { height: 38px; }
.auth-brand h1 { margin: 0; font-size: clamp(54px, 6vw, 92px); font-weight: 580; line-height: .9; letter-spacing: -.06em; }
.brand-copy { max-width: 420px; margin: 32px 0 48px; color: #98a8ba; font-size: 17px; line-height: 1.7; }
.link-preview { display: flex; gap: 28px; }
.link-preview div { display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 9px; }
.link-preview small { grid-column: 2; color: var(--muted); }
.pulse { width: 8px; height: 8px; border-radius: 50%; grid-row: 1 / 3; }
.pulse.online { background: var(--teal); box-shadow: 0 0 0 5px rgba(54,214,176,.08), 0 0 15px var(--teal); }
.pulse.standby { background: var(--blue); box-shadow: 0 0 0 5px rgba(102,140,255,.08); }
.auth-panel { display: grid; place-items: center; padding: 40px; }
.auth-card { width: min(100%, 570px); }
.auth-tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 34px; padding: 5px; border: 1px solid var(--line); background: rgba(7,16,29,.65); border-radius: 14px; }
.tab { border: 0; background: transparent; color: var(--muted); border-radius: 10px; padding: 11px 8px; cursor: pointer; font-size: 13px; }
.tab.active { background: var(--surface-2); color: var(--text); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.auth-form { padding: 36px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(150deg, rgba(17,31,49,.91), rgba(9,19,32,.92)); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.auth-form header { margin-bottom: 30px; }
.auth-form h2, .settings-card h3 { margin: 0 0 9px; font-size: 28px; letter-spacing: -.025em; }
.auth-form header > p:last-child, .settings-card > p { color: var(--muted); line-height: 1.55; }
label { display: grid; gap: 9px; margin-bottom: 18px; color: #bdcad8; font-size: 13px; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: rgba(5,12,22,.58); color: var(--text); padding: 13px 14px; border-radius: 10px; transition: border-color .2s, background .2s; }
input:hover, input:focus, select:hover, select:focus, textarea:hover, textarea:focus { border-color: rgba(54,214,176,.55); background: rgba(5,12,22,.82); }
textarea { resize: vertical; font: 11px ui-monospace, monospace; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.primary-button, .secondary-button, .danger-button, .icon-button, .menu-button { border: 0; cursor: pointer; transition: transform .15s, opacity .15s, background .15s; }
.primary-button { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding: 14px 17px; border-radius: 11px; background: var(--teal); color: #031811; font-weight: 780; }
.primary-button:hover { transform: translateY(-1px); background: #48e7c0; }
button:disabled { cursor: not-allowed; opacity: .45; }
.form-message { min-height: 21px; margin: 14px 4px 0; color: var(--muted); font-size: 13px; }
.form-message.error { color: #ff8c9f; }
.form-message.success { color: var(--teal); }
.notice { padding: 13px 15px; margin-bottom: 16px; border-radius: 10px; font-size: 13px; }
.notice.warning { color: #ffd889; background: rgba(245,189,89,.09); border: 1px solid rgba(245,189,89,.25); }
code { color: #a9bfff; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px 20px; border-right: 1px solid var(--line); background: rgba(6,14,25,.88); backdrop-filter: blur(20px); z-index: 10; }
.sidebar-brand { display: flex; align-items: center; gap: 13px; padding: 0 10px 34px; }
.brand-mark.small { width: 28px; height: 25px; margin: 0; gap: 3px; }
.brand-mark.small span { width: 5px; }
.brand-mark.small span:nth-child(1) { height: 11px; }
.brand-mark.small span:nth-child(2) { height: 18px; }
.brand-mark.small span:nth-child(3) { height: 24px; }
.sidebar-brand div:last-child { display: flex; flex-direction: column; line-height: 1.05; }
.sidebar-brand small { color: var(--muted); }
.sidebar nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item { display: grid; grid-template-columns: 25px 1fr; gap: 8px; align-items: center; text-align: left; border: 0; background: transparent; padding: 12px 13px; color: #91a1b5; border-radius: 10px; cursor: pointer; }
.nav-item span { font-size: 18px; text-align: center; }
.nav-item:hover:not(:disabled) { color: var(--text); background: rgba(255,255,255,.035); }
.nav-item.active { color: var(--teal); background: rgba(54,214,176,.085); }
.nav-item.muted { opacity: .42; }
.nav-divider { padding: 25px 13px 7px; font-size: 9px; letter-spacing: .18em; color: #526176; }
.sidebar-footer { margin-top: auto; display: grid; grid-template-columns: 36px 1fr 32px; align-items: center; gap: 10px; padding: 17px 8px 0; border-top: 1px solid var(--line); }
.user-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(135deg, #244b55, #172c44); color: var(--teal); font-size: 12px; font-weight: 800; }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-meta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.user-meta small { color: var(--muted); font-size: 10px; }
.icon-button, .menu-button { border-radius: 8px; background: transparent; color: var(--muted); padding: 7px; }
.icon-button:hover { background: rgba(255,255,255,.05); color: var(--text); }
.content { min-width: 0; padding: 0 clamp(24px, 4vw, 68px) 70px; }
.topbar { height: 112px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); margin-bottom: 44px; }
.topbar h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.topbar .eyebrow { margin-bottom: 4px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.last-update { color: var(--muted); font-size: 12px; }
.secondary-button { padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); color: #b9c7d7; font-size: 12px; }
.secondary-button:hover { border-color: rgba(54,214,176,.4); color: var(--teal); }
.menu-button { display: none; font-size: 21px; }
.view { display: none; }
.view.active-view { display: block; animation: appear .3s ease both; }
@keyframes appear { from { opacity: 0; transform: translateY(7px); } }
.hero-row { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 34px; }
.hero-row h2 { margin: 0; font-size: clamp(34px, 4.2vw, 58px); line-height: 1.04; letter-spacing: -.05em; font-weight: 540; }
.hero-row h2 em { color: #7f92aa; font-style: normal; }
.health-pill { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; }
.health-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.health-pill.online { color: var(--teal); border-color: rgba(54,214,176,.22); background: rgba(54,214,176,.05); }
.health-pill.online span { background: var(--teal); box-shadow: 0 0 10px var(--teal); }
.health-pill.degraded { color: var(--amber); }
.health-pill.degraded span { background: var(--amber); }
.health-pill.offline { color: var(--red); }
.health-pill.offline span { background: var(--red); }
.link-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 44px; }
.link-card { position: relative; overflow: hidden; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(16,31,49,.9), rgba(9,18,31,.92)); }
.link-card::after { content: ""; position: absolute; width: 170px; height: 170px; border-radius: 50%; right: -90px; top: -100px; background: var(--muted); opacity: .04; filter: blur(5px); }
.link-card.online { border-color: rgba(54,214,176,.18); }
.link-card.online::after { background: var(--teal); opacity: .1; }
.link-card.offline { border-color: rgba(255,102,127,.25); }
.link-card-head { display: flex; justify-content: space-between; align-items: start; }
.link-card h3 { margin: 4px 0 0; font-size: 19px; }
.interface-name { margin: 0; color: var(--muted); font: 11px ui-monospace, monospace; text-transform: uppercase; letter-spacing: .14em; }
.status-badge { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.status-badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.online .status-badge { color: var(--teal); }
.offline .status-badge { color: var(--red); }
.speed-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 29px 0 24px; }
.speed-row div + div { border-left: 1px solid var(--line); padding-left: 22px; }
.speed-row small { display: block; color: #64748a; font-size: 9px; letter-spacing: .14em; margin-bottom: 7px; }
.speed-row strong { font-size: clamp(19px, 2vw, 27px); font-weight: 580; letter-spacing: -.035em; }
.link-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; padding-top: 17px; border-top: 1px solid var(--line); }
.link-metrics span { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 10px; }
.link-metrics b { color: #c5d1df; font-size: 11px; font-weight: 600; }
.section-heading, .panel-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 18px; }
.section-heading h3, .panel-heading h3 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.module-card { min-height: 108px; display: grid; grid-template-columns: 42px 1fr auto; gap: 13px; align-items: center; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: rgba(11,22,37,.68); color: var(--text); text-align: left; }
button.module-card { cursor: pointer; }
.module-card.featured:hover { border-color: rgba(54,214,176,.35); transform: translateY(-2px); }
.module-card.disabled { opacity: .46; }
.module-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: rgba(102,140,255,.08); color: var(--blue); font-size: 21px; }
.featured .module-icon { color: var(--teal); background: rgba(54,214,176,.08); }
.module-card div { display: flex; flex-direction: column; gap: 4px; }
.module-card small, .module-card > span:last-child { color: var(--muted); font-size: 10px; }
.chart-panel, .table-panel, .settings-card { padding: 24px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(10,21,35,.75); }
.chart-legend { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.rx-dot, .tx-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.rx-dot { background: var(--teal); }
.tx-dot { background: var(--blue); margin-left: 8px; }
.charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.charts-grid article + article { border-left: 1px solid var(--line); padding-left: 28px; }
.charts-grid h4 { margin: 0 0 10px; color: #b8c6d7; font: 12px ui-monospace, monospace; }
canvas { width: 100%; display: block; }
.empty-state { color: var(--muted); text-align: center; padding: 28px; font-size: 12px; }
.incident-row, .destination-row { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 13px; padding: 14px 3px; border-top: 1px solid var(--line); }
.incident-row:first-child, .destination-row:first-child { border-top: 0; }
.incident-state { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.incident-state.online { background: var(--teal); }
.incident-state.offline { background: var(--red); }
.incident-row div, .destination-row div { display: flex; flex-direction: column; gap: 3px; }
.incident-row small, .destination-row small, .incident-row time { color: var(--muted); font-size: 10px; }
.incident-row time { white-space: nowrap; }
.settings-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); gap: 20px; }
.settings-card { height: fit-content; }
.destination-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: rgba(54,214,176,.08); color: var(--teal); }
.danger-button { padding: 7px 10px; border-radius: 8px; background: rgba(255,102,127,.08); color: #ff8ca0; font-size: 10px; }
.role-badge { padding: 6px 9px; border-radius: 999px; color: #a9bfff; background: rgba(102,140,255,.08); font-size: 9px; }
.invitation-result { margin-top: 20px; padding: 15px; border: 1px solid rgba(245,189,89,.2); background: rgba(245,189,89,.045); border-radius: 12px; }
.invitation-result p { margin: 0; color: #c9aa6e; font-size: 10px; line-height: 1.5; }

@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { min-height: 390px; border-right: 0; border-bottom: 1px solid var(--line); padding: 55px 9vw; }
  .auth-brand h1 { font-size: 58px; }
  .brand-mark { margin-bottom: 30px; }
  .brand-copy { margin: 20px 0 28px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -280px; width: 260px; transition: left .25s; box-shadow: 25px 0 70px rgba(0,0,0,.4); }
  .sidebar.open { left: 0; }
  .menu-button { display: block; }
  .topbar { justify-content: flex-start; gap: 18px; }
  .topbar-actions { margin-left: auto; }
  .module-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .auth-panel { padding: 24px 16px 50px; }
  .auth-tabs { grid-template-columns: 1fr; }
  .auth-form { padding: 25px 20px; }
  .form-grid, .link-grid, .charts-grid, .settings-layout { grid-template-columns: 1fr; }
  .content { padding: 0 16px 45px; }
  .topbar { height: 88px; margin-bottom: 30px; }
  .topbar .eyebrow, .last-update { display: none; }
  .hero-row { align-items: start; flex-direction: column; }
  .hero-row h2 { font-size: 38px; }
  .charts-grid article + article { border-left: 0; border-top: 1px solid var(--line); padding: 22px 0 0; }
  .link-metrics { grid-template-columns: 1fr 1fr; }
  .speed-row strong { font-size: 19px; }
  .incident-row { grid-template-columns: 16px 1fr; }
  .incident-row time { grid-column: 2; }
}

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