:root {
  --bg: #071017;
  --panel: #101d28;
  --panel2: #122535;
  --line: #263b4d;
  --text: #eef8ff;
  --muted: #95aabc;
  --blue: #35a8ff;
  --cyan: #36d8e8;
  --green: #27d889;
  --amber: #f5aa36;
  --red: #ff5f71;
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at 20% -10%, rgba(53,168,255,.16), transparent 28rem), var(--bg);
}

button, input { font: inherit; }
button { cursor: pointer; border: 0; color: inherit; background: none; }
.app { min-height: 100vh; display: grid; grid-template-columns: 264px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 14px; background: #08131b; border-right: 1px solid rgba(148,184,205,.15); display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px; }
.brand > span { width: 42px; height: 42px; border: 2px solid var(--blue); color: var(--blue); border-radius: 50%; display: grid; place-items: center; font-weight: 800; }
.brand strong { display: block; font-size: 22px; }
.brand small { color: #62baff; letter-spacing: .25em; font-weight: 800; font-size: 11px; }
nav { display: grid; gap: 5px; }
nav button { text-align: left; min-height: 46px; padding: 0 14px; border-radius: 7px; color: #c5d7e4; }
nav button.active, nav button:hover { background: rgba(53,168,255,.13); color: white; }
.platform { margin-top: auto; border-top: 1px solid rgba(148,184,205,.15); padding: 18px 10px; color: var(--muted); display: grid; gap: 8px; font-size: 13px; }
.platform p { margin: 0; }
.platform span, .status span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--green); box-shadow: 0 0 14px var(--green); }
main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 42px 280px minmax(260px, 1fr) auto 190px; gap: 16px; align-items: center; min-height: 72px; padding: 0 18px; background: rgba(7,16,23,.86); backdrop-filter: blur(16px); border-bottom: 1px solid rgba(148,184,205,.15); }
.ghost { min-height: 38px; border-radius: 7px; padding: 0 12px; border: 1px solid var(--line); background: rgba(16,29,40,.55); }
.status { color: #d5e5f0; white-space: nowrap; }
input { height: 44px; min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: #08131b; color: var(--text); padding: 0 16px; outline: 0; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(53,168,255,.12); }
.admin { line-height: 1.2; font-weight: 700; }
.admin small { color: var(--muted); font-weight: 500; }
.content { padding: 18px; display: grid; gap: 14px; }
.metrics { display: grid; grid-template-columns: repeat(6, minmax(145px, 1fr)); gap: 10px; }
.card, .panel { background: linear-gradient(180deg, rgba(18,33,46,.95), rgba(11,22,31,.96)); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.card { min-height: 118px; padding: 18px; }
.card small { color: #bdd0de; text-transform: uppercase; letter-spacing: .07em; font-weight: 800; }
.card strong { display: block; font-size: 30px; margin-top: 8px; }
.card span { color: var(--muted); font-size: 13px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 410px; gap: 14px; align-items: start; }
.panel-head { min-height: 56px; padding: 0 18px; border-bottom: 1px solid rgba(148,184,205,.15); display: flex; justify-content: space-between; align-items: center; gap: 14px; }
h2 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; }
.segmented { display: flex; gap: 6px; flex-wrap: wrap; }
.segmented button { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); color: #b7ccdc; }
.segmented button.active { color: white; border-color: var(--blue); background: rgba(53,168,255,.14); }
.map-body { display: grid; grid-template-columns: minmax(0, 1fr) 255px; }
.world { min-height: 295px; margin: 18px; position: relative; overflow: hidden; border-radius: 7px; background: radial-gradient(circle at 53% 45%, rgba(39,216,137,.22), transparent 10rem), linear-gradient(135deg, #132b3a, #08121a); }
.world:before { content: ""; position: absolute; inset: 42px 30px; opacity: .24; background: linear-gradient(25deg, transparent 38%, #d5efff 39% 47%, transparent 48%), linear-gradient(150deg, transparent 43%, #d5efff 44% 52%, transparent 53%); border-radius: 50%; filter: blur(1px); }
.route { position: absolute; border-top: 1px dashed; transform-origin: left center; opacity: .8; }
.r1 { left: 26%; top: 52%; width: 330px; transform: rotate(-17deg); border-color: var(--blue); }
.r2 { left: 28%; top: 54%; width: 310px; transform: rotate(19deg); border-color: var(--green); }
.r3 { left: 25%; top: 58%; width: 230px; transform: rotate(-44deg); border-color: var(--amber); }
.node { position: absolute; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: #123140; border: 1px solid rgba(255,255,255,.25); box-shadow: 0 0 30px rgba(54,216,232,.35); }
.us { left: 18%; top: 45%; } .br { left: 32%; top: 62%; box-shadow: 0 0 30px rgba(245,170,54,.45); } .eu { left: 50%; top: 37%; box-shadow: 0 0 30px rgba(39,216,137,.45); } .as { left: 75%; top: 48%; } .au { left: 86%; top: 75%; box-shadow: 0 0 30px rgba(39,216,137,.45); }
.health { border-left: 1px solid rgba(148,184,205,.15); padding: 18px; display: grid; gap: 16px; align-content: start; }
.health h3 { margin: 0; font-size: 14px; text-transform: uppercase; }
.bar { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.bar i { grid-column: 1/-1; height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--cyan) var(--w), #233746 var(--w)); }
.donut { width: 86px; height: 86px; border-radius: 50%; background: conic-gradient(var(--green) 43%, var(--blue) 43% 78%, var(--amber) 78% 92%, var(--red) 92%); box-shadow: inset 0 0 0 22px #101d28; }
.audit { max-height: 606px; overflow: hidden; }
.audit-item { display: grid; gap: 5px; padding: 17px 18px; border-bottom: 1px solid rgba(148,184,205,.15); }
.audit-item strong { color: white; }
.audit-item span { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 920px; }
th, td { padding: 13px 18px; border-bottom: 1px solid rgba(148,184,205,.15); text-align: left; white-space: nowrap; font-size: 13px; }
th { color: #adc1d0; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
tbody tr:hover { background: rgba(53,168,255,.08); }
.pill { display: inline-flex; align-items: center; gap: 7px; }
.pill:before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 12px var(--c); }
.connect { min-height: 32px; border: 1px solid #38566d; border-radius: 6px; padding: 0 12px; background: rgba(8,19,27,.75); }
.drawer { position: fixed; right: 18px; top: 90px; width: min(420px, calc(100vw - 36px)); max-height: calc(100vh - 108px); overflow: auto; transform: translateX(calc(100% + 28px)); transition: transform .2s ease; z-index: 20; background: #101d28; border: 1px solid var(--line); border-radius: 8px; padding: 20px; box-shadow: 0 30px 90px rgba(0,0,0,.45); }
.drawer.open { transform: translateX(0); }
.close { position: absolute; right: 14px; top: 10px; font-size: 28px; color: var(--muted); }
.details { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.detail { border: 1px solid rgba(148,184,205,.15); border-radius: 7px; padding: 12px; }
.detail small { display: block; color: var(--muted); margin-bottom: 4px; }
.primary { min-height: 42px; width: 100%; border-radius: 7px; margin-bottom: 10px; font-weight: 800; color: #021016; background: linear-gradient(135deg, var(--blue), var(--green)); }
.drawer button:not(.close):not(.primary) { min-height: 38px; border: 1px solid var(--line); border-radius: 7px; padding: 0 12px; margin-right: 8px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 80px); opacity: 0; transition: .2s; background: #112432; border: 1px solid rgba(53,168,255,.55); padding: 12px 16px; border-radius: 7px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1180px) {
  .app { grid-template-columns: 86px 1fr; }
  .brand div, nav span, .platform { display: none; }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { display: block; }
  .sidebar { position: fixed; z-index: 30; width: 264px; transform: translateX(-100%); transition: .2s; }
  body.menu-open .sidebar { transform: translateX(0); }
  .brand div, .platform { display: block; }
  .topbar { grid-template-columns: 42px minmax(0,1fr); }
  .status, .admin, #refresh { display: none; }
  .content { padding: 12px; }
  .metrics { grid-template-columns: 1fr; }
  .map-body { grid-template-columns: 1fr; }
  .health { border-left: 0; border-top: 1px solid rgba(148,184,205,.15); }
}
