/* ARJCOM Panel - network operations console */
:root {
  --bg: #0d1625;
  --bg-2: #111c2e;
  --surface: #15223a;
  --raised: #1b2a45;
  --line: #24365a;
  --line-soft: #1d2d4a;
  --text: #e7eef9;
  --muted: #8d9dba;
  --faint: #5d6e8f;
  --accent: #2fd3c3;
  --accent-ink: #062a27;
  --accent-soft: rgba(47, 211, 195, .12);
  --tx: #9b8cff;
  --good: #3ddc84;
  --warn: #f5b544;
  --bad: #f2545b;
  --info: #5b9dff;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px -18px rgba(0, 0, 0, .7);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #eef2f8;
  --bg-2: #e6ecf5;
  --surface: #ffffff;
  --raised: #f4f7fc;
  --line: #d5deec;
  --line-soft: #e3e9f3;
  --text: #0f1b2e;
  --muted: #55657f;
  --faint: #8594ad;
  --accent: #0aa596;
  --accent-ink: #ffffff;
  --accent-soft: rgba(10, 165, 150, .1);
  --tx: #6a55f0;
  --good: #149a55;
  --warn: #c47d06;
  --bad: #d63a42;
  --info: #2f6fe0;
  --shadow: 0 1px 2px rgba(15, 27, 46, .05), 0 8px 24px -16px rgba(15, 27, 46, .25);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01';
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; font-weight: 650; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
code, .mono { font-family: var(--mono); font-size: .92em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  background: var(--bg-2); border-right: 1px solid var(--line-soft); padding: 18px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand img { height: 30px; max-width: 120px; object-fit: contain; }
.brand .mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), #2a8bff); color: #04121a; font-weight: 800; font-size: 14px;
}
.brand b { font-size: 15px; display: block; line-height: 1.15; }
.brand small { color: var(--muted); font-size: 11.5px; }
.nav-sec { color: var(--faint); font-size: 11.5px; padding: 14px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; text-decoration: none; position: relative;
}
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.on { background: var(--surface); color: var(--text); }
.nav a.on::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.side-foot { margin-top: auto; padding: 12px 10px 0; color: var(--faint); font-size: 11.5px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.top .crumbs { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; min-width: 0; }
.top .crumbs a { color: var(--muted); }
.top .crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .grow { flex: 1; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }
.who { display: flex; align-items: center; gap: 9px; padding: 3px 4px 3px 3px; border-radius: 99px; }
.who .av {
  width: 30px; height: 30px; border-radius: 50%; background: var(--raised); border: 1px solid var(--line);
  display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--accent);
}
.who small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.1; }
.who span { font-weight: 600; font-size: 13px; line-height: 1.2; }
.menu-btn { display: none; }

.page { padding: 26px 28px 60px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .t { flex: 1; min-width: 220px; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.banner {
  display: flex; gap: 12px; align-items: center; padding: 11px 16px; border-radius: var(--radius);
  border: 1px solid; margin-bottom: 18px; font-weight: 500;
}
.banner.warn { background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }
.banner.bad { background: color-mix(in srgb, var(--bad) 10%, transparent); border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); }
.banner.info { background: color-mix(in srgb, var(--info) 10%, transparent); border-color: color-mix(in srgb, var(--info) 35%, transparent); color: var(--info); }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.card-h h2 { flex: 1; }
.card-h .sub { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.card-b { padding: 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 16px; }

.stat { padding: 16px 18px; }
.stat .k { color: var(--muted); font-size: 12.5px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 14px; color: var(--muted); font-weight: 500; }
.stat .bar { height: 4px; border-radius: 4px; background: var(--raised); margin-top: 10px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--raised); color: var(--text); font: 600 13px var(--font);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: transparent; }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--raised); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn.winbox { background: linear-gradient(180deg, #2a8bff, #1f6fe0); border-color: #1f6fe0; color: #fff; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 13px; }
.field .hint { color: var(--muted); font-size: 12px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search],
select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font: 14px var(--font); transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-radius: 8px 0 0 8px; }
.input-suffix span {
  display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-left: 0;
  border-radius: 0 8px 8px 0; background: var(--raised); color: var(--muted); font-family: var(--mono); font-size: 13px;
}
.check { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; padding: 4px 0; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 3px; background: var(--bg-2); gap: 3px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft); white-space: nowrap; background: var(--bg-2);
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--raised) 55%, transparent); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.tbl .muted, .muted { color: var(--muted); }
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

.pager { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.pager .per { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.pager .per select { width: auto; height: 30px; padding: 0 8px; font-size: 13px; }
.pager .info { color: var(--muted); font-size: 12.5px; flex: 1; }
.pager .pages { display: flex; gap: 4px; }
.pager .pages a, .pager .pages span {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 7px; display: grid; place-items: center;
  border: 1px solid var(--line-soft); color: var(--muted); font-size: 12.5px; font-weight: 600; text-decoration: none;
}
.pager .pages a:hover { border-color: var(--faint); color: var(--text); }
.pager .pages .cur { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- pills / status ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--raised); color: var(--muted); white-space: nowrap;
}
.pill.good { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.pill.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.pill.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.pill.info { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; display: inline-block; }
.dot.online { background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); animation: pulse 2.4s infinite; }
.dot.offline { background: var(--bad); }
.dot.rebooting { background: var(--warn); animation: blink 1s infinite; }
.dot.pending { background: var(--faint); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes blink { 50% { opacity: .3; } }

/* ---------- live board: the switch front panel ---------- */
.board-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.board-tools input[type=search] { max-width: 280px; }
.board-tools .legend { margin-left: auto; display: flex; gap: 14px; color: var(--muted); font-size: 12.5px; align-items: center; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.co-group + .co-group { margin-top: 26px; }
.co-group > h3 { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; color: var(--muted); font-weight: 600; }
.co-group > h3 b { color: var(--text); }
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; align-items: start; }
.rcard { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.rcard.offline { opacity: .8; }
.rcard .rh { display: flex; align-items: center; gap: 10px; padding: 13px 16px 10px; }
.rcard .rh a { color: var(--text); font-weight: 650; font-size: 14.5px; }
.rcard .rh .loc { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcard .rh .grow { flex: 1; min-width: 0; }
.rcard .tot { text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; line-height: 1.35; }
.rcard .tot .rx { color: var(--accent); }
.rcard .tot .tx { color: var(--tx); }
.faceplate {
  margin: 0 12px 12px; padding: 10px; border-radius: 9px;
  background: linear-gradient(180deg, #0a111e, #0c1524); border: 1px solid #1d2b45;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 7px;
}
[data-theme="light"] .faceplate { background: linear-gradient(180deg, #1a2333, #1e293b); border-color: #2a3850; }
.port {
  position: relative; border-radius: 6px; padding: 7px 8px 6px; background: #121d31; border: 1px solid #22324f;
  color: #dbe5f5; cursor: default; min-width: 0;
}
.port .pn { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11.5px; font-weight: 600; }
.port .pn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.port .led { width: 7px; height: 7px; border-radius: 2px; background: #3ddc84; box-shadow: 0 0 6px #3ddc84; flex: none; }
.port.busy .led { animation: blink .5s infinite; }
.port .sp { font-family: var(--mono); font-size: 10.5px; color: #8ea2c4; margin-top: 2px; }
.port .sp.g10 { color: #67e8f9; }
.port .sp.slow { color: #f5b544; }
.port .rt { font-family: var(--mono); font-size: 10.5px; line-height: 1.4; margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.port .rt .rx { color: #2fd3c3; }
.port .rt .tx { color: #a99cff; }
.port .lbl { font-size: 10.5px; color: #8ea2c4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.port.sel { border-color: color-mix(in srgb, #2fd3c3 55%, #22324f); }
.faceplate .none { grid-column: 1 / -1; color: #7a8bab; font-size: 12.5px; padding: 6px 2px; }
.rcard .rf { display: flex; gap: 14px; padding: 0 16px 12px; color: var(--muted); font-size: 12px; }
.rcard .rf b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- router page ---------- */
.rhead { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.rhead .ttl { display: flex; gap: 12px; align-items: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.chart-card .card-b { padding: 12px 14px 8px; }
.chart { width: 100%; height: 220px; display: block; }
.chart.small { height: 64px; }
.total-card { display: grid; grid-template-columns: 220px 1fr; gap: 0; }
.total-card .nums { padding: 18px; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.big-rate { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.big-rate small { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.big-rate.rx { color: var(--accent); }
.big-rate.tx { color: var(--tx); }
.ports-tbl .spark { width: 160px; height: 34px; display: block; }
.ports-tbl .pname { font-family: var(--mono); font-weight: 600; }
.ports-tbl tr.down td { opacity: .45; }
.speed-tag { font-family: var(--mono); font-size: 12px; padding: 2px 7px; border-radius: 5px; background: var(--raised); }
.speed-tag.g10 { color: #22b8cf; }
.speed-tag.slow { color: var(--warn); }
.toggle { position: relative; display: inline-block; width: 34px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; border-radius: 20px; background: var(--line); cursor: pointer; transition: background .15s; }
.toggle span::after { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(14px); }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- devices ---------- */
.dev-brand { display: flex; gap: 8px; align-items: baseline; padding: 12px 16px 8px; border-top: 1px solid var(--line-soft); }
.dev-brand:first-child { border-top: 0; }
.dev-tbl { table-layout: fixed; min-width: 980px; }
.dev-tbl td { overflow: hidden; text-overflow: ellipsis; }
.dot.restarting { background: var(--warn); animation: blink 1s infinite; }

/* ---------- network map ---------- */
.map { display: flex; flex-direction: column; gap: 6px; }
.map-root { display: inline-flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 10px; background: var(--surface); border: 1px solid var(--accent); align-self: flex-start; font-size: 15px; }
.map-co { margin-left: 22px; padding-left: 22px; border-left: 2px solid var(--line); padding-top: 6px; }
.map-co-h { color: var(--muted); font-weight: 600; margin: 10px 0 6px; }
.map-node { position: relative; padding: 5px 0 5px 0; }
.map-children { margin-left: 18px; padding-left: 22px; border-left: 1px solid var(--line); }
.map-children > .map-node::before { content: ''; position: absolute; left: -22px; top: 22px; width: 18px; border-top: 1px solid var(--line); }
.map-card { display: inline-flex; gap: 9px; align-items: center; padding: 9px 13px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line-soft); color: var(--text); text-decoration: none; flex-wrap: wrap; max-width: 100%; }
.map-card:hover { border-color: var(--faint); text-decoration: none; }
.map-card.good { border-left: 3px solid var(--good); }
.map-card.bad { border-left: 3px solid var(--bad); }
.map-card.warn { border-left: 3px solid var(--warn); }
.map-card.sm { padding: 7px 11px; font-size: 13px; }
.map-card .muted { font-size: 12px; }
.map-port { display: inline-block; padding: 4px 9px; border-radius: 6px; background: var(--raised); font-size: 12px; margin-top: 8px; }

/* ---------- script box (terminal) ---------- */
.term { border-radius: 10px; overflow: hidden; border: 1px solid #1f2d47; background: #070d18; box-shadow: var(--shadow); }
.term-h { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: #0e1828; border-bottom: 1px solid #1f2d47; }
.term-h .lights { display: flex; gap: 6px; }
.term-h .lights i { width: 10px; height: 10px; border-radius: 50%; background: #3a4560; display: block; }
.term-h .lights i:nth-child(1) { background: #f2545b; }
.term-h .lights i:nth-child(2) { background: #f5b544; }
.term-h .lights i:nth-child(3) { background: #3ddc84; }
.term-h .tt { flex: 1; font-family: var(--mono); font-size: 12px; color: #9fb0cf; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-h .btn { background: #15223a; border-color: #273a5c; color: #dbe5f5; }
.term-h .btn:hover { border-color: #3d5583; }
.term pre {
  margin: 0; padding: 14px 16px; max-height: 460px; overflow: auto; font: 12.5px/1.65 var(--mono); color: #d6e2f5;
  white-space: pre; tab-size: 4;
}
.term pre .c { color: #5f7396; }
.term pre .k { color: #7cc4ff; }
.term pre .s { color: #ffcf7a; }
.term pre .v { color: #c4a6ff; }
.term pre .p { color: #6ee7d6; }
.term .hidden-msg { padding: 26px 16px; text-align: center; color: #7c8db0; font-size: 13px; }
.term.is-hidden pre { display: none; }
.term:not(.is-hidden) .hidden-msg { display: none; }

/* ---------- modal & toast ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(4, 9, 18, .6); backdrop-filter: blur(3px); display: none;
  align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-bg.open { display: flex; animation: fade .15s ease-out; }
.modal { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7); }
.modal.wide { max-width: 860px; }
.modal-h { padding: 18px 20px 6px; }
.modal-h h2 { font-size: 17px; }
.modal-b { padding: 8px 20px 18px; color: var(--muted); }
.modal-b p { margin: 0 0 10px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-soft); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 36px)); }
.toast {
  padding: 11px 14px 11px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .6); font-weight: 500;
  animation: slide .2s ease-out;
}
.toast.error { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
.toast.ok { border-left-color: var(--good); }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- auth pages ---------- */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr);
}
.auth-art {
  position: relative; overflow: hidden; padding: 44px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at 20% 110%, rgba(47, 211, 195, .16), transparent 60%),
              radial-gradient(900px 500px at 90% -10%, rgba(42, 139, 255, .18), transparent 60%), #0a1220;
  color: #e7eef9; border-right: 1px solid #1a2740;
}
.auth-art .net { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .85; }
.auth-art .brand-l { position: relative; display: flex; gap: 12px; align-items: center; }
.auth-art .brand-l img { height: 40px; max-width: 180px; object-fit: contain; }
.auth-art .brand-l b { font-size: 18px; }
.auth-art .claim { position: relative; max-width: 460px; margin-top: auto; margin-bottom: 28px; }
.auth-art .claim h1 { font-size: 34px; line-height: 1.12; letter-spacing: -.025em; font-weight: 700; }
.auth-art .claim p { color: #9fb0cf; font-size: 15px; margin-top: 12px; }
.auth-art .foot { position: relative; color: #6f82a6; font-size: 12.5px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 28px; background: var(--bg); }
.auth-box { width: 100%; max-width: 360px; }
.auth-box h2 { font-size: 22px; margin-bottom: 4px; }
.auth-box > p { color: var(--muted); margin: 0 0 24px; }
.auth-box .btn.primary { width: 100%; height: 42px; justify-content: center; font-size: 14px; margin-top: 6px; }
.otp { font-family: var(--mono); font-size: 22px !important; letter-spacing: .4em; text-align: center; height: 52px !important; }
.qr { background: #fff; border-radius: 12px; padding: 10px; display: inline-block; }
.qr svg { display: block; width: 190px; height: 190px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: var(--mono); font-size: 15px; }
.codes span { padding: 8px 10px; background: var(--raised); border-radius: 7px; text-align: center; border: 1px solid var(--line-soft); }

.secret-box { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 9px; background: var(--bg-2); font-family: var(--mono); font-size: 14px; word-break: break-all; }
.secret-box span { flex: 1; }

.drop {
  border: 1.5px dashed var(--line); border-radius: 12px; padding: 30px; text-align: center; color: var(--muted);
  transition: border-color .15s, background .15s; cursor: pointer;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.drop b { color: var(--text); display: block; font-size: 15px; margin-bottom: 4px; }
.drop svg { width: 34px; height: 34px; display: block; margin: 0 auto 10px; color: var(--accent); }
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.filter-bar input[type=search] { max-width: 260px; height: 32px; }
.filter-bar select { width: auto; height: 32px; font-size: 13px; }
.chip { height: 28px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: 600 12px var(--font); cursor: pointer; }
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.progress { height: 6px; border-radius: 6px; background: var(--raised); overflow: hidden; margin-top: 12px; display: none; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-soft); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }

.meter { display: flex; flex-direction: column; gap: 6px; }
.meter .top-row { display: flex; justify-content: space-between; font-size: 13px; }
.meter .track { height: 8px; border-radius: 8px; background: var(--raised); overflow: hidden; }
.meter .track i { display: block; height: 100%; border-radius: 8px; background: var(--accent); transition: width .4s; }
.meter .track i.warn { background: var(--warn); }
.meter .track i.bad { background: var(--bad); }

.logbox { background: #070d18; color: #c9d6ee; font: 12px/1.6 var(--mono); padding: 14px; border-radius: 10px; max-height: 560px; overflow: auto; white-space: pre-wrap; border: 1px solid #1f2d47; }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 38px; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; font-size: 13px;
}
.steps li b { display: block; }
.steps li span { color: var(--muted); }
.divider { height: 1px; background: var(--line-soft); margin: 18px 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.hide { display: none !important; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .total-card { grid-template-columns: 1fr; }
  .total-card .nums { border-right: 0; border-bottom: 1px solid var(--line-soft); flex-direction: row; justify-content: space-around; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .side { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .5); }
  .menu-btn { display: grid; }
  .page { padding: 18px 16px 50px; }
  .top { padding: 10px 16px; }
  .g2, .g3, .g4, .form-grid { grid-template-columns: 1fr; }
  .rgrid { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .who div { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* saved password reveal */
.secret { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.secret .s-val { padding: 2px 8px; border-radius: 6px; background: var(--bg-2, rgba(127,127,127,.12)); user-select: all; word-break: break-all; }
