:root {
  --bg: #050d14;
  --bg-2: #07131d;
  --panel: #0b1a26;
  --panel-2: #0e2231;
  --panel-3: #122b3d;
  --line: #1b3a4e;
  --line-soft: #142c3d;
  --text: #e7f2f8;
  --muted: #7f9bae;
  --muted-2: #5f7d90;
  --accent: #25d7ff;
  --accent-2: #17b8dd;
  --accent-soft: rgba(37, 215, 255, .12);
  --green: #34d399;
  --amber: #fbbf24;
  --orange: #fb923c;
  --red: #f87171;
  --violet: #a78bfa;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  --radius: 14px;
  --sidebar: 236px;
  --topbar: 66px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(28, 118, 158, .18), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(16, 185, 129, .08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.nowrap { white-space: nowrap; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1d3b4f; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #2a5671; }

/* ---------- brand + login ---------- */
.login-screen { display: grid; grid-template-columns: 1.15fr .85fr; min-height: 100vh; }
.login-visual {
  position: relative; overflow: hidden; padding: 48px 56px; display: flex; flex-direction: column;
  justify-content: space-between; background: linear-gradient(145deg, #06111a 0%, #081b28 55%, #0a2434 100%);
  border-right: 1px solid var(--line);
}
.login-grid {
  position: absolute; inset: 0; opacity: .35;
  background-image: linear-gradient(rgba(37, 215, 255, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(37, 215, 255, .08) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at 30% 40%, #000 0%, transparent 75%);
}
.login-visual::after {
  content: ""; position: absolute; width: 520px; height: 520px; right: -140px; bottom: -180px; border-radius: 50%;
  border: 1px solid rgba(37, 215, 255, .18); box-shadow: 0 0 0 60px rgba(37, 215, 255, .03), 0 0 0 130px rgba(37, 215, 255, .02);
}
.brand-lockup { position: relative; display: flex; align-items: center; gap: 14px; z-index: 1; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; letter-spacing: .5px;
  color: #04141d; background: linear-gradient(135deg, #7cecfc, #12b9df 55%, #0e8fb3); box-shadow: 0 0 30px rgba(37, 215, 255, .35);
}
.brand-mark.small { width: 36px; height: 36px; border-radius: 9px; font-size: 12px; }
.brand-title { font-weight: 750; letter-spacing: .2px; font-size: 17px; }
.brand-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; letter-spacing: .3px; }
.login-hero { position: relative; z-index: 1; max-width: 660px; }
.eyebrow { color: var(--accent); font-size: 11px; letter-spacing: 2.2px; font-weight: 650; margin-bottom: 18px; }
.login-hero h1 { font-size: clamp(34px, 4.2vw, 58px); line-height: 1.05; letter-spacing: -1.6px; margin: 0 0 22px; font-weight: 730; }
.login-hero p { color: #9db5c5; font-size: 16px; line-height: 1.65; max-width: 600px; }
.login-stats { display: flex; gap: 42px; margin-top: 38px; }
.login-stats div { display: flex; flex-direction: column; gap: 4px; }
.login-stats strong { font-size: 20px; color: var(--accent); letter-spacing: .5px; }
.login-stats span { color: var(--muted); font-size: 11.5px; }
.login-foot { position: relative; z-index: 1; color: var(--muted-2); font-size: 11.5px; letter-spacing: .3px; }
.login-panel { display: grid; place-items: center; padding: 38px; background: rgba(5, 13, 20, .55); }
.login-card { width: 100%; max-width: 390px; padding: 38px; border-radius: 20px; background: rgba(10, 26, 38, .82); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.login-card-head { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11.5px; letter-spacing: .5px; text-transform: uppercase; margin-bottom: 20px; }
.login-card h2 { margin: 0 0 6px; font-size: 27px; letter-spacing: -.5px; }
.login-card p { margin: 0 0 26px; }
.login-card label { display: block; font-size: 11.5px; color: var(--muted); margin: 16px 0 7px; letter-spacing: .3px; }
.login-card input { width: 100%; background: #071620; border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px; color: var(--text); outline: none; transition: border .18s, box-shadow .18s; }
.login-card input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(37, 215, 255, .08); }
.login-card .btn { margin-top: 24px; }
.login-error { min-height: 18px; color: var(--red); font-size: 12px; margin-top: 12px; }
.login-hint { color: var(--muted-2); font-size: 11.5px; line-height: 1.5; margin-top: 6px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted-2); }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 4px rgba(52, 211, 153, .11), 0 0 12px rgba(52, 211, 153, .55); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 20px;
  padding: 20px 14px; background: linear-gradient(180deg, #07131d 0%, #081824 100%);
  border-right: 1px solid var(--line-soft); z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 14px; border-bottom: 1px solid var(--line-soft); }
.nav { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; padding-right: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border: 1px solid transparent;
  background: transparent; color: #9fb7c7; border-radius: 10px; text-align: left; font-size: 13px; letter-spacing: .1px;
  transition: background .16s, color .16s, border .16s;
}
.nav-item:hover { background: rgba(37, 215, 255, .05); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(37, 215, 255, .14), rgba(37, 215, 255, .02)); color: var(--accent); border-color: rgba(37, 215, 255, .16); }
.nav-icon { width: 18px; height: 18px; display: grid; place-items: center; flex: 0 0 18px; }
.nav-icon svg { width: 17px; height: 17px; fill: currentColor; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; padding: 14px 8px 4px; border-top: 1px solid var(--line-soft); }
.sys-status { display: flex; gap: 10px; align-items: flex-start; }
.sys-status strong { display: block; font-size: 11.5px; color: #b8ccd8; }
.sys-status span { display: block; font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.sidebar-meta { font-size: 10px; color: #446275; letter-spacing: .4px; }
.shell { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar); position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 0 26px; background: rgba(5, 13, 20, .78); border-bottom: 1px solid var(--line-soft); backdrop-filter: blur(16px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; }
.global-search { position: relative; display: flex; align-items: center; gap: 10px; width: min(480px, 42vw); padding: 9px 12px; background: #071722; border: 1px solid var(--line-soft); border-radius: 10px; }
.global-search:focus-within { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(37, 215, 255, .06); }
.global-search svg { width: 16px; height: 16px; fill: var(--muted); flex: 0 0 16px; }
.global-search input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); min-width: 0; }
.global-search input::placeholder { color: #58788b; }
.global-search kbd { color: #5d7f93; border: 1px solid var(--line); border-radius: 5px; font-size: 10px; padding: 2px 5px; }
.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: #0a1e2b; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 420px; overflow: auto; padding: 6px; z-index: 90; }
.search-group { padding: 7px 9px 4px; color: var(--muted-2); font-size: 10px; text-transform: uppercase; letter-spacing: .9px; }
.search-result { display: flex; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.search-result:hover { background: rgba(37, 215, 255, .07); }
.search-result strong { font-weight: 600; font-size: 12.5px; }
.search-result span { color: var(--muted); font-size: 11px; }
.live-clock { color: #87a3b4; font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: .4px; white-space: nowrap; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line-soft); background: #081823; color: #9bb6c6; display: grid; place-items: center; }
.icon-btn:hover { color: var(--accent); border-color: rgba(37, 215, 255, .28); }
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; }
.icon-btn.tiny { width: 27px; height: 27px; border: 0; background: transparent; }
.mobile-menu { display: none; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 7px 5px 5px; border: 1px solid var(--line-soft); border-radius: 10px; background: #081823; }
.avatar { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, #1c5c74, #0f4155); color: #d8f6ff; font-weight: 700; font-size: 12px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta strong { font-size: 11.5px; font-weight: 600; }
.user-meta span { font-size: 10px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .5px; }
.view-root { flex: 1; min-width: 0; padding: 24px 26px 40px; }

/* ---------- shared ui ---------- */
.view { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.view-head h1 { margin: 0; font-size: 25px; letter-spacing: -.6px; }
.view-head p { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; }
.head-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border-radius: 9px; border: 1px solid var(--line); background: #0a1d2a; color: #c7dce8; font-size: 12.5px; transition: .16s; white-space: nowrap; }
.btn:hover { border-color: #2b566f; color: var(--text); }
.btn.primary { background: linear-gradient(180deg, #21c7ec, #13a3c4); border-color: #42e2ff; color: #04151e; font-weight: 700; box-shadow: 0 8px 20px rgba(23, 184, 221, .18); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(248, 113, 113, .35); color: #fca5a5; }
.btn.sm { padding: 6px 10px; font-size: 11.5px; border-radius: 7px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.panel { background: linear-gradient(180deg, rgba(12, 30, 43, .92), rgba(9, 23, 33, .92)); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 17px; border-bottom: 1px solid var(--line-soft); }
.panel-head h3 { margin: 0; font-size: 13px; letter-spacing: .1px; font-weight: 650; }
.panel-head span { color: var(--muted); font-size: 11px; }
.panel-body { padding: 16px 17px; }
.panel-body.tight { padding: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 16px; }
.kpi-card { position: relative; padding: 15px 16px 14px; border-radius: 12px; background: linear-gradient(160deg, rgba(15, 40, 56, .92), rgba(8, 22, 32, .95)); border: 1px solid var(--line-soft); overflow: hidden; }
.kpi-card::after { content: ""; position: absolute; width: 90px; height: 90px; right: -35px; top: -45px; border-radius: 50%; background: var(--accent-soft); filter: blur(8px); }
.kpi-label { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; display: flex; align-items: center; gap: 7px; }
.kpi-value { font-size: 27px; font-weight: 720; letter-spacing: -1px; margin-top: 7px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.kpi-foot { color: var(--muted-2); font-size: 10.5px; margin-top: 5px; }
.kpi-card.accent .kpi-value { color: var(--accent); }
.kpi-card.green .kpi-value { color: var(--green); }
.kpi-card.amber .kpi-value { color: var(--amber); }
.kpi-card.red .kpi-value { color: var(--red); }
.grid-2 { display: grid; grid-template-columns: 1.35fr .65fr; gap: 16px; }
.grid-2eq { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .2px; border: 1px solid transparent; white-space: nowrap; }
.chip.ok { background: rgba(52, 211, 153, .1); color: #6ee7b7; border-color: rgba(52, 211, 153, .22); }
.chip.review { background: rgba(251, 191, 36, .1); color: #fcd34d; border-color: rgba(251, 191, 36, .22); }
.chip.critical { background: rgba(248, 113, 113, .12); color: #fca5a5; border-color: rgba(248, 113, 113, .25); }
.chip.info { background: rgba(37, 215, 255, .09); color: #7ee8ff; border-color: rgba(37, 215, 255, .2); }
.chip.neutral { background: rgba(148, 163, 184, .1); color: #b5c7d3; border-color: rgba(148, 163, 184, .18); }
.chip.warning { background: rgba(251, 146, 60, .11); color: #fdba74; border-color: rgba(251, 146, 60, .24); }
.chip.violet { background: rgba(167, 139, 250, .11); color: #c4b5fd; border-color: rgba(167, 139, 250, .24); }
.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th { position: sticky; top: 0; background: #0c2130; color: var(--muted); text-align: left; font-weight: 600; font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 2; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); color: #c3d6e2; vertical-align: middle; }
table.data tr:hover td { background: rgba(37, 215, 255, .035); }
table.data tr.clickable { cursor: pointer; }
table.data td strong { color: var(--text); font-weight: 600; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 12.5px; }
.loading { padding: 38px; display: grid; place-items: center; color: var(--muted); gap: 12px; }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #17374a; border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar label { color: var(--muted); font-size: 11px; }
.input, select.input, textarea.input { background: #071722; border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 8px 10px; outline: none; font-size: 12px; }
.input:focus { border-color: var(--accent-2); }
.input-search { min-width: 220px; }
.toggle { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11.5px; cursor: pointer; }
.toggle input { accent-color: var(--accent-2); }
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 138px 1fr 56px; gap: 10px; align-items: center; font-size: 11.5px; }
.bar-row span:first-child { color: #b5ccda; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 7px; border-radius: 999px; background: #0c2636; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; min-width: 3px; }
.bar-row b { text-align: right; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.issue-list { display: flex; flex-direction: column; }
.issue-row { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.issue-row:last-child { border-bottom: 0; }
.issue-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex: 0 0 7px; background: var(--muted); }
.issue-dot.critical { background: var(--red); box-shadow: 0 0 8px rgba(248, 113, 113, .6); }
.issue-dot.warning { background: var(--amber); }
.issue-dot.info { background: var(--accent); }
.issue-row strong { display: block; font-size: 11.5px; font-weight: 600; }
.issue-row span { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; line-height: 1.45; }
.mini-stat { display: flex; flex-direction: column; gap: 3px; padding: 11px 12px; border-radius: 10px; background: #091b27; border: 1px solid var(--line-soft); }
.mini-stat strong { font-size: 18px; letter-spacing: -.4px; }
.mini-stat span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .5px; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }

/* ---------- map ---------- */
.map-layout { display: grid; grid-template-columns: 1fr 340px; gap: 14px; height: calc(100vh - var(--topbar) - 118px); min-height: 520px; }
.map-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #06121a; }
#campus-map { position: absolute; inset: 0; }
.map-toolbar { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px; border-radius: 10px; background: rgba(5, 16, 24, .82); border: 1px solid rgba(37, 215, 255, .13); backdrop-filter: blur(12px); }
.map-toolbar select, .map-toolbar input { background: #081c28; border: 1px solid #1b4054; color: var(--text); border-radius: 7px; padding: 7px 9px; font-size: 11.5px; }
.map-toolbar .spacer { flex: 1; }
.map-legend { position: absolute; left: 12px; bottom: 12px; z-index: 5; display: flex; flex-direction: column; gap: 5px; padding: 9px 11px; border-radius: 9px; background: rgba(5, 16, 24, .82); border: 1px solid rgba(37, 215, 255, .12); backdrop-filter: blur(10px); max-height: 220px; overflow: auto; }
.legend-row { display: flex; align-items: center; gap: 7px; font-size: 10px; color: #a9c2d1; }
.legend-swatch { width: 9px; height: 9px; border-radius: 2px; }
.map-scale { position: absolute; right: 12px; bottom: 12px; z-index: 5; color: var(--muted-2); font-size: 10px; background: rgba(5, 16, 24, .7); padding: 4px 7px; border-radius: 5px; }
.inspector { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.inspector-head { padding: 15px 16px; border-bottom: 1px solid var(--line-soft); }
.inspector-head h3 { margin: 0; font-size: 14px; }
.inspector-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.inspector-body { overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.kv { display: grid; grid-template-columns: 105px 1fr; gap: 7px; font-size: 11.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: #c9dce7; }
.detail-section h4 { margin: 0 0 8px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.detail-list { display: flex; flex-direction: column; gap: 6px; }
.detail-item { padding: 9px 10px; border-radius: 8px; background: #091b27; border: 1px solid var(--line-soft); font-size: 11.5px; }
.detail-item strong { display: block; font-weight: 600; }
.detail-item span { color: var(--muted); font-size: 10.5px; }
.maplibregl-popup-content { background: #0b2231 !important; color: var(--text) !important; border: 1px solid var(--line) !important; border-radius: 9px !important; font-family: inherit !important; font-size: 12px; box-shadow: var(--shadow); }
.maplibregl-popup-tip { border-top-color: #0b2231 !important; }
.maplibregl-ctrl-group { background: #0a1e2b !important; border: 1px solid var(--line) !important; }
.maplibregl-ctrl-group button span { filter: invert(1) brightness(1.8); }
.maplibregl-ctrl-attrib { background: rgba(5, 16, 24, .7) !important; color: var(--muted-2) !important; font-size: 9px !important; }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }

/* ---------- 3d twin ---------- */
.twin-layout { position: relative; height: calc(100vh - var(--topbar) - 118px); min-height: 520px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: radial-gradient(circle at 50% 30%, #0b2131 0%, #050d14 70%); }
#twin-canvas { position: absolute; inset: 0; }
.twin-overlay { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px; border-radius: 10px; background: rgba(5, 16, 24, .82); border: 1px solid rgba(37, 215, 255, .13); backdrop-filter: blur(12px); }
.twin-overlay select { background: #081c28; border: 1px solid #1b4054; color: var(--text); border-radius: 7px; padding: 7px 9px; font-size: 11.5px; }
.twin-controls { position: absolute; bottom: 14px; left: 14px; z-index: 5; display: flex; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 10px; background: rgba(5, 16, 24, .82); border: 1px solid rgba(37, 215, 255, .13); backdrop-filter: blur(12px); }
.twin-controls label { color: var(--muted); font-size: 10.5px; display: flex; align-items: center; gap: 8px; }
.twin-controls input[type=range] { accent-color: var(--accent); width: 130px; }
.twin-help { position: absolute; bottom: 14px; right: 14px; z-index: 5; color: var(--muted-2); font-size: 10px; background: rgba(5, 16, 24, .7); padding: 6px 8px; border-radius: 6px; }
.twin-inspector { position: absolute; right: 14px; top: 72px; width: 300px; max-height: calc(100% - 150px); z-index: 6; overflow: auto; }
.twin-floor-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; background: #0b2231; border: 1px solid var(--line); font-size: 10.5px; color: #b8d0de; }

/* ---------- modal + toast ---------- */
.modal-root { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: rgba(2, 8, 12, .72); backdrop-filter: blur(4px); }
.modal-card { width: min(680px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: #0a1b27; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); animation: pop .18s ease; }
@keyframes pop { from { transform: scale(.98); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { margin: 0; font-size: 17px; letter-spacing: -.3px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 18px; border-top: 1px solid var(--line-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 15px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 6px; }
.form-field input, .form-field select, .form-field textarea { width: 100%; background: #071722; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 10px; outline: none; }
.form-field textarea { min-height: 80px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--accent-2); }
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 260px; max-width: 380px; padding: 12px 14px; border-radius: 10px; background: #0b2231; border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 12px; animation: slide .22s ease; }
.toast.error { border-color: rgba(248, 113, 113, .35); }
.toast.success { border-color: rgba(52, 211, 153, .35); }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.public-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.public-card { width: min(420px, 100%); padding: 28px; border-radius: 18px; background: #0a1b27; border: 1px solid var(--line); box-shadow: var(--shadow); }
.public-card h1 { margin: 14px 0 4px; font-size: 22px; }
.public-card .tag { font-family: ui-monospace, monospace; color: var(--accent); letter-spacing: 1px; }
.qr-box { display: grid; place-items: center; padding: 16px; background: #fff; border-radius: 12px; margin: 16px 0; }
.qr-box img { width: 220px; height: 220px; display: block; }
.progress { height: 6px; border-radius: 999px; background: #0c2636; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, #13a3c4, #25d7ff); border-radius: 999px; }
.page-tabs { display: flex; gap: 4px; padding: 4px; background: #081823; border: 1px solid var(--line-soft); border-radius: 9px; width: fit-content; margin-bottom: 14px; }
.page-tabs button { border: 0; background: transparent; color: var(--muted); padding: 7px 12px; border-radius: 6px; font-size: 11.5px; }
.page-tabs button.active { background: #0f2c3f; color: var(--accent); }
.dropzone { border: 1px dashed #2b5870; border-radius: 10px; padding: 24px; text-align: center; color: var(--muted); font-size: 12px; background: rgba(37, 215, 255, .025); }
.dropzone.drag { border-color: var(--accent); background: rgba(37, 215, 255, .06); }
.file-name { color: var(--accent); font-size: 11.5px; margin-top: 8px; }
.callout { padding: 10px 12px; border-radius: 9px; background: rgba(37, 215, 255, .05); border: 1px solid rgba(37, 215, 255, .14); color: #a7c6d6; font-size: 11.5px; line-height: 1.5; }
.callout.warn { background: rgba(251, 191, 36, .06); border-color: rgba(251, 191, 36, .2); }
.callout.danger { background: rgba(248, 113, 113, .06); border-color: rgba(248, 113, 113, .2); }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.asset-card { padding: 14px; border-radius: 11px; background: #091b27; border: 1px solid var(--line-soft); }
.asset-card h4 { margin: 0 0 4px; font-size: 13px; }
.asset-card .tag { font-family: ui-monospace, monospace; color: var(--accent); font-size: 10.5px; }
.asset-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 160px; background: #0b2231; border: 1px solid var(--line); border-radius: 9px; padding: 5px; z-index: 50; box-shadow: var(--shadow); }
.dropdown-menu button { display: block; width: 100%; text-align: left; padding: 7px 9px; border: 0; background: transparent; color: #b8ccd8; border-radius: 6px; font-size: 11.5px; }
.dropdown-menu button:hover { background: rgba(37, 215, 255, .07); color: var(--text); }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .map-layout { grid-template-columns: 1fr 300px; }
}
@media (max-width: 920px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 240px; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .mobile-menu { display: grid; }
  .view-root { padding: 18px 16px 30px; }
  .map-layout { grid-template-columns: 1fr; height: auto; }
  .map-wrap { height: 62vh; }
  .inspector { max-height: 420px; }
  .twin-layout { height: 68vh; }
  .grid-3, .grid-2eq { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .live-clock { display: none; }
  .global-search { width: min(340px, 46vw); }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .login-panel { padding: 16px; }
  .login-card { padding: 26px; }
  .topbar-right .user-meta { display: none; }
  .global-search { width: 100%; }
  .topbar-left { flex: 1; }
  .view-head h1 { font-size: 21px; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 110px 1fr 46px; }
  .twin-inspector { width: calc(100% - 28px); right: 14px; left: 14px; top: auto; bottom: 74px; max-height: 48%; }
}
