/*FONTS*/
@font-face { font-family: 'Vazirmatn'; font-weight: 100 900; font-display: swap;
  src: local('Vazirmatn'), url('fonts/Vazirmatn.woff2') format('woff2'),
       url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn%5Bwght%5D.woff2') format('woff2'); }
/*/FONTS*/

:root {
  --abyss: #03050a;
  --ink: #e9eeff;
  --mute: #8791ad;
  --faint: #56607a;
  --ion: #4fe3ff;
  --plasma: #8f7bff;
  --ok: #3cf0a5;
  --bad: #ff5c7a;
  --warn: #ffc857;
  --line: rgba(170, 200, 255, .11);
  --line-2: rgba(170, 200, 255, .2);
  --glass: linear-gradient(180deg, rgba(150, 180, 255, .075), rgba(150, 180, 255, .025));
  --glass-solid: #0a0e18;
  --r-lg: 20px;
  --r-md: 13px;
  --r-sm: 9px;
  --ui: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--abyss); color: var(--ink);
  font: 14px/1.7 var(--ui); -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(79, 227, 255, .3); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(170, 200, 255, .14); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(170, 200, 255, .26); background-clip: padding-box; border: 2px solid transparent; }
:focus-visible { outline: 2px solid var(--ion); outline-offset: 2px; }

/* backdrop: two far-off light sources and a faint lattice, nothing moves */
.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 520px at 88% -8%, rgba(79, 227, 255, .13), transparent 62%),
    radial-gradient(760px 560px at 6% 108%, rgba(143, 123, 255, .15), transparent 60%),
    radial-gradient(500px 300px at 40% 40%, rgba(60, 240, 165, .035), transparent 70%),
    var(--abyss);
}
.sky::after { content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(170, 200, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(170, 200, 255, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 35%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 75% 65% at 50% 35%, #000 10%, transparent 75%);
}

.glass {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-lg);
  -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 24px 60px -30px rgba(0, 0, 0, .9);
}

/* ───── shell ───── */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 18px; height: 100vh; padding: 18px; }
.side { display: flex; flex-direction: column; padding: 18px 12px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; font-weight: 700; font-size: 15px; }
.brand i { width: 30px; height: 30px; border-radius: 10px; flex: none; position: relative;
  background: conic-gradient(from 210deg, var(--ion), var(--plasma), var(--ion)); box-shadow: 0 0 22px rgba(79, 227, 255, .45); }
.brand i::after { content: ''; position: absolute; inset: 2px; border-radius: 8px; background: #060914;
  background-image: radial-gradient(circle at 50% 50%, var(--ion) 0 2.5px, transparent 3px), radial-gradient(circle at 50% 50%, transparent 6px, rgba(79, 227, 255, .5) 6.5px, transparent 7.5px); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: var(--r-md); color: var(--mute); border: 1px solid transparent; transition: color .15s, background .15s; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { color: var(--ink); background: rgba(170, 200, 255, .05); }
.nav a.on { color: var(--ink); background: linear-gradient(90deg, rgba(79, 227, 255, .13), rgba(143, 123, 255, .06)); border-color: rgba(79, 227, 255, .25); box-shadow: inset -2px 0 0 var(--ion); }
.nav a b { margin-inline-start: auto; font: 500 11px var(--mono); color: var(--faint); }
.side .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 0; border-top: 1px solid var(--line); color: var(--mute); font-size: 12.5px; }

.main { display: flex; flex-direction: column; gap: 14px; min-width: 0; min-height: 0; }
.top { display: flex; gap: 12px; align-items: center; }
.find { flex: 1; position: relative; }
.find svg { position: absolute; inset-inline-start: 14px; top: 50%; translate: 0 -50%; width: 17px; height: 17px; color: var(--mute); pointer-events: none; }
.find input { width: 100%; height: 46px; padding-inline: 42px 16px; border-radius: 15px; }

/* the router rail: every MikroTik as a node on one line */
.rail { display: flex; align-items: center; gap: 0; padding: 9px 16px; overflow-x: auto; scrollbar-width: none; border-radius: 15px; min-height: 46px; }
.rail::-webkit-scrollbar { display: none; }
.rail .lbl { color: var(--mute); font-size: 12.5px; white-space: nowrap; margin-inline-end: 14px; }
.rail .hop { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 13px; cursor: pointer; padding: 3px 4px; border-radius: 8px; }
.rail .hop small { font: 11px var(--mono); color: var(--faint); direction: ltr; }
.rail .hop + .hop::before { content: ''; width: 26px; height: 1px; margin-inline: 6px 8px; background: linear-gradient(90deg, transparent, var(--line-2), transparent); }
.rail .hop.off { color: var(--faint); }
.rail .empty { color: var(--mute); font-size: 13px; }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--faint); display: inline-block; }
.dot.up { background: var(--ok); box-shadow: 0 0 0 3px rgba(60, 240, 165, .14), 0 0 12px var(--ok); }
.dot.down { background: var(--bad); box-shadow: 0 0 0 3px rgba(255, 92, 122, .14), 0 0 12px rgba(255, 92, 122, .8); }
.dot.wait { background: transparent; border: 2px solid var(--faint); border-top-color: var(--ion); animation: spin .8s linear infinite; }
.dot.idle { background: transparent; border: 1.5px dashed var(--faint); }
@keyframes spin { to { rotate: 360deg; } }

.view { flex: 1; min-height: 0; overflow: auto; padding-inline-end: 4px; scrollbar-gutter: stable; }
.head { display: flex; align-items: flex-end; gap: 12px; margin: 4px 2px 14px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.2px; }
.head p { margin: 0; color: var(--mute); font-size: 13px; }
.head .sp { flex: 1; }
.pad { padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ───── controls ───── */
.in, .find input, select.in, textarea.in {
  background: rgba(5, 8, 16, .62); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 9px 13px; outline: none; min-width: 0; transition: border-color .15s, box-shadow .15s, background .15s;
}
.in::placeholder, .find input::placeholder { color: var(--faint); font-family: var(--ui); }
.in:focus, .find input:focus { border-color: rgba(79, 227, 255, .6); box-shadow: 0 0 0 4px rgba(79, 227, 255, .1), inset 0 0 18px rgba(79, 227, 255, .05); background: rgba(5, 8, 16, .85); }
.in.ltr, .ltr { direction: ltr; text-align: left; font-family: var(--mono); font-size: 13px; }
textarea.in { resize: vertical; line-height: 1.75; }
select.in { appearance: none; padding-inline-end: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(135deg, var(--mute) 50%, transparent 50%); background-position: 14px 55%, 9px 55%; background-size: 5px 5px; background-repeat: no-repeat; }
select.in option { background: #0b101c; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--mute); min-width: 0; }
label.f .in { color: var(--ink); font-size: 14px; }
label.f .in.ltr { font-size: 13px; }
.hint { color: var(--faint); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: var(--r-md); cursor: pointer; white-space: nowrap;
  background: rgba(170, 200, 255, .06); border: 1px solid var(--line); transition: background .15s, border-color .15s, box-shadow .15s, translate .05s; }
.btn:hover { background: rgba(170, 200, 255, .11); border-color: var(--line-2); }
.btn:active { translate: 0 1px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.pri { color: #021018; font-weight: 600; border-color: transparent; background: linear-gradient(120deg, var(--ion), #7fb0ff 55%, var(--plasma)); box-shadow: 0 0 0 1px rgba(79, 227, 255, .3), 0 8px 28px -8px rgba(79, 227, 255, .6); }
.btn.pri:hover { box-shadow: 0 0 0 1px rgba(79, 227, 255, .5), 0 10px 34px -6px rgba(79, 227, 255, .8); }
.btn.bad { color: var(--bad); border-color: rgba(255, 92, 122, .3); background: rgba(255, 92, 122, .08); }
.btn.bad:hover { background: rgba(255, 92, 122, .16); border-color: rgba(255, 92, 122, .5); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 10px; }
.btn.big { height: 46px; padding: 0 20px; border-radius: 15px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.ib { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 9px; cursor: pointer; background: none; border: 1px solid transparent; color: var(--mute); }
.ib svg { width: 15px; height: 15px; }
.ib:hover { color: var(--ink); background: rgba(170, 200, 255, .09); border-color: var(--line); }
.ib.bad:hover { color: var(--bad); border-color: rgba(255, 92, 122, .35); background: rgba(255, 92, 122, .1); }
.ib.go:hover { color: var(--ion); }

.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(5, 8, 16, .6); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 4px 12px; border-radius: 9px; cursor: pointer; color: var(--mute); font-size: 13px; }
.seg button.on { background: rgba(79, 227, 255, .14); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(79, 227, 255, .3); }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 99px; font-size: 12px; border: 1px solid var(--line); color: var(--mute); white-space: nowrap; }
.tag.ok { color: var(--ok); border-color: rgba(60, 240, 165, .3); background: rgba(60, 240, 165, .07); }
.tag.warn { color: var(--warn); border-color: rgba(255, 200, 87, .3); background: rgba(255, 200, 87, .07); }
.tag.bad { color: var(--bad); border-color: rgba(255, 92, 122, .3); background: rgba(255, 92, 122, .07); }
.tag.ion { color: var(--ion); border-color: rgba(79, 227, 255, .3); background: rgba(79, 227, 255, .07); }

.pick { display: flex; flex-wrap: wrap; gap: 7px; }
.pick button { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 99px; cursor: pointer; background: rgba(5, 8, 16, .5); border: 1px solid var(--line); color: var(--mute); font-size: 13px; }
.pick button.on { color: var(--ink); border-color: rgba(79, 227, 255, .45); background: rgba(79, 227, 255, .1); }
.pick button.on::before { content: '✓'; color: var(--ion); font-size: 11px; }
.pick button.dead { opacity: .5; }

.sw { position: relative; width: 40px; height: 22px; border-radius: 99px; background: rgba(170, 200, 255, .12); border: 1px solid var(--line); cursor: pointer; flex: none; padding: 0; }
.sw::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--mute); transition: inset-inline-start .15s, background .15s; }
.sw.on { background: rgba(79, 227, 255, .22); border-color: rgba(79, 227, 255, .5); }
.sw.on::after { inset-inline-start: 20px; background: var(--ion); box-shadow: 0 0 10px var(--ion); }
.swl { display: flex; align-items: center; gap: 10px; cursor: pointer; }

/* ───── routers page ───── */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tile { padding: 16px 16px 12px; position: relative; overflow: hidden; }
.tile.on::before { content: ''; position: absolute; top: 0; inset-inline: 18px; height: 1px; background: linear-gradient(90deg, transparent, var(--ok), transparent); opacity: .7; }
.tile.err::before { content: ''; position: absolute; top: 0; inset-inline: 18px; height: 1px; background: linear-gradient(90deg, transparent, var(--bad), transparent); opacity: .7; }
.tile.dis { opacity: .55; }
.tile .t { display: flex; align-items: center; gap: 10px; }
.tile .t b { font-size: 15.5px; }
.tile .addr { font: 12px var(--mono); color: var(--mute); direction: ltr; text-align: right; margin: 2px 0 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile dl { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 6px 10px; margin: 0 0 10px; }
.tile dt { font-size: 11.5px; color: var(--faint); }
.tile dd { margin: 0; font: 500 13px var(--mono); direction: ltr; text-align: right; }
.tile .msg { color: var(--bad); font-size: 12.5px; margin-bottom: 10px; min-height: 44px; }
.tile .msg.q { color: var(--mute); }
.tile .acts { display: flex; align-items: center; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; }
.tile .acts .sp { flex: 1; }
.grp { margin: 18px 4px 10px; color: var(--mute); font-size: 13px; display: flex; align-items: center; gap: 10px; }
.grp::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.blank { padding: 44px 20px; text-align: center; color: var(--mute); }
.blank h3 { margin: 0 0 6px; color: var(--ink); font-size: 17px; }
.blank .btn { margin-top: 14px; }

/* ───── lists page ───── */
.split { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 14px; height: 100%; min-height: 0; }
.idx { display: flex; flex-direction: column; min-height: 0; padding: 12px; }
.idx .in { margin-bottom: 8px; }
.idx .items { overflow: auto; flex: 1; margin-inline: -4px; padding-inline: 4px; }
.idx a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; color: var(--mute); border: 1px solid transparent; }
.idx a span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; font-size: 13.5px; }
.idx a b { font: 500 11.5px var(--mono); color: var(--faint); }
.idx a:hover { background: rgba(170, 200, 255, .05); color: var(--ink); }
.idx a.on { background: rgba(79, 227, 255, .1); border-color: rgba(79, 227, 255, .28); color: var(--ink); }
.idx a.on b { color: var(--ion); }
.idx a i { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 8px var(--warn); flex: none; }
.idx a svg { width: 12px; height: 12px; color: var(--warn); flex: none; }
.pane { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.pane .ph { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.pane .ph h2 { margin: 0; font-size: 19px; direction: ltr; unicode-bidi: plaintext; }
.pane .ph .sub { color: var(--mute); font-size: 13px; }
.quick { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(120px, 1.4fr) auto; gap: 8px; margin-top: 12px; }
.bar { display: flex; gap: 8px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bar .in { height: 34px; padding-block: 0; width: 210px; }
.bar .sp { flex: 1; }
.bar.sel { background: linear-gradient(90deg, rgba(79, 227, 255, .12), rgba(143, 123, 255, .08)); }
.scroll { flex: 1; overflow: auto; min-height: 0; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { position: sticky; top: 0; z-index: 2; text-align: start; font-weight: 500; font-size: 12.5px; color: var(--mute); padding: 9px 12px; background: #090d17; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 7px 12px; border-bottom: 1px solid rgba(170, 200, 255, .06); vertical-align: middle; }
table.t tr:hover td { background: rgba(79, 227, 255, .035); }
table.t tr.off td.ip, table.t tr.off td.cm { opacity: .45; text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, .3); }
table.t td.ip { font: 500 13.5px var(--mono); direction: ltr; text-align: right; color: #bfeaff; white-space: nowrap; }
table.t td.cm { color: var(--mute); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; }
table.t td.ln a { color: var(--ion); font-weight: 600; direction: ltr; unicode-bidi: plaintext; }
table.t td.dt { font: 11.5px var(--mono); color: var(--faint); direction: ltr; text-align: right; white-space: nowrap; }
table.t td.ac { white-space: nowrap; text-align: end; width: 1%; }
table.t td.ck, table.t th.ck { width: 34px; padding-inline-end: 0; }
input[type=checkbox] { appearance: none; width: 16px; height: 16px; border-radius: 5px; border: 1px solid var(--line-2); background: rgba(5, 8, 16, .6); cursor: pointer; vertical-align: middle; margin: 0; display: inline-grid; place-items: center; }
input[type=checkbox]:checked { background: var(--ion); border-color: var(--ion); box-shadow: 0 0 10px rgba(79, 227, 255, .5); }
input[type=checkbox]:checked::after { content: ''; width: 8px; height: 4px; border: 2px solid #021018; border-top: 0; border-right: 0; rotate: -45deg; translate: 0 -1px; }

/* presence strip: one light per router, same order as the rail */
.pres { display: inline-flex; gap: 5px; align-items: center; flex-wrap: wrap; max-width: 220px; vertical-align: middle; }
.pres i { width: 9px; height: 9px; border-radius: 3px; background: var(--ok); box-shadow: 0 0 7px rgba(60, 240, 165, .7); }
.pres i.no { background: transparent; box-shadow: none; border: 1.5px solid rgba(255, 92, 122, .75); }
.pres i.dis { background: var(--warn); box-shadow: 0 0 7px rgba(255, 200, 87, .6); }
.pres em { font-style: normal; font-size: 12px; color: var(--mute); margin-inline-start: 4px; }
.more { padding: 14px; text-align: center; }

/* ───── add page ───── */
.addgrid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.parse { display: flex; gap: 8px; flex-wrap: wrap; min-height: 24px; }
table.mx { border-collapse: collapse; width: 100%; }
table.mx th, table.mx td { padding: 6px 10px; border-bottom: 1px solid rgba(170, 200, 255, .06); text-align: center; font-size: 13px; white-space: nowrap; }
table.mx th { color: var(--mute); font-weight: 500; position: sticky; top: 0; background: #090d17; }
table.mx td:first-child, table.mx th:first-child { text-align: left; direction: ltr; font-family: var(--mono); color: #bfeaff; }
.c-ok { color: var(--ok); } .c-eq { color: var(--mute); } .c-bad { color: var(--bad); cursor: help; white-space: normal !important; min-width: 110px; } .c-wait { color: var(--faint); }

/* ───── overlays ───── */
.veil { position: fixed; inset: 0; z-index: 50; background: rgba(1, 2, 6, .66); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 18px; overflow: auto; }
.modal { width: min(560px, 100%); background: linear-gradient(180deg, rgba(20, 27, 46, .96), rgba(9, 13, 24, .97)); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: 0 40px 120px -20px #000, inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 80px -30px rgba(79, 227, 255, .35); }
.modal.wide { width: min(760px, 100%); }
.modal header { display: flex; align-items: center; padding: 16px 20px 0; }
.modal header h3 { margin: 0; font-size: 17px; flex: 1; }
.modal .body { padding: 16px 20px; display: flex; flex-direction: column; gap: 13px; max-height: 68vh; overflow: auto; }
.modal footer { display: flex; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--line); align-items: center; }
.modal footer .sp { flex: 1; }
.note { padding: 10px 13px; border-radius: var(--r-md); font-size: 13px; border: 1px solid var(--line); background: rgba(5, 8, 16, .5); color: var(--mute); }
.note.ok { color: var(--ok); border-color: rgba(60, 240, 165, .3); } .note.bad { color: var(--bad); border-color: rgba(255, 92, 122, .3); } .note.warn { color: var(--warn); border-color: rgba(255, 200, 87, .3); }
details.help { font-size: 13px; color: var(--mute); }
details.help summary { cursor: pointer; color: var(--ion); }
pre.code { margin: 8px 0 0; padding: 12px; border-radius: var(--r-md); background: #04060c; border: 1px solid var(--line); direction: ltr; text-align: left; font: 12px/1.8 var(--mono); color: #b9c6e6; white-space: pre-wrap; word-break: break-all; }

.toasts { position: fixed; z-index: 80; bottom: 22px; left: 22px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; max-width: min(480px, calc(100vw - 44px)); font-size: 13.5px;
  background: rgba(12, 17, 30, .92); border: 1px solid var(--line-2); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 18px 50px -12px #000; }
.toast.ok { border-color: rgba(60, 240, 165, .45); } .toast.err { border-color: rgba(255, 92, 122, .5); } .toast.warn { border-color: rgba(255, 200, 87, .45); }
.toast button { background: none; border: 0; color: var(--ion); cursor: pointer; padding: 0 2px; white-space: nowrap; }

/* ───── sign in ───── */
.gate { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.gate .card { width: min(390px, 100%); padding: 30px 28px 26px; display: flex; flex-direction: column; gap: 14px; }
.gate h1 { margin: 6px 0 0; font-size: 21px; }
.gate p { margin: 0 0 4px; color: var(--mute); font-size: 13.5px; }

/* ───── small screens ───── */
@media (max-width: 900px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; height: auto; min-height: 100vh; padding: 12px 12px 84px; gap: 12px; }
  .side { position: fixed; z-index: 40; bottom: 10px; inset-inline: 10px; padding: 6px; flex-direction: row; border-radius: 18px; background: rgba(10, 14, 24, .9); }
  .brand, .side .foot { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; }
  .nav a.on { box-shadow: none; }
  .nav a b { display: none; }
  .view { overflow: visible; padding: 0; }
  .split { grid-template-columns: 1fr; height: auto; }
  .idx { max-height: 210px; }
  .pane { overflow: visible; }
  .scroll { overflow-x: auto; }
  .addgrid, .grid2, .grid3, .quick { grid-template-columns: 1fr; }
  .top .btn span { display: none; }
  .tile dl { grid-template-columns: repeat(2, auto); }
  table.t td.dt, table.t th.dt { display: none; }
  .toasts { bottom: 84px; left: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; } }

/* ───── alerts in chrome ───── */
.nav a i.alarm { margin-inline-start: auto; font: 600 11px var(--mono); font-style: normal; color: #fff; background: var(--bad); border-radius: 99px; padding: 0 7px; box-shadow: 0 0 12px rgba(255, 92, 122, .7); }
.rail .hop.alarm { color: var(--ink); box-shadow: inset 0 0 0 1px rgba(255, 92, 122, .55); background: rgba(255, 92, 122, .08); padding-inline: 8px; }

/* ───── monitoring ───── */
.mon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 14px; }
.mon { padding: 14px 16px 10px; min-width: 0; }
.mon.alarmed { border-color: rgba(255, 92, 122, .45); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 0 0 1px rgba(255, 92, 122, .15), 0 24px 60px -30px rgba(255, 92, 122, .45); }
.mh { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mh b { font-size: 15.5px; }
.kpis { display: grid; grid-template-columns: 1.15fr 1fr 1fr 1.3fr 1fr; gap: 10px; margin-bottom: 8px; }
.kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi > span { font-size: 11.5px; color: var(--mute); }
.kpi > b { font: 600 17px var(--mono); direction: ltr; text-align: right; white-space: nowrap; }
.kpi:first-child > b { font-size: 26px; line-height: 1.15; letter-spacing: -.5px; }
.kpi small { font-size: 11px; color: var(--faint); white-space: nowrap; }
.kpi small.ltr { font-family: var(--mono); }
.meter { display: block; height: 6px; border-radius: 99px; background: rgba(14, 165, 198, .16); overflow: hidden; margin-top: 3px; }
.meter i { display: block; height: 100%; border-radius: 99px; background: #0ea5c6; }
.meter.warn { background: rgba(255, 200, 87, .16); } .meter.warn i { background: var(--warn); }
.meter.bad { background: rgba(255, 92, 122, .16); } .meter.bad i { background: var(--bad); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--mute); margin: 2px 0 2px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 2px; border-radius: 2px; }
.chart { position: relative; direction: ltr; height: 150px; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: rgba(170, 200, 255, .09); stroke-width: 1; }
.chart .ax { fill: var(--faint); font: 10.5px var(--mono); }
.chart .thr { stroke: rgba(255, 200, 87, .55); stroke-width: 1; }
.chart .thr-l { fill: var(--warn); font-family: var(--ui); }
.chart .cross { stroke: rgba(233, 238, 255, .35); stroke-width: 1; }
.chart .tip { display: none; position: absolute; top: 4px; pointer-events: none; z-index: 3; min-width: 150px; padding: 8px 10px; border-radius: 10px; direction: rtl;
  background: rgba(8, 12, 22, .95); border: 1px solid var(--line-2); box-shadow: 0 12px 30px -8px #000; font-size: 12px; }
.chart .tip .tt { color: var(--mute); font: 11px var(--mono); margin-bottom: 4px; direction: ltr; text-align: right; }
.chart .tip .tr { display: flex; align-items: center; gap: 7px; }
.chart .tip .tr i { width: 10px; height: 2px; border-radius: 2px; flex: none; }
.chart .tip .tr span { flex: 1; color: var(--mute); }
.chart .tip .tr b { font: 600 12px var(--mono); direction: ltr; }
.alarms { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.alarm-card { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-md); background: rgba(255, 92, 122, .07); border: 1px solid rgba(255, 92, 122, .35); }
.alarm-card .m { flex: 1; }

/* ───── settings ───── */
.savebar { position: sticky; bottom: 0; display: flex; justify-content: flex-end; padding: 12px 0 2px; margin-top: 10px; background: linear-gradient(transparent, var(--abyss) 40%); }
.secret { font: 600 18px var(--mono); letter-spacing: 1px; padding: 12px; text-align: center; border-radius: var(--r-md); background: #04060c; border: 1px dashed rgba(79, 227, 255, .4); color: #bfeaff; user-select: all; }
.head .seg { flex-wrap: wrap; }

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .nav { overflow-x: auto; justify-content: flex-start; }
}
svg:not([width]) { width: 16px; height: 16px; flex: none; vertical-align: middle; }
.tag svg:not([width]) { width: 12px; height: 12px; }

.find.sm { flex: none; margin-bottom: 8px; }
.find.sm input { height: 40px; border-radius: var(--r-md); padding-inline: 38px 12px; }
.find.sm svg { inset-inline-start: 12px; width: 15px; height: 15px; }

/* ───── multi-list picker ───── */
.pick.lists { max-height: 190px; overflow: auto; padding: 2px; }
.pick.lists button[disabled] { cursor: not-allowed; }
table.mx tr.grp-row td { text-align: right !important; direction: ltr; font: 600 12.5px var(--mono); color: var(--ion) !important; background: rgba(79, 227, 255, .06); }

/* ───── backups ───── */
.bk .ph { display: flex; gap: 10px; align-items: center; }
.bk .ph b { font-size: 15px; }
.bk table.t td { vertical-align: top; padding-top: 9px; padding-bottom: 9px; }

/* ───── terminal ───── */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 2px; }
.tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 11px 11px 4px 4px; border: 1px solid var(--line); background: rgba(5, 8, 16, .5); color: var(--mute); cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-color: rgba(79, 227, 255, .45); background: rgba(79, 227, 255, .1); box-shadow: inset 0 -2px 0 var(--ion); }
.term { display: flex; flex-direction: column; height: calc(100vh - 330px); min-height: 360px; padding: 0; overflow: hidden; background: linear-gradient(180deg, rgba(3, 5, 10, .92), rgba(3, 6, 12, .96)); }
.term-out { flex: 1; overflow: auto; padding: 14px 16px; direction: ltr; text-align: left; font: 13px/1.6 var(--mono); }
.term-out pre { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; font: inherit; color: #cfd8ee; }
.term-e { margin-bottom: 12px; }
.term-cmd { color: #e9eeff; }
.term-ps { color: var(--ion); font-family: var(--mono); white-space: nowrap; }
.term-err { color: var(--bad) !important; }
.term-wait { color: var(--faint); }
.term-meta { color: var(--faint); font-size: 11px; }
.term-hello { color: var(--mute); white-space: pre-wrap; direction: rtl; text-align: right; font-family: var(--ui); }
.term-line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-top: 1px solid var(--line); direction: ltr; background: rgba(5, 8, 16, .8); }
.term-line .term-ps { padding-top: 6px; }
.term-in { flex: 1; resize: none; background: transparent; border: 0; outline: none; color: var(--ink); font: 13.5px/1.7 var(--mono); padding: 4px 0; direction: ltr; }
.term-line .btn { direction: rtl; }
@media (max-width: 900px) { .term { height: 70vh; } }
