/* ============================================
   Phase 2: Visual Overhaul Refined
   ============================================ */

:root {
    /* CGE Core Colors */
    --cge-primary: #00A651;
    --cge-primary-hover: rgba(0, 166, 81, 0.9);
    --cge-primary-dim: rgba(0, 166, 81, 0.12);
    --cge-secondary: #0066CC;
    --cge-secondary-dim: rgba(0, 102, 204, 0.12);

    /* Backgrounds & Surfaces */
    --cge-bg: #FFFFFF;
    --cge-surface: #F8F9FA;
    --cge-dark-bg: #111827;
    --cge-dark-surface: #1F2937;
    --cge-dark-hover: #2d3748;

    /* Text */
    --cge-text: #1A1A1A;
    --cge-text-muted: #666666;
    --cge-text-subtle: #9CA3AF;
    --cge-text-on-dark: #FFFFFF;

    /* Borders */
    --cge-border: #E5E7EB;
    --cge-border-dark: rgba(255, 255, 255, 0.1);

    /* Status Colors */
    --cge-success: #00A651;
    --cge-warning: #F59E0B;
    --cge-error: #EF4444;
    --cge-info: #0066CC;

    /* Typography */
    --cge-font: "DM Sans", "Inter", system-ui, sans-serif;
    --cge-font-mono: ui-monospace, monospace;

    /* Radius */
    --cge-radius-sm: 8px;
    --cge-radius-md: 12px;
    --cge-radius-lg: 16px;
    --cge-radius-xl: 24px;
    --cge-radius-pill: 100px;

    /* Shadows */
    --cge-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --cge-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --cge-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.08);
    --cge-shadow-green: 0 4px 12px rgba(20, 180, 80, 0.3);

    /* Transitions */
    --cge-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --cge-transition: all 0.2s var(--cge-ease);

    /* Layout */
    --header-h: 48px;
    --sidebar-w: 320px;
    --assistant-w: 520px;
}

/* ============== RESET ============== */

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

body {
    font-family: var(--cge-font);
    background: var(--cge-dark-bg);
    color: var(--cge-text-on-dark);
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ============== UNIFIED SIDEBAR CHECKBOX ============== */
/* Green square with white checkmark — used everywhere in sidebar */

.sidebar input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: all 0.15s ease;
}

.sidebar input[type="checkbox"]:checked {
    background: var(--cge-primary);
    border-color: var(--cge-primary);
}

.sidebar input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.sidebar input[type="checkbox"]:hover {
    border-color: var(--cge-primary);
    background: rgba(0, 166, 81, 0.15);
}

.sidebar input[type="checkbox"]:checked:hover {
    background: var(--cge-primary-hover);
}

/* ============== UTILITY CLASSES ============== */

.hidden {
    display: none !important;
}

.layers-list {
    padding: 4px 8px 6px;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============== LOGIN ============== */

.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cge-dark-bg);
    background-image: radial-gradient(circle at 2px 2px, rgba(255, 255, 255, 0.05) 1px, transparent 0);
    background-size: 40px 40px;
    z-index: 10000;
}

.login-card {
    background: var(--cge-dark-surface);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-lg);
    padding: 48px 40px;
    width: 400px;
    text-align: center;
    box-shadow: var(--cge-shadow-lg);
}

.login-logo {
    margin-bottom: 20px;
}

.login-card h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.login-card h1 .logo-green {
    color: var(--cge-primary);
}

.login-card h1 .logo-white {
    color: var(--cge-text-on-dark);
}

.login-subtitle {
    color: var(--cge-text-subtle);
    font-size: 14px;
    margin-bottom: 32px;
}

.input-group {
    text-align: left;
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--cge-text-subtle);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    width: 100%;
    padding: 12px 14px;
    background: var(--cge-dark-bg);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-sm);
    color: var(--cge-text-on-dark);
    font-size: 14px;
    font-family: var(--cge-font);
    outline: none;
    transition: var(--cge-transition);
}

.input-group input:focus {
    border-color: var(--cge-primary);
    box-shadow: 0 0 0 3px var(--cge-primary-dim);
}

#login-btn {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    background: var(--cge-primary);
    color: #fff;
    border: none;
    border-radius: var(--cge-radius-pill);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--cge-transition);
}

#login-btn:hover {
    background: var(--cge-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--cge-shadow-green);
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 16px 0;
    color: #9ca3af;
    font-size: 13px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
}

.login-divider span {
    padding: 0 12px;
}

.google-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    background: #ffffff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: var(--cge-radius-pill);
    font-size: 15px;
    font-weight: 500;
    font-family: 'Roboto', -apple-system, sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
}

.google-login-btn:hover {
    background: #f7f8f8;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.google-login-btn svg {
    flex-shrink: 0;
}

/* Google jako główny przycisk — trochę większy padding na ekranie logowania */
.google-login-primary {
    padding: 13px 16px;
    font-size: 15px;
}

/* "Zaloguj się jako administrator" — drugorzędny link-przycisk pod Google */
.admin-login-toggle {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 8px;
    background: none;
    border: none;
    color: var(--cge-text-subtle, #9ca3af);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.15s;
}

.admin-login-toggle:hover {
    color: var(--cge-text-on-dark, #f9fafb);
}

/* Formularz admina — gdy rozwinięty, lekki odstęp od góry */
.admin-login-form {
    margin-top: 8px;
}

.error-msg {
    color: var(--cge-error);
    font-size: 13px;
    margin-top: 12px;
    min-height: 18px;
}

/* ============== APP LAYOUT ============== */

.app {
    display: grid;
    grid-template-rows: var(--header-h) 1fr;
    grid-template-columns: var(--sidebar-w) 1fr;
    height: 100vh;
    position: relative;
}

.app.sidebar-collapsed {
    grid-template-columns: 0 1fr;
}


/* ============== HEADER (Glassmorphism) ============== */

.header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1000;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-branding {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo-icon svg {
    display: block;
    filter: drop-shadow(0 4px 6px rgba(0, 166, 81, 0.2));
}

.header-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.header-title .logo-green {
    color: var(--cge-primary);
}

.header-title .logo-text {
    color: var(--cge-text-on-dark);
}

.header-center {
    flex: 1;
    max-width: 500px;
    margin: 0 32px;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--cge-radius-sm);
    color: var(--cge-text-subtle);
    cursor: pointer;
    transition: var(--cge-transition);
}

.icon-btn:hover {
    color: var(--cge-text-on-dark);
    border-color: var(--cge-border-dark);
    background: var(--cge-dark-surface);
}

/* ============== HEADER BUTTONS WITH TEXT ============== */

.header-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--cge-radius-pill);
    color: var(--cge-text-subtle);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--cge-font);
    cursor: pointer;
    transition: var(--cge-transition);
    white-space: nowrap;
}

.header-btn:hover {
    color: var(--cge-text-on-dark);
    border-color: var(--cge-border-dark);
    background: var(--cge-dark-surface);
}

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

/* ============== AI AGENCI ANALITYCZNI — PROMINENT BUTTON ============== */

.header-btn-ai {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px 5px 8px;
    background: linear-gradient(135deg, #052e16 0%, #14532d 100%);
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: var(--cge-radius-pill);
    color: #dcfce7;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--cge-font);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.2), 0 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.02em;
    overflow: hidden;
}

/* Shimmer sweep effect */
.header-btn-ai::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(34, 197, 94, 0.15), transparent);
    animation: hai-shimmer 3s ease-in-out infinite;
}

@keyframes hai-shimmer {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

.header-btn-ai:hover {
    background: linear-gradient(135deg, #14532d 0%, #166534 100%);
    border-color: rgba(74, 222, 128, 0.6);
    box-shadow: 0 0 24px rgba(34, 197, 94, 0.4), 0 4px 16px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
    color: #fff;
}

.header-btn-ai:hover .hai-icon {
    background: rgba(34, 197, 94, 0.5);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.5);
}

.header-btn-ai:hover .hai-dots span {
    animation-duration: 0.4s;
}

.header-btn-ai:active {
    transform: translateY(0);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

.hai-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: rgba(34, 197, 94, 0.25);
    border-radius: 6px;
    flex-shrink: 0;
    transition: all 0.3s ease;
    position: relative;
}

.hai-icon svg {
    width: 16px;
    height: 16px;
    stroke: #4ade80;
    transition: stroke 0.3s ease;
}

.header-btn-ai:hover .hai-icon svg {
    stroke: #86efac;
}

.hai-label {
    line-height: 1;
    position: relative;
    z-index: 1;
}

/* Animated AI dots */
.hai-dots {
    display: flex;
    gap: 3px;
    align-items: center;
    margin-left: 2px;
}

.hai-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #4ade80;
    animation: hai-dot-bounce 1.4s ease-in-out infinite;
}

.hai-dots span:nth-child(2) { animation-delay: 0.2s; }
.hai-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes hai-dot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.2); opacity: 1; }
}

.hai-pulse {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 9px;
    height: 9px;
    background: #34D399;
    border-radius: 50%;
    border: 2px solid #052e16;
    animation: hai-blink 2s ease-in-out infinite;
}

@keyframes hai-blink {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); }
    50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(52, 211, 153, 0); }
}

/* responsive: hide label on small screens */
@media (max-width: 1100px) {
    .hai-label { display: none; }
    .hai-dots { display: none; }
    .header-btn-ai { padding: 8px 12px; }
}

/* ============== FEEDBACK MODALS ============== */

.modal-card textarea {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-sm);
    color: var(--cge-text-on-dark);
    font-size: 14px;
    font-family: var(--cge-font);
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

.modal-card textarea:focus {
    outline: none;
    border-color: var(--cge-primary);
    box-shadow: 0 0 0 2px rgba(0, 166, 81, 0.2);
}

.modal-card textarea::placeholder {
    color: var(--cge-text-subtle);
    opacity: 0.6;
}

.char-count {
    display: block;
    text-align: right;
    font-size: 11px;
    color: var(--cge-text-subtle);
    margin-top: 4px;
}

.feedback-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--cge-primary);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--cge-radius-pill);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--cge-font);
    z-index: 9999;
    box-shadow: var(--cge-shadow-green);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to   { opacity: 0; transform: translateX(-50%) translateY(20px); }
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--cge-text-on-dark);
}

/* ============== SEARCH ============== */

/* ============== SEARCH BOX (PROMINENT) ============== */

.search-box {
    position: relative;
    width: 100%;
    max-width: 340px;
}

.search-box input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    background: rgba(255, 255, 255, 0.08);
    /* Lighter bg */
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* More visible border */
    border-radius: var(--cge-radius-md);
    color: var(--cge-text-on-dark);
    font-size: 14px;
    font-family: var(--cge-font);
    transition: var(--cge-transition);
    outline: none;
}

.search-box input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--cge-primary);
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.2);
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cge-text-subtle);
    pointer-events: none;
    transition: var(--cge-transition);
}

.search-box input:focus+.search-icon {
    color: var(--cge-primary);
}

#search-input::placeholder {
    color: var(--cge-text-muted);
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--cge-dark-surface);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-md);
    max-height: 400px;
    overflow-y: auto;
    z-index: 2000;
    box-shadow: var(--cge-shadow-lg);
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--cge-transition);
}

.search-result-item:hover {
    background: var(--cge-dark-hover);
    border-left: 3px solid var(--cge-primary);
    padding-left: 13px;
}

.search-result-item .result-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--cge-text-on-dark);
}

.search-result-item .result-meta {
    font-size: 12px;
    color: var(--cge-text-subtle);
    margin-top: 2px;
}

/* ============== SIDEBAR ============== */

.sidebar {
    grid-row: 2;
    background: var(--cge-dark-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 6px 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Base maps at the bottom */
.sidebar-section:last-child {
    margin-top: auto;
    border-bottom: none;
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-heading {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--cge-text-on-dark);
    margin-bottom: 3px;
    font-family: var(--cge-font-mono);
    display: flex;
    align-items: center;
    background: rgba(0, 166, 81, 0.12);
    border: 1px solid rgba(0, 166, 81, 0.25);
    border-radius: 5px;
    padding: 3px 8px;
    gap: 6px;
}

/* green dot removed — toggle button now serves as visual indicator */

/* Project layers section – heading stays, content scrolls */
#section-projects {
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

#section-projects>.sidebar-heading {
    flex-shrink: 0;
}

.category-tiles-stack {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.category-tiles-stack>* {
    flex-shrink: 0;
}

/* ---- Category Tile Rows (see unified section below) ---- */
/* Group visibility toggle checkbox inside each category tile */
.group-toggle-cb {
    order: -1;
    margin-right: 0;
}

/* ---- Import SHP Dialog ---- */

.import-shp-dialog {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
}

.import-shp-card {
    background: var(--cge-dark-surface);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-lg);
    padding: 24px;
    width: 400px;
    max-width: 90vw;
}

.import-shp-drop {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--cge-radius-sm);
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
    color: var(--cge-text-subtle);
    font-size: 13px;
}

.import-shp-drop:hover,
.import-shp-drop.drag-over {
    border-color: var(--cge-primary);
}

.import-status {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

.import-status.success {
    background: rgba(0, 166, 81, 0.15);
    color: var(--cge-primary);
}

.import-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--cge-error);
}

/* Category Headers */
.project-category {
    margin-bottom: 20px;
}

.category-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--cge-text-on-dark);
    margin-bottom: 8px;
    padding: 8px 12px;
    border: 1.5px solid var(--cge-border-dark);
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    background: rgba(255, 255, 255, 0.04);
    letter-spacing: 0.3px;
}

.category-title:hover {
    color: var(--cge-primary);
    border-color: var(--cge-primary);
    background: rgba(255, 255, 255, 0.08);
}

.category-title[data-category="pv"] {
    border-color: #F59E0B;
    color: #FBBF24;
    background: rgba(245, 158, 11, 0.08);
}

.category-title[data-category="wind"] {
    border-color: #8B5CF6;
    color: #A78BFA;
    background: rgba(139, 92, 246, 0.08);
}

.category-title[data-category="biogas"] {
    border-color: #00A651;
    color: #34D399;
    background: rgba(0, 166, 81, 0.08);
}

.category-title[data-category="gpz"] {
    border-color: #F97316;
    color: #FB923C;
    background: rgba(249, 115, 22, 0.08);
}

.category-title[data-category="cable"] {
    border-color: #EF4444;
    color: #F87171;
    background: rgba(239, 68, 68, 0.08);
}

.category-title[data-category="datacenter"] {
    border-color: #0066CC;
    color: #60A5FA;
    background: rgba(0, 102, 204, 0.08);
}

.category-title[data-category="other"] {
    border-color: #6B7280;
    color: #9CA3AF;
    background: rgba(107, 114, 128, 0.08);
}

.layers-list {
    padding-left: 10px;
    min-height: 4px;
}

/* ============== LAYER CALLOUT BUBBLES (komiksowe dymki etykiet) ============== */

.cge-callout-wrapper {
    position: relative;
    pointer-events: none;  /* wrapper przezroczysty na klik */
    user-select: none;
    z-index: 100;
    --callout-color: #6b7280;
    --callout-fs: 12px;
}

.cge-callout-bubble {
    background: rgba(255, 255, 255, 0.97);
    color: #111827;
    font-family: 'DM Sans', sans-serif;
    font-size: var(--callout-fs);
    font-weight: 600;
    line-height: 1.2;
    padding: 0.35em 0.8em;
    border: calc(var(--callout-fs) * 0.13) solid var(--callout-color);
    border-radius: 0.5em;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
    white-space: nowrap;
    position: relative;
    pointer-events: auto;
    cursor: default;  /* domyślnie zablokowane (dwa kliknięcia żeby edytować) */
    transition: box-shadow 0.15s ease, outline 0.15s ease;
    user-select: none;
}

.cge-callout-bubble:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.24);
}

/* === Edit mode — uaktywniony przez double-click === */
.cge-callout-wrapper.cge-edit-mode .cge-callout-bubble {
    cursor: move;
    outline: 2px dashed #00A651;
    outline-offset: 3px;
    box-shadow: 0 4px 14px rgba(0, 166, 81, 0.35);
}

.cge-callout-wrapper.cge-edit-mode .cge-callout-bubble:hover {
    outline-color: #008A43;
}

.cge-callout-bubble.cge-dragging {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    opacity: 0.92;
}

/* SVG kropka — domyślnie zablokowana (do drag wymaga double-click) */
.cge-callout-dot {
    pointer-events: auto;       /* musi łapać klik dla double-click */
    cursor: default;
    transition: filter 0.15s ease;
}
.cge-callout-dot:hover circle:first-child {
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.4));
}

/* Edit mode kropki — zielone podświetlenie + 4-stronne strzałki drag */
.cge-callout-dot.cge-edit-mode {
    cursor: move;
    filter: drop-shadow(0 0 6px rgba(0, 166, 81, 0.7));
}
.cge-callout-dot.cge-edit-mode circle:first-child {
    stroke: #00A651;
    stroke-width: 2.5;
    r: 8;
    fill: #fff;
}
.cge-callout-dot.cge-edit-mode circle:last-child {
    fill: #00A651;
    r: 3;
}

/* Anchor + tail wąsy są teraz ukryte — używamy SVG leader lines */
.cge-callout-anchor {
    display: none;
}

.cge-callout-bubble::before,
.cge-callout-bubble::after {
    display: none !important;
}

/* SVG overlay z leader lines */
.cge-callout-leaders {
    pointer-events: none;
}
.cge-callout-leaders line {
    opacity: 0.85;
}

/* --- Tail kierunki — trójkątna nóżka jak w komiksie --- */

/* Default: tail na dole (dymek nad anchorem) */
.cge-callout-wrapper.tail-bottom .cge-callout-bubble::before,
.cge-callout-wrapper.tail-bottom .cge-callout-bubble::after,
.cge-callout-wrapper:not(.tail-top):not(.tail-left):not(.tail-right) .cge-callout-bubble::before,
.cge-callout-wrapper:not(.tail-top):not(.tail-left):not(.tail-right) .cge-callout-bubble::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
}
.cge-callout-wrapper.tail-bottom .cge-callout-bubble::before,
.cge-callout-wrapper:not(.tail-top):not(.tail-left):not(.tail-right) .cge-callout-bubble::before {
    bottom: calc(var(--callout-fs) * -0.75);
    border-left: calc(var(--callout-fs) * 0.67) solid transparent;
    border-right: calc(var(--callout-fs) * 0.67) solid transparent;
    border-top: calc(var(--callout-fs) * 0.75) solid var(--callout-color);
}
.cge-callout-wrapper.tail-bottom .cge-callout-bubble::after,
.cge-callout-wrapper:not(.tail-top):not(.tail-left):not(.tail-right) .cge-callout-bubble::after {
    bottom: calc(var(--callout-fs) * -0.58);
    border-left: calc(var(--callout-fs) * 0.54) solid transparent;
    border-right: calc(var(--callout-fs) * 0.54) solid transparent;
    border-top: calc(var(--callout-fs) * 0.62) solid rgba(255, 255, 255, 0.97);
}
.cge-callout-wrapper.tail-bottom .cge-callout-anchor,
.cge-callout-wrapper:not(.tail-top):not(.tail-left):not(.tail-right) .cge-callout-anchor {
    bottom: calc(var(--callout-fs) * -0.3);
    left: 50%;
    transform: translateX(-50%);
}

/* Tail na górze (dymek pod anchorem) */
.cge-callout-wrapper.tail-top .cge-callout-bubble::before,
.cge-callout-wrapper.tail-top .cge-callout-bubble::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
}
.cge-callout-wrapper.tail-top .cge-callout-bubble::before {
    top: calc(var(--callout-fs) * -0.75);
    border-left: calc(var(--callout-fs) * 0.67) solid transparent;
    border-right: calc(var(--callout-fs) * 0.67) solid transparent;
    border-bottom: calc(var(--callout-fs) * 0.75) solid var(--callout-color);
}
.cge-callout-wrapper.tail-top .cge-callout-bubble::after {
    top: calc(var(--callout-fs) * -0.58);
    border-left: calc(var(--callout-fs) * 0.54) solid transparent;
    border-right: calc(var(--callout-fs) * 0.54) solid transparent;
    border-bottom: calc(var(--callout-fs) * 0.62) solid rgba(255, 255, 255, 0.97);
}
.cge-callout-wrapper.tail-top .cge-callout-anchor {
    top: calc(var(--callout-fs) * -0.3);
    left: 50%;
    transform: translateX(-50%);
}

/* Tail po lewej (dymek na prawo od anchora) */
.cge-callout-wrapper.tail-left .cge-callout-bubble::before,
.cge-callout-wrapper.tail-left .cge-callout-bubble::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
}
.cge-callout-wrapper.tail-left .cge-callout-bubble::before {
    left: calc(var(--callout-fs) * -0.75);
    border-top: calc(var(--callout-fs) * 0.67) solid transparent;
    border-bottom: calc(var(--callout-fs) * 0.67) solid transparent;
    border-right: calc(var(--callout-fs) * 0.75) solid var(--callout-color);
}
.cge-callout-wrapper.tail-left .cge-callout-bubble::after {
    left: calc(var(--callout-fs) * -0.58);
    border-top: calc(var(--callout-fs) * 0.54) solid transparent;
    border-bottom: calc(var(--callout-fs) * 0.54) solid transparent;
    border-right: calc(var(--callout-fs) * 0.62) solid rgba(255, 255, 255, 0.97);
}
.cge-callout-wrapper.tail-left .cge-callout-anchor {
    left: calc(var(--callout-fs) * -0.3);
    top: 50%;
    transform: translateY(-50%);
}

/* Tail po prawej (dymek na lewo od anchora) */
.cge-callout-wrapper.tail-right .cge-callout-bubble::before,
.cge-callout-wrapper.tail-right .cge-callout-bubble::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
}
.cge-callout-wrapper.tail-right .cge-callout-bubble::before {
    right: calc(var(--callout-fs) * -0.75);
    border-top: calc(var(--callout-fs) * 0.67) solid transparent;
    border-bottom: calc(var(--callout-fs) * 0.67) solid transparent;
    border-left: calc(var(--callout-fs) * 0.75) solid var(--callout-color);
}
.cge-callout-wrapper.tail-right .cge-callout-bubble::after {
    right: calc(var(--callout-fs) * -0.58);
    border-top: calc(var(--callout-fs) * 0.54) solid transparent;
    border-bottom: calc(var(--callout-fs) * 0.54) solid transparent;
    border-left: calc(var(--callout-fs) * 0.62) solid rgba(255, 255, 255, 0.97);
}
.cge-callout-wrapper.tail-right .cge-callout-anchor {
    right: calc(var(--callout-fs) * -0.3);
    top: 50%;
    transform: translateY(-50%);
}

/* ============== LAYER GROUP FOLDERS — hierarchiczne drzewko (kompaktowe) ============== */

.pl-folder {
    margin: 1px 0;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.pl-folder-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 2px 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 2px;
    color: var(--cge-text);
    user-select: none;
    transition: background 0.15s ease;
}

.pl-folder-header:hover {
    background: rgba(255, 255, 255, 0.08);
}

.pl-folder-cb {
    accent-color: #00A651;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
    transform-origin: center;
}

.pl-folder-icon {
    color: var(--cge-text-subtle);
    text-align: center;
    flex-shrink: 0;
}

.pl-folder-name {
    flex: 1;
    color: #F3F4F6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pl-folder-count {
    color: var(--cge-text-subtle);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.pl-folder-content {
    padding-top: 1px;
}

/* --- Poziom 1: główny folder (np. "DC Konin 1") --- */
.pl-folder[data-folder-level="1"] > .pl-folder-header {
    padding: 3px 8px;
    background: rgba(0, 102, 204, 0.08);
    border-left: 2px solid rgba(0, 102, 204, 0.5);
}
.pl-folder[data-folder-level="1"] > .pl-folder-header:hover {
    background: rgba(0, 102, 204, 0.16);
}
.pl-folder[data-folder-level="1"] > .pl-folder-header .pl-folder-name {
    font-size: 11px;
    font-weight: 700;
}
.pl-folder[data-folder-level="1"] > .pl-folder-header .pl-folder-icon {
    font-size: 9px;
    width: 9px;
}
.pl-folder[data-folder-level="1"] > .pl-folder-header .pl-folder-cb {
    transform: scale(0.78);
    margin: -2px -3px;
}
.pl-folder[data-folder-level="1"] > .pl-folder-header .pl-folder-count {
    font-size: 9.5px;
}
.pl-folder[data-folder-level="1"] > .pl-folder-content {
    padding-left: 10px;
    margin-top: 1px;
}

/* --- Poziom 2: podfolder (np. "Magazyn energii") --- */
.pl-folder[data-folder-level="2"] > .pl-folder-header {
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.04);
    border-left: 1px solid rgba(255, 255, 255, 0.22);
}
.pl-folder[data-folder-level="2"] > .pl-folder-header .pl-folder-name {
    font-size: 10px;
    font-weight: 600;
}
.pl-folder[data-folder-level="2"] > .pl-folder-header .pl-folder-icon {
    font-size: 8px;
    width: 8px;
}
.pl-folder[data-folder-level="2"] > .pl-folder-header .pl-folder-cb {
    transform: scale(0.68);
    margin: -3px -4px;
}
.pl-folder[data-folder-level="2"] > .pl-folder-header .pl-folder-count {
    font-size: 9px;
}
.pl-folder[data-folder-level="2"] > .pl-folder-content {
    padding-left: 9px;
}

/* --- Poziom 3+: głębsze zagnieżdżenie --- */
.pl-folder[data-folder-level="3"] > .pl-folder-header,
.pl-folder[data-folder-level="4"] > .pl-folder-header,
.pl-folder[data-folder-level="5"] > .pl-folder-header {
    padding: 2px 5px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 1px dotted rgba(255, 255, 255, 0.15);
}
.pl-folder[data-folder-level="3"] > .pl-folder-header .pl-folder-name,
.pl-folder[data-folder-level="4"] > .pl-folder-header .pl-folder-name,
.pl-folder[data-folder-level="5"] > .pl-folder-header .pl-folder-name {
    font-size: 9.5px;
    font-weight: 500;
    color: #D1D5DB;
}
.pl-folder[data-folder-level="3"] > .pl-folder-header .pl-folder-icon,
.pl-folder[data-folder-level="4"] > .pl-folder-header .pl-folder-icon,
.pl-folder[data-folder-level="5"] > .pl-folder-header .pl-folder-icon {
    font-size: 7px;
    width: 7px;
}
.pl-folder[data-folder-level="3"] > .pl-folder-header .pl-folder-cb,
.pl-folder[data-folder-level="4"] > .pl-folder-header .pl-folder-cb,
.pl-folder[data-folder-level="5"] > .pl-folder-header .pl-folder-cb {
    transform: scale(0.60);
    margin: -3px -5px;
}
.pl-folder[data-folder-level="3"] > .pl-folder-header .pl-folder-count,
.pl-folder[data-folder-level="4"] > .pl-folder-header .pl-folder-count,
.pl-folder[data-folder-level="5"] > .pl-folder-header .pl-folder-count {
    font-size: 8.5px;
}
.pl-folder[data-folder-level="3"] > .pl-folder-content,
.pl-folder[data-folder-level="4"] > .pl-folder-content,
.pl-folder[data-folder-level="5"] > .pl-folder-content {
    padding-left: 8px;
}

.pl-folder:not([data-folder-level]) > .pl-folder-header {
    padding: 2px 6px;
}
.pl-folder:not([data-folder-level]) > .pl-folder-header .pl-folder-name {
    font-size: 10px;
    font-weight: 600;
}
.pl-folder:not([data-folder-level]) > .pl-folder-content {
    padding-left: 9px;
}
.pl-folder:not([data-folder-level]) > .pl-folder-header .pl-folder-cb {
    transform: scale(0.72);
    margin: -3px -4px;
}

/* ============== COMPOUND OBJECTS (scalone warstwy: GPO = poligony+linie) ============== */

.pl-compound {
    margin: 1px 0;
    border-left: 1px solid rgba(0, 166, 81, 0.4);
    background: rgba(0, 166, 81, 0.04);
    border-radius: 0 3px 3px 0;
}

.pl-compound-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 10px;
    color: var(--cge-text);
    user-select: none;
    transition: background 0.15s ease;
    position: relative;
}

.pl-compound-header:hover {
    background: rgba(0, 166, 81, 0.10);
}

.pl-compound-cb {
    accent-color: #00A651;
    cursor: pointer;
    flex-shrink: 0;
    margin: -3px -4px;
    transform-origin: center;
    transform: scale(0.68);
}

.pl-compound-icon {
    color: var(--cge-text-subtle);
    font-size: 8px;
    width: 8px;
    text-align: center;
    flex-shrink: 0;
}

.pl-compound-name {
    flex: 1;
    font-weight: 700;
    font-size: 10px;
    color: #E5E7EB;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pl-compound-count {
    color: var(--cge-text-subtle);
    font-size: 9px;
    font-variant-numeric: tabular-nums;
}

.pl-compound-actions {
    display: none;
    gap: 2px;
    margin-left: 4px;
}

.pl-compound-header:hover .pl-compound-actions {
    display: flex;
}

.pl-compound-content {
    padding-left: 9px;
    padding-top: 1px;
    padding-bottom: 1px;
    border-top: 1px dashed rgba(0, 166, 81, 0.2);
}

/* ============== PROJECT LAYER ITEMS ============== */

.project-layer-item {
    position: relative;
    border-left: 3px solid var(--cge-border-dark);
    padding: 6px 8px;
    margin-bottom: 2px;
    border-radius: 0 4px 4px 0;
    background: rgba(255, 255, 255, 0.03);
    transition: background 0.15s ease;
}

.project-layer-item:hover {
    background: rgba(0, 166, 81, 0.08);  /* delikatna zielona poświata */
}

/* Wyraźniejsza poświata gdy warstwa zaznaczona (klik) */
.project-layer-item.cge-layer-selected {
    background: rgba(0, 166, 81, 0.14);
    box-shadow: inset 0 0 0 1px rgba(0, 166, 81, 0.4);
}

.pl-main-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
}

.pl-vis-cb {
    accent-color: var(--cge-primary);
    cursor: pointer;
    flex-shrink: 0;
    margin: -2px -3px;
    transform-origin: center;
    transform: scale(0.75);
}

.pl-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.pl-name {
    flex: 1;
    font-size: 12px;
    color: var(--cge-text-on-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.pl-name.dim {
    opacity: 0.4;
}

.pl-count {
    font-size: 11px;
    color: var(--cge-text-subtle);
    flex-shrink: 0;
    margin-right: 2px;
}

/* Popover akcji — floating po prawej stronie wiersza, pokazuje się TYLKO
   po kliknięciu warstwy (cge-layer-selected). Position fixed wychodzi poza
   overflow scrollowanych kontenerów. */
.pl-hover-actions {
    display: none;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    position: fixed;
    z-index: 10000;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 7px;
    padding: 5px 7px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

/* Popover widoczny tylko gdy wiersz jest zaznaczony LUB użytkownik wskazuje popover */
.project-layer-item.cge-layer-selected .pl-hover-actions,
.project-layer-item[data-dragging] .pl-hover-actions {
    display: flex;
}

.pl-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--cge-text-subtle);
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    transition: all 0.15s ease;
}

.pl-btn:hover {
    background: var(--cge-dark-hover);
    border-color: var(--cge-border-dark);
    color: var(--cge-text-on-dark);
}

.pl-del-btn:hover {
    border-color: var(--cge-error);
    color: var(--cge-error);
}

.pl-opacity-slider {
    width: 50px;
    height: 4px;
    accent-color: var(--cge-primary);
    cursor: pointer;
}

.category-add-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: var(--cge-text-subtle);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    margin-right: 4px;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.category-add-btn:hover {
    background: var(--cge-primary);
    border-color: var(--cge-primary);
    color: #fff;
}

/* Label toggle button — always visible, sits between count and hover-actions */
.pl-lbl-btn {
    font-size: 12px;
    padding: 0 3px;
    opacity: 0.4;
    transition: opacity 0.15s, color 0.15s;
    flex-shrink: 0;
}

.pl-lbl-btn.pl-lbl-active {
    opacity: 1;
    color: var(--cge-primary);
}

.pl-lbl-btn:hover {
    opacity: 1 !important;
}


.layer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--cge-text-subtle);
    transition: var(--cge-transition);
}

.layer-item:hover {
    color: var(--cge-text-on-dark);
}

.layer-item input {
    accent-color: var(--cge-primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.layer-item label {
    cursor: pointer;
    flex: 1;
}

.layer-item .layer-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.base-layer-item {
    font-size: 13px;
    /* Slightly smaller than header */
    padding: 8px 0;
}

/* ============== DRAW TOOLBAR ============== */

.draw-tool-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cge-dark-surface);
    border: 1px solid var(--cge-border-dark);
    border-radius: 6px;
    color: var(--cge-text-subtle);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.draw-tool-btn:hover {
    background: var(--cge-dark-hover);
    border-color: var(--cge-primary);
    color: var(--cge-text-on-dark);
}

.draw-tool-btn.active {
    background: var(--cge-primary);
    border-color: var(--cge-primary);
    color: #fff;
    box-shadow: var(--cge-shadow-green);
}

.layer-select-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    background: var(--cge-dark-surface);
    border: 1px solid var(--cge-border-dark);
    border-radius: 6px;
    color: var(--cge-text-on-dark);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 4px;
    font-size: 13px;
    text-align: left;
}

.layer-select-item:hover {
    background: var(--cge-dark-hover);
    border-color: var(--cge-primary);
}

.layer-select-name {
    flex: 1;
}

.layer-select-count {
    color: var(--cge-text-subtle);
    font-size: 11px;
}

#add-layer-picker {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    background: var(--cge-panel-bg);
    border: 1px solid var(--cge-border-dark);
    flex-shrink: 0;
    border-radius: 6px;
    padding: 6px;
}

#add-layer-picker.hidden {
    display: none !important;
}

/* ============== FLOATING TOOLS ============== */

.map-container {
    grid-row: 2;
    grid-column: 2;
    position: relative;
    background: #ffffff;
}

.floating-tools {
    position: absolute;
    top: 10px;
    left: 20px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 6px;
    z-index: 100;
}

.tool-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;
}

.tool-group-label {
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #fff;
    background: #111;
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
    line-height: 1.4;
    position: relative;
    z-index: 2;
}

.tool-group-label::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 8px;
    background: #333;
}

.tool-group-btns {
    display: flex;
    gap: 3px;
    position: relative;
    padding-top: 10px;
}

.tool-group-btns::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    height: 1px;
    background: #333;
}

.floater-btn {
    width: 36px;
    height: 36px;
    background: var(--cge-dark-surface);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-sm);
    color: var(--cge-text-on-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--cge-transition);
    box-shadow: var(--cge-shadow-sm);
}

.floater-btn:hover {
    background: var(--cge-dark-hover);
    border-color: var(--cge-primary);
    transform: translateY(-2px);
    /* Vertical hover effect since horizontal layout */
}

.floater-btn.active {
    background: var(--cge-primary);
    border-color: var(--cge-primary);
    color: white;
    box-shadow: var(--cge-shadow-green);
}

/* Locked floater button — feature in development.
   Disabled, dimmed, with a small lock badge in the corner. */
.floater-btn--locked {
    position: relative;
    opacity: 0.45;
    cursor: not-allowed !important;
}

.floater-btn--locked:hover {
    background: var(--cge-dark-surface) !important;
    border-color: var(--cge-border-dark) !important;
    transform: none !important;
}

.floater-btn-lock {
    position: absolute;
    bottom: -3px;
    right: -3px;
    font-size: 10px;
    line-height: 1;
    background: var(--cge-dark-bg, #111827);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Locked AI Analityk button in header */
.header-btn-ai--locked {
    position: relative;
    opacity: 0.55;
    cursor: not-allowed !important;
    filter: grayscale(0.5);
}

.header-btn-ai--locked:hover {
    transform: none !important;
    box-shadow: none !important;
}

.header-btn-ai-lock {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 11px;
    line-height: 1;
    background: var(--cge-dark-bg, #111827);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Locked icon buttons in assistant header (sync, etc.) */
.assistant-icon-btn--locked {
    position: relative;
    opacity: 0.45;
    cursor: not-allowed !important;
}

.assistant-icon-btn--locked:hover {
    background: transparent !important;
    color: inherit !important;
}

.assistant-icon-btn-lock {
    position: absolute;
    bottom: -3px;
    right: -3px;
    font-size: 9px;
    line-height: 1;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Locked Postęp button */
.assistant-progress-btn--locked {
    position: relative;
    opacity: 0.5;
    cursor: not-allowed !important;
}

.assistant-progress-btn--locked:hover {
    background: inherit !important;
}

.assistant-progress-btn-lock {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 10px;
    line-height: 1;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.floater-btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--cge-error);
    color: var(--cge-error);
}

.tool-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #FACC15;
    color: #111;
    font-size: 10px;
    font-weight: 700;
    border-radius: 9px;
    margin-top: 2px;
}

/* ============== COORDINATES DISPLAY ============== */

.mouse-coords {
    position: absolute;
    bottom: 16px;
    left: 380px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--cge-radius-md);
    padding: 5px 10px;
    font-size: 11px;
    font-family: var(--cge-font-mono);
    color: #374151;
    pointer-events: none;
    z-index: 100;
    display: flex;
    gap: 12px;
}

.mouse-coords span {
    color: #111827;
    font-weight: 600;
}

/* ============== MAP CONTROLS OVERRIDES ============== */

.map-container .ol-zoom {
    top: 20px;
    right: 20px;
    left: auto;
}

.map-container .ol-full-screen {
    top: 70px;
    right: 20px;
}

.map-container .ol-scale-line {
    left: 20px;
    bottom: 16px;
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 4px 8px;
    border-radius: var(--cge-radius-md);
}

.map-container .ol-attribution {
    right: auto;
    left: 130px;
    bottom: 16px;
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--cge-radius-md);
}

/* ============== POPUP & MEASURE TOOTLIP ============== */


.ol-popup {
    background: var(--cge-bg);
    border-radius: var(--cge-radius-lg);
    box-shadow: var(--cge-shadow-lg);
    padding: 18px 16px;
    min-width: 300px;
    max-width: 380px;
    position: relative;
}

/* Compact info table inside popup */
.ol-popup table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: fixed;
}

.ol-popup table td:first-child {
    width: 42%;
    padding: 3px 6px 3px 0;
    color: #666;
    font-weight: 500;
    word-break: break-word;
    white-space: normal;
}

.ol-popup table td:last-child {
    width: 58%;
    padding: 3px 0;
    color: #111;
    text-align: right;
    word-break: break-word;
    white-space: normal;
}

.ol-popup table tr {
    border-bottom: 1px solid #f0f0f0;
}

.ol-popup table a {
    color: #1976D2;
    text-decoration: underline;
    font-weight: 600;
    word-break: break-all;
}

.ol-popup table a:hover {
    color: #0D47A1;
}

.ol-popup-closer {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: #f0f0f0;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 700;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    z-index: 1;
    line-height: 1;
}

.ol-popup-closer:hover {
    background: #e0e0e0;
    color: #333;
}

.popup-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--cge-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.popup-title::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--cge-primary);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--cge-primary);
}

.measure-tooltip {
    position: fixed;
    z-index: 999;
    pointer-events: none;
    white-space: nowrap;
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid var(--cge-primary);
    color: var(--cge-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
}

/* ============== TOOL SEPARATOR ============== */

.floater-separator {
    width: 1px;
    height: 28px;
    background: var(--cge-border-dark);
    align-self: center;
    margin: 0 2px;
}

/* ============== MODAL OVERLAY ============== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-card {
    background: var(--cge-dark-surface);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-lg);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
    width: 480px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s var(--cge-ease);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--cge-text-on-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title svg {
    color: var(--cge-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--cge-radius-sm);
    color: var(--cge-text-subtle);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--cge-transition);
}

.modal-close:hover {
    color: var(--cge-text-on-dark);
    border-color: var(--cge-border-dark);
    background: var(--cge-dark-hover);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--cge-border-dark);
}

/* ============== FORM ELEMENTS ============== */

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

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--cge-text-subtle);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--cge-dark-bg);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-sm);
    color: var(--cge-text-on-dark);
    font-size: 14px;
    font-family: var(--cge-font);
    outline: none;
    transition: var(--cge-transition);
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    border-color: var(--cge-primary);
    box-shadow: 0 0 0 2px var(--cge-primary-dim);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--cge-text-on-dark);
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

.checkbox-item input {
    accent-color: var(--cge-primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ============== BUTTONS ============== */

.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--cge-primary);
    color: white;
    border: none;
    border-radius: var(--cge-radius-pill);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--cge-font);
    cursor: pointer;
    transition: var(--cge-transition);
}

.btn-primary:hover {
    background: var(--cge-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--cge-shadow-green);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    color: var(--cge-text-subtle);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-pill);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--cge-font);
    cursor: pointer;
    transition: var(--cge-transition);
}

.btn-secondary:hover {
    color: var(--cge-text-on-dark);
    border-color: var(--cge-text-subtle);
    background: var(--cge-dark-hover);
}

/* ============== PRINT PREVIEW INFO ============== */

.print-preview-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--cge-primary-dim);
    border: 1px solid rgba(0, 166, 81, 0.2);
    border-radius: var(--cge-radius-sm);
    font-size: 12px;
    color: var(--cge-primary);
}

.print-preview-info svg {
    flex-shrink: 0;
    color: var(--cge-primary);
}

/* ============== SPINNER ============== */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ============== PRINT PANEL (Non-blocking) ============== */

.print-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 360px;
    background: var(--cge-dark-surface);
    border: 1px solid var(--cge-border-dark);
    box-shadow: var(--cge-shadow-lg);
    border-radius: var(--cge-radius-lg);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s var(--cge-ease);
    color: var(--cge-text-on-dark);
}

.print-panel.hidden {
    display: none !important;
}

.print-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--cge-border-dark);
    background: rgba(255, 255, 255, 0.02);
}

.panel-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--cge-text-on-dark);
}

.panel-close {
    background: none;
    border: none;
    color: var(--cge-text-subtle);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--cge-transition);
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--cge-text-on-dark);
}

.print-panel-body {
    padding: 16px;
    overflow-y: auto;
    max-height: 60vh;
}

.print-panel-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--cge-border-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.spacer {
    flex: 1;
}

/* Compact Form Elements */
.form-group.compact {
    margin-bottom: 12px;
}

.form-group.compact label {
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--cge-text-subtle);
}

.form-group.compact select,
.form-group.compact input[type="text"],
.form-group.compact input[type="number"] {
    padding: 6px 10px;
    font-size: 13px;
    height: 32px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--cge-border-dark);
    color: var(--cge-text-on-dark);
    border-radius: var(--cge-radius-sm);
    width: 100%;
}

.checkbox-group.compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.checkbox-item {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--cge-text-on-dark);
}

.print-preview-info.compact {
    margin-top: 12px;
    padding: 8px 12px;
    font-size: 12px;
    gap: 8px;
    background: rgba(0, 166, 81, 0.1);
    border: 1px solid rgba(0, 166, 81, 0.2);
    border-radius: var(--cge-radius-sm);
    color: #4ade80;
    display: flex;
    align-items: flex-start;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============== SIDEBAR COLLAPSE ============== */

.sidebar {
    transition: width 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    overflow: hidden;
    position: relative;
}

.sidebar.collapsed {
    width: 0 !important;
    min-width: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.sidebar-collapse-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-sm);
    color: var(--cge-text-subtle);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: var(--cge-transition);
}

.sidebar-collapse-btn:hover {
    background: var(--cge-dark-hover);
    color: var(--cge-text-on-dark);
}

/* ============== CATEGORY TILES (elongated rows) ============== */

.category-tiles-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.category-tile-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-left: 3px solid var(--tile-color, var(--cge-border-dark));
    border-radius: var(--cge-radius-sm);
    cursor: pointer;
    transition: var(--cge-transition);
    color: var(--cge-text-subtle);
    font-size: 13px;
    font-weight: 500;
}

.category-tile-row span {
    flex: 1;
}

.category-tile-row .tile-chevron {
    opacity: 0.4;
    transition: transform 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

.category-tile-row:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--cge-text-on-dark);
    border-color: rgba(255, 255, 255, 0.1);
    border-left-color: var(--tile-color, var(--cge-primary));
}

.category-tile-row.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    border-left-color: var(--tile-color, var(--cge-primary));
    color: var(--cge-text-on-dark);
}

.category-tile-row.active .tile-chevron {
    transform: rotate(180deg);
    opacity: 0.8;
}

.category-tile-row svg:first-child {
    color: var(--tile-color, var(--cge-text-subtle));
    flex-shrink: 0;
}

/* ============== BASEMAP CONTROLS ============== */

.basemap-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.basemap-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    transition: var(--cge-transition);
    cursor: default;
}

.basemap-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.basemap-item.dragging {
    opacity: 0.5;
    background: rgba(0, 166, 81, 0.1);
    border: 1px dashed var(--cge-primary);
}

/* Unified reorder arrows — always visible */
.reorder-arrows,
.my-layer-order,
.gp-reorder-arrows {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex-shrink: 0;
}

.reorder-btn,
.order-btn,
.gp-reorder-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    font-size: 9px;
    line-height: 1;
    cursor: pointer;
    padding: 1px 3px;
    transition: all 0.15s ease;
    border-radius: 2px;
}

.reorder-btn:hover:not(:disabled),
.order-btn:hover:not(:disabled),
.gp-reorder-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.reorder-btn:disabled,
.order-btn:disabled {
    opacity: 0.15;
    cursor: default;
}

/* basemap checkboxes inherit from unified .sidebar input[type="checkbox"] */

.basemap-item label {
    font-size: 12px;
    color: var(--cge-text-subtle);
    cursor: pointer;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.basemap-item input[type="checkbox"]:checked+label {
    color: var(--cge-text-on-dark);
}

.opacity-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 50px;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    flex-shrink: 0;
}

.opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--cge-primary);
    border-radius: 50%;
    cursor: grab;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.opacity-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.15);
}

.opacity-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--cge-primary);
    border-radius: 50%;
    cursor: grab;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.opacity-slider::-moz-range-thumb:active {
    cursor: grabbing;
}

/* ---- Geoportal Layer Groups ---- */

#geoportal-layers {
    padding: 0 4px 8px;
}

.geoportal-group {
    margin-bottom: 4px;
    border-radius: var(--cge-radius-sm);
    overflow: hidden;
}

.geoportal-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--cge-text-subtle);
    cursor: pointer;
    border-radius: 4px;
    transition: var(--cge-transition);
    user-select: none;
}

.geoportal-group-title {
    flex: 1;
}

/* Unified toggle buttons — styled to match green checkbox */
.group-toggle-btn,
.section-toggle-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    color: transparent;
    font-size: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    position: relative;
}

.group-toggle-btn:hover,
.section-toggle-btn:hover {
    border-color: var(--cge-primary);
    background: rgba(0, 166, 81, 0.15);
}

/* Active (checked) state — green bg + checkmark via ::after */
.group-toggle-btn.toggle-on,
.section-toggle-btn.toggle-on {
    background: var(--cge-primary);
    border-color: var(--cge-primary);
}

.group-toggle-btn.toggle-on::after,
.section-toggle-btn.toggle-on::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* section-toggle-btn is now placed before text in HTML, no margin-left needed */

/* Sidebar horizontal resize handle */
.sidebar-width-handle {
    position: absolute;
    top: 0;
    right: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    z-index: 20;
    background: transparent;
}

.sidebar-width-handle:hover,
.sidebar-width-handle.active {
    background: rgba(0, 166, 81, 0.3);
}

.sidebar-width-handle::after {
    content: '';
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.sidebar-width-handle:hover::after,
.sidebar-width-handle.active::after {
    background: rgba(0, 166, 81, 0.5);
}

.gp-collapse-arrow {
    font-size: 8px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--cge-text-subtle);
    transition: transform 0.25s ease, background 0.2s, color 0.2s;
    flex-shrink: 0;
    margin-left: auto;
}

.geoportal-group.collapsed .gp-collapse-arrow {
    transform: rotate(-90deg);
}

.geoportal-group-header:hover .gp-collapse-arrow {
    background: rgba(0, 166, 81, 0.2);
    color: var(--cge-accent);
}

.geoportal-group-header:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--cge-text-on-dark);
}

.geoportal-group-body {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.25s ease;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.geoportal-group.collapsed .geoportal-group-body {
    max-height: 0;
}

.geoportal-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 4px;
    transition: var(--cge-transition);
    font-size: 12px;
}

.geoportal-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* geoportal checkboxes inherit from unified .sidebar input[type="checkbox"] */

.geoportal-item label {
    font-size: 12px;
    color: var(--cge-text-subtle);
    cursor: pointer;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.geoportal-item input[type="checkbox"]:checked+label {
    color: var(--cge-text-on-dark);
}

.geoportal-item .opacity-slider {
    width: 44px;
}

/* --- Nested sub-layers (level 2 indentation) --- */
.geoportal-sublayer-group {
    border-left: 1px solid rgba(255, 255, 255, 0.10);
    margin-left: 12px;
    padding-left: 8px;
}

.geoportal-parent-item {
    padding-left: 4px !important;
}

.geoportal-parent-item label {
    font-weight: 600;
    color: var(--cge-text-on-dark);
    font-size: 12px;
}

.sublayer-toggle {
    cursor: pointer;
    font-size: 7px;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--cge-text-subtle);
    transition: var(--cge-transition);
    user-select: none;
    flex-shrink: 0;
}

.sublayer-toggle:hover {
    background: rgba(0, 166, 81, 0.2);
    color: var(--cge-accent);
}

.geoportal-sublayers {
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.geoportal-sublayers.collapsed {
    display: none;
}

.geoportal-child-item {
    padding-left: 4px !important;
}

.geoportal-child-item label {
    font-size: 11px;
    font-style: normal;
}

/* ============== TOOL LABEL ============== */

.tool-label {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 8px;
    font-weight: 700;
    color: var(--cge-primary);
    font-family: var(--cge-font);
}

.floater-btn {
    position: relative;
}

/* ============== SIDEBAR EXPAND STRIP ============== */

.sidebar-expand-strip {
    position: fixed;
    left: 0;
    top: var(--header-h);
    bottom: 0;
    width: 28px;
    background: rgba(17, 24, 39, 0.92);
    backdrop-filter: blur(8px);
    border-right: 1px solid var(--cge-border-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 90;
    transition: background 0.2s ease;
}

.sidebar-expand-strip:hover {
    background: rgba(17, 24, 39, 1);
}

.sidebar-expand-arrow {
    width: 24px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--cge-text-subtle);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--cge-transition);
}

.sidebar-expand-arrow:hover {
    color: var(--cge-primary);
}

/* ============== OLD ASSISTANT PANEL STYLES (removed — see section 3000+) ============== */

/* ============== PRINT MEDIA QUERY ============== */
@media print {
    @page {
        size: auto;
        margin: 0;
    }

    body {
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    .header,
    .sidebar,
    .floating-tools,
    .measure-tooltip,
    .ol-control,
    .print-panel,
    .ol-popup,
    .assistant-panel,
    .assistant-expand-strip,
    #login-screen {
        display: none !important;
    }

    .app {
        display: block !important;
        position: static !important;
        width: 100vw !important;
        height: 100vh !important;
        overflow: visible !important;
    }

    .map-container {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 0 !important;
        background: white !important;
    }

    canvas {
        width: 100% !important;
        height: 100% !important;
    }

    .map-container::after {
        content: "CGE S.A.";
        position: absolute;
        bottom: 10px;
        right: 10px;
        font-size: 10pt;
        color: #000;
        background: rgba(255, 255, 255, 0.8);
        padding: 2px 5px;
        z-index: 1000;
    }
}


/* ============== MY LAYERS ============== */

.my-layers-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.my-layers-empty {
    color: var(--cge-text-subtle);
    font-size: 12px;
    padding: 12px 8px;
    text-align: center;
    opacity: 0.6;
}

.my-layer-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: var(--cge-radius-sm);
    transition: var(--cge-transition);
    cursor: default;
}

.my-layer-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.my-layer-item.active {
    background: rgba(0, 166, 81, 0.15);
    border: 1px solid rgba(0, 166, 81, 0.3);
}

.my-layer-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.my-layer-icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
    color: var(--cge-text-subtle);
}

.my-layer-name {
    flex: 1;
    font-size: 12px;
    color: var(--cge-text-on-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    line-height: 22px;
}

.my-layer-count {
    font-size: 10px;
    color: var(--cge-text-subtle);
    flex-shrink: 0;
}

.my-layer-actions {
    display: none;
    gap: 1px;
    flex-shrink: 0;
    margin-left: auto;
}

/* Sub-layer (exclusion/condition) grouping */
.my-layer-expand { cursor: pointer; font-size: 11px; color: var(--cge-text-subtle); padding: 0 3px; flex-shrink: 0; user-select: none; }
.my-layer-expand:hover { color: var(--cge-accent); }
.my-layer-children { padding-left: 6px; border-left: 2px solid rgba(255,255,255,0.08); margin-left: 22px; }
.my-layer-child { padding: 1px 2px; font-size: 10px; min-height: 18px; gap: 4px; }
.my-layer-child .my-layer-name { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.my-layer-child .my-layer-count { font-size: 8px; }
.my-layer-child .layer-vis-cb { width: 12px; height: 12px; }
.my-layer-swatch-canvas { flex-shrink: 0; width: 14px; height: 14px; border-radius: 2px; }
.child-name { opacity: 0.85; }

/* Building type checkboxes */
.ls-bld-types { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 4px 0; }
.ls-bld-type-cb { display: flex; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--ls-text-on-dark); cursor: pointer; white-space: nowrap; }
.ls-bld-type-cb input[type="checkbox"] { width: 13px; height: 13px; accent-color: var(--ls-primary); }

/* Pokazywanie akcji obsługiwane przez JS w user-layers.js — tylko dla
   warstwy zaznaczonej w drzewku (kliknięcie). Brak CSS hover rule tutaj. */

.my-layer-btn {
    background: transparent;
    border: none;
    color: var(--cge-text-subtle);
    cursor: pointer;
    padding: 2px 3px;
    border-radius: 3px;
    transition: var(--cge-transition);
    display: flex;
    align-items: center;
    font-size: 11px;
    opacity: 0.7;
}

.my-layer-btn:hover {
    color: var(--cge-text-on-dark);
    background: rgba(255, 255, 255, 0.12);
    opacity: 1;
}

.my-layer-btn-danger:hover {
    color: var(--cge-error);
    background: rgba(239, 68, 68, 0.15);
}

.new-layer-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    margin-top: 8px;
    background: rgba(0, 166, 81, 0.1);
    border: 1px dashed rgba(0, 166, 81, 0.3);
    border-radius: var(--cge-radius-sm);
    color: var(--cge-primary);
    font-size: 13px;
    font-family: var(--cge-font);
    cursor: pointer;
    transition: var(--cge-transition);
}

.new-layer-btn:hover {
    background: rgba(0, 166, 81, 0.2);
    border-color: var(--cge-primary);
}

/* Drawing tool active state */
/* ============== MODAL DIALOGS ============== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-card {
    background: var(--cge-dark-bg);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-card h3 {
    color: var(--cge-text-on-dark);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-desc {
    color: var(--cge-text-subtle);
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.modal-card .input-group {
    margin-bottom: 12px;
}

.modal-card label {
    display: block;
    color: var(--cge-text-subtle);
    font-size: 12px;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-card input[type="text"],
.modal-card select {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-sm);
    color: var(--cge-text-on-dark);
    font-size: 14px;
    font-family: var(--cge-font);
    outline: none;
    transition: var(--cge-transition);
}

.modal-card input[type="text"]:focus,
.modal-card select:focus {
    border-color: var(--cge-primary);
    box-shadow: 0 0 0 2px rgba(0, 166, 81, 0.2);
}

.modal-card input[type="color"] {
    width: 48px;
    height: 32px;
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-sm);
    background: transparent;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}


/* ============== LAYER SIDE PANEL ============== */

.layer-side-panel {
    position: fixed;
    top: calc(var(--header-h, 56px) + 120px);
    left: calc(var(--sidebar-w, 320px) + 10px);
    width: 280px;
    background: var(--cge-dark-bg);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    overflow: hidden;
    transition: opacity 0.2s, transform 0.2s;
    color: #fff;
}

.layer-side-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-20px);
}

.layer-side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--cge-border-dark);
}

.layer-side-panel-header h3 {
    color: var(--cge-text-on-dark);
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.layer-side-panel-body {
    padding: 16px;
}

.layer-side-panel-body .input-group {
    margin-bottom: 12px;
}

.layer-side-panel-body label {
    display: block;
    color: var(--cge-text-subtle);
    font-size: 11px;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.layer-side-panel-body input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-sm);
    color: var(--cge-text-on-dark);
    font-size: 13px;
    font-family: var(--cge-font);
    outline: none;
    transition: var(--cge-transition);
}

.layer-side-panel-body input[type="text"]:focus {
    border-color: var(--cge-primary);
    box-shadow: 0 0 0 2px rgba(0, 166, 81, 0.2);
}

.layer-side-panel-body input[type="color"] {
    width: 40px;
    height: 28px;
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-sm);
    background: transparent;
    cursor: pointer;
}

.draw-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    margin-bottom: 14px;
    background: rgba(0, 166, 81, 0.15);
    border: 1px solid rgba(0, 166, 81, 0.3);
    border-radius: 20px;
    color: var(--cge-primary);
    font-size: 12px;
    font-weight: 600;
}

/* Slider rows in side panel and inline style */
.slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.style-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    outline: none;
}

.style-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--cge-primary);
    cursor: pointer;
}

.slider-val {
    color: var(--cge-text-subtle);
    font-size: 11px;
    min-width: 28px;
    text-align: right;
}

/* Layer item structure */
.my-layer-header {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.my-layer-toggle {
    margin-left: auto;
    opacity: 0.5;
    transition: var(--cge-transition);
}

.my-layer-item:hover .my-layer-toggle {
    opacity: 1;
}

/* Inline style panel (per-layer editing) */
.my-layer-style-panel {
    padding: 8px 8px 4px 24px;
    margin-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.my-layer-style-panel.hidden {
    display: none;
}

.style-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.style-row label {
    color: var(--cge-text-subtle);
    font-size: 11px;
    min-width: 55px;
}

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

.style-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--cge-primary);
    cursor: pointer;
}

.style-row input[type="color"] {
    width: 28px;
    height: 22px;
    border: 1px solid var(--cge-border-dark);
    border-radius: 3px;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.style-row .style-val {
    color: var(--cge-text-subtle);
    font-size: 11px;
    min-width: 24px;
    text-align: right;
}

/* ============== OL SCALE LINE ============== */

.ol-scale-line {
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--cge-radius-md);
    padding: 4px 8px;
}

.ol-scale-line-inner {
    border-color: #374151 !important;
    color: #111827 !important;
    font-size: 11px;
    font-family: var(--cge-font);
    font-weight: 600;
}

/* ============== OL ATTRIBUTION ============== */

.ol-attribution {
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--cge-radius-md);
}

.ol-attribution ul {
    color: #374151;
    font-size: 11px;
    text-shadow: none;
}

.ol-attribution ul a {
    color: var(--cge-primary);
}

.ol-attribution button {
    background: rgba(255, 255, 255, 0.85) !important;
    color: #374151 !important;
}

/* ============== PRINT PANEL ============== */

.print-panel {
    position: fixed;
    top: calc(var(--header-h) + 12px);
    right: 16px;
    width: 340px;
    max-width: 95vw;
    max-height: calc(100vh - var(--header-h) - 24px);
    background: var(--cge-dark-bg);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-lg);
    z-index: 500;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    animation: slideInRight 0.3s var(--cge-ease);
    overflow: hidden;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.print-panel-header .panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--cge-text-on-dark);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.print-panel-header .panel-title svg {
    color: var(--cge-primary);
}

.panel-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--cge-radius-sm);
    color: var(--cge-text-subtle);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--cge-transition);
}

.panel-close:hover {
    color: var(--cge-text-on-dark);
    border-color: var(--cge-border-dark);
    background: var(--cge-dark-hover);
}

.print-panel-body {
    overflow-y: auto;
    padding: 16px;
}

.print-panel-body .form-group.compact {
    margin-bottom: 14px;
}

.print-panel-body label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--cge-text-subtle);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.print-panel-body input[type="text"],
.print-panel-body input[type="number"],
.print-panel-body select {
    width: 100%;
    padding: 8px 10px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--cge-radius-sm);
    color: #fff;
    font-size: 13px;
    font-family: var(--cge-font);
    outline: none;
    transition: var(--cge-transition);
    color-scheme: dark;
}

.print-panel-body select option {
    background: #000;
    color: #fff;
}

.print-panel-body input:focus,
.print-panel-body select:focus {
    border-color: var(--cge-primary);
    box-shadow: 0 0 0 2px var(--cge-primary-dim);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.checkbox-group.compact {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--cge-text-on-dark);
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    accent-color: var(--cge-primary);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.print-preview-info.compact {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(0, 166, 81, 0.08);
    border: 1px solid rgba(0, 166, 81, 0.2);
    border-radius: var(--cge-radius-sm);
    color: var(--cge-text-subtle);
    font-size: 12px;
    line-height: 1.4;
    margin-top: 8px;
}

.print-preview-info.compact svg {
    flex-shrink: 0;
    color: var(--cge-primary);
    margin-top: 1px;
}

.print-panel-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--cge-border-dark);
    flex-shrink: 0;
}

.print-panel-footer .spacer {
    flex: 1;
}

.btn-primary {
    padding: 8px 20px;
    background: var(--cge-primary);
    color: #fff;
    border: none;
    border-radius: var(--cge-radius-pill);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--cge-font);
    cursor: pointer;
    transition: var(--cge-transition);
}

.btn-primary:hover {
    background: var(--cge-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--cge-shadow-green);
}

.btn-secondary {
    padding: 8px 16px;
    background: var(--cge-dark-surface);
    color: var(--cge-text-on-dark);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-pill);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--cge-font);
    cursor: pointer;
    transition: var(--cge-transition);
}

.btn-secondary:hover {
    background: var(--cge-dark-hover);
    border-color: var(--cge-primary);
}

.btn-icon-only {
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============== ASSISTANT PANEL ============== */

.assistant-panel {
    position: absolute;
    top: calc(var(--header-h) + 70px);
    right: 0;
    bottom: 0;
    width: var(--assistant-w);
    z-index: 50;
    display: flex !important;
    flex-direction: column;
    background: #ffffff;
    border-left: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
    overflow: hidden;
    min-width: 0;
}

.assistant-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    background: #f8faf9;
}

.assistant-panel-header .panel-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.assistant-panel-header .panel-title svg {
    color: var(--cge-primary);
}

/* ── Green title with orb ── */
.assistant-title-green {
    color: #00A651 !important;
    font-size: 17px !important;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.assistant-panel-header .ai-orb {
    width: 28px;
    height: 28px;
}

.assistant-panel-header .ai-orb__core {
    width: 24px;
    height: 24px;
}

/* ── Collapse button (replaces close ×) ── */
.assistant-collapse-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--cge-transition);
    flex-shrink: 0;
}

.assistant-collapse-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1a202c;
    border-color: #e2e8f0;
}

/* ── Expand strip (shown when assistant is collapsed) ── */
.assistant-expand-strip {
    position: absolute;
    top: calc(var(--header-h) + 70px);
    right: 0;
    bottom: 0;
    width: 44px;
    z-index: 50;
    background: #f8faf9;
    border-left: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 16px;
    gap: 6px;
    cursor: pointer;
}

.assistant-expand-strip:hover {
    background: #f0fdf4;
}

.assistant-expand-strip.hidden {
    display: none;
}

.assistant-expand-arrow {
    width: 40px;
    height: 40px;
    background: rgba(0, 166, 81, 0.08);
    border: 2px solid rgba(0, 166, 81, 0.25);
    color: var(--cge-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--cge-transition);
}

.assistant-expand-arrow:hover {
    background: rgba(0, 166, 81, 0.18);
    border-color: var(--cge-primary);
    transform: scale(1.08);
}

.assistant-expand-label {
    font-size: 10px;
    font-weight: 800;
    color: #00A651;
    letter-spacing: 1px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    margin-top: 4px;
}

/* Orb in strip — bigger and more visible */
.ai-orb--strip {
    width: 26px;
    height: 26px;
}

.ai-orb--strip .ai-orb__core {
    width: 22px;
    height: 22px;
    background: rgba(0, 166, 81, 0.2);
}

.ai-orb--strip .ai-orb__ring--2 {
    inset: -4px;
}

.ai-orb--strip .ai-orb__ring--3 {
    inset: -8px;
}

/* ── Collapsed state ── */
.app.assistant-collapsed .assistant-panel {
    display: none !important;
}

.app.assistant-collapsed .assistant-expand-strip {
    display: flex;
}

.assistant-panel-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.assistant-placeholder {
    text-align: center;
    color: #94a3b8;
}

.assistant-placeholder svg {
    color: rgba(0, 166, 81, 0.3);
    margin-bottom: 16px;
}

.assistant-placeholder p {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 8px;
}

.assistant-placeholder span {
    font-size: 14px;
    color: #64748b;
    display: block;
    padding: 8px 16px;
    background: rgba(0, 166, 81, 0.08);
    border-radius: var(--cge-radius-pill);
    margin-top: 12px;
}

/* ── AI Orb: animated icon ── */

.ai-orb {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-orb__ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 166, 81, 0.55);
    animation: orb-pulse 2.4s ease-in-out infinite;
}

.ai-orb__ring--2 {
    inset: -4px;
    border-color: rgba(0, 166, 81, 0.3);
    animation-delay: 0.8s;
}

.ai-orb__ring--3 {
    inset: -8px;
    border-color: rgba(0, 166, 81, 0.15);
    animation-delay: 1.6s;
}

@keyframes orb-pulse {

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

    50% {
        transform: scale(1.25);
        opacity: 0;
    }
}

.ai-orb__core {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 166, 81, 0.15);
    color: var(--cge-primary);
    animation: orb-spin 8s linear infinite;
}

@keyframes orb-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Stop spin on hover in panel header — feels responsive */
.assistant-panel-header:hover .ai-orb__core {
    animation-play-state: paused;
    background: rgba(0, 166, 81, 0.28);
}



.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal-card {
    background: var(--cge-dark-surface, #1a1f2e);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 24px;
    min-width: 340px;
    max-width: 420px;
    color: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.modal-desc {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    margin: 0 0 16px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ============== LAYER SELECT DIALOG ============== */

.layer-select-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
}

.layer-select-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 13px;
    font-family: var(--cge-font);
    text-align: left;
    width: 100%;
}

.layer-select-item:hover {
    background: rgba(0, 166, 81, 0.15);
    border-color: var(--cge-primary);
}

.layer-select-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.layer-select-icon {
    font-size: 14px;
    opacity: 0.7;
}

.layer-select-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layer-select-count {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

/* ============== LAYER SIDE PANEL ============== */

.layer-side-panel {
    position: fixed;
    top: calc(var(--header-h, 56px) + 120px);
    left: calc(var(--sidebar-w, 320px) + 10px);
    width: 280px;
    max-height: calc(100vh - var(--header-h, 56px) - 140px);
    background: var(--cge-dark-bg, #0d1117);
    border: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 1200;
    color: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease;
    border-radius: 12px;
    overflow: hidden;
}

.layer-side-panel-header .panel-close {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.layer-side-panel-header .panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ff6b6b;
}


.layer-side-panel.hidden {
    display: none;
}

.layer-side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.layer-side-panel-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.layer-side-panel-body {
    padding: 16px;
    overflow-y: auto;
}

.layer-side-panel-body .input-group {
    margin-bottom: 14px;
}

.layer-side-panel-body label {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
}

.layer-side-panel-body input[type="text"],
.layer-side-panel-body input[type="color"] {
    width: 100%;
    padding: 8px 10px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-family: var(--cge-font);
    outline: none;
}

.layer-side-panel-body input[type="color"] {
    height: 36px;
    cursor: pointer;
}

.layer-side-panel-body input:focus {
    border-color: var(--cge-primary);
}

/* ============== MY LAYER LIST ITEMS ============== */

.my-layers-empty {
    padding: 16px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    text-align: center;
}

.my-layer-item {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 3px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 12px;
    position: relative;
    overflow: visible;
    cursor: pointer;
}

.my-layer-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Aktywna warstwa zaznaczona w drzewku — cel dla "Rysuj X" w toolbar */
.my-layer-item.cge-layer-selected {
    background: rgba(0, 166, 81, 0.18);
    box-shadow: inset 3px 0 0 #00A651;
}
.my-layer-item.cge-layer-selected .my-layer-name {
    color: #00A651;
    font-weight: 600;
}

.my-layer-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.my-layer-icon {
    font-size: 12px;
    opacity: 0.6;
    flex-shrink: 0;
}

.my-layer-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    font-size: 12px;
    line-height: 22px;
}

.my-layer-count {
    color: rgba(255, 255, 255, 0.35);
    font-size: 10px;
    flex-shrink: 0;
}

.my-layers-count-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(0, 166, 81, 0.15);
    color: var(--cge-primary, #00a651);
    font-family: var(--cge-font-mono);
    letter-spacing: 0;
    text-transform: none;
    margin-left: 4px;
}

.my-layers-count-badge.warn {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.my-layers-count-badge.full {
    background: rgba(239, 68, 68, 0.22);
    color: #ef4444;
}

.my-layer-actions {
    display: none;
    gap: 3px;
    align-items: center;
    flex-shrink: 0;
    /* Popover pozycjonowany przez JS (position: fixed) — wychodzi ponad scrollowane
       containery (sidebar-section ma overflow: hidden, my-layers-list scroll). */
    position: fixed;
    z-index: 10000;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 7px;
    padding: 5px 7px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.my-layer-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    padding: 3px 5px;
    border-radius: 4px;
    transition: background 0.15s ease;
    line-height: 1;
    opacity: 0.85;
}

.my-layer-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    opacity: 1;
}

.my-layer-btn.del:hover {
    background: rgba(239, 68, 68, 0.25);
    opacity: 1;
}

/* Compact opacity slider inside the actions popover (service layers) */
.my-layer-actions .svc-opacity-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 3px 0 5px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    margin-left: 2px;
}

.my-layer-actions .svc-opacity-inline svg {
    color: rgba(255, 255, 255, 0.55);
    flex-shrink: 0;
    width: 12px;
    height: 12px;
}

.my-layer-actions .svc-opacity-slider {
    width: 68px;
    height: 12px;
    cursor: pointer;
    accent-color: var(--cge-primary, #00a651);
}

.my-layer-actions .svc-opacity-val {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    min-width: 28px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.my-layer-btn.save-local {
    color: #22c55e;
    font-size: 12px;
    animation: pulse-save 2s ease-in-out infinite;
}
.my-layer-btn.save-local:hover {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}
@keyframes pulse-save {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 1; }
}

/* Toast notifications */
.ul-toast {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    color: #fff;
    background: #1e293b;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    transition: opacity 0.4s ease;
    max-width: 360px;
    word-break: break-word;
}
.ul-toast-success { background: #166534; border-left: 4px solid #22c55e; }
.ul-toast-error   { background: #7f1d1d; border-left: 4px solid #ef4444; }
.ul-toast-warning { background: #713f12; border-left: 4px solid #f59e0b; }
.ul-toast-info    { background: #1e3a5f; border-left: 4px solid #3b82f6; }

/* ============== STYLE EDITOR ============== */

.style-editor-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.slider-row input[type="range"] {
    flex: 1;
    accent-color: var(--cge-primary, #00a651);
    height: 6px;
}

.slider-row span {
    min-width: 32px;
    text-align: right;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-variant-numeric: tabular-nums;
}

/* ============== DRAW TYPE BADGE ============== */

.draw-type-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--cge-primary-dim, rgba(0, 166, 81, 0.1));
    color: var(--cge-primary, #00a651);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 14px;
}

/* ============== BUTTONS ============== */

.btn-primary {
    padding: 8px 16px;
    background: var(--cge-primary, #00a651);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--cge-font);
}

.btn-primary:hover {
    background: #00b85c;
    transform: translateY(-1px);
}

.btn-secondary {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--cge-font);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ============== LAYER VISIBILITY & ICONS ============== */

/* .layer-vis-cb inherits from unified .sidebar input[type="checkbox"] */

.layer-geom-icon {
    flex-shrink: 0;
    vertical-align: middle;
}

.my-layer-name.dim {
    opacity: 0.35;
    text-decoration: line-through;
}

/* .my-layer-order and .order-btn — see unified rules above */

.my-layer-opacity-row {
    display: none;
    align-items: center;
    position: absolute;
    left: 0;
    right: 0;
    bottom: -22px;
    padding: 2px 8px 2px 28px;
    gap: 4px;
    background: rgba(30, 30, 40, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 10;
}

.my-layer-item:hover .my-layer-opacity-row {
    display: flex;
}

/* ============== CATEGORY TILE ROW & LAYERS LIST ============== */

.category-tile-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    background: color-mix(in srgb, var(--tile-color, #6B7280) 8%, var(--cge-dark-bg, #1a1f2e));
    border: 1.5px solid var(--tile-color, #6B7280);
    border-radius: 5px;
    margin-bottom: 3px;
    transition: background 0.15s ease, border-color 0.15s ease;
    color: rgba(255, 255, 255, 0.95);
    font-size: 12px;
    font-weight: 600;
}

.category-tile-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.category-tile-row.active {
    background: rgba(255, 255, 255, 0.04);
}

.category-tile-row svg:first-child {
    flex-shrink: 0;
    color: var(--tile-color, #6B7280);
    opacity: 0.8;
}

.category-tile-row span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.5;
}

.category-tile-row.active .tile-chevron {
    transform: rotate(180deg);
}

.layers-list {
    padding: 2px 4px 4px 4px;
    position: relative;
    z-index: 1;
}

.layers-list.hidden {
    display: none !important;
}

/* ============== ADD LAYER BUTTON & PICKER ============== */

.sidebar-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.add-layer-btn {
    background: rgba(0, 166, 81, 0.15);
    border: 1px solid rgba(0, 166, 81, 0.3);
    color: #00a651;
    font-size: 16px;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    line-height: 1;
}

.add-layer-btn:hover {
    background: rgba(0, 166, 81, 0.3);
    transform: scale(1.1);
}

.add-layer-picker {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.geom-pick-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--cge-font);
}

.geom-pick-btn:hover {
    background: rgba(14, 165, 233, 0.15);
    border-color: rgba(14, 165, 233, 0.3);
    color: #fff;
}

/* ============== IMPORT DIALOG OVERLAY (Buffer, Share) ============== */

.import-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.import-dialog {
    background: var(--cge-dark-surface);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-lg);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
    padding: 24px;
    width: 480px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s var(--cge-ease);
}

/* ============== PROJECT LAYER ITEMS ============== */

.category-add-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    margin-left: auto;
    background: rgba(0, 166, 81, 0.15);
    border: 1px solid rgba(0, 166, 81, 0.3);
    border-radius: 4px;
    color: var(--cge-primary, #00a651);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.category-tile-row:hover .category-add-btn {
    display: flex;
}

.category-add-btn:hover {
    background: rgba(0, 166, 81, 0.3);
    border-color: rgba(0, 166, 81, 0.5);
    transform: scale(1.1);
}

.project-layer-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0 4px 4px 0;
    padding: 4px 6px 4px 8px;
    margin-bottom: 1px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-left: 3px solid #6B7280;
    transition: all 0.15s ease;
    overflow: hidden;
}

.pl-main-row {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    min-height: 20px;
}

/* .pl-vis-cb inherits from unified .sidebar input[type="checkbox"] */

.pl-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.pl-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    font-size: 12px;
    line-height: 20px;
    color: rgba(255, 255, 255, 0.85);
}

.pl-name.dim {
    opacity: 0.35;
    text-decoration: line-through;
}

.pl-count {
    color: rgba(255, 255, 255, 0.3);
    font-size: 10px;
    flex-shrink: 0;
}

/* Compact inline opacity slider */
.pl-hover-actions .pl-opacity-slider {
    width: 45px;
    height: 3px;
    accent-color: var(--cge-primary, #00a651);
    cursor: pointer;
    flex-shrink: 0;
}

.pl-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    padding: 2px 3px;
    border-radius: 3px;
    transition: background 0.15s ease;
    line-height: 1;
    opacity: 0.7;
}

.pl-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    opacity: 1;
}

/* .pl-order-btn — see unified reorder rules above */

.pl-del-btn:hover {
    background: rgba(239, 68, 68, 0.2) !important;
}

/* ============== SHP DROP ZONE ============== */

.shp-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.shp-drop-zone:hover,
.shp-drop-zone.drag-over {
    border-color: var(--cge-primary, #00a651);
    background: rgba(0, 166, 81, 0.08);
}

.shp-drop-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.shp-drop-zone p {
    margin: 2px 0;
    font-size: 13px;
}

/* ============== IMPORT STATUS ============== */

.import-status {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    text-align: center;
}

.import-status.success {
    background: rgba(0, 166, 81, 0.1);
    color: var(--cge-primary, #00a651);
    border: 1px solid rgba(0, 166, 81, 0.25);
}

.import-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ============== SIDEBAR FLEX LAYOUT & RESIZE ============== */

.sidebar {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-h, 56px));
    overflow: hidden;
}

.sidebar-section {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-height: 36px;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-section>.sidebar-heading {
    flex-shrink: 0;
}

.sidebar-section>.category-tiles-stack,
.sidebar-section>.my-layers-list,
.sidebar-section>.basemap-list,
.sidebar-section>#geoportal-layers {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.sidebar-section>.category-tiles-stack::-webkit-scrollbar,
.sidebar-section>.my-layers-list::-webkit-scrollbar,
.sidebar-section>.basemap-list::-webkit-scrollbar,
.sidebar-section>#geoportal-layers::-webkit-scrollbar {
    width: 4px;
}

.sidebar-section>.category-tiles-stack::-webkit-scrollbar-thumb,
.sidebar-section>.my-layers-list::-webkit-scrollbar-thumb,
.sidebar-section>.basemap-list::-webkit-scrollbar-thumb,
.sidebar-section>#geoportal-layers::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Resize handles */

.sidebar-resize-handle {
    flex-shrink: 0;
    height: 4px;
    cursor: row-resize;
    background: transparent;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    transition: background 0.15s ease;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.active {
    background: rgba(0, 166, 81, 0.2);
    border-color: rgba(0, 166, 81, 0.4);
}

.sidebar-resize-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 2px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle.active::after {
    background: rgba(0, 166, 81, 0.5);
}

/* ===== AGENT AI PANEL (grid-based, defined earlier) ===== */

/* panel-header and panel-title defined earlier — kept for reference */

.assistant-header-actions {
    display: flex;
    gap: 6px;
}

.assistant-icon-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 5px;
    cursor: pointer;
    color: #4a5568;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.assistant-icon-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1a202c;
}

.assistant-icon-btn.active {
    color: #00A651;
    border-color: rgba(0, 166, 81, 0.3);
}

/* Model selector bar */
.assistant-model-bar {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.assistant-model-select {
    width: 100%;
    padding: 5px 10px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    background: #ffffff;
    color: #1a202c;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.assistant-model-select:hover {
    border-color: rgba(0, 166, 81, 0.4);
}

.assistant-model-select:focus {
    border-color: #00A651;
    box-shadow: 0 0 0 2px rgba(0, 166, 81, 0.15);
}

.assistant-model-select option {
    background: #ffffff;
    color: #1a202c;
    padding: 4px 8px;
}

.assistant-model-select optgroup {
    font-weight: 700;
    font-size: 12px;
    color: #555;
    padding: 4px 0;
}

.assistant-context-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(0, 166, 81, 0.08);
    border-bottom: 1px solid rgba(0, 166, 81, 0.2);
    font-size: 12px;
    color: #00A651;
    flex-shrink: 0;
}

.assistant-context-bar.hidden {
    display: none;
}

.assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.assistant-messages::-webkit-scrollbar {
    width: 4px;
}

.assistant-messages::-webkit-scrollbar-track {
    background: transparent;
}

.assistant-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 2px;
}

.assistant-msg {
    display: flex;
    flex-direction: column;
    max-width: 90%;
}

.assistant-msg--user {
    align-self: flex-end;
}

.assistant-msg--bot {
    align-self: flex-start;
}

.assistant-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.assistant-msg--user .assistant-bubble {
    background: #00A651;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.assistant-msg--bot .assistant-bubble {
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

.assistant-msg--error .assistant-bubble {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

/* Chat links */
.assistant-bubble a.chat-link {
    color: #1a73e8;
    text-decoration: underline;
    cursor: pointer;
}
.assistant-bubble a.chat-link:hover {
    color: #1557b0;
}
.assistant-msg--user .assistant-bubble a.chat-link {
    color: #bbf7d0;
}
.assistant-bubble code {
    background: rgba(0, 0, 0, 0.06);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
    color: #d6336c;
}

/* Thinking / loading message with pulsing bar */
.assistant-thinking-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}
.assistant-thinking-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 40%;
    background: linear-gradient(90deg, transparent, #22c55e, transparent);
    animation: thinkingBar 1.5s ease-in-out infinite;
}
@keyframes thinkingBar {
    0%   { left: -40%; }
    100% { left: 100%; }
}
.thinking-text {
    opacity: 1;
}
.thinking-dots {
    display: inline-flex;
    gap: 2px;
    margin-left: 4px;
}

/* Typing dots */
.typing-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #64748b;
    border-radius: 50%;
    margin: 0 2px;
    animation: typingPulse 1.2s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingPulse {

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

    50% {
        opacity: 1;
        transform: scale(1)
    }
}

/* ── Source documents — collapsible tab ── */
.assistant-sources {
    margin-top: 6px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.02);
}

.assistant-sources-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    color: #374151;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.assistant-sources-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1a202c;
}

.assistant-sources-toggle svg:first-child {
    flex-shrink: 0;
    opacity: 0.5;
}

.assistant-sources-label {
    color: #1a202c;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.assistant-sources-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: rgba(0, 166, 81, 0.2);
    color: #00A651;
    font-size: 10px;
    font-weight: 700;
}

.assistant-sources-chevron {
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.4;
}

.assistant-sources.expanded .assistant-sources-chevron {
    transform: rotate(180deg);
}

.assistant-sources-list {
    display: none;
    flex-direction: column;
    gap: 1px;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.assistant-sources.expanded .assistant-sources-list {
    display: flex;
}

/* Scrollbar styling */
.assistant-sources-list::-webkit-scrollbar {
    width: 4px;
}
.assistant-sources-list::-webkit-scrollbar-track {
    background: transparent;
}
.assistant-sources-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

.assistant-source-link {
    display: block;
    font-size: 12px;
    line-height: 1.4;
    color: #1a73e8;
    text-decoration: none;
    padding: 5px 10px;
    word-break: break-all;
    overflow-wrap: break-word;
    white-space: normal;
    transition: background 0.12s;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.assistant-source-link:last-child {
    border-bottom: none;
}

.assistant-source-link:hover {
    background: rgba(26, 115, 232, 0.06);
    text-decoration: underline;
}

.assistant-source-no-link {
    color: #555;
    cursor: default;
    pointer-events: none;
}

/* Inline citation chips in the assistant bubble — [1], [2], ... */
.assistant-bubble a.citation-chip {
    display: inline-block;
    padding: 0 5px;
    margin: 0 1px;
    font-size: 11px;
    font-weight: 600;
    color: #1a73e8;
    background: rgba(26, 115, 232, 0.10);
    border: 1px solid rgba(26, 115, 232, 0.25);
    border-radius: 10px;
    text-decoration: none;
    vertical-align: baseline;
    line-height: 1.5;
    transition: background 0.12s, color 0.12s;
}

.assistant-bubble a.citation-chip:hover {
    background: rgba(26, 115, 232, 0.20);
    color: #0d47a1;
}

/* Citation number prefix shown inside each source entry */
.assistant-source-num {
    display: inline-block;
    min-width: 26px;
    padding: 1px 5px;
    margin-right: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #1a73e8;
    background: rgba(26, 115, 232, 0.10);
    border-radius: 8px;
    vertical-align: middle;
}

/* Flash highlight when user clicks a [N] chip and scrolls to the source */
.assistant-source-highlight {
    animation: source-pulse 1.6s ease-out;
}

@keyframes source-pulse {
    0%   { background: rgba(255, 214, 0, 0.45); }
    100% { background: transparent; }
}

/* ── Document folder groups ── */
.assistant-source-folder {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.assistant-source-folder:last-child {
    border-bottom: none;
}
.assistant-source-folder-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 8px;
    background: rgba(0, 166, 81, 0.04);
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    text-align: left;
    transition: background 0.15s;
}
.assistant-source-folder-toggle:hover {
    background: rgba(0, 166, 81, 0.1);
}
.assistant-source-folder-toggle span:first-child {
    flex: 1;
}
.assistant-source-folder-toggle .assistant-sources-count {
    font-size: 10px;
    background: rgba(0, 0, 0, 0.08);
    color: #666;
    padding: 1px 5px;
    border-radius: 8px;
    font-weight: 500;
}
.assistant-source-folder-toggle .assistant-sources-chevron {
    transition: transform 0.2s;
}
.assistant-source-folder.folder-expanded .assistant-source-folder-toggle .assistant-sources-chevron {
    transform: rotate(180deg);
}
.assistant-source-folder-list {
    display: none;
    flex-direction: column;
    padding-left: 12px;
}
.assistant-source-folder.folder-expanded .assistant-source-folder-list {
    display: flex;
}

/* ── Agent routing badge ── */
.agent-badge {
    font-size: 10px;
    color: #059669;
    padding: 2px 8px;
    margin-bottom: 2px;
    letter-spacing: 0.3px;
    font-weight: 500;
}

/* Input area */
.assistant-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
    background: #fafbfc;
}

.assistant-input {
    flex: 1;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 9px 12px;
    color: #1e293b;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    max-height: 120px;
    overflow-y: auto;
}

.assistant-input:focus {
    border-color: #00A651;
    box-shadow: 0 0 0 2px rgba(0, 166, 81, 0.12);
}

.assistant-input::placeholder {
    color: #94a3b8;
}

.assistant-mic-btn,
.assistant-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.assistant-mic-btn {
    background: #f1f5f9;
    color: #64748b;
}

.assistant-mic-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.assistant-mic-btn.listening {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    animation: micPulse 1s infinite;
}

@keyframes micPulse {

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

    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0)
    }
}

.assistant-send-btn {
    background: #00A651;
    color: #fff;
}

.assistant-send-btn:hover {
    background: #009045;
}

.assistant-send-btn:disabled,
.assistant-mic-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Scrollbar thumb hover */
.assistant-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ── Agent Chips: klikalne wiersze listy wyników ── */

.agent-chips {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
    width: 100%;
}

/* Compact list-row chip */
.agent-chip--row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 5px 8px;
    background: rgba(0, 166, 81, 0.07);
    border: 1px solid rgba(0, 166, 81, 0.2);
    border-radius: 6px;
    color: var(--cge-primary, #00a651);
    font-size: 12px;
    font-family: var(--cge-font);
    cursor: pointer;
    text-align: left;
    transition: background 0.13s, border-color 0.13s;
    line-height: 1.3;
    box-sizing: border-box;
    min-height: 34px;
}

.agent-chip--row:hover {
    background: rgba(0, 166, 81, 0.18);
    border-color: var(--cge-primary, #00a651);
}

.agent-chip--row:active {
    transform: scale(0.99);
}

.agent-chip--row.agent-chip--active {
    background: rgba(0, 166, 81, 0.25);
    border-color: var(--cge-primary, #00a651);
    box-shadow: 0 0 0 2px rgba(0, 166, 81, 0.3);
}

/* Row number badge */
.agent-chip__num {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0, 166, 81, 0.25);
    color: var(--cge-primary, #00a651);
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.agent-chip__icon {
    flex-shrink: 0;
    font-size: 11px;
}

/* Info block: two lines */
.agent-chip__info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.agent-chip__primary {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-chip__secondary {
    font-size: 10px;
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Resize handle on left edge of assistant panel ── */

.assistant-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: ew-resize;
    background: rgba(0, 0, 0, 0.04);
    z-index: 20;
    transition: background 0.15s;
}

.assistant-resize-handle:hover {
    background: rgba(0, 166, 81, 0.3);
}

/* ===== PROJECT PROGRESS CHART ===== */

.assistant-progress-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: 1px solid rgba(0, 166, 81, 0.3);
    border-radius: 12px;
    background: rgba(0, 166, 81, 0.08);
    color: #00A651;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.assistant-progress-btn:hover {
    background: rgba(0, 166, 81, 0.15);
    border-color: #00A651;
}

.assistant-progress-panel {
    padding: 12px 16px;
    background: var(--cge-surface, #F8F9FA);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    max-height: 320px;
    overflow-y: auto;
}

.assistant-progress-panel.hidden {
    display: none;
}

.progress-loading, .progress-empty {
    text-align: center;
    color: #6b7280;
    font-size: 12px;
    padding: 8px 0;
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.progress-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a202c;
}

.progress-pct {
    font-size: 14px;
    font-weight: 800;
    color: #00A651;
}

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

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00A651, #4ade80);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-stages {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.progress-stage {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.progress-stage:hover {
    background: rgba(0, 0, 0, 0.04);
}

.progress-stage-icon {
    font-size: 14px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.progress-stage-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.progress-stage-name {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.progress-stage--completed .progress-stage-name {
    color: #059669;
}

.progress-stage--in_progress .progress-stage-name {
    color: #d97706;
}

.progress-stage--blocked .progress-stage-name {
    color: #dc2626;
}

.progress-stage--pending .progress-stage-name {
    color: #9ca3af;
}

.progress-stage-date {
    font-size: 10px;
    color: #9ca3af;
}

.progress-footer {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    text-align: center;
}

.progress-stages-count {
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
}

.progress-source {
    font-size: 10px;
    color: #9ca3af;
    margin-left: 8px;
}

.progress-sources {
    margin-top: 6px;
    padding-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.progress-sources-label {
    font-size: 10px;
    color: #9ca3af;
    margin-right: 2px;
}

.progress-source-file {
    font-size: 9px;
    color: #6b7280;
    background: rgba(0, 0, 0, 0.04);
    padding: 1px 6px;
    border-radius: 8px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Panel is now in grid — no overlay shift needed */

/* ===== PROJECT PROGRESS TIMELINE MODAL ===== */

.progress-modal-card {
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.progress-modal-card .modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 20px 24px;
}

.progress-modal-card .modal-header .modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Summary Section ── */

.tl-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--cge-border-dark);
}

.tl-summary-pct { flex-shrink: 0; }

.tl-circle-chart { width: 72px; height: 72px; }

.tl-circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 3;
}

.tl-circle-fill {
    fill: none;
    stroke: var(--cge-success);
    stroke-width: 3;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dasharray 0.6s ease;
}

.tl-circle-text {
    fill: var(--cge-text-on-dark);
    font-size: 9px;
    font-weight: 700;
    text-anchor: middle;
    font-family: var(--cge-font);
}

.tl-summary-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
}

.tl-stat {
    font-size: 12px;
    color: var(--cge-text-subtle);
}

.tl-stat-num {
    font-weight: 700;
    font-size: 14px;
    margin-right: 4px;
}

.tl-stat--completed   { color: var(--cge-success); }
.tl-stat--in_progress { color: var(--cge-warning); }
.tl-stat--blocked     { color: var(--cge-error); }
.tl-stat--pending     { color: var(--cge-text-subtle); }

/* ── Timeline Vertical Layout ── */

.tl-timeline {
    display: flex;
    flex-direction: column;
}

.tl-node {
    display: flex;
    gap: 16px;
    min-height: 64px;
}

.tl-node-track {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 20px;
    flex-shrink: 0;
    padding-top: 2px;
}

.tl-node-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--cge-text-subtle);
    background: var(--cge-dark-surface);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    transition: all 0.3s var(--cge-ease);
}

.tl-node-line {
    width: 2px;
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    margin-top: 2px;
}

/* Status-specific dot colors */
.tl-node--completed .tl-node-dot {
    border-color: var(--cge-success);
    background: var(--cge-success);
    box-shadow: 0 0 8px rgba(0, 166, 81, 0.4);
}
.tl-node--completed .tl-node-line {
    background: var(--cge-success);
}

.tl-node--in_progress .tl-node-dot {
    border-color: var(--cge-warning);
    background: var(--cge-warning);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    animation: tl-pulse 2s ease-in-out infinite;
}

.tl-node--blocked .tl-node-dot {
    border-color: var(--cge-error);
    background: var(--cge-error);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.tl-node--pending .tl-node-dot {
    border-color: rgba(255, 255, 255, 0.15);
    background: transparent;
}
.tl-node--pending .tl-node-line {
    background: rgba(255, 255, 255, 0.05);
}

@keyframes tl-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(245, 158, 11, 0.3); }
    50%      { box-shadow: 0 0 12px rgba(245, 158, 11, 0.6); }
}

/* ── Node Info Card ── */

.tl-node-card {
    flex: 1;
    padding: 8px 12px 12px;
    border-radius: var(--cge-radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: all 0.2s var(--cge-ease);
    margin-bottom: 4px;
}

.tl-node--completed .tl-node-card {
    border-color: rgba(0, 166, 81, 0.15);
}
.tl-node--in_progress .tl-node-card {
    border-color: rgba(245, 158, 11, 0.2);
    background: rgba(245, 158, 11, 0.04);
}
.tl-node--blocked .tl-node-card {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.04);
}
.tl-node--pending .tl-node-card {
    opacity: 0.5;
}

.tl-node-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.tl-node-icon { font-size: 16px; flex-shrink: 0; }

.tl-node-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--cge-text-on-dark);
    flex: 1;
}
.tl-node--pending .tl-node-name {
    color: var(--cge-text-subtle);
}

/* ── Status Badge ── */

.tl-node-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--cge-radius-pill);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tl-badge--completed {
    color: var(--cge-success);
    background: rgba(0, 166, 81, 0.12);
}
.tl-badge--in_progress {
    color: var(--cge-warning);
    background: rgba(245, 158, 11, 0.12);
}
.tl-badge--blocked {
    color: var(--cge-error);
    background: rgba(239, 68, 68, 0.12);
}
.tl-badge--pending {
    color: var(--cge-text-subtle);
    background: rgba(255, 255, 255, 0.05);
}

/* ── Date & Duration ── */

.tl-node-dates {
    display: block;
    font-size: 11px;
    color: var(--cge-text-subtle);
    margin-bottom: 2px;
}

.tl-node-duration {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: var(--cge-text-subtle);
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
}

.tl-node-doccount {
    display: inline-block;
    font-size: 10px;
    color: var(--cge-text-subtle);
    background: rgba(255, 255, 255, 0.04);
    padding: 1px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
}

.tl-node-details {
    font-size: 11px;
    color: var(--cge-text-subtle);
    margin: 4px 0 0;
    line-height: 1.4;
}

/* ── Footer ── */

.progress-modal-card .modal-footer {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    padding: 10px 24px;
}

.tl-footer-source { color: var(--cge-text-subtle); }

.tl-footer-docs {
    color: var(--cge-text-subtle);
    cursor: help;
    border-bottom: 1px dotted var(--cge-text-subtle);
}

.tl-footer-hint {
    display: block;
    font-size: 10px;
    color: var(--cge-text-subtle);
    opacity: 0.7;
    margin-top: 2px;
}

/* ── Loading & Empty ── */

.progress-loading,
.progress-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--cge-text-subtle);
    font-size: 13px;
}

/* ── Expandable Document Lists ── */

.tl-node-docs-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--cge-accent);
    background: rgba(59, 130, 246, 0.08);
    border: none;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s var(--cge-ease);
    margin-bottom: 2px;
}
.tl-node-docs-toggle:hover {
    background: rgba(59, 130, 246, 0.16);
}
.tl-node-docs-toggle .arrow {
    font-size: 8px;
    transition: transform 0.2s var(--cge-ease);
}
.tl-node-docs-toggle.open .arrow {
    transform: rotate(90deg);
}

.tl-node-docs-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-top: 0;
}
.tl-node-docs-list.open {
    max-height: 220px;
    overflow-y: auto;
    margin-top: 6px;
}

.tl-doc-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 11px;
}
.tl-doc-item:last-child { border-bottom: none; }

.tl-doc-date {
    flex-shrink: 0;
    font-size: 10px;
    color: var(--cge-text-subtle);
    font-variant-numeric: tabular-nums;
    min-width: 68px;
}

.tl-doc-name {
    color: var(--cge-text-on-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.tl-doc-name a {
    color: var(--cge-accent);
    text-decoration: none;
}
.tl-doc-name a:hover {
    text-decoration: underline;
}

.tl-node-no-docs {
    font-size: 11px;
    font-style: italic;
    color: var(--cge-text-subtle);
    opacity: 0.7;
    margin-top: 2px;
}

/* ── Document Timeline SVG Chart ── */

.tl-doc-timeline {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--cge-border-dark);
}
.tl-doc-timeline-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--cge-text-on-dark);
    margin-bottom: 8px;
}

.tl-chart-svg {
    width: 100%;
    height: auto;
}
.tl-chart-dot {
    transition: r 0.15s ease;
    cursor: default;
}
.tl-chart-dot:hover {
    r: 6;
}

.tl-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 8px;
    padding: 6px 0;
}
.tl-chart-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--cge-text-subtle);
}
.tl-chart-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Unassigned Documents Section ── */

.tl-unassigned {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.tl-unassigned-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--cge-text-subtle);
    margin-bottom: 6px;
}

/* ── Responsive ── */

@media (max-width: 600px) {
    .progress-modal-card { max-width: 95vw !important; }
    .tl-summary { flex-direction: column; align-items: flex-start; gap: 12px; }
    .tl-node-card { padding: 6px 8px 10px; }
    .tl-doc-timeline { display: none; }
}

@media (max-width: 768px) {
    .tl-doc-timeline { display: none; }
    .header-btn span { display: none; }
    .header-btn { padding: 8px; }
}

/* layer-side-panel uses left positioning, no right override needed */

/* ================================================================== */
/* ADMIN FEEDBACK PANEL                                                */
/* ================================================================== */

/* Admin-only button visibility */
.admin-only-btn {
    display: none !important;
}

body.is-admin .admin-only-btn {
    display: inline-flex !important;
}

/* Admin card — wider modal */
.fb-admin-card {
    max-width: 720px !important;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.fb-admin-card .modal-header {
    flex-shrink: 0;
}

.fb-count-badge {
    background: var(--cge-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

/* Filters bar */
.fb-admin-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--cge-border-dark);
    flex-shrink: 0;
}

.fb-filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fb-filter-label {
    font-size: 11px;
    color: var(--cge-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 2px;
}

.fb-filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--cge-border-dark);
    color: var(--cge-text-subtle);
    padding: 4px 10px;
    border-radius: var(--cge-radius-pill);
    font-size: 11px;
    font-family: var(--cge-font);
    cursor: pointer;
    transition: all 0.15s ease;
}

.fb-filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--cge-text-on-dark);
}

.fb-filter-btn.active {
    background: var(--cge-primary);
    border-color: var(--cge-primary);
    color: #fff;
}

/* Scrollable body */
.fb-admin-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding: 16px 24px !important;
}

/* Feedback list */
.fb-admin-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fb-loading,
.fb-empty {
    text-align: center;
    color: var(--cge-text-subtle);
    font-size: 13px;
    padding: 40px 0;
}

/* Individual feedback card */
.fb-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--cge-border-dark);
    border-radius: var(--cge-radius-md);
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.fb-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.fb-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.fb-type {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--cge-text-on-dark);
}

.fb-date {
    font-size: 11px;
    color: var(--cge-text-subtle);
}

.fb-card-body {
    padding: 12px 14px;
}

.fb-description {
    font-size: 13px;
    color: var(--cge-text-on-dark);
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 120px;
    overflow-y: auto;
}

.fb-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    gap: 10px;
}

.fb-author {
    font-size: 11px;
    color: var(--cge-text-subtle);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

.fb-status-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.fb-status-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--cge-radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.fb-status-new {
    background: rgba(59, 130, 246, 0.15);
    color: #60A5FA;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.fb-status-reviewed {
    background: rgba(250, 204, 21, 0.15);
    color: #FACC15;
    border: 1px solid rgba(250, 204, 21, 0.3);
}

.fb-status-resolved {
    background: rgba(0, 166, 81, 0.15);
    color: #00A651;
    border: 1px solid rgba(0, 166, 81, 0.3);
}

.fb-status-rejected {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.fb-status-select {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--cge-border-dark);
    color: var(--cge-text-on-dark);
    border-radius: var(--cge-radius-sm);
    font-size: 11px;
    font-family: var(--cge-font);
    cursor: pointer;
}

.fb-status-select:focus {
    outline: none;
    border-color: var(--cge-primary);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .fb-admin-card {
        max-width: 100% !important;
        max-height: 95vh;
        border-radius: 12px;
    }
    .fb-admin-filters {
        flex-direction: column;
        gap: 8px;
        padding: 10px 16px;
    }
    .fb-card-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   LAND SEARCH — AI Agents Panel (Dark Theme — matching mockup)
   ═══════════════════════════════════════════════════════════════════════ */

/* CSS Variables for Land Search dark theme */
.ls-panel {
    --ls-primary: #00A651;
    --ls-primary-hover: rgba(0, 166, 81, 0.9);
    --ls-primary-dim: rgba(0, 166, 81, 0.12);
    --ls-secondary: #0066CC;
    --ls-secondary-dim: rgba(0, 102, 204, 0.12);
    --ls-dark-bg: #111827;
    --ls-dark-surface: #1F2937;
    --ls-dark-hover: #2d3748;
    --ls-text-subtle: #9CA3AF;
    --ls-text-on-dark: #FFFFFF;
    --ls-border-dark: rgba(255, 255, 255, 0.1);
    --ls-success: #00A651;
    --ls-warning: #F59E0B;
    --ls-error: #EF4444;
    --ls-info: #0066CC;
    --ls-radius-sm: 8px;
    --ls-radius-md: 12px;
    --ls-radius-lg: 16px;

    position: fixed;
    inset: 0;
    background: var(--ls-dark-bg);
    color: var(--ls-text-on-dark);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    font-family: "DM Sans", system-ui, sans-serif;
    line-height: 1.6;
    overflow: hidden;
}
.ls-panel.hidden { display: none !important; }

/* Scrollbar */
.ls-panel ::-webkit-scrollbar { width: 5px; }
.ls-panel ::-webkit-scrollbar-track { background: transparent; }
.ls-panel ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

/* Header bar */
.ls-header {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 1.5rem;
    gap: 1rem;
    background: rgba(17,24,39,0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--ls-border-dark);
    flex-shrink: 0;
}
.ls-header-logo { font-weight: 700; font-size: 1.05rem; color: var(--ls-primary); white-space: nowrap; }
.ls-header-logo span { color: var(--ls-text-on-dark); font-weight: 400; }
.ls-header-title { font-size: 0.95rem; font-weight: 600; color: var(--ls-primary); }
.ls-header-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.ls-nav-link { padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 0.82rem; font-weight: 500; color: var(--ls-text-subtle); background: transparent; border: 1px solid transparent; transition: all 0.2s; white-space: nowrap; }
.ls-nav-link:hover { color: var(--ls-text-on-dark); background: var(--ls-dark-hover); }
.ls-nav-link.active { color: var(--ls-primary); background: var(--ls-primary-dim); border-color: rgba(0,166,81,0.3); }
.ls-close { background: none; border: 1px solid var(--ls-border-dark); color: var(--ls-text-subtle); font-size: 18px; cursor: pointer; line-height: 1; padding: 6px 10px; border-radius: 8px; transition: all 0.2s; }
.ls-close:hover { color: var(--ls-text-on-dark); background: var(--ls-dark-hover); }

/* Body */
.ls-body { flex: 1; overflow-y: auto; padding: 1.5rem 2rem 3rem; max-width: 1400px; margin: 0 auto; width: 100%; }

/* Section title */
.ls-section-title { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.4rem; }
.ls-section-subtitle { color: var(--ls-text-subtle); margin-bottom: 1.5rem; font-size: 0.95rem; }

/* Agent Panel */
.ls-ap { background: var(--ls-dark-surface); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-lg); overflow: hidden; }
.ls-ap-head { padding: 16px 20px; border-bottom: 1px solid var(--ls-border-dark); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.ls-ap-title { font-size: 1.1rem; font-weight: 700; }
.ls-inline-edit { background: transparent; border: 1px solid transparent; color: var(--ls-text); padding: 2px 6px; border-radius: 4px; font-family: inherit; transition: border-color .2s; }
.ls-inline-edit:hover { border-color: var(--ls-border); }
.ls-inline-edit:focus { border-color: var(--ls-primary); outline: none; background: rgba(255,255,255,.05); }
.ls-ap-title-input { font-size: 1.1rem; font-weight: 700; width: 100%; }
.ls-inline-sm { font-size: 0.78rem; padding: 2px 6px; }
.ls-ap-body { padding: 20px; }

/* Agent grid */
.ls-ag { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }

/* Agent card */
.ls-ac { background: rgba(255,255,255,0.03); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md); padding: 16px; cursor: pointer; transition: all 0.2s; position: relative; }
.ls-ac:hover { border-color: rgba(0,166,81,0.4); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.ls-ac-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: 10px; }
.ls-ac-icon.pv { background: rgba(245,158,11,0.15); }
.ls-ac-icon.wind { background: rgba(139,92,246,0.15); }
.ls-ac-icon.bio { background: rgba(0,166,81,0.15); }
.ls-ac-icon.biogas { background: rgba(0,166,81,0.15); }
.ls-ac-icon.ev { background: rgba(59,130,246,0.15); }
.ls-ac-icon.dc { background: rgba(239,68,68,0.15); }
.ls-ac-icon.datacenter { background: rgba(239,68,68,0.15); }
.ls-ac-icon.cable { background: rgba(236,72,153,0.15); }
.ls-ac-icon.custom { background: rgba(139,92,246,0.15); }
.ls-ac-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 3px; }
.ls-ac-desc { font-size: 0.82rem; color: var(--ls-text-subtle); line-height: 1.4; }
.ls-ac-badge { position: absolute; top: 10px; right: 10px; padding: 2px 8px; border-radius: 100px; font-size: 0.68rem; font-weight: 600; }
.ls-badge-t { background: rgba(0,166,81,0.15); color: var(--ls-primary); }
.ls-badge-u { background: rgba(59,130,246,0.15); color: #3B82F6; }
.ls-ac-hist { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--ls-border-dark); }
.ls-ac-hist-item { font-size: 0.78rem; color: var(--ls-text-subtle); padding: 3px 0; display: flex; justify-content: space-between; align-items: center; }
.ls-ac-hist-item:hover { color: var(--ls-text-on-dark); }
.ls-ac-hist-count { font-size: 0.72rem; background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 4px; }

/* New agent card (dashed) */
.ls-btn-new-card { display: flex; align-items: center; justify-content: center; gap: 8px; background: rgba(255,255,255,0.03); border: 2px dashed var(--ls-border-dark); border-radius: var(--ls-radius-md); padding: 30px 16px; cursor: pointer; font-size: 0.9rem; color: var(--ls-text-subtle); transition: all 0.2s; min-height: 140px; }
.ls-btn-new-card:hover { border-color: var(--ls-primary); color: var(--ls-primary); }

/* Buttons */
.ls-btn { padding: 9px 18px; border-radius: 8px; font-family: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; }
.ls-btn-p { background: var(--ls-primary); color: #fff; }
.ls-btn-p:hover { background: var(--ls-primary-hover); box-shadow: 0 4px 12px rgba(0,166,81,0.3); }
.ls-btn-s { background: rgba(255,255,255,0.06); color: var(--ls-text-on-dark); border: 1px solid var(--ls-border-dark); }
.ls-btn-s:hover { background: var(--ls-dark-hover); }
.ls-btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.ls-btn-g { display: flex; gap: 8px; justify-content: flex-end; padding-top: 6px; }

/* Creator */
.ls-cr { background: var(--ls-dark-surface); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-lg); max-width: 960px; }
.ls-cr-head { padding: 16px 20px; border-bottom: 1px solid var(--ls-border-dark); display: flex; align-items: center; gap: 10px; }
.ls-cr-head h3 { font-size: 1.05rem; font-weight: 700; }
.ls-cr-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.ls-fr { display: flex; gap: 14px; }
.ls-fg { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.ls-fl { font-size: 0.82rem; font-weight: 500; color: var(--ls-text-subtle); }
.ls-fi, .ls-fs, .ls-ft { background: rgba(255,255,255,0.05); border: 1px solid var(--ls-border-dark); border-radius: 8px; padding: 9px 12px; color: var(--ls-text-on-dark); font-family: inherit; font-size: 0.88rem; width: 100%; }
.ls-fi:focus, .ls-fs:focus, .ls-ft:focus { outline: none; border-color: var(--ls-primary); }
.ls-fs option { background: var(--ls-dark-surface); color: var(--ls-text-on-dark); }
.ls-ft { min-height: 70px; resize: vertical; }
.ls-fs { cursor: pointer; }

/* Criteria section */
.ls-cs { background: rgba(255,255,255,0.02); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md); padding: 16px; }
.ls-cs-title { font-size: 0.92rem; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.ls-cs-sub { font-size: 0.85rem; font-weight: 600; color: var(--ls-info); margin: 12px 0 8px; padding-bottom: 4px; border-bottom: 1px solid rgba(0,102,204,0.2); display: flex; align-items: center; gap: 8px; }

/* WFS URL list (multi-county support) */
.ls-wfs-urls { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.ls-wfs-url-row { display: flex; gap: 6px; align-items: center; }
.ls-wfs-url-row .ls-fi { flex: 1; background: rgba(255,255,255,0.05); color: var(--ls-text-on-dark); }
.ls-wfs-url-remove { background: none; border: 1px solid rgba(255,80,80,0.3); color: rgba(255,80,80,0.7); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; transition: all 0.15s; flex-shrink: 0; }
.ls-wfs-url-remove:hover { background: rgba(255,80,80,0.15); color: #ff5050; border-color: #ff5050; }
.ls-wfs-url-add { background: none; border: 1px dashed var(--ls-border-dark); color: var(--ls-text-subtle); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 0.82rem; margin-top: 4px; transition: all 0.15s; width: 100%; }
.ls-wfs-url-add:hover { border-color: var(--ls-primary); color: var(--ls-primary); background: rgba(0,102,204,0.05); }

/* Criterion row */
.ls-cr-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; flex-wrap: wrap; }
.ls-cr-label { font-size: 0.83rem; min-width: 180px; }
.ls-cr-opts { display: flex; gap: 3px; flex-wrap: wrap; }
.ls-cr-opt { padding: 3px 9px; border-radius: 5px; font-size: 0.76rem; font-weight: 500; cursor: pointer; border: 1px solid var(--ls-border-dark); color: var(--ls-text-subtle); background: transparent; transition: all 0.12s; white-space: nowrap; }
.ls-cr-opt.sel { background: var(--ls-primary-dim); color: var(--ls-primary); border-color: rgba(0,166,81,0.4); }
.ls-cr-opt.sel-r { background: rgba(239,68,68,0.12); color: var(--ls-error); border-color: rgba(239,68,68,0.4); }
.ls-cr-opt.sel-y { background: rgba(245,158,11,0.12); color: var(--ls-warning); border-color: rgba(245,158,11,0.4); }
.ls-cr-skip { padding: 3px 9px; border-radius: 5px; font-size: 0.73rem; cursor: pointer; border: 1px dashed rgba(156,163,175,0.3); color: var(--ls-text-subtle); background: transparent; transition: all 0.12s; font-style: italic; margin-left: auto; }
.ls-cr-skip:hover { border-color: var(--ls-warning); color: var(--ls-warning); }
.ls-cr-skip.active { background: rgba(245,158,11,0.1); border-color: var(--ls-warning); color: var(--ls-warning); border-style: solid; }

/* Slider skip toggle — large, clear chip */
.ls-cr-skip-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 6px;
    border: 1.5px solid #22c55e;
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    user-select: none;
    flex-shrink: 0;
}
.ls-cr-skip-toggle::before {
    content: '✓';
    font-size: 0.65rem;
}
.ls-cr-skip-toggle:hover {
    background: rgba(34, 197, 94, 0.25);
}
/* Skipped state */
[data-skip-wrap].ls-skipped .ls-cr-skip-toggle {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    pointer-events: auto;
    cursor: pointer;
    opacity: 1;
    position: relative;
    z-index: 2;
}
[data-skip-wrap].ls-skipped .ls-cr-skip-toggle::before {
    content: '✕';
}
[data-skip-wrap].ls-skipped {
    opacity: 0.45;
}
[data-skip-wrap].ls-skipped .ls-sl-top {
    opacity: 1;
}
[data-skip-wrap].ls-skipped input[type="range"] {
    pointer-events: none;
}
[data-skip-wrap].ls-skipped .ls-sl-val {
    text-decoration: line-through;
    opacity: 0.5;
}
.ls-cr-del { width: 20px; height: 20px; border-radius: 5px; border: 1px solid rgba(239,68,68,0.2); background: transparent; color: var(--ls-text-subtle); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; transition: all 0.12s; flex-shrink: 0; }
.ls-cr-del:hover { border-color: var(--ls-error); color: var(--ls-error); background: rgba(239,68,68,0.08); }

/* Scoring mode toggle */
.ls-scoring-toggle { display: flex; gap: 2px; background: rgba(255,255,255,0.03); border: 1px solid var(--ls-border-dark); border-radius: 8px; padding: 2px; margin-bottom: 14px; }
.ls-scoring-toggle-opt { flex: 1; padding: 8px 14px; border-radius: 6px; text-align: center; cursor: pointer; font-size: 0.82rem; font-weight: 500; color: var(--ls-text-subtle); transition: all 0.15s; border: 1px solid transparent; }
.ls-scoring-toggle-opt.active-hard { background: rgba(239,68,68,0.12); color: var(--ls-error); border-color: rgba(239,68,68,0.3); }
.ls-scoring-toggle-opt.active-score { background: rgba(0,102,204,0.12); color: var(--ls-info); border-color: rgba(0,102,204,0.3); }

/* Soil toggles */
.ls-soil-toggle { padding: 5px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; cursor: pointer; border: 1px solid var(--ls-border-dark); color: var(--ls-text-subtle); background: transparent; transition: all 0.15s; min-width: 36px; text-align: center; }
.ls-soil-toggle:hover { border-color: rgba(239,68,68,0.4); color: var(--ls-error); }
.ls-soil-toggle.excluded { background: rgba(239,68,68,0.15); color: var(--ls-error); border-color: rgba(239,68,68,0.5); }

/* Slider */
.ls-sl { display: flex; flex-direction: column; gap: 3px; }
.ls-sl-top { font-size: 0.82rem; color: var(--ls-text-subtle); display: flex; justify-content: space-between; align-items: center; }
.ls-sl-val { color: var(--ls-primary); font-weight: 600; }
.ls-panel input[type="range"] { -webkit-appearance: none; width: 100%; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.1); outline: none; }
.ls-panel input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--ls-primary); cursor: pointer; border: 2px solid var(--ls-dark-surface); }

/* Mode selector */
.ls-mode { display: flex; gap: 10px; padding: 3px; background: rgba(255,255,255,0.03); border-radius: 10px; border: 1px solid var(--ls-border-dark); }
.ls-mode-opt { flex: 1; padding: 10px 14px; border-radius: 8px; cursor: pointer; text-align: center; transition: all 0.2s; border: 1px solid transparent; }
.ls-mode-opt.sel { background: var(--ls-primary-dim); border-color: rgba(0,166,81,0.4); }
.ls-mode-t { font-weight: 600; font-size: 0.88rem; margin-bottom: 1px; }
.ls-mode-d { font-size: 0.76rem; color: var(--ls-text-subtle); }

/* NLP Generator */
.ls-ccg { background: rgba(139,92,246,0.04); border: 1px solid rgba(139,92,246,0.2); border-radius: var(--ls-radius-md); padding: 16px; margin-top: 4px; }
.ls-ccg-title { font-size: 0.88rem; font-weight: 600; color: #A78BFA; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.ls-ccg-input-wrap { display: flex; gap: 8px; margin-bottom: 14px; }
.ls-ccg-input { flex: 1; background: rgba(255,255,255,0.05); border: 1px solid rgba(139,92,246,0.3); border-radius: 8px; padding: 10px 14px; color: var(--ls-text-on-dark); font-family: inherit; font-size: 0.85rem; resize: none; min-height: 42px; }
.ls-ccg-input:focus { outline: none; border-color: #A78BFA; box-shadow: 0 0 0 2px rgba(139,92,246,0.15); }
.ls-ccg-input::placeholder { color: rgba(156,163,175,0.6); }
.ls-ccg-submit { padding: 10px 16px; border-radius: 8px; background: rgba(139,92,246,0.15); border: 1px solid rgba(139,92,246,0.4); color: #A78BFA; font-family: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: all 0.15s; display: flex; align-items: center; gap: 5px; }
.ls-ccg-submit:hover { background: rgba(139,92,246,0.25); }
.ls-ccg-tpl { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ls-ccg-tpl-btn { padding: 4px 10px; border-radius: 6px; border: 1px dashed rgba(139,92,246,0.25); background: transparent; color: var(--ls-text-subtle); cursor: pointer; font-family: inherit; font-size: 0.75rem; transition: all 0.12s; }
.ls-ccg-tpl-btn:hover { border-color: #A78BFA; color: #A78BFA; border-style: solid; background: rgba(139,92,246,0.06); }
.ls-ccg-ai-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 0.68rem; color: #A78BFA; background: rgba(139,92,246,0.1); padding: 1px 6px; border-radius: 3px; font-weight: 600; }
.ls-ccg-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.ls-ccg-card { background: rgba(255,255,255,0.03); border: 1px solid var(--ls-border-dark); border-radius: 10px; padding: 12px 14px; position: relative; transition: all 0.15s; }
.ls-ccg-card:hover { border-color: rgba(139,92,246,0.3); }
.ls-ccg-card-head { display: flex; align-items: flex-start; gap: 10px; }
.ls-ccg-card-icon { width: 32px; height: 32px; border-radius: 8px; background: rgba(139,92,246,0.12); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.85rem; }
.ls-ccg-card-body { flex: 1; }
.ls-ccg-card-label { font-weight: 600; font-size: 0.85rem; margin-bottom: 2px; }
.ls-ccg-card-detail { font-size: 0.78rem; color: var(--ls-text-subtle); line-height: 1.4; }
.ls-ccg-card-source { display: inline-flex; align-items: center; gap: 3px; font-size: 0.7rem; color: #A78BFA; background: rgba(139,92,246,0.08); padding: 1px 7px; border-radius: 4px; margin-top: 4px; }
.ls-ccg-card-actions { display: flex; gap: 4px; margin-left: auto; flex-shrink: 0; }
.ls-ccg-card-btn { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--ls-border-dark); background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; transition: all 0.12s; color: var(--ls-text-subtle); }
.ls-ccg-card-btn:hover { background: rgba(255,255,255,0.06); }
.ls-ccg-card-btn.del { color: var(--ls-error); border-color: rgba(239,68,68,0.2); }
.ls-ccg-card-btn.del:hover { background: rgba(239,68,68,0.1); }
.ls-ccg-card-btn.promote { color: var(--ls-primary); border-color: rgba(0,166,81,0.2); font-size: 0.7rem; }
.ls-ccg-card-btn.promote:hover { background: rgba(0,166,81,0.15); }

/* Official custom criteria list */
.ls-custom-criteria { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; padding: 8px; background: rgba(0,166,81,0.04); border: 1px dashed rgba(0,166,81,0.2); border-radius: 8px; min-height: 32px; }
.ls-cc-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: rgba(255,255,255,0.04); border-radius: 6px; font-size: 0.8rem; transition: all 0.3s; }
.ls-cc-item:hover { background: rgba(255,255,255,0.08); }
.ls-cc-item.skipped { opacity: 0.4; text-decoration: line-through; }
.ls-cc-icon { font-size: 0.8rem; min-width: 20px; text-align: center; }
.ls-cc-label { flex: 1; font-weight: 500; }
.ls-cc-detail { font-size: 0.7rem; color: var(--ls-text-subtle); }
.ls-cc-skip, .ls-cc-del { width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--ls-border-dark); background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; color: var(--ls-text-subtle); transition: all 0.12s; }
.ls-cc-skip:hover { background: rgba(245,158,11,0.12); color: var(--ls-warning); }
.ls-cc-del { color: var(--ls-error); border-color: rgba(239,68,68,0.15); }
.ls-cc-del:hover { background: rgba(239,68,68,0.1); }
.ls-ccg-card-btn.promote:hover { background: rgba(0,166,81,0.1); border-color: rgba(0,166,81,0.4); }

/* Promoted criteria */
.ls-cr-promoted { background: rgba(139,92,246,0.04); border: 1px solid rgba(139,92,246,0.2); border-radius: 8px; padding: 8px 12px; margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ls-cr-promoted-label { font-size: 0.83rem; font-weight: 600; flex: 1; }
.ls-cr-promoted-badge { font-size: 0.65rem; background: rgba(139,92,246,0.12); color: #A78BFA; padding: 1px 6px; border-radius: 3px; font-weight: 600; }

/* Data source badge */
.ls-cr-source { display: inline-flex; align-items: center; gap: 3px; font-size: 0.68rem; color: var(--ls-info); background: rgba(0,102,204,0.06); padding: 2px 8px; border-radius: 4px; cursor: pointer; border: 1px solid transparent; transition: all 0.15s; margin-left: 4px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-cr-source:hover { border-color: rgba(0,102,204,0.3); background: rgba(0,102,204,0.1); }
/* overridden below with row layout */
.ls-cr-source-select { font-size: 0.68rem; color: var(--ls-info); background: rgba(0,102,204,0.08); border: 1px solid rgba(0,102,204,0.2); border-radius: 4px; padding: 2px 6px; cursor: pointer; width: 100%; appearance: auto; }
.ls-cr-source-select:hover { border-color: rgba(0,102,204,0.4); background: rgba(0,102,204,0.12); }
.ls-cr-source-select:focus { outline: none; border-color: var(--ls-info); }
.ls-cr-source-url { font-size: 0.65rem; color: var(--ls-text-subtle); background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); border-radius: 3px; padding: 3px 6px; width: 100%; font-family: monospace; }
.ls-cr-shp-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; cursor: pointer; font-size: 0.8rem; border-radius: 4px; background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); flex-shrink: 0; }
.ls-cr-shp-btn:hover { background: rgba(245,158,11,0.2); }
.ls-cr-shp-status { font-size: 0.65rem; color: var(--ls-success); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-cr-shp-del { background: none; border: none; color: var(--ls-error); cursor: pointer; font-size: 0.8rem; padding: 0 2px; }
.ls-cr-source-wrap { display: flex; flex-direction: row; flex-wrap: wrap; gap: 3px; margin-left: 4px; min-width: 0; flex: 1; align-items: center; }
.ls-cr-source-url:focus { outline: none; border-color: var(--ls-info); color: var(--ls-text); background: rgba(255,255,255,0.08); }
.ls-cr-row { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }

/* Analysis view */
.ls-al { display: grid; grid-template-columns: 1fr 420px; gap: 20px; }

/* Chat panel */
.ls-ch { background: var(--ls-dark-surface); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-lg); display: flex; flex-direction: column; max-height: 700px; }
.ls-ch-head { padding: 12px 16px; border-bottom: 1px solid var(--ls-border-dark); display: flex; align-items: center; gap: 8px; }
.ls-ch-badge { padding: 3px 8px; border-radius: 100px; font-size: 0.75rem; font-weight: 600; background: rgba(245,158,11,0.15); color: #F59E0B; }
.ls-ch-msgs { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ls-msg { padding: 10px 14px; border-radius: 10px; font-size: 0.85rem; line-height: 1.45; max-width: 95%; }
.ls-msg.ag { background: rgba(255,255,255,0.04); border: 1px solid var(--ls-border-dark); align-self: flex-start; }
.ls-msg.us { background: var(--ls-primary-dim); border: 1px solid rgba(0,166,81,0.2); align-self: flex-end; }
.ls-msg.st { background: rgba(0,102,204,0.08); border: 1px solid rgba(0,102,204,0.2); border-left: 3px solid var(--ls-info); }
.ls-msg.qu { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2); border-left: 3px solid var(--ls-warning); }
.ls-ch-acts { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.ls-ch-act { padding: 4px 10px; border-radius: 5px; font-size: 0.76rem; font-weight: 500; cursor: pointer; border: 1px solid var(--ls-border-dark); background: rgba(255,255,255,0.04); color: var(--ls-text-on-dark); transition: all 0.12s; }
.ls-ch-act:hover { border-color: var(--ls-primary); color: var(--ls-primary); }
.ls-ch-in { padding: 10px 14px; border-top: 1px solid var(--ls-border-dark); display: flex; gap: 6px; }
.ls-ch-input { flex: 1; background: rgba(255,255,255,0.05); border: 1px solid var(--ls-border-dark); border-radius: 8px; padding: 9px 12px; color: var(--ls-text-on-dark); font-family: inherit; font-size: 0.85rem; }
.ls-ch-input:focus { outline: none; border-color: var(--ls-primary); }
.ls-ch-send { width: 36px; height: 36px; border-radius: 8px; background: var(--ls-primary); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1rem; }

/* Mini progress overlay (on map area) */
.ls-mp { position: absolute; bottom: 12px; left: 12px; right: 12px; background: rgba(17,24,39,0.95); backdrop-filter: blur(8px); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md); padding: 14px; z-index: 10; }
.ls-mp-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.ls-mp-title { font-weight: 600; font-size: 0.88rem; }
.ls-mp-pct { color: var(--ls-primary); font-weight: 700; }
.ls-pb { height: 5px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.ls-pf { height: 100%; background: var(--ls-primary); border-radius: 3px; transition: width 0.5s ease; }
.ls-mp-step { font-size: 0.8rem; color: var(--ls-text-subtle); margin-top: 5px; }

/* Report */
.ls-rp { background: var(--ls-dark-surface); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-lg); overflow: hidden; }
.ls-rp-head { background: linear-gradient(135deg, rgba(0,166,81,0.15), rgba(0,102,204,0.1)); padding: 20px 24px; border-bottom: 1px solid var(--ls-border-dark); }
.ls-rp-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 3px; }
.ls-rp-meta { font-size: 0.82rem; color: var(--ls-text-subtle); }
.ls-rp-body { padding: 20px 24px; }
.ls-rp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.ls-st-card { background: rgba(255,255,255,0.03); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md); padding: 14px; text-align: center; }
.ls-st-val { font-size: 1.6rem; font-weight: 700; }
.ls-st-val.gr { color: var(--ls-success); }
.ls-st-val.bl { color: var(--ls-info); }
.ls-st-val.yl { color: var(--ls-warning); }
.ls-st-lbl { font-size: 0.8rem; color: var(--ls-text-subtle); margin-top: 1px; }

/* Report table */
.ls-rt { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.ls-rt th { text-align: left; padding: 8px 12px; font-size: 0.78rem; font-weight: 600; color: var(--ls-text-subtle); border-bottom: 1px solid var(--ls-border-dark); text-transform: uppercase; letter-spacing: 0.4px; }
.ls-rt td { padding: 8px 12px; font-size: 0.85rem; border-bottom: 1px solid rgba(255,255,255,0.04); }
.ls-rt tr:hover td { background: rgba(255,255,255,0.02); }

/* Report warnings */
.ls-rp-warn { background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.2); border-radius: var(--ls-radius-md); padding: 14px 18px; margin-bottom: 20px; }
.ls-rp-warn-t { font-weight: 600; color: var(--ls-warning); font-size: 0.88rem; margin-bottom: 6px; }
.ls-rp-warn-i { font-size: 0.82rem; color: var(--ls-text-subtle); padding: 3px 0 3px 14px; position: relative; }
.ls-rp-warn-i::before { content: '!'; position: absolute; left: 0; color: var(--ls-warning); font-weight: 700; }
.ls-rp-acts { display: flex; gap: 8px; padding-top: 16px; border-top: 1px solid var(--ls-border-dark); flex-wrap: wrap; }

/* Agent tabs (inside agent view) */
.ls-agent-tabs { display: flex; gap: 2px; padding: 0 20px; background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--ls-border-dark); }
.ls-agent-tab { padding: 12px 18px; font-size: 0.85rem; font-weight: 500; color: var(--ls-text-subtle); cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.15s; display: flex; align-items: center; gap: 6px; }
.ls-agent-tab:hover { color: var(--ls-text-on-dark); }
.ls-agent-tab.active { color: var(--ls-primary); border-bottom-color: var(--ls-primary); }
.ls-agent-tab-count { font-size: 0.7rem; background: rgba(255,255,255,0.08); padding: 1px 6px; border-radius: 10px; }
.ls-agent-tab-panel { display: none; padding: 20px; }
.ls-agent-tab-panel.active { display: block; }

/* Studies list (inside agent) */
.ls-study-item { background: rgba(255,255,255,0.03); border: 1px solid var(--ls-border-dark); border-radius: 8px; padding: 12px 16px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; transition: all 0.15s; flex-wrap: wrap; gap: 8px; }
.ls-study-item:hover { border-color: rgba(0,166,81,0.3); background: rgba(0,166,81,0.04); }
.ls-study-name { font-weight: 600; font-size: 0.9rem; }
.ls-study-meta { font-size: 0.78rem; color: var(--ls-text-subtle); }
.ls-study-stats { display: flex; gap: 12px; font-size: 0.8rem; }
.ls-study-stat { display: flex; align-items: center; gap: 4px; }

/* Config view */
.ls-cfg-section { margin-bottom: 16px; }
.ls-cfg-section-title { font-size: 0.85rem; font-weight: 600; color: var(--ls-info); margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid rgba(0,102,204,0.15); display: flex; align-items: center; gap: 6px; }
.ls-cfg-row { display: flex; align-items: center; padding: 4px 0; font-size: 0.82rem; }
.ls-cfg-label { color: var(--ls-text-subtle); min-width: 200px; }
.ls-cfg-value { font-weight: 500; }
.ls-cfg-badge { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 0.73rem; font-weight: 600; margin: 0 2px; }
.ls-cfg-badge.pass { background: rgba(0,166,81,0.12); color: var(--ls-success); }
.ls-cfg-badge.fail { background: rgba(239,68,68,0.12); color: var(--ls-error); }
.ls-cfg-badge.warn { background: rgba(245,158,11,0.12); color: var(--ls-warning); }
.ls-cfg-badge.info { background: rgba(139,92,246,0.12); color: #A78BFA; }

/* Study history items */
.ls-study-item { background: var(--ls-card-bg); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md); padding: 12px 16px; transition: border-color 0.2s; }
.ls-study-item:hover { border-color: var(--ls-primary); }
.ls-study-item + .ls-study-item { margin-top: 8px; }
.ls-study-item-head { display: flex; justify-content: space-between; align-items: center; }
.ls-study-item-title { font-weight: 600; font-size: 0.88rem; color: var(--ls-text); }
.ls-study-item-meta { font-size: 0.75rem; color: var(--ls-text-subtle); margin-top: 2px; }
.ls-btn-xs { padding: 2px 8px !important; font-size: 0.7rem !important; }

/* Knowledge Base */
.ls-kb { margin-top: 24px; }
.ls-kb-title { font-size: 0.95rem; font-weight: 700; color: var(--ls-text); margin-bottom: 12px; }
.ls-kb-section { background: var(--ls-card-bg); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md); padding: 16px 20px; }
.ls-kb-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ls-kb-dropzone {
    border: 2px dashed var(--ls-border-dark); border-radius: var(--ls-radius-md);
    padding: 24px; text-align: center; color: var(--ls-text-subtle); font-size: 0.82rem;
    transition: border-color 0.2s, background 0.2s; cursor: pointer;
}
.ls-kb-dropzone:hover, .ls-kb-dropzone.dragover { border-color: var(--ls-primary); background: rgba(0,166,81,0.04); }
.ls-kb-docs { margin-top: 12px; }
.ls-kb-doc {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-sm);
    transition: border-color 0.2s;
}
.ls-kb-doc:hover { border-color: var(--ls-primary); }
.ls-kb-doc + .ls-kb-doc { margin-top: 6px; }
.ls-kb-doc-icon {
    width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ls-kb-doc-info { flex: 1; min-width: 0; }
.ls-kb-doc-name { font-weight: 600; font-size: 0.82rem; color: var(--ls-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-kb-doc-meta { font-size: 0.7rem; color: var(--ls-text-subtle); margin-top: 1px; }
.ls-kb-doc-status {
    font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; white-space: nowrap;
}
.ls-kb-doc-status.indexed { background: rgba(0,166,81,0.12); color: var(--ls-success); }
.ls-kb-doc-status.indexing { background: rgba(245,158,11,0.12); color: var(--ls-warning); }
.ls-kb-doc-status.pending { background: rgba(139,92,246,0.12); color: #A78BFA; }
.ls-kb-doc-remove {
    background: none; border: none; color: var(--ls-text-subtle); font-size: 1.1rem; cursor: pointer;
    width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.ls-kb-doc-remove:hover { background: rgba(239,68,68,0.15); color: var(--ls-error); }
.ls-kb-howto {
    margin-top: 14px; font-size: 0.75rem; color: var(--ls-text-subtle); line-height: 1.5;
    background: rgba(139,92,246,0.06); border: 1px solid rgba(139,92,246,0.15); border-radius: var(--ls-radius-sm);
    padding: 10px 14px;
}

/* NLP Generator Cards */
.ls-ccg-card {
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; padding: 8px 10px; margin-bottom: 6px;
}
.ls-ccg-card-head { display: flex; align-items: flex-start; gap: 8px; }
.ls-ccg-card-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 2px; }
.ls-ccg-card-body { flex: 1; min-width: 0; }
.ls-ccg-card-label { font-weight: 600; font-size: 0.82rem; color: var(--ls-text-on-dark, #fff); }
.ls-ccg-card-detail { font-size: 0.72rem; color: var(--ls-text-subtle, #9CA3AF); margin-top: 2px; }
.ls-ccg-card-source { font-size: 0.7rem; color: var(--ls-text-subtle, #9CA3AF); opacity: 0.7; }
.ls-ccg-card-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.ls-ccg-card-btn {
    background: none; border: 1px solid rgba(255,255,255,0.15); border-radius: 6px;
    width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--ls-text-subtle, #9CA3AF); font-size: 1rem;
    transition: background 0.15s, border-color 0.15s;
}
.ls-ccg-card-btn.promote:hover { background: rgba(0,166,81,0.15); border-color: var(--ls-success, #00A651); }
.ls-ccg-card-btn.del:hover { background: rgba(239,68,68,0.15); border-color: var(--ls-error, #EF4444); color: var(--ls-error); }

/* System Prompt Section */
.ls-prompt-section { }
.ls-prompt-head { margin-bottom: 4px; }
.ls-prompt-preview {
    background: #0d1117; border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md);
    padding: 0; overflow: hidden;
}
.ls-prompt-code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace; font-size: 0.76rem;
    line-height: 1.7; color: #c9d1d9; margin: 0; padding: 16px 20px; white-space: pre-wrap; word-break: break-word;
}
.ls-p-red { color: #EF4444; font-weight: 700; }
.ls-p-green { color: #00A651; font-weight: 700; }
.ls-p-yellow { color: #F59E0B; font-weight: 700; }
.ls-p-cyan { color: #06B6D4; }
.ls-p-dim { color: #8b949e; }
.ls-prompt-edit-wrap { margin-top: -1px; }
.ls-prompt-textarea {
    width: 100%; background: #0d1117; border: 1px solid var(--ls-primary); border-radius: var(--ls-radius-md);
    color: #c9d1d9; font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace; font-size: 0.76rem;
    line-height: 1.7; padding: 16px 20px; resize: vertical; min-height: 200px;
}
.ls-prompt-textarea:focus { outline: none; box-shadow: 0 0 0 2px rgba(0,166,81,0.3); }
.ls-prompt-footer {
    display: flex; justify-content: space-between; align-items: center; margin-top: 8px;
}

/* Floating progress panel (for when panel is closed) */
.ls-progress-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 340px;
    background: var(--ls-dark-surface, #1F2937);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
    z-index: 1300;
    overflow: hidden;
    color: #fff;
    font-family: "DM Sans", system-ui, sans-serif;
}
.ls-progress-panel.hidden { display: none; }
.ls-pp-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: rgba(0,166,81,0.15); border-bottom: 1px solid rgba(255,255,255,0.1); }
.ls-pp-title { font-weight: 600; font-size: 0.85rem; }
.ls-pp-cancel { background: none; border: none; color: #9CA3AF; font-size: 18px; cursor: pointer; line-height: 1; }
.ls-pp-cancel:hover { color: #fff; }
.ls-pp-bar { height: 4px; background: rgba(255,255,255,0.1); }
.ls-pp-fill { height: 100%; background: linear-gradient(90deg, #00A651, #0066CC); transition: width .5s ease; border-radius: 2px; }
.ls-pp-msg { padding: 10px 14px; font-size: 0.82rem; color: #9CA3AF; }
.ls-pp-question { padding: 8px 14px 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.ls-pp-question.hidden { display: none; }
.ls-pp-q-text { font-size: 0.82rem; color: #fff; margin-bottom: 8px; font-weight: 500; }
.ls-pp-input { width: 100%; padding: 7px 10px; border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; font-size: 0.82rem; margin-top: 6px; background: rgba(255,255,255,0.05); color: #fff; font-family: inherit; }
.ls-pp-input:focus { outline: none; border-color: #00A651; }
.ls-pp-question .ls-btn { margin-right: 4px; margin-bottom: 4px; }

/* Parcel scoring popup (dark) */
.ls-popup { background: #1F2937; border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.4); padding: 14px 16px; min-width: 280px; max-width: 380px; font-size: 0.82rem; position: relative; color: #fff; font-family: "DM Sans", system-ui, sans-serif; }
.ls-popup-close { position: absolute; top: 8px; right: 12px; font-size: 18px; cursor: pointer; color: #9CA3AF; line-height: 1; }
.ls-popup-close:hover { color: #fff; }
.ls-popup-title { font-weight: 700; font-size: 0.95rem; color: #fff; margin-bottom: 2px; }
.ls-popup-meta { font-size: 0.78rem; color: #9CA3AF; margin-bottom: 10px; }
.ls-popup-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.ls-popup-table th { text-align: left; font-weight: 600; color: #9CA3AF; border-bottom: 1px solid rgba(255,255,255,0.1); padding: 4px 8px; }
.ls-popup-table td { padding: 4px 8px; border-bottom: 1px solid rgba(255,255,255,0.04); color: #fff; }

/* Utility classes within panel */
.ls-panel .text-green { color: #00A651; }
.ls-panel .text-yellow { color: #F59E0B; }
.ls-panel .text-red { color: #EF4444; }
.ls-panel .text-blue { color: #0066CC; }
.ls-panel .text-muted { color: #9CA3AF; }
.ls-panel .fw-600 { font-weight: 600; }
.ls-panel .fs-sm { font-size: 0.82rem; }
.ls-panel .hidden { display: none !important; }

@keyframes ls-pulse { 0%,100%{box-shadow:0 0 0 0 rgba(0,166,81,0.4)} 50%{box-shadow:0 0 0 6px rgba(0,166,81,0)} }

@media (max-width: 900px) {
    .ls-al { grid-template-columns: 1fr; }
    .ls-rp-stats { grid-template-columns: repeat(2, 1fr); }
    .ls-fr { flex-direction: column; }
}
@media (max-width: 640px) {
    .ls-body { padding: 1rem; }
}

/* Location Card view */
.ls-lc-grid { display: grid; grid-template-columns: 480px 1fr; gap: 20px; align-items: start; }
.ls-lc-card { background: var(--ls-dark-surface); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-lg); overflow: hidden; max-width: 480px; }
.ls-lc-header { padding: 16px 20px; background: linear-gradient(135deg, rgba(0,166,81,0.12), rgba(0,102,204,0.08)); border-bottom: 1px solid var(--ls-border-dark); }
.ls-lc-sub { font-size: 0.78rem; color: var(--ls-text-subtle); }
.ls-lc-title { font-weight: 700; font-size: 1.05rem; margin-top: 2px; }
.ls-lc-score { font-size: 2.5rem; font-weight: 700; }
.ls-lc-score-max { font-size: 0.9rem; font-weight: 400; color: var(--ls-text-subtle); }
.ls-lc-tag { padding: 2px 8px; border-radius: 4px; font-size: 0.68rem; font-weight: 600; }
.ls-lc-body { padding: 16px 20px; }
.ls-lc-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 0.82rem; }
.ls-lc-row:last-child { border-bottom: none; }
.ls-lc-bar-wrap { display: flex; align-items: center; gap: 8px; }
.ls-lc-bar { width: 80px; height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.ls-lc-bar-fill { height: 100%; border-radius: 3px; }
.ls-lc-pts { font-weight: 700; min-width: 40px; text-align: right; }
.ls-lc-weight { font-size: 0.68rem; color: var(--ls-text-subtle); min-width: 40px; }
.ls-lc-detail { font-size: 0.68rem; color: var(--ls-text-subtle); padding-left: 8px; margin-top: -2px; margin-bottom: 4px; }
.ls-lc-hard { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--ls-border-dark); }
.ls-lc-badge { padding: 3px 8px; border-radius: 4px; font-size: 0.7rem; display: inline-block; margin: 2px; }
.ls-lc-badge.pass { background: rgba(0,166,81,0.1); color: var(--ls-success); }
.ls-lc-badge.fail { background: rgba(239,68,68,0.1); color: var(--ls-error); }
.ls-lc-badge.warn { background: rgba(245,158,11,0.1); color: var(--ls-warning); }
.ls-lc-actions { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.ls-lc-right { display: flex; flex-direction: column; gap: 16px; }
.ls-lc-map { background: #1a2332; border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md); min-height: 300px; position: relative; overflow: hidden; }
.ls-lc-map-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ls-text-subtle); font-size: 0.85rem; text-align: center; padding: 20px; }
.ls-lc-parcels-panel { background: var(--ls-dark-surface); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md); padding: 16px; }
.ls-lc-parcels-list { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; }
.ls-lc-parcel { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: rgba(0,166,81,0.04); border-radius: 4px; cursor: pointer; }
.ls-lc-parcel:hover { background: rgba(0,166,81,0.08); }
.ls-lc-parcel-id { font-weight: 600; min-width: 120px; }
.ls-lc-parcel-meta { flex: 1; color: var(--ls-text-subtle); }
.ls-lc-parcel-pts { font-weight: 700; }
.ls-lc-meta-bar { background: var(--ls-dark-surface); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md); padding: 10px 14px; display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--ls-text-subtle); }

/* National Scanning view */
.ls-ns-controls { background: var(--ls-dark-surface); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md); padding: 14px 16px; margin-bottom: 16px; }
.ls-ns-controls-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ls-ns-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ls-ns-map { background: #1a2332; border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md); min-height: 420px; position: relative; overflow: hidden; }
.ls-ns-heatmap { position: absolute; inset: 30px; display: grid; grid-template-columns: repeat(20, 1fr); grid-template-rows: repeat(14, 1fr); gap: 1px; }
.ls-ns-cell { border-radius: 1px; opacity: 0.7; }
.ls-ns-cell.g { background: var(--ls-success); }
.ls-ns-cell.y { background: var(--ls-warning); }
.ls-ns-cell.r { background: var(--ls-error); }
.ls-ns-cell.x { background: rgba(255,255,255,0.04); }
.ls-ns-panel { display: flex; flex-direction: column; gap: 12px; }
.ls-ns-stat { background: rgba(255,255,255,0.03); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md); padding: 14px; text-align: center; }
.ls-ns-stat-val { font-size: 1.6rem; font-weight: 700; }
.ls-ns-stat-lbl { font-size: 0.72rem; color: var(--ls-text-subtle); }
.ls-ns-top-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 4px; cursor: pointer; font-size: 0.78rem; }
.ls-ns-top-item:hover { background: rgba(0,166,81,0.08); }
.ls-ns-top-item:nth-child(1) { background: rgba(0,166,81,0.06); }
.ls-ns-top-rank { font-weight: 700; color: var(--ls-primary); min-width: 20px; }
.ls-ns-top-name { flex: 1; }
.ls-ns-top-score { font-weight: 700; }
.ls-ns-top-area { font-size: 0.68rem; color: var(--ls-text-subtle); }

/* Enhanced Report — charts, map result, per-region table */
.ls-rp-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.ls-rp-chart { background: rgba(255,255,255,0.02); border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md); padding: 16px; }
.ls-rp-chart-title { font-size: 0.88rem; font-weight: 600; margin-bottom: 12px; }
.ls-map-result { background: rgba(0,166,81,0.06); border: 2px solid rgba(0,166,81,0.4); border-radius: var(--ls-radius-md); padding: 16px; margin-bottom: 20px; }
.ls-map-result-title { font-size: 0.95rem; font-weight: 700; color: var(--ls-primary); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.ls-map-result-preview { background: #1a2332; border: 1px solid var(--ls-border-dark); border-radius: 8px; min-height: 200px; position: relative; overflow: hidden; margin-bottom: 12px; display: flex; align-items: center; justify-content: center; color: var(--ls-text-subtle); font-size: 0.85rem; }
.ls-map-result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Analysis view — map area */
.ls-al-map { background: #1a2332; border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md); min-height: 450px; position: relative; overflow: hidden; }
.ls-al-layers { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 4px; z-index: 5; }
.ls-al-layer { display: flex; align-items: center; gap: 5px; background: rgba(17,24,39,0.9); border: 1px solid var(--ls-border-dark); border-radius: 6px; padding: 5px 10px; font-size: 0.75rem; color: var(--ls-text-subtle); cursor: pointer; transition: all 0.15s; user-select: none; }
.ls-al-layer:hover { border-color: var(--ls-primary); color: var(--ls-text-on-dark); }
.ls-al-layer.active { color: var(--ls-primary); border-color: rgba(0,166,81,0.4); background: rgba(0,166,81,0.08); }
.ls-al-layer input { accent-color: var(--ls-primary); }

/* Analysis view — bottom progress bar */
.ls-al-progress { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(17,24,39,0.95); backdrop-filter: blur(8px); border-top: 1px solid var(--ls-border-dark); padding: 10px 14px; z-index: 5; }
.ls-al-progress-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.ls-al-progress-title { font-weight: 600; font-size: 0.85rem; }
.ls-al-progress-pct { color: var(--ls-primary); font-weight: 700; font-size: 0.88rem; }
.ls-al-progress-step { font-size: 0.78rem; color: var(--ls-text-subtle); margin-top: 4px; }

/* Chat messages — analysis */
.ls-msg-user { align-self: flex-end; max-width: 85%; }
.ls-msg-agent { align-self: flex-start; max-width: 95%; }
.ls-msg-user-hint { align-self: flex-end; max-width: 85%; }
.ls-msg-bubble { padding: 10px 14px; border-radius: 10px; font-size: 0.85rem; line-height: 1.5; }
.ls-msg-bubble.user { background: var(--ls-primary-dim); border: 1px solid rgba(0,166,81,0.2); }
.ls-msg-bubble.agent { background: rgba(255,255,255,0.04); border: 1px solid var(--ls-border-dark); }
.ls-msg-bubble.hint { background: rgba(139,92,246,0.08); border: 1px solid rgba(139,92,246,0.25); font-style: italic; }
.ls-msg-step { margin-bottom: 4px; }
.ls-msg-step strong { color: var(--ls-primary); }
.ls-msg-actions { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }

/* Analysis map enhancements */
.ls-map-tools { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 4px; z-index: 5; }
.ls-map-tool { background: rgba(17,24,39,0.9); border: 1px solid var(--ls-border-dark); border-radius: 6px; padding: 6px 10px; font-size: 0.72rem; color: var(--ls-text-subtle); cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 5px; }
.ls-map-tool:hover { color: var(--ls-text-on-dark); border-color: var(--ls-primary); }
.ls-map-tool.active { color: var(--ls-primary); border-color: rgba(0,166,81,0.4); background: rgba(0,166,81,0.08); }
.ls-legend { position: absolute; top: 10px; right: 10px; background: rgba(17,24,39,0.9); padding: 8px 12px; border-radius: 8px; font-size: 0.75rem; display: flex; flex-direction: column; gap: 3px; z-index: 5; }
.ls-legend-i { display: flex; align-items: center; gap: 5px; }
.ls-legend-d { width: 10px; height: 10px; border-radius: 2px; }
.ls-map-parcels { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.ls-parcel-cell { width: 36px; height: 26px; border-radius: 3px; border: 2px solid; }
.ls-parcel-cell.g { background: rgba(0,166,81,0.25); border-color: var(--ls-success); }
.ls-parcel-cell.y { background: rgba(245,158,11,0.25); border-color: var(--ls-warning); }
.ls-parcel-cell.r { background: rgba(239,68,68,0.15); border-color: var(--ls-error); }
.ls-parcel-cell.e { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.1); }

/* ═══ Analysis Map Overlay ═══ */
.ls-analysis-overlay {
    --ls-primary: #00A651;
    --ls-primary-dim: rgba(0, 166, 81, 0.12);
    --ls-success: #00A651;
    --ls-warning: #F59E0B;
    --ls-error: #EF4444;
    --ls-info: #0066CC;
    --ls-dark-surface: #1F2937;
    --ls-border-dark: rgba(255, 255, 255, 0.1);
    --ls-text-on-dark: #FFFFFF;
    --ls-text-subtle: #9CA3AF;
    --ls-radius-md: 12px;
    --ls-radius-lg: 16px;
    position: fixed; inset: 0; z-index: 1100; pointer-events: none;
    font-family: "DM Sans", system-ui, sans-serif; color: var(--ls-text-on-dark);
}
.ls-analysis-overlay > * { pointer-events: auto; }

/* Chat panel — right side, full height */
.ls-ao-chat {
    position: absolute; top: 0; right: 12px; bottom: 70px; width: 380px;
    background: rgba(17,24,39,0.95); backdrop-filter: blur(12px);
    border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-lg);
    display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.ls-ao-chat .ls-ch-head { padding: 8px 12px; border-bottom: 1px solid var(--ls-border-dark); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.ls-ao-chat .ls-ch-msgs { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.ls-ao-chat .ls-ch-in { padding: 8px 12px; border-top: 1px solid var(--ls-border-dark); display: flex; gap: 6px; flex-shrink: 0; }

/* Progress bar — bottom, spans map width (left of chat) */
.ls-ao-progress {
    display: none; /* Moved to inside chat panel */
    position: absolute; bottom: 10px; left: 270px; right: 404px;
    background: rgba(17,24,39,0.95); backdrop-filter: blur(12px);
    border: 1px solid var(--ls-border-dark); border-radius: var(--ls-radius-md);
    padding: 8px 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Legend inline (inside chat panel) */
.ls-ao-legend-inline {
    padding: 8px 12px; border-bottom: 1px solid var(--ls-border-dark);
    font-size: 0.75rem; display: flex; flex-direction: column; gap: 4px;
    max-height: 200px; overflow-y: auto; flex-shrink: 0;
}
.ls-legend-colors { display: flex; gap: 12px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.06); margin-top: 4px; }
.ls-legend-step {
    display: flex; align-items: center; gap: 6px;
    padding: 2px 4px; border-radius: 3px; transition: background 0.2s;
}
.ls-legend-step.completed { background: rgba(40,167,69,0.08); }
.ls-legend-step.in_progress { background: rgba(33,150,243,0.12); }
.ls-legend-step-icon { font-size: 0.65rem; min-width: 14px; text-align: center; }
.ls-legend-step-label { flex: 1; color: var(--ls-text-on-dark); font-size: 0.7rem; }
.ls-legend-step-nums { font-family: 'DM Mono', monospace; color: var(--ls-muted-on-dark); font-size: 0.65rem; white-space: nowrap; }
.ls-legend-step-nums small { color: var(--ls-error); font-weight: 600; }

@media (max-width: 900px) {
    .ls-ao-chat { width: 300px; right: 10px; top: 50px; }
    .ls-ao-progress { right: 10px; left: 10px; }
}

/* Agent typing indicator */
.ls-typing { display: inline-block; animation: ls-blink 1s infinite; color: var(--ls-text-subtle); }
@keyframes ls-blink { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }

/* Layer added banner */
.ls-layer-added { background: var(--ls-primary-dim); border: 1px solid rgba(0,166,81,0.3); border-radius: var(--ls-radius-md); padding: 12px 16px; margin-top: 16px; display: flex; align-items: center; gap: 10px; }

@media (max-width: 900px) {
    .ls-lc-grid { grid-template-columns: 1fr; }
    .ls-ns-grid { grid-template-columns: 1fr; }
    .ls-rp-charts { grid-template-columns: 1fr; }
}

/* ============== CUSTOM DIALOG (alert/confirm replacement) ============== */

.cge-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.12s ease;
    padding: 20px;
}

.cge-dialog-overlay.cge-dialog-open {
    opacity: 1;
}

.cge-dialog-overlay.cge-dialog-closing {
    opacity: 0;
}

.cge-dialog-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25), 0 6px 16px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 460px;
    padding: 22px 24px 18px;
    transform: translateY(8px) scale(0.98);
    transition: transform 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
    font-family: var(--cge-font);
}

.cge-dialog-overlay.cge-dialog-open .cge-dialog-card {
    transform: translateY(0) scale(1);
}

.cge-dialog-head {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 10px;
}

.cge-dialog-body {
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
    margin-bottom: 20px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.cge-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.cge-dialog-btn {
    appearance: none;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
    min-width: 88px;
}

.cge-dialog-btn:active {
    transform: translateY(1px);
}

.cge-dialog-btn-primary {
    background: var(--cge-primary, #00a651);
    color: #ffffff;
}

.cge-dialog-btn-primary:hover {
    background: #008f45;
}

.cge-dialog-btn-danger {
    background: #dc2626;
}

.cge-dialog-btn-danger:hover {
    background: #b91c1c;
}

.cge-dialog-btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.cge-dialog-btn-secondary:hover {
    background: #e2e8f0;
}

/* ============== IMPORT FILE DROP ZONE ============== */

.import-drop-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 140px;
    padding: 22px 16px;
    border: 2px dashed rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--cge-text-on-dark);
    font-size: 13px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.05s ease;
}

.import-drop-zone:hover {
    border-color: rgba(0, 166, 81, 0.5);
    background: rgba(0, 166, 81, 0.06);
}

.import-drop-zone.drag-over {
    border-color: var(--cge-primary, #00a651);
    background: rgba(0, 166, 81, 0.12);
    transform: scale(1.01);
}

/* Children must not capture pointer events — they'd trigger dragleave on the parent
   while the cursor is still inside the zone, causing the highlight to flicker. */
.import-drop-zone > svg,
.import-drop-zone > span {
    pointer-events: none;
}

.import-status {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
}

.import-status.success {
    background: rgba(0, 166, 81, 0.12);
    border: 1px solid rgba(0, 166, 81, 0.3);
    color: #16a34a;
}

.import-status.error {
    background: rgba(220, 38, 38, 0.12);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #ef4444;
}
