/* ═══════════════════════════════════════════════
   WebGIS Pro — Premium Dark Theme
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-base: #0a0c10;
    --bg-surface: #111318;
    --bg-panel: rgba(17, 19, 24, 0.85);
    --bg-elevated: rgba(25, 28, 35, 0.92);
    --bg-secondary: rgba(255, 255, 255, 0.05);
    --bg-dark: #080a0e;
    --bg-hover: rgba(255, 255, 255, 0.06);
    --bg-active: rgba(255, 255, 255, 0.1);
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 179, 255, 0.4);
    --text: #eaf0f6;
    --text-primary: #eaf0f6;
    --text-secondary: #8b95a5;
    --text-muted: #5a6373;
    --accent: #4d9fff;
    --accent-glow: rgba(77, 159, 255, 0.25);
    --accent-hover: #3b8ef0;
    --accent-gradient: linear-gradient(135deg, #4d9fff 0%, #36d1c4 100%);
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --glass-blur: 16px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --header-h: 98px;
    --sidebar-w: 300px;
    --statusbar-h: 32px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════════
   TEMA: Light Professional
   ═══════════════════════════════════════════════ */
[data-theme="light"] {
    --bg-base: #f0f4f8;
    --bg-surface: #ffffff;
    --bg-panel: rgba(255, 255, 255, 0.97);
    --bg-elevated: rgba(255, 255, 255, 0.99);
    --bg-secondary: rgba(0, 0, 0, 0.05);
    --bg-dark: #e2e8f0;
    --bg-hover: rgba(0, 0, 0, 0.04);
    --bg-active: rgba(0, 0, 0, 0.08);
    --border: rgba(0, 0, 0, 0.10);
    --border-focus: rgba(37, 99, 235, 0.4);
    --text: #1e293b;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent: #2563eb;
    --accent-glow: rgba(37, 99, 235, 0.20);
    --accent-hover: #1d4ed8;
    --accent-gradient: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --glass-blur: 0px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.12);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.16);
}
[data-theme="light"] body { background: var(--bg-base); color: var(--text-primary); }
[data-theme="light"] input, [data-theme="light"] select, [data-theme="light"] textarea {
    background: #ffffff; color: #1e293b; border-color: rgba(0,0,0,0.15);
}
[data-theme="light"] .dash-header { background: #1e293b; color: #fff; border-bottom-color: #1e293b; }
[data-theme="light"] .dash-header .logo span,
[data-theme="light"] .dash-header button { color: rgba(255,255,255,0.85); }
[data-theme="light"] .primary { background: #2563eb; }
[data-theme="light"] .modal-overlay { background: rgba(0,0,0,0.55); }
[data-theme="light"] .modal-content, [data-theme="light"] .modal-body { background: #fff; color: #1e293b; }
[data-theme="light"] code { background: rgba(0,0,0,0.07); color: #1e293b; }

/* ── Paper White ─────────────────────────────── */
[data-theme="paper"] {
    --bg-base: #ffffff; --bg-surface: #f8f9fa; --bg-panel: rgba(248,249,250,0.98);
    --bg-elevated: #ffffff; --bg-secondary: rgba(0,0,0,0.04); --bg-dark: #e9ecef;
    --bg-hover: rgba(0,0,0,0.03); --bg-active: rgba(59,130,246,0.08);
    --border: rgba(0,0,0,0.09); --border-focus: rgba(59,130,246,0.4);
    --text: #1a1a2e; --text-primary: #1a1a2e; --text-secondary: #3d3d5c; --text-muted: #7a7a9a;
    --accent: #3b82f6; --accent-glow: rgba(59,130,246,0.18); --accent-hover: #2563eb;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    --success: #16a34a; --warning: #d97706; --danger: #dc2626;
    --glass-blur: 0px; --shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.1); --shadow-lg: 0 16px 48px rgba(0,0,0,0.14);
}
[data-theme="paper"] body { background: var(--bg-base); color: var(--text-primary); }
[data-theme="paper"] input, [data-theme="paper"] select, [data-theme="paper"] textarea { background: #fff; color: #1a1a2e; border-color: rgba(0,0,0,0.12); }
[data-theme="paper"] .dash-header { background: #1a1a2e; color: #fff; border-bottom-color: #1a1a2e; }
[data-theme="paper"] .dash-header .logo span, [data-theme="paper"] .dash-header button { color: rgba(255,255,255,0.85); }
[data-theme="paper"] .primary { background: #3b82f6; }
[data-theme="paper"] .modal-overlay { background: rgba(0,0,0,0.5); }
[data-theme="paper"] .modal-content, [data-theme="paper"] .modal-body { background: #fff; color: #1a1a2e; }

/* ── Daylight ─────────────────────────────────── */
[data-theme="daylight"] {
    --bg-base: #fafaf7; --bg-surface: #f0ede6; --bg-panel: rgba(240,237,230,0.97);
    --bg-elevated: #fafaf7; --bg-secondary: rgba(0,0,0,0.04); --bg-dark: #e0dbd0;
    --bg-hover: rgba(0,0,0,0.03); --bg-active: rgba(0,184,148,0.08);
    --border: rgba(0,0,0,0.09); --border-focus: rgba(0,184,148,0.4);
    --text: #2d3436; --text-primary: #2d3436; --text-secondary: #4a5568; --text-muted: #718096;
    --accent: #00b894; --accent-glow: rgba(0,184,148,0.18); --accent-hover: #00a382;
    --accent-gradient: linear-gradient(135deg, #00b894 0%, #55efc4 100%);
    --success: #059669; --warning: #d97706; --danger: #e11d48;
    --glass-blur: 0px; --shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.1); --shadow-lg: 0 16px 48px rgba(0,0,0,0.14);
}
[data-theme="daylight"] body { background: var(--bg-base); color: var(--text-primary); }
[data-theme="daylight"] input, [data-theme="daylight"] select, [data-theme="daylight"] textarea { background: #fafaf7; color: #2d3436; border-color: rgba(0,0,0,0.12); }
[data-theme="daylight"] .dash-header { background: #2d3436; color: #fff; border-bottom-color: #2d3436; }
[data-theme="daylight"] .dash-header .logo span, [data-theme="daylight"] .dash-header button { color: rgba(255,255,255,0.85); }
[data-theme="daylight"] .primary { background: #00b894; }
[data-theme="daylight"] .modal-overlay { background: rgba(0,0,0,0.5); }
[data-theme="daylight"] .modal-content, [data-theme="daylight"] .modal-body { background: #fafaf7; color: #2d3436; }

/* ── Blueprint ────────────────────────────────── */
[data-theme="blueprint"] {
    --bg-base: #f0f4ff; --bg-surface: #e8eeff; --bg-panel: rgba(232,238,255,0.98);
    --bg-elevated: #f0f4ff; --bg-secondary: rgba(30,64,175,0.05); --bg-dark: #d8e0ff;
    --bg-hover: rgba(30,64,175,0.04); --bg-active: rgba(30,64,175,0.1);
    --border: rgba(30,64,175,0.12); --border-focus: rgba(30,64,175,0.4);
    --text: #1e2a4a; --text-primary: #1e2a4a; --text-secondary: #3b4a72; --text-muted: #6272a4;
    --accent: #1e40af; --accent-glow: rgba(30,64,175,0.2); --accent-hover: #1d3a9a;
    --accent-gradient: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    --success: #059669; --warning: #b45309; --danger: #dc2626;
    --glass-blur: 0px; --shadow-sm: 0 2px 8px rgba(30,64,175,0.08);
    --shadow-md: 0 8px 32px rgba(30,64,175,0.12); --shadow-lg: 0 16px 48px rgba(30,64,175,0.16);
}
[data-theme="blueprint"] body { background: var(--bg-base); color: var(--text-primary); }
[data-theme="blueprint"] input, [data-theme="blueprint"] select, [data-theme="blueprint"] textarea { background: #f0f4ff; color: #1e2a4a; border-color: rgba(30,64,175,0.15); }
[data-theme="blueprint"] .dash-header { background: #1e2a4a; color: #fff; border-bottom-color: #1e2a4a; }
[data-theme="blueprint"] .dash-header .logo span, [data-theme="blueprint"] .dash-header button { color: rgba(255,255,255,0.85); }
[data-theme="blueprint"] .primary { background: #1e40af; }
[data-theme="blueprint"] .modal-overlay { background: rgba(0,0,0,0.5); }
[data-theme="blueprint"] .modal-content, [data-theme="blueprint"] .modal-body { background: #f0f4ff; color: #1e2a4a; }

/* ═══════════════════════════════════════════════
   TEMA: GIS Green (ispirato a grafica.png)
   ═══════════════════════════════════════════════ */
[data-theme="gis-green"] {
    --bg-base: #f5f5f5;
    --bg-surface: #ffffff;
    --bg-panel: rgba(255, 255, 255, 0.98);
    --bg-elevated: rgba(255, 255, 255, 0.99);
    --bg-secondary: rgba(0, 0, 0, 0.05);
    --bg-dark: #e8f5e9;
    --bg-hover: rgba(39, 174, 96, 0.07);
    --bg-active: rgba(39, 174, 96, 0.14);
    --border: rgba(0, 0, 0, 0.09);
    --border-focus: rgba(39, 174, 96, 0.5);
    --text: #1a1a1a;
    --text-primary: #1a1a1a;
    --text-secondary: #4a5568;
    --text-muted: #a0aec0;
    --accent: #27ae60;
    --accent-glow: rgba(39, 174, 96, 0.25);
    --accent-hover: #219a52;
    --accent-gradient: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    --success: #27ae60;
    --warning: #e67e22;
    --danger: #e74c3c;
    --glass-blur: 0px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.10);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.14);
}
[data-theme="gis-green"] body { background: var(--bg-base); color: var(--text-primary); }
[data-theme="gis-green"] input, [data-theme="gis-green"] select, [data-theme="gis-green"] textarea {
    background: #ffffff; color: #1a1a1a; border-color: rgba(0,0,0,0.15);
}
[data-theme="gis-green"] .dash-header {
    background: #1a5c36; color: #fff; border-bottom-color: #145028;
}
[data-theme="gis-green"] .dash-header .logo span,
[data-theme="gis-green"] .dash-header button { color: rgba(255,255,255,0.85); }
[data-theme="gis-green"] .dash-sidebar {
    background: #1a5c36; border-right: 1px solid #145028;
}
[data-theme="gis-green"] #dash-nav-list li { color: rgba(255,255,255,0.75); }
[data-theme="gis-green"] #dash-nav-list li:hover,
[data-theme="gis-green"] #dash-nav-list li.active {
    background: rgba(255,255,255,0.12); color: #fff; border-left-color: #2ecc71;
}
[data-theme="gis-green"] .primary { background: #27ae60; }
[data-theme="gis-green"] .primary:hover { background: #219a52; }
[data-theme="gis-green"] .toggle-slider { background: #b2dfdb; }
[data-theme="gis-green"] input:checked + .toggle-slider { background: #27ae60; }
[data-theme="gis-green"] .modal-overlay { background: rgba(0,0,0,0.55); }
[data-theme="gis-green"] .modal-content, [data-theme="gis-green"] .modal-body { background: #fff; color: #1a1a1a; }
[data-theme="gis-green"] code { background: rgba(0,0,0,0.07); color: #1a1a1a; }

/* Upload inner tabs */
.upload-inner-tabs { display:flex; gap:2px; margin-bottom:20px; background:var(--bg-secondary); border-radius:var(--radius-md); padding:4px; width:fit-content; }
.upload-inner-tab { padding:7px 18px; border-radius:var(--radius-sm); cursor:pointer; font-size:0.85em; font-weight:500; color:var(--text-secondary); transition:var(--transition); white-space:nowrap; border:none; background:transparent; }
.upload-inner-tab.active { background:var(--bg-surface); color:var(--text-primary); box-shadow:var(--shadow-sm); }
.upload-inner-tab:hover:not(.active) { background:var(--bg-hover); color:var(--text-primary); }
.upload-inner-content { display:none; }
.upload-inner-content.active { display:block; }
.upload-drop-large { border:2px dashed var(--border); border-radius:var(--radius-lg); padding:48px 20px; text-align:center; cursor:pointer; transition:var(--transition); background:var(--bg-secondary); position:relative; }
.upload-drop-large:hover, .upload-drop-large.dragover { border-color:var(--accent); background:var(--accent-glow); }
.upload-drop-large svg { opacity:0.5; margin-bottom:12px; }
.upload-queue { margin-top:20px; display:flex; flex-direction:column; gap:8px; }
.upload-queue-item { display:flex; align-items:center; gap:10px; padding:10px 14px; background:var(--bg-panel); border:1px solid var(--border); border-radius:var(--radius-sm); font-size:0.84em; }
.upload-queue-item .uq-icon { width:28px; height:28px; border-radius:6px; display:flex; align-items:center; justify-content:center; font-size:1em; flex-shrink:0; }
.upload-queue-item .uq-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.upload-queue-item .uq-bar { height:4px; border-radius:2px; background:var(--bg-active); overflow:hidden; width:80px; flex-shrink:0; }
.upload-queue-item .uq-fill { height:100%; background:var(--accent); transition:width 0.3s; }
.upload-queue-item.done .uq-fill { background:var(--success); }
.upload-queue-item.error .uq-fill { background:var(--danger); }

/* User management redesign */
.user-card { background:var(--bg-panel); border:1px solid var(--border); border-radius:var(--radius-md); overflow:hidden; display:flex; flex-direction:column; transition:var(--transition); }
.user-card:hover { border-color:rgba(255,255,255,0.14); box-shadow:var(--shadow-sm); }
.user-card-header { padding:16px 18px 14px; display:flex; gap:14px; align-items:flex-start; }
.user-avatar { width:52px; height:52px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:1.1em; flex-shrink:0; }
.user-card-body { padding:0 18px 14px; display:flex; flex-direction:column; gap:10px; flex:1; }
.user-card-section-label { font-size:0.68em; font-weight:700; color:var(--text-muted); letter-spacing:.6px; margin-bottom:5px; }
.user-card-actions { padding:12px 18px; border-top:1px solid var(--border); display:flex; gap:6px; flex-wrap:wrap; }
.uca-btn { flex:1; font-size:0.76em; padding:5px 8px; background:var(--bg-secondary); border:1px solid var(--border); border-radius:5px; cursor:pointer; color:var(--text); min-width:60px; white-space:nowrap; }
.uca-btn:hover { background:var(--bg-hover); color:var(--text-primary); }
.uca-btn.danger { background:rgba(239,68,68,0.10); border-color:rgba(239,68,68,0.25); color:#f87171; }
.uca-btn.warn { background:rgba(245,158,11,0.10); border-color:rgba(245,158,11,0.25); color:var(--warning); }

/* Theme picker cards */
.theme-card { border:2px solid var(--border); border-radius:var(--radius-md); padding:12px; cursor:pointer; transition:var(--transition); text-align:center; }
.theme-card:hover { border-color:var(--accent); }
.theme-card.selected { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-glow); }
.theme-preview { height:60px; border-radius:6px; margin-bottom:8px; overflow:hidden; display:flex; flex-direction:column; }
.theme-preview-header { height:16px; }
.theme-preview-body { flex:1; display:flex; }
.theme-preview-sidebar { width:24px; }
.theme-preview-content { flex:1; background: repeating-linear-gradient(90deg, rgba(255,255,255,0.06) 0px, rgba(255,255,255,0.06) 1px, transparent 1px, transparent 14px); }

/* ── Collapsible settings cards ─────────────────────────── */
/* ── Settings vcard ─────────────────────────────────────────────────────── */
.settings-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow .18s, border-color .18s, transform .15s;
    position: relative;
}
.settings-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent, #3b82f6);
    border-radius: 0;
    opacity: .7;
    transition: opacity .18s;
}
.settings-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,0.28); border-color: rgba(59,130,246,0.35); }
.settings-card:hover::before { opacity: 1; }
.settings-card-header {
    display: flex;
    align-items: center;
    padding: 14px 18px 14px 20px;
    cursor: pointer;
    user-select: none;
    gap: 14px;
    background: transparent;
    transition: background .12s;
}
.settings-card-header:hover { background: rgba(255,255,255,0.03); }
/* Icon circle */
.settings-card-header .sc-icon {
    width: 38px; height: 38px; flex-shrink: 0;
    border-radius: 10px;
    background: rgba(59,130,246,0.14);
    border: 1px solid rgba(59,130,246,0.22);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1em;
    transition: background .15s;
}
.settings-card-header:hover .sc-icon { background: rgba(59,130,246,0.22); }
/* Text block */
.settings-card-header .sc-text { flex: 1; min-width: 0; }
.settings-card-header .sc-text h3 { margin: 0; font-size: 0.94em; font-weight: 700; color: var(--text-primary, #f1f5f9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-card-header .sc-text p  { margin: 2px 0 0; font-size: 0.73em; color: var(--text-secondary, #94a3b8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Toggle arrow */
.settings-card-header .sc-toggle {
    width: 24px; height: 24px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: transform .2s, background .12s;
    background: rgba(255,255,255,0.06); color: var(--text-secondary); font-size: 0.68em;
}
.settings-card.sc-collapsed .sc-toggle { transform: rotate(-90deg); }
.settings-card-body {
    padding: 4px 18px 18px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    animation: scExpand 0.18s ease;
}
.settings-card.sc-collapsed .settings-card-body { display: none; }
@keyframes scExpand { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:translateY(0); } }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
}

.hidden { display: none !important; }

/* ─── Header ─────────────────────────────────── */

#header {
    height: var(--header-h);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    /* z-index rimosso: non creare stacking context qui — i dropdown (.menu-dropdown z-index:9999)
       devono essere valutati nel root context per apparire sopra le overlay della mappa (z-index 1000+) */
    position: relative;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
    flex-shrink: 0;
}

.header-brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: 46px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}

.header-brand-row span {
    font-size: 1.05em;
    font-weight: 700;
    letter-spacing: 1px;
}

.header-toolbar-row {
    display: flex;
    align-items: flex-start;
    padding: 2px 6px 3px;
    flex: 1;
    min-width: 0;
    overflow: visible;
}

.header-toolbar-row .toolbar {
    width: 100%;
}

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

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.logo h1 {
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
}

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

.toolbar-row2 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.menu-bar {
    display: flex;
    align-items: center;
    gap: 4px 8px;
    flex-wrap: wrap;
    row-gap: 3px;
    min-width: 0;
}

.menu-item {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.menu-btn:hover, .menu-btn.open {
    border-color: var(--accent);
    background: var(--bg-elevated);
    color: var(--accent);
}

/* Toolbar icon-only mode */
.toolbar-icon-mode .menu-bar .menu-btn {
    font-size: 0 !important;
    padding: 7px 8px;
    gap: 0;
    min-width: 0;
}
.toolbar-icon-mode .menu-bar .menu-btn svg {
    font-size: initial;
    flex-shrink: 0;
}
.toolbar-mode-opt { transition: border-color .15s, background .15s; }
.toolbar-mode-opt.active-opt {
    background: var(--accent-muted) !important;
    border-color: var(--accent) !important;
}

.menu-btn.ai-geo-disabled {
    opacity: 0.66;
    border-style: dashed;
}

.menu-btn.ai-geo-disabled:hover {
    opacity: 1;
    border-color: var(--warning);
    color: var(--warning);
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    min-width: 260px;
    max-height: 72vh;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 6px;
    z-index: 9999;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65);
}

.menu-dropdown.open {
    display: block;
}

.menu-dropdown button {
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.83rem;
    display: block;
}

.menu-dropdown button:hover {
    background: var(--bg-panel);
    color: var(--text-primary);
}

.menu-dropdown button.open {
    background: rgba(var(--accent-rgb, 99,102,241), 0.15);
    color: var(--accent);
}

.menu-section-title {
    margin: 8px 6px 4px;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.menu-sep {
    height: 1px;
    background: var(--border);
    margin: 8px 4px;
}

.project-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-selector label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

select {
    appearance: none;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 7px 30px 7px 10px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
    transition: border var(--transition);
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b95a5' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 14px;
    max-width: 260px;
}

select:focus { border-color: var(--accent); }

/* Buttons */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-hover);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

button:hover { background: var(--bg-active); border-color: rgba(255,255,255,0.15); }
button:active { transform: scale(0.97); }

button.primary {
    background: var(--accent);
    border-color: transparent;
    color: white;
    box-shadow: 0 2px 10px var(--accent-glow);
}
button.primary:hover { background: var(--accent-hover); }

.tool-group {
    display: flex;
    gap: 1px;
    background: rgba(255,255,255,0.03);
    padding: 2px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.tool-group button { border: none; background: transparent; padding: 5px 8px; }
.tool-group button:hover { background: var(--bg-active); }

.agenzia-shift-btn {
    background: #d4a017;
    border-color: #f2c94c;
    color: #181100;
    font-weight: 700;
}
.agenzia-shift-btn:hover {
    background: #f2c94c;
    border-color: #ffd866;
    color: #181100;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
}
.icon-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

.tool-info-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    border-left: 1px solid var(--border);
    padding-left: 10px;
    font-style: italic;
}

/* ─── Main Layout ────────────────────────────── */

.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ─── Sidebar ────────────────────────────────── */

#sidebar {
    width: var(--sidebar-w);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    background: var(--bg-surface);
    transition: width var(--transition), transform var(--transition);
    flex-shrink: 0;
    position: relative;
}

#sidebar.collapsed {
    width: 0;
    overflow: hidden;
    border-right: none;
}

#sidebar.sidebar-geocoder-active {
    width: clamp(var(--sidebar-w), 34vw, 430px);
}

#sidebar.collapsed.sidebar-geocoder-active {
    width: 0;
}

.sidebar-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ── Sidebar nav 2×2 grid ─────────────────────────────────── */
.sidebar-nav-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

@keyframes ocean-pulse {
    0%   { box-shadow: 0 0 6px rgba(30,160,230,0.55), 0 0 14px rgba(14,100,200,0.35), inset 0 1px 0 rgba(160,225,255,0.18); }
    50%  { box-shadow: 0 0 12px rgba(30,160,230,0.85), 0 0 28px rgba(14,100,200,0.55), inset 0 1px 0 rgba(160,225,255,0.30); }
    100% { box-shadow: 0 0 6px rgba(30,160,230,0.55), 0 0 14px rgba(14,100,200,0.35), inset 0 1px 0 rgba(160,225,255,0.18); }
}

.snav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
    line-height: 1;
    letter-spacing: 0.01em;
}

.snav-btn:hover {
    background: var(--bg-secondary);
    color: #7dd6f7;
    border-color: #1aa3e8;
    box-shadow: 0 0 6px rgba(30,160,230,0.35);
}

.snav-btn.snav-active {
    background: linear-gradient(160deg, #0b2a4a 0%, #0a4a8c 55%, #0c6ebd 100%);
    border-color: #1aa3e8;
    color: #a8e6ff;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(160,230,255,0.75);
    animation: ocean-pulse 2.8s ease-in-out infinite;
}

.snav-btn.snav-active svg {
    filter: drop-shadow(0 0 4px rgba(160,230,255,0.9));
}

.snav-btn svg {
    flex-shrink: 0;
}

/* Search */
.layer-search {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.layer-search input {
    width: 100%;
    padding: 7px 10px 7px 32px;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8rem;
    outline: none;
    transition: border var(--transition);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a6373' stroke-width='2'%3e%3ccircle cx='11' cy='11' r='8'%3e%3c/circle%3e%3cline x1='21' y1='21' x2='16.65' y2='16.65'%3e%3c/line%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: 8px center;
    background-size: 14px;
}
.layer-search input:focus { border-color: var(--accent); }
.layer-search input::placeholder { color: var(--text-muted); }

/* Layer list */
.layer-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
}

.layer-list::-webkit-scrollbar { width: 6px; }
.layer-list::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); border-radius: 3px; }
.layer-list::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.35); border-radius: 3px; }
.layer-list::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.6); }

/* Layer toolbar */
.layer-tree-toolbar { flex-shrink: 0; }

.ltt-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.ltt-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--accent);
}

.layer-group { margin-bottom: 2px; }
.layer-group.drop-target > .group-header {
    outline: 2px dashed var(--accent);
    outline-offset: 2px;
    background: rgba(77,159,255,0.10);
}
.layer-list.drop-root {
    outline: 2px dashed var(--accent);
    outline-offset: -6px;
    background: rgba(77,159,255,0.06);
}

.group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: background var(--transition);
}
.group-header:hover { background: var(--bg-hover); }

.group-toggle {
    font-size: 0.55rem;
    color: var(--text-muted);
    transition: transform var(--transition);
    width: 12px;
    text-align: center;
}

.layer-group.collapsed .group-toggle { transform: rotate(-90deg); }
.layer-group.collapsed .group-children { display: none; }

.group-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.group-children {
    padding-left: 12px;
    border-left: 1px solid rgba(255,255,255,0.04);
    margin-left: 6px;
}

.layer-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 4px 6px;
    border-radius: var(--radius-xs);
    margin-bottom: 2px;
    transition: background var(--transition);
    gap: 2px;
}
.layer-item:hover { background: var(--bg-hover); }
.layer-item.unsupported { }
.layer-item.dragging { opacity: 0.55; }
.layer-item.drop-before {
    outline: 2px dashed var(--accent);
    outline-offset: 2px;
    background: rgba(77,159,255,0.08);
}

.layer-info {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    overflow: hidden;
    cursor: pointer;
}

.layer-icon {
    font-size: 0.75rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
}

.layer-name {
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.layer-badge {
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 8px;
    background: rgba(77,159,255,0.15);
    color: var(--accent);
    margin-left: 4px;
    flex-shrink: 0;
    font-weight: 600;
}

.layer-badge.error {
    background: rgba(248,113,113,0.15);
    color: var(--danger);
}

/* Semaphore presence badge on project cards */
.presence-badge {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-left: 5px;
    vertical-align: middle;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.3);
    transition: background 0.3s;
}
.presence-badge.free {
    background: #2ecc71;
}
.presence-badge.busy {
    background: #f59e0b;
    animation: gf-blink-yellow 1s ease-in-out infinite;
}
@keyframes gf-blink-yellow {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px #f59e0b; }
    50% { opacity: 0.2; box-shadow: none; }
}

.layer-actions {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    padding-left: 26px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.18s ease, opacity 0.18s ease;
}
.layer-item:hover .layer-actions,
.layer-item:focus-within .layer-actions {
    max-height: 100px;
    opacity: 1;
}

.layer-action-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 2px 5px;
    font-size: 0.78rem;
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: all var(--transition);
    line-height: 1;
    color: var(--text-secondary);
}
.layer-action-btn:hover {
    background: var(--bg-active);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* Checkbox styling */
input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

/* Opacity slider */
.opacity-slider {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 38px;
    margin-bottom: 2px;
}

.layer-symbol {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
}

/* (duplicate .layer-actions/.layer-action-btn rules removed — see above) */

input[type="color"] {
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 2px;
    height: 40px;
    width: 100%;
    cursor: pointer;
}

.opacity-slider input[type="range"] {
    flex: 1;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    outline: none;
}

.opacity-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

.opacity-slider span {
    font-size: 0.65rem;
    color: var(--text-muted);
    width: 28px;
    text-align: right;
}

/* ─── Map ────────────────────────────────────── */

#map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    background: var(--bg-base);
}

/* Drag & drop import overlay (QGIS Browser-like) */
.map-drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
}

.map-drop-overlay-inner {
    padding: 16px 20px;
    border: 2px dashed var(--accent);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.sidebar-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1000;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 7px 9px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-active); }

.basemap-toggle {
    left: auto;
    right: 50px;
}

/* Basemap selector — anchored to left side (JS overrides with fixed+coords on open) */
.basemap-panel {
    position: fixed;
    top: 72px;
    right: 70px;
    left: auto;
    z-index: 1000;
    display: grid;
    grid-template-columns: repeat(4, 62px);
    gap: 7px;
    padding: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: opacity var(--transition), transform var(--transition);
    max-height: 85vh;
    overflow-y: auto;
}

.basemap-panel.basemap-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(10px);
}

.basemap-option {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    overflow: hidden;
    transition: border var(--transition), transform var(--transition);
    position: relative;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-lighter);
}

.basemap-option[data-basemap="none"] { background: var(--bg-lighter); }
.basemap-option[data-basemap="osm"] { background-image: url('https://a.tile.openstreetmap.org/6/33/23.png'); }
.basemap-option[data-basemap="voyager"] { background-image: url('https://a.basemaps.cartocdn.com/rastertiles/voyager/6/33/23.png'); }
.basemap-option[data-basemap="light"] { background-image: url('https://a.basemaps.cartocdn.com/light_all/6/33/23.png'); }
.basemap-option[data-basemap="dark"] { background-image: url('https://a.basemaps.cartocdn.com/dark_all/6/33/23.png'); }
.basemap-option[data-basemap="satellite"] { background-image: url('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/6/23/33'); }
.basemap-option[data-basemap="esri_street"] { background-image: url('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/6/23/33'); }
.basemap-option[data-basemap="topo_stack"] { background-image: url('https://a.tile.opentopomap.org/6/33/23.png'); }
.basemap-option[data-basemap="agenzia_wms"] { background-image: linear-gradient(to bottom right, #f8f9fa, #e9ecef); border: 1px solid #dee2e6; }
.basemap-option[data-basemap="agenzia_wfs"] { background-image: linear-gradient(to bottom right, #f8f9fa, #e9ecef); border: 1px solid #dee2e6; }

.basemap-option:hover { transform: scale(1.05); }
.basemap-option.active { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }

/* Activated STAC catalogs: quick-launch tiles in the basemap panel */
.basemap-option.basemap-stac {
    background-image: linear-gradient(135deg, #0b3d5c, #1d6fa5);
    border: 2px solid rgba(77,159,255,0.55);
}
.basemap-option.basemap-stac span {
    background: rgba(0,0,0,0.78);
    font-size: 0.46rem;
}

.basemap-option span {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 0.5rem;
    text-align: center;
    padding: 2px;
    background: rgba(0,0,0,0.7);
    color: var(--text-primary);
    font-weight: 600;
}

.basemap-watermark {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    z-index: 640;
    max-width: min(620px, calc(100% - 260px));
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px 9px;
    padding: 5px 10px;
    border: 1px solid rgba(148,163,184,0.3);
    border-radius: 6px;
    background: rgba(10,12,16,0.76);
    box-shadow: 0 3px 14px rgba(0,0,0,0.28);
    color: rgba(226,232,240,0.92);
    font-size: 0.64rem;
    line-height: 1.25;
    pointer-events: auto;
}

.basemap-watermark.hidden {
    display: none !important;
}

.basemap-watermark-credit {
    font-weight: 700;
}

.basemap-watermark-license {
    color: rgba(203,213,225,0.84);
}

.basemap-watermark-site a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
}

.basemap-watermark-site a:hover {
    text-decoration: underline;
}

@media (max-width: 820px) {
    .basemap-watermark {
        bottom: 8px;
        max-width: calc(100% - 22px);
        font-size: 0.58rem;
        padding: 4px 7px;
    }
}

.georef-gcp-flag-icon {
    background: transparent;
    border: 0;
}

.georef-gcp-tooltip {
    background: #111827 !important;
    border: 1px solid rgba(255,255,255,.25) !important;
    color: #f8fafc !important;
    border-radius: 4px !important;
    box-shadow: 0 3px 10px rgba(0,0,0,.35) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 2px 6px !important;
}

.georef-gcp-tooltip::before {
    border-top-color: #111827 !important;
}

.coordinate-grid-label {
    background: rgba(10, 15, 28, 0.82);
    border: 1px solid rgba(77,159,255,0.45);
    color: #dbeafe;
    border-radius: 4px;
    padding: 2px 5px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

.coordinate-grid-intersection-label {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 76px;
    padding: 3px 5px;
    border-radius: 5px;
    border: 1px solid rgba(148, 197, 255, 0.32);
    background: rgba(8, 13, 24, 0.74);
    color: #e0f2fe;
    box-shadow: 0 2px 9px rgba(0,0,0,0.34);
    font-size: 9px;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
}

.coordinate-grid-intersection-label span:last-child {
    color: #bfdbfe;
    font-weight: 600;
}

.coordinate-grid-scale {
    min-width: 120px;
    padding: 7px 9px 8px;
    border-radius: 7px;
    border: 1px solid rgba(226,232,240,0.42);
    background: rgba(8, 13, 24, 0.88);
    color: #f8fafc;
    box-shadow: 0 4px 16px rgba(0,0,0,0.42);
    font-size: 10px;
    pointer-events: none;
}

.coordinate-grid-scale-title {
    color: #bfdbfe;
    font-weight: 700;
    margin-bottom: 4px;
}

.coordinate-grid-scale-bar {
    position: relative;
    height: 12px;
    display: flex;
    border: 1px solid #f8fafc;
    background: #0f172a;
}

.coordinate-grid-scale-bar span {
    flex: 1;
    border-right: 1px solid #f8fafc;
}

.coordinate-grid-scale-bar span:nth-child(odd) {
    background: #f8fafc;
}

.coordinate-grid-scale-bar span:last-child {
    border-right: 0;
}

.coordinate-grid-scale-label {
    margin-top: 3px;
    color: #e2e8f0;
    font-weight: 800;
}

.output-storage-indicator {
    position: fixed;
    right: 18px;
    bottom: 76px;
    z-index: 90000;
    max-width: 360px;
    padding: 11px 13px;
    border-radius: 9px;
    border: 1px solid rgba(52,211,153,0.45);
    background: rgba(12, 18, 28, 0.96);
    color: #d1fae5;
    box-shadow: 0 8px 28px rgba(0,0,0,0.45);
    font-size: 0.82rem;
}

.output-storage-indicator strong {
    color: #34d399;
}

.gf-output-flash {
    animation: gfOutputFlash 1s ease-in-out 6;
}

@keyframes gfOutputFlash {
    0%, 100% { box-shadow: none; background: transparent; }
    50% { box-shadow: 0 0 0 2px rgba(52,211,153,0.75); background: rgba(52,211,153,0.18); }
}

.geocoder-control {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px 34px;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    overflow: visible;
}

#sidebar-geocoder-tab {
    font-size: 0.92rem;
}

#sidebar-geocoder-tab .geocoder-control {
    grid-template-columns: 30px minmax(0, 1fr) 30px 30px;
}

.geocoder-control input {
    height: 34px;
    border: 0;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    padding: 0 10px;
    outline: none;
    min-width: 0;
}

#sidebar-geocoder-tab .geocoder-control input {
    height: 32px;
    padding: 0 8px;
    font-size: 0.78rem;
}

.geocoder-control button {
    height: 34px;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sidebar-geocoder-tab .geocoder-control button {
    height: 32px;
}

.geocoder-control button:hover,
.geocoder-control .geocoder-mode.reverse {
    color: var(--accent);
    background: var(--bg-hover);
}

.geocoder-results {
    position: static;
    grid-column: 1 / -1;
    max-height: 260px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    margin-top: 6px;
}

.geocoder-result {
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    display: grid;
    gap: 3px;
    cursor: pointer;
}

.geocoder-result:hover { background: var(--bg-hover); }
.geocoder-result span,
.geocoder-result.muted { color: var(--text-secondary); font-size: 0.76rem; }
.geocoder-result.error { color: var(--danger); }

.geocoder-route-panel {
    position: static;
    grid-column: 1 / -1;
    z-index: 1;
    display: grid;
    gap: 8px;
    padding: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    margin-top: 6px;
}

#sidebar-geocoder-tab .geocoder-route-panel {
    gap: 6px;
    padding: 8px;
}

.route-input-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 6px;
}

#sidebar-geocoder-tab .route-input-row {
    grid-template-columns: 20px minmax(0, 1fr) 30px;
    gap: 5px;
}

.route-input-row span {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(59,130,246,0.16);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 800;
}

#sidebar-geocoder-tab .route-input-row span {
    width: 20px;
    height: 20px;
    font-size: 0.68rem;
}

.route-input-row input {
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
}

#sidebar-geocoder-tab .route-input-row input {
    height: 30px;
    padding: 0 7px;
    font-size: 0.75rem;
}

.route-input-row button,
.route-actions button,
.route-actions select {
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

#sidebar-geocoder-tab .route-input-row button,
#sidebar-geocoder-tab .route-actions button,
#sidebar-geocoder-tab .route-actions select {
    height: 30px;
    font-size: 0.72rem;
    padding: 0 5px;
    min-width: 0;
}

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

#sidebar-geocoder-tab .route-actions {
    gap: 5px;
}

.route-actions select {
    grid-column: 1 / -1;
    width: 100%;
}

.route-actions button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    padding: 0 12px;
}

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

.geocoder-route-marker-icon {
    width: 26px !important;
    height: 26px !important;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1;
}

.geocoder-route-marker-icon.route-a {
    background: #16a34a;
}

.geocoder-route-marker-icon.route-b {
    background: #dc2626;
}

/* ────────────────────────────────────────────────────────────────────────── */
/* Map rotation (compass)                                                     */
/* ────────────────────────────────────────────────────────────────────────── */

.leaflet-rotate-wrapper {
    position: absolute;
    inset: 0;
    transform-origin: 50% 50%;
    will-change: transform;
}

.leaflet-rotate-pane {
    transform-origin: 50% 50%;
}

.leaflet-rotate-upright {
    will-change: transform;
}

.compass-btn {
    touch-action: none; /* allow pointer-drag rotation */
}

.compass-btn svg {
    transform-origin: 50% 50%;
    will-change: transform;
}

.route-status {
    min-height: 18px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

#sidebar-geocoder-tab .route-status {
    max-height: min(360px, calc(100vh - 330px)) !important;
    font-size: 0.72rem;
}

.route-status .route-ext-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.route-status .route-ext-actions button {
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    padding: 0 8px;
}

#map-screenshot-btn:hover,
#map-refresh-btn:hover {
    background: rgba(30,34,50,0.97) !important;
    border-color: rgba(255,255,255,0.28) !important;
}

#map-screenshot-btn:active {
    border-color: rgba(99,102,241,.8) !important;
    color: #818cf8 !important;
    transform: scale(0.93);
}

.screenshot-target-menu {
    position: fixed;
    z-index: 10000;
    min-width: 230px;
    padding: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.screenshot-target-menu button {
    width: 100%;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-align: left;
}

.screenshot-target-menu button:hover {
    background: var(--bg-hover);
}

.screenshot-target-menu button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.screenshot-target-menu small {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.external-map-pip {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9400;
    width: min(520px, calc(100vw - 32px));
    height: min(390px, calc(100vh - 80px));
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 18px 60px rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.external-map-pip header {
    height: 38px;
    flex: 0 0 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    font-size: 0.82rem;
    font-weight: 700;
}

.external-map-pip header span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.external-map-pip header button {
    height: 26px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
}

.external-map-pip iframe {
    width: 100%;
    height: 100%;
    border: 0;
    flex: 1;
    background: #0f172a;
}

.external-map-pip .pip-message {
    padding: 16px;
    font-size: 0.84rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.external-map-tool-active {
    background: rgba(59,130,246,0.18) !important;
    box-shadow: 0 0 0 1px rgba(96,165,250,0.45) inset;
}

.chart-clickable {
    cursor: zoom-in;
}

.chart-clickable:hover {
    box-shadow: 0 0 0 1px rgba(96,165,250,0.5) inset;
}

.graph-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 10020;
    background: rgba(0,0,0,0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.graph-viewer {
    width: min(1040px, 96vw);
    max-height: 92vh;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 70px rgba(0,0,0,0.6);
}

.graph-viewer header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.graph-viewer header strong {
    flex: 1;
}

.graph-viewer header button {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 6px 10px;
    cursor: pointer;
}

.graph-viewer-body {
    padding: 12px;
    overflow: auto;
    background: rgba(255,255,255,0.025);
}

/* ─── Map Overlays (Replaces Status Bar) ──────── */

.map-overlay {
    position: absolute;
    z-index: 1000;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    pointer-events: none; /* Let clicks pass through to map */
}

.map-overlay.bottom-right {
    bottom: 12px;
    right: 12px;
}

.map-overlay.top-center {
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 95vw;
    white-space: nowrap;
    flex-wrap: nowrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-item .label {
    color: var(--text-muted);
    font-weight: 500;
}

#status-project {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6b7280; /* Default gray */
    display: inline-block;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

/* ─── Table Panel ────────────────────────────── */

#table-panel {
    position: absolute;
    bottom: 16px;
    left: calc(var(--sidebar-w) + 16px);
    right: 16px;
    height: 36%;
    min-height: 220px;
    max-height: 75vh;
    z-index: 500;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    transition: transform 0.3s ease, opacity 0.3s ease;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.3);
    overflow: hidden;
}

/* ── Resize handle at top of table panel ── */
#table-panel-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    cursor: ns-resize;
    background: transparent;
    z-index: 10;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
#table-panel-resize-handle::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    margin: 1.5px auto 0;
    transition: background 0.15s;
}
#table-panel-resize-handle:hover::after { background: rgba(77,159,255,0.6); }

#table-panel.collapsed {
    transform: translateY(calc(100% + 48px));
    opacity: 0;
    pointer-events: none;
}

#table-panel.at-editing-mode {
    border-color: rgba(52,211,153,0.4);
    box-shadow: 0 8px 32px rgba(0,0,0,0.45), 0 0 0 1px rgba(52,211,153,0.2);
}

/* ── Table Header bar ── */
.table-header {
    padding: 6px 12px 6px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.22);
    flex-shrink: 0;
    gap: 8px;
}

.table-header h3 {
    font-size: 0.82rem;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    letter-spacing: 0.01em;
}

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

.badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(77,159,255,0.15);
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.at-sel-badge {
    font-size: 0.68rem;
    color: #f59e0b;
    font-weight: 600;
    white-space: nowrap;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(245,158,11,0.12);
    border: 1px solid rgba(245,158,11,0.25);
    display: none;
}

.at-sel-badge.visible { display: inline-block; }

.at-edit-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: #34d399;
    background: rgba(52,211,153,0.14);
    border: 1px solid rgba(52,211,153,0.35);
    border-radius: 10px;
    padding: 2px 8px;
    white-space: nowrap;
    display: none;
    letter-spacing: 0.02em;
}

.at-edit-badge.visible { display: inline-flex; align-items: center; gap: 4px; }

/* ── Attribute Table Toolbar ── */
.at-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1px;
    padding: 4px 8px;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.at-group {
    display: flex;
    align-items: center;
    gap: 1px;
}

.at-sep {
    width: 1px;
    height: 18px;
    background: rgba(255,255,255,0.1);
    margin: 0 4px;
    flex-shrink: 0;
}

/* Base toolbar button */
.at-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 5px;
    border: 1px solid transparent;
    background: rgba(255,255,255,0.05);
    color: #cbd5e1;
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    line-height: 1.3;
}
.at-btn:hover { background: rgba(255,255,255,0.11); color: #f1f5f9; border-color: rgba(255,255,255,0.1); }
.at-btn svg { flex-shrink: 0; opacity: 0.8; }
.at-btn:hover svg { opacity: 1; }

/* Edit toggle button */
.at-btn-edit {
    border-color: rgba(255,255,255,0.12);
}
.at-btn-edit.active {
    background: rgba(52,211,153,0.14);
    border-color: rgba(52,211,153,0.45);
    color: #34d399;
    font-weight: 700;
}
.at-btn-edit.active svg { opacity: 1; }

/* Save button */
.at-btn-save {
    background: rgba(52,211,153,0.08);
    border-color: rgba(52,211,153,0.3);
    color: #34d399;
}
.at-btn-save:hover { background: rgba(52,211,153,0.2); border-color: rgba(52,211,153,0.6); }

/* Add feature button */
.at-btn-add {
    background: rgba(77,159,255,0.08);
    border-color: rgba(77,159,255,0.25);
    color: #60a5fa;
}
.at-btn-add:hover { background: rgba(77,159,255,0.18); border-color: rgba(77,159,255,0.5); }

/* Delete button */
.at-btn-del {
    background: rgba(239,68,68,0.07);
    border-color: rgba(239,68,68,0.25);
    color: #f87171;
}
.at-btn-del:hover { background: rgba(239,68,68,0.18); border-color: rgba(239,68,68,0.5); }

/* Geometry / orange ops */
.at-btn-geom {
    background: rgba(245,158,11,0.07);
    border-color: rgba(245,158,11,0.25);
    color: #fbbf24;
}
.at-btn-geom:hover { background: rgba(245,158,11,0.18); border-color: rgba(245,158,11,0.5); }

/* Export / purple */
.at-btn-export {
    background: rgba(167,139,250,0.07);
    border-color: rgba(167,139,250,0.25);
    color: #a78bfa;
}
.at-btn-export:hover { background: rgba(167,139,250,0.18); border-color: rgba(167,139,250,0.5); }

/* Join / teal */
.at-btn-join {
    background: rgba(52,211,153,0.06);
    border-color: rgba(52,211,153,0.22);
    color: #6ee7b7;
}
.at-btn-join:hover { background: rgba(52,211,153,0.15); }

/* Filter input */
.at-filter-input {
    flex: 1;
    min-width: 90px;
    max-width: 180px;
    padding: 3px 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    color: #e2e8f0;
    font-size: 0.76rem;
    outline: none;
    transition: border-color 0.15s;
}
.at-filter-input:focus { border-color: rgba(77,159,255,0.5); }
.at-filter-input::placeholder { color: rgba(255,255,255,0.28); font-style: italic; }

.at-filter-count {
    font-size: 0.72rem;
    color: #f59e0b;
    white-space: nowrap;
    font-weight: 600;
    display: none;
}

/* ── Geometry operations bar (shown on row selection) ── */
.at-geombar {
    display: none;
    align-items: center;
    gap: 3px;
    padding: 4px 10px;
    background: rgba(245,158,11,0.06);
    border-bottom: 1px solid rgba(245,158,11,0.18);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.at-geombar.visible { display: flex; }

.at-geombar-label {
    font-size: 0.7rem;
    color: #f59e0b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    margin-right: 4px;
}

.at-geombar-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(245,158,11,0.22);
    background: rgba(245,158,11,0.07);
    color: #fbbf24;
    cursor: pointer;
    font-size: 0.73rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s;
}
.at-geombar-btn:hover { background: rgba(245,158,11,0.2); border-color: rgba(245,158,11,0.55); }
.at-geombar-btn.danger { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.07); color: #f87171; }
.at-geombar-btn.danger:hover { background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.6); }

.at-geombar-more-item {
    display: block;
    width: 100%;
    padding: 7px 10px;
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 0.78em;
    text-align: left;
    cursor: pointer;
    border-radius: 5px;
    white-space: nowrap;
}
.at-geombar-more-item:hover { background: rgba(245,158,11,0.15); color: #fbbf24; }

/* ── Table content area ── */
.table-content {
    flex: 1;
    overflow: auto;
    position: relative;
    /* Improve horizontal scroll experience */
    scroll-behavior: smooth;
}

/* Wider, more visible scrollbars for ease of use */
.table-content::-webkit-scrollbar { width: 8px; height: 8px; }
.table-content::-webkit-scrollbar-track { background: rgba(0,0,0,0.15); border-radius: 4px; }
.table-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
.table-content::-webkit-scrollbar-thumb:hover { background: rgba(77,159,255,0.5); border-color: transparent; background-clip: padding-box; }
.table-content::-webkit-scrollbar-corner { background: transparent; }

/* Keep the attribute-table from stretching to full width when columns are narrow */
#attribute-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
    table-layout: fixed;
}

/* Generic table fallback (non-attribute tables) */
table:not(#attribute-table) {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

/* ── Row number column: sticky left + top ── */
th.at-th-num, td.at-td-num {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    text-align: right;
    padding: 0 8px 0 4px;
    color: rgba(148,163,184,0.45) !important;
    font-size: 0.67rem;
    user-select: none;
    border-right: 1px solid rgba(255,255,255,0.07);
    cursor: default !important;
    /* Frozen first column */
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bg-surface);
}
th.at-th-num {
    z-index: 3; /* Above data cells when scrolling both axes */
    background: var(--bg-elevated, #1a1f2e) !important;
}
td.at-td-num {
    background: rgba(15,20,30,0.85) !important;
}

th {
    position: sticky;
    top: 0;
    background: var(--bg-elevated, #1a1f2e);
    padding: 7px 12px;
    text-align: left;
    color: var(--text-secondary);
    border-bottom: 2px solid rgba(77,159,255,0.25);
    font-weight: 700;
    font-size: 0.69rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color var(--transition), background var(--transition);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    z-index: 1;
    min-width: 80px;
}
th:hover { color: var(--accent); background: rgba(77,159,255,0.08); }
th.sorted { color: var(--accent); }
th.sorted::after { content: ' ▼'; font-size: 0.55rem; opacity: 0.8; }
th.sorted.asc::after { content: ' ▲'; }

.table-col-label {
    display: inline-block;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.table-col-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 5px;
    border-radius: 3px;
    border: 1px solid rgba(239,68,68,0.28);
    background: rgba(239,68,68,0.08);
    color: #fca5a5;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.14s, background 0.14s;
    vertical-align: middle;
}

#table-head-row th:hover .table-col-delete,
.table-col-delete:focus { opacity: 1; }
.table-col-delete:hover { background: rgba(239,68,68,0.22); border-color: rgba(239,68,68,0.65); color: #fff; }

.delete-field-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow: auto;
    padding-right: 3px;
}

.delete-field-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    cursor: pointer;
    text-align: left;
}
.delete-field-item:hover { border-color: rgba(77,159,255,0.45); background: rgba(77,159,255,0.10); }
.delete-field-item.selected { border-color: rgba(239,68,68,0.72); background: rgba(239,68,68,0.14); }
.delete-field-item.disabled { opacity: 0.48; cursor: not-allowed; }

.delete-field-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.delete-field-type {
    flex-shrink: 0;
    font-size: 0.72em;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 7px;
}

#df-confirm-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: saturate(0.55);
}

#attribute-table td {
    padding: 6px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    white-space: nowrap;
    max-width: 280px;
    min-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}
/* Generic td fallback */
td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.025);
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

#attribute-table tr { cursor: pointer; transition: background 0.07s; }
#attribute-table tr:nth-child(even) { background: rgba(255,255,255,0.022); }
#attribute-table tr:hover { background: rgba(77,159,255,0.08) !important; }
#attribute-table tr.selected {
    background: rgba(77,159,255,0.18) !important;
    box-shadow: inset 3px 0 0 var(--accent);
}
#attribute-table tr.selected td { color: #e2e8f0; }
/* Row height consistency */
#attribute-table tr { height: 30px; }

tr.selected td { color: #e2e8f0; }

/* Empty state */
.at-empty-state {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.at-empty-state svg { opacity: 0.25; margin-bottom: 10px; display: block; margin-left: auto; margin-right: auto; }

/* ── Attribute table smart enhancements ── */
td.at-cell-editing {
    background: rgba(77,159,255,0.12) !important;
    outline: 2px solid rgba(77,159,255,0.6);
    outline-offset: -2px;
    border-radius: 3px;
}
td.at-cell-null { color: rgba(148,163,184,0.38) !important; font-style: italic; }
td.at-cell-num { color: #a5f3fc; font-variant-numeric: tabular-nums; }
td.at-cell-bool-true { color: #34d399; }
td.at-cell-bool-false { color: #f87171; }
td.at-cell-url { color: var(--accent); text-decoration: underline; cursor: pointer; }

/* ── Column type icon badges ── */
.at-col-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: 700;
    border-radius: 3px;
    padding: 1px 4px;
    margin-right: 4px;
    vertical-align: middle;
    opacity: 0.7;
    letter-spacing: 0;
    text-transform: none;
    pointer-events: none;
}
.at-ct-num { background: rgba(165,243,252,0.13); color: #a5f3fc; border: 1px solid rgba(165,243,252,0.2); }
.at-ct-str { background: rgba(167,139,250,0.13); color: #a78bfa; border: 1px solid rgba(167,139,250,0.2); }
.at-ct-date { background: rgba(251,191,36,0.13); color: #fbbf24; border: 1px solid rgba(251,191,36,0.2); }
.at-ct-bool { background: rgba(52,211,153,0.13); color: #34d399; border: 1px solid rgba(52,211,153,0.2); }

/* ── Row hover zoom icon (replaces row number on hover) ── */
td.at-td-num .at-rn { display: inline; }
td.at-td-num .at-rz {
    display: none;
    cursor: pointer;
    color: var(--accent);
    font-size: 1em;
    line-height: 1;
    transition: transform 0.12s;
}
td.at-td-num .at-rz:hover { transform: scale(1.2); }
#attribute-table tr:hover td.at-td-num .at-rn { display: none; }
#attribute-table tr:hover td.at-td-num .at-rz { display: inline; }

/* Column stats tooltip on header */
.at-col-stats-tooltip {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: rgba(18,22,35,0.97);
    border: 1px solid rgba(77,159,255,0.3);
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 0.74em;
    color: #94a3b8;
    white-space: nowrap;
    z-index: 3000;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    min-width: 160px;
}
.at-col-stats-tooltip dt { color: #cbd5e1; font-weight: 700; margin-bottom: 4px; font-size: 0.9em; }
.at-col-stats-tooltip dd { margin: 2px 0; display: flex; justify-content: space-between; gap: 12px; }
.at-col-stats-tooltip dd span { color: #f1f5f9; font-weight: 600; }

/* Table row flash animation on save */
@keyframes rowSaved { 0%{background:rgba(52,211,153,0.25)} 100%{background:transparent} }
tr.at-row-saved { animation: rowSaved 0.8s ease-out; }
@keyframes rowError { 0%{background:rgba(239,68,68,0.25)} 100%{background:transparent} }
tr.at-row-error { animation: rowError 0.8s ease-out; }

/* Smart search highlight in cells */
td mark.at-match {
    background: rgba(245,158,11,0.3);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

.media-link {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}
.media-link:hover { color: var(--success); }

/* ─── Modal ──────────────────────────────────── */

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    width: 100%;
    max-width: 900px;
    height: 85%;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.25s ease;
}

.modal-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h3 { font-size: 0.9rem; }
.modal-actions { display: flex; gap: 6px; align-items: center; }

.modal-body {
    flex: 1;
    overflow: auto;
    background: #000;
}

.modal-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: auto;
}

.modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.info-content {
    padding: 20px;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-surface);
}
.info-content strong { color: var(--accent); }
.info-field { margin-bottom: 8px; display: flex; gap: 8px; }
.info-label { color: var(--text-muted); min-width: 100px; font-weight: 500; }

/* ─── Toast Notifications ────────────────────── */

#toast-container {
    position: fixed;
    bottom: 44px;
    right: 16px;
    z-index: 3000;
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
    pointer-events: none;
    max-width: 340px;
}

.toast {
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 0.79rem;
    color: var(--text-primary);
    background: rgba(14,17,28,0.97);
    border: 1px solid rgba(255,255,255,0.09);
    box-shadow: 0 6px 28px rgba(0,0,0,0.65), 0 1px 0 rgba(255,255,255,0.04) inset;
    animation: toastIn 0.22s cubic-bezier(0.34,1.56,0.64,1), fadeOut 0.3s ease 3.7s forwards;
    pointer-events: auto;
    max-width: 340px;
    display: flex;
    align-items: center;
    gap: 9px;
    backdrop-filter: blur(12px);
    line-height: 1.4;
}
.toast .toast-icon {
    flex: 0 0 auto;
}
.toast .toast-message {
    min-width: 0;
    overflow-wrap: anywhere;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info    { border-left: 3px solid var(--accent); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Loading Overlay ────────────────────────── */

.glass-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 12, 16, 0.85);
    backdrop-filter: blur(4px);
    /* Above every modal (incl. the 100000-range DXF/STAC/Potree viewers) so the
       loading bar stays visible while a long operation runs from inside a modal. */
    z-index: 120000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255,255,255,0.08);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ─── Loading: GEOFUSION pulsing logo ─────────────────────────────── */
.gf-loading-logo-wrap {
    position: relative;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gf-loading-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    animation: gf-ring-spin 1.2s linear infinite;
}
.gf-ring-arc {
    transform-origin: center;
}
.gf-loading-logo {
    width: 54px;
    height: auto;
    animation: gf-logo-pulse 1.2s ease-in-out infinite;
    position: relative;
    z-index: 1;
}
@keyframes gf-logo-pulse {
    0%, 100% { opacity: 0.6;  transform: scale(0.93); filter: none; }
    50%       { opacity: 1;   transform: scale(1.05); filter: drop-shadow(0 0 10px rgba(77,159,255,0.55)); }
}
@keyframes gf-ring-spin {
    to { transform: rotate(360deg); }
}

/* Mini badge version */
.gf-loading-mini-logo-wrap {
    position: relative;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gf-loading-mini-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    animation: gf-ring-spin 1.2s linear infinite;
}
.gf-loading-mini-logo {
    width: 18px;
    height: auto;
    animation: gf-logo-pulse 1.2s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

.glass-overlay p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ─── Loading progress bar ───────────────────── */
.loading-bar {
    width: 240px;
    max-width: 60vw;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
}
.loading-bar-fill {
    height: 100%;
    width: 40%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--accent), rgba(255,255,255,0.55), var(--accent));
    animation: loadingIndeterminate 1.2s ease-in-out infinite;
}
.loading-bar.determinate .loading-bar-fill {
    animation: none;
    width: 0%;
    transition: width 0.35s ease;
}
.loading-overlay-sub {
    font-size: 0.72rem !important;
    color: var(--text-muted) !important;
    max-width: 60vw;
    text-align: center;
}
@keyframes loadingIndeterminate {
    0%   { transform: translateX(-110%); }
    100% { transform: translateX(360%); }
}

/* ─── Loading: minimize button + mini badge (bottom-right) ─────────── */
#loading-overlay-min {
    position: absolute;
    top: 14px;
    right: 16px;
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.72rem;
    cursor: pointer;
    z-index: 1;
}
#loading-overlay-min:hover {
    background: rgba(255,255,255,0.14);
}
.loading-mini-badge {
    position: fixed;
    bottom: 18px;
    right: 18px;
    background: rgba(20, 24, 34, 0.96);
    border: 1px solid rgba(212,160,23,0.4);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.45);
    z-index: 120001;
    min-width: 240px;
    max-width: 320px;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.loading-mini-badge:hover { transform: translateY(-1px); }
.loading-mini-badge.hidden { display: none; }
.loading-mini-spinner {
    /* kept for legacy references — hidden in favour of .gf-loading-mini-logo-wrap */
    display: none;
}
.loading-mini-text {
    flex: 1;
    min-width: 0;
    color: #e2e8f0;
}
#loading-mini-msg {
    font-size: 0.78rem;
    font-weight: 600;
    color: #d4a017;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.loading-mini-bar {
    margin-top: 4px;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.loading-mini-fill {
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, var(--accent), rgba(255,255,255,0.55), var(--accent));
    animation: loadingIndeterminate 1.2s ease-in-out infinite;
    border-radius: 3px;
}
.loading-mini-fill.determinate {
    animation: none;
    transition: width 0.35s ease;
}
.loading-mini-sub {
    font-size: 0.66rem;
    color: rgba(255,255,255,0.55);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.loading-mini-expand {
    background: transparent;
    border: 0;
    color: #94a3b8;
    font-size: 1.05em;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
}
.loading-mini-expand:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

/* ─── Legend Panel ───────────────────────────── */

.legend-container {
    padding: 6px 10px 6px 38px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

/* ─── Animations ─────────────────────────────── */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes gf-stac-loading {
    0% { transform: translateX(-120%); }
    50% { transform: translateX(80%); }
    100% { transform: translateX(240%); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ─── Leaflet Overrides ──────────────────────── */

/* Zoom Leaflet nativo nascosto — sostituito dal canvas-bottom-bar */
.leaflet-control-zoom { display: none !important; }

.leaflet-control-zoom a {
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}
.leaflet-control-zoom a:hover { background: var(--bg-active) !important; }

/* ─── Canvas overlay controls ────────────────── */
/* I container (#canvas-bottom-bar, #canvas-right-toolbar) usano pointer-events:none
   così NON bloccano i click agli elementi sottostanti (tabella attributi, layer panel, ecc.)
   Solo i singoli pulsanti .canvas-map-btn hanno pointer-events:auto. */
#canvas-bottom-bar button,
#canvas-right-toolbar button,
#canvas-bottom-bar .canvas-map-btn,
#canvas-right-toolbar .canvas-map-btn {
    pointer-events: auto;
}

.canvas-map-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    border-radius: 7px;
    cursor: pointer;
    transition: background .15s, color .15s;
    flex-shrink: 0;
    pointer-events: auto;
}
.canvas-map-btn:hover {
    background: rgba(255,255,255,0.09);
}
.canvas-map-btn.active {
    background: rgba(99,102,241,0.22);
    color: var(--accent);
}
.canvas-map-btn-icon {
    width: 30px;
    height: 30px;
}
.canvas-map-btn-labeled {
    flex-direction: column;
    gap: 2px;
    width: 100%;
    height: auto;
    padding: 5px 4px 4px;
    border-radius: 8px;
    font-size: 0;
}
.canvas-map-btn-labeled span {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: inherit;
    opacity: 0.82;
    text-align: center;
    line-height: 1;
    pointer-events: none;
    white-space: nowrap;
}

.leaflet-control-attribution {
    background: rgba(10,12,16,0.7) !important;
    color: var(--text-muted) !important;
    font-size: 0.6rem !important;
}
.leaflet-control-attribution a { color: var(--text-secondary) !important; }

.leaflet-control-scale-line {
    background: rgba(10,12,16,0.7) !important;
    color: var(--text-secondary) !important;
    border-color: var(--text-muted) !important;
    font-size: 0.6rem !important;
}

/* ─── Map Feature Highlight ────────────────────── */

.feature-highlight {
    filter: drop-shadow(0 0 8px var(--accent));
    animation: pulse-glow 2s infinite alternate;
    outline: none;
}

@keyframes pulse-glow {
    0% { filter: drop-shadow(0 0 6px var(--accent)); }
    100% { filter: drop-shadow(0 0 16px var(--accent)); }
}

@keyframes save-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.pulse {
    animation: save-pulse 2s infinite;
    background: var(--success) !important;
    color: #000 !important;
}

/* ─── Responsive ─────────────────────────────── */

@media (max-width: 768px) {
    #sidebar { position: absolute; left: 0; top: var(--header-h); bottom: var(--statusbar-h); z-index: 50; }
    #sidebar.collapsed { transform: translateX(-100%); width: var(--sidebar-w); }
    #table-panel { left: 16px; }
    .tool-info-text { display: none; }
}

/* Placeholder text */
.placeholder-text {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: 0.8rem;
}

/* Auth Styles */
.auth-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, #1a1e26 0%, #0a0c10 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
.auth-box {
    background: var(--bg-panel);
    backdrop-filter: blur(var(--glass-blur));
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
    text-align: center;
}
.auth-box h2 {
    margin-top: 0;
    margin-bottom: 25px;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: -0.5px;
}
.auth-box input {
    width: 100%;
    margin-bottom: 15px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: var(--transition);
}
.auth-box input:focus {
    border-color: var(--accent);
    outline: none;
    background: rgba(255,255,255,0.08);
}
/* ─── Sidebar Footer Brand ────────────────────── */

/* sidebar-footer-brand removed (Venosa logo replaced by AI progress bar) */

.user-profile-menu {
    display: flex;
    gap: 10px;
    margin-left: 15px;
    padding-left: 15px;
    border-left: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════
   Dashboard Styles
   ═══════════════════════════════════════════════ */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-base);
}

.dash-header {
    height: var(--header-h);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

.dash-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.dash-sidebar {
    width: 240px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 20px 0;
}

#dash-nav-list {
    list-style: none;
}

#dash-nav-list li {
    padding: 12px 20px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

#dash-nav-list li:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

#dash-nav-list li.active {
    background: var(--bg-active);
    color: var(--accent);
    border-left-color: var(--accent);
}

.dash-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.projects-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Category section */
.proj-category-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.proj-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border);
}

.proj-category-header .pch-icon { font-size: 1.1em; }
.proj-cat-count {
    margin-left: auto;
    font-size: 0.72em;
    background: var(--bg-secondary);
    color: var(--text-muted);
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.proj-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.project-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 4px;
    background: var(--accent-gradient);
    opacity: 0.7;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.4);
    border-color: var(--accent);
    background: var(--bg-elevated);
}

.project-card-thumb {
    height: 160px;
    background: linear-gradient(135deg, var(--bg-panel) 0%, #1a1f2e 100%);
    overflow: hidden;
    position: relative;
}

.project-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
    transition: opacity 0.3s, transform 0.3s;
}

.project-card-thumb.no-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
}
.project-card-thumb.no-thumb::after {
    content: '🗺️';
    font-size: 2.5em;
    opacity: 0.3;
}

.project-card:hover .project-card-thumb img {
    opacity: 1;
    transform: scale(1.03);
}

.card-thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: white;
    font-size: 0.8em;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s;
}
.project-card-thumb:hover .card-thumb-overlay {
    opacity: 1;
}

.project-card-thumb .card-badges {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 5px;
}

.project-card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.project-card-body h3 {
    margin: 0;
    color: #fff;
    font-size: 1em;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.72em;
    color: var(--text-secondary);
}

.project-card-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.04);
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.06);
}

.project-card-meta .meta-item svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.project-card-desc {
    font-size: 0.75em;
    color: var(--text-muted);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-card-actions {
    display: flex;
    gap: 6px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
}

.project-card-actions button {
    flex: 1;
    padding: 6px 10px;
    font-size: 0.72em;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
}

.project-card-actions .btn-export {
    background: rgba(77, 159, 255, 0.12);
    border: 1px solid rgba(77, 159, 255, 0.2);
    color: var(--accent);
}

.project-card-actions .btn-export:hover {
    background: rgba(77, 159, 255, 0.25);
}

.project-card-actions .btn-delete {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.15);
    color: var(--danger);
}

.project-card-actions .btn-delete:hover {
    background: rgba(248, 113, 113, 0.25);
}

.project-card-actions .btn-open {
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.2);
    color: var(--success);
}

.project-card-actions .btn-open:hover {
    background: rgba(52, 211, 153, 0.25);
}

.project-card .layer-badge {
    position: static;
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: 6px;
}

/* User access badges on project cards */
.card-users-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}
.card-user-badge {
    font-size: 0.65em;
    padding: 2px 7px;
    border-radius: 20px;
    background: rgba(139,92,246,0.15);
    border: 1px solid rgba(139,92,246,0.25);
    color: #c4b5fd;
    white-space: nowrap;
}
.card-user-more {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.1);
    color: var(--text-muted);
}

/* Feature modal footer */
.modal-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.dash-sidebar li {
    margin: 4px 12px;
    border-radius: var(--radius-sm);
    border-left: none !important;
}

.dash-sidebar li.active {
    background: rgba(77, 159, 255, 0.15);
    color: var(--accent);
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-elevated);
    transition: var(--transition);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(77, 159, 255, 0.05);
}

.drop-zone svg {
    margin-bottom: 10px;
}

/* File Browser */
#file-browser-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════════
   GEOFUSION Restyle 2026 — Operations UI
   ═══════════════════════════════════════════════ */

:root {
    --bg-base: #090d12;
    --bg-surface: #111821;
    --bg-panel: #151d27;
    --bg-elevated: #1b2531;
    --bg-secondary: rgba(255, 255, 255, 0.055);
    --bg-dark: #06090d;
    --bg-hover: rgba(255, 255, 255, 0.075);
    --bg-active: rgba(79, 156, 249, 0.14);
    --border: rgba(214, 226, 241, 0.1);
    --border-focus: rgba(79, 156, 249, 0.55);
    --text: #e7eef7;
    --text-primary: #f4f7fb;
    --text-secondary: #a1afbf;
    --text-muted: #6d7a8b;
    --accent: #4f9cf9;
    --accent-glow: rgba(79, 156, 249, 0.18);
    --accent-hover: #72b4ff;
    --accent-gradient: linear-gradient(135deg, #4f9cf9 0%, #30c3a2 100%);
    --success: #30c38d;
    --warning: #f0b84f;
    --danger: #ef6b73;
    --service-mergin: #31c48d;
    --service-webodm: #f0b84f;
    --service-task: #b997ff;
    --service-files: #52c7ea;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 10px 26px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.38);
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 8px;
    --radius-xl: 8px;
    --header-h: 98px;
}

[data-theme="light"],
[data-theme="paper"],
[data-theme="daylight"],
[data-theme="blueprint"],
[data-theme="gis-green"] {
    --bg-base: #eef3f8;
    --bg-surface: #ffffff;
    --bg-panel: #ffffff;
    --bg-elevated: #f7f9fc;
    --bg-secondary: rgba(15, 23, 42, 0.055);
    --bg-dark: #dde6ef;
    --bg-hover: rgba(15, 23, 42, 0.055);
    --bg-active: rgba(37, 99, 235, 0.1);
    --border: rgba(15, 23, 42, 0.12);
    --text: #172033;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #7b8796;
    --accent: #2459d6;
    --accent-hover: #1d4ed8;
    --accent-glow: rgba(37, 99, 235, 0.16);
    --success: #158463;
    --warning: #a86710;
    --danger: #c73943;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 12px 28px rgba(15, 23, 42, 0.12);
    --shadow-lg: 0 18px 48px rgba(15, 23, 42, 0.16);
}

html,
body {
    letter-spacing: 0;
}

body,
button,
input,
select,
textarea {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

button,
.btn,
.adm-btn,
.dash-action-btn,
.dash-icon-btn,
.dash-service-tile {
    border-radius: var(--radius-sm);
}

button:active {
    transform: none;
}

input,
select,
textarea,
.adm-field input,
.adm-field select,
.adm-field textarea {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
}

input:focus,
select:focus,
textarea:focus,
.adm-field input:focus,
.adm-field select:focus,
.adm-field textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
    outline: none;
}

/* Login */
.auth-container {
    background:
        linear-gradient(180deg, rgba(9, 13, 18, 0.94), rgba(9, 13, 18, 0.98)),
        url('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/6/33/36');
    background-size: cover;
    background-position: center;
}

.auth-box {
    width: min(420px, calc(100vw - 32px));
    background: rgba(13, 19, 27, 0.94);
    border: 1px solid rgba(226, 237, 250, 0.12);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 34px;
    backdrop-filter: blur(14px);
}

.auth-box img[alt="GeoFusion Logo"] {
    max-width: 164px !important;
    margin-bottom: 24px !important;
}

.auth-box input {
    height: 42px;
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(226, 237, 250, 0.13);
}

.auth-box button.primary {
    height: 42px;
    font-weight: 700;
}

/* Dashboard shell */
.dashboard-layout {
    background: var(--bg-base);
}

.dash-header {
    height: var(--header-h);
    padding: 0 22px;
    background: color-mix(in srgb, var(--bg-surface) 92%, #000 8%);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}

.dash-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.dash-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.dash-brand-mark img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.dash-brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    min-width: 0;
}

.dash-brand-title {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0;
}

.dash-brand-subtitle {
    margin-top: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0;
}

.dash-user {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dash-action-btn,
.dash-icon-btn {
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    min-height: 34px;
    box-shadow: none;
}

.dash-action-btn {
    padding: 7px 11px;
    font-size: 0.78rem;
    font-weight: 700;
}

.dash-icon-btn {
    width: 34px;
    height: 34px;
    padding: 0;
}

.dash-icon-btn svg {
    width: 17px;
    height: 17px;
}

.dash-action-btn:hover,
.dash-icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: rgba(226, 237, 250, 0.18);
}

.dash-icon-btn.danger {
    color: var(--danger);
}

.dash-main {
    background: var(--bg-base);
}

.dash-sidebar {
    width: 268px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
}

#dash-nav-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

#dash-nav-list li {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    margin: 0;
    border: 1px solid transparent !important;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 650;
}

#dash-nav-list li:not(.dash-nav-section):hover {
    background: var(--bg-hover);
    border-color: var(--border) !important;
    color: var(--text-primary);
}

#dash-nav-list li.active {
    background: var(--bg-active);
    border-color: rgba(79, 156, 249, 0.28) !important;
    color: var(--text-primary);
    box-shadow: inset 3px 0 0 var(--accent);
}

#dash-nav-list li.dash-nav-section {
    min-height: 24px;
    margin-top: 12px;
    padding: 8px 10px 4px;
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
    cursor: default;
    pointer-events: none;
}

#dash-nav-list li.dash-nav-section:first-child {
    margin-top: 0;
}

.dash-nav-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    background: rgba(79, 156, 249, 0.11);
    flex-shrink: 0;
}

.dash-nav-icon svg {
    width: 15px;
    height: 15px;
}

.dash-nav-icon.service-mergin {
    color: var(--service-mergin);
    background: color-mix(in srgb, var(--service-mergin) 14%, transparent);
}

.dash-nav-icon.service-webodm {
    color: var(--service-webodm);
    background: color-mix(in srgb, var(--service-webodm) 15%, transparent);
}

.dash-nav-icon.service-task {
    color: var(--service-task);
    background: color-mix(in srgb, var(--service-task) 14%, transparent);
}

.dash-sidebar-footer {
    margin-top: auto;
    padding: 14px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.76rem;
    line-height: 1.4;
}

.dash-sidebar-footer strong {
    display: block;
    margin-top: 4px;
    color: var(--text-primary);
    font-size: 0.8rem;
}

.dash-sidebar-kicker {
    color: var(--text-muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

.dash-content {
    padding: 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 220px),
        var(--bg-base);
}

.dash-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.dash-page-head h2,
.dash-content h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.42rem;
    font-weight: 800;
    letter-spacing: 0;
}

.dash-page-head p {
    max-width: 780px;
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.55;
}

.dash-eyebrow {
    margin: 0 0 4px !important;
    color: var(--accent) !important;
    font-size: 0.72rem !important;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

.dash-page-head .primary {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 0.84rem;
    font-weight: 800;
}

.dash-service-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}

.dash-service-tile {
    min-height: 74px;
    justify-content: flex-start;
    gap: 12px;
    padding: 13px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-primary);
    text-align: left;
    box-shadow: var(--shadow-sm);
}

.dash-service-tile:hover {
    background: var(--bg-elevated);
    border-color: rgba(226, 237, 250, 0.18);
    box-shadow: var(--shadow-md);
}

.service-tile-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.service-tile-icon svg {
    width: 19px;
    height: 19px;
}

.tile-qgis {
    color: var(--accent);
    background: rgba(79, 156, 249, 0.12);
}

.tile-mergin {
    color: var(--service-mergin);
    background: color-mix(in srgb, var(--service-mergin) 14%, transparent);
}

.tile-webodm {
    color: var(--service-webodm);
    background: color-mix(in srgb, var(--service-webodm) 15%, transparent);
}

.tile-files {
    color: var(--service-files);
    background: color-mix(in srgb, var(--service-files) 14%, transparent);
}

.dash-service-tile span:last-child {
    min-width: 0;
}

.dash-service-tile strong,
.dash-service-tile small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-service-tile strong {
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 800;
}

.dash-service-tile small {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.35;
    white-space: normal;
}

.dash-section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 12px;
    padding-top: 2px;
}

.dash-section-title span {
    color: var(--text-primary);
    font-size: 0.92rem;
    font-weight: 800;
}

.dash-section-title small {
    color: var(--text-muted);
    font-size: 0.76rem;
}

/* Project cards */
.projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
    gap: 14px;
}

.project-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.project-card::before {
    height: 0;
    display: none;
}

.project-card:hover {
    transform: translateY(-2px);
    background: var(--bg-elevated);
    border-color: rgba(79, 156, 249, 0.34);
    box-shadow: var(--shadow-md);
}

.project-card-thumb {
    height: 132px;
    background:
        linear-gradient(135deg, rgba(79, 156, 249, 0.12), rgba(48, 195, 141, 0.08)),
        var(--bg-elevated) !important;
    border-bottom: 1px solid var(--border);
}

.project-card-thumb.no-thumb::after {
    content: none !important;
}

.project-card-thumb img {
    opacity: 0.92;
    filter: saturate(0.92) contrast(1.02);
}

.project-card-body {
    padding: 14px 14px 12px;
    gap: 9px;
}

.project-card-body h3 {
    color: var(--text-primary);
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: 0;
}

.project-card-meta {
    gap: 6px;
}

.project-card-meta .meta-item,
.project-card .layer-badge,
.card-user-badge {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.project-card .layer-badge {
    padding: 3px 7px;
    font-size: 0.68rem;
    font-weight: 800;
}

.project-card-desc {
    color: var(--text-muted);
    font-size: 0.76rem;
}

.card-thumb-overlay {
    background: rgba(7, 11, 17, 0.74);
    backdrop-filter: blur(2px);
}

.project-card-actions {
    padding: 10px 12px 12px;
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-dark) 28%, transparent);
}

.project-card-actions button {
    min-height: 31px;
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-weight: 800;
}

.project-card-actions .btn-open {
    background: color-mix(in srgb, var(--success) 13%, transparent);
    border-color: color-mix(in srgb, var(--success) 24%, transparent);
    color: var(--success);
}

.project-card-actions .btn-export {
    background: color-mix(in srgb, var(--accent) 13%, transparent);
    border-color: color-mix(in srgb, var(--accent) 24%, transparent);
    color: var(--accent);
}

.project-card-actions .btn-delete {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    border-color: color-mix(in srgb, var(--danger) 24%, transparent);
    color: var(--danger);
}

/* Admin/service panels */
.adm-layout {
    grid-template-columns: 224px 1fr;
    min-height: calc(100vh - var(--header-h) - 48px);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.adm-sidenav {
    padding: 14px 10px;
    background: color-mix(in srgb, var(--bg-surface) 78%, #000 22%);
    border-right: 1px solid var(--border);
}

.adm-sidenav-group {
    padding: 9px 10px 6px;
    color: var(--text-muted);
    font-size: 0.66rem;
    letter-spacing: 0;
}

.adm-nav-btn {
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 700;
}

.adm-nav-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text-primary);
}

.adm-nav-btn.active {
    background: var(--bg-active);
    border-color: rgba(79, 156, 249, 0.26);
    color: var(--text-primary);
}

.adm-main {
    padding: 22px;
}

.adm-page-header {
    margin-bottom: 18px;
}

.adm-page-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0;
}

.adm-page-subtitle {
    margin-top: 4px;
    color: var(--text-secondary);
}

/* ── Municipal services form elements ── */
.adm-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.78em;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.adm-input,
.adm-label input,
.adm-label textarea {
    padding: 8px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.88em;
    font-weight: 400;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}
.adm-input:focus,
.adm-label input:focus,
.adm-label textarea:focus,
.adm-label select:focus {
    outline: none;
    border-color: var(--accent);
}
.adm-select,
.adm-label select {
    padding: 8px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.88em;
    width: 100%;
    cursor: pointer;
}
.adm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82em;
}
.adm-table th {
    background: rgba(255,255,255,0.04);
    padding: 8px 12px;
    text-align: left;
    font-size: 0.75em;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    position: sticky;
    top: 0;
}
.adm-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    vertical-align: middle;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.adm-table tr:hover td { background: rgba(255,255,255,0.03); }
.adm-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.adm-badge-success { background: rgba(52,211,153,0.15); color: #34d399; }
.adm-badge-danger  { background: rgba(239,68,68,0.15);  color: #f87171; }
.adm-badge-warning { background: rgba(245,158,11,0.15); color: #fbbf24; }
.adm-badge-info    { background: rgba(96,165,250,0.15); color: #60a5fa; }
.adm-section { display: none; }
.adm-section.adm-active { display: block; }

.adm-card,
.adm-stat,
.adm-container-card,
.settings-card,
.user-card {
    background: var(--bg-surface);
    border-color: var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.adm-card-header,
.user-card-actions {
    border-color: var(--border);
}

.adm-card-icon {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.adm-stat-val {
    font-size: 1.32rem;
    font-weight: 800;
}

.adm-info-row {
    background: var(--bg-elevated);
    border-color: var(--border);
    border-radius: var(--radius-sm);
}

.adm-info-key {
    letter-spacing: 0;
}

.adm-empty {
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
}

/* Upload and embedded file manager */
.upload-inner-tabs {
    width: 100%;
    max-width: 520px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.upload-inner-tab {
    border-radius: var(--radius-sm);
    font-weight: 800;
}

.upload-inner-tab.active {
    background: var(--bg-elevated);
    box-shadow: none;
}

.upload-drop-large,
.drop-zone {
    border-color: rgba(226, 237, 250, 0.16);
    border-radius: var(--radius-lg);
    background: var(--bg-panel);
}

.upload-drop-large:hover,
.upload-drop-large.dragover,
.drop-zone:hover,
.drop-zone.dragover {
    background: color-mix(in srgb, var(--accent) 9%, var(--bg-panel));
    border-color: var(--accent);
}

.efm-root {
    border-radius: var(--radius-lg) !important;
    border-color: var(--border) !important;
    background: var(--bg-panel) !important;
}

.efm-toolbar,
.efm-statusbar {
    background: var(--bg-surface) !important;
    border-color: var(--border) !important;
}

.efm-tb-btn,
.efm-search {
    border-radius: var(--radius-sm) !important;
}

/* Project AI workflow modal */
.ai-geo-modal-card {
    width: min(94vw, 920px);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-geo-modal-head {
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.ai-geo-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ai-geo-title-wrap h3 {
    margin: 0;
    font-size: 1.02rem;
    letter-spacing: 0;
}

.ai-geo-title-wrap p {
    margin: 2px 0 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.ai-geo-title-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(147, 197, 253, 0.24);
    flex: 0 0 auto;
}

.ai-geo-modal-body {
    padding: 16px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-geo-form-shell {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-geo-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(190px, 240px);
    gap: 12px;
    align-items: stretch;
}

.ai-geo-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.79rem;
}

.ai-geo-label {
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 700;
}

.ai-geo-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text);
    outline: none;
}

.ai-geo-input:focus {
    border-color: rgba(96, 165, 250, 0.75);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.ai-geo-status-card,
.ai-geo-result,
.ai-geo-file-dropdown {
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.ai-geo-status-card {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.ai-geo-status-card strong {
    color: var(--text);
    font-size: 0.84rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-geo-status-card small,
.ai-geo-status-k,
.ai-geo-file-info {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.ai-geo-source-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ai-geo-source-btn {
    padding: 10px 12px;
    min-height: 58px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    text-align: left;
}

.ai-geo-source-btn span {
    font-weight: 800;
}

.ai-geo-source-btn small {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.ai-geo-source-btn.is-active {
    border-color: rgba(96, 165, 250, 0.72);
    background: rgba(37, 99, 235, 0.16);
    color: #bfdbfe;
}

.ai-geo-inline-note {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.18);
    border-radius: 7px;
    padding: 8px 10px;
    font-size: 0.75rem;
}

.ai-geo-area-data-alert {
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(245, 158, 11, 0.34);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(59, 130, 246, 0.08));
    color: #fde68a;
    font-size: 0.75rem;
    line-height: 1.45;
}

.ai-geo-area-data-alert-title {
    color: #fbbf24;
    font-weight: 800;
}

.ai-geo-area-raster-box {
    padding: 10px;
    border: 1px solid rgba(96, 165, 250, 0.22);
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.07);
}

.ai-geo-area-summary-box {
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 7px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.ai-geo-area-summary-box::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    flex: 0 0 auto;
}

.ai-geo-file-picker {
    position: relative;
}

.ai-geo-file-input {
    padding-right: 38px;
}

.ai-geo-file-browse {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.ai-geo-file-browse:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.ai-geo-file-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 230px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.ai-geo-file-row {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
}

.ai-geo-file-row:hover {
    background: var(--bg-secondary);
}

.ai-geo-file-row span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-geo-file-row small {
    color: var(--text-muted);
    flex: 0 0 auto;
}

.ai-geo-file-row.is-muted {
    cursor: default;
    color: var(--text-muted);
}

.ai-geo-file-row.is-error {
    cursor: default;
    color: var(--danger);
}

.ai-geo-actionbar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.ai-geo-action-left,
.ai-geo-action-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ai-geo-outline-btn,
.ai-geo-run-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.ai-geo-outline-btn {
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-secondary);
    color: var(--text);
    cursor: pointer;
    font-size: 0.8rem;
}

.ai-geo-outline-btn:hover {
    border-color: rgba(148, 163, 184, 0.55);
    background: var(--bg-elevated);
}

.ai-geo-accent-btn {
    border-color: rgba(96, 165, 250, 0.68);
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.12);
}

.ai-geo-timer {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    min-width: 58px;
    text-align: right;
}

.ai-geo-result {
    min-height: 118px;
    padding: 13px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.ai-geo-result-empty {
    height: 88px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
}

.ai-geo-result-empty strong {
    color: var(--text);
}

.ai-geo-run-message,
.ai-geo-result-title {
    font-weight: 800;
    margin-bottom: 8px;
}

.ai-geo-run-progress {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
    margin: 9px 0;
}

.ai-geo-run-progress > div {
    height: 100%;
    background: linear-gradient(90deg, #1d4ed8, #3b82f6, #93c5fd);
    transition: width 0.35s ease;
}

.ai-geo-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.ai-geo-result-grid > div {
    padding: 8px 9px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    min-width: 0;
}

.ai-geo-result-grid strong,
.ai-geo-result-grid span {
    display: block;
}

.ai-geo-result-grid strong {
    color: var(--text-muted);
    font-size: 0.68rem;
    margin-bottom: 3px;
}

.ai-geo-result-grid span {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-geo-output-spec {
    border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.07);
    padding: 10px 12px;
}

.ai-geo-output-spec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    min-width: 0;
}

.ai-geo-output-spec-head strong {
    color: var(--text);
    font-size: 0.82rem;
}

.ai-geo-output-spec-head span {
    color: #93c5fd;
    font-size: 0.72rem;
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-geo-output-spec-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
}

.ai-geo-output-spec-grid > div {
    min-width: 0;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 7px 8px;
}

.ai-geo-output-spec-grid span,
.ai-geo-output-spec-grid strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-geo-output-spec-grid span {
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 700;
}

.ai-geo-output-spec-grid strong {
    color: var(--text);
    font-size: 0.74rem;
    margin-top: 2px;
}

.ai-geo-output-files {
    margin-top: 10px;
    border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.06);
    padding: 9px 11px;
}

.ai-geo-output-files-title {
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin-bottom: 7px;
}

.ai-geo-output-file-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-geo-output-file-row:first-of-type {
    border-top: 0;
}

.ai-geo-output-file-kind {
    font-size: 0.66rem;
    font-weight: 800;
    color: #bfdbfe;
    background: rgba(96, 165, 250, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.24);
    border-radius: 999px;
    padding: 2px 7px;
    text-align: center;
}

.ai-geo-output-file-main {
    min-width: 0;
}

.ai-geo-output-file-main strong,
.ai-geo-output-file-main code {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-geo-output-file-main strong {
    color: var(--text);
    font-size: 0.78rem;
}

.ai-geo-output-file-main code {
    color: var(--text-muted);
    font-size: 0.69rem;
    background: transparent;
    padding: 0;
}

.ai-geo-output-file-size {
    color: var(--text-muted);
    font-size: 0.7rem;
    white-space: nowrap;
}

.ai-geo-output-file-row a {
    color: var(--accent);
    border: 1px solid rgba(96, 165, 250, 0.32);
    border-radius: 5px;
    padding: 3px 8px;
    text-decoration: none;
    font-size: 0.72rem;
    background: rgba(96, 165, 250, 0.1);
    white-space: nowrap;
}

.ai-geo-demo-table-wrap {
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 10px;
}

.ai-geo-demo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.74rem;
}

.ai-geo-demo-table th,
.ai-geo-demo-table td {
    padding: 8px 9px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: top;
    text-align: left;
}

.ai-geo-demo-table th {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ai-geo-demo-table td {
    color: var(--text-secondary);
}

.ai-geo-demo-table td strong,
.ai-geo-demo-table td code {
    display: block;
}

.ai-geo-demo-table td strong {
    color: var(--text);
    font-size: 0.76rem;
}

.ai-geo-demo-table td code {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.67rem;
}

.ai-geo-demo-ok,
.ai-geo-demo-warn {
    display: inline-block;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.66rem;
    font-weight: 800;
}

.ai-geo-demo-ok {
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.26);
}

.ai-geo-demo-warn {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

/* ── AI Geo — card-based operation picker ─────────────────────────── */
.ai-geo-op-picker {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-geo-op-group-label {
    font-size: 0.67rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.ai-geo-op-group-req {
    font-weight: 500;
    color: #fbbf24;
    text-transform: none;
    letter-spacing: 0;
}

.ai-geo-op-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
}

.ai-geo-op-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    padding-right: 40px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.14s, background 0.14s, box-shadow 0.14s;
    position: relative;
    overflow: hidden;
}

.ai-geo-op-card:hover {
    border-color: rgba(148, 163, 184, 0.45);
    background: var(--bg-elevated);
}

.ai-geo-op-card.is-active {
    border-color: rgba(96, 165, 250, 0.72);
    background: rgba(37, 99, 235, 0.14);
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.18), 0 2px 14px rgba(37, 99, 235, 0.16);
}

.ai-geo-op-card-icon {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: background 0.14s, color 0.14s;
}

.ai-geo-op-card.is-active .ai-geo-op-card-icon {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
}

.ai-geo-op-card-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.ai-geo-op-card-body strong {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.ai-geo-op-card-body span {
    font-size: 0.67rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.ai-geo-op-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    white-space: nowrap;
}

.ai-geo-op-badge.is-gpu {
    background: rgba(245, 158, 11, 0.14);
    color: #fbbf24;
}

.ai-geo-op-badge.is-sys {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
}

.ai-geo-project-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid var(--border);
    font-size: 0.74rem;
    color: var(--text-secondary);
}

.ai-geo-project-bar strong {
    color: var(--text);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 260px;
}

.ai-geo-project-bar small {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.ai-geo-bar-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
}

/* Upload manager refresh */
.upload-manager-head {
    align-items: center;
}

.upload-project-toolbar,
.attach-action-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.upload-project-toolbar {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-panel);
}

.upload-project-toolbar label,
.attach-action-row span {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 800;
}

.upload-project-toolbar select {
    min-width: 220px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-secondary);
    color: var(--text);
}

.upload-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-secondary);
    color: var(--text);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
}

.upload-toolbar-btn:hover {
    background: var(--bg-elevated);
    border-color: rgba(148, 163, 184, 0.48);
}

.upload-inner-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
}

.upload-inner-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 12px;
    border: 0;
    color: var(--text-secondary);
    background: transparent;
    cursor: pointer;
}

.upload-inner-tab.active {
    color: var(--text);
}

.upload-drop-large {
    min-height: 230px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-style: dashed;
    text-align: center;
}

.upload-drop-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(147, 197, 253, 0.22);
}

.upload-drop-title {
    margin: 0;
    color: var(--text);
    font-weight: 800;
    font-size: 0.98rem;
}

.upload-format-strip {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    max-width: 680px;
}

.upload-format-strip span {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 700;
}

.upload-drop-meta {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.76rem;
}

.upload-drop-meta #attach-current-folder {
    color: var(--accent);
    font-weight: 800;
}

.attach-action-row {
    justify-content: flex-end;
    margin-bottom: 10px;
}

.upload-queue {
    margin-top: 16px;
}

.upload-queue-item {
    min-height: 44px;
    background: var(--bg-panel);
    border-color: rgba(226, 237, 250, 0.14);
    border-radius: 8px;
}

#upload-progress-container {
    border-radius: 8px !important;
}

#efm-root.efm-root {
    min-height: 520px;
    border-radius: 8px !important;
    background: color-mix(in srgb, var(--bg-panel) 92%, #020617) !important;
}

#efm-root .efm-toolbar {
    padding: 9px 10px;
    gap: 7px;
}

#efm-root .efm-breadcrumb {
    min-height: 30px;
}

#efm-root .efm-search {
    width: min(220px, 28vw);
    padding: 7px 10px;
}

#efm-root .efm-tb-btn {
    min-height: 30px;
    padding: 5px 9px;
    gap: 6px;
    border-radius: 7px !important;
    font-weight: 700;
}

#efm-root .efm-files-wrap {
    max-height: 520px;
    min-height: 320px;
    padding: 12px;
}

#efm-root .efm-grid {
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 10px;
}

#efm-root .efm-card {
    min-height: 112px;
    padding: 11px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#efm-root .efm-card:hover,
#efm-root .efm-card.selected {
    background: rgba(59, 130, 246, 0.11);
    border-color: rgba(96, 165, 250, 0.42);
}

#efm-root .efm-card-name {
    max-width: 106px;
    font-size: 0.72rem;
}

#efm-root .efm-list th,
#efm-root .efm-list td {
    padding: 8px 9px;
}

#efm-root .efm-statusbar,
#efm-root .efm-selbar,
#efm-root .efm-upload-panel {
    padding: 8px 10px;
}

/* WebODM-like swipe comparison chrome */
.leaflet-sbs {
    z-index: 999 !important;
}

.leaflet-sbs-divider {
    width: 2px !important;
    margin-left: -1px !important;
    background: #f8fafc !important;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.42), 0 0 18px rgba(15, 23, 42, 0.55) !important;
}

.leaflet-sbs-range {
    top: 50% !important;
    height: 0 !important;
    background: transparent !important;
    z-index: 1002 !important;
}

.leaflet-sbs-range::-webkit-slider-thumb {
    width: 54px !important;
    height: 54px !important;
    border-radius: 50% !important;
    border: 2px solid #f8fafc !important;
    background-color: rgba(15, 23, 42, 0.94) !important;
    background-image:
        linear-gradient(90deg, transparent 16px, #f8fafc 16px, #f8fafc 18px, transparent 18px, transparent 25px, #f8fafc 25px, #f8fafc 27px, transparent 27px) !important;
    background-size: 54px 54px !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(15, 23, 42, 0.42) !important;
}

.leaflet-sbs-range::-moz-range-thumb {
    width: 54px !important;
    height: 54px !important;
    border-radius: 50% !important;
    border: 2px solid #f8fafc !important;
    background-color: rgba(15, 23, 42, 0.94) !important;
    background-image:
        linear-gradient(90deg, transparent 16px, #f8fafc 16px, #f8fafc 18px, transparent 18px, transparent 25px, #f8fafc 25px, #f8fafc 27px, transparent 27px) !important;
    background-size: 54px 54px !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(15, 23, 42, 0.42) !important;
}

.swipe-map-chrome {
    --swipe-x: 50%;
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
}

.swipe-map-label {
    position: absolute;
    top: 14px;
    max-width: min(34vw, 280px);
    padding: 7px 10px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.84);
    color: #f8fafc;
    border: 1px solid rgba(226, 232, 240, 0.18);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    font-size: 0.78rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.swipe-map-label-left {
    left: 14px;
}

.swipe-map-label-right {
    right: 14px;
}

.swipe-map-guide {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--swipe-x);
    transform: translateX(-50%);
    width: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swipe-map-guide span {
    width: 16px;
    height: 100%;
    border-left: 1px solid rgba(248, 250, 252, 0.45);
    border-right: 1px solid rgba(248, 250, 252, 0.45);
    opacity: 0.2;
}

/* Map application surface */
#header,
#sidebar,
.panel,
.glass-panel,
.menu-dropdown {
    border-color: var(--border);
}

#header {
    background: var(--bg-surface);
}

.menu-btn,
.tool-group,
.layer-item,
.panel-section,
.modal-content,
.modal-body {
    border-radius: var(--radius-md);
}

.menu-btn {
    font-weight: 700;
}

.menu-dropdown {
    box-shadow: var(--shadow-lg);
}

/* Responsive */
@media (max-width: 1100px) {
    .dash-service-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .adm-layout {
        grid-template-columns: 190px 1fr;
    }
}

@media (max-width: 820px) {
    .dash-header {
        padding: 0 14px;
    }

    .dash-brand-subtitle,
    .dash-action-btn {
        display: none;
    }

    .dash-main {
        flex-direction: column;
    }

    .dash-sidebar {
        width: 100%;
        max-height: none;
        padding: 10px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    #dash-nav-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #dash-nav-list li.dash-nav-section,
    .dash-sidebar-footer {
        display: none !important;
    }

    .dash-content {
        padding: 16px;
    }

    .dash-page-head {
        flex-direction: column;
        align-items: stretch;
    }

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

    .ai-geo-op-cards {
        grid-template-columns: 1fr 1fr;
    }

    .ai-geo-output-spec-grid {
        grid-template-columns: 1fr 1fr;
    }

    .ai-geo-output-file-row {
        grid-template-columns: 58px minmax(0, 1fr);
    }

    .ai-geo-output-file-size,
    .ai-geo-output-file-row a {
        justify-self: start;
        grid-column: 2;
    }

    .upload-project-toolbar {
        align-items: stretch;
    }

    .upload-project-toolbar select {
        min-width: 0;
        flex: 1 1 100%;
    }

    .dash-service-strip,
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .adm-layout {
        display: block;
        min-height: 0;
    }

    .adm-sidenav {
        flex-direction: row;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .adm-sidenav-group {
        display: none;
    }

    .adm-nav-btn {
        flex: 0 0 auto;
    }
}

#file-browser-table tr:hover {
    background: rgba(255,255,255,0.02);
}

#file-breadcrumb span:hover {
    text-decoration: underline;
}

.upload-panel h3 {
    font-size: 1em;
    color: var(--text-primary);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════
   NEW DESKTOP-LIKE COMPONENTS
   ═══════════════════════════════════════════════ */

/* ─── Advanced Style Editor ──────────────────── */

.style-editor-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
}
.style-editor-tabs button {
    flex: 1;
    padding: 10px 8px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.style-editor-tabs button:hover { color: var(--text-primary); background: var(--bg-hover); }
.style-editor-tabs button.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(77,159,255,0.06);
}

.style-tab-content { display: none; padding: 16px; }
.style-tab-content.active { display: block; }

.style-category-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.2);
    margin-bottom: 4px;
    transition: background var(--transition);
}
.style-category-row:hover { background: rgba(0,0,0,0.35); }

.style-category-row .cat-color {
    width: 28px; height: 28px;
    border-radius: 4px;
    border: 1px solid var(--border);
    cursor: pointer;
    flex-shrink: 0;
}
.style-category-row .cat-label {
    flex: 1; font-size: 0.8rem; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.style-category-row .cat-actions {
    display: flex; gap: 4px; opacity: 0; transition: opacity var(--transition);
}
.style-category-row:hover .cat-actions { opacity: 1; }

.style-form-group {
    margin-bottom: 14px;
}
.style-form-group label {
    display: block; margin-bottom: 5px; font-weight: 600;
    font-size: 0.82rem; color: var(--text-secondary);
}

.new-layer-tab { display: none; }
.new-layer-tab.active { display: block; }
.new-layer-tab.hidden { display: none !important; }

/* Processing Toolbox tabs */
.processing-tab { display: block; }
.processing-tab.hidden { display: none !important; }

.new-layer-style-preview {
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
    margin-bottom: 14px;
}

#new-layer-style-preview-shape {
    display: inline-block;
    transition: all var(--transition);
}

.attribute-attach-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    align-items: center;
}

.attribute-attach-row button,
.attachment-cell-link {
    border: 1px solid var(--border);
    background: var(--bg-hover);
    color: var(--accent);
    border-radius: var(--radius-xs);
    padding: 5px 8px;
    cursor: pointer;
    white-space: nowrap;
}

.attachment-cell-image {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 220px;
}

.attachment-cell-image img {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    flex: 0 0 auto;
}

.attachment-cell-image span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.attribute-attach-row button:hover,
.attachment-cell-link:hover {
    background: var(--bg-active);
}

.attachment-picker-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.attachment-picker-breadcrumb button {
    border: 1px solid var(--border);
    background: var(--bg-hover);
    color: var(--accent);
    border-radius: var(--radius-xs);
    padding: 4px 8px;
    cursor: pointer;
}

.attachment-picker-list {
    max-height: 430px;
    overflow-y: auto;
    display: grid;
    gap: 6px;
}

.attachment-picker-item {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 9px 10px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-align: left;
}

.attachment-picker-item:hover { background: var(--bg-hover); border-color: var(--border-focus); }
.attachment-picker-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-picker-item em { color: var(--text-secondary); font-style: normal; font-size: 0.76rem; }
.attachment-picker-empty { padding: 22px; color: var(--text-secondary); text-align: center; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.attachment-picker-empty.error { color: var(--danger); }

.processing-param-form {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.processing-param-row {
    display: grid;
    grid-template-columns: minmax(170px, 0.9fr) minmax(220px, 1fr);
    gap: 10px;
    align-items: center;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.025);
}

.processing-param-row label {
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
}

.processing-param-row label small {
    display: block;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 3px;
}

.processing-param-row .required { color: var(--warning); }
.processing-param-row input,
.processing-param-row select {
    width: 100%;
}

.processing-check {
    display: flex !important;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary) !important;
}

.processing-json-details {
    margin: 10px 0 12px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.processing-json-details summary {
    cursor: pointer;
    margin-bottom: 8px;
}

/* ─── QGIS Symbol Library ───────────────────── */

.qgis-symbol-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    max-height: 340px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0,0,0,0.15);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.qgis-symbol-item {
    display: grid;
    grid-template-rows: 44px auto;
    gap: 6px;
    align-items: center;
    justify-items: center;
    padding: 10px 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform var(--transition), background var(--transition), border-color var(--transition);
}
.qgis-symbol-item:hover {
    transform: translateY(-2px);
    background: rgba(77,159,255,0.08);
    border-color: rgba(77,159,255,0.25);
}
.qgis-symbol-item img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}
.qgis-symbol-name {
    font-size: 0.74rem;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.15;
    max-height: 2.3em;
    overflow: hidden;
}

/* ─── Expression Builder ────────────────────── */

.expr-layout {
    display: flex;
    gap: 14px;
    padding: 14px;
    max-height: 70vh;
    overflow: hidden;
}

.expr-sidebar {
    width: 300px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    padding-right: 14px;
    overflow-y: auto;
}

.expr-main {
    flex: 1;
    overflow-y: auto;
}

.expr-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    padding: 6px;
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.expr-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    font-size: 0.74rem;
    line-height: 1;
    cursor: pointer;
}
.expr-chip:hover {
    background: rgba(77,159,255,0.10);
    border-color: rgba(77,159,255,0.22);
}
.expr-chip-group {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.expr-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}

.expr-validate-msg {
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.expr-validate-msg.ok { color: var(--success); }
.expr-validate-msg.error { color: var(--danger); }

/* ─── SVG Browser ────────────────────────────── */

.svg-browser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(0,0,0,0.15);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.svg-browser-item {
    width: 64px; height: 64px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    padding: 6px;
    position: relative;
}
.svg-browser-item:hover {
    background: rgba(77,159,255,0.1);
    border-color: rgba(77,159,255,0.3);
    transform: scale(1.08);
}
.svg-browser-item.selected {
    border-color: var(--accent);
    background: rgba(77,159,255,0.15);
    box-shadow: 0 0 12px var(--accent-glow);
}
.svg-browser-item img, .svg-browser-item svg {
    max-width: 44px; max-height: 44px;
    filter: brightness(0.9);
}
.svg-browser-item:hover img, .svg-browser-item:hover svg { filter: brightness(1.2); }
.svg-browser-item.svg-preview-error::after {
    content: "SVG";
    font-size: 0.68rem;
    color: var(--text-muted);
}

.svg-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 10px;
}
.svg-upload-zone:hover {
    border-color: var(--accent);
    background: rgba(77,159,255,0.04);
    color: var(--accent);
}

/* ─── Inline Table Editing ───────────────────── */

td.editing {
    padding: 0 !important;
}
td.editing input {
    width: 100%;
    padding: 6px 10px;
    background: rgba(77,159,255,0.1);
    border: 2px solid var(--accent);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.78rem;
    outline: none;
    border-radius: 0;
}
td.editing input:focus {
    background: rgba(77,159,255,0.15);
}
td.modified {
    position: relative;
}
td.modified::after {
    content: '';
    position: absolute;
    top: 2px; right: 2px;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--warning);
}

.field-toolbar {
    display: flex;
    gap: 6px;
    padding: 6px 16px;
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid var(--border);
    align-items: center;
    flex-wrap: wrap;
}
.field-toolbar button {
    padding: 4px 10px;
    font-size: 0.75rem;
}
.field-toolbar input {
    padding: 4px 10px;
    font-size: 0.75rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 6px;
    outline: none;
}
.field-toolbar input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(77,159,255,0.15);
}
.field-toolbar .separator {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

/* ─── Project Drop Zone ──────────────────────── */

.project-drop-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(12px);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.3s ease;
}
.project-drop-overlay.visible {
    display: flex;
}

.project-drop-overlay .drop-icon {
    width: 100px; height: 100px;
    border: 3px dashed var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s ease infinite;
}
.project-drop-overlay .drop-icon svg {
    width: 48px; height: 48px;
    color: var(--accent);
}
.project-drop-overlay h2 {
    font-size: 1.4rem;
    color: var(--text-primary);
    text-align: center;
}
.project-drop-overlay p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.8; }
}

/* ─── Context Menu ───────────────────────────── */

.context-menu {
    position: fixed;
    z-index: 6000;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 4px 0;
    animation: scaleIn 0.15s ease;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 0.82rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
}
.context-menu-item:hover {
    background: rgba(77,159,255,0.12);
    color: var(--accent);
}
.context-menu-item.danger:hover {
    background: rgba(248,113,113,0.12);
    color: var(--danger);
}
.context-menu-separator {
    height: 1px;
    background: var(--border);
    margin: 4px 8px;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ─── Import Progress ────────────────────────── */

.import-progress {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    max-width: 420px;
    width: 100%;
}

.import-progress h4 {
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.import-progress .progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.import-progress .progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.import-progress .status-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.missing-files-list {
    max-height: 150px;
    overflow-y: auto;
    margin-top: 10px;
    padding: 8px;
    background: rgba(248,113,113,0.05);
    border: 1px solid rgba(248,113,113,0.2);
    border-radius: var(--radius-sm);
}

.missing-files-list li {
    font-size: 0.78rem;
    color: var(--danger);
    padding: 2px 0;
    list-style: none;
}
.missing-files-list li::before { content: '⚠ '; }

/* ─── Responsive table panel with sidebar collapsed ── */
#sidebar.collapsed ~ #map-container #table-panel,
#sidebar.collapsed + main #table-panel {
    left: 16px;
}

/* ─── Dark Leaflet popup (GeoFusion style) ── */
.geofusion-popup .leaflet-popup-content-wrapper {
    background: rgba(20, 20, 30, 0.95);
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    border: 1px solid rgba(77,159,255,0.3);
}
.geofusion-popup .leaflet-popup-tip {
    background: rgba(20, 20, 30, 0.95);
}
.geofusion-popup .leaflet-popup-close-button {
    color: rgba(255,255,255,0.6);
}
.geofusion-popup .leaflet-popup-close-button:hover { color: #fff; }

/* ─── Digitizer cursor hint ── */
#map.digitizing { cursor: crosshair !important; }

/* ─── Feature Console buttons ── */
.fc-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid rgba(77,159,255,0.35);
    background: rgba(77,159,255,0.1);
    color: #c9d8ee;
    font-size: 0.82em;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.fc-btn:hover {
    background: rgba(77,159,255,0.25);
    border-color: #4d9fff;
    color: #fff;
}
.fc-btn-danger {
    border-color: rgba(239,68,68,0.45);
    background: rgba(239,68,68,0.1);
    color: #fca5a5;
}
.fc-btn-danger:hover {
    background: rgba(239,68,68,0.28);
    border-color: #ef4444;
    color: #fff;
}

/* Geoprocessing panel buttons */
.gp-btn {
    display: block;
    width: 100%;
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid rgba(168,85,247,0.35);
    background: rgba(168,85,247,0.08);
    color: #d8b4fe;
    font-size: 0.79em;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gp-btn:hover {
    background: rgba(168,85,247,0.25);
    border-color: #a855f7;
    color: #fff;
}
.gp-btn-overlay {
    border-color: rgba(245,158,11,0.35);
    background: rgba(245,158,11,0.08);
    color: #fcd34d;
}
.gp-btn-overlay:hover {
    background: rgba(245,158,11,0.25);
    border-color: #f59e0b;
    color: #fff;
}
.gp-btn-layer {
    border-color: rgba(52,211,153,0.35);
    background: rgba(52,211,153,0.08);
    color: #6ee7b7;
}
.gp-btn-layer:hover {
    background: rgba(52,211,153,0.25);
    border-color: #34d399;
    color: #fff;
}

/* Geoprocessing panel scrollbar */
#geoprocessing-panel::-webkit-scrollbar { width: 5px; }
#geoprocessing-panel::-webkit-scrollbar-track { background: transparent; }
#geoprocessing-panel::-webkit-scrollbar-thumb { background: rgba(168,85,247,0.3); border-radius: 3px; }

/* ── Telegram widget (Assistenza tab) ─────────────────────────────── */
.gf-tg-btn {
    position: fixed; bottom: 28px; right: 28px; z-index: 9990;
    width: 62px; height: 62px; border-radius: 50%; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0088cc 0%, #00b4d8 60%, #29d9f5 100%);
    box-shadow: 0 4px 20px rgba(0,136,204,.55), 0 1px 4px rgba(0,0,0,.2);
    color: #fff; font-size: 26px;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s ease;
}
.gf-tg-btn::before {
    content: ''; position: absolute; inset: -3px; border-radius: 50%;
    border: 2px solid rgba(0,180,216,.35);
    animation: gf-tg-ring 2.4s ease-in-out infinite; pointer-events: none;
}
.gf-tg-btn:hover { transform: scale(1.12) translateY(-2px); box-shadow: 0 8px 32px rgba(0,136,204,.7); }
.gf-tg-btn:active { transform: scale(.95); }
@keyframes gf-tg-ring {
    0%,100% { transform: scale(1); opacity: .5; }
    50%      { transform: scale(1.25); opacity: 0; }
}
.gf-tg-overlay {
    display: none; position: fixed; inset: 0; z-index: 9995;
}
.gf-tg-overlay.active { display: block; animation: gf-tg-bg-in .25s ease; }
@keyframes gf-tg-bg-in { from { opacity: 0; } to { opacity: 1; } }
.gf-tg-overlay::before {
    content: ''; position: absolute; inset: 0;
    background: rgba(0,0,0,.45); backdrop-filter: blur(4px);
}
.gf-tg-modal {
    position: absolute; bottom: 24px; right: 24px;
    width: min(420px, calc(100vw - 48px));
    height: min(560px, calc(100svh - 48px));
    border-radius: 22px; display: flex; flex-direction: column; overflow: hidden;
    background: #0e1929;
    box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(0,180,216,.18);
    animation: gf-tg-panel-in .4s cubic-bezier(.34,1.42,.64,1);
}
@keyframes gf-tg-panel-in {
    from { transform: translateY(40px) scale(.93); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}
.gf-tg-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, #0b1422 0%, #0f2035 100%);
    border-bottom: 1px solid rgba(0,180,216,.15); flex-shrink: 0;
}
.gf-tg-header-title {
    font-size: 14px; font-weight: 700; color: #e8f4ff;
    display: flex; align-items: center; gap: 8px;
}
.gf-tg-header-title::before {
    content: ''; display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; background: #29f5a0; box-shadow: 0 0 6px #29f5a0;
    animation: gf-tg-green-pulse 1.6s ease-in-out infinite;
}
@keyframes gf-tg-green-pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.gf-tg-close {
    background: rgba(255,255,255,.08); border: none; color: #aac; cursor: pointer;
    border-radius: 8px; font-size: 16px; width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
}
.gf-tg-close:hover { background: rgba(255,255,255,.15); color: #fff; }
.gf-tg-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.gf-tg-body label { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.55); display: block; margin-bottom: 4px; }
.gf-tg-body input, .gf-tg-body textarea {
    width: 100%; box-sizing: border-box; border-radius: 10px;
    border: 1px solid rgba(0,180,216,.2); background: rgba(255,255,255,.05);
    color: #e8f4ff; padding: 8px 11px; font-size: 13px; outline: none;
    transition: border-color .2s;
}
.gf-tg-body input:focus, .gf-tg-body textarea:focus { border-color: rgba(0,180,216,.5); }
.gf-tg-body textarea { min-height: 90px; resize: vertical; }
.gf-tg-footer { padding: 12px 18px; flex-shrink: 0; border-top: 1px solid rgba(0,180,216,.1); }
.gf-tg-send {
    width: 100%; padding: 11px; border-radius: 12px; border: none; cursor: pointer;
    background: linear-gradient(135deg, #0088cc, #29d9f5);
    color: #fff; font-size: 14px; font-weight: 700; letter-spacing: .3px;
    transition: opacity .2s;
}
.gf-tg-send:hover { opacity: .88; }
.gf-tg-send:active { transform: scale(.98); }

/* Measure tool tooltip */
.measure-tooltip {
    background: rgba(245,158,11,0.92) !important;
    border: none !important;
    color: #fff !important;
    font-weight: 600;
    font-size: 12px;
    padding: 2px 8px !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.4) !important;
    white-space: nowrap;
}
.measure-tooltip::before { border-right-color: rgba(245,158,11,0.92) !important; }

/* Final visual normalization for the 2026 restyle */
*, *::before, *::after {
    letter-spacing: 0 !important;
}

.dash-content [style*="border-radius:14px"],
.dash-content [style*="border-radius:12px"],
.dash-content [style*="border-radius:10px"],
.dash-content [style*="border-radius:8px"] {
    border-radius: var(--radius-lg) !important;
}

/* ── Full tool names mode — map tools sidebar ──────────────────────────── */
body.gf-full-toolnames #map-tools-toolbar {
    min-width: 130px !important;
}
body.gf-full-toolnames #map-tools-toolbar .icon-btn {
    width: 100%;
    justify-content: flex-start !important;
    gap: 8px;
    padding: 5px 8px !important;
    font-size: 0.72em;
}
body.gf-full-toolnames #map-tools-toolbar .icon-btn::after {
    content: attr(title);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
    font-size: 0.9em;
}

/* ── Compact toolbar (icon-only top bar) ───────────────────────────────── */
body.gf-compact-toolbar .menu-btn > span:not(:has(svg)),
body.gf-compact-toolbar .menu-btn > span:last-child:not(:first-child) {
    display: none;
}


/* ════════════════════════════════════════════════════════════════════════════
   MODERN LAYOUT  [data-layout="modern"]
   Layout alternativo — più pulito, glass morphism, controlli ridisegnati.
   Attivato aggiungendo data-layout="modern" su <html>.
   ════════════════════════════════════════════════════════════════════════════ */

[data-layout="modern"] {
    --header-h: 50px;
    --radius-sm: 9px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition: 0.17s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Header ─────────────────────────────────────────────────────────────── */
[data-layout="modern"] #header {
    height: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;
    background: rgba(9,11,20,0.97) !important;
    backdrop-filter: blur(24px) saturate(1.8) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.8) !important;
    border-bottom: 1px solid rgba(255,255,255,0.07) !important;
    box-shadow: 0 1px 0 rgba(255,255,255,0.04), 0 6px 40px rgba(0,0,0,0.5) !important;
}
[data-layout="modern"] .header-brand-row { display: none !important; }
[data-layout="modern"] .header-toolbar-row {
    height: 50px !important;
    max-height: 50px !important;
    min-height: 50px !important;
    padding: 0 10px !important;
    gap: 3px !important;
    overflow: visible !important;
}

/* ── Toolbar buttons ─────────────────────────────────────────────────────── */
[data-layout="modern"] .menu-btn {
    border-radius: 22px !important;
    padding: 4px 11px !important;
    font-size: 0.78em !important;
    height: 30px !important;
    letter-spacing: 0.15px !important;
    gap: 5px !important;
    transition: background 0.15s, transform 0.12s, box-shadow 0.15s !important;
}
[data-layout="modern"] .menu-btn:hover {
    background: rgba(255,255,255,0.1) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3) !important;
}
[data-layout="modern"] .menu-btn.open {
    background: rgba(var(--accent-rgb, 77,159,255), 0.18) !important;
    box-shadow: 0 0 0 1px rgba(77,159,255,0.3) inset !important;
}
[data-layout="modern"] .icon-btn {
    border-radius: 10px !important;
    transition: background 0.15s, transform 0.12s !important;
}
[data-layout="modern"] .icon-btn:hover { transform: scale(1.08) !important; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
[data-layout="modern"] #sidebar {
    background: rgba(8,10,20,0.96) !important;
    backdrop-filter: blur(24px) saturate(1.5) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.5) !important;
    border-right: 1px solid rgba(255,255,255,0.06) !important;
    box-shadow: 3px 0 40px rgba(0,0,0,0.5) !important;
}
[data-layout="modern"] .sidebar-header {
    background: linear-gradient(135deg, rgba(77,159,255,0.07) 0%, transparent 100%) !important;
    border-bottom: 1px solid rgba(255,255,255,0.06) !important;
}
[data-layout="modern"] .sidebar-tab { border-radius: 8px !important; }
[data-layout="modern"] .sidebar-tab.active {
    border-bottom: 2px solid var(--accent) !important;
    background: rgba(77,159,255,0.1) !important;
    border-radius: 8px 8px 0 0 !important;
}
[data-layout="modern"] .layer-item {
    border-radius: 8px !important;
    margin: 1px 4px !important;
}
[data-layout="modern"] .layer-item:hover { background: rgba(255,255,255,0.06) !important; }
[data-layout="modern"] .layer-item.selected { border-radius: 8px !important; }

/* ── Canvas bottom bar ───────────────────────────────────────────────────── */
[data-layout="modern"] #canvas-bottom-bar {
    border-radius: 50px !important;
    padding: 6px 14px !important;
    background: rgba(8,10,18,0.96) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04) inset !important;
    gap: 6px !important;
}

/* ── Canvas right toolbar ────────────────────────────────────────────────── */
[data-layout="modern"] #canvas-right-toolbar {
    border-radius: 50px !important;
    padding: 10px 5px !important;
    background: rgba(8,10,18,0.96) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04) inset !important;
    gap: 4px !important;
}

/* ── Canvas control buttons ──────────────────────────────────────────────── */
[data-layout="modern"] .canvas-map-btn {
    border-radius: 50% !important;
    transition: background 0.14s, color 0.14s, transform 0.14s, box-shadow 0.14s !important;
    width: 30px !important;
    height: 30px !important;
}
[data-layout="modern"] .canvas-map-btn:hover {
    background: rgba(77,159,255,0.2) !important;
    color: var(--accent) !important;
    transform: scale(1.12) !important;
}
[data-layout="modern"] .canvas-map-btn.active {
    background: rgba(77,159,255,0.28) !important;
    color: var(--accent) !important;
    box-shadow: 0 0 0 2px rgba(77,159,255,0.35) !important;
}

/* ── Menu dropdowns ──────────────────────────────────────────────────────── */
[data-layout="modern"] .menu-dropdown {
    border-radius: 18px !important;
    backdrop-filter: blur(24px) saturate(1.6) !important;
    background: rgba(10,12,22,0.97) !important;
    border: 1px solid rgba(255,255,255,0.09) !important;
    box-shadow: 0 24px 64px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.03) !important;
    padding: 6px !important;
}
[data-layout="modern"] .menu-dropdown button {
    border-radius: 11px !important;
    margin: 1px 2px !important;
    transition: background 0.12s, transform 0.1s !important;
}
[data-layout="modern"] .menu-dropdown button:hover {
    background: rgba(255,255,255,0.08) !important;
    transform: translateX(2px) !important;
}

/* ── Toast in Modern ─────────────────────────────────────────────────────── */
[data-layout="modern"] .toast {
    border-radius: 14px !important;
    background: rgba(10,12,22,0.97) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    box-shadow: 0 10px 36px rgba(0,0,0,0.7) !important;
    font-size: 0.82rem !important;
    padding: 10px 16px !important;
}

/* ── Floating context buttons ────────────────────────────────────────────── */
[data-layout="modern"] #map-refresh-btn,
[data-layout="modern"] #map-screenshot-btn {
    border-radius: 50% !important;
    background: rgba(8,10,18,0.96) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6) !important;
    transition: background 0.15s, transform 0.15s !important;
}
[data-layout="modern"] #map-refresh-btn:hover,
[data-layout="modern"] #map-screenshot-btn:hover {
    background: rgba(77,159,255,0.18) !important;
    color: var(--accent) !important;
    transform: scale(1.08) !important;
}

/* ── Status bar ──────────────────────────────────────────────────────────── */
[data-layout="modern"] #status-bar {
    background: rgba(8,10,18,0.95) !important;
    backdrop-filter: blur(16px) !important;
    border-top: 1px solid rgba(255,255,255,0.05) !important;
    font-size: 0.73em !important;
}

/* ── Modals & panels ─────────────────────────────────────────────────────── */
[data-layout="modern"] .modal-overlay { backdrop-filter: blur(6px) !important; }
[data-layout="modern"] [class*="modal-content"],
[data-layout="modern"] [class*="-panel"]:not(#sidebar):not(#status-bar) {
    border-radius: 18px !important;
}

/* ── Basemap panel ───────────────────────────────────────────────────────── */
[data-layout="modern"] #basemap-panel {
    border-radius: 18px !important;
    backdrop-filter: blur(24px) !important;
    background: rgba(10,12,22,0.97) !important;
    border: 1px solid rgba(255,255,255,0.09) !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.75) !important;
}
[data-layout="modern"] .basemap-option {
    border-radius: 10px !important;
    transition: background 0.12s, transform 0.12s, border-color 0.12s !important;
}
[data-layout="modern"] .basemap-option:hover { transform: translateY(-2px) !important; }
[data-layout="modern"] .basemap-option.active {
    box-shadow: 0 0 0 2px var(--accent) !important;
}

/* ── Settings cards in modern ────────────────────────────────────────────── */
[data-layout="modern"] .settings-card { border-radius: 18px !important; }
[data-layout="modern"] .settings-card-header { border-radius: 18px 18px 0 0 !important; }

/* ── Layout selector cards ───────────────────────────────────────────────── */
.layout-card {
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 14px 12px 12px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    text-align: center;
    background: var(--bg-secondary);
    user-select: none;
}
.layout-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.layout-card.selected {
    border-color: var(--accent);
    background: rgba(77,159,255,0.07);
    box-shadow: 0 0 0 3px rgba(77,159,255,0.18);
}
.layout-preview {
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255,255,255,0.08);
    background: #0a0c10;
}
.layout-preview-header {
    height: 14px;
    background: #111318;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.layout-preview-header.slim { height: 9px; background: rgba(9,11,20,0.97); }
.layout-preview-body {
    flex: 1;
    display: flex;
}
.layout-preview-sidebar {
    width: 38px;
    background: #0e1117;
    border-right: 1px solid rgba(255,255,255,0.05);
}
.layout-preview-sidebar.glass { background: rgba(8,10,20,0.9); }
.layout-preview-canvas {
    flex: 1;
    background: #0d1520;
    position: relative;
}
.layout-preview-pill {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    height: 5px;
    width: 34px;
    border-radius: 10px;
    background: rgba(77,159,255,0.5);
}

/* ══════════════════════════════════════════════════════════════════
   POPUP CONFIG DIALOG  — restyling completo
   ══════════════════════════════════════════════════════════════════ */
.popup-cfg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100002;
    backdrop-filter: blur(3px);
}
.popup-cfg-dialog {
    background: linear-gradient(160deg, #1a1f2e 0%, #141824 100%);
    border-radius: 14px;
    border: 1px solid rgba(77,159,255,0.28);
    width: min(700px, 96vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    color: #e2e8f0;
    box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04);
    overflow: hidden;
}
.popup-cfg-header {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(77,159,255,0.05);
    flex-shrink: 0;
}
.popup-cfg-close {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #94a3b8;
    border-radius: 6px;
    width: 28px; height: 28px;
    font-size: 1em;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .12s, color .12s;
}
.popup-cfg-close:hover { background: rgba(239,68,68,0.18); color: #f87171; border-color: rgba(239,68,68,0.4); }
.popup-cfg-subtitle {
    padding: 10px 18px 0;
    font-size: 0.82em;
    color: #94a3b8;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    flex-shrink: 0;
}
.popup-cfg-hint {
    padding: 6px 18px 8px;
    font-size: 0.74em;
    color: rgba(148,163,184,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.popup-cfg-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 6px 14px 10px;
}
.popup-cfg-scroll::-webkit-scrollbar { width: 6px; }
.popup-cfg-scroll::-webkit-scrollbar-track { background: transparent; }
.popup-cfg-scroll::-webkit-scrollbar-thumb { background: rgba(77,159,255,0.25); border-radius: 3px; }
.popup-cfg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82em;
}
.popup-cfg-table thead tr {
    border-bottom: 2px solid rgba(77,159,255,0.18);
}
.popup-cfg-table th {
    position: sticky; top: 0;
    background: #141824;
    padding: 8px 8px;
    text-align: left;
    font-size: 0.72em;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    z-index: 1;
    box-shadow: none;
    border: none;
    cursor: default;
    user-select: none;
    min-width: unset;
    white-space: nowrap;
    transition: none;
}
.popup-cfg-table th:hover { color: #64748b; background: #141824; }
.pcfg-row {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background .1s;
}
.pcfg-row:hover { background: rgba(77,159,255,0.06); }
.pcfg-row td { padding: 7px 8px; vertical-align: middle; }
.pcfg-drag {
    color: rgba(148,163,184,0.3);
    cursor: grab;
    font-size: 1.1em;
    text-align: center;
    user-select: none;
    transition: color .12s;
    width: 20px;
}
.pcfg-row:hover .pcfg-drag { color: rgba(148,163,184,0.7); }
.pcfg-fname {
    font-family: ui-monospace, 'Cascadia Code', monospace;
    font-size: 0.88em;
    color: #a5b4fc;
    white-space: nowrap;
}
.pcfg-alias-input {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    color: #e2e8f0;
    padding: 4px 8px;
    font-size: 0.82em;
    width: 100%;
    max-width: 160px;
    transition: border-color .12s;
}
.pcfg-alias-input:focus { outline: none; border-color: rgba(77,159,255,0.5); background: rgba(77,159,255,0.06); }
.pcfg-alias-input::placeholder { color: rgba(148,163,184,0.3); font-style: italic; }
.pcfg-type-sel {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    color: #e2e8f0;
    padding: 4px 8px;
    font-size: 0.78em;
    width: 100%;
    cursor: pointer;
}
.pcfg-type-sel:focus { outline: none; border-color: rgba(77,159,255,0.5); }
.pcfg-row.pcfg-dragging { opacity: 0.45; background: rgba(77,159,255,0.12); }
.pcfg-row.pcfg-dragover td { border-top: 2px solid #4d9fff !important; }
.popup-cfg-footer {
    padding: 12px 18px;
    border-top: 1px solid rgba(255,255,255,0.07);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    background: rgba(0,0,0,0.15);
}
.pcfg-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 0.84em;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
.pcfg-btn-secondary {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.14);
    color: #cbd5e1;
}
.pcfg-btn-secondary:hover { background: rgba(255,255,255,0.11); border-color: rgba(255,255,255,0.25); }
.pcfg-btn-primary {
    background: linear-gradient(135deg,#4d9fff,#3b82f6);
    border: 1px solid rgba(77,159,255,0.5);
    color: #fff;
    box-shadow: 0 2px 8px rgba(77,159,255,0.25);
}
.pcfg-btn-primary:hover { background: linear-gradient(135deg,#60abff,#4d9fff); }

/* ══════════════════════════════════════════════════════════════════
   ATTRIBUTE TABLE — restyling completo
   ══════════════════════════════════════════════════════════════════ */

/* Panel */
#table-panel {
    background: linear-gradient(180deg, rgba(20,24,38,0.98) 0%, rgba(16,20,32,0.99) 100%) !important;
    border: 1px solid rgba(77,159,255,0.18) !important;
    box-shadow: 0 -4px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.03) !important;
}

/* Header */
.table-header {
    background: linear-gradient(90deg, rgba(77,159,255,0.08) 0%, rgba(0,0,0,0) 60%) !important;
    border-bottom: 1px solid rgba(77,159,255,0.15) !important;
    padding: 7px 14px 7px 16px !important;
}
.table-header h3 { color: #f1f5f9 !important; font-size: 0.85rem !important; }

/* Toolbar — compact redesign */
.at-toolbar {
    gap: 2px !important;
    padding: 4px 10px !important;
    background: rgba(0,0,0,0.18) !important;
    border-bottom: 1px solid rgba(255,255,255,0.05) !important;
}
.at-group {
    gap: 1px !important;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    padding: 1px;
    border: 1px solid rgba(255,255,255,0.06);
}
.at-sep { margin: 0 3px !important; height: 22px !important; }
.at-btn {
    border-radius: 5px !important;
    padding: 4px 9px !important;
    font-size: 0.73rem !important;
    gap: 3px !important;
    letter-spacing: 0 !important;
    border-color: transparent !important;
}
.at-btn:hover { border-color: rgba(255,255,255,0.08) !important; }
.at-btn-edit.active {
    background: rgba(52,211,153,0.18) !important;
    border-color: rgba(52,211,153,0.4) !important;
    box-shadow: 0 0 8px rgba(52,211,153,0.15);
}
.at-filter-input {
    border-radius: 6px !important;
    font-size: 0.78em !important;
    background: rgba(255,255,255,0.06) !important;
    border-color: rgba(255,255,255,0.1) !important;
    padding: 4px 10px !important;
}
.at-filter-input:focus { background: rgba(77,159,255,0.08) !important; }

/* Table header — accent gradient line */
#attribute-table thead th {
    background: linear-gradient(180deg, rgba(20,25,40,0.98) 0%, rgba(16,20,32,0.99) 100%) !important;
    border-bottom: 2px solid rgba(77,159,255,0.3) !important;
    padding: 8px 12px !important;
    font-size: 0.68rem !important;
    letter-spacing: 0.06em !important;
    color: #64748b !important;
}
#attribute-table thead th:hover { color: #a5b4fc !important; background: rgba(77,159,255,0.08) !important; }
#attribute-table thead th.sorted { color: #4d9fff !important; }

/* Rows */
#attribute-table tr { height: 29px !important; transition: background 0.06s !important; }
#attribute-table tr:nth-child(odd) { background: rgba(255,255,255,0.012); }
#attribute-table tr:nth-child(even) { background: rgba(0,0,0,0.08); }
#attribute-table tr:hover { background: rgba(77,159,255,0.09) !important; }
#attribute-table tr.selected {
    background: rgba(77,159,255,0.17) !important;
    box-shadow: inset 3px 0 0 #4d9fff, inset 0 0 0 1px rgba(77,159,255,0.12) !important;
}
#attribute-table tr.selected td { color: #e2e8f0 !important; }

/* Modified cell indicator */
td.modified {
    position: relative;
}
td.modified::after {
    content: '';
    position: absolute;
    top: 3px; right: 3px;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #fbbf24;
}

/* Cells */
#attribute-table td {
    padding: 5px 12px !important;
    font-size: 0.77rem !important;
    border-bottom: 1px solid rgba(255,255,255,0.025) !important;
}

/* Geometry bar */
.at-geombar {
    border-bottom: 1px solid rgba(245,158,11,0.15) !important;
    background: rgba(245,158,11,0.04) !important;
    padding: 4px 10px !important;
}

/* ══════════════════════════════════════════════════════════════════
   ATTRIBUTE TABLE — practical operator redesign
   ══════════════════════════════════════════════════════════════════ */

#table-panel {
    bottom: 14px !important;
    height: 42% !important;
    min-height: 300px !important;
    max-height: 82vh !important;
    border-radius: 8px !important;
    background: #111827 !important;
    border-color: rgba(148,163,184,0.24) !important;
    box-shadow: 0 -12px 34px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.04) !important;
}

#table-panel.at-maximized {
    top: 62px !important;
    bottom: 12px !important;
    height: auto !important;
    max-height: none !important;
}

#table-panel-resize-handle {
    height: 8px !important;
}

#table-panel-resize-handle::after {
    width: 56px !important;
    height: 3px !important;
    margin-top: 2px !important;
}

.table-header {
    min-height: 48px;
    padding: 8px 12px 8px 14px !important;
    background: #0f172a !important;
    border-bottom: 1px solid rgba(148,163,184,0.16) !important;
}

.at-title-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    flex: 1;
}

.at-title-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.table-header h3 {
    max-width: min(460px, 44vw) !important;
    font-size: 0.9rem !important;
    line-height: 1.15;
    color: #f8fafc !important;
    letter-spacing: 0 !important;
}

.at-layer-meta {
    font-size: 0.69rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-actions {
    gap: 7px !important;
    min-width: 0;
}

.at-info-chip,
.badge,
.at-sel-badge,
.at-edit-badge {
    min-height: 22px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px !important;
    font-size: 0.68rem !important;
    line-height: 1;
}

.at-sel-badge:not(.visible),
.at-edit-badge:not(.visible) {
    display: none;
}

.at-sel-badge.visible,
.at-edit-badge.visible {
    display: inline-flex;
}

.at-info-chip {
    padding: 2px 8px;
    background: rgba(148,163,184,0.09);
    border: 1px solid rgba(148,163,184,0.18);
    color: #cbd5e1;
    font-weight: 650;
    white-space: nowrap;
}

.at-info-chip.editable {
    background: rgba(20,184,166,0.11);
    border-color: rgba(20,184,166,0.30);
    color: #5eead4;
}

.badge {
    background: rgba(59,130,246,0.12) !important;
    border: 1px solid rgba(59,130,246,0.24);
    color: #93c5fd !important;
    white-space: nowrap;
}

.at-header-btn {
    width: 28px !important;
    height: 28px !important;
    border-radius: 6px !important;
    border: 1px solid rgba(148,163,184,0.16) !important;
    background: rgba(255,255,255,0.04) !important;
}

.at-header-btn.active {
    color: #facc15 !important;
    border-color: rgba(250,204,21,0.34) !important;
    background: rgba(250,204,21,0.10) !important;
}

.at-toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    align-items: stretch !important;
    align-content: flex-start !important;
    padding: 8px 10px !important;
    background: #111827 !important;
    border-bottom: 1px solid rgba(148,163,184,0.13) !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
}

.at-sep {
    display: none !important;
}

.at-group {
    position: relative;
    gap: 4px !important;
    padding: 18px 5px 5px !important;
    border-radius: 7px !important;
    border: 1px solid rgba(148,163,184,0.13) !important;
    background: rgba(15,23,42,0.74) !important;
    min-height: 38px;
    flex: 0 1 auto;
    max-width: 100%;
    flex-wrap: wrap;
}

.at-group-label {
    position: absolute;
    top: 4px;
    left: 7px;
    right: 7px;
    color: #64748b;
    font-size: 0.55rem;
    line-height: 1;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    pointer-events: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.at-btn,
.at-geombar-btn {
    min-height: 28px !important;
    border-radius: 6px !important;
    padding: 5px 7px !important;
    font-size: 0.72rem !important;
    font-weight: 650 !important;
    letter-spacing: 0 !important;
    flex-shrink: 1;
}

.at-btn svg,
.at-geombar-btn svg {
    width: 13px;
    height: 13px;
}

.at-btn:focus-visible,
.at-geombar-btn:focus-visible,
.at-filter-input:focus-visible {
    outline: 2px solid rgba(96,165,250,0.78);
    outline-offset: 1px;
}

.at-group-edit { border-color: rgba(20,184,166,0.18) !important; }
.at-group-feature { border-color: rgba(96,165,250,0.18) !important; }
.at-group-selection { border-color: rgba(250,204,21,0.18) !important; }
.at-group-data { border-color: rgba(168,85,247,0.18) !important; }
.at-group-fields { border-color: rgba(244,114,182,0.18) !important; }
.at-group-relations { border-color: rgba(34,197,94,0.18) !important; }

.at-filter-group {
    min-width: 260px;
    flex: 1 1 320px;
    display: grid !important;
    grid-template-columns: auto auto minmax(160px, 1fr) auto auto auto;
    align-items: end;
}

.at-btn-view.active {
    background: rgba(250,204,21,0.13) !important;
    border-color: rgba(250,204,21,0.38) !important;
    color: #fde68a !important;
}

.at-filter-input {
    width: 100%;
    min-width: 0 !important;
    max-width: none !important;
    height: 28px;
    border-radius: 6px !important;
    background: rgba(2,6,23,0.55) !important;
    border-color: rgba(148,163,184,0.22) !important;
    font-size: 0.76rem !important;
}

.at-filter-input:focus {
    border-color: rgba(96,165,250,0.65) !important;
    background: rgba(15,23,42,0.96) !important;
}

.at-filter-count {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(250,204,21,0.11);
    border: 1px solid rgba(250,204,21,0.24);
    color: #fde68a !important;
}

.at-status-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 6px 12px;
    border-bottom: 1px solid rgba(148,163,184,0.10);
    background: #0b1220;
    color: #94a3b8;
    font-size: 0.73rem;
    flex-shrink: 0;
}

#table-status-text {
    color: #cbd5e1;
    font-weight: 650;
    white-space: nowrap;
}

.at-filter-chip {
    max-width: 38vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-radius: 999px;
    padding: 3px 9px;
    background: rgba(250,204,21,0.10);
    border: 1px solid rgba(250,204,21,0.22);
    color: #fde68a;
    font-weight: 650;
}

.at-filter-chip.hidden { display: none; }

.at-status-hint {
    margin-left: auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #64748b;
}

.at-geombar {
    gap: 5px !important;
    padding: 7px 10px !important;
    background: #1f1a0b !important;
    border-bottom-color: rgba(250,204,21,0.22) !important;
}

.at-geombar-label {
    padding: 0 4px;
    color: #facc15 !important;
}

.at-geombar-btn {
    background: rgba(250,204,21,0.08) !important;
    border-color: rgba(250,204,21,0.22) !important;
    color: #fde68a !important;
}

.at-geombar-btn:hover {
    background: rgba(250,204,21,0.16) !important;
    border-color: rgba(250,204,21,0.42) !important;
}

.table-content {
    background: #0f172a;
    scrollbar-color: rgba(148,163,184,0.42) rgba(15,23,42,0.7);
}

#attribute-table {
    font-size: 0.78rem !important;
}

#attribute-table thead th {
    height: 36px;
    background: #182235 !important;
    color: #cbd5e1 !important;
    border-bottom: 1px solid rgba(96,165,250,0.32) !important;
    box-shadow: 0 2px 0 rgba(0,0,0,0.22) !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: 0.75rem !important;
}

#attribute-table thead th:not(.at-th-num) {
    min-width: 130px;
}

#attribute-table thead th:hover {
    color: #f8fafc !important;
    background: #1e293b !important;
}

#attribute-table thead th.sorted {
    color: #93c5fd !important;
    background: #1e2f4a !important;
}

.table-col-label {
    max-width: 190px !important;
    font-weight: 750;
}

.at-col-type {
    margin-right: 6px !important;
    opacity: 1 !important;
}

#attribute-table td {
    height: 32px;
    padding: 6px 12px !important;
    border-bottom: 1px solid rgba(148,163,184,0.08) !important;
    color: #dbeafe;
}

#table-panel.at-density-comfortable #attribute-table td {
    height: 40px;
    padding-top: 9px !important;
    padding-bottom: 9px !important;
    font-size: 0.82rem !important;
}

#table-panel.at-density-comfortable #attribute-table tr {
    height: 40px !important;
}

#attribute-table tr:nth-child(odd) { background: #0f172a !important; }
#attribute-table tr:nth-child(even) { background: #111c2e !important; }
#attribute-table tr:hover { background: #1d2d45 !important; }

#attribute-table tr.selected {
    background: #17365b !important;
    box-shadow: inset 4px 0 0 #60a5fa, inset 0 0 0 1px rgba(96,165,250,0.30) !important;
}

th.at-th-num,
td.at-td-num {
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    background: #0b1220 !important;
    color: #94a3b8 !important;
    border-right: 1px solid rgba(148,163,184,0.14) !important;
}

th.at-th-num {
    background: #182235 !important;
}

.at-null-token {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    border: 1px dashed rgba(148,163,184,0.22);
    color: #64748b;
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 650;
}

td.at-cell-num { color: #67e8f9 !important; }
td.at-cell-bool-true { color: #86efac !important; }
td.at-cell-bool-false { color: #fca5a5 !important; }
td.at-cell-url { color: #93c5fd !important; }

td.at-cell-editing {
    background: #1e3a5f !important;
    outline-color: rgba(96,165,250,0.88) !important;
}

.at-empty-state {
    padding: 42px 18px !important;
    color: #94a3b8 !important;
}

@media (max-width: 1280px) {
    .at-toolbar {
        gap: 5px !important;
    }
    .at-group {
        padding: 16px 4px 4px !important;
        gap: 3px !important;
    }
    .at-btn,
    .at-geombar-btn {
        padding: 5px 6px !important;
        font-size: 0.69rem !important;
    }
    .at-group-label {
        font-size: 0.50rem;
    }
    .at-status-hint { display: none; }
}

@media (max-width: 760px) {
    #table-panel {
        left: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
        height: 58% !important;
        min-height: 320px !important;
    }
    .table-header {
        align-items: flex-start;
        gap: 8px;
    }
    .table-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .at-info-chip,
    #table-field-count {
        display: none;
    }
    .at-toolbar {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
    }
    .at-group {
        overflow-x: hidden;
        width: 100%;
    }
    .at-filter-group {
        grid-template-columns: auto auto minmax(120px, 1fr) auto auto !important;
    }
    .at-filter-count {
        display: none !important;
    }
    .at-status-strip {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
    .at-filter-chip {
        max-width: 100%;
    }
}

/* ── Municipal Services — settings card badges ── */
.sc-badge {
    font-size: 0.65em;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 2px 9px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}
.sc-badge-active {
    background: rgba(52,211,153,0.14);
    color: #34d399;
    border: 1px solid rgba(52,211,153,0.35);
}
.sc-badge-warning {
    background: rgba(251,191,36,0.14);
    color: #fbbf24;
    border: 1px solid rgba(251,191,36,0.35);
}

/* ── Dossier CF card ── */
.mun-dossier-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    transition: border-color .15s;
}
.mun-dossier-card:hover { border-color: rgba(77,159,255,0.35); }
.mun-dossier-card-title {
    font-size: 0.78em;
    font-weight: 700;
    color: #4d9fff;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mun-dossier-card table { font-size: 0.8em; width: 100%; border-collapse: collapse; }
.mun-dossier-card td { padding: 3px 6px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.mun-dossier-card td:first-child { color: var(--text-muted); white-space: nowrap; width: 40%; }
.mun-cf-pill {
    display: inline-block;
    font-family: ui-monospace, monospace;
    font-size: 0.88em;
    background: rgba(77,159,255,0.1);
    border: 1px solid rgba(77,159,255,0.25);
    border-radius: 6px;
    padding: 2px 8px;
    color: #7eb8ff;
    letter-spacing: .05em;
}

.mun-cf-suggest {
    position: fixed;
    z-index: 100020;
    max-height: 280px;
    overflow: auto;
    padding: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 14px 40px rgba(0,0,0,.42);
}

.mun-cf-suggest-row {
    width: 100%;
    display: grid;
    gap: 3px;
    padding: 9px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.mun-cf-suggest-row:hover,
.mun-cf-suggest-row:focus {
    background: rgba(77,159,255,.12);
    outline: none;
}

.mun-cf-suggest-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.mun-cf-suggest-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mun-cf-suggest-main code {
    color: #7eb8ff;
    font-size: .86em;
    background: rgba(77,159,255,.1);
    border: 1px solid rgba(77,159,255,.22);
    border-radius: 5px;
    padding: 1px 5px;
}

.mun-cf-suggest-meta,
.mun-cf-suggest-empty {
    color: var(--text-muted);
    font-size: .78em;
}

.mun-cf-suggest-empty {
    padding: 10px 12px;
}
