/* PhantomCore global.css: consolidated app-facing CSS */

/* index.css */
    :root {
      color-scheme: dark;
      --bg: #0b0f16;
      --panel: #151b26;
      --panel-2: #111622;
      --line: #253044;
      --muted: #91a1ba;
      --text: #d8e1f2;
      --accent: #5cc7ff;
      --accent-2: #3aa4ff;
      --ok: #58d68d;
      --warn: #f3c969;
      --danger: #f16f6f;
      --page-footer-height: 74px;
    }
    
    * {
      box-sizing: border-box;
    }
    
    body {
      margin: 0;
      min-height: 100vh;
      background: radial-gradient(circle at 20% 10%, rgba(92, 199, 255, 0.12), transparent 40%),
        radial-gradient(circle at 80% 0%, rgba(58, 164, 255, 0.2), transparent 45%),
        linear-gradient(180deg, #0a0f17 0%, #0b0f16 50%, #0a0d14 100%);
      color: var(--text);
      font-family: "Rajdhani", "Segoe UI", sans-serif;
      line-height: 1.6;
      -webkit-font-smoothing: antialiased;
    }

    /* Banner - compact, pinned */
    .banner {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      z-index: 1102;
      padding: 7px 24px;
      background: rgba(11, 15, 22, 0.85);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border-bottom: 1px solid rgba(92, 199, 255, 0.12);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .banner-title {
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      font-size: 11px;
      letter-spacing: 0.6px;
      text-transform: uppercase;
      color: var(--muted);
      opacity: 0.7;
      pointer-events: none;
      white-space: nowrap;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 14px;
      font-weight: 600;
      letter-spacing: 0.3px;
      text-decoration: none;
      color: var(--text);
    }

    .brand-mark {
      width: 18px;
      height: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .brand-mark svg {
      width: 100%;
      height: 100%;
    }

    .brand-text span {
      color: var(--accent);
    }

    /* Menu Toggle */
    .menu-toggle {
      position: relative;
      z-index: 1001;
      width: 30px;
      height: 30px;
      background: rgba(92, 199, 255, 0.05);
      border: 1px solid rgba(92, 199, 255, 0.18);
      border-radius: 6px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s ease;
      opacity: 0.9;
    }
    
    .menu-toggle:hover {
      background: rgba(92, 199, 255, 0.12);
      border-color: rgba(92, 199, 255, 0.28);
    }

    .menu-toggle-icon {
      width: 17px;
      height: 17px;
      color: var(--muted);
      transition: transform 0.25s ease, color 0.25s ease;
    }

    .menu-toggle:hover .menu-toggle-icon {
      color: var(--accent);
    }

    .menu-toggle.active .menu-toggle-icon {
      transform: rotate(180deg);
      color: var(--accent);
    }

    /* Right-side Menu Rail (desktop default visible) */
    .menu-panel {
      position: fixed;
      top: 43px;
      right: 0;
      bottom: var(--page-footer-height);
      width: 260px;
      height: auto;
      background: linear-gradient(180deg, rgba(21, 27, 38, 0.92) 0%, rgba(11, 15, 22, 0.96) 100%);
      border-left: 1px solid var(--line);
      z-index: 1000;
      padding: 70px 18px 32px;
      transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
      overflow-y: auto;
      box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    }

    .menu-panel.collapsed {
      right: -280px;
      box-shadow: none;
    }
    
    .menu-panel.open {
      right: 0;
      box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    }
    
    .menu-overlay {
      position: fixed;
      inset: 0;
      background: rgba(4, 6, 10, 0.4);
      opacity: 0;
      visibility: hidden;
      transition: all 0.35s ease;
      z-index: 999;
    }
    
    .menu-overlay.visible {
      opacity: 1;
      visibility: visible;
    }

    @media (min-width: 769px) {
      .menu-overlay {
        display: none !important;
      }

      body.has-right-menu:not(.menu-collapsed):not(.app-mode) .wrap {
        padding-right: 300px;
        transition: padding-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
      }

      body.has-right-menu.menu-collapsed:not(.app-mode) .wrap {
        padding-right: 30px;
      }

      body.has-right-menu.app-mode:not(.menu-collapsed) .page-body {
        padding-right: 260px;
      }

      body.has-right-menu.app-mode.menu-collapsed .page-body {
        padding-right: 30px;
      }
    }

    /* Menu Content */
    .menu-section {
      margin-bottom: 24px;
    }
    
    .menu-section-title {
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 1.5px;
      color: var(--muted);
      margin: 0 0 12px 0;
      opacity: 0.7;
    }
    
    .menu-link {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 14px;
      margin: 0 -14px;
      color: var(--text);
      text-decoration: none;
      font-size: 15px;
      font-weight: 500;
      border-radius: 8px;
      transition: all 0.2s ease;
      border: 1px solid transparent;
    }

    .menu-link.compact {
      padding: 8px 10px;
      font-size: 13px;
    }

    .menu-link.signin {
      border: 1px solid rgba(92, 199, 255, 0.2);
      background: rgba(92, 199, 255, 0.08);
      color: var(--accent);
    }
    
    .menu-link:hover {
      background: rgba(92, 199, 255, 0.08);
      border-color: rgba(92, 199, 255, 0.15);
      color: #fff;
    }
    
    .menu-link svg {
      width: 20px;
      height: 20px;
      color: var(--muted);
      transition: color 0.2s ease;
    }
    
    .menu-link:hover svg {
      color: var(--accent);
    }
    
    .menu-divider {
      height: 1px;
      background: var(--line);
      margin: 20px 0;
    }

    /* User Section in Menu */
    .menu-user {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 14px;
      margin: 0 -14px 20px;
      background: var(--panel-2);
      border-radius: 10px;
      border: 1px solid var(--line);
    }
    
    .menu-user-avatar {
      width: 40px;
      height: 40px;
      border-radius: 8px;
      background: linear-gradient(135deg, var(--accent), var(--accent-2));
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 16px;
      color: var(--bg);
    }
    
    .menu-user-info {
      flex: 1;
    }
    
    .menu-user-name {
      font-weight: 600;
      font-size: 14px;
      color: #fff;
      margin: 0 0 2px 0;
    }
    
    .menu-user-role {
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--muted);
    }
    
    .menu-user-role.admin {
      color: var(--accent);
    }

    /* Main Content */
    .wrap {
      max-width: 1100px;
      margin: 0 auto;
      padding: 80px 48px 120px;
    }

    .hero-layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
      gap: 48px;
      align-items: start;
    }

    .hero-column {
      display: flex;
      flex-direction: column;
      gap: 32px;
    }
    
    .hero-image {
      display: block;
      margin: 0;
      margin-top: -25px;
      max-width: 360px;
      width: 100%;
      height: auto;
      filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.4));
    }
    
    .content {
      font-size: 14px;
      letter-spacing: 0.02em;
    }
    
    .content p {
      margin: 0 0 20px 0;
      color: var(--text);
      opacity: 0.9;
    }
    
    .content p:last-child {
      margin-bottom: 0;
    }

    /* Info Panel - matches HBlink card style */
    .info-panel {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 24px;
      margin-top: 40px;
    }

    .highlight-panel {
      margin-top: 0;
      min-height: 220px;
    }

    .highlight-placeholder {
      color: var(--muted);
      font-size: 14px;
    }
    
    .info-panel-title {
      font-size: 13px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--accent);
      margin: 0 0 16px 0;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    
    .info-panel-title::before {
      content: "";
      width: 3px;
      height: 14px;
      background: var(--accent);
      border-radius: 2px;
    }
    
    .info-list {
      list-style: none;
      padding: 0;
      margin: 0;
      display: grid;
      gap: 8px;
    }
    
    .info-list li {
      font-size: 14px;
      color: var(--muted);
      padding-left: 16px;
      position: relative;
    }
    
    .info-list li::before {
      content: "—";
      position: absolute;
      left: 0;
      color: var(--line);
    }

    /* Footer */
    .site-footer {
      padding: 12px 24px;
      font-size: 11px;
      color: var(--muted);
      letter-spacing: 0.5px;
      opacity: 0.5;
    }

    .site-footer-content {
      display: block;
    }

    .page-footer {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background: rgba(11, 15, 22, 0.92);
      border-top: 1px solid rgba(92, 199, 255, 0.12);
      z-index: 90;
    }

    .site-footer-left {
      display: grid;
      gap: 0;
      font-size: 11px;
      letter-spacing: 0.3px;
    }

    .site-footer-content > .site-footer-left[aria-hidden="true"] {
      display: none;
    }

    .site-footer-content > .site-footer-left:first-child {
      width: 100%;
      grid-template-columns: max-content max-content;
      grid-template-rows: repeat(4, min-content);
      justify-content: space-between;
      align-items: start;
      column-gap: 32px;
    }

    .site-footer-content > .site-footer-left:first-child > div:nth-child(1) { grid-column: 1; grid-row: 1; }
    .site-footer-content > .site-footer-left:first-child > div:nth-child(2) { grid-column: 1; grid-row: 2; }
    .site-footer-content > .site-footer-left:first-child > div:nth-child(3) { grid-column: 1; grid-row: 3; }
    .site-footer-content > .site-footer-left:first-child > div:nth-child(4) { grid-column: 2; grid-row: 1; }
    .site-footer-content > .site-footer-left:first-child > div:nth-child(5) { grid-column: 2; grid-row: 2; }
    .site-footer-content > .site-footer-left:first-child > div:nth-child(6) { grid-column: 2; grid-row: 3; }
    .site-footer-content > .site-footer-left:first-child > div:nth-child(7) { grid-column: 2; grid-row: 4; }

    .site-footer-content > .site-footer-left:first-child > div:nth-child(n+4) {
      justify-self: end;
      text-align: right;
    }

    .site-footer-left div {
      line-height: 1.1;
    }

    .site-footer-left a {
      color: inherit;
      text-decoration: none;
    }

    .site-footer-left a:hover {
      text-decoration: underline;
    }

    .site-footer-center {
      flex: 1;
      text-align: center;
      font-size: 11px;
      letter-spacing: 0.5px;
    }

    .app-frame {
      display: block;
      width: 100%;
      min-height: calc(100vh - 43px - var(--page-footer-height));
      border: 0;
      background: #0b0f16;
      border-radius: 12px;
      box-shadow: 0 18px 32px rgba(4, 8, 14, 0.45);
    }

    .app-mode .page-body {
      padding-top: 43px;
      padding-bottom: var(--page-footer-height);
      min-width: 0;
    }

    .app-mode .wrap {
      max-width: none;
      width: 100%;
      margin: 0;
      padding: 0;
      min-height: calc(100vh - 43px - var(--page-footer-height));
    }

    .app-mode .app-frame {
      border-radius: 0;
      box-shadow: none;
    }

    .app-mode {
      min-height: 100vh;
    }

    /* GPS page: hard-anchor content between fixed header and fixed footer */
    .gps-mode .page-body {
      position: fixed;
      top: 43px;
      left: 0;
      right: 0;
      bottom: calc(var(--page-footer-height) + 5px);
      overflow: hidden;
      padding-bottom: 20px;
      box-sizing: border-box;
    }

    .gps-mode .wrap {
      max-width: none;
      width: 100%;
      margin: 0 auto;
      padding: 0 30px;
      overflow: hidden;
    }

    .gps-mode .gps-map-card {
      height: 100%;
      margin: 0 auto;
    }

    .gps-map-card {
      height: 100%;
      margin: 0 auto;
      width: min(1200px, 100%);
      background: rgba(15, 24, 38, 0.92);
      border: 1px solid rgba(92, 199, 255, 0.2);
      border-radius: 14px;
      padding: 18px 20px 20px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      box-shadow: 0 20px 35px rgba(4, 8, 14, 0.45);
    }

    .gps-map-title {
      font-size: 13px;
      text-transform: uppercase;
      letter-spacing: 2px;
      color: var(--muted);
    }

    .gps-map-body {
      flex: 1;
      border: 1px solid rgba(92, 199, 255, 0.2);
      border-radius: 12px;
      min-height: 500px;
      width: 100%;
    }
    
    #gpsMap {
      width: 100%;
      height: 100%;
      border-radius: 12px;
    }

    .gps-radio-marker { background: none; border: none; }
    .gps-radio-icon { display: block; line-height: 0; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
    .gps-radio-icon svg { display: block; }
    .leaflet-tooltip.gps-marker-tooltip {
      white-space: nowrap;
      font-size: 11px;
      padding: 4px 8px;
      background: rgba(21, 27, 38, 0.95);
      backdrop-filter: blur(8px);
      border: 1px solid rgba(92, 199, 255, 0.2);
      border-radius: 4px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
      color: var(--text);
      font-family: "Rajdhani", "Segoe UI", sans-serif;
      font-weight: 500;
      pointer-events: none;
      max-width: none;
    }
    .leaflet-tooltip.gps-marker-tooltip .gps-tooltip-name {
      color: var(--accent);
      font-weight: 600;
      margin-right: 6px;
    }
    .leaflet-tooltip.gps-marker-tooltip .gps-tooltip-id {
      color: var(--muted);
      margin-right: 6px;
    }
    .leaflet-tooltip.gps-marker-tooltip .gps-tooltip-coords {
      color: var(--muted);
      font-size: 10px;
    }
    .leaflet-tooltip.gps-marker-tooltip::before {
      border-top-color: rgba(92, 199, 255, 0.2);
    }

    .modal-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(3, 6, 12, 0.6);
      backdrop-filter: blur(6px);
      opacity: 0;
      visibility: hidden;
      transition: all 0.2s ease;
      z-index: 1200;
    }

    .modal-backdrop.active {
      opacity: 1;
      visibility: visible;
    }

    .signin-modal {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%) scale(0.98);
      width: min(360px, 90vw);
      background: rgba(15, 26, 44, 0.96);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 14px;
      padding: 22px;
      opacity: 0;
      visibility: hidden;
      transition: all 0.2s ease;
      z-index: 1300;
      box-shadow: 0 28px 60px rgba(4, 8, 14, 0.6);
    }

    .signin-modal.active {
      opacity: 1;
      visibility: visible;
      transform: translate(-50%, -50%) scale(1);
    }

    .signin-title {
      margin: 0 0 6px 0;
      font-size: 18px;
      color: #e9eef5;
    }

    .signin-subtitle {
      margin: 0 0 16px 0;
      font-size: 12px;
      color: var(--muted);
    }

    .signin-group {
      margin-bottom: 12px;
    }

    .signin-label {
      display: block;
      font-size: 12px;
      color: #e9eef5;
      margin-bottom: 6px;
    }

    .signin-input {
      width: 100%;
      padding: 10px 12px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 8px;
      color: #e9eef5;
      font-size: 14px;
    }

    .signin-password-row {
      position: relative;
    }

    .signin-toggle {
      position: absolute;
      right: 10px;
      top: 50%;
      transform: translateY(-50%);
      background: transparent;
      border: none;
      color: var(--muted);
      font-size: 12px;
      cursor: pointer;
      padding: 4px 6px;
    }

    .signin-toggle:hover {
      color: var(--text);
    }

    .signin-actions {
      display: flex;
      gap: 10px;
      margin-top: 16px;
    }

    .signin-btn {
      flex: 1;
      padding: 10px 12px;
      border-radius: 8px;
      border: none;
      cursor: pointer;
      font-weight: 600;
      background: linear-gradient(135deg, #2563eb, #1d4ed8);
      color: #fff;
    }

    .signin-cancel {
      background: rgba(255, 255, 255, 0.08);
      color: var(--text);
    }

    .signin-error {
      margin-top: 10px;
      font-size: 12px;
      color: #fca5a5;
      min-height: 16px;
    }

    .signin-remember-group {
      margin-top: 4px;
    }

    .signin-remember-label {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      color: var(--muted);
      cursor: pointer;
    }

    .signin-remember-label input[type="checkbox"] {
      width: 14px;
      height: 14px;
    }

    .logout-modal {
      width: min(420px, 92vw);
    }

    .logout-meta-row {
      font-size: 13px;
      color: var(--text);
      margin: 6px 0;
    }

    .logout-meta-row strong {
      color: var(--muted);
      margin-right: 6px;
    }

    .welcome-panel {
      margin: 24px 0 10px;
      padding: 18px 20px;
      border-radius: 14px;
      background: rgba(15, 22, 34, 0.7);
      border: 1px solid rgba(92, 199, 255, 0.18);
      box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    }

    .welcome-title {
      font-size: 20px;
      margin: 0 0 6px 0;
      color: var(--text);
    }

    .welcome-subtitle {
      margin: 0 0 14px 0;
      color: var(--muted);
      font-size: 14px;
    }

    .welcome-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
    }

    .welcome-btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 14px;
      border-radius: 999px;
      border: 1px solid rgba(92, 199, 255, 0.3);
      color: var(--text);
      text-decoration: none;
      font-size: 13px;
      transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    }

    .welcome-btn.primary {
      border-color: transparent;
      background: linear-gradient(120deg, rgba(92, 199, 255, 0.4), rgba(58, 164, 255, 0.2));
    }

    .welcome-btn:hover {
      border-color: var(--accent);
      color: var(--accent);
    }

    /* Responsive */
    @media (max-width: 768px) {
      .banner {
        padding: 6px 12px;
      }
      
      .brand {
        font-size: 13px;
        gap: 6px;
      }
      
      .brand-mark {
        width: 16px;
        height: 16px;
      }
      
      .menu-toggle {
        width: 28px;
        height: 28px;
      }
      
      .menu-toggle-icon {
        width: 16px;
        height: 16px;
      }

      .gps-mode .page-body {
        top: 41px;
        bottom: calc(var(--page-footer-height) + 4px);
      }

      .gps-mode .wrap {
        padding: 0;
      }

      .gps-mode .gps-map-card {
        height: 100%;
        margin: 0;
      }

      .app-mode .page-body {
        padding-top: 41px;
      }

      .app-mode .wrap {
        min-height: calc(100vh - 41px - var(--page-footer-height));
      }
      
      .gps-map-card {
        height: 100%;
        margin: 0;
      }
      
      .menu-panel {
        width: 220px;
        right: -240px;
        padding: 60px 14px 24px;
        box-shadow: none;
      }

      .menu-panel.open {
        right: 0;
        box-shadow: -10px 0 28px rgba(0, 0, 0, 0.45);
      }

      .menu-panel.collapsed {
        right: -240px;
      }
      
      .wrap {
        padding: 70px 20px 80px;
      }

      .hero-layout {
        grid-template-columns: 1fr;
        gap: 36px;
      }

      .hero-column {
        gap: 24px;
      }
      
      .hero-image {
        max-width: 300px;
        margin: 0 auto;
      }
      
      .content {
        font-size: 13px;
      }
      
      .info-panel {
        padding: 20px;
      }

      .highlight-panel {
        min-height: 160px;
      }

      .app-frame {
        min-height: calc(100vh - 160px);
      }

      .site-footer {
        padding: 10px 16px;
      }

      :root {
        --page-footer-height: 70px;
      }

      .site-footer-content {
        display: block;
        text-align: initial;
      }

      .site-footer-left {
        text-align: initial;
      }
    }


/* admin.css */
    *,
    *::before,
    *::after {
      box-sizing: border-box;
    }
    body:has(.page-header-actions) {
      margin: 0;
      min-height: 0;
      background: #0b0f16;
      color: #e9eef5;
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      width: 100%;
      min-width: 0;
    }
    body:has(.page-header-actions) .page {
      padding: 28px 32px 40px;
      display: flex;
      flex-direction: column;
      min-height: 0;
      width: 100%;
      max-width: 100%;
      min-width: 0;
    }
    body:has(.page-header-actions) .page-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 24px;
    }
    .page-header-actions {
      flex: 0 0 auto;
      display: flex;
      gap: 8px;
      align-items: center;
      justify-content: flex-end;
    }
    .layout-tool-btn {
      border: 1px solid rgba(92, 199, 255, 0.32);
      background: rgba(92, 199, 255, 0.10);
      color: #b8e8ff;
      border-radius: 7px;
      width: 28px;
      height: 28px;
      padding: 4px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex: 0 0 auto;
    }
    .layout-tool-btn:hover {
      border-color: rgba(92, 199, 255, 0.55);
      background: rgba(92, 199, 255, 0.16);
    }
    .layout-tool-btn svg {
      width: 15px;
      height: 15px;
      fill: currentColor;
    }
    .sort-save-btn {
      display: none;
      width: 28px;
      height: 28px;
      padding: 4px;
      border: 1px solid rgba(92, 199, 255, 0.4);
      border-radius: 7px;
      background: rgba(92, 199, 255, 0.14);
      color: #b8e8ff;
      cursor: pointer;
      box-shadow: 0 8px 18px rgba(4, 8, 14, 0.45);
    }
    .sort-save-btn.show {
      display: inline-flex;
      align-items: center;
      flex: 0 0 auto;
      justify-content: center;
    }
    .sort-save-btn svg {
      width: 16px;
      height: 16px;
      fill: currentColor;
    }
    body:has(.page-header-actions) .page-title {
      margin: 0 0 6px;
      font-size: 24px;
      letter-spacing: 0.4px;
    }
    body:has(.page-header-actions) .page-subtitle {
      margin: 0;
      color: #94a3b8;
      font-size: 13px;
    }
    body:has(.page-header-actions) .card-grid {
      display: grid;
      --card-width: 220px;
      --card-height: 118px;
      --card-gap: 18px;
      gap: var(--card-gap);
      grid-template-columns: repeat(auto-fit, minmax(var(--card-width), var(--card-width)));
      grid-auto-rows: minmax(var(--card-height), auto);
      grid-auto-flow: row;
      align-content: start;
      justify-content: flex-start;
      width: 100%;
      min-width: 0;
      max-width: 100%;
    }
    body:has(.page-header-actions) .card-grid.drag-placing {
      min-height: calc(var(--card-height) * 6 + var(--card-gap) * 5);
      padding-bottom: calc(var(--card-height) + var(--card-gap));
    }
    body:has(.page-header-actions) .card {
      min-height: 118px;
      background: rgba(20, 30, 48, 0.8);
      border: 1px solid rgba(92, 199, 255, 0.14);
      border-radius: 12px;
      padding: 18px;
      padding-right: 44px;
      width: 220px;
      box-shadow: 0 18px 30px rgba(4, 8, 14, 0.4);
    }
    body:has(.page-header-actions) .card h2 {
      margin: 0 0 8px 0;
      font-size: 16px;
    }
    body:has(.page-header-actions) .card p {
      margin: 0;
      font-size: 13px;
      color: #cbd5f5;
    }

    .card-expandable {
      cursor: pointer;
      position: relative;
    }

    .card-drag-handle {
      position: absolute;
      top: 8px;
      right: 8px;
      width: 22px;
      height: 22px;
      border: 1px solid rgba(92, 199, 255, 0.3);
      border-radius: 6px;
      background: rgba(92, 199, 255, 0.08);
      color: #b8e8ff;
      cursor: grab;
      font-size: 14px;
      line-height: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      user-select: none;
    }

    .card-drag-handle:active {
      cursor: grabbing;
    }

    .card.is-dragging {
      opacity: 0.6;
      border-color: rgba(92, 199, 255, 0.5);
    }

    .card-actions {
      display: none;
      flex-direction: column;
      gap: 8px;
      position: absolute;
      left: 18px;
      right: 18px;
      top: calc(100% - 6px);
      background: rgba(11, 15, 22, 0.98);
      border: 1px solid rgba(92, 199, 255, 0.3);
      border-radius: 10px;
      padding: 10px;
      box-shadow: 0 18px 30px rgba(4, 8, 14, 0.55);
    }

    .card-actions button {
      text-align: left;
      background: rgba(92, 199, 255, 0.08);
      border: 1px solid rgba(92, 199, 255, 0.2);
      color: #e9eef5;
      padding: 8px 10px;
      border-radius: 8px;
      font-size: 13px;
      cursor: pointer;
    }

    .card-actions button:hover {
      border-color: rgba(92, 199, 255, 0.5);
    }

    .card-expandable.open .card-actions {
      display: flex;
    }

    .card-expandable.open {
      z-index: 5;
    }

    body:has(.page-header-actions) .card-panel {
      position: absolute;
      top: 12px;
      width: 320px;
      min-width: 320px;
      max-width: min(92vw, 320px);
      max-height: calc(100vh - 160px);
      overflow-y: auto;
      overflow-x: hidden;
      background: rgba(11, 15, 22, 0.98);
      border: 1px solid rgba(92, 199, 255, 0.3);
      border-radius: 12px;
      padding: 14px;
      box-shadow: 0 20px 32px rgba(4, 8, 14, 0.6);
      opacity: 0;
      pointer-events: none;
      transform: translateX(0);
      transition: transform 180ms ease, opacity 180ms ease;
      z-index: 6;
      display: none;
    }

    body:has(.page-header-actions) .card-panel.open {
      display: block;
      opacity: 1;
      pointer-events: auto;
    }

    .card-panel[data-side="right"] {
      left: calc(100% + 14px);
      transform: translateX(-12px);
    }

    .card-panel.open[data-side="right"] {
      transform: translateX(0);
    }

    .card-panel[data-side="left"] {
      right: calc(100% + 14px);
      transform: translateX(12px);
    }

    .card-panel.open[data-side="left"] {
      transform: translateX(0);
    }

    .card-panel[data-side="below"] {
      left: 0;
      right: 0;
      top: calc(100% + 8px);
      transform: translateY(-8px);
    }

    .card-panel.open[data-side="below"] {
      transform: translateY(0);
    }

    .card-panel-wide {
      width: 560px;
      min-width: 560px;
      max-width: min(90vw, 560px);
    }

    .card-panel-title {
      margin: 0 0 10px 0;
      font-size: 14px;
      letter-spacing: 0.4px;
    }

    .form-grid {
      display: grid;
      gap: 10px;
    }

    .form-row {
      display: grid;
      grid-template-columns: 120px minmax(0, 1fr);
      align-items: center;
      gap: 10px;
    }

    .form-row label {
      font-size: 12px;
      color: #cbd5f5;
    }

    .form-row input {
      background: rgba(18, 24, 34, 0.9);
      border: 1px solid rgba(92, 199, 255, 0.25);
      border-radius: 6px;
      color: #e9eef5;
      padding: 6px 8px;
      font-size: 13px;
      width: 100%;
      min-width: 0;
      box-sizing: border-box;
    }

    .form-row select {
      background: rgba(18, 24, 34, 0.9);
      border: 1px solid rgba(92, 199, 255, 0.25);
      border-radius: 6px;
      color: #e9eef5;
      padding: 6px 8px;
      font-size: 13px;
      width: 100%;
      min-width: 0;
      box-sizing: border-box;
    }

    .form-row input.is-invalid {
      border-color: rgba(255, 83, 83, 0.75);
      color: #ff6b6b;
    }

    .form-row input.is-valid {
      border-color: rgba(255, 213, 79, 0.8);
      color: #ffd54f;
    }

    .form-row input.is-good {
      border-color: rgba(76, 175, 80, 0.9);
      color: #7ae582;
    }

    .form-row input.is-match {
      border-color: rgba(76, 175, 80, 0.9);
      color: #7ae582;
    }

    .form-row input:invalid {
      box-shadow: none;
    }

    .password-field {
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
    }

    .password-field input {
      flex: 1;
      min-width: 0;
    }

    body:has(.page-header-actions) .password-toggle {
      flex: 0 0 auto;
      border: 1px solid rgba(92, 199, 255, 0.25);
      background: rgba(92, 199, 255, 0.08);
      color: #e9eef5;
      padding: 5px 8px;
      border-radius: 6px;
      cursor: pointer;
      font-size: 12px;
    }

    .form-actions {
      display: flex;
      gap: 10px;
      margin-top: 12px;
    }

    .form-actions button {
      flex: 1;
      background: rgba(92, 199, 255, 0.1);
      border: 1px solid rgba(92, 199, 255, 0.3);
      color: #e9eef5;
      padding: 8px 10px;
      border-radius: 8px;
      cursor: pointer;
      font-size: 13px;
    }

    .form-actions button:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }

    .checkbox-row input[type="checkbox"] {
      width: 16px;
      height: 16px;
      justify-self: start;
      accent-color: #5cc7ff;
    }

    .encryption-form .form-row {
      grid-template-columns: 150px minmax(0, 1fr);
    }

    .encryption-form .form-row.form-row-block {
      grid-template-columns: 1fr;
      gap: 6px;
    }

    .encryption-form .form-row.form-row-block label {
      margin-bottom: 2px;
    }

    .encryption-form input#stationIdPrivacyKey,
    .encryption-form input#stationIdPrivacyTgs {
      width: 100%;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
      font-size: 12px;
      letter-spacing: 0.3px;
      padding: 8px 10px;
    }

    .general-settings-form .mode-row {
      grid-template-columns: 150px minmax(0, 1fr);
      align-items: start;
    }

    .general-settings-form .mode-options {
      display: flex;
      gap: 14px;
      align-items: center;
      flex-wrap: wrap;
    }

    .general-settings-form .mode-options label {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 13px;
      color: #e9eef5;
    }

    .general-settings-form .mode-options input[type="checkbox"] {
      width: 16px;
      height: 16px;
      accent-color: #5cc7ff;
    }

    .panel-inline-status {
      min-height: 18px;
      margin-top: 2px;
      font-size: 12px;
      color: #a7b7cf;
    }

    .panel-inline-status.is-success {
      color: #7ae582;
    }

    .panel-inline-status.is-error {
      color: #ff7e7e;
    }

    .compliance-warning {
      margin-top: 8px;
      padding: 10px;
      border: 1px solid rgba(255, 203, 92, 0.45);
      background: rgba(255, 203, 92, 0.12);
      border-radius: 8px;
      color: #ffe8b0;
      font-size: 12px;
    }

    .compliance-warning-title {
      font-weight: 600;
      margin-bottom: 4px;
    }

    .compliance-warning-summary {
      margin-bottom: 6px;
    }

    .compliance-warning-list {
      margin: 0 0 8px 18px;
      padding: 0;
    }

    .compliance-warning-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .compliance-warning-actions button {
      background: rgba(92, 199, 255, 0.12);
      border: 1px solid rgba(92, 199, 255, 0.32);
      color: #e9eef5;
      border-radius: 8px;
      padding: 6px 10px;
      font-size: 12px;
      cursor: pointer;
    }

    .compliance-warning-actions .link-button {
      background: transparent;
      border: 1px solid rgba(255, 203, 92, 0.45);
      color: #ffe8b0;
    }

    body:has(.page-header-actions) .modal-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(6, 10, 18, 0.75);
      opacity: 0;
      visibility: hidden;
      transition: opacity 150ms ease;
      z-index: 1000;
    }

    .modal {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%) scale(0.98);
      background: rgba(20, 30, 48, 0.98);
      border: 1px solid rgba(92, 199, 255, 0.2);
      border-radius: 12px;
      padding: 20px;
      max-width: 520px;
      width: calc(100% - 32px);
      opacity: 0;
      visibility: hidden;
      transition: opacity 150ms ease, transform 150ms ease;
      z-index: 1001;
    }

    .modal.open,
    .modal-backdrop.open {
      opacity: 1;
      visibility: visible;
    }

    .modal.open {
      transform: translate(-50%, -50%) scale(1);
    }

    .modal h2 {
      margin: 0 0 10px 0;
      font-size: 18px;
    }

    .modal-actions {
      display: flex;
      gap: 12px;
      margin-top: 16px;
    }

    .modal-actions button {
      flex: 1;
      padding: 10px 12px;
      border-radius: 8px;
      border: 1px solid rgba(92, 199, 255, 0.3);
      background: rgba(92, 199, 255, 0.12);
      color: #e9eef5;
      cursor: pointer;
    }

    .guidelines-modal {
      max-width: 700px;
    }

    .guidelines-body {
      max-height: min(58vh, 440px);
      overflow-y: auto;
      padding-right: 8px;
      line-height: 1.5;
      color: #d7e2f2;
      border-top: 1px solid rgba(92, 199, 255, 0.2);
      border-bottom: 1px solid rgba(92, 199, 255, 0.2);
      padding-top: 10px;
      padding-bottom: 10px;
    }

    .search-results {
      margin-top: 12px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .search-status {
      font-size: 0.85em;
      color: #8899aa;
      margin: 0;
    }
    .search-result-row {
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(92,199,255,0.12);
      border-radius: 6px;
      padding: 8px 10px;
      display: flex;
      flex-direction: column;
      gap: 2px;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s;
    }
    .search-result-row:hover {
      background: rgba(92,199,255,0.10);
      border-color: rgba(92,199,255,0.35);
    }
    .search-result-name {
      font-size: 0.9em;
      font-weight: 600;
      color: #c8dff5;
    }
    .search-result-meta {
      font-weight: 400;
      color: #7a9ab8;
    }
    .search-result-detail {
      font-size: 0.8em;
      color: #7a9ab8;
    }
    /* Edit User — existing password preserved (click to replace) */
    input.is-preserved {
      border-color: #4a9abb !important;
      background: rgba(74,154,187,0.08) !important;
    }
    /* List Users panel */
    .card-panel-list {
      width: 420px;
      min-width: 280px;
      max-width: min(92vw, 420px);
      max-height: calc(100vh - 220px);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .list-user-controls {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 8px;
      flex-shrink: 0;
    }
    .list-user-controls .card-panel-title {
      margin: 0;
    }
    .list-user-controls-actions {
      display: flex;
      gap: 6px;
    }
    .list-user-controls-actions button {
      background: rgba(92,199,255,0.08);
      border: 1px solid rgba(92,199,255,0.2);
      color: #b8e8ff;
      border-radius: 6px;
      padding: 3px 9px;
      font-size: 12px;
      cursor: pointer;
    }
    .list-user-controls-actions button:hover {
      border-color: rgba(92,199,255,0.5);
    }
    .list-users-body {
      overflow-y: auto;
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
      gap: 6px;
      padding-right: 2px;
    }
    .list-users-body::-webkit-scrollbar {
      width: 5px;
    }
    .list-users-body::-webkit-scrollbar-track {
      background: transparent;
    }
    .list-users-body::-webkit-scrollbar-thumb {
      background: rgba(92,199,255,0.25);
      border-radius: 3px;
    }
    .list-user-count {
      font-size: 0.78em;
      color: #5a7a96;
      margin-bottom: 4px;
      flex-shrink: 0;
    }
    .list-user-row-deleted .search-result-name,
    .list-user-row-deleted .search-result-detail {
      opacity: 0.45;
    }


/* user.css */
    body:has(.page):not(:has(.page-header-actions)) {
      margin: 0;
      min-height: 100vh;
      background: #0b0f16;
      color: #e9eef5;
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    }
    body:has(.page):not(:has(.page-header-actions)) .page {
      padding: 28px 32px 40px;
    }
    body:has(.page):not(:has(.page-header-actions)) .page-header {
      margin-bottom: 24px;
    }
    body:has(.page):not(:has(.page-header-actions)) .page-title {
      margin: 0 0 6px 0;
      font-size: 24px;
      letter-spacing: 0.4px;
    }
    body:has(.page):not(:has(.page-header-actions)) .page-subtitle {
      margin: 0;
      color: #94a3b8;
      font-size: 13px;
    }
    body:has(.page):not(:has(.page-header-actions)) .card-grid {
      display: grid;
      gap: 18px;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
    body:has(.page):not(:has(.page-header-actions)) .card {
      background: rgba(20, 30, 48, 0.8);
      border: 1px solid rgba(92, 199, 255, 0.14);
      border-radius: 12px;
      padding: 18px;
      box-shadow: 0 18px 30px rgba(4, 8, 14, 0.4);
    }
    body:has(.page):not(:has(.page-header-actions)) .card h2 {
      margin: 0 0 8px 0;
      font-size: 16px;
    }
    body:has(.page):not(:has(.page-header-actions)) .card p {
      margin: 0;
      font-size: 13px;
      color: #cbd5f5;
    }


/* login.css */
    body:has(.login-container) {
      color-scheme: light;
      margin: 0;
      min-height: 100vh;
      background:
        radial-gradient(circle at 15% 20%, rgba(41, 86, 140, 0.65) 0%, rgba(15, 26, 44, 0) 45%),
        radial-gradient(circle at 80% 18%, rgba(27, 124, 109, 0.55) 0%, rgba(15, 26, 44, 0) 45%),
        radial-gradient(circle at 60% 75%, rgba(152, 46, 60, 0.5) 0%, rgba(15, 26, 44, 0) 50%),
        radial-gradient(circle at 30% 70%, rgba(70, 122, 56, 0.45) 0%, rgba(15, 26, 44, 0) 50%),
        #0f1a2c;
      color: #e9eef5;
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    }

    .login-container {
      max-width: 400px;
      margin: 100px auto;
      padding: 40px;
      background: rgba(15, 26, 44, 0.9);
      border-radius: 12px;
      border: 1px solid rgba(255, 255, 255, 0.1);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }

    .login-header {
      text-align: center;
      margin-bottom: 32px;
    }

    .login-title {
      font-size: 24px;
      font-weight: 600;
      color: #e9eef5;
      margin: 0 0 8px 0;
    }

    .login-subtitle {
      color: #94a3b8;
      font-size: 14px;
      margin: 0;
    }

    .form-group {
      margin-bottom: 20px;
    }

    .form-label {
      display: block;
      font-size: 14px;
      color: #e9eef5;
      margin-bottom: 8px;
      font-weight: 500;
    }

    .form-input {
      width: 100%;
      padding: 12px 16px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 8px;
      color: #e9eef5;
      font-size: 16px;
      transition: border-color 0.2s ease;
    }

    .form-input:focus {
      outline: none;
      border-color: #2563eb;
      box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }

    .form-input::placeholder {
      color: #64748b;
    }

    .password-row {
      position: relative;
    }

    body:has(.login-container) .password-toggle {
      position: absolute;
      top: 50%;
      right: 12px;
      transform: translateY(-50%);
      background: transparent;
      border: none;
      color: #94a3b8;
      font-size: 12px;
      cursor: pointer;
      padding: 4px 6px;
    }

    .password-toggle:hover {
      color: #e9eef5;
    }

    .remember-row {
      margin: -2px 0 18px;
    }

    .remember-label {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      font-size: 14px;
      color: #c8d5e8;
      cursor: pointer;
    }

    .remember-label input[type="checkbox"] {
      width: 15px;
      height: 15px;
    }

    .login-btn {
      width: 100%;
      padding: 12px 16px;
      background: linear-gradient(135deg, #2563eb, #1d4ed8);
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 16px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .login-btn:hover {
      background: linear-gradient(135deg, #1d4ed8, #1e40af);
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    }

    .error-message {
      background: rgba(220, 38, 38, 0.1);
      border: 1px solid rgba(220, 38, 38, 0.2);
      color: #fca5a5;
      padding: 12px;
      border-radius: 6px;
      margin-bottom: 20px;
      font-size: 14px;
    }

    .back-link {
      display: block;
      text-align: center;
      margin-top: 24px;
      color: #64748b;
      text-decoration: none;
      font-size: 14px;
    }

    .back-link:hover {
      color: #e9eef5;
    }

    .demo-credentials {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.1);
      padding: 16px;
      border-radius: 8px;
      margin-top: 24px;
      font-size: 12px;
      color: #94a3b8;
    }

    .demo-credentials strong {
      color: #e9eef5;
    }

    @media (max-width: 480px) {
      .login-container {
        margin: 40px 20px;
        padding: 32px 24px;
      }
    }


/* status/css/inline.css */
      body:has(.top-cards) {
        margin: 0;
        background: radial-gradient(circle at 20% 10%, rgba(92, 199, 255, 0.12), transparent 40%),
          radial-gradient(circle at 80% 0%, rgba(58, 164, 255, 0.2), transparent 45%),
          linear-gradient(180deg, #0a0f17 0%, #0b0f16 50%, #0a0d14 100%);
        color: var(--text);
        font-family: "Rajdhani", "Segoe UI", sans-serif;
      }

      body:has(.top-cards) .banner {
        padding: 28px 48px 48px;
        background: linear-gradient(120deg, rgba(15, 25, 40, 0.9) 0%, rgba(10, 16, 26, 0.4) 45%, rgba(11, 15, 22, 0.9) 100%);
        border-bottom: 1px solid rgba(92, 199, 255, 0.2);
        position: relative;
        overflow: hidden;
      }

      .banner::after {
        content: "";
        position: absolute;
        inset: 0;
        background: radial-gradient(circle at 65% 40%, rgba(92, 199, 255, 0.2), transparent 55%),
          radial-gradient(circle at 90% 60%, rgba(92, 199, 255, 0.12), transparent 45%);
        opacity: 0.8;
        pointer-events: none;
      }

      .embedded .banner {
        display: none;
      }

      .embedded .wrap {
        margin-top: 0;
      }

      body:has(.top-cards) .wrap {
        padding: 0 48px 48px;
        margin-top: -32px;
        max-width: 1520px;
        width: 100%;
        margin-left: auto;
        margin-right: auto;
      }

      .top-cards {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
      }

      .stat {
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 8px;
        padding: 14px 16px;
        display: grid;
        gap: 6px;
        align-content: start;
      }

      .stat-wide {
        width: 100%;
      }

      .stat-top-full {
        grid-column: 1 / -1;
      }

      .stat-label {
        font-size: 10px;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 1px;
      }

      .stat-value {
        font-size: 24px;
        font-weight: 700;
      }

      .stat-value-compact {
        font-size: 14px;
        line-height: 1.4;
        font-weight: 700;
      }

      .connections-rows {
        display: grid;
        gap: 8px;
      }

      .connections-row {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
      }

      .connections-item {
        white-space: nowrap;
      }

      .stat-alert-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        flex-wrap: nowrap;
      }

      .audio-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        cursor: pointer;
        color: var(--muted);
        font-size: 12px;
      }

      .audio-toggle input[type="checkbox"] {
        cursor: pointer;
        width: 16px;
        height: 16px;
      }


      .stat-subsection-gap {
        height: 8px;
      }

      .stat-subsection-label {
        font-size: 10px;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 1px;
      }

      .stat-status {
        display: grid;
        gap: 8px;
        justify-items: start;
        text-align: left;
        align-content: start;
      }

      .status-pill {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 6px 10px;
        border-radius: 999px;
        background: rgba(88, 214, 141, 0.12);
        color: var(--ok);
        font-weight: 600;
        text-transform: uppercase;
        font-size: 10px;
      }

      .dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--ok);
        box-shadow: 0 0 10px rgba(88, 214, 141, 0.8);
      }

      .hblink-service-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
        padding: 0;
        border: 1px solid rgba(255,255,255,0.25);
        border-radius: 4px;
        background: rgba(255,255,255,0.08);
        color: inherit;
        cursor: pointer;
        transition: background 0.15s, border-color 0.15s;
      }
      .hblink-service-btn:hover {
        background: rgba(255,255,255,0.18);
        border-color: rgba(255,255,255,0.4);
      }
      .hblink-service-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
      }

      .service-list {
        width: 100%;
        display: flex;
        flex-wrap: nowrap;
        align-items: flex-start;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
      }

      .service-row {
        width: auto;
        min-width: 120px;
        flex: 1 1 0;
        display: grid;
        grid-template-rows: auto auto auto auto;
        gap: 6px;
        align-items: start;
        border: 0;
        border-radius: 0;
        padding: 2px 0;
        background: transparent;
      }

      .service-row-empty {
        min-width: 220px;
      }

      .service-main {
        display: grid;
        grid-auto-rows: min-content;
        gap: 4px;
        align-items: start;
        min-width: 0;
      }

      .service-name {
        font-size: 12px;
        font-weight: 700;
        color: var(--text);
        white-space: normal;
      }

      .service-status-line {
        display: inline-flex;
        align-items: baseline;
        gap: 8px;
        flex-wrap: wrap;
      }

      .service-status {
        font-size: 9px;
        font-weight: 700;
        letter-spacing: 0.6px;
        white-space: nowrap;
      }

      .service-status-running {
        color: var(--ok);
      }

      .service-status-transition {
        color: var(--warn);
      }

      .service-status-stopped {
        color: #9aa3b2;
      }

      .service-status-error {
        color: var(--danger);
      }

      .service-uptime {
        font-size: 11px;
        color: var(--muted);
        line-height: 1.1;
        white-space: nowrap;
      }

      .service-actions {
        display: inline-flex;
        align-items: center;
        gap: 4px;
      }

      .service-feedback {
        grid-column: auto;
        font-size: 9px;
        color: var(--muted);
        min-width: 0;
        text-align: left;
        min-height: 12px;
      }

      .services-strip {
        margin-top: 16px;
      }

      .services-strip .section-title {
        font-size: 10px;
        letter-spacing: 1px;
      }

      .lastheard-strip .section-title {
        font-size: 10px;
        letter-spacing: 1px;
      }

      .section {
        margin-top: 24px;
        background: var(--panel-2);
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 16px 18px;
      }

      .section-title {
        font-size: 12px;
        letter-spacing: 2px;
        text-transform: uppercase;
        color: var(--muted);
        margin-bottom: 12px;
      }

      .lastheard-tabs {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin-bottom: 10px;
      }

      .lastheard-tab {
        border: 1px solid var(--line);
        background: rgba(20, 30, 45, 0.8);
        color: var(--muted);
        border-radius: 6px;
        padding: 4px 10px;
        font-size: 11px;
        letter-spacing: 0.5px;
        cursor: pointer;
      }

      .lastheard-tab:hover {
        color: var(--text);
        border-color: var(--accent);
      }

      .lastheard-tab.is-active {
        background: rgba(53, 106, 255, 0.18);
        border-color: var(--accent);
        color: var(--text);
      }

      .grid {
        display: grid;
        gap: 18px;
      }

      .grid.two {
        grid-template-columns: 1.1fr 0.9fr;
      }

      .grid.bottom {
        grid-template-columns: 0.6fr 1.4fr;
      }

      table {
        width: 100%;
        border-collapse: collapse;
        font-size: 11px;
      }

      th,
      td {
        border-bottom: 1px solid rgba(37, 48, 68, 0.8);
        padding: 10px 8px;
        text-align: left;
      }

      th {
        color: var(--muted);
        font-weight: 600;
        text-transform: uppercase;
        font-size: 9px;
        letter-spacing: 1px;
      }

      td.center {
        text-align: center;
      }

      .lastheard-strip {
        overflow-x: auto;
      }

      #lastheard-table th,
      #lastheard-table td {
        white-space: nowrap;
      }

      #lastheard-table {
        width: 100%;
        table-layout: auto;
      }

      /* PhantomRelay LH column shaping */
      #lastheard-table th:nth-child(1), #lastheard-table td:nth-child(1)  { padding-right: 4px; } /* Date/Time never truncate */
      #lastheard-table th:nth-child(2), #lastheard-table td:nth-child(2)  { min-width: 11ch;  max-width: 11ch;  padding-left: 10px; } /* Subscriber: 11 chars */
      #lastheard-table th:nth-child(3), #lastheard-table td:nth-child(3)  { min-width: 8ch;   max-width: 8ch;  padding-left: 4px; padding-right: 4px; } /* Call Sign: 8 chars */
      #lastheard-table th:nth-child(4), #lastheard-table td:nth-child(4)  { max-width: 140px; padding-left: 4px; overflow: hidden; text-overflow: ellipsis; } /* User tighter to Call Sign */
      #lastheard-table td:nth-child(5)  { max-width: 170px; overflow: hidden; text-overflow: ellipsis; } /* City */
      #lastheard-table td:nth-child(6)  { max-width: 210px; overflow: hidden; text-overflow: ellipsis; } /* State/Province */
      #lastheard-table td:nth-child(7)  { max-width: 140px; overflow: hidden; text-overflow: ellipsis; } /* Country */
      #lastheard-table td:nth-child(8)  { max-width: 340px; overflow: hidden; text-overflow: ellipsis; } /* Talkgroup */
      #lastheard-table td:nth-child(9)  { max-width: 42px; } /* Slot */
      #lastheard-table td:nth-child(10) { max-width: 112px; } /* Network */
      #lastheard-table th:nth-child(9), #lastheard-table td:nth-child(9)  { text-align: right; padding-right: 4px; } /* Slot edge alignment */
      #lastheard-table th:nth-child(10), #lastheard-table td:nth-child(10) { padding-left: 4px; } /* Network tighter to Slot */

      /* ACTIVE Last Heard row */
      #lastheard-table tr.lh-active {
        background-color: rgba(0,200,0,0.5) !important;
      }
      #lastheard-table tr.lh-active td {
        color: #fff !important;
        font-weight: 700 !important;
      }
      
      /* EMERGENCY ACTIVE Last Heard row (red instead of green) */
      #lastheard-table tr.lh-active.lh-emergency-active {
        background-color: rgba(241, 111, 111, 0.5) !important;
      }
      #lastheard-table tr.lh-active.lh-emergency-active td {
        color: #fff !important;
        font-weight: 700 !important;
      }

      /* Clickable emergency talkgroup tag in Last Heard */
      .lh-emergency-link {
        cursor: pointer;
        text-decoration: underline;
        text-underline-offset: 2px;
      }
      .lh-emergency-link:hover {
        filter: brightness(1.1);
      }

      .emergency-spinner {
        display: inline-block;
        width: 12px;
        height: 12px;
        margin-right: 6px;
        border: 2px solid rgba(145, 161, 186, 0.45);
        border-top-color: var(--accent);
        border-radius: 50%;
        animation: emergency-spin 0.8s linear infinite;
        vertical-align: -1px;
      }
      @keyframes emergency-spin {
        to {
          transform: rotate(360deg);
        }
      }
      
      /* Emergency Modal Popup */
      html.emergency-modal-open,
      body.emergency-modal-open {
        overflow: hidden !important;
      }

      #emergency-modal {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.7);
        z-index: 10000;
        align-items: center;
        justify-content: center;
        animation: fadeIn 0.3s ease;
        padding: 12px;
        overflow-y: hidden;
      }
      
      #emergency-modal.show {
        display: flex;
      }
      
      @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
      }
      
      #emergency-modal-content {
        background: var(--panel);
        border: 2px solid var(--danger);
        border-radius: 12px;
        padding: 24px;
        max-width: 500px;
        width: 90%;
        max-height: none;
        overflow-y: visible;
        box-shadow: 0 8px 32px rgba(241, 111, 111, 0.3);
        position: relative;
        animation: slideUp 0.3s ease;
      }

      #emergency-details-content {
        max-height: 42vh;
        overflow-y: auto;
        padding-right: 6px;
      }

      @media (max-height: 700px) {
        #emergency-details-content {
          max-height: 36vh;
        }
      }
      
      @keyframes slideUp {
        from {
          transform: translateY(20px);
          opacity: 0;
        }
        to {
          transform: translateY(0);
          opacity: 1;
        }
      }
      
      #emergency-modal-close {
        position: absolute;
        top: 12px;
        right: 12px;
        background: transparent;
        border: none;
        color: var(--muted);
        font-size: 24px;
        line-height: 1;
        cursor: pointer;
        padding: 4px 8px;
        border-radius: 4px;
        transition: color 0.2s, background 0.2s;
      }
      
      #emergency-modal-close:hover {
        color: var(--text);
        background: rgba(255, 255, 255, 0.1);
      }
      
      #emergency-modal-title {
        color: var(--danger);
        font-size: 24px;
        font-weight: 700;
        margin: 0 0 20px 0;
        text-align: center;
      }
      
      #emergency-modal-info {
        display: grid;
        gap: 12px;
      }
      
      .emergency-info-row {
        display: grid;
        grid-template-columns: 120px 1fr;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 1px solid var(--line);
      }
      
      .emergency-info-row:last-child {
        border-bottom: none;
      }
      
      .emergency-info-label {
        color: var(--muted);
        font-weight: 600;
        font-size: 14px;
      }
      
      .emergency-info-value {
        color: var(--text);
        font-size: 14px;
      }
      
      .emergency-info-value.placeholder {
        color: var(--muted);
        font-style: italic;
      }
      
      /* Emergency History Modal */
      #emergency-history-modal {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.7);
        z-index: 10001;
        align-items: center;
        justify-content: center;
        animation: fadeIn 0.3s ease;
      }
      
      #emergency-history-modal.show {
        display: flex;
      }
      
      #emergency-history-modal-content {
        background: var(--panel);
        border: 2px solid var(--danger);
        border-radius: 12px;
        padding: 24px;
        max-width: 600px;
        width: 90%;
        max-height: 80vh;
        box-shadow: 0 8px 32px rgba(241, 111, 111, 0.3);
        position: relative;
        animation: slideUp 0.3s ease;
        display: flex;
        flex-direction: column;
      }
      
      #emergency-history-modal-close {
        position: absolute;
        top: 12px;
        right: 12px;
        background: transparent;
        border: none;
        color: var(--muted);
        font-size: 24px;
        line-height: 1;
        cursor: pointer;
        padding: 4px 8px;
        border-radius: 4px;
        transition: color 0.2s, background 0.2s;
      }
      
      #emergency-history-modal-close:hover {
        color: var(--text);
        background: rgba(255, 255, 255, 0.1);
      }
      
      #emergency-history-modal-title {
        color: var(--danger);
        font-size: 24px;
        font-weight: 700;
        margin: 0 0 20px 0;
        text-align: center;
      }
      
      .emergency-history-entry {
        padding: 12px;
        border-bottom: 1px solid var(--line);
        cursor: pointer;
        transition: background 0.2s;
      }
      
      .emergency-history-entry:hover {
        background: rgba(241, 111, 111, 0.1);
      }
      
      .emergency-history-entry:last-child {
        border-bottom: none;
      }

      .tag {
        display: inline-block;
        padding: 4px 8px;
        border-radius: 999px;
        background: rgba(92, 199, 255, 0.15);
        color: var(--accent);
        font-size: 9px;
        letter-spacing: 1px;
        text-transform: uppercase;
      }

      .status-up {
        color: var(--ok);
        font-weight: 600;
      }

      .sidebar {
        display: grid;
        gap: 12px;
      }

      .nav-item {
        padding: 12px 14px;
        border-radius: 8px;
        background: rgba(17, 22, 34, 0.8);
        border: 1px solid var(--line);
        color: var(--muted);
        font-size: 11px;
      }

      .map-placeholder {
        height: 220px;
        border-radius: 10px;
        border: 1px dashed rgba(145, 161, 186, 0.4);
        display: grid;
        place-items: center;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 2px;
        font-size: 10px;
      }

      .version {
        font-size: 9px;
        color: var(--muted);
        margin-top: 6px;
      }

      @media (max-width: 980px) {
        .wrap {
          padding: 0 20px 32px;
          max-width: 100%;
        }

        .top-cards {
          grid-template-columns: 1fr;
        }

        .connections-row {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .service-list {
          gap: 8px;
        }

        .grid.two,
        .grid.bottom {
          grid-template-columns: 1fr;
        }
      }

      @media (max-width: 640px) {
        .connections-row {
          grid-template-columns: 1fr;
        }

        .service-list {
          flex-wrap: wrap;
          overflow-x: visible;
        }

        #lastheard-table th,
        #lastheard-table td {
          white-space: normal;
        }
      }


/* inc/cookie-notice.php inline styles */
#phantom-cookie-notice {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 0.75rem 1.5rem;
  background: rgba(18, 22, 30, 0.97);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.4);
  flex-wrap: wrap;
}
.phantom-cookie-text {
  margin: 0;
  font-size: 0.82rem;
  color: #aab;
  line-height: 1.5;
}
.phantom-cookie-btn {
  flex-shrink: 0;
  padding: 0.35rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: #3a7bd5;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.phantom-cookie-btn:hover {
  background: #2f66b8;
}


/* gps/index.php inline styles */
    body.gps-mode .wrap {
      max-width: none;
      width: 100%;
      height: 90%;
      margin: 0;
      padding: 0;
      overflow: hidden;
    }

    @media (min-width: 769px) {
      body.gps-mode.has-right-menu:not(.menu-collapsed) .wrap {
      }

body.gps-mode .gps-map-card {
  width: 100%;
  height: 90%;
  max-width: none;
  margin: 0;
  border-radius: 0;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

    .gps-map-layout {
      display: flex;
      gap: 12px;
      width: 100%;
      flex: 1;
      min-height: 0;
    }

    .gps-subscriber-panel {
      width: 300px;
      min-width: 300px;
      background: rgba(10, 17, 27, 0.75);
      border: 1px solid rgba(92, 199, 255, 0.2);
      border-radius: 10px;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      transition: width 0.28s ease, min-width 0.28s ease;
    }

    .gps-subscriber-panel.collapsed {
      width: 46px;
      min-width: 46px;
    }

    .gps-subscriber-panel.collapsed .gps-subscriber-title-text,
    .gps-subscriber-panel.collapsed .gps-subscriber-list {
      display: none;
    }

    .gps-subscriber-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 10px 10px 12px;
      border-bottom: 1px solid rgba(92, 199, 255, 0.18);
      background: rgba(17, 27, 40, 0.85);
      min-height: 44px;
    }

    .gps-subscriber-title-text {
      font-size: 12px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: #9ec7e7;
      font-weight: 700;
    }

    .gps-subscriber-toggle {
      width: 24px;
      height: 24px;
      border: 1px solid rgba(92, 199, 255, 0.25);
      background: rgba(92, 199, 255, 0.08);
      color: #b7dfff;
      border-radius: 6px;
      cursor: pointer;
      font-size: 12px;
      line-height: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .gps-subscriber-toggle:hover {
      background: rgba(92, 199, 255, 0.18);
      border-color: rgba(92, 199, 255, 0.35);
      color: #e4f4ff;
    }

    .gps-subscriber-list {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      padding: 8px;
    }

    .gps-subscriber-item {
      width: 100%;
      border: 1px solid rgba(92, 199, 255, 0.14);
      background: rgba(18, 28, 42, 0.85);
      color: #d7e8f8;
      border-radius: 8px;
      padding: 8px 10px;
      margin-bottom: 8px;
      text-align: left;
      cursor: pointer;
      transition: background 0.2s ease, border-color 0.2s ease;
    }

    .gps-subscriber-item:hover {
      background: rgba(35, 56, 84, 0.92);
      border-color: rgba(92, 199, 255, 0.38);
    }

    .gps-subscriber-name {
      font-size: 14px;
      font-weight: 700;
      color: #f0f8ff;
      line-height: 1.25;
    }

    .gps-subscriber-id {
      font-size: 12px;
      color: #8fb0cc;
      margin-top: 2px;
      line-height: 1.2;
    }

    .gps-subscriber-last-seen {
      font-size: 11px;
      color: #5d8aaa;
      margin-top: 3px;
      line-height: 1.2;
    }

    .gps-subscriber-empty {
      font-size: 12px;
      color: #91a9bf;
      text-align: center;
      padding: 16px 8px;
    }

    .gps-subscriber-entry {
      margin-bottom: 8px;
    }
    .gps-subscriber-entry .gps-subscriber-item {
      margin-bottom: 0;
      border-radius: 8px;
      width: 100%;
    }
    .gps-subscriber-entry .gps-subscriber-item.subcard-open {
      border-bottom-left-radius: 0;
      border-bottom-right-radius: 0;
      border-color: rgba(92, 199, 255, 0.45);
      background: rgba(35, 56, 84, 0.95);
    }
    .gps-subscriber-subcard {
      display: none;
      background: rgba(12, 19, 30, 0.97);
      border: 1px solid rgba(92, 199, 255, 0.28);
      border-top: none;
      border-bottom-left-radius: 8px;
      border-bottom-right-radius: 8px;
      padding: 10px 12px 12px;
      font-size: 12px;
      color: #b8d4ea;
    }
    .gps-subscriber-subcard.open { display: block; }

    /* Details section inside the dark subcard — force all backgrounds dark, all text white */
    .gps-subscriber-subcard .details-section { background: transparent; }
    .gps-subscriber-subcard .details-marker-summary { background: rgba(255,255,255,0.08) !important; }
    .gps-subscriber-subcard .details-content * { color: #ffffff !important; background: transparent !important; border-color: rgba(255,255,255,0.25) !important; }
    .gps-subscriber-subcard .details-content a { color: #7ad4ff !important; }
    .gps-subscriber-subcard .details-content h4 { border-bottom: 1px solid rgba(255,255,255,0.2) !important; padding-bottom: 3px; }
    .subcard-coords {
      font-family: monospace;
      font-size: 12px;
      color: #9ec7e7;
      margin-bottom: 3px;
    }
    .subcard-motion { font-size: 11px; color: #7aadcc; margin-bottom: 2px; }
    .subcard-timestamp { font-size: 11px; color: #5d8aaa; margin-bottom: 8px; }
    .subcard-controls { margin-top: 6px; }
    .subcard-controls .track-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
    .subcard-controls .details-btn { margin-top: 4px; }

    /* User group cards in subscriber panel */
    .gps-user-group {
      margin-bottom: 10px;
      border: 1px solid rgba(92, 199, 255, 0.22);
      border-radius: 8px;
      overflow: hidden;
    }
    .gps-user-header {
      width: 100%;
      background: rgba(18, 38, 62, 0.92);
      color: #d7e8f8;
      border: none;
      padding: 9px 12px;
      text-align: left;
      cursor: pointer;
      display: flex;
      align-items: center;
      font-weight: 700;
      font-size: 13px;
      transition: background 0.2s ease;
    }
    .gps-user-header:hover { background: rgba(35, 60, 95, 0.95); }
    .gps-user-header-name { color: #f0f8ff; flex: 1; }
    .gps-user-header-arrow {
      font-size: 10px;
      color: #5cc7ff;
      margin-left: 6px;
      transition: transform 0.2s;
    }
    .gps-user-group.collapsed .gps-user-header-arrow { transform: rotate(-90deg); }
    .gps-user-devices { padding: 4px 6px 6px; background: rgba(10, 18, 30, 0.7); }
    .gps-user-group.collapsed .gps-user-devices { display: none; }
    .gps-device-entry { margin-bottom: 6px; }
    .gps-device-entry:last-child { margin-bottom: 0; }
    .gps-device-entry .gps-subscriber-item {
      margin-bottom: 0;
      border-radius: 6px;
      padding: 7px 10px;
    }
    .gps-subscriber-header-row {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 8px;
    }
    .gps-subscriber-header-meta {
      min-width: 0;
      flex: 1;
    }
    .gps-subscriber-fix-state {
      flex: 0 0 auto;
      margin-top: 1px;
      margin-left: auto;
    }
    .gps-device-entry .gps-subscriber-item.subcard-open {
      border-bottom-left-radius: 0;
      border-bottom-right-radius: 0;
      border-color: rgba(92, 199, 255, 0.45);
      background: rgba(35, 56, 84, 0.95);
    }
    .gps-device-type-badge {
      display: inline-block;
      font-size: 10px;
      font-weight: 600;
      color: #5cc7ff;
      background: rgba(92, 199, 255, 0.12);
      border: 1px solid rgba(92, 199, 255, 0.25);
      border-radius: 3px;
      padding: 1px 5px;
      margin-top: 3px;
      letter-spacing: 0.03em;
    }

    @media (max-width: 1100px) {
      .gps-subscriber-panel {
        width: 250px;
        min-width: 250px;
      }
    }

    @media (max-width: 900px) {
      .gps-map-layout {
        flex-direction: column;
        min-height: 0;
      }

      .gps-subscriber-panel {
        width: 100%;
        min-width: 100%;
        max-height: 220px;
      }

      .gps-subscriber-panel.collapsed {
        width: 100%;
        min-width: 100%;
        max-height: 44px;
      }
    }
    
    body.gps-mode .gps-map-body {
      position: relative;
      flex: 1;
      min-width: 0;
      min-height: 0;
      height: 100%;
    }
    
    .emergency-modal {
      position: absolute;
      top: 10px;
      right: 10px;
      z-index: 10000;
      max-width: 300px;
      width: auto;
    }
    
    .emergency-content {
      background: rgba(255, 23, 68, 0.95);
      color: white;
      border-radius: 8px;
      box-shadow: 0 4px 16px rgba(255, 23, 68, 0.6);
      animation: emergencyPulse 1s ease-in-out infinite alternate;
    }
    
    .emergency-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 16px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .emergency-header h2 {
      margin: 0;
      font-size: 1.1em;
      font-weight: bold;
    }
    
    .emergency-close {
      background: none;
      border: none;
      color: white;
      font-size: 18px;
      cursor: pointer;
      padding: 0;
      width: 24px;
      height: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .emergency-close:hover {
      background: rgba(255, 255, 255, 0.2);
      border-radius: 50%;
    }
    
    .emergency-body {
      padding: 12px 16px;
    }
    
    #emergencyMessage {
      font-size: 1em;
      font-weight: bold;
      margin-bottom: 8px;
    }
    
    #emergencyDetails {
      font-size: 0.85em;
      opacity: 0.9;
    }
    
    .emergency-minimal {
      position: absolute;
      top: 10px;
      right: 10px;
      z-index: 10000;
      background: rgba(255, 23, 68, 0.9);
      color: white;
      padding: 8px 12px;
      border-radius: 6px;
      font-size: 0.9em;
      font-weight: bold;
      cursor: pointer;
      box-shadow: 0 2px 8px rgba(255, 23, 68, 0.4);
      animation: emergencyPulse 1s ease-in-out infinite alternate;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    
    .emergency-minimal:hover {
      background: rgba(213, 0, 0, 0.9);
    }
    
    .emergency-minimal-close {
      background: none;
      border: none;
      color: white;
      font-size: 16px;
      cursor: pointer;
      padding: 0;
      width: 20px;
      height: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 50%;
    }
    
    .emergency-minimal-close:hover {
      background: rgba(255, 255, 255, 0.2);
    }
    
    .emergency-history-modal {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.7);
      z-index: 10001;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    
    .emergency-history-content {
      background: rgba(255, 255, 255, 0.8);
      border-radius: 8px;
      max-width: 500px;
      width: 90%;
      max-height: 70vh;
      overflow-y: auto;
      backdrop-filter: blur(5px);
    }
    
    .emergency-history-header {
      padding: 20px;
      border-bottom: 1px solid #eee;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    
    .emergency-history-header h3 {
      margin: 0;
      color: #333;
    }
    
    .emergency-history-close {
      background: none;
      border: none;
      font-size: 24px;
      cursor: pointer;
      color: #666;
      padding: 0;
      width: 30px;
      height: 30px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .emergency-history-close:hover {
      background: #f0f0f0;
      border-radius: 50%;
    }
    
    .emergency-history-list {
      padding: 20px;
      max-height: 400px;
      overflow-y: auto;
    }
    
    .emergency-overlay {
      pointer-events: none;
      z-index: 1000;
    }
    
    .emergency-triangle-overlay {
      pointer-events: none;
      z-index: 2000;
    }
    
    .emergency-triangle-overlay img {
      filter: drop-shadow(0 1px 3px rgba(255, 23, 68, 0.8));
    }
    
    .gps-tooltip-address {
      color: #4a90d9;
      font-style: italic;
      font-size: 0.9em;
      display: block;
      margin-top: 2px;
    }

    .gps-tooltip-motion {
      display: block;
      font-size: 0.84em;
      margin-top: 2px;
      color: #596673;
    }

    .gps-fix-line {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .gps-fix-state {
      font-size: 0.82em;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.02em;
      padding: 1px 6px;
      border-radius: 12px;
      border: 1px solid transparent;
      line-height: 1.3;
    }

    .gps-fix-state-green {
      background: #e8f5e9;
      color: #1b5e20;
      border-color: #a5d6a7;
    }

    .gps-fix-state-yellow {
      background: #fff8e1;
      color: #7a5b00;
      border-color: #ffecb3;
    }

    .gps-fix-state-orange {
      background: #fff3e0;
      color: #a54600;
      border-color: #ffcc80;
    }

    .gps-fix-state-red {
      background: #ffebee;
      color: #b71c1c;
      border-color: #ef9a9a;
    }
    
    .details-btn {
      background: #4a90d9;
      color: white;
      border: none;
      padding: 6px 12px;
      border-radius: 4px;
      cursor: pointer;
      font-size: 0.9em;
    }
    
    .details-btn:hover {
      background: #357abd;
    }
    
    .details-btn:disabled {
      background: #ccc;
      cursor: not-allowed;
    }
    
    .details-section {
      background: #f8f9fa;
      border: 1px solid #dee2e6;
      border-radius: 4px;
      padding: 10px;
      font-size: 0.85em;
      max-height: 260px;
      overflow-y: auto;
      overflow-x: hidden;
    }

    .gps-details-popup .leaflet-popup-content {
      max-height: none;
      overflow: visible;
    }

    .gps-details-popup .leaflet-popup-content-wrapper {
      opacity: 0.9;
      background: rgba(255, 255, 255, 0.96);
    }

    .gps-popup-toolbar {
      display: flex;
      justify-content: flex-end;
      padding-right: 22px;
      margin-bottom: 6px;
    }

    .gps-popup-drag-handle {
      font-size: 0.74em;
      color: #4f5f71;
      background: rgba(221, 232, 245, 0.88);
      border: 1px solid #c5d7eb;
      border-radius: 4px;
      padding: 2px 8px;
      margin: 0;
      display: inline-block;
      cursor: move;
      user-select: none;
    }

    .gps-details-popup .leaflet-popup.gps-popup-dragging {
      transition: none !important;
    }

    .gps-details-popup .leaflet-popup.gps-popup-dragging .gps-popup-drag-handle {
      cursor: grabbing;
    }

    .gps-details-popup .leaflet-popup.gps-popup-dragging * {
      user-select: none;
    }
    
    .details-marker-summary {
      background: rgba(255,255,255,0.08);
      border-left: 3px solid #1a5a80;
      border-radius: 4px;
      padding: 8px 10px;
      margin-bottom: 10px;
      font-size: 12px;
      line-height: 1.6;
      color: #111111;
    }
    .details-marker-name { font-size: 13px; color: #ffffff; font-weight: bold; margin-bottom: 3px; }
    .details-marker-coords { color: #ffffff; }
    .details-marker-motion { color: #ffffff; }
    .details-marker-ts { color: #ffffff; }
    .details-marker-address { color: #ffffff; margin-top: 3px; }
    .details-content h4 {
      margin: 10px 0 5px 0;
      color: #333;
      font-size: 1em;
    }
    
    .agency-item, .business-item {
      margin: 8px 0;
      padding: 6px;
      background: white;
      border-radius: 3px;
      border-left: 3px solid #4a90d9;
    }
    
    .contact-info, .business-info {
      color: #666;
      font-size: 0.9em;
    }
    
    .emergency-contacts {
      background: #fff3cd;
      border: 1px solid #ffeaa7;
      border-radius: 3px;
      padding: 8px;
    }
    
    .emergency-contacts div {
      margin: 3px 0;
    }
    
    .jurisdiction-info {
      background: #e3f2fd;
      border: 1px solid #bbdefb;
      border-radius: 3px;
      padding: 6px;
      margin: 5px 0;
      font-size: 0.9em;
    }
    
    .details-content a {
      color: #4a90d9;
      text-decoration: none;
    }
    
    .details-content a:hover {
      text-decoration: underline;
    }
    
    .details-content small {
      color: #666;
      font-style: italic;
    }

    .details-loading {
      display: flex;
      align-items: center;
      gap: 10px;
      color: #495057;
      font-size: 0.9em;
    }

    .details-loading-spinner {
      width: 14px;
      height: 14px;
      border: 2px solid #d6e4f5;
      border-top-color: #4a90d9;
      border-radius: 50%;
      animation: details-spin 0.8s linear infinite;
      flex: 0 0 auto;
    }

    .details-loading-status {
      color: #5f6c7b;
      font-size: 0.85em;
      margin-top: 4px;
    }

    .track-controls {
      margin-top: 10px;
      padding: 8px;
      border: 1px solid #d6e4f5;
      border-radius: 4px;
      background: #f6fbff;
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 8px;
    }

    .track-controls label {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-weight: 600;
      color: #2f4d67;
      font-size: 0.9em;
    }

    .track-controls select {
      border: 1px solid #c5d7eb;
      border-radius: 4px;
      padding: 3px 6px;
      background: #fff;
      color: #1d2d3f;
      font-size: 0.88em;
    }

    .track-status {
      width: 100%;
      font-size: 0.82em;
      color: #5f6c7b;
    }

    .details-prefetch-inline {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      color: #5f6c7b;
      font-size: 0.88em;
    }

    .details-inline-spinner {
      width: 12px;
      height: 12px;
      border: 2px solid #d6e4f5;
      border-top-color: #4a90d9;
      border-radius: 50%;
      animation: details-spin 0.8s linear infinite;
      flex: 0 0 auto;
    }

    @keyframes details-spin {
      from { transform: rotate(0deg); }
      to { transform: rotate(360deg); }
    }
    
    #alertTriangleIndicator {
      position: absolute;
      top: 10px;
      right: 10px;
      z-index: 10000;
      width: 40px;
      height: 40px;
      cursor: pointer;
      animation: pulse 2s infinite;
    }
    
    #alertTriangleIndicator img {
      width: 100%;
      height: 100%;
      filter: drop-shadow(0 2px 8px rgba(255, 23, 68, 0.6));
    }
    
    #alertTriangleIndicator:hover {
      transform: scale(1.1);
      transition: transform 0.2s;
    }
    
    body.gps-mode .emergency-history-item {
      padding: 12px;
      border-bottom: 1px solid #eee;
      cursor: pointer;
      transition: background-color 0.2s;
    }
    
    body.gps-mode .emergency-history-item:hover {
      background: #f9f9f9;
    }
    
    body.gps-mode .emergency-history-item:last-child {
      border-bottom: none;
    }
    
    .emergency-history-time {
      font-weight: bold;
      color: #ff1744;
    }
    
    .emergency-history-details {
      color: #666;
      font-size: 0.9em;
      margin-top: 4px;
    }
    
    @keyframes emergencyPulse {
      from { box-shadow: 0 4px 16px rgba(255, 23, 68, 0.6); }
      to { box-shadow: 0 4px 16px rgba(255, 23, 68, 0.9); }
    }
