/* =====================================================================
   BMS Cascina del Poggio — tema "Neon Forest" 3D
   ===================================================================== */
:root {
  --bg0: #030712;
  --bg1: #07111f;
  --glass: rgba(15, 28, 48, .55);
  --glass-2: rgba(22, 40, 66, .62);
  --border: rgba(125, 211, 252, .16);
  --border-hi: rgba(125, 211, 252, .45);
  --text: #e6f1ff;
  --muted: #8ba3c1;
  --dim: #5b7290;
  --cyan: #22d3ee;
  --blue: #3b82f6;
  --violet: #a78bfa;
  --magenta: #f472b6;
  --green: #34d399;
  --lime: #a3e635;
  --amber: #fbbf24;
  --red: #f43f5e;
  --orange: #fb923c;
  --grad: linear-gradient(135deg, #22d3ee 0%, #34d399 45%, #a78bfa 100%);
  --grad-warm: linear-gradient(135deg, #fb923c, #f472b6);
  --radius: 18px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, .8), 0 0 0 1px var(--border) inset;
  --sidebar: 248px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--text); font-size: 14px;
  background: radial-gradient(1200px 800px at 80% -10%, #0e2a3d 0%, transparent 60%),
              radial-gradient(900px 700px at -10% 110%, #12203f 0%, transparent 60%), var(--bg0);
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(34, 211, 238, .35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(125, 211, 252, .18); border-radius: 10px; }

#bg3d { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .9; transition: opacity .8s; }
#bg3d.faded { opacity: .25; }

/* ---------------- layout ---------------- */
.shell { position: relative; z-index: 1; min-height: 100vh; display: flex; }
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar); z-index: 20;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 14px 14px;
  background: linear-gradient(180deg, rgba(6, 16, 30, .82), rgba(4, 10, 22, .9));
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px;
}
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 4px 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.brand img { width: 150px; filter: drop-shadow(0 0 18px rgba(52, 211, 153, .35)); }
.brand .tag { font-size: 11px; letter-spacing: .28em; text-transform: uppercase; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: var(--muted);
  font-weight: 500; position: relative; transition: all .25s; text-decoration: none; overflow: hidden;
}
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { color: var(--text); background: rgba(125, 211, 252, .07); }
.nav a.active { color: #fff; background: linear-gradient(90deg, rgba(34, 211, 238, .22), rgba(167, 139, 250, .1)); box-shadow: 0 0 0 1px rgba(34, 211, 238, .3) inset, 0 8px 30px -10px rgba(34, 211, 238, .5); }
.nav a.active::before { content: ""; position: absolute; left: 0; top: 18%; bottom: 18%; width: 3px; border-radius: 3px; background: var(--grad); box-shadow: 0 0 12px var(--cyan); }
.sidebar .spacer { flex: 1; }
.sidebar .side-foot { font-size: 11px; color: var(--dim); text-align: center; }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 14px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 24px 12px;
  background: linear-gradient(180deg, rgba(3, 7, 18, .85), rgba(3, 7, 18, .4));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid rgba(125, 211, 252, .08);
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: .01em; }
.topbar h1 small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.topbar .grow { flex: 1; }
.topbar .mobile-logo { display: none; height: 36px; filter: drop-shadow(0 0 10px rgba(52,211,153,.4)); }
.content { padding: 22px 24px 30px; flex: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--glass); border: 1px solid var(--border); white-space: nowrap;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(52, 211, 153, .7); animation: pulse 2s infinite; flex: none; }
.dot.red { background: var(--red); animation-name: pulse-red; }
.dot.amber { background: var(--amber); animation-name: pulse-amber; }
.dot.gray { background: var(--dim); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .7); } 70% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, .8); } 70% { box-shadow: 0 0 0 10px rgba(244, 63, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); } }
@keyframes pulse-amber { 0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, .8); } 70% { box-shadow: 0 0 0 10px rgba(251, 191, 36, 0); } 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); } }

.user-btn { display: flex; align-items: center; gap: 10px; background: var(--glass); border: 1px solid var(--border); padding: 5px 12px 5px 5px; border-radius: 999px; cursor: pointer; transition: .2s; }
.user-btn:hover { border-color: var(--border-hi); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #04121f; background: var(--grad); }
.user-btn .meta { line-height: 1.1; text-align: left; }
.user-btn .meta b { font-size: 13px; display: block; }
.user-btn .meta span { font-size: 11px; color: var(--muted); }
.menu { position: absolute; right: 24px; top: 64px; min-width: 210px; padding: 8px; border-radius: 14px; background: rgba(8, 18, 34, .96); border: 1px solid var(--border); box-shadow: var(--shadow); z-index: 50; }
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; background: none; border: 0; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--text); text-align: left; }
.menu button:hover { background: rgba(125, 211, 252, .1); }
.menu svg { width: 18px; height: 18px; }

/* ---------------- footer ETA ---------------- */
.footer { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); color: var(--muted); font-size: 12px; letter-spacing: .04em; flex-wrap: wrap; text-align: center; }
.footer .eta-badge { background: #fff; border-radius: 12px; padding: 2px 6px; display: inline-flex; align-items: center; box-shadow: 0 6px 24px -8px rgba(59, 130, 246, .6), 0 0 0 1px rgba(255, 255, 255, .6); transition: transform .3s; }
.footer .eta-badge:hover { transform: translateY(-2px) scale(1.04); }
.footer .eta-badge img { height: 54px; display: block; }
.footer b { color: var(--text); font-weight: 600; }

/* ---------------- cards ---------------- */
.grid { display: grid; gap: 18px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }

.card {
  position: relative; background: linear-gradient(160deg, var(--glass-2), var(--glass)); border-radius: var(--radius);
  padding: 18px 18px; box-shadow: var(--shadow); backdrop-filter: blur(16px) saturate(130%); -webkit-backdrop-filter: blur(16px) saturate(130%);
  transform-style: preserve-3d; transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s; min-width: 0;
  animation: rise .6s cubic-bezier(.2, .8, .2, 1) both;
}
.card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(400px 160px at var(--mx, 50%) var(--my, 0%), rgba(125, 211, 252, .12), transparent 70%); opacity: 0; transition: opacity .3s; }
.card:hover::after { opacity: 1; }
.card.tilt:hover { box-shadow: 0 30px 60px -25px rgba(34, 211, 238, .35), 0 0 0 1px var(--border-hi) inset; }
.card h3 { margin: 0 0 14px; font-size: 13px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card h3 svg { width: 16px; height: 16px; color: var(--cyan); }
.card h3 .right { margin-left: auto; text-transform: none; letter-spacing: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.grid > .card:nth-child(2) { animation-delay: .05s; } .grid > .card:nth-child(3) { animation-delay: .1s; }
.grid > .card:nth-child(4) { animation-delay: .15s; } .grid > .card:nth-child(5) { animation-delay: .2s; }
.grid > .card:nth-child(6) { animation-delay: .25s; } .grid > .card:nth-child(7) { animation-delay: .3s; }

.kpi { display: flex; align-items: center; gap: 14px; }
.kpi .ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: none; background: linear-gradient(135deg, rgba(34, 211, 238, .25), rgba(167, 139, 250, .2)); box-shadow: 0 0 30px -6px rgba(34, 211, 238, .55), 0 0 0 1px rgba(125, 211, 252, .25) inset; transform: translateZ(30px); }
.kpi .ic svg { width: 26px; height: 26px; color: #fff; }
.kpi .ic.green { background: linear-gradient(135deg, rgba(52, 211, 153, .35), rgba(163, 230, 53, .15)); box-shadow: 0 0 30px -6px rgba(52, 211, 153, .6); }
.kpi .ic.red { background: linear-gradient(135deg, rgba(244, 63, 94, .4), rgba(251, 146, 60, .2)); box-shadow: 0 0 30px -6px rgba(244, 63, 94, .6); }
.kpi .ic.amber { background: linear-gradient(135deg, rgba(251, 191, 36, .35), rgba(251, 146, 60, .2)); box-shadow: 0 0 30px -6px rgba(251, 191, 36, .6); }
.kpi .ic.violet { background: linear-gradient(135deg, rgba(167, 139, 250, .4), rgba(244, 114, 182, .2)); box-shadow: 0 0 30px -6px rgba(167, 139, 250, .6); }
.kpi .v { font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; }
.kpi .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .s { font-size: 11px; color: var(--dim); margin-top: 3px; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* gauges */
.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gauge { position: relative; display: grid; place-items: center; }
.gauge svg { width: 100%; max-width: 130px; transform: rotate(-90deg); overflow: visible; }
.gauge .track { stroke: rgba(125, 211, 252, .1); }
.gauge .bar { transition: stroke-dashoffset 1.2s cubic-bezier(.2, .8, .2, 1); filter: drop-shadow(0 0 6px currentColor); }
.gauge .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.gauge .val b { font-size: 20px; display: block; }
.gauge .val span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; }

/* WAN hero */
.wan-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.wan-line { flex: 1; min-width: 220px; height: 64px; position: relative; }
.wan-line canvas { width: 100%; height: 100%; display: block; }
.wan-badge { font-size: 22px; font-weight: 800; }
.wan-sub { color: var(--muted); font-size: 12px; }

/* list */
.dev-list { display: flex; flex-direction: column; gap: 6px; max-height: 470px; overflow-y: auto; padding-right: 4px; }
.dev-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: rgba(125, 211, 252, .04); border: 1px solid transparent; transition: .2s; cursor: pointer; }
.dev-row:hover { border-color: var(--border); background: rgba(125, 211, 252, .08); transform: translateX(3px); }
.dev-row .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.dev-row .ip { color: var(--dim); font-family: var(--mono); font-size: 12px; }
.dev-row .lat { font-family: var(--mono); font-size: 12px; min-width: 64px; text-align: right; }

.events { display: flex; flex-direction: column; gap: 2px; }
.ev { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; padding: 9px 4px; border-bottom: 1px dashed rgba(125, 211, 252, .08); }
.ev:last-child { border-bottom: 0; }
.ev .t { color: var(--dim); font-size: 11px; font-family: var(--mono); grid-column: 2; }
.ev .m { font-size: 13px; }
.ev .lv { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; grid-row: span 2; }
.lv.info { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.lv.warning { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.lv.error { background: var(--red); box-shadow: 0 0 8px var(--red); }

.chart-box { position: relative; height: 240px; }
.chart-box.sm { height: 160px; }
.chart-box.lg { height: 320px; }

/* ---------------- tabs ---------------- */
.tabs { display: flex; gap: 6px; padding: 5px; border-radius: 14px; background: var(--glass); border: 1px solid var(--border); overflow-x: auto; margin-bottom: 18px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 9px 14px; border-radius: 10px; color: var(--muted); cursor: pointer; white-space: nowrap; font-weight: 600; display: flex; gap: 8px; align-items: center; transition: .2s; }
.tabs button svg { width: 16px; height: 16px; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: #04121f; background: var(--grad); box-shadow: 0 6px 20px -6px rgba(34, 211, 238, .7); }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; padding: 10px 12px; background: rgba(125, 211, 252, .05); white-space: nowrap; position: sticky; top: 0; }
td { padding: 10px 12px; border-top: 1px solid rgba(125, 211, 252, .07); vertical-align: middle; }
tr:hover td { background: rgba(125, 211, 252, .03); }
td.mono, .mono { font-family: var(--mono); font-size: 12px; }
td .sub { display: block; color: var(--dim); font-size: 11px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.b-ok { background: rgba(52, 211, 153, .14); color: var(--green); box-shadow: 0 0 0 1px rgba(52, 211, 153, .3) inset; }
.b-err { background: rgba(244, 63, 94, .14); color: #fb7185; box-shadow: 0 0 0 1px rgba(244, 63, 94, .3) inset; }
.b-warn { background: rgba(251, 191, 36, .14); color: var(--amber); box-shadow: 0 0 0 1px rgba(251, 191, 36, .3) inset; }
.b-info { background: rgba(34, 211, 238, .12); color: var(--cyan); box-shadow: 0 0 0 1px rgba(34, 211, 238, .3) inset; }
.b-vio { background: rgba(167, 139, 250, .14); color: var(--violet); box-shadow: 0 0 0 1px rgba(167, 139, 250, .3) inset; }
.b-gray { background: rgba(139, 163, 193, .12); color: var(--muted); }
.empty { text-align: center; color: var(--dim); padding: 26px; }

/* ---------------- forms / buttons ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; padding: 10px 16px; border-radius: 12px; font-weight: 700; color: #04121f; background: var(--grad); box-shadow: 0 10px 24px -10px rgba(34, 211, 238, .8); transition: transform .15s, box-shadow .2s, filter .2s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.1); box-shadow: 0 14px 30px -10px rgba(34, 211, 238, .9); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; }
.btn.ghost { background: rgba(125, 211, 252, .08); color: var(--text); box-shadow: 0 0 0 1px var(--border) inset; }
.btn.ghost:hover { box-shadow: 0 0 0 1px var(--border-hi) inset; }
.btn.danger { background: var(--grad-warm); color: #fff; box-shadow: 0 10px 24px -10px rgba(244, 63, 94, .8); }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 9px; }
.btn.icon { padding: 7px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row .grow { flex: 1; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field .hint { font-size: 11px; color: var(--dim); }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; border-radius: 12px; background: rgba(2, 8, 20, .6); border: 1px solid var(--border); outline: none; transition: .2s;
}
.input:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(34, 211, 238, .15); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 12px; }
.check input { width: 18px; height: 18px; accent-color: var(--cyan); }

/* ---------------- modal / toast ---------------- */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(1, 4, 12, .7); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.modal { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: linear-gradient(160deg, #0c1a2e, #081222); border-radius: 20px; padding: 22px; box-shadow: 0 40px 80px -20px #000, 0 0 0 1px var(--border-hi) inset; animation: pop .35s cubic-bezier(.2, 1.3, .3, 1); }
.modal h2 { margin: 0 0 16px; font-size: 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.9) translateY(20px) rotateX(10deg); } }
.toasts { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: 12px; background: rgba(8, 18, 34, .96); border: 1px solid var(--border-hi); box-shadow: var(--shadow); animation: pop .3s; font-size: 13px; }
.toast.err { border-color: rgba(244, 63, 94, .6); }
.toast.ok { border-color: rgba(52, 211, 153, .6); }

/* ---------------- network 3D ---------------- */
.net-wrap { position: relative; height: calc(100vh - 210px); min-height: 460px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: radial-gradient(ellipse at center, #071a2e 0%, #020611 75%); }
.net-wrap canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.net-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.nlabel { position: absolute; transform: translate(-50%, 0); white-space: nowrap; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 8px; background: rgba(3, 10, 22, .72); border: 1px solid rgba(125, 211, 252, .2); color: var(--text); pointer-events: auto; cursor: pointer; transition: opacity .2s; backdrop-filter: blur(4px); }
.nlabel small { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); font-weight: 400; }
.nlabel.down { border-color: rgba(244, 63, 94, .6); color: #fecdd3; }
.nlabel.sel { border-color: var(--cyan); box-shadow: 0 0 16px rgba(34, 211, 238, .6); }
.net-legend { position: absolute; left: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); background: rgba(3, 10, 22, .7); border: 1px solid var(--border); padding: 10px 12px; border-radius: 12px; backdrop-filter: blur(6px); }
.net-legend i { display: inline-block; width: 22px; height: 3px; border-radius: 3px; vertical-align: middle; margin-right: 8px; }
.net-hud { position: absolute; left: 14px; top: 14px; right: 14px; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.net-hud > * { pointer-events: auto; }
.net-panel { position: absolute; right: 14px; top: 64px; width: 330px; max-width: calc(100% - 28px); max-height: calc(100% - 80px); overflow: auto; background: rgba(5, 14, 28, .9); border: 1px solid var(--border-hi); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); backdrop-filter: blur(10px); animation: slidein .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } }
.net-panel h4 { margin: 0 0 4px; font-size: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 12px; margin: 12px 0; }
.kv span:nth-child(odd) { color: var(--muted); }
.kv span:nth-child(even) { font-family: var(--mono); word-break: break-word; }
.site-chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- mobile nav ---------------- */
.bottom-nav { display: none; }
.hamb { display: none; }

@media (max-width: 1200px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span-3 { grid-column: 1 / -1; } }
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .topbar { padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; gap: 10px; }
  .topbar .mobile-logo { display: block; }
  .topbar h1 { font-size: 16px; }
  .topbar .wan-pill-desk, .user-btn .meta { display: none; }
  .content { padding: 16px 16px 100px; }
  .g-4, .g-3, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .g-4.keep-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2, .span-3 { grid-column: auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi .v { font-size: 21px; }
  .kpi .ic { width: 44px; height: 44px; border-radius: 13px; }
  .net-wrap { height: calc(100vh - 230px); min-height: 380px; }
  .net-panel { left: 10px; right: 10px; width: auto; top: auto; bottom: 10px; max-height: 55%; }
  .net-legend { display: none; }
  .nlabel { font-size: 10px; padding: 2px 6px; }
  .nlabel small { display: none; }
  .nlabel.sel small { display: block; }
  .footer { padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
  .bottom-nav {
    display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 30;
    background: rgba(6, 16, 30, .88); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--border);
    border-radius: 20px; padding: 6px; justify-content: space-around; box-shadow: 0 20px 40px -10px #000;
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px; border-radius: 14px; color: var(--muted); font-size: 10px; font-weight: 600; text-decoration: none; transition: .2s; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: #04121f; background: var(--grad); box-shadow: 0 6px 20px -6px rgba(34, 211, 238, .8); }
  .menu { right: 12px; top: 58px; }
  .hide-m { display: none !important; }
}
@media (max-width: 420px) { .g-4.keep-2 { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------------- login ---------------- */
.login-page { min-height: 100vh; display: flex; flex-direction: column; position: relative; z-index: 1; }
.login-center { flex: 1; display: grid; place-items: center; padding: 24px 16px; perspective: 1200px; }
.login-card { width: 100%; max-width: 410px; padding: 30px 28px; border-radius: 26px; background: linear-gradient(160deg, rgba(14, 30, 52, .7), rgba(6, 14, 28, .78)); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); box-shadow: 0 50px 100px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(125, 211, 252, .22) inset, 0 0 80px -30px rgba(34, 211, 238, .5); transform-style: preserve-3d; transition: transform .2s ease-out; animation: pop .8s cubic-bezier(.2, 1.2, .3, 1); }
.login-card .logo { display: block; width: 210px; margin: 0 auto 6px; filter: drop-shadow(0 0 24px rgba(52, 211, 153, .45)); transform: translateZ(40px); }
.login-card .claim { text-align: center; font-size: 11px; letter-spacing: .32em; text-transform: uppercase; margin-bottom: 22px; }
.login-card h2 { text-align: center; margin: 0 0 18px; font-size: 15px; font-weight: 600; color: var(--muted); }
.login-card .btn { width: 100%; padding: 13px; font-size: 15px; margin-top: 6px; }
.input-ic { position: relative; }
.input-ic svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.input-ic .input { padding-left: 42px; }
.err-box { background: rgba(244, 63, 94, .12); border: 1px solid rgba(244, 63, 94, .4); color: #fecdd3; padding: 10px 12px; border-radius: 12px; font-size: 13px; margin-bottom: 12px; animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.login-info { text-align: center; color: var(--dim); font-size: 11px; margin-top: 16px; line-height: 1.6; }
.spin { width: 18px; height: 18px; border: 2px solid rgba(4, 18, 31, .3); border-top-color: #04121f; border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 60px; color: var(--muted); }
.loading .spin { width: 36px; height: 36px; border-color: rgba(34, 211, 238, .2); border-top-color: var(--cyan); }
.progress { height: 8px; border-radius: 8px; background: rgba(125, 211, 252, .1); overflow: hidden; }
.progress > div { height: 100%; border-radius: 8px; background: var(--grad); box-shadow: 0 0 12px var(--cyan); transition: width 1s; }
.code { font-family: var(--mono); font-size: 12px; background: rgba(2, 8, 20, .7); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; word-break: break-all; color: #bae6fd; }
.note { font-size: 12px; color: var(--muted); line-height: 1.6; }
.sect-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; margin: 22px 0 10px; }
