:root {
      --bg: #f5f7fb;
      --card: #ffffff;
      --text: #172033;
      --muted: #6b7280;
      --primary: #155eef;
      --primary-dark: #0f3fb0;
      --success: #16a34a;
      --warning: #f59e0b;
      --danger: #dc2626;
      --dark: #0f172a;
      --border: #e5e7eb;
      --shadow: 0 14px 40px rgba(15, 23, 42, 0.10);
      --radius: 20px;
    }

    * {
      box-sizing: border-box;
    }

    html {
      scroll-behavior: smooth;
    }

    body {
      margin: 0;
      font-family: "Segoe UI", Arial, sans-serif;
      background: var(--bg);
      color: var(--text);
    }

    a {
      color: inherit;
      text-decoration: none;
    }

    .container {
      width: min(1180px, calc(100% - 32px));
      margin: 0 auto;
    }

    .topbar {
      position: sticky;
      top: 0;
      z-index: 50;
      background: rgba(255, 255, 255, 0.92);
      backdrop-filter: blur(16px);
      border-bottom: 1px solid var(--border);
    }

    .nav {
      min-height: 72px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 20px;
      padding: 10px 0;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 12px;
      font-weight: 800;
      letter-spacing: -0.03em;
      font-size: 22px;
    }

    .logo {
      width: 42px;
      height: 42px;
      border-radius: 14px;
      background: linear-gradient(135deg, #155eef, #0ea5e9);
      display: grid;
      place-items: center;
      color: white;
      box-shadow: 0 10px 24px rgba(21, 94, 239, .25);
      overflow: hidden;
    }

    .logo span {
      font-size: 20px;
      font-weight: 900;
    }

    /*
      Когда будет ваш настоящий логотип:
      1) положи файл logo.png в папку static
      2) замени <img src="/static/logo.png" alt="AlertGrid" class="company-logo"> на:
         <img src="logo.png" alt="Логотип компании" class="company-logo">
    */
    .company-logo {
      width: 42px;
      height: 42px;
      object-fit: contain;
    }

    .nav-links {
      display: flex;
      align-items: center;
      gap: 22px;
      font-size: 14px;
      color: #334155;
      font-weight: 600;
    }

    .nav-actions {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .btn {
      border: 0;
      cursor: pointer;
      font-weight: 700;
      border-radius: 14px;
      padding: 12px 18px;
      transition: .2s ease;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      font-size: 14px;
    }

    .btn-primary {
      background: var(--primary);
      color: white;
      box-shadow: 0 10px 24px rgba(21, 94, 239, .25);
    }

    .btn-primary:hover {
      background: var(--primary-dark);
      transform: translateY(-1px);
    }

    .btn-light {
      background: white;
      color: var(--text);
      border: 1px solid var(--border);
    }

    .btn-light:hover {
      border-color: #cbd5e1;
      transform: translateY(-1px);
    }

    .hero {
      position: relative;
      overflow: hidden;
      background:
        radial-gradient(circle at 20% 20%, rgba(21, 94, 239, .20), transparent 28%),
        radial-gradient(circle at 85% 15%, rgba(14, 165, 233, .18), transparent 28%),
        linear-gradient(135deg, #0f172a, #172554 55%, #0f172a);
      color: white;
      padding: 76px 0 86px;
    }

    .hero-grid {
      display: grid;
      grid-template-columns: 1.05fr .95fr;
      gap: 42px;
      align-items: center;
    }

    .badge {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      border-radius: 999px;
      background: rgba(255,255,255,.12);
      border: 1px solid rgba(255,255,255,.16);
      color: #dbeafe;
      font-size: 13px;
      font-weight: 700;
      margin-bottom: 22px;
    }

    .hero h1 {
      font-size: clamp(38px, 5vw, 64px);
      line-height: .98;
      letter-spacing: -0.06em;
      margin: 0 0 22px;
    }

    .hero p {
      color: #cbd5e1;
      font-size: 18px;
      line-height: 1.65;
      max-width: 650px;
      margin: 0 0 28px;
    }

    .hero-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      margin-top: 26px;
    }

    .hero .btn-light {
      background: rgba(255,255,255,.10);
      color: white;
      border-color: rgba(255,255,255,.18);
    }

    .hero-card {
      background: rgba(255,255,255,.10);
      border: 1px solid rgba(255,255,255,.16);
      border-radius: 28px;
      padding: 20px;
      box-shadow: 0 24px 70px rgba(0,0,0,.30);
      backdrop-filter: blur(18px);
    }

    .screen {
      background: #0b1224;
      border-radius: 22px;
      overflow: hidden;
      border: 1px solid rgba(255,255,255,.10);
    }

    .screen-head {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 14px;
      background: rgba(255,255,255,.06);
    }

    .dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: #64748b;
    }

    .dot.red {
      background: #ef4444;
    }

    .dot.yellow {
      background: #f59e0b;
    }

    .dot.green {
      background: #22c55e;
    }

    .dashboard-preview {
      padding: 18px;
    }

    .mini-cards {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 12px;
      margin-bottom: 16px;
    }

    .mini-card {
      background: rgba(255,255,255,.08);
      border: 1px solid rgba(255,255,255,.10);
      border-radius: 16px;
      padding: 14px;
    }

    .mini-card strong {
      display: block;
      font-size: 24px;
      margin-bottom: 4px;
    }

    .mini-card small {
      color: #cbd5e1;
    }

    .fake-map {
      height: 230px;
      border-radius: 18px;
      background:
        linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px),
        linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
        radial-gradient(circle at 25% 45%, rgba(34,197,94,.32), transparent 4%),
        radial-gradient(circle at 68% 35%, rgba(239,68,68,.38), transparent 5%),
        radial-gradient(circle at 55% 70%, rgba(245,158,11,.34), transparent 4%),
        #111827;
      background-size: 38px 38px, 38px 38px, auto, auto, auto, auto;
      position: relative;
      overflow: hidden;
      border: 1px solid rgba(255,255,255,.08);
    }

    .map-label {
      position: absolute;
      left: 18px;
      top: 18px;
      font-weight: 800;
      font-size: 14px;
      color: #e5e7eb;
    }

    .pin {
      position: absolute;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      box-shadow: 0 0 0 8px rgba(255,255,255,.08);
    }

    .pin.green {
      background: #22c55e;
      left: 25%;
      top: 45%;
    }

    .pin.red {
      background: #ef4444;
      left: 68%;
      top: 35%;
      animation: pulse 1.4s infinite;
    }

    .pin.yellow {
      background: #f59e0b;
      left: 55%;
      top: 70%;
    }

    @keyframes pulse {
      0% {
        box-shadow: 0 0 0 0 rgba(239,68,68,.55);
      }

      70% {
        box-shadow: 0 0 0 16px rgba(239,68,68,0);
      }

      100% {
        box-shadow: 0 0 0 0 rgba(239,68,68,0);
      }
    }

    section {
      padding: 82px 0;
    }

    .section-title {
      max-width: 780px;
      margin: 0 auto 44px;
      text-align: center;
    }

    .section-title h2 {
      margin: 0 0 14px;
      font-size: clamp(30px, 3.5vw, 44px);
      letter-spacing: -0.045em;
    }

    .section-title p {
      color: var(--muted);
      font-size: 17px;
      line-height: 1.65;
      margin: 0;
    }

    .grid-3 {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 20px;
    }

    .grid-4 {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 18px;
    }

    .card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 24px;
      box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
    }

    .card h3 {
      margin: 0 0 10px;
      font-size: 20px;
      letter-spacing: -0.025em;
    }

    .card p {
      margin: 0;
      color: var(--muted);
      line-height: 1.6;
      font-size: 15px;
    }

    .icon {
      width: 46px;
      height: 46px;
      border-radius: 16px;
      display: grid;
      place-items: center;
      margin-bottom: 16px;
      background: #eff6ff;
      color: var(--primary);
      font-size: 22px;
    }

    .telemetry {
      background: white;
    }

    .split {
      display: grid;
      grid-template-columns: .9fr 1.1fr;
      gap: 34px;
      align-items: center;
    }

    .feature-list {
      display: grid;
      gap: 12px;
      margin-top: 24px;
    }

    .feature-item {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      padding: 14px;
      border-radius: 16px;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      color: #334155;
      font-weight: 650;
    }

    .check {
      width: 24px;
      height: 24px;
      min-width: 24px;
      border-radius: 50%;
      background: #dcfce7;
      color: #166534;
      display: grid;
      place-items: center;
      font-weight: 900;
    }

    .panel {
      background: #0f172a;
      color: white;
      border-radius: 28px;
      padding: 24px;
      box-shadow: var(--shadow);
    }

    .event-list {
      display: grid;
      gap: 12px;
    }

    .event-row {
      display: grid;
      grid-template-columns: auto 1fr auto;
      gap: 12px;
      align-items: center;
      background: rgba(255,255,255,.07);
      border: 1px solid rgba(255,255,255,.09);
      padding: 14px;
      border-radius: 16px;
    }

    .severity {
      width: 12px;
      height: 42px;
      border-radius: 999px;
    }

    .severity.danger {
      background: var(--danger);
    }

    .severity.warning {
      background: var(--warning);
    }

    .severity.success {
      background: var(--success);
    }

    .event-row strong {
      display: block;
      margin-bottom: 4px;
    }

    .event-row span {
      color: #cbd5e1;
      font-size: 13px;
    }

    .status-pill {
      padding: 7px 10px;
      border-radius: 999px;
      background: rgba(255,255,255,.10);
      color: #e5e7eb;
      font-size: 12px;
      font-weight: 800;
      white-space: nowrap;
    }

    .reports {
      background: #eef4ff;
    }

    .report-card {
      background: white;
      border-radius: 26px;
      padding: 24px;
      border: 1px solid #dbeafe;
      box-shadow: 0 10px 28px rgba(30, 64, 175, 0.08);
    }

    .report-table {
      width: 100%;
      border-collapse: collapse;
      overflow: hidden;
      border-radius: 14px;
      font-size: 14px;
    }

    .report-table th,
    .report-table td {
      text-align: left;
      padding: 13px;
      border-bottom: 1px solid #e5e7eb;
    }

    .report-table th {
      color: #475569;
      background: #f8fafc;
      font-size: 13px;
    }

    .cta {
      background: linear-gradient(135deg, #155eef, #0f172a);
      color: white;
      border-radius: 34px;
      padding: 44px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 28px;
      box-shadow: var(--shadow);
    }

    .cta h2 {
      margin: 0 0 10px;
      font-size: 34px;
      letter-spacing: -0.045em;
    }

    .cta p {
      margin: 0;
      color: #cbd5e1;
      line-height: 1.6;
    }

    footer {
      padding: 46px 0;
      background: #0f172a;
      color: #cbd5e1;
    }

    .footer-grid {
      display: grid;
      grid-template-columns: 1.2fr repeat(3, 1fr);
      gap: 24px;
    }

    footer h4 {
      color: white;
      margin: 0 0 14px;
    }

    footer p,
    footer a {
      font-size: 14px;
      line-height: 1.7;
      color: #cbd5e1;
    }

    footer a {
      display: block;
      margin: 7px 0;
    }

    .modal {
      position: fixed;
      inset: 0;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 18px;
      background: rgba(15, 23, 42, .62);
      z-index: 100;
    }

    .modal.open {
      display: flex;
    }

    .modal-card {
      width: min(440px, 100%);
      background: white;
      border-radius: 26px;
      padding: 28px;
      box-shadow: 0 30px 90px rgba(0,0,0,.28);
    }

    .modal-card h2 {
      margin: 0 0 8px;
      letter-spacing: -0.035em;
      font-size: 28px;
    }

    .modal-card p {
      margin: 0 0 22px;
      color: var(--muted);
      line-height: 1.55;
    }

    .form-group {
      display: grid;
      gap: 7px;
      margin-bottom: 14px;
    }

    label {
      font-weight: 750;
      font-size: 13px;
      color: #334155;
    }

    input,
    select,
    textarea {
      width: 100%;
      border: 1px solid #d1d5db;
      border-radius: 14px;
      padding: 13px 14px;
      font: inherit;
      outline: none;
      transition: .2s ease;
      background: white;
    }

    input:focus,
    select:focus,
    textarea:focus {
      border-color: var(--primary);
      box-shadow: 0 0 0 4px rgba(21, 94, 239, .12);
    }

    .modal-actions {
      display: flex;
      gap: 10px;
      margin-top: 18px;
    }

    .app-view {
      display: none;
      min-height: 100vh;
      background: #f1f5f9;
    }

    .app-view.active {
      display: block;
    }

    .site-view.hidden {
      display: none;
    }

    .app-shell {
      display: grid;
      grid-template-columns: 280px 1fr;
      min-height: 100vh;
    }

    .sidebar {
      background: #0f172a;
      color: white;
      padding: 24px;
      position: sticky;
      top: 0;
      height: 100vh;
    }

    .side-brand {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 30px;
      font-weight: 850;
      font-size: 20px;
    }

    .side-menu {
      display: grid;
      gap: 8px;
    }

    .side-menu button {
      text-align: left;
      border: 0;
      background: transparent;
      color: #cbd5e1;
      border-radius: 14px;
      padding: 13px 14px;
      font-weight: 700;
      cursor: pointer;
    }

    .side-menu button.active,
    .side-menu button:hover {
      background: rgba(255,255,255,.10);
      color: white;
    }

    .app-main {
      padding: 26px;
    }

    .app-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 20px;
      margin-bottom: 24px;
    }

    .app-header h1 {
      margin: 0 0 6px;
      letter-spacing: -0.04em;
      font-size: 34px;
    }

    .app-header p {
      margin: 0;
      color: var(--muted);
    }

    .stats-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 16px;
      margin-bottom: 20px;
    }

    .stat-card {
      background: white;
      border: 1px solid var(--border);
      border-radius: 22px;
      padding: 20px;
      box-shadow: 0 6px 18px rgba(15,23,42,.04);
    }

    .stat-card span {
      color: var(--muted);
      font-size: 13px;
      font-weight: 750;
    }

    .stat-card strong {
      display: block;
      font-size: 32px;
      margin-top: 8px;
      letter-spacing: -0.04em;
    }

    .app-grid {
      display: grid;
      grid-template-columns: 1.1fr .9fr;
      gap: 18px;
    }

    .app-panel {
      background: white;
      border: 1px solid var(--border);
      border-radius: 24px;
      padding: 20px;
      box-shadow: 0 6px 18px rgba(15,23,42,.04);
    }

    .app-panel h2 {
      margin: 0 0 16px;
      font-size: 20px;
      letter-spacing: -0.025em;
    }

    .real-map {
      height: 420px;
      border-radius: 20px;
      background:
        linear-gradient(90deg, #e2e8f0 1px, transparent 1px),
        linear-gradient(#e2e8f0 1px, transparent 1px),
        #f8fafc;
      background-size: 42px 42px;
      position: relative;
      overflow: hidden;
      border: 1px solid #e2e8f0;
    }

    .real-map::before {
      content: "";
      position: absolute;
      width: 460px;
      height: 210px;
      border: 16px solid rgba(21,94,239,.08);
      border-radius: 50%;
      transform: rotate(-22deg);
      left: 80px;
      top: 85px;
    }

    .map-pin {
      position: absolute;
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 10px;
      border-radius: 999px;
      background: white;
      border: 1px solid #e2e8f0;
      box-shadow: 0 10px 24px rgba(15,23,42,.12);
      font-size: 12px;
      font-weight: 800;
    }

    .map-pin i {
      width: 11px;
      height: 11px;
      border-radius: 50%;
      display: block;
    }

    .map-pin.ok i {
      background: var(--success);
    }

    .map-pin.warn i {
      background: var(--warning);
    }

    .map-pin.alarm i {
      background: var(--danger);
    }

    .map-pin.p1 {
      left: 55px;
      top: 110px;
    }

    .map-pin.p2 {
      right: 60px;
      top: 85px;
    }

    .map-pin.p3 {
      left: 42%;
      bottom: 70px;
    }

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

    .table th,
    .table td {
      padding: 13px 10px;
      border-bottom: 1px solid #e5e7eb;
      text-align: left;
    }

    .table th {
      color: #64748b;
      font-size: 12px;
      text-transform: uppercase;
    }

    .tag {
      display: inline-flex;
      padding: 6px 9px;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 850;
    }

    .tag.red {
      background: #fee2e2;
      color: #991b1b;
    }

    .tag.green {
      background: #dcfce7;
      color: #166534;
    }

    .tag.yellow {
      background: #fef3c7;
      color: #92400e;
    }

    .tag.blue {
      background: #dbeafe;
      color: #1e40af;
    }

    .cabinet-list {
      display: grid;
      gap: 12px;
    }

    .object-card {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 18px;
      border: 1px solid #e2e8f0;
      border-radius: 18px;
      padding: 16px;
      background: #f8fafc;
    }

    .object-card strong {
      display: block;
      margin-bottom: 4px;
    }

    .object-card span {
      color: var(--muted);
      font-size: 13px;
    }


    .object-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .small-btn {
      border: 0;
      cursor: pointer;
      border-radius: 999px;
      padding: 7px 10px;
      font-size: 12px;
      font-weight: 850;
    }

    .small-btn.delete {
      background: #fee2e2;
      color: #991b1b;
    }

    .small-btn.delete:hover {
      background: #fecaca;
    }

    .coord-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }



    .app-section {
      display: none;
    }

    .app-section.active-section {
      display: block;
    }

    .event-card {
      border: 1px solid #e2e8f0;
      border-radius: 18px;
      padding: 16px;
      background: #f8fafc;
      display: grid;
      gap: 12px;
    }

    .event-card-header {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: flex-start;
    }

    .event-card strong {
      display: block;
      font-size: 16px;
      margin-bottom: 4px;
    }

    .event-card span {
      color: var(--muted);
      font-size: 13px;
    }

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

    .small-btn.accept {
      background: #dbeafe;
      color: #1e40af;
    }

    .small-btn.work {
      background: #fef3c7;
      color: #92400e;
    }

    .small-btn.close {
      background: #dcfce7;
      color: #166534;
    }

    .small-btn.false {
      background: #f3f4f6;
      color: #374151;
    }

    .small-btn.report {
      background: #ede9fe;
      color: #5b21b6;
    }

    .dashboard-empty {
      border: 1px dashed #cbd5e1;
      border-radius: 18px;
      padding: 20px;
      color: var(--muted);
      background: #f8fafc;
      text-align: center;
    }

    .modal-card.wide {
      width: min(720px, 100%);
    }

    .form-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }

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

    /* Настоящая карта Leaflet / OpenStreetMap */
    #map.real-map {
      height: 420px;
      border-radius: 20px;
      overflow: hidden;
      border: 1px solid #e2e8f0;
      background: #e5e7eb;
      position: relative;
    }

    #map.real-map::before {
      display: none;
      content: none;
    }

    .leaflet-container {
      font-family: "Segoe UI", Arial, sans-serif;
    }

    .leaflet-popup-content {
      font-size: 13px;
      line-height: 1.45;
    }

    .map-popup-title {
      font-weight: 800;
      font-size: 14px;
      margin-bottom: 4px;
      color: #0f172a;
    }

    .map-popup-line {
      color: #475569;
      margin: 2px 0;
    }

    @media (max-width: 980px) {
      .hero-grid,
      .split,
      .app-grid {
        grid-template-columns: 1fr;
      }

      .grid-3,
      .grid-4,
      .stats-grid {
        grid-template-columns: repeat(2, 1fr);
      }

      .nav-links {
        display: none;
      }

      .app-shell {
        grid-template-columns: 1fr;
      }

      .sidebar {
        position: relative;
        height: auto;
      }
    }

    @media (max-width: 620px) {
      .grid-3,
      .grid-4,
      .stats-grid,
      .mini-cards {
        grid-template-columns: 1fr;
      }

      .cta {
        flex-direction: column;
        align-items: flex-start;
        padding: 28px;
      }

      .nav {
        height: auto;
        padding: 14px 0;
        flex-wrap: wrap;
      }

      .hero {
        padding: 52px 0;
      }

      section {
        padding: 56px 0;
      }

      .app-main {
        padding: 16px;
      }
    }
  
    /* Исправление: карта не должна выходить поверх меню и окон */
    .topbar {
      z-index: 3000;
    }

    .sidebar {
      z-index: 2500;
    }

    .app-header {
      position: relative;
      z-index: 2000;
    }

    .modal {
      z-index: 5000;
    }

    .modal-card {
      position: relative;
      z-index: 5100;
    }

    #map,
    #mapFull,
    .real-map {
      position: relative;
      z-index: 1;
    }

    .leaflet-container {
      z-index: 1;
    }

    .leaflet-pane {
      z-index: 1;
    }

    .leaflet-map-pane {
      z-index: 1;
    }

    .leaflet-tile-pane {
      z-index: 1;
    }

    .leaflet-overlay-pane {
      z-index: 2;
    }

    .leaflet-marker-pane {
      z-index: 3;
    }

    .leaflet-tooltip-pane {
      z-index: 4;
    }

    .leaflet-popup-pane {
      z-index: 5;
    }

    .leaflet-top,
    .leaflet-bottom {
      z-index: 10;
    }

  
    /* Анимированные маркеры объектов по статусу */
    .ag-marker {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      border: 3px solid #ffffff;
      box-shadow: 0 8px 18px rgba(15, 23, 42, 0.28);
      position: relative;
    }

    .ag-marker::after {
      content: "";
      position: absolute;
      inset: -9px;
      border-radius: 50%;
      opacity: 0.45;
      animation: agPulse 1.6s infinite;
    }

    .ag-marker.normal {
      background: #16a34a;
    }

    .ag-marker.normal::after {
      background: rgba(22, 163, 74, 0.25);
      animation: none;
      opacity: 0.25;
    }

    .ag-marker.warning {
      background: #f59e0b;
    }

    .ag-marker.warning::after {
      background: rgba(245, 158, 11, 0.35);
      animation: agPulse 1.8s infinite;
    }

    .ag-marker.alarm {
      background: #dc2626;
      animation: agBlink 0.9s infinite;
    }

    .ag-marker.alarm::after {
      background: rgba(220, 38, 38, 0.45);
      animation: agPulse 1.1s infinite;
    }

    .ag-marker.offline {
      background: #64748b;
    }

    .ag-marker.offline::after {
      background: rgba(100, 116, 139, 0.25);
      animation: none;
    }

    @keyframes agPulse {
      0% {
        transform: scale(0.75);
        opacity: 0.55;
      }
      70% {
        transform: scale(1.8);
        opacity: 0;
      }
      100% {
        transform: scale(0.75);
        opacity: 0;
      }
    }

    @keyframes agBlink {
      0%, 100% {
        filter: brightness(1);
      }
      50% {
        filter: brightness(1.8);
      }
    }

    .ag-marker-label {
      position: absolute;
      left: 28px;
      top: -2px;
      white-space: nowrap;
      background: #ffffff;
      color: #0f172a;
      border: 1px solid #e2e8f0;
      border-radius: 999px;
      padding: 4px 9px;
      font-size: 12px;
      font-weight: 800;
      box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    }

    .ag-marker-wrap {
      position: relative;
    }

  
    /* Скролл для блоков тревог, событий и отчётов */
    .scroll-box {
      max-height: 420px;
      overflow-y: auto;
      padding-right: 6px;
    }

    .scroll-box.small {
      max-height: 360px;
    }

    .scroll-box.large {
      max-height: 650px;
    }

    .scroll-box::-webkit-scrollbar {
      width: 8px;
    }

    .scroll-box::-webkit-scrollbar-track {
      background: #f1f5f9;
      border-radius: 999px;
    }

    .scroll-box::-webkit-scrollbar-thumb {
      background: #cbd5e1;
      border-radius: 999px;
    }

    .scroll-box::-webkit-scrollbar-thumb:hover {
      background: #94a3b8;
    }

    .app-panel {
      min-height: 0;
    }

    .app-grid {
      align-items: start;
    }

  
    /* Таблица объектов для большого количества записей */
    .objects-toolbar {
      display: grid;
      grid-template-columns: 1fr 220px 180px;
      gap: 12px;
      margin-bottom: 16px;
      align-items: center;
    }

    .objects-table-wrap {
      border: 1px solid #e5e7eb;
      border-radius: 18px;
      overflow: auto;
      max-height: 620px;
      background: white;
    }

    .objects-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 14px;
      min-width: 980px;
    }

    .objects-table th {
      position: sticky;
      top: 0;
      z-index: 20;
      background: #f8fafc;
      color: #475569;
      text-align: left;
      padding: 12px;
      border-bottom: 1px solid #e5e7eb;
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: .03em;
    }

    .objects-table td {
      padding: 12px;
      border-bottom: 1px solid #eef2f7;
      vertical-align: middle;
      color: #334155;
    }

    .objects-table tr:hover td {
      background: #f8fafc;
    }

    .object-name-cell {
      font-weight: 800;
      color: #0f172a;
    }

    .table-actions {
      display: flex;
      gap: 8px;
      flex-wrap: nowrap;
    }

    .pagination-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      margin-top: 14px;
      color: var(--muted);
      font-size: 14px;
      flex-wrap: wrap;
    }

    @media (max-width: 900px) {
      .objects-toolbar {
        grid-template-columns: 1fr;
      }
    }

  
    #mapPicker {
      position: relative;
      z-index: 1;
      background: #e5e7eb;
    }

    #mapPicker .leaflet-container,
    #mapPicker .leaflet-pane,
    #mapPicker .leaflet-top,
    #mapPicker .leaflet-bottom {
      z-index: 1;
    }

    .modal-card.wide {
      width: min(760px, 100%);
    }

    .form-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }

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

  
    /* Дашборды по городам */
    .city-filter-bar {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-top: 12px;
      flex-wrap: wrap;
    }

    .city-filter-bar label {
      color: #475569;
      font-weight: 800;
      font-size: 13px;
    }

    .city-filter-bar select {
      min-width: 220px;
      max-width: 280px;
      padding: 10px 12px;
      border-radius: 14px;
    }

    .city-summary-panel hierarchy-summary-panel {
      margin-bottom: 18px;
    }

    .city-summary-grid hierarchy-summary-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      max-height: 260px;
      overflow-y: auto;
      padding-right: 6px;
    }

    .city-summary-card hierarchy-summary-card {
      border: 1px solid #e2e8f0;
      border-radius: 18px;
      background: #f8fafc;
      padding: 14px;
      cursor: pointer;
      transition: .18s ease;
    }

    .city-summary-card hierarchy-summary-card:hover {
      transform: translateY(-1px);
      box-shadow: 0 8px 22px rgba(15,23,42,.08);
      background: #ffffff;
    }

    .city-summary-card hierarchy-summary-card.active {
      border-color: #155eef;
      box-shadow: 0 0 0 4px rgba(21,94,239,.10);
      background: #eff6ff;
    }

    .city-summary-title hierarchy-summary-title {
      font-weight: 900;
      color: #0f172a;
      margin-bottom: 10px;
    }

    .city-summary-numbers hierarchy-summary-numbers {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      font-size: 12px;
      color: #475569;
    }

    .city-summary-numbers hierarchy-summary-numbers strong {
      display: block;
      font-size: 18px;
      color: #0f172a;
      letter-spacing: -.03em;
    }

    @media (max-width: 1100px) {
      .city-summary-grid hierarchy-summary-grid {
        grid-template-columns: repeat(2, 1fr);
      }
    }

    @media (max-width: 620px) {
      .city-summary-grid hierarchy-summary-grid {
        grid-template-columns: 1fr;
      }
    }

  
    .hierarchy-filter-bar {
      display: grid;
      grid-template-columns: auto minmax(180px, 240px) auto minmax(180px, 240px) auto minmax(180px, 260px);
      gap: 10px;
      align-items: center;
      margin-top: 12px;
    }

    .hierarchy-filter-bar label {
      white-space: nowrap;
    }

    .hierarchy-summary-grid {
      grid-template-columns: repeat(4, 1fr);
    }

    .hierarchy-level-badge {
      display: inline-flex;
      align-items: center;
      padding: 4px 8px;
      border-radius: 999px;
      font-size: 11px;
      font-weight: 900;
      background: #e0f2fe;
      color: #075985;
      margin-bottom: 8px;
    }

    @media (max-width: 1100px) {
      .hierarchy-filter-bar {
        grid-template-columns: 1fr;
      }
    }

  
    .tag.gray {
      background: #e2e8f0;
      color: #334155;
    }

    .tag.orange {
      background: #ffedd5;
      color: #9a3412;
    }

  
    /* Компактные квадратные плитки иерархии */
    .hierarchy-summary-panel {
      margin-bottom: 18px;
    }

    .hierarchy-summary-grid,
    .city-summary-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
      gap: 12px;
      max-height: 360px;
      overflow-y: auto;
      padding-right: 6px;
      align-items: stretch;
    }

    .hierarchy-summary-card,
    .city-summary-card {
      min-height: 150px;
      aspect-ratio: 1 / 1;
      border: 1px solid #e2e8f0;
      border-radius: 20px;
      background: #ffffff;
      padding: 12px;
      cursor: pointer;
      transition: .18s ease;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      box-shadow: 0 6px 18px rgba(15,23,42,.04);
    }

    .hierarchy-summary-card:hover,
    .city-summary-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 12px 26px rgba(15,23,42,.10);
      border-color: #bfdbfe;
    }

    .hierarchy-summary-card.active,
    .city-summary-card.active {
      border-color: #155eef;
      background: #eff6ff;
      box-shadow: 0 0 0 4px rgba(21,94,239,.10);
    }

    .hierarchy-level-badge {
      align-self: flex-start;
      display: inline-flex;
      align-items: center;
      padding: 4px 8px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 900;
      background: #e0f2fe;
      color: #075985;
      margin-bottom: 8px;
      max-width: 100%;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .hierarchy-summary-title,
    .city-summary-title {
      font-weight: 900;
      color: #0f172a;
      font-size: 14px;
      line-height: 1.2;
      min-height: 34px;
      max-height: 50px;
      overflow: hidden;
    }

    .hierarchy-summary-numbers,
    .city-summary-numbers {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 6px;
      font-size: 11px;
      color: #64748b;
      margin-top: 8px;
    }

    .hierarchy-summary-numbers div,
    .city-summary-numbers div {
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-radius: 12px;
      padding: 6px;
      min-height: 42px;
    }

    .hierarchy-summary-numbers strong,
    .city-summary-numbers strong {
      display: block;
      font-size: 18px;
      color: #0f172a;
      line-height: 1;
      letter-spacing: -.03em;
      margin-bottom: 3px;
    }

    @media (max-width: 900px) {
      .hierarchy-summary-grid,
      .city-summary-grid {
        grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
      }

      .hierarchy-summary-card,
      .city-summary-card {
        min-height: 135px;
      }
    }

    @media (max-width: 520px) {
      .hierarchy-summary-grid,
      .city-summary-grid {
        grid-template-columns: repeat(2, 1fr);
      }
    }

  
    /* Компактные плитки объектов на дашборде */
    .dashboard-objects-panel {
      margin-top: 18px;
    }

    .object-tile-controls {
      display: flex;
      gap: 10px;
      align-items: center;
      flex-wrap: wrap;
    }

    .object-tile-controls input {
      width: 260px;
      max-width: 100%;
      padding: 10px 12px;
      border-radius: 14px;
    }

    .object-tile-controls select {
      width: 180px;
      padding: 10px 12px;
      border-radius: 14px;
    }

    .object-tile-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
      gap: 8px;
      max-height: 430px;
      overflow-y: auto;
      padding-right: 6px;
    }

    .object-tile-grid::-webkit-scrollbar {
      width: 8px;
    }

    .object-tile-grid::-webkit-scrollbar-track {
      background: #f1f5f9;
      border-radius: 999px;
    }

    .object-tile-grid::-webkit-scrollbar-thumb {
      background: #cbd5e1;
      border-radius: 999px;
    }

    .object-tile {
      min-height: 72px;
      border: 1px solid #e2e8f0;
      border-radius: 16px;
      background: #ffffff;
      padding: 10px;
      cursor: pointer;
      transition: .16s ease;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      gap: 8px;
      box-shadow: 0 4px 12px rgba(15,23,42,.04);
    }

    .object-tile:hover {
      transform: translateY(-1px);
      box-shadow: 0 10px 22px rgba(15,23,42,.10);
      border-color: #bfdbfe;
    }

    .object-tile-name {
      font-size: 12px;
      font-weight: 900;
      line-height: 1.2;
      color: #0f172a;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      min-height: 29px;
    }

    .object-tile-footer {
      display: flex;
      gap: 5px;
      flex-wrap: wrap;
      align-items: center;
    }

    .object-tile .mini-status {
      display: inline-flex;
      align-items: center;
      padding: 4px 7px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 900;
      line-height: 1;
    }

    .mini-status.green {
      background: #dcfce7;
      color: #166534;
    }

    .mini-status.red {
      background: #fee2e2;
      color: #991b1b;
    }

    .mini-status.yellow {
      background: #fef3c7;
      color: #92400e;
    }

    .mini-status.blue {
      background: #dbeafe;
      color: #1e40af;
    }

    .mini-status.gray {
      background: #e2e8f0;
      color: #334155;
    }

    .mini-status.orange {
      background: #ffedd5;
      color: #9a3412;
    }

    .object-tile.alarm {
      border-color: #fecaca;
      background: #fff7f7;
    }

    .object-tile.warning {
      border-color: #fde68a;
      background: #fffbeb;
    }

    .object-tile.normal {
      border-color: #bbf7d0;
      background: #f8fff9;
    }

    .object-tile.no_connection {
      border-color: #cbd5e1;
      background: #f8fafc;
    }

    @media (max-width: 700px) {
      .object-tile-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
      }

      .object-tile-controls {
        width: 100%;
      }

      .object-tile-controls input,
      .object-tile-controls select {
        width: 100%;
      }
    }

  
    /* Дашборд: компактные плитки объектов вместо длинных карточек */
    .dashboard-objects-panel {
      margin-top: 0;
    }

    .object-tile-controls {
      display: flex;
      gap: 10px;
      align-items: center;
      flex-wrap: wrap;
    }

    .object-tile-controls input {
      width: 260px;
      max-width: 100%;
      padding: 10px 12px;
      border-radius: 14px;
    }

    .object-tile-controls select {
      width: 180px;
      padding: 10px 12px;
      border-radius: 14px;
    }

    #objectsList.object-tile-grid,
    .object-tile-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
      gap: 8px;
      max-height: 430px;
      overflow-y: auto;
      padding-right: 6px;
    }

    #objectsList.object-tile-grid::-webkit-scrollbar,
    .object-tile-grid::-webkit-scrollbar {
      width: 8px;
    }

    #objectsList.object-tile-grid::-webkit-scrollbar-track,
    .object-tile-grid::-webkit-scrollbar-track {
      background: #f1f5f9;
      border-radius: 999px;
    }

    #objectsList.object-tile-grid::-webkit-scrollbar-thumb,
    .object-tile-grid::-webkit-scrollbar-thumb {
      background: #cbd5e1;
      border-radius: 999px;
    }

    .object-tile {
      min-height: 70px;
      border: 1px solid #e2e8f0;
      border-radius: 16px;
      background: #ffffff;
      padding: 9px;
      cursor: pointer;
      transition: .16s ease;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      gap: 8px;
      box-shadow: 0 4px 12px rgba(15,23,42,.04);
    }

    .object-tile:hover {
      transform: translateY(-1px);
      box-shadow: 0 10px 22px rgba(15,23,42,.10);
      border-color: #bfdbfe;
    }

    .object-tile-name {
      font-size: 12px;
      font-weight: 900;
      line-height: 1.2;
      color: #0f172a;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      min-height: 29px;
    }

    .object-tile-footer {
      display: flex;
      gap: 5px;
      flex-wrap: wrap;
      align-items: center;
    }

    .mini-status {
      display: inline-flex;
      align-items: center;
      padding: 4px 7px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 900;
      line-height: 1;
    }

    .mini-status.green {
      background: #dcfce7;
      color: #166534;
    }

    .mini-status.red {
      background: #fee2e2;
      color: #991b1b;
    }

    .mini-status.yellow {
      background: #fef3c7;
      color: #92400e;
    }

    .mini-status.blue {
      background: #dbeafe;
      color: #1e40af;
    }

    .mini-status.gray {
      background: #e2e8f0;
      color: #334155;
    }

    .mini-status.orange {
      background: #ffedd5;
      color: #9a3412;
    }

    .object-tile.alarm {
      border-color: #fecaca;
      background: #fff7f7;
    }

    .object-tile.warning {
      border-color: #fde68a;
      background: #fffbeb;
    }

    .object-tile.normal {
      border-color: #bbf7d0;
      background: #f8fff9;
    }

    .object-tile.no_connection {
      border-color: #cbd5e1;
      background: #f8fafc;
    }

    @media (max-width: 700px) {
      #objectsList.object-tile-grid,
      .object-tile-grid {
        grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
      }

      .object-tile-controls {
        width: 100%;
      }

      .object-tile-controls input,
      .object-tile-controls select {
        width: 100%;
      }
    }

  
    /* Цветные плитки объектов по статусам */
    .object-tile {
      position: relative;
      overflow: hidden;
      border-width: 2px;
    }

    .object-tile::before {
      content: "";
      position: absolute;
      inset: 0;
      opacity: .08;
      pointer-events: none;
    }

    .object-tile.normal {
      border-color: #22c55e;
      background: linear-gradient(135deg, #f0fdf4, #ffffff);
    }

    .object-tile.normal::before {
      background: #22c55e;
    }

    .object-tile.alarm,
    .object-tile.no_connection {
      border-color: #ef4444;
      background: linear-gradient(135deg, #fef2f2, #ffffff);
      animation: tileAlarmPulse 1.4s infinite;
    }

    .object-tile.alarm::before,
    .object-tile.no_connection::before {
      background: #ef4444;
    }

    .object-tile.warning,
    .object-tile.unstable_connection,
    .object-tile.no_coords {
      border-color: #f59e0b;
      background: linear-gradient(135deg, #fffbeb, #ffffff);
    }

    .object-tile.warning::before,
    .object-tile.unstable_connection::before,
    .object-tile.no_coords::before {
      background: #f59e0b;
    }

    .object-tile.offline {
      border-color: #64748b;
      background: linear-gradient(135deg, #f1f5f9, #ffffff);
    }

    .object-tile.offline::before {
      background: #64748b;
    }

    @keyframes tileAlarmPulse {
      0%, 100% {
        box-shadow: 0 4px 12px rgba(239, 68, 68, .10);
      }
      50% {
        box-shadow: 0 0 0 4px rgba(239, 68, 68, .14), 0 8px 24px rgba(239, 68, 68, .20);
      }
    }

    .object-tile-top {
      position: relative;
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 6px;
      z-index: 1;
    }

    .object-tile-icon {
      width: 26px;
      height: 26px;
      min-width: 26px;
      border-radius: 999px;
      display: grid;
      place-items: center;
      font-size: 14px;
      font-weight: 900;
      background: #ffffff;
      border: 1px solid #e2e8f0;
      box-shadow: 0 4px 10px rgba(15,23,42,.08);
    }

    .object-tile-name {
      position: relative;
      z-index: 1;
    }

    .object-tile-footer {
      position: relative;
      z-index: 1;
    }

    .mini-status {
      gap: 4px;
    }

    .mini-status .status-icon {
      font-size: 10px;
      line-height: 1;
    }

    .object-tile-meta {
      position: relative;
      z-index: 1;
      font-size: 10px;
      color: #64748b;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-top: -2px;
    }

  
    /* FIX: гарантированное отображение плиток объектов */
    #objectsList.object-tile-grid,
    .object-tile-grid {
      display: grid !important;
      grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
      gap: 8px !important;
      min-height: 90px;
      max-height: 430px;
      overflow-y: auto;
      padding-right: 6px;
    }

    .object-tile {
      display: flex !important;
      visibility: visible !important;
      opacity: 1 !important;
    }

  
    /* FIX FINAL: плитки объектов обязательно видимы */
    #objectsList.object-tile-grid,
    .object-tile-grid {
      display: grid !important;
      grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
      gap: 8px !important;
      min-height: 90px;
      max-height: 430px;
      overflow-y: auto;
      padding-right: 6px;
    }

    .object-tile {
      min-height: 70px;
      border: 2px solid #e2e8f0;
      border-radius: 16px;
      background: #ffffff;
      padding: 9px;
      cursor: pointer;
      display: flex !important;
      flex-direction: column;
      justify-content: space-between;
      gap: 8px;
      box-shadow: 0 4px 12px rgba(15,23,42,.04);
      visibility: visible !important;
      opacity: 1 !important;
    }

    .object-tile.normal {
      border-color: #22c55e;
      background: linear-gradient(135deg, #f0fdf4, #ffffff);
    }

    .object-tile.alarm,
    .object-tile.no_connection {
      border-color: #ef4444;
      background: linear-gradient(135deg, #fef2f2, #ffffff);
    }

    .object-tile.warning,
    .object-tile.unstable_connection,
    .object-tile.no_coords {
      border-color: #f59e0b;
      background: linear-gradient(135deg, #fffbeb, #ffffff);
    }

    .object-tile-name {
      font-size: 12px;
      font-weight: 900;
      line-height: 1.2;
      color: #0f172a;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      min-height: 29px;
    }

    .object-tile-footer {
      display: flex;
      gap: 5px;
      flex-wrap: wrap;
      align-items: center;
    }

    .mini-status {
      display: inline-flex;
      align-items: center;
      padding: 4px 7px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 900;
      line-height: 1;
    }

  
    /* Иконки типа события на плитках */
    .object-tile-icon {
      font-size: 16px;
    }

    .object-tile.alarm .object-tile-icon,
    .object-tile.no_connection .object-tile-icon {
      animation: tileIconPulse 1.1s infinite;
    }

    @keyframes tileIconPulse {
      0%, 100% {
        transform: scale(1);
      }
      50% {
        transform: scale(1.18);
      }
    }

  
    /* Контактный номер на плитке */
    .object-tile-footer .mini-status {
      max-width: 100%;
    }

    .object-tile-footer .mini-status:last-child {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

  
    /* FIX: выравнивание плиток сводки по областям / районам / населённым пунктам */
    .city-summary-panel,
    .hierarchy-summary-panel {
      overflow: visible;
    }

    .city-summary-panel .tag,
    .hierarchy-summary-panel .tag {
      align-self: flex-start;
    }

    .city-summary-grid,
    .hierarchy-summary-grid {
      display: grid !important;
      grid-template-columns: repeat(auto-fill, minmax(150px, 150px)) !important;
      justify-content: start !important;
      align-items: stretch !important;
      gap: 12px !important;
      max-height: 380px !important;
      overflow-y: auto !important;
      overflow-x: hidden !important;
      padding: 2px 8px 8px 2px !important;
    }

    .city-summary-card,
    .hierarchy-summary-card {
      width: 150px !important;
      height: 150px !important;
      min-height: 150px !important;
      max-height: 150px !important;
      aspect-ratio: auto !important;
      box-sizing: border-box !important;
      display: flex !important;
      flex-direction: column !important;
      justify-content: space-between !important;
      padding: 12px !important;
      overflow: hidden !important;
    }

    .city-summary-title,
    .hierarchy-summary-title {
      font-size: 13px !important;
      line-height: 1.18 !important;
      min-height: 34px !important;
      max-height: 38px !important;
      overflow: hidden !important;
      display: -webkit-box !important;
      -webkit-line-clamp: 2 !important;
      -webkit-box-orient: vertical !important;
    }

    .city-summary-numbers,
    .hierarchy-summary-numbers {
      display: grid !important;
      grid-template-columns: 1fr 1fr !important;
      gap: 6px !important;
      margin-top: 6px !important;
    }

    .city-summary-numbers div,
    .hierarchy-summary-numbers div {
      min-height: 38px !important;
      padding: 5px !important;
      border-radius: 10px !important;
      font-size: 10px !important;
      line-height: 1.1 !important;
      overflow: hidden !important;
    }

    .city-summary-numbers strong,
    .hierarchy-summary-numbers strong {
      font-size: 17px !important;
      line-height: 1 !important;
      margin-bottom: 2px !important;
    }

    .hierarchy-level-badge {
      max-width: 126px !important;
      font-size: 9px !important;
      padding: 3px 7px !important;
      margin-bottom: 5px !important;
      white-space: nowrap !important;
      overflow: hidden !important;
      text-overflow: ellipsis !important;
    }

    @media (max-width: 700px) {
      .city-summary-grid,
      .hierarchy-summary-grid {
        grid-template-columns: repeat(auto-fill, minmax(135px, 135px)) !important;
      }

      .city-summary-card,
      .hierarchy-summary-card {
        width: 135px !important;
        height: 135px !important;
        min-height: 135px !important;
        max-height: 135px !important;
      }
    }

  
    /* Часы реального времени */
    .realtime-clock-card {
      min-width: 170px;
      border: 1px solid #e2e8f0;
      border-radius: 18px;
      background: #ffffff;
      padding: 10px 14px;
      box-shadow: 0 6px 18px rgba(15,23,42,.05);
      text-align: right;
    }

    .realtime-clock {
      font-size: 24px;
      line-height: 1;
      font-weight: 900;
      color: #0f172a;
      letter-spacing: -0.04em;
      font-variant-numeric: tabular-nums;
    }

    .realtime-date {
      margin-top: 5px;
      font-size: 12px;
      font-weight: 800;
      color: #64748b;
    }

    @media (max-width: 760px) {
      .realtime-clock-card {
        width: 100%;
        text-align: left;
      }
    }

  
    /* Красивая шапка единого центра мониторинга */
    .app-header {
      background: linear-gradient(135deg, #ffffff 0%, #f8fbff 55%, #eef6ff 100%);
      border: 1px solid #e2e8f0;
      border-radius: 28px;
      padding: 22px 24px;
      box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
      margin-bottom: 22px;
    }

    .app-title-block {
      display: grid;
      gap: 6px;
    }

    .app-kicker {
      width: fit-content;
      padding: 5px 10px;
      border-radius: 999px;
      background: #dbeafe;
      color: #1e40af;
      font-size: 12px;
      font-weight: 900;
      letter-spacing: .06em;
      text-transform: uppercase;
    }

    .app-header h1 {
      margin: 0;
      font-size: clamp(30px, 3vw, 44px);
      line-height: 1;
      letter-spacing: -0.055em;
      color: #0f172a;
    }

    .app-header p {
      margin: 0;
      color: #475569;
      font-size: 16px;
      font-weight: 650;
    }

    .app-title-badges {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 8px;
    }

    .app-title-badges span {
      display: inline-flex;
      align-items: center;
      padding: 7px 10px;
      border-radius: 999px;
      background: #ffffff;
      border: 1px solid #dbeafe;
      color: #1e3a8a;
      font-size: 12px;
      font-weight: 900;
      box-shadow: 0 4px 10px rgba(30, 64, 175, .06);
    }

    .app-header > div:last-child {
      align-items: center;
    }

    .realtime-clock-card {
      background: #0f172a;
      border-color: #1e293b;
      color: #ffffff;
      box-shadow: 0 12px 28px rgba(15,23,42,.18);
    }

    .realtime-clock {
      color: #ffffff;
    }

    .realtime-date {
      color: #cbd5e1;
    }

    @media (max-width: 900px) {
      .app-header {
        align-items: stretch;
      }

      .app-header > div:last-child {
        width: 100%;
      }
    }

  
    /* Звуковое оповещение */
    #soundToggleBtn.sound-off {
      background: #f1f5f9;
      color: #64748b;
      border-color: #cbd5e1;
      box-shadow: none;
    }

    #soundToggleBtn.sound-alarm {
      background: #fee2e2;
      color: #991b1b;
      border-color: #fecaca;
      animation: soundAlarmPulse 1.2s infinite;
    }

    @keyframes soundAlarmPulse {
      0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, .25);
      }
      50% {
        box-shadow: 0 0 0 6px rgba(220, 38, 38, 0);
      }
    }

  
    /* ИИ-помощник */
    .ai-output {
      min-height: 260px;
      max-height: 520px;
      overflow-y: auto;
      padding: 16px;
      border-radius: 18px;
      border: 1px solid #e2e8f0;
      background: #f8fafc;
      color: #0f172a;
      font-size: 14px;
      line-height: 1.65;
      white-space: pre-wrap;
    }

    .small-btn.ai {
      background: #ede9fe;
      color: #5b21b6;
    }

    .small-btn.ai-report {
      background: #dbeafe;
      color: #1e40af;
    }



    /* Техническая служба внутри телеметрии */
    .small-btn.tech {
      background: #ccfbf1;
      color: #0f766e;
    }

    .technical-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 14px;
      margin-bottom: 18px;
    }

    .technical-metric {
      background: #ffffff;
      border: 1px solid #e2e8f0;
      border-radius: 20px;
      padding: 18px;
      box-shadow: 0 6px 18px rgba(15,23,42,.04);
    }

    .technical-metric span {
      display: block;
      color: #64748b;
      font-size: 13px;
      font-weight: 800;
    }

    .technical-metric strong {
      display: block;
      margin-top: 8px;
      font-size: 30px;
      line-height: 1;
      color: #0f172a;
      letter-spacing: -.04em;
    }

    .technical-layout {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 18px;
      align-items: start;
    }

    .technical-wide {
      grid-column: 1 / -1;
    }

    .technical-toolbar {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: center;
      flex-wrap: wrap;
      margin-bottom: 14px;
    }

    .technical-table-wrap {
      border: 1px solid #e5e7eb;
      border-radius: 18px;
      overflow: auto;
      max-height: 430px;
      background: #ffffff;
    }

    .technical-table {
      width: 100%;
      min-width: 760px;
      border-collapse: collapse;
      font-size: 14px;
    }

    .technical-table th {
      position: sticky;
      top: 0;
      z-index: 2;
      background: #f8fafc;
      color: #475569;
      text-align: left;
      padding: 12px;
      border-bottom: 1px solid #e5e7eb;
      font-size: 12px;
      text-transform: uppercase;
    }

    .technical-table td {
      padding: 12px;
      border-bottom: 1px solid #eef2f7;
      vertical-align: top;
      color: #334155;
    }

    .technical-form-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 12px;
    }

    .technical-map {
      height: 430px;
      border: 1px solid #e2e8f0;
      border-radius: 20px;
      overflow: hidden;
      background: #e5e7eb;
    }

    .tech-team-marker {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background: #2563eb;
      border: 3px solid #ffffff;
      box-shadow: 0 8px 18px rgba(15,23,42,.30);
      position: relative;
    }

    .tech-team-marker::after {
      content: "";
      position: absolute;
      inset: -9px;
      border-radius: 50%;
      background: rgba(37,99,235,.28);
      animation: agPulse 1.6s infinite;
    }

    @media (max-width: 1100px) {
      .technical-grid {
        grid-template-columns: repeat(2, 1fr);
      }
      .technical-layout {
        grid-template-columns: 1fr;
      }
      .technical-form-grid {
        grid-template-columns: 1fr;
      }
    }

    @media (max-width: 620px) {
      .technical-grid {
        grid-template-columns: 1fr;
      }
    }


    /* Журнал действий оператора */
    .operator-journal-toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
      margin-bottom: 14px;
    }

    .operator-journal-filters {
      display: grid;
      grid-template-columns: repeat(6, minmax(140px, 1fr));
      gap: 10px;
      margin-bottom: 14px;
      padding: 14px;
      border: 1px solid #e5e7eb;
      border-radius: 18px;
      background: #f8fafc;
    }

    .operator-journal-filters .filter-field {
      display: grid;
      gap: 5px;
    }

    .operator-journal-filters label {
      font-size: 12px;
      font-weight: 850;
      color: #475569;
    }

    .operator-journal-filters input,
    .operator-journal-filters select {
      padding: 10px 11px;
      border-radius: 12px;
      font-size: 13px;
      background: #ffffff;
    }

    .operator-journal-export-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      margin-bottom: 12px;
      color: #64748b;
      font-size: 13px;
      font-weight: 750;
    }

    .small-btn.export {
      background: #dcfce7;
      color: #166534;
    }

    @media (max-width: 1200px) {
      .operator-journal-filters {
        grid-template-columns: repeat(3, minmax(140px, 1fr));
      }
    }

    @media (max-width: 760px) {
      .operator-journal-filters {
        grid-template-columns: 1fr;
      }
    }

    .operator-journal-table-wrap {
      max-height: 620px;
      overflow: auto;
      border: 1px solid #e5e7eb;
      border-radius: 18px;
      background: #ffffff;
    }

    .operator-journal-table {
      width: 100%;
      border-collapse: collapse;
      min-width: 980px;
      font-size: 13px;
    }

    .operator-journal-table th {
      position: sticky;
      top: 0;
      z-index: 10;
      background: #f8fafc;
      color: #475569;
      text-align: left;
      padding: 12px;
      border-bottom: 1px solid #e5e7eb;
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: .03em;
    }

    .operator-journal-table td {
      padding: 12px;
      border-bottom: 1px solid #eef2f7;
      vertical-align: top;
      color: #334155;
    }

    .small-btn.journal {
      background: #e0f2fe;
      color: #075985;
    }

    .small-btn.tech {
      background: #dcfce7;
      color: #166534;
    }

/* -------------------------------------------------- */

.ag-technical-service-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    margin: 6px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb, #0f172a);
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.16);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.18);
    transition: 0.2s ease;
  }
  .ag-technical-service-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.25);
  }
  .ag-technical-service-floating {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9999;
  }
