    :root {
      --bg: #f8fafc;
      --panel: #ffffff;
      --panel-solid: #ffffff;
      --panel-2: #f1f5f9;
      --ink: #0f172a;
      --muted: #64748b;
      --line: #e2e8f0;
      --accent: #2563eb;
      --accent-dark: #1d4ed8;
      --accent-glow: rgba(37, 99, 235, 0.15);
      --success: #059669;
      --success-dark: #047857;
      --success-glow: rgba(5, 150, 105, 0.18);
      --warn: #d97706;
      --good: #059669;
      --danger: #dc2626;
      --shadow: 0 4px 16px -4px rgba(15, 23, 42, 0.08), 0 2px 8px -4px rgba(15, 23, 42, 0.04);
      --shadow-sm: 0 1px 4px rgba(15, 23, 42, 0.06);
      --radius: 12px;
      --sidebar-w: clamp(420px, 46%, 640px);
      font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    }

    * {
      box-sizing: border-box;
    }

    html,
    body {
      height: 100vh;
      min-height: 100vh;
      margin: 0;
      padding: 0;
      background: var(--bg);
      color: var(--ink);
      overflow: hidden;
    }

    body {
      display: flex;
      flex-direction: column;
      height: 100vh;
    }

    /* ── Scrollbars ─────────────────────────────────────── */
    ::-webkit-scrollbar {
      width: 5px;
      height: 5px;
    }

    ::-webkit-scrollbar-track {
      background: rgba(15, 23, 42, 0.02);
    }

    ::-webkit-scrollbar-thumb {
      background: rgba(15, 23, 42, 0.14);
      border-radius: 99px;
    }

    ::-webkit-scrollbar-thumb:hover {
      background: var(--accent);
    }

    h1,
    h2,
    h3,
    h4 {
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-weight: 700;
      letter-spacing: -0.02em;
    }

    /* ── Status Bar ──────────────────────────────────────── */
    #status {
      font-size: 12px;
      display: flex;
      align-items: flex-start;
      gap: 8px;
      padding-top: 10px;
      padding-left: 8px;
      grid-column: 1 / -1;
      color: var(--muted);
      line-height: 1.5;
      white-space: pre-wrap;
      transition: color 0.2s ease;
    }

    #status::before {
      content: '';
      display: inline-block;
      flex-shrink: 0;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--good);
      box-shadow: 0 0 6px var(--good);
      margin-top: 3px;
    }

    #status.status-loading::before {
      background: var(--warn);
      box-shadow: 0 0 6px var(--warn);
      animation: pulse-dot 1s ease-in-out infinite;
    }

    #status.status-error::before {
      background: var(--danger);
      box-shadow: 0 0 6px var(--danger);
    }

    @keyframes pulse-dot {

      0%,
      100% {
        opacity: 1;
        transform: scale(1);
      }

      50% {
        opacity: 0.5;
        transform: scale(0.75);
      }
    }

    /* ── Spinner in button ───────────────────────────────── */
    .btn-spinner {
      display: inline-block;
      width: 13px;
      height: 13px;
      border: 2px solid rgba(255, 255, 255, 0.35);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin 0.7s linear infinite;
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    /* ── Layout ──────────────────────────────────────────── */
    main {
      display: grid;
      grid-template-columns: var(--sidebar-w) 8px 1fr;
      flex: 1;
      min-height: 0;
      overflow: hidden;
      position: relative;
    }

    aside {
      background: var(--panel-2);
      border-right: 1px solid var(--line);
      overflow-y: auto;
      overflow-x: hidden;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      min-width: 0;
      /* ensure content never pushes past the sidebar edge */
      contain: inline-size;
    }

    /* Hide lower sections until data is loaded */
    aside.sidebar-empty>*:not(:first-child):not(.feature-preview) {
      display: none !important;
    }

    aside:not(.sidebar-empty)>.feature-preview {
      display: none;
    }

    .feature-preview {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 14px;
      padding: 4px 8px 8px;
    }

    .feature-preview figure {
      display: grid;
      grid-template-columns: clamp(140px, 42%, 200px) minmax(0, 1fr);
      align-items: start;
      gap: 14px;
      min-width: 0;
      margin: 0;
      text-align: left;
    }

    .feature-preview img {
      display: block;
      width: 100%;
      aspect-ratio: 1;
      object-fit: cover;
      border-radius: 50%;
      box-shadow: var(--shadow);
    }

    .feature-preview figcaption {
      display: flex;
      flex-direction: column;
      gap: 4px;
      color: var(--muted);
      font-size: 16px;
      line-height: 1.55;
    }

    .feature-preview figcaption strong {
      color: var(--ink);
      font-family: 'Plus Jakarta Sans', sans-serif;
      font-size: 14px;
    }

    .feature-preview figcaption span {
      font-size: 16px;
      line-height: 1.55;
      color: var(--muted);
    }

    /* ── Resize Handle ───────────────────────────────────── */
    .resize-handle {
      grid-column: 2;
      background: var(--line);
      cursor: col-resize;
      position: relative;
      z-index: 10;
      transition: background 0.15s ease;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .resize-handle::after {
      content: '';
      width: 2px;
      height: 32px;
      border-radius: 99px;
      background: rgba(15, 23, 42, 0.2);
      transition: background 0.15s ease, height 0.15s ease;
    }

    .resize-handle:hover,
    .resize-handle.dragging {
      background: #e0e7ef;
    }

    .resize-handle:hover::after,
    .resize-handle.dragging::after {
      background: var(--accent);
      height: 48px;
    }

    #mapFrame {
      grid-column: 3;
      position: relative;
      width: 100%;
      height: 100%;
      min-width: 0;
      min-height: 0;
      background: #f1f5f9;
    }

    #pipelineFrame {
      grid-column: 3;
      position: relative;
      width: 100%;
      height: 100%;
      min-width: 0;
      min-height: 0;
      background: linear-gradient(165deg, #f8fafc 0%, #eef2f7 55%, #e8eef5 100%);
      overflow: hidden;
    }

    body.view-pipeline #mapFrame {
      display: none;
    }

    body.view-map #pipelineFrame {
      display: none;
    }

    .pipeline-panel {
      display: flex;
      flex-direction: column;
      height: 100%;
      min-height: 0;
      padding: 20px 22px 16px;
      box-sizing: border-box;
    }

    .pipeline-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 14px;
      flex-shrink: 0;
    }

    .pipeline-header h2 {
      margin: 0;
      font-size: 1.25rem;
      font-weight: 700;
      letter-spacing: -0.02em;
      color: var(--text);
    }

    .pipeline-info {
      margin: 4px 0 0;
      font-size: 0.85rem;
      color: var(--text-muted, var(--muted));
    }

    .pipeline-table-wrap {
      flex: 1;
      min-height: 0;
      overflow: auto;
      border: 1px solid var(--border, var(--line));
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.92);
    }

    .pipeline-table {
      width: 100%;
      border-collapse: collapse;
    }

    .pipeline-table th,
    .pipeline-table td {
      padding: 10px 12px;
      text-align: left;
      border-bottom: 1px solid var(--border, var(--line));
      font-size: 0.82rem;
      white-space: normal !important;
    }

    .pipeline-table th {
      position: sticky;
      top: 0;
      background: #f8fafc;
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--muted);
      z-index: 1;
    }

    .pipeline-table tbody tr {
      cursor: pointer;
      transition: background 0.15s ease;
    }

    .pipeline-table tbody tr:hover {
      background: rgba(37, 99, 235, 0.06);
    }

    .pipeline-table tbody tr.is-selected {
      background: rgba(37, 99, 235, 0.1);
    }

    .pipeline-table .pipeline-status {
      min-width: 160px;
      font: inherit;
      padding: 5px 8px;
      border-radius: 8px;
      border: 1px solid var(--border, var(--line));
      background: #fff;
      cursor: pointer;
    }

    .pipeline-editable-cell {
      min-width: 140px;
      max-width: 220px;
      white-space: normal;
      vertical-align: top;
    }

    .pipeline-editable-cell .pipeline-field {
      margin-bottom: 6px;
    }

    .pipeline-field {
      display: block;
      width: 100%;
      min-width: 120px;
      max-width: 220px;
      box-sizing: border-box;
      margin: 0;
      padding: 6px 8px;
      border: 1px solid var(--border, var(--line));
      border-radius: 8px;
      background: #fff;
      font: inherit;
      font-size: 0.8rem;
      line-height: 1.35;
      resize: vertical;
      color: var(--text);
    }

    .pipeline-field:focus {
      outline: 2px solid rgba(37, 99, 235, 0.35);
      border-color: #2563eb;
    }

    .pipeline-action,
    .pipeline-table .pipeline-delete {
      padding: 4px 8px;
      font-size: 0.75rem;
      line-height: 1.2;
      white-space: nowrap;
    }

    .pipeline-action {
      display: inline-flex;
      width: 100%;
      max-width: 220px;
      justify-content: center;
    }

    .pipeline-empty {
      padding: 28px 16px;
      text-align: center;
      color: var(--muted);
      font-size: 0.9rem;
    }

    .pipeline-status-badge {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 999px;
      font-size: 0.72rem;
      font-weight: 600;
    }

    .pipeline-status-badge[data-status="novo"] { background: #dbeafe; color: #1d4ed8; }
    .pipeline-status-badge[data-status="poizvedba_lastnika"] { background: #fef3c7; color: #b45309; }
    .pipeline-status-badge[data-status="email_poslan"] { background: #e0e7ff; color: #4338ca; }
    .pipeline-status-badge[data-status="zakljuceno"] { background: #dcfce7; color: #15803d; }
    .pipeline-status-badge[data-status="zavrnjeno"] { background: #fee2e2; color: #b91c1c; }

    #map {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      z-index: 1;
      background: transparent;
    }

    .hidden {
      display: none !important;
    }

    /* ── Cards ───────────────────────────────────────────── */
    .provider-note {
      padding: 10px 12px;
      border-radius: 10px;
      background: #fef3c7;
      color: #b45309;
      border: 1px solid #fde68a;
      font-size: 12px;
      line-height: 1.4;
    }

    .provider-note code {
      color: #7c2d12;
      font-weight: 700;
    }

    .card {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 14px;
      box-shadow: var(--shadow);
      transition: box-shadow 0.2s ease, border-color 0.2s ease;
      /* never let card push past sidebar */
      min-width: 0;
      /* overflow: hidden; */
    }

    .card:hover {
      box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.1);
      border-color: #cbd5e1;
    }

    .card h2,
    #recordsSection h2 {
      margin: 0 0 10px;
      font-size: 16px;
      color: var(--ink);
      display: flex;
      align-items: center;
      gap: 6px;
      border-bottom: 1px solid var(--line);
      padding-bottom: 8px;
    }

    #gursSearchSection h2 {
      border-bottom: 0;
      padding-bottom: 0;
    }

    /* ── Controls Grid ───────────────────────────────────── */
    .controls-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    #gursSearchSection .controls-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .controls-grid-nested {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-top: 10px;
    }

    /* ── Smooth collapse (max-height transition) ─────────── */
    .controls-grid-nested {
      overflow: hidden;
      max-height: 600px;
      transition: max-height 0.3s ease, opacity 0.25s ease, margin-top 0.25s ease;
      opacity: 1;
    }

    .controls-grid-nested.collapsed {
      max-height: 0 !important;
      opacity: 0;
      margin-top: 0 !important;
      pointer-events: none;
    }

    .sidebar-actions {
      display: flex;
      gap: 8px;
      margin-top: 2px;
    }

    .sidebar-actions button {
      flex: 1;
    }

    label {
      display: grid;
      gap: 5px;
      font-size: 11px;
      color: var(--muted);
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .06em;
    }

    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
      width: 100%;
      border: 1px solid #cbd5e1;
      background: #ffffff;
      border-radius: 8px;
      padding: 8px 10px;
      font-size: 13px;
      color: var(--ink);
      outline: none;
      transition: all 0.2s ease;
    }

    textarea {
      resize: vertical;
      min-height: 42px;
      font-family: inherit;
      line-height: 1.35;
    }

    select:disabled {
      opacity: 0.55;
      cursor: not-allowed;
      background: var(--panel-2);
      color: var(--muted);
    }

    input[type="text"]:focus,
    input[type="number"]:focus,
    input[type="email"]:focus,
    input[type="password"]:focus,
    select:focus,
    textarea:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px var(--accent-glow);
    }

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

    /* ── POI / Nominatim autocomplete ─────────────────── */
    .poi-search {
      position: relative;
      grid-column: 1 / -1;
      margin-bottom: 4px;
    }

    .poi-search label {
      display: block;
    }

    .poi-results {
      position: absolute;
      left: 0;
      right: 0;
      top: calc(100% + 4px);
      z-index: 40;
      margin: 0;
      padding: 4px 0;
      list-style: none;
      max-height: 260px;
      overflow-y: auto;
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    }

    .poi-results[hidden] {
      display: none;
    }

    .poi-results li {
      margin: 0;
      padding: 8px 12px;
      font-size: 13px;
      line-height: 1.35;
      color: var(--ink);
      cursor: pointer;
    }

    .poi-results li[aria-selected="true"],
    .poi-results li:hover {
      background: var(--accent-glow);
      color: var(--accent-dark);
    }

    .poi-results li.poi-result-meta {
      cursor: default;
      color: var(--muted);
      font-size: 12px;
    }

    .poi-results li.poi-result-meta:hover,
    .poi-results li.poi-result-meta[aria-selected="true"] {
      background: transparent;
      color: var(--muted);
    }

    .poi-results .poi-result-name {
      display: block;
      font-weight: 600;
    }

    .poi-results .poi-result-detail {
      display: block;
      margin-top: 2px;
      font-size: 12px;
      color: var(--muted);
      font-weight: 400;
    }

    /* ── Stats Grid ───────────────────────────────────── */
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
      min-width: 0;
    }

    .stats-visibility {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
      margin: 0 0 10px;
      padding: 10px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: var(--panel-2);
    }

    .stats-toggle {
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--ink);
      font-size: 12px;
      font-weight: 600;
      text-transform: none;
      letter-spacing: 0;
      cursor: pointer;
    }

    .stats-toggle input {
      width: 16px;
      height: 16px;
      margin: 0;
      accent-color: var(--accent);
    }

    .stat {
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 10px 12px;
      background: var(--panel-2);
      transition: background 0.2s ease;
    }

    .stat:hover {
      background: #e2e8f0;
    }

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

    .stat .value {
      font-size: 20px;
      line-height: 1.2;
      font-weight: 800;
      color: var(--ink);
      margin-top: 4px;
      word-break: break-word;
    }

    .stat .sub {
      font-size: 11px;
      color: var(--muted);
      margin-top: 2px;
    }

    /* ── Insight Block ───────────────────────────────────── */
    .insight-block {
      display: grid;
      gap: 12px;
      margin-top: 10px;
      min-width: 0;
      overflow: hidden;
    }

    /* Each distribution/category block inside insight-block gets
       a horizontal scroll so its table never breaks the sidebar */
    .insight-block>div {
      overflow-x: auto;
      min-width: 0;
    }

    .insight-block h3 {
      margin: 4px 0 6px;
      font-size: 16px;
      color: var(--ink);
    }

    .insight-note {
      margin: 6px 0 0;
      font-size: 12px;
      color: var(--muted);
      line-height: 1.45;
    }

    /* ── Bar Charts ──────────────────────────────────────── */
    .bar-cell {
      min-width: 60px;
    }

    .bar {
      height: 7px;
      border-radius: 999px;
      background: #e2e8f0;
      overflow: hidden;
    }

    .bar>span {
      display: block;
      height: 100%;
      background: var(--accent);
      transition: width 0.25s ease;
    }

    /* ── Legend ──────────────────────────────────────────── */
    .legend {
      display: grid;
      gap: 8px;
      margin-top: 10px;
      font-size: 12px;
      color: var(--muted);
    }

    .legend-gradient {
      height: 10px;
      border-radius: 999px;
      border: 1px solid rgba(15, 23, 42, 0.15);
      background: linear-gradient(90deg, #dbeafe, #60a5fa, #1e3a8a);
    }

    .legend-items {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 6px 10px;
    }

    .legend-item {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
    }

    .swatch {
      width: 12px;
      height: 12px;
      border-radius: 4px;
      flex: 0 0 12px;
      border: 1px solid rgba(15, 23, 42, 0.15);
    }

    /* ── Mini Table (stats) ──────────────────────────────── */
    .mini-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 14px;
      /* table must never grow wider than its container */
      table-layout: auto;
      max-width: 100%;
    }

    .mini-table td {
      border-bottom: 1px solid var(--line);
      padding: 9px 7px;
      text-align: right;
      /* no nowrap on data cells — they can wrap */
      white-space: normal;
      color: var(--ink);
    }

    .mini-table th {
      border-bottom: 1px solid var(--line);
      padding: 9px 7px;
      text-align: right;
      white-space: nowrap;
      color: var(--ink);
    }

    .mini-table th:first-child,
    .mini-table td:first-child {
      text-align: left;
      white-space: normal;
      max-width: 160px;
    }

    .mini-table th {
      color: var(--muted);
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: .05em;
    }

    .mini-table .stats-check-head,
    .mini-table .stats-check-cell {
      width: 26px;
      min-width: 26px;
      max-width: 26px;
      padding-left: 0;
      padding-right: 4px;
      text-align: center;
      white-space: nowrap;
    }

    .mini-table .stats-label-head,
    .mini-table .stats-label-cell {
      text-align: left;
      white-space: normal;
      max-width: 160px;
    }

    .stats-row-checkbox {
      width: 18px;
      height: 18px;
      margin: 0;
      vertical-align: middle;
      accent-color: var(--accent);
      cursor: pointer;
    }

    .stats-row-muted .stats-data-cell,
    .stats-row-muted .bar-cell {
      color: var(--muted);
      opacity: .45;
    }

    .stats-row-muted .bar>span {
      width: 0 !important;
    }

    /* ── Table Toolbar ───────────────────────────────────── */
    .table-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 6px;
      margin-bottom: 8px;
      font-size: 14px;
      color: var(--muted);
      flex-wrap: wrap;
    }

    .table-toolbar-actions {
      display: flex;
      gap: 6px;
      align-items: center;
      flex-shrink: 0;
    }

    /* ── Data Table ───────────────────────────────────── */
    .table-wrap {
      overflow: auto;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: #ffffff;
      min-width: 0;
      max-width: 100%;
      /* No fixed max-height — sidebar scroll handles it */
    }

    /* Give the records table a min-height so it's never empty-looking */
    #recordsSection .table-wrap {
      min-height: 120px;
    }

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

    table.data th,
    table.data td {
      border-bottom: 1px solid var(--line);
      padding: 11px 12px;
      text-align: left;
      vertical-align: top;
      max-width: 200px;
      color: var(--ink);
      white-space: normal;
    }

    table.data th {
      position: sticky;
      top: 0;
      background: #f1f5f9;
      z-index: 1;
      cursor: pointer;
      user-select: none;
      font-size: 12px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: .05em;
      white-space: nowrap;
    }

    table.data tr {
      cursor: pointer;
      transition: background 0.12s ease;
    }

    table.data tr:hover,
    table.data tr.selected {
      background: rgba(37, 99, 235, 0.05);
    }

    table.data tr.selected {
      border-left: 3px solid var(--accent);
    }

    .truncate {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      display: block;
      max-width: 200px;
    }

    /* ── Drop Zone ───────────────────────────────────────── */
    .drop-zone {
      border: 1.5px dashed #cbd5e1;
      background: #ffffff;
      border-radius: 10px;
      padding: 14px;
      text-align: center;
      color: var(--muted);
      font-size: 12px;
      margin-top: 8px;
      transition: all 0.2s ease;
    }

    .drop-zone.dragover {
      border-color: var(--accent);
      background: rgba(37, 99, 235, 0.05);
      color: var(--accent);
    }

    .note {
      font-size: 12px;
      color: var(--muted);
      line-height: 1.45;
    }

    /* ── Map Popup ───────────────────────────────────────── */
    .maplibregl-popup-content {
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      max-width: min(320px, 90vw);
      max-height: 60vh;
      overflow-y: auto;
      overflow-x: hidden;
      padding: 14px 32px 14px 14px;
      font-family: inherit;
      background: #ffffff;
      border: 1px solid var(--line);
      color: var(--ink);
    }

    .maplibregl-popup-close-button {
      color: var(--muted);
      font-size: 16px;
      padding: 8px;
    }

    .popup-title {
      font-weight: 800;
      font-size: 14px;
      margin-bottom: 10px;
      color: var(--ink);
      border-bottom: 1px solid var(--line);
      padding-bottom: 6px;
    }

    .popup-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
      gap: 5px 10px;
      font-family: inherit;
      font-size: 12px;
    }

    .popup-grid .key {
      color: var(--muted);
      font-weight: 600;
      word-break: break-word;
    }

    .popup-grid .val {
      word-break: break-word;
      color: var(--ink);
    }

    /* ── Mobile Nav ──────────────────────────────────────── */
    .mobile-nav {
      display: none;
    }

    /* ── Buttons ─────────────────────────────────────────── */
    .button,
    input::file-selector-button {
      border: 0;
      border-radius: 8px;
      padding: 9px 14px;
      background: var(--accent);
      color: #fff;
      cursor: pointer;
      font-weight: 600;
      font-size: 14px;
      transition: all 0.18s ease;
      box-shadow: 0 3px 10px var(--accent-glow);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      white-space: nowrap;
    }

    .button:hover,
    input::file-selector-button:hover {
      background: var(--accent-dark);
      transform: translateY(-1px);
      box-shadow: 0 5px 14px var(--accent-glow);
    }

    .button:active,
    input::file-selector-button:active {
      transform: translateY(0);
    }

    .button:disabled {
      opacity: 0.6;
      cursor: not-allowed;
      transform: none;
    }

    .button.secondary {
      background: #ffffff;
      box-shadow: none;
      border: 1px solid #cbd5e1;
      color: var(--ink);
    }

    .button.secondary:hover {
      background: #f1f5f9;
      border-color: #94a3b8;
      transform: none;
    }

    .button.light {
      background: rgba(37, 99, 235, 0.08);
      color: var(--accent);
      box-shadow: none;
    }

    .button.light:hover {
      background: rgba(37, 99, 235, 0.15);
      transform: none;
    }

    /* ── SUCCESS / Export button ─────────────────────────── */
    .button.success {
      background: var(--success);
      box-shadow: 0 3px 10px var(--success-glow);
    }

    .button.success:hover {
      background: var(--success-dark);
      box-shadow: 0 5px 14px var(--success-glow);
    }

    /* ── Header Checkbox ─────────────────────────────────── */
    .header-check {
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      cursor: pointer;
      height: 36px;
    }

    .header-check input {
      width: 15px;
      height: 15px;
      accent-color: var(--accent);
      cursor: pointer;
    }

    /* ── Table CSV Export Checkboxes ─────────────────────── */
    table.data .csv-check-head,
    table.data .csv-check-cell {
      width: 36px;
      min-width: 36px;
      max-width: 36px;
      padding: 9px 4px;
      text-align: center;
      vertical-align: middle;
    }

    table.data .csv-check-head input,
    table.data .csv-check-cell input {
      width: 18px;
      height: 18px;
      margin: 0;
      vertical-align: middle;
      accent-color: var(--accent);
      cursor: pointer;
    }

    table.data tr.row-csv-excluded td {
      opacity: 0.55;
    }

    table.data tr.row-csv-excluded td.csv-check-cell {
      opacity: 1;
    }

    .ownership-dialog {
      width: min(620px, calc(100vw - 32px));
      max-height: calc(100vh - 32px);
      border: 0;
      border-radius: 18px;
      padding: 0;
      color: var(--ink);
      box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
    }

    .ownership-dialog::backdrop {
      background: rgba(15, 23, 42, .55);
      backdrop-filter: blur(3px);
    }

    .ownership-dialog-shell {
      padding: 22px;
    }

    .ownership-dialog-head,
    .ownership-dialog-footer,
    .ownership-parcel-summary {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
    }

    .ownership-dialog-head h2 {
      margin: 2px 0 0;
    }

    .ownership-eyebrow {
      margin: 0;
      color: var(--accent);
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    .ownership-dialog-close {
      border: 0;
      background: transparent;
      color: var(--muted);
      font-size: 30px;
      line-height: 1;
      cursor: pointer;
    }

    .ownership-dialog-intro {
      margin: 14px 0;
      color: var(--muted);
      line-height: 1.5;
    }

    .ownership-parcel-list {
      display: grid;
      gap: 10px;
      max-height: 42vh;
      overflow: auto;
    }

    .ownership-parcel-card {
      padding: 14px;
      border: 1px solid var(--line);
      border-radius: 12px;
      background: #f8fafc;
    }

    .ownership-parcel-card .ownership-result {
      margin-top: 14px;
    }

    .ownership-parcel-card-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 12px;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--line);
      font-size: 13px;
    }

    .ownership-parcel-type {
      padding: 4px 8px;
      border-radius: 999px;
      background: #dbeafe;
      color: #1d4ed8;
      font-size: 11px;
      font-weight: 750;
      text-align: right;
    }

    .ownership-parcel-data {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 4px 12px;
      font-size: 13px;
    }

    .ownership-parcel-data span {
      color: var(--muted);
    }

    .ownership-actions {
      display: grid;
      flex-shrink: 0;
      gap: 6px;
      justify-items: center;
    }

    .ownership-fetch-button {
      flex-shrink: 0;
      white-space: nowrap;
    }

    .ownership-fetch-button:disabled {
      cursor: wait;
      opacity: .65;
    }

    .ownership-manual-link {
      color: var(--muted);
      font-size: 12px;
    }

    .ownership-extension-setup {
      display: grid;
      gap: 4px;
      margin-top: 8px;
      font-size: 16px;
      line-height: 1.55;
    }

    .ownership-extension-status {
      margin-top: 4px;
      font-size: 16px;
      font-weight: 700;
    }

    .ownership-extension-status.is-ready {
      color: #047857;
    }

    .ownership-extension-status.is-missing {
      color: #92400e;
    }

    .ownership-extension-download,
    .cert-download {
      display: flex;
      align-items: center;
      justify-content: center;
      justify-self: start;
      margin-top: 6px;
      padding: 8px 11px;
      border-radius: 8px;
      background: var(--accent);
      color: #fff;
      font-weight: 800;
      text-decoration: none;
      width: 100%;
    }

    .ownership-extension-download:hover,
    .cert-download:hover {
      filter: brightness(.92);
    }

    .cert-password {
      margin: 12px 0 0;
      padding: 12px 14px;
      border-radius: 10px;
      background: rgba(15, 23, 42, .06);
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: 18px;
      font-weight: 800;
      letter-spacing: .06em;
      text-align: center;
      user-select: all;
    }

    .ownership-extension-setup.is-ready .ownership-extension-download,
    .ownership-extension-setup.is-ready .ownership-extension-install {
      display: none;
    }

    .ownership-extension-install summary {
      cursor: pointer;
      font-weight: 750;
    }

    .ownership-extension-install ol {
      margin: 8px 0 0;
      padding-left: 20px;
    }

    .ownership-extension-install code {
      user-select: all;
    }

    .ownership-result {
      display: grid;
      gap: 12px;
      margin-top: 14px;
      padding: 16px;
      border: 1px solid #a7f3d0;
      border-radius: 12px;
      background: #ecfdf5;
    }

    .ownership-result.is-missing-owner {
      border-color: #fcd34d;
      background: #fffbeb;
    }

    .ownership-result.is-missing-owner .ownership-result-head span:first-child {
      color: #b45309;
    }

    .ownership-result[hidden] {
      display: none;
    }

    .ownership-result-head,
    .ownership-owner-card {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 14px;
    }

    .ownership-result-head span:first-child {
      color: #047857;
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .06em;
      text-transform: uppercase;
    }

    .ownership-result-head h3 {
      margin: 3px 0 0;
      font-size: 16px;
    }

    .ownership-plombe,
    .ownership-share {
      flex-shrink: 0;
      padding: 5px 8px;
      border-radius: 999px;
      background: #d1fae5;
      color: #047857;
      font-size: 12px;
      font-weight: 800;
    }

    .ownership-plombe.has-plombe {
      background: #fef3c7;
      color: #92400e;
    }

    .ownership-owner-list {
      display: grid;
      gap: 8px;
    }

    .ownership-owner-card {
      padding: 12px;
      border: 1px solid #d1d5db;
      border-radius: 9px;
      background: white;
    }

    .ownership-owner-main {
      display: grid;
      gap: 3px;
      min-width: 0;
    }

    .bizi-contacts {
      display: grid;
      gap: 4px;
      margin-top: 8px;
      padding: 9px;
      border-radius: 7px;
      background: #f0fdf4;
      color: #334155;
      font-size: 12px;
      line-height: 1.4;
    }

    .bizi-contacts.is-blocked,
    .bizi-contacts.is-error,
    .bizi-contacts.is-not_found {
      background: #fffbeb;
      color: #92400e;
    }

    .bizi-contacts a {
      color: #1d4ed8;
      overflow-wrap: anywhere;
    }

    .bizi-contacts .bizi-source {
      justify-self: start;
      margin-top: 2px;
      color: #047857;
      font-weight: 750;
    }

    .ownership-holder-role {
      color: #1d4ed8 !important;
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .04em;
      text-transform: uppercase;
    }

    .ownership-owner-main span,
    .ownership-owner-main small,
    .ownership-result-meta,
    .ownership-restrictions li span {
      color: var(--muted);
    }

    .ownership-restrictions summary {
      cursor: pointer;
      font-weight: 750;
    }

    .ownership-restrictions ul {
      display: grid;
      gap: 10px;
      margin: 10px 0 0;
      padding: 0;
      list-style: none;
    }

    .ownership-restriction-item {
      padding: 10px;
      border: 1px solid #bfdbfe;
      border-radius: 8px;
      background: #f8fbff;
    }

    .ownership-restrictions li span {
      display: block;
      font-size: 12px;
    }

    .ownership-restriction-holder-list {
      display: grid;
      gap: 6px;
      margin-top: 8px;
    }

    .ownership-restriction-holder {
      display: grid;
      gap: 2px;
      padding: 8px;
      border-left: 3px solid #2563eb;
      border-radius: 0 6px 6px 0;
      background: #eff6ff;
    }

    .ownership-restriction-holder.is-missing {
      border-left-color: #d97706;
      background: #fffbeb;
    }

    .ownership-result-ok,
    .ownership-result-warning,
    .ownership-result-meta {
      margin: 0;
      font-size: 12px;
    }

    .ownership-result-warning {
      color: #92400e;
    }

    .ownership-dialog-footer {
      justify-content: flex-end;
      margin-top: 16px;
    }

    @media (max-width: 620px) {
      .ownership-parcel-card-head {
        align-items: flex-start;
      }

      .ownership-parcel-summary {
        align-items: stretch;
        flex-direction: column;
      }

      .ownership-actions,
      .ownership-fetch-button {
        width: 100%;
      }

      .ownership-result-head,
      .ownership-owner-card {
        align-items: stretch;
        flex-direction: column;
      }

      .ownership-plombe,
      .ownership-share {
        align-self: flex-start;
      }

    }

    /* ── Responsive ──────────────────────────────────────── */
    @media (max-width: 980px) {
      body.show-map-view aside {
        display: none;
      }

      body.show-data-view #mapFrame,
      body.show-data-view #pipelineFrame {
        display: none;
      }

      body.show-data-view .resize-handle {
        display: none;
      }

      main {
        grid-template-columns: 1fr;
        flex: 1;
        min-height: 0;
      }

      #mapFrame,
      #pipelineFrame {
        grid-column: 1;
      }

      .resize-handle {
        display: none;
      }

      aside {
        border-right: 0;
        padding: 10px;
      }

      .mobile-nav {
        display: flex;
        height: 58px;
        flex-shrink: 0;
        background: #ffffff;
        border-top: 1px solid var(--line);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
      }

      .nav-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: 0;
        color: var(--muted);
        font-size: 11px;
        font-weight: 600;
        cursor: pointer;
        gap: 3px;
        transition: all 0.2s ease;
      }

      .nav-tab.active {
        color: var(--accent);
        background: rgba(0, 0, 0, 0.02);
      }

      .nav-tab .icon {
        font-size: 18px;
      }

      .controls-grid,
      .controls-grid-nested {
        grid-template-columns: 1fr;
      }

      #gursSearchSection .controls-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    @media (max-width: 600px) {
      .table-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
      }

      .table-toolbar-actions {
        width: 100%;
      }

      .table-toolbar-actions button {
        flex: 1;
      }
    }

    .maplibregl-ctrl-attrib {
      display: none !important;
    }

    /* ── Map Context Menu ──────────────────────────────────── */
    .map-context-menu {
      position: absolute;
      background: var(--panel);
      border: 1px solid var(--line);
      box-shadow: var(--shadow);
      border-radius: 8px;
      padding: 4px 0;
      z-index: 9999;
      min-width: 160px;
      pointer-events: auto;
      font-size: 13px;
      display: none;
    }

    .map-context-menu.visible {
      display: block;
    }

    .map-context-menu [hidden] {
      display: none;
    }

    .map-context-menu a {
      display: block;
      padding: 8px 16px;
      color: var(--ink);
      text-decoration: none;
      transition: background 0.15s ease;
    }

    .map-context-menu #cmWhatsHere,
    .map-context-menu #cmOwnership {
      padding-top: 11px;
      padding-bottom: 11px;
      font-size: 16px;
      font-weight: 700;
    }

    .map-context-menu a:hover {
      background: var(--panel-2);
      color: var(--accent);
    }
/* ── Toast Notification ────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Auth gate ─────────────────────────────────────────── */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, 0.12), transparent 42%),
    var(--bg);
}

.auth-gate[hidden],
main[hidden] {
  display: none !important;
}

.auth-gate.is-busy {
  cursor: wait;
}

.auth-card {
  width: min(100%, 420px);
  margin: 0;
  padding: 28px;
  display: grid;
  gap: 16px;
}

.auth-card h1 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
}

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

.auth-card form {
  display: grid;
  gap: 12px;
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

.auth-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-microsoft {
  width: 100%;
}

.auth-microsoft-icon {
  width: 16px;
  height: 16px;
  background:
    linear-gradient(#f25022 0 0) 0 0 / 7px 7px no-repeat,
    linear-gradient(#7fba00 0 0) 9px 0 / 7px 7px no-repeat,
    linear-gradient(#00a4ef 0 0) 0 9px / 7px 7px no-repeat,
    linear-gradient(#ffb900 0 0) 9px 9px / 7px 7px no-repeat;
}

.auth-sign-out {
  padding: 6px 10px;
  font-size: 12px;
}
