:root {
  color-scheme: dark;
  --bg: #07110f;
  --panel: rgba(15, 30, 27, 0.78);
  --panel-strong: #10221e;
  --line: rgba(194, 232, 218, 0.13);
  --line-strong: rgba(194, 232, 218, 0.25);
  --text: #edf8f3;
  --muted: #8ca79d;
  --green: #70f0b4;
  --green-deep: #1baa78;
  --mint: #b9ffde;
  --amber: #f4c56a;
  --red: #ff7b7b;
  --blue: #78b9ff;
  --mono: "DM Mono", monospace;
  --sans: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--sans); overflow-x: hidden; }
button, select, input { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }

.ambient { position: fixed; width: 48rem; height: 48rem; border-radius: 50%; pointer-events: none; filter: blur(120px); opacity: .12; z-index: -1; }
.ambient-a { background: #38ecaa; left: -20rem; top: -22rem; }
.ambient-b { background: #2d90ff; right: -25rem; top: 25rem; }

.topbar { height: 72px; padding: 0 clamp(20px, 4vw, 64px); display: flex; align-items: center; border-bottom: 1px solid var(--line); background: rgba(7,17,15,.74); backdrop-filter: blur(20px); position: sticky; top: 0; z-index: 20; }
.brand { color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 13px; letter-spacing: .08em; }
.brand b { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--green); color: #04100c; font: 800 17px var(--sans); box-shadow: 0 0 30px rgba(112,240,180,.25); }
.topbar nav { display: flex; gap: 8px; margin-left: 54px; }
.topbar nav a { color: var(--muted); text-decoration: none; padding: 9px 13px; border-radius: 9px; font-size: 13px; }
.topbar nav a:hover, .topbar nav a.active { color: var(--text); background: rgba(255,255,255,.055); }
.control-state { margin-left: auto; color: var(--muted); font: 500 11px var(--mono); letter-spacing: .05em; }

.page { width: min(1440px, calc(100% - 48px)); margin: 0 auto; }
.hero { min-height: 440px; display: grid; grid-template-columns: 1.2fr .8fr; align-items: center; gap: 60px; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--green); font: 500 11px var(--mono); letter-spacing: .14em; margin: 0 0 14px; }
.hero h1 { font-size: clamp(42px, 5.5vw, 78px); line-height: 1.02; letter-spacing: -.055em; margin: 0; max-width: 820px; }
.hero h1 em { color: var(--mint); font-style: normal; font-weight: 500; }
.hero-copy { max-width: 690px; color: var(--muted); line-height: 1.75; font-size: 15px; margin-top: 24px; }
.hero-orbit { height: 340px; position: relative; display: grid; place-items: center; }
.orbit-ring { width: 285px; height: 285px; border: 1px solid rgba(112,240,180,.22); border-radius: 50%; position: absolute; animation: spin 28s linear infinite; }
.orbit-ring::after { content: ""; position: absolute; width: 8px; height: 8px; background: var(--green); border-radius: 50%; top: 36px; right: 38px; box-shadow: 0 0 18px var(--green); }
.orbit-ring.inner { width: 190px; height: 190px; border-style: dashed; animation-direction: reverse; animation-duration: 22s; }
.orbit-core { width: 112px; height: 112px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: radial-gradient(circle at 40% 30%, #235947, #0d211b 70%); border: 1px solid rgba(112,240,180,.4); box-shadow: 0 0 80px rgba(50,220,150,.12); }
.orbit-core b { font: 700 27px var(--mono); }.orbit-core span { color: var(--muted); font-size: 11px; margin-top: 4px; }
.satellite { position: absolute; padding: 7px 10px; border: 1px solid var(--line-strong); background: #0d211c; border-radius: 8px; color: var(--green); font: 500 10px var(--mono); box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.satellite.one { top: 52px; right: 24%; }.satellite.two { left: 10%; top: 56%; }.satellite.three { right: 8%; bottom: 18%; }.satellite.locked { color: var(--amber); }
@keyframes spin { to { transform: rotate(360deg); } }

.strip { min-height: 52px; border-bottom: 1px solid var(--line); display: flex; align-items: center; flex-wrap: wrap; gap: 24px; color: var(--muted); font: 500 11px var(--mono); }
.strip span { display: flex; align-items: center; gap: 7px; }.strip .updated { margin-left: auto; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #66756f; box-shadow: 0 0 0 3px rgba(102,117,111,.08); }
.dot.online { background: var(--green); box-shadow: 0 0 0 3px rgba(112,240,180,.1), 0 0 12px rgba(112,240,180,.45); }
.dot.offline { background: var(--red); }.dot.unknown { background: var(--amber); }

.section { padding: 72px 0 0; }
.section-head, .panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.section-head h2, .panel-head h2 { margin: 0; font-size: 28px; letter-spacing: -.035em; }
.section-note { color: var(--muted); font-size: 12px; margin: 0; }
.button { border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 15px; background: transparent; font-weight: 700; font-size: 12px; transition: .2s ease; }
.button:hover { transform: translateY(-1px); border-color: rgba(112,240,180,.5); }
.button.primary { background: var(--green); border-color: var(--green); color: #06120e; }
.button.ghost { color: var(--muted); }

.egress-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.egress-card { min-height: 145px; border: 1px solid var(--line); border-radius: 18px; padding: 22px; background: linear-gradient(145deg, rgba(17,38,33,.82), rgba(10,23,20,.78)); display: grid; grid-template-columns: auto 1fr auto; gap: 17px; align-items: center; position: relative; overflow: hidden; }
.egress-card::after { content: ""; position: absolute; inset: auto -25% -70% 25%; height: 120px; background: var(--green); filter: blur(65px); opacity: 0; transition: .4s; }
.egress-card.is-online::after { opacity: .08; }
.egress-icon { width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; background: rgba(112,240,180,.09); border: 1px solid rgba(112,240,180,.16); color: var(--green); font: 500 22px var(--mono); }
.card-kicker { color: var(--muted); font: 500 9px var(--mono); letter-spacing: .11em; display: flex; align-items: center; gap: 7px; }
.egress-copy h3 { margin: 8px 0 5px; font-size: 17px; }.egress-copy p { margin: 0; color: var(--muted); font-size: 11px; }
.latency { text-align: right; font-family: var(--mono); }.latency strong { font-size: 22px; }.latency span { display: block; color: var(--muted); font-size: 9px; margin-top: 3px; }

.device-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.device-card { border: 1px solid var(--line); border-radius: 18px; padding: 22px; background: var(--panel); min-width: 0; }
.device-card.protected { background: linear-gradient(145deg, rgba(44,37,20,.68), rgba(20,24,21,.78)); border-color: rgba(244,197,106,.18); }
.device-head { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; }
.device-avatar { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font: 700 15px var(--mono); background: rgba(255,255,255,.055); border: 1px solid var(--line); }
.device-head .eyebrow { margin-bottom: 3px; font-size: 8px; }.device-head h3 { margin: 0 0 4px; font-size: 16px; }.device-head div > span { color: var(--muted); font-size: 10px; display: flex; align-items: center; gap: 5px; }
.agent-badge, .protection-badge { padding: 6px 8px; border-radius: 7px; font: 500 8px var(--mono); letter-spacing: .06em; }
.agent-badge.ready { color: var(--green); background: rgba(112,240,180,.08); }.agent-badge.pending { color: var(--amber); background: rgba(244,197,106,.08); }.protection-badge { color: var(--amber); background: rgba(244,197,106,.08); }
.route-now { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; display: flex; justify-content: space-between; align-items: center; }.route-now span { color: var(--muted); font-size: 11px; }.route-now strong { font-size: 13px; }
.exit-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.exit-choice { min-height: 39px; padding: 7px 5px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 10px; }
.exit-choice.active { color: #07120e; background: var(--green); border-color: var(--green); font-weight: 800; }
.default-select { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 13px; color: var(--muted); font-size: 10px; }
select { min-width: 0; border: 1px solid var(--line); background: #0b1b17; border-radius: 8px; padding: 8px 26px 8px 9px; outline: none; font-size: 10px; }
select:focus, input:focus { border-color: rgba(112,240,180,.55); }
.device-note { color: var(--muted); font-size: 10px; line-height: 1.55; margin: 14px 0 0; }
.ioa-lock { margin-top: 20px; border: 1px solid rgba(244,197,106,.15); border-radius: 13px; padding: 18px; display: flex; align-items: flex-start; gap: 14px; background: rgba(244,197,106,.035); }.shield { color: var(--amber); font-size: 24px; }.ioa-lock strong { font-size: 13px; }.ioa-lock p { color: var(--muted); margin: 7px 0 0; font-size: 10px; line-height: 1.55; }

.head-actions { display: flex; align-items: center; gap: 8px; }.draft-state { color: var(--muted); font: 500 10px var(--mono); margin-right: 8px; }.draft-state.dirty { color: var(--amber); }
.policy-banner { border: 1px solid rgba(112,240,180,.15); border-radius: 12px; padding: 13px 16px; background: rgba(112,240,180,.035); display: flex; gap: 12px; align-items: center; font-size: 11px; }.policy-banner b { color: var(--green); }.policy-banner span { color: var(--muted); }
.rules-list { margin-top: 12px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: rgba(10,23,20,.65); }
.rule-row { min-height: 68px; display: grid; grid-template-columns: auto minmax(190px, 1fr) auto auto 150px auto; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); transition: opacity .2s; }.rule-row:last-child { border-bottom: 0; }.rule-row.disabled { opacity: .48; }
.toggle { width: 34px; height: 19px; padding: 2px; border: 0; border-radius: 99px; background: #33413c; }.toggle i { display: block; width: 15px; height: 15px; border-radius: 50%; background: #8da098; transition: .2s; }.toggle.on { background: var(--green-deep); }.toggle.on i { background: white; transform: translateX(15px); }
.rule-main { min-width: 0; }.rule-main strong { display: block; font-size: 12px; }.rule-main code { display: block; color: var(--muted); font: 400 10px var(--mono); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rule-devices { display: flex; gap: 4px; }.rule-devices span { padding: 4px 6px; border-radius: 5px; color: var(--blue); background: rgba(120,185,255,.08); font: 500 8px var(--mono); }.route-arrow { color: var(--muted); }
.rule-row select { width: 100%; }.delete-rule { width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); font-size: 18px; border-radius: 7px; }.delete-rule:hover { color: var(--red); background: rgba(255,123,123,.08); }
.empty-state { padding: 40px; color: var(--muted); text-align: center; font-size: 12px; }

.lower-grid { padding: 72px 0; display: grid; grid-template-columns: 1.35fr .65fr; gap: 14px; }.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); padding: 22px; }.panel-head { margin-bottom: 14px; }.panel-head h2 { font-size: 20px; }
.events { list-style: none; padding: 0; margin: 0; }.events li { display: grid; grid-template-columns: 54px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }.event-time { color: var(--green); font: 500 9px var(--mono); }.events strong { font-size: 11px; }.events p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.operations button { width: 100%; border: 0; border-top: 1px solid var(--line); background: transparent; display: flex; justify-content: space-between; padding: 15px 3px; color: var(--text); text-align: left; font-size: 11px; }.operations button:hover { color: var(--green); }.operations p { color: var(--muted); font-size: 9px; }
footer { border-top: 1px solid var(--line); min-height: 62px; padding: 0 max(24px, calc((100% - 1392px)/2)); display: flex; justify-content: space-between; align-items: center; color: var(--muted); font: 500 9px var(--mono); letter-spacing: .08em; }

dialog { width: min(520px, calc(100% - 32px)); border: 1px solid var(--line-strong); border-radius: 18px; padding: 24px; color: var(--text); background: #0d1e1a; box-shadow: 0 30px 100px rgba(0,0,0,.65); }
dialog::backdrop { background: rgba(2,8,6,.72); backdrop-filter: blur(8px); }.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }.dialog-head h2 { margin: 0; }.icon-button { border: 0; color: var(--muted); background: transparent; font-size: 24px; }
#rule-form > label, .form-row label { display: grid; gap: 7px; color: var(--muted); font-size: 10px; margin: 13px 0; }.form-row { display: grid; grid-template-columns: 1fr .5fr; gap: 10px; }.form-row label { margin: 0; }
input, dialog select { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #071511; color: var(--text); padding: 11px; outline: none; }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 16px 0; padding: 12px; display: flex; align-items: center; gap: 15px; }fieldset legend { color: var(--muted); font-size: 10px; }.check { font-size: 11px; }.locked-choice { color: var(--amber); font-size: 9px; margin-left: auto; }.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

#toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); padding: 11px 16px; border: 1px solid rgba(112,240,180,.25); background: #102b22; color: var(--mint); border-radius: 10px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; font-size: 11px; box-shadow: 0 18px 60px rgba(0,0,0,.45); }#toast.visible { opacity: 1; transform: translate(-50%, 0); }#toast.error { color: #ffd0d0; border-color: rgba(255,123,123,.3); background: #321b1b; }
.loading { min-height: 100vh; display: grid; place-content: center; text-align: center; color: var(--muted); }.loader { width: 36px; height: 36px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; margin: auto; animation: spin 1s linear infinite; }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr .65fr; }.device-grid { grid-template-columns: 1fr 1fr; }.device-card.protected { grid-column: span 2; }.egress-grid { grid-template-columns: 1fr; }.egress-card { min-height: 112px; }.rule-row { grid-template-columns: auto 1fr auto 130px auto; }.rule-devices { display: none; }
}
@media (max-width: 760px) {
  .page { width: min(100% - 28px, 620px); }.topbar { height: 62px; padding: 0 14px; }.topbar nav { display: none; }.control-state { font-size: 8px; }.brand span { display: none; }
  .hero { min-height: auto; grid-template-columns: 1fr; padding: 70px 0 30px; }.hero h1 { font-size: 43px; }.hero-orbit { height: 285px; }.strip { gap: 12px 18px; padding: 12px 0; }.strip .updated { width: 100%; margin-left: 0; }
  .section { padding-top: 55px; }.section-head { align-items: flex-start; flex-direction: column; }.head-actions { flex-wrap: wrap; }.draft-state { width: 100%; }
  .device-grid { grid-template-columns: 1fr; }.device-card.protected { grid-column: auto; }.device-head { grid-template-columns: auto 1fr; }.agent-badge, .protection-badge { grid-column: 2; justify-self: start; }
  .rule-row { grid-template-columns: auto 1fr auto; gap: 10px; }.rule-row select { grid-column: 2; width: 100%; }.route-arrow { display: none; }.delete-rule { grid-column: 3; grid-row: 1; }.lower-grid { grid-template-columns: 1fr; }.policy-banner { align-items: flex-start; flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }fieldset { align-items: flex-start; flex-direction: column; }.locked-choice { margin-left: 0; }
}
