/* Nordic theme for α²Tracking — light, airy, muted palette
 * Mirrors the aa-bms Nordic dashboard tone: warm whites (#faf9f7),
 * stone borders (#ece9e4), soft slate ink, DM Sans body. Tighter
 * type and density than the previous draft so the UI doesn't feel bulky.
 */

:root {
  --nd-bg:         #faf9f7;          /* warm white */
  --nd-surface:    #ffffff;
  --nd-surface-2:  #f5f3ef;          /* subtle fill */
  --nd-ink:        #2d3436;
  --nd-ink-2:      #4a4e54;
  --nd-muted:      #9ca3a8;
  --nd-border:     #ece9e4;
  --nd-border-2:   #e8e4df;
  --nd-accent:     #5a8bb0;          /* nordic dusty blue */
  --nd-accent-2:   #6b9ac4;
  --nd-ok:         #7aad8a;          /* sage */
  --nd-warn:       #d29e6f;          /* warm amber */
  --nd-danger:     #c97064;          /* muted brick */
  --nd-info:       #6b9ac4;
  --nd-radius:     8px;
  --nd-radius-sm:  6px;
  --nd-shadow:     0 1px 2px rgba(45,52,54,0.03);
  --nd-shadow-md:  0 2px 8px rgba(45,52,54,0.05);
  --nd-font:       'DM Sans', 'Inter', system-ui, -apple-system, sans-serif;
  --nd-mono:       'Space Mono', ui-monospace, monospace;

  --nd-fs-xs:      11px;
  --nd-fs-sm:      12px;
  --nd-fs-base:    13px;
  --nd-fs-md:      14px;
  --nd-fs-lg:      16px;
  --nd-fs-xl:      18px;
  --nd-fs-2xl:     22px;
}

* { box-sizing: border-box; }
html { font-size: 14px; }            /* shrink baseline so rem-sized Telerik chrome is tighter */
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--nd-font);
  background: var(--nd-bg);
  color: var(--nd-ink);
  font-size: var(--nd-fs-base);
  line-height: 1.5;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 { color: var(--nd-ink); letter-spacing: -0.005em; }

a { color: var(--nd-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout shell ---------- */
.nd-app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.nd-sidebar {
  background: #0f172a; color: #e2e8f0; padding: 24px 16px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.nd-sidebar .nd-logo {
  font-family: var(--nd-mono); font-size: 18px; letter-spacing: 1px;
  color: #fff; font-weight: 700; margin-bottom: 28px;
}
.nd-sidebar .nd-logo span { color: var(--nd-accent-2); }
.nd-sidebar nav a {
  display: block; padding: 8px 12px; margin: 3px 0; border-radius: 6px;
  color: #cbd5e1; font-weight: 500; font-size: 13px;
}
.nd-sidebar nav a:hover { background: #1e293b; color: #fff; text-decoration: none; }
.nd-sidebar nav a.active { background: var(--nd-accent); color: #fff; }

/* ---- SideBarMenu component ---- */
.nd-menu { margin-top: 8px; }
.nd-menu-section {
  font-size: 11px; letter-spacing: 1.5px; color: #64748b;
  text-transform: uppercase; padding: 14px 14px 6px 14px; font-weight: 700;
}
.nd-menu-group { margin-bottom: 2px; }
.nd-menu-group-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: none; cursor: pointer;
  padding: 7px 10px; border-radius: 6px; color: #cbd5e1; font-size: 13px; font-weight: 600;
  text-align: left; transition: background .12s ease;
}
.nd-menu-group-head:hover { background: #1e293b; color: #fff; }
.nd-menu-emoji { font-size: 16px; width: 22px; display: inline-block; }
.nd-menu-title { flex: 1; }
.nd-menu-caret { transition: transform .15s ease; opacity: .55; font-size: 14px; }
.nd-menu-group.open .nd-menu-caret { transform: rotate(90deg); }
.nd-menu-sub { padding: 4px 0 8px 34px; }
.nd-menu-link {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 6px; color: #94a3b8;
  font-size: 12.5px; text-decoration: none; transition: background .12s, color .12s;
}
.nd-menu-link:hover { background: #1e293b; color: #fff; text-decoration: none; }
.nd-menu-link.active { background: var(--nd-accent); color: #fff; }
.nd-menu-dot {
  width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .5;
}
.nd-menu-link.active .nd-menu-dot { opacity: 1; }
.nd-sidebar-foot {
  position: absolute; bottom: 16px; left: 16px; right: 16px;
  font-size: 11px; color: #64748b; font-family: var(--nd-mono); letter-spacing: .5px;
}

/* ---- Telerik grid/chart trims (mirror aa-bms .e-grid overrides) ---- */
.k-grid {
  background: transparent;
  border: 1px solid var(--nd-border);
  border-radius: var(--nd-radius);
}
.k-grid-header { background: #f5f4f1 !important; }
.k-grid-header .k-column-title { color: var(--nd-ink); font-weight: 600; }
.k-grid tr:hover { background: #fafaf8 !important; }
/* Telerik's default k-pager renders ~52px tall with chunky 40px buttons —
   visually dominates the layout when the grid has 1-2 rows. Squash it
   to ~28px with !important since the theme's class chains
   (.k-button.k-button-md.k-icon-button) outweigh single-class overrides. */
.telerik-blazor.k-pager.k-grid-pager {
  background: transparent !important;
  border-top: 1px solid var(--nd-border) !important;
  padding: 2px 10px !important;
  min-height: 28px !important;
  height: 28px !important;
}
.telerik-blazor.k-pager .k-pager-numbers-wrap {
  min-height: 24px !important;
  display: flex !important;
  align-items: center !important;
  gap: 2px !important;
}
.telerik-blazor.k-pager .k-button,
.telerik-blazor.k-pager .k-button.k-button-md {
  min-height: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  padding: 0 6px !important;
  font-size: 12px !important;
}
.telerik-blazor.k-pager .k-button.k-icon-button {
  width: 22px !important;
  height: 22px !important;
  padding: 0 !important;
}
.telerik-blazor.k-pager .k-pager-info {
  font-size: 11px !important;
  color: var(--nd-ink-muted, #6b7280) !important;
  margin-left: auto !important;
}
.telerik-blazor.k-pager .k-button-icon svg {
  width: 12px !important;
  height: 12px !important;
}
/* Hide the entire pager when there's only one page (all four nav buttons
   are k-disabled). :has() is supported in all evergreen browsers; the
   prior :nth-of-type variant was unreliable. This counts disabled nav
   buttons directly: there are exactly 4 nav buttons + 0 enabled means
   single-page. */
.telerik-blazor.k-pager.k-grid-pager:not(:has(.k-pager-nav:not(.k-disabled))) {
  display: none !important;
}
.k-chart { font-family: var(--nd-font); }

/* ---- Dashboard/page fragmentation widgets ---- */
.dev-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0 18px 0; margin-bottom: 18px; border-bottom: 1px solid var(--nd-border);
}
.dev-topbar-left { display: flex; align-items: center; gap: 14px; }
.dev-topbar-icon {
  width: 44px; height: 44px; background: var(--nd-surface);
  border: 1px solid var(--nd-border); border-radius: 10px;
  display: grid; place-items: center; font-size: 22px;
}
.dev-topbar-title { font-size: 17px; font-weight: 700; color: var(--nd-ink); letter-spacing: -0.005em; }
.dev-topbar-sub   { font-size: 11.5px; color: var(--nd-muted); margin-top: 2px; }
.dev-topbar-right { display: flex; align-items: center; gap: 10px; }
.dev-split-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
@media (max-width: 1100px) { .dev-split-layout { grid-template-columns: 1fr; } }

.nd-widget-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.nd-widget-head h3 {
  margin: 0; font-size: 12px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--nd-muted); font-weight: 600;
}
.nd-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--nd-surface-2); padding: 2px 9px; border-radius: 999px;
  font-size: 11px; color: var(--nd-muted); font-weight: 600; letter-spacing: 0.2px;
}
.nd-chip.ok      { background: #dcfce7; color: #166534; }
.nd-chip.warn    { background: #fef3c7; color: #92400e; }
.nd-chip.danger  { background: #fee2e2; color: #991b1b; }

/* ---- Devices page widgets ---- */
.dev-topbar-sep { width: 1px; height: 24px; background: var(--nd-border); margin: 0 6px; }
.dev-alert-banner { border-left: 3px solid var(--nd-warn); }
.dev-toolbar { padding: 14px 18px; }
.dev-statustabs { padding: 0; overflow: hidden; }
.dev-statustabs .k-tabstrip-items { padding: 0 8px; background: transparent; }
.dev-statustabs .k-tabstrip-items .k-item { font-weight: 600; }
.dev-ico {
  width: 32px; height: 32px; border-radius: 8px; background: #f5f4f1;
  display: inline-grid; place-items: center; font-size: 14px;
}
/* Side panel lives inside a CSS-grid cell. Pin a min-height so it matches
   the typical height of the list/grid on the other side and content doesn't
   look cramped when a row is selected. Also stretch to fill the grid cell
   (display:grid rows default to max-content unless children use
   `align-self: stretch`) so the surround card covers the whole column. */
.dev-split-side             { display: flex; flex-direction: column; gap: 12px; }
.dev-split-side > .nd-card  { flex: 0 0 auto; }
.dev-side-panel { padding: 16px 18px; min-height: 560px; }
.dev-sp-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin: -16px -18px 4px; background: #0f172a; color: #e2e8f0;
  border-radius: var(--nd-radius) var(--nd-radius) 0 0;
}
.dev-sp-icon { font-size: 22px; width: 34px; height: 34px; display: grid; place-items: center; background: #1e293b; border-radius: 8px; }
.dev-sp-name { font-family: var(--nd-mono); font-weight: 700; font-size: 14px; color: #fff; }
.dev-sp-sub  { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.dev-sp-chip { margin-left: auto; }
.dev-sp-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin: 0; font-size: 13px; }
.dev-sp-dl dt { color: var(--nd-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; margin-top: 8px; }
.dev-sp-dl dd { margin: 0; color: var(--nd-ink); margin-top: 8px; font-weight: 600; }
.dev-fault-list { list-style: none; padding: 0; margin: 0; }
.dev-fault-list li {
  display: flex; align-items: center; padding: 8px 4px;
  border-bottom: 1px solid var(--nd-border); font-size: 13px;
}
.dev-fault-list li:last-child { border-bottom: none; }

.nd-main { padding: 22px 24px; width: 100%; box-sizing: border-box; }

/* ---------- App bar (top-right user widget) ---------- */
.nd-appbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 0 14px 0; margin-bottom: 14px;
  border-bottom: 1px solid var(--nd-border);
}
.nd-appbar-spacer { flex: 1; }

.nd-user { position: relative; outline: none; }
.nd-user-trigger {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 5px 8px 5px 5px; border: 1px solid var(--nd-border);
  background: var(--nd-surface); border-radius: 999px;
  font-family: var(--nd-font); cursor: pointer;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.nd-user-trigger:hover  { border-color: var(--nd-accent); background: var(--nd-surface-2); }
.nd-user.open .nd-user-trigger { border-color: var(--nd-accent); box-shadow: 0 0 0 3px rgba(90,139,176,0.12); }

.nd-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: linear-gradient(135deg, var(--nd-accent) 0%, var(--nd-accent-2) 100%);
  color: #fff; font-weight: 700; font-size: 11px; letter-spacing: 0.5px;
  text-transform: uppercase;
}
.nd-avatar.lg { width: 40px; height: 40px; font-size: 14px; }

.nd-user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.nd-user-name { font-size: 12.5px; font-weight: 600; color: var(--nd-ink); }
.nd-user-role { font-size: 10px; color: var(--nd-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.nd-user-caret { color: var(--nd-muted); font-size: 11px; padding-right: 4px; }

.nd-user-popover {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 280px; background: var(--nd-surface);
  border: 1px solid var(--nd-border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(45,52,54,0.10);
  z-index: 60; padding: 14px; animation: nd-pop-in .12s ease-out;
}
@keyframes nd-pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.nd-user-popover-head {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--nd-border);
}
.nd-user-popover-name { font-size: 13.5px; font-weight: 700; color: var(--nd-ink); }
.nd-user-popover-id   { font-size: 10.5px; color: var(--nd-muted); font-family: var(--nd-mono); }

.nd-user-popover-section { padding: 10px 0; border-bottom: 1px solid var(--nd-border); }
.nd-user-popover-section:last-of-type { border-bottom: none; }
.nd-user-popover-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--nd-muted); font-weight: 600; margin-bottom: 4px;
}
.nd-user-popover-value      { font-size: 12px; color: var(--nd-ink); font-weight: 600; }
.nd-user-popover-value.mono { font-family: var(--nd-mono); font-size: 11px; }
.nd-user-popover-roles      { display: flex; flex-wrap: wrap; gap: 4px; }

.nd-user-popover-actions { padding-top: 10px; border-top: 1px solid var(--nd-border); }
.nd-user-action {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: 1px solid transparent;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  font-family: var(--nd-font); font-size: 12.5px; font-weight: 600;
  color: var(--nd-ink); text-align: left; transition: background .12s, color .12s, border-color .12s;
}
.nd-user-action:hover         { background: var(--nd-surface-2); }
.nd-user-action.danger        { color: var(--nd-danger); }
.nd-user-action.danger:hover  { background: #fdeeec; border-color: #f5c6c0; }
.nd-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.nd-topbar h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.nd-badge-live {
  background: #dcfce7; color: #166534; padding: 4px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
}

/* ---------- Cards & panels ---------- */
.nd-card {
  background: var(--nd-surface);
  border: 1px solid var(--nd-border);
  border-radius: var(--nd-radius);
  padding: 16px 18px;
  box-shadow: var(--nd-shadow);
}
.nd-card:hover { box-shadow: var(--nd-shadow-md); }
.nd-card h3 { margin: 0 0 10px 0; font-size: 12px; color: var(--nd-muted); font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; }
.nd-grid { display: grid; gap: 14px; }
.nd-grid-4 { grid-template-columns: repeat(4, 1fr); }
.nd-grid-3 { grid-template-columns: repeat(3, 1fr); }
.nd-grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .nd-grid-4 { grid-template-columns: repeat(2, 1fr); } .nd-grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px)  { .nd-grid-4, .nd-grid-3, .nd-grid-2 { grid-template-columns: 1fr; } }

.nd-kpi .nd-kpi-value { font-size: 28px; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; color: var(--nd-ink); }
.nd-kpi .nd-kpi-delta { font-size: 11.5px; color: var(--nd-muted); margin-top: 4px; }
.nd-kpi .nd-kpi-delta.up   { color: var(--nd-ok); }
.nd-kpi .nd-kpi-delta.down { color: var(--nd-danger); }

/* New KPI layout: icon tile + headline column + breakdown chip strip. */
.nd-kpi .nd-kpi-row       { display: flex; align-items: center; gap: 14px; }
.nd-kpi .nd-kpi-icon      {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.nd-kpi .nd-kpi-headline  { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nd-kpi .nd-kpi-label     { font-size: 12px; color: var(--nd-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.nd-kpi .nd-kpi-breakdown {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px;
  padding-top: 12px; border-top: 1px dashed var(--nd-border);
}
.nd-kpi .nd-kpi-breakdown .nd-chip { font-size: 11px; padding: 2px 8px; }

/* Stacked-bar mix widget (Vehicles by status / Devices by connectivity). */
.nd-mix-block       { padding: 14px 0; }
.nd-mix-block + .nd-mix-block { border-top: 1px dashed var(--nd-border); }
.nd-mix-label       { font-size: 12px; font-weight: 600; color: var(--nd-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px; }
.nd-mix-bar         {
  display: flex; height: 14px; border-radius: 7px; overflow: hidden;
  background: var(--nd-surface-2); border: 1px solid var(--nd-border);
}
.nd-mix-seg         { height: 100%; transition: width 0.4s ease; }
.nd-mix-empty       { width: 100% !important; background: transparent !important; color: var(--nd-muted); font-size: 11px; text-align: center; padding-top: 0; line-height: 14px; }
.nd-mix-legend      { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--nd-ink-2); }
.nd-mix-leg         { display: inline-flex; align-items: center; gap: 6px; }
.nd-mix-leg strong  { color: var(--nd-ink); margin-left: 2px; }
.nd-mix-dot         { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- Syncfusion trims ---------- */
.e-grid, .e-chart { border: none !important; box-shadow: none !important; }
.e-grid .e-headercell, .e-grid .e-headercelldiv { background: #f5f4f1 !important; color: var(--nd-ink) !important; font-weight: 600 !important; }

/* ---------- Landing ---------- */
.nd-landing { max-width: 1200px; margin: 0 auto; padding: 80px 32px 60px; }
.nd-landing .hero h1 { font-size: 44px; line-height: 1.1; margin: 0 0 16px; font-weight: 700; letter-spacing: -0.02em; }
.nd-landing .hero p  { font-size: 16px; color: var(--nd-muted); max-width: 680px; margin: 0 0 28px; line-height: 1.6; }
.nd-landing .hero .cta { display: inline-flex; gap: 10px; }
.nd-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; cursor: pointer; font-size: 13px; text-decoration: none; transition: background .12s, border-color .12s; }
.nd-btn.primary   { background: var(--nd-accent); color: #fff; }
.nd-btn.primary:hover { background: #1e40af; text-decoration: none; }
.nd-btn.secondary { background: transparent; color: var(--nd-ink); border-color: var(--nd-border); }
.nd-btn.secondary:hover { background: var(--nd-surface); text-decoration: none; }
.nd-btn.nd-btn-on-gradient { background: #fff; color: var(--nd-accent); }
.nd-btn.nd-btn-on-gradient:hover { background: #f5f4f1; text-decoration: none; }
.nd-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--nd-border); border-bottom: 1px solid var(--nd-border); padding: 28px 0; margin: 56px 0; }
.nd-stats .stat { text-align: center; border-right: 1px solid var(--nd-border); }
.nd-stats .stat:last-child { border-right: none; }
.nd-stats .stat .num { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.nd-stats .stat .lbl { font-size: 11px; color: var(--nd-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
.nd-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin: 56px 0; }
.nd-features .feat { background: var(--nd-surface); border: 1px solid var(--nd-border); border-radius: var(--nd-radius); padding: 28px; }
.nd-features .feat .ico { font-size: 28px; margin-bottom: 12px; width: 48px; height: 48px; }
.nd-features .feat .ico svg { width: 100%; height: 100%; }
/* Custom-SVG hero badge — bicycle-first marker above the headline. Pill
   with an inline icon + tagline; uses brand orange via currentColor. */
.nd-landing .hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(240, 83, 45, 0.08); color: #c0421f;
  padding: 6px 14px 6px 8px; border-radius: 9999px;
  font-size: 13px; font-weight: 600; margin-bottom: 18px;
}
.nd-landing .hero-badge-ico { display: inline-flex; width: 22px; height: 22px; }
.nd-landing .hero-badge-ico svg { width: 100%; height: 100%; }
/* Sector card SVG sizing — keeps the SVG inside the 48×48 wrapper from
   spilling out of its column. */
.nd-grid .nd-card svg { width: 100%; height: 100%; display: block; }
.nd-features .feat h4  { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.nd-features .feat p   { margin: 0; color: var(--nd-muted); font-size: 13px; line-height: 1.55; }

/* ---------- Sign-in (production-grade two-column auth card) ---------- */
.nd-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f8fafc;
  background-image:
    radial-gradient(circle at 0% 0%, rgba(29, 78, 216, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(15, 23, 42, 0.04) 0%, transparent 40%);
}
.nd-auth-card {
  width: 100%;
  max-width: 960px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--nd-surface);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.06);
}

/* Brand panel — restrained dark navy, no gimmicks */
.nd-auth-brand {
  background: #0f172a;
  color: #cbd5e1;
  padding: 44px 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.nd-auth-brand-top { display: flex; align-items: center; gap: 10px; }
.nd-auth-mark {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; color: #fff;
}
.nd-auth-mark-glyph {
  font-family: var(--nd-mono);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.04em;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #1d4ed8 0%, #6366f1 100%);
  border-radius: 8px;
  color: #fff;
}
.nd-auth-mark-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }

.nd-auth-pitch h2 {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.02em;
}
.nd-auth-pitch p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: #94a3b8;
}

.nd-auth-trust {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 14px;
}
.nd-auth-trust li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.nd-auth-trust li:first-child { border-top: none; padding-top: 0; }
.nd-auth-trust-ico {
  font-size: 14px; flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 6px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}
.nd-auth-trust li > div   { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nd-auth-trust li strong  { color: #f8fafc; font-size: 12.5px; font-weight: 600; letter-spacing: -0.005em; }
.nd-auth-trust li span    { color: #64748b; font-size: 11.5px; line-height: 1.5; }

.nd-auth-brand-footer {
  margin-top: auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 6px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px; color: #64748b;
}
.nd-auth-brand-links { display: inline-flex; gap: 6px; align-items: center; }
.nd-auth-brand-footer a { color: #94a3b8; text-decoration: none; transition: color 0.15s; }
.nd-auth-brand-footer a:hover { color: #f8fafc; }
.nd-auth-dot { color: #475569; }

/* Form panel */
.nd-auth-form {
  padding: 48px 44px 36px;
  display: flex; flex-direction: column;
  gap: 18px;
  background: #fff;
}
.nd-auth-form-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.nd-auth-form-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}
.nd-auth-form-head p {
  margin: 0;
  color: #64748b;
  font-size: 13.5px;
}
.nd-auth-error { padding: 12px 14px !important; margin-bottom: 4px; }

.nd-auth-field { display: flex; flex-direction: column; gap: 6px; }
.nd-auth-field label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}
.nd-auth-field-label-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
}

.nd-auth-helper-link {
  font-size: 12px;
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 500;
}
.nd-auth-helper-link:hover { text-decoration: underline; }

.nd-auth-remember {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: #475569;
  cursor: pointer; user-select: none;
  margin-top: 2px;
}
.nd-auth-remember input { accent-color: #1d4ed8; width: 14px; height: 14px; }

.nd-auth-submit {
  width: 100%;
  margin-top: 8px;
  height: 42px;
  font-weight: 600 !important;
}

.nd-auth-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 18px; padding-top: 18px;
  border-top: 1px solid #f1f5f9;
  font-size: 12px;
  color: #64748b;
  flex-wrap: wrap; gap: 10px;
}
.nd-auth-foot-help { color: #64748b; }
.nd-auth-foot-help a { color: #1d4ed8; text-decoration: none; font-weight: 500; }
.nd-auth-foot-help a:hover { text-decoration: underline; }

@media (max-width: 820px) {
  .nd-auth { padding: 0; }
  .nd-auth-card { grid-template-columns: 1fr; max-width: 480px; border-radius: 0; min-height: 100vh; }
  .nd-auth-brand { padding: 28px 24px; gap: 22px; order: 2; }
  .nd-auth-form  { padding: 32px 24px; order: 1; }
  .nd-auth-pitch h2 { font-size: 18px; }
  .nd-auth-trust li { padding: 8px 0; }
}

/* ---------- Alerts page ---------- */
.nd-chip.info { background: #dbeafe; color: #1e40af; }
.nd-mono { font-family: var(--nd-mono); font-size: 12px; }

.nd-live-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
    padding: 4px 10px; border-radius: 999px; background: var(--nd-surface); border: 1px solid var(--nd-border); }
.nd-live-indicator.on  { color: #166534; background: #dcfce7; border-color: #bbf7d0; }
.nd-live-indicator.off { color: #64748b; }
.nd-live-indicator .nd-live-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor;
    box-shadow: 0 0 0 4px rgba(34,197,94,0.15); }
.nd-live-indicator.off .nd-live-dot { box-shadow: none; }

.nd-alert-banner { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-radius: 12px;
    border: 1px solid transparent; margin-bottom: 16px; }
.nd-alert-banner.danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.nd-alert-banner-icon { font-size: 24px; flex-shrink: 0; }
.nd-alert-banner-title { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.nd-alert-banner-sub   { font-size: 12.5px; color: #7f1d1d; }

.nd-alerts-list { display: flex; flex-direction: column; gap: 10px; }
.nd-alert-card { position: relative; background: var(--nd-surface); border: 1px solid var(--nd-border);
    border-left: 4px solid var(--nd-border); border-radius: 10px; padding: 14px 16px;
    cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.nd-alert-card:hover    { box-shadow: 0 2px 8px rgba(15,23,42,.06); }
.nd-alert-card.selected { box-shadow: 0 0 0 2px #93c5fd; }
.nd-alert-card.sev-crit { border-left-color: #dc2626; }
.nd-alert-card.sev-warn { border-left-color: #d97706; }
.nd-alert-card.sev-info { border-left-color: #2563eb; }

.nd-alert-card-top { display: flex; gap: 12px; align-items: flex-start; }
.nd-alert-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
    font-size: 18px; flex-shrink: 0; }
.nd-alert-info { flex: 1; min-width: 0; }
.nd-alert-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.nd-alert-subject { font-weight: 600; font-size: 14px; color: var(--nd-ink); margin-bottom: 4px; }
.nd-alert-source { font-size: 12px; color: var(--nd-muted); }
.nd-alert-time { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.nd-alert-time .nd-mono { font-size: 11px; color: var(--nd-muted); }
.nd-alert-time .nd-muted { font-size: 10.5px; color: var(--nd-muted); }

.nd-alert-actions { display: flex; gap: 6px; padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--nd-border); }

/* Severity toggle chips in toolbar */
.nd-btn.sev-chip.active.danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.nd-btn.sev-chip.active.warn   { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.nd-btn.sev-chip.active.info   { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }

/* ---------- Events page ---------- */
.te-page { display: flex; flex-direction: column; gap: 0; }
.te-rate-badge { display: inline-flex; gap: 8px; align-items: center; font-family: var(--nd-mono);
    font-size: 11px; color: var(--nd-muted); padding: 4px 10px; border-radius: 6px;
    background: var(--nd-surface); border: 1px solid var(--nd-border); }
.te-rate-badge .te-sep { opacity: .35; }

.te-body-wrap { display: grid; grid-template-columns: 0fr 1fr 0fr; gap: 0;
    align-items: stretch; transition: grid-template-columns .2s ease; position: relative; }
.te-body-wrap .te-stats-sidebar.open { grid-column: 1; }
.te-body-wrap .te-detail-panel.open  { grid-column: 3; }
.te-stream-wrap { grid-column: 2; min-width: 0; }

.te-grid-wrap { padding: 0; overflow: hidden; }
.te-ts-cell { display: flex; flex-direction: column; line-height: 1.2; }
.te-ts-time { font-weight: 600; font-size: 12px; }
.te-ts-ms   { font-size: 10px; color: var(--nd-muted); }

.te-sev-cell { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.te-sev-dot  { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.te-ev-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; font-size: 11px;
    font-weight: 600; border-radius: 6px; background: #f3f4f6; color: #374151; border: 1px solid #e5e7eb; }
.te-ev-chip-danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.te-ev-chip-warn   { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.te-ev-chip-info   { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.te-ev-chip-ok     { background: #dcfce7; color: #166534; border-color: #bbf7d0; }

.te-ev-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.te-evpill { cursor: pointer; font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
    background: #f9fafb; color: var(--nd-muted); border: 1px solid transparent;
    transition: all .15s; user-select: none; }
.te-evpill:hover { background: #eff2f5; color: var(--nd-ink); }
.te-evpill.active { background: #e0f2fe; color: #075985; border-color: #7dd3fc; box-shadow: 0 0 0 2px rgba(14,165,233,.12); }

/* ---- Stats sidebar ---- */
.te-stats-sidebar { width: 0; overflow: hidden; background: var(--nd-surface); border: 1px solid transparent;
    border-radius: 0; transition: width .2s ease, padding .2s ease, border-color .2s ease; padding: 0;
    max-height: calc(100vh - 280px); overflow-y: auto; }
.te-stats-sidebar.open { width: 280px; padding: 16px; border-color: var(--nd-border); border-radius: 12px 0 0 12px; margin-right: 10px; }
.te-stats-section { padding: 10px 0; border-bottom: 1px solid var(--nd-border); }
.te-stats-section:last-child { border-bottom: none; }
.te-stats-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
    color: var(--nd-muted); margin-bottom: 10px; }
.te-stats-bar-row { display: grid; grid-template-columns: 80px 1fr 32px; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 11px; }
.te-stats-bar-label { color: var(--nd-ink); font-weight: 600; }
.te-stats-bar-track { height: 6px; background: #f1f5f9; border-radius: 3px; overflow: hidden; }
.te-stats-bar-fill  { height: 100%; transition: width .3s; }
.te-stats-bar-count { font-family: var(--nd-mono); font-size: 11px; color: var(--nd-ink); text-align: right; }
.te-stats-sev-row   { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.te-stats-sev-label { flex: 1; font-weight: 600; }
.te-stats-sev-count { font-family: var(--nd-mono); font-size: 11px; }
.te-stats-dev-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.te-stats-dev-icon { width: 26px; height: 26px; display: grid; place-items: center; background: #e0f2fe;
    border-radius: 6px; font-size: 12px; }
.te-stats-dev-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.te-stats-dev-name { font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.te-stats-dev-ia   { font-size: 10px; color: var(--nd-muted); }
.te-stats-dev-count { font-family: var(--nd-mono); font-size: 11px; }
.te-stats-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.te-stats-total-item { text-align: center; padding: 8px; border-radius: 8px; background: #f9fafb; }
.te-stats-total-val  { font-size: 18px; font-weight: 800; color: var(--nd-ink); }
.te-stats-total-lbl  { font-size: 10px; color: var(--nd-muted); text-transform: uppercase; letter-spacing: .5px; }

/* ---- Detail panel (slide-in) ---- */
.te-detail-panel { width: 0;
    /* Important: only clip horizontally during the width transition.
       overflow-y is set on .open so the body can scroll once visible. */
    overflow: hidden;
    box-sizing: border-box;
    background: var(--nd-surface); border: 1px solid transparent;
    border-radius: 0; transition: width .2s ease, padding .2s ease, border-color .2s ease; padding: 0;
    min-height: calc(100vh - 180px);
    max-height: calc(100vh - 180px); }
.te-detail-panel.open {
    width: 420px; padding: 16px; border-color: var(--nd-border);
    border-radius: 0 12px 12px 0; margin-left: 10px;
    /* Re-enable vertical scrolling on the open variant. The base
       `overflow: hidden` was clipping both axes which truncated long UUIDs
       and hid the action buttons at the bottom of taller content. */
    overflow-x: hidden; overflow-y: auto;
}
.te-detail-header-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.te-detail-close { cursor: pointer; font-size: 16px; color: var(--nd-muted); padding: 0 6px; }
.te-detail-close:hover { color: var(--nd-ink); }
.te-detail-id { font-size: 11px; color: var(--nd-muted); margin-bottom: 10px; }
.te-detail-banner { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 8px;
    background: #f9fafb; margin-bottom: 14px; }
.te-detail-section { border-top: 1px solid var(--nd-border); padding: 12px 0; }
.te-detail-sect-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
    color: var(--nd-muted); margin-bottom: 8px; }
/* Stack label + value so long UUIDs wrap naturally instead of being
   clipped on the right edge. Label sits as a small caption above its
   value; value can break on any character (UUID-friendly). */
.te-detail-row {
    display: flex; flex-direction: column; align-items: stretch;
    gap: 2px; padding: 6px 0; font-size: 12px;
    word-break: break-word;
}
.te-detail-row-lbl {
    color: var(--nd-muted);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}
.te-detail-row-val { color: var(--nd-ink); font-weight: 600; word-break: break-all; }
/* Direct value spans inside a row (used by some templates that don't
   wrap the value in .te-detail-row-val) inherit the same wrapping. */
.te-detail-row > span:not(.te-detail-row-lbl),
.te-detail-row > div { word-break: break-all; min-width: 0; }
.te-detail-actions { display: flex; flex-direction: column; gap: 6px; padding: 12px 0 0; border-top: 1px solid var(--nd-border); }
/* Action button row inside .te-detail-actions: stretch buttons to full
   width and stack on a column so they never overflow horizontally. */
.te-detail-actions > div { display: flex !important; flex-direction: column !important; gap: 8px !important; width: 100%; }
.te-detail-actions > div > .telerik-blazor.k-button { width: 100%; justify-content: center; }

.te-timeline { display: flex; flex-direction: column; gap: 4px; }
.te-tl-item { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center;
    padding: 6px 8px; border-radius: 6px; cursor: pointer; transition: background .15s; font-size: 12px; }
.te-tl-item:hover { background: #f1f5f9; }
.te-tl-icon { font-size: 13px; text-align: center; }
.te-tl-body { display: flex; flex-direction: column; min-width: 0; }
.te-tl-label { font-weight: 700; color: var(--nd-ink); }
.te-tl-meta  { font-size: 10px; color: var(--nd-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.te-tl-time  { color: var(--nd-muted); font-size: 11px; }

/* ---------- Geofences page ---------- */
.gf-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: stretch; }
@media (max-width: 1100px) { .gf-split { grid-template-columns: 1fr; } }

.gf-map-card { padding: 16px; }
.gf-map-wrap { border-radius: 10px; overflow: hidden; border: 1px solid var(--nd-border); }
.gf-map-container { width: 100%; height: 460px; background: #1e2530; }

/* Geofence draw-modal layout: stacked top-to-bottom inside the Telerik window. */
.gf-draw-wrap { display: flex; flex-direction: column; gap: 12px; }
.gf-draw-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px; border: 1px solid var(--nd-border); border-radius: 8px;
  background: var(--nd-surface-2);
}
.gf-draw-hint { margin-left: auto; font-size: 12px; color: var(--nd-muted); }
.gf-draw-map {
  width: 100%; height: 320px;
  border: 1px solid var(--nd-border); border-radius: 10px; overflow: hidden;
  background: #1e2530;
}
.gf-draw-readout {
  margin-top: 8px; padding: 8px 10px; font-size: 12px;
  background: var(--nd-surface-2); border: 1px dashed var(--nd-border);
  border-radius: 6px; color: var(--nd-ink-2);
}

.gf-list-card { padding: 16px; }

.gf-color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%;
    vertical-align: middle; margin-right: 6px; border: 1px solid rgba(0,0,0,0.1); }

.gf-form { display: flex; flex-direction: column; gap: 12px; }
.gf-form-row { display: flex; flex-direction: column; gap: 4px; }
.gf-form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gf-form-row label { font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: var(--nd-muted); }
.gf-check { display: flex; align-items: center; gap: 8px; text-transform: none;
    letter-spacing: 0; font-weight: 600; color: var(--nd-ink); font-size: 13px; }

/* ---------- Utility ---------- */
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:32px}.mt-5{margin-top:48px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}.mb-4{margin-bottom:32px}.mb-5{margin-bottom:48px}
.text-muted { color: var(--nd-muted); }
.fw-bold { font-weight: 700; }

/* ---------- Live sensor card (motion / mag / gas) ---------- */
.sensor-card { margin-top: 16px; }
.sensor-section { padding: 8px 4px; border-top: 1px solid var(--nd-border); }
.sensor-section:first-of-type { border-top: 0; }
.sensor-row-label { font-size: 12px; font-weight: 700; color: var(--nd-muted);
    text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px;
    display: flex; justify-content: space-between; align-items: center; }
.sensor-meta { font-family: var(--nd-mono); font-size: 11px; font-weight: 400; opacity: 0.7; }
.sensor-row { display: flex; gap: 10px; flex-wrap: wrap; font-family: var(--nd-mono);
    font-size: 12px; line-height: 1.6; }
.sensor-row span { white-space: nowrap; }
.sensor-row-empty { font-size: 12px; color: var(--nd-muted); font-style: italic; padding: 4px 0; }