:root {
  --bg: #f4f6fb; --surface: #ffffff; --surface-2: #f0f3fa; --border: #e3e8f2;
  --text: #151a2d; --muted: #6b7491; --accent: #4f6bff; --accent-2: #3a53e0; --accent-soft: #e9edff;
  --green: #12b76a; --orange: #f79009; --red: #f04438; --grey: #98a2b3; --blue: #2e90fa;
  --shadow: 0 8px 30px rgba(20, 30, 70, .10); --shadow-sm: 0 1px 3px rgba(20, 30, 70, .08);
  --radius: 14px; --sidebar: 360px;
}
[data-theme="dark"] {
  --bg: #0d111c; --surface: #151a28; --surface-2: #1c2233; --border: #262d42;
  --text: #e8ecf8; --muted: #8e98b5; --accent: #6d86ff; --accent-2: #8a9dff; --accent-soft: #232b4d;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45); --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 500; transition: .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: rgba(240, 68, 56, .1); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 8px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
input:not([type=checkbox]):not([type=radio]):not([type=range]), select {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); outline: none; transition: .15s;
}
input:not([type=checkbox]):not([type=radio]):not([type=range]), select { color: var(--text); color-scheme: light; }
[data-theme="dark"] input:not([type=checkbox]):not([type=radio]):not([type=range]), [data-theme="dark"] select { color-scheme: dark; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.err { color: var(--red); font-size: 13px; min-height: 18px; margin: 4px 0 10px; }

/* login */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #8a5cff); display: grid; place-items: center; color: #fff; }
.login-card h1 { font-size: 22px; margin: 22px 0 4px; }
.login-card .btn { width: 100%; padding: 11px; }

/* app layout */
.app { height: 100%; display: grid; grid-template-rows: 58px 1fr; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 1200; }
.topbar .sp { flex: 1; }
.main { position: relative; display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 0; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; z-index: 1100; }
.sidebar .head { padding: 14px 14px 8px; }
.tabs { display: flex; gap: 4px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.tab { padding: 9px 12px; border: 0; background: none; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--accent); border-color: var(--accent); }
.list { flex: 1; overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
#map { height: 100%; width: 100%; background: var(--surface-2); }

.dev { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; border: 1px solid var(--border); cursor: pointer; transition: .15s; background: var(--surface); }
.dev:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.dev.sel { border-color: var(--accent); background: var(--accent-soft); }
.dev .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--grey); }
.dev .nm { font-weight: 600; }
.dev .st { font-size: 12.5px; color: var(--muted); }
.dev .tm { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.s-moving .ic, .mk-moving { background: var(--green) !important; }
.s-idle .ic, .mk-idle { background: var(--orange) !important; }
.s-alarm .ic, .mk-alarm { background: var(--red) !important; }
.s-parked .ic, .mk-parked { background: var(--blue) !important; }
.s-offline .ic, .s-never .ic, .mk-offline, .mk-never { background: var(--grey) !important; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--grey); }
.dot.s-moving { background: var(--green); } .dot.s-idle { background: var(--orange); } .dot.s-parked { background: var(--blue); } .dot.s-alarm { background: var(--red); }

.ev { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.ev:hover { border-color: var(--accent); }
.ev .bd { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.ev .bd.on { background: var(--green); } .ev .bd.off { background: var(--red); }

/* detail panel */
.panel { position: absolute; top: 14px; right: 14px; width: 380px; max-height: calc(100% - 28px); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); z-index: 1000; display: flex; flex-direction: column; overflow: hidden; }
.panel .ph { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel .ph h2 { margin: 0; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); }
.panel .pb { overflow: auto; padding: 14px 16px 16px; }
.panel-speed { display: none; }
.location-button { position: absolute; z-index: 800; top: 14px; left: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.own-location { width: 34px; height: 34px; display: grid; place-items: center; pointer-events: none; }
.own-location span { width: 14px; height: 14px; border: 2px solid #fff; border-radius: 50%; background: #1687ff; box-shadow: 0 1px 5px #0005; position: relative; }
.own-location span::before { content: ''; position: absolute; inset: -9px; border-radius: 50%; background: #1687ff40; animation: location-pulse 2s ease-out infinite; }
@keyframes location-pulse { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .own-location span::before { animation: none; } }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { grid-template-columns: 1fr 1fr 1fr; }
.grid3 .stat { padding: 8px 10px; }
.grid3 .stat b { font-size: 13.5px; }
.grid3 .stat small { font-size: 10px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 17px; letter-spacing: -.01em; }
.stat small { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.sec { margin: 18px 0 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.history-head .sec { margin: 18px 0 8px; }
.history-head .btn { margin: 8px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface); padding: 5px 11px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 500; }
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.custom { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.custom .btn { grid-column: span 2; }
.trip { padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; margin-bottom: 6px; }
.trip:hover, .trip.sel { border-color: var(--accent); background: var(--accent-soft); }
.trip .r1 { display: flex; justify-content: space-between; font-weight: 600; }
.trip .r2 { color: var(--muted); font-size: 12.5px; display: flex; gap: 12px; margin-top: 2px; }
.play { display: flex; align-items: center; gap: 10px; background: var(--surface-2); padding: 10px 12px; border-radius: 12px; }
.play input[type=range] { flex: 1; accent-color: var(--accent); }
.play .info { font-size: 12.5px; color: var(--muted); min-width: 0; }

/* map markers */
.mk { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .35); display: grid; place-items: center; color: #fff; }
.mk.gl-marker { overflow: visible; }
.mapbox-dark .mapboxgl-canvas { filter: brightness(.84) saturate(.88); }
.mk.gl-marker::after { content: attr(data-label); position: absolute; top: 34px; left: 50%; transform: translateX(-50%); width: max-content; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--border); border-radius: 7px; padding: 1px 7px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font: 600 12px/1.5 system-ui, sans-serif; }
.mk svg { width: 16px; height: 16px; fill: #fff; transition: transform .4s; }
.mk.sel { outline: 3px solid var(--accent); outline-offset: 2px; }
.leaflet-tooltip.mk-label { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font-weight: 600; box-shadow: var(--shadow-sm); padding: 2px 8px; }
.leaflet-tooltip.mk-label::before { display: none; }
.pt { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff; color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.pt.a { background: var(--green); } .pt.b { background: var(--red); } .pt.on { background: var(--green); } .pt.off { background: var(--orange); }
.pt.cur { background: var(--accent); }
.legend { position: absolute; left: calc(var(--sidebar) + 14px); bottom: 24px; z-index: 900; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; font-size: 12px; box-shadow: var(--shadow-sm); display: flex; gap: 12px; }

/* toasts */
.toasts { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--green); border-radius: 12px; padding: 10px 16px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; animation: slide .25s; }
.toast.off { border-left-color: var(--orange); }
@keyframes slide { from { opacity: 0; transform: translateY(-10px); } }

/* dialogs */
dialog { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); padding: 0; box-shadow: var(--shadow); width: min(560px, 94vw); max-height: 90vh; }
dialog.wide { width: min(940px, 96vw); height: min(680px, 90vh); }
dialog::backdrop { background: rgba(10, 14, 30, .55); backdrop-filter: blur(3px); }
.dlg { display: flex; flex-direction: column; max-height: inherit; height: 100%; }
.dlg header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.dlg header h3 { margin: 0; flex: 1; font-size: 17px; }
.dlg .body { padding: 18px 20px; overflow: auto; flex: 1; }
.dlg footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.checks { border: 1px solid var(--border); border-radius: 10px; max-height: 170px; overflow: auto; padding: 6px; }
.checks label { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.checks label:hover { background: var(--surface-2); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
td.act { text-align: right; white-space: nowrap; }
.badge { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); }
.badge.admin { background: var(--accent-soft); color: var(--accent); }
.badge.off { background: rgba(240, 68, 56, .12); color: var(--red); }
.badge.on { background: rgba(18, 183, 106, .14); color: var(--green); }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; }
.menu { position: absolute; right: 12px; top: 54px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 210px; z-index: 2000; }
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; background: none; border: 0; padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu .who { padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

.only-mobile { display: none; }
.tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.9) saturate(.7); }
.push-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border-bottom: 1px solid var(--border); }
.push-row .muted { font-size: 12px; margin-top: 2px; }
.push-actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; flex: none; }
.sheet-grab { display: none; }
.install-steps { line-height: 1.65; }
.install-steps ol { padding-left: 24px; }
.install-steps li { padding: 4px 0; }
.install-note { margin-top: 18px; padding: 12px; border-radius: 12px; background: var(--accent-soft); }
@media (max-width: 900px) {
  :root { --sidebar: 100%; }
  html, body, #root { height: 100%; height: 100dvh; }
  body { overflow: hidden; }
  .app { position: relative; display: block; height: 100%; height: 100dvh; overflow: hidden; }
  .topbar {
    position: absolute; top: env(safe-area-inset-top); left: 0; right: 0; height: 58px;
    padding: 0 10px; background: color-mix(in srgb, var(--surface) 88%, transparent);
    border: 0; box-shadow: 0 2px 18px rgba(20, 30, 70, .08); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  }
  .topbar .brand { font-size: 16px; gap: 7px; }
  .topbar .logo { width: 30px; height: 30px; border-radius: 50%; }
  .topbar > .btn { min-width: 38px; min-height: 38px; padding: 9px; font-size: 0; gap: 0; border-radius: 50%; }
  .topbar > .btn svg.i { width: 19px; height: 19px; }
  .topbar > .topbar-install { min-width: 0; padding: 8px 10px; gap: 6px; border-radius: 12px; font-size: 12px; }
  .topbar-geofences, .topbar-admin, .topbar-theme { display: none !important; }
  .topbar > .only-mobile { display: none !important; }
  .main { position: absolute; inset: 0; display: block; overflow: hidden; }
  .main > div { position: absolute !important; inset: 0; }
  .sidebar {
    position: absolute; top: auto; bottom: 10px; left: 10px; right: 10px; width: auto; height: min(228px, 31vh);
    display: flex; overflow: hidden; border: 1px solid rgba(255,255,255,.68); border-radius: 24px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 12px 40px rgba(12, 20, 42, .2); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    transform: none; transition: height .24s ease, opacity .2s ease, transform .2s ease;
  }
  .sidebar.open { height: min(68vh, 640px); transform: none; }
  .sidebar.collapsed { height: 42px; }
  .sidebar.collapsed > :not(.sheet-grab) { display: none; }
  .sidebar .head { padding: 4px 14px 7px; }
  .sidebar .head input { min-height: 40px; border-radius: 14px; background: var(--surface-2); border-color: transparent; }
  .sheet-grab { display: flex; align-items: center; justify-content: center; flex: none; width: 100%; height: 40px; gap: 8px; border: 0; background: transparent; cursor: grab; touch-action: none; }
  .sheet-grab span { width: 36px; height: 5px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 40%, transparent); }
  .sheet-grab small { color: var(--muted); font-size: 11px; font-weight: 600; }
  .tabs { display: none; }
  .tab { padding: 7px 10px; }
  .list { min-height: 0; padding: 8px 12px 12px; overscroll-behavior: contain; }
  .dev, .ev { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 10px 5px; background: transparent; }
  .dev.sel { border-radius: 14px; background: var(--accent-soft); }
  .dev .ic { border-radius: 50%; }
  .panel {
    top: auto; bottom: 10px; right: 10px; left: 10px; width: auto;
    max-height: min(68vh, 640px); border: 1px solid rgba(255,255,255,.68); border-radius: 24px;
    background: color-mix(in srgb, var(--surface) 95%, transparent);
    box-shadow: 0 12px 40px rgba(12, 20, 42, .22); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  }
  .panel .ph { padding: 15px 16px 12px; }
  .panel .detail-grab { height: 28px; }
  .panel .ph { flex: none; padding-top: 4px; }
  .panel .detail-grab small { display: none; }
  .panel.details-collapsed .pb { display: none; }
  .panel.details-collapsed .ph .pill, .panel.details-collapsed .ph > .dot { display: none; }
  .panel.details-collapsed .panel-speed { display: inline; white-space: nowrap; font-weight: 700; color: var(--accent); }
  .location-button { top: calc(env(safe-area-inset-top) + 72px); left: 12px; }
  .panel .pb { padding: 12px 16px calc(18px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
  .panel .ph h2 { font-size: 18px; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .legend { display: none; }
  .mobile-selection .sidebar { opacity: 0; pointer-events: none; transform: translateY(12px); }
  .notif { position: fixed; z-index: 2300; top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); left: 10px; right: 10px; width: auto; max-height: min(82vh, 720px); border-radius: 24px; padding: 8px; }
  .notif .who { padding: 10px; }
  .notif .nrow { padding: 10px; }
  .notif .push-row { align-items: flex-start; }
  .install-dialog { width: min(440px, calc(100vw - 24px)); max-height: min(82dvh, 700px); border-radius: 24px; }
  .install-dialog .dlg header { padding: 14px 16px; }
  .install-dialog .dlg .body { padding: 16px; }
  .install-dialog .dlg footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .toasts { top: calc(env(safe-area-inset-top) + 66px); width: calc(100% - 24px); }
  .toast { max-width: 100%; }
  .menu:not(.notif) { top: calc(env(safe-area-inset-top) + 54px); right: 8px; }
  .leaflet-bottom.leaflet-right { bottom: 54px; }
  .mobile-sheet-open .leaflet-bottom.leaflet-right { bottom: min(69vh, 650px); }
  .mobile-selection .leaflet-bottom.leaflet-right { bottom: min(69vh, 650px); }
  .mobile-selection.mobile-panel-collapsed .leaflet-bottom.leaflet-right { bottom: 110px; }
  .install-note.warning { background: color-mix(in srgb, var(--orange) 15%, var(--surface)); }
}
@media (max-width: 380px) {
  .topbar { gap: 4px; padding: 0 7px; }
  .topbar .brand { font-size: 14px; }
  .topbar > .btn { min-width: 34px; min-height: 34px; padding: 7px; }
  .topbar > .topbar-install { min-width: 0; padding: 7px; gap: 5px; font-size: 11px; }
}

/* ---- notifications & geofences ---- */
.ev .bd.purple, .bd.purple { background: #8a5cff; } .ev .bd.red, .bd.red { background: var(--red); }
.pt.purple { background: #8a5cff; } .pt.red { background: var(--red); }
.toast.red { border-left-color: var(--red); } .toast.purple { border-left-color: #8a5cff; }
.iorow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.iorow + .iorow { border-top: 1px solid var(--border); }
.iobtn { border: 0; border-radius: 10px; padding: 8px 18px; min-width: 96px; font: inherit; font-weight: 600; color: #fff; background: var(--grey); cursor: pointer; }
.iobtn.on { background: var(--green); } .iobtn.off { background: var(--red); }
.iobtn:disabled { cursor: default; }
.iobtn.pulse { animation: iopulse 1.1s ease-in-out infinite; }
@keyframes iopulse { 0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 255, 255, .35); } 50% { opacity: .55; box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); } }
.iostate { font-weight: 600; color: var(--grey); } .iostate.on { color: var(--green); } .iostate.off { color: var(--red); }
.stat.ok b { color: var(--green); } .stat.bad b { color: var(--red); }
.menu.notif { width: 340px; padding: 8px; max-height: calc(100vh - 80px); overflow: auto; right: 150px; }
.nrow { padding: 10px; border-radius: 10px; }
.nrow + .nrow { border-top: 1px solid var(--border); }
.nhead { display: flex; align-items: center; gap: 12px; }
.nic { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.ntx { flex: 1; min-width: 0; } .ntx .muted { font-size: 12px; }
.nextra { margin: 10px 0 0 46px; display: grid; gap: 8px; }
.nextra .opts { display: flex; gap: 16px; }
.nextra .opts label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.nextra .limit { display: flex; align-items: center; gap: 8px; }
.nextra .limit input { width: 90px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); }
.switch { position: relative; width: 44px; height: 26px; flex: none; display: inline-block; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.slider { position: absolute; inset: 0; background: var(--grey); border-radius: 26px; transition: .2s; }
.slider::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.gf-label { background: transparent; border: 0; box-shadow: none; color: #8a5cff; font-weight: 700; font-size: 13px; text-shadow: 0 0 3px var(--surface), 0 0 3px var(--surface); }
.gf-label::before { display: none; }
.gf-list { display: grid; gap: 6px; }
.gf-item, .gf-res { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; }
.gf-new { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.gf-search { display: flex; gap: 8px; margin-bottom: 8px; } .gf-search input { flex: 1; }
.gf-results { display: grid; gap: 6px; }
.gf-rn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switchrow { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.draw-bar { position: absolute; z-index: 1500; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; background: var(--surface); padding: 6px; border-radius: 14px; box-shadow: var(--shadow); border: 1px solid var(--border); flex-wrap: wrap; justify-content: center; }
.draw-hint { position: absolute; z-index: 1500; bottom: 64px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 8px 16px; border-radius: 20px; font-size: 13px; box-shadow: var(--shadow); pointer-events: none; }
#map.drawing, #map.drawing .leaflet-interactive { cursor: crosshair; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.dsel { width: 100%; margin: 8px 0 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); }
.nhead.own { padding: 10px; background: var(--surface-2); border-radius: 10px; margin: 6px 0; }
.nrow.ro { opacity: .55; }

.logbar { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; } .logbar .dsel { width: auto; flex: 1; min-width: 150px; }
.logbox { display: grid; gap: 6px; }
.logrow { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; font-size: 13.5px; }
.logrow.warn { border-color: var(--red); } .logrow.warn .nic { background: rgba(240, 68, 56, .12); color: var(--red); }
.security-stat { width: 100%; border: 1px solid var(--border); text-align: left; cursor: pointer; color: var(--text); font: inherit; }
.security-stat:hover, .security-stat:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.security-row { width: 100%; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.security-row:hover, .security-row:focus-visible { border-color: var(--accent); background: var(--surface-2); }
.security-details { margin-top: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.security-details .toolbar { margin-bottom: 8px; }
.security-table-wrap { max-width: 100%; overflow-x: auto; }
.security-table-wrap table { min-width: 580px; }

.addr { margin-top: 12px; display: grid; gap: 4px; }
.addr-t { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; line-height: 1.3; }
.addr-t .i { flex: none; color: var(--accent); margin-top: 1px; }
.addr a { font-size: 12px; padding-left: 26px; }
