/* ═══════════════════════════════════════════
   Terrapoint — Premium Forest Dashboard
   ═══════════════════════════════════════════ */

:root {
    --primary: #0a3d9e;
    --primary-light: #1565c0;
    --primary-dark: #002171;
    --accent: #42a5f5;
    --accent-light: #90caf9;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    --bg: #f8fafb;
    --bg-alt: #f0f4fa;
    --card: #ffffff;
    --surface: #f5f7fa;
    --surface-alt: #f0f4fa;

    --text: #1a1d23;
    --text-secondary: #4a5568;
    --text-muted: #8896a6;
    --border: #e2e8f0;
    --border-light: #edf2f7;

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.12);
    --shadow-glow: 0 0 30px rgba(10,61,158,0.15);

    --radius-sm: 3px;
    --radius: 4px;
    --radius-lg: 6px;
    --radius-xl: 6px;
    --radius-full: 9999px;

    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; overflow-x: hidden; }

/* ═══ Navbar ═══ */
.hero {
    position: sticky;
    top: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 56px;
    background: linear-gradient(135deg, #0a3d9e, #1565c0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger:hover { background: rgba(255,255,255,0.15); }

/* ═══ Sidebar ═══ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 1500;
}
.sidebar-overlay.open { display: block; }

.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 280px;
    background: var(--card, #fff);
    border-right: 1px solid var(--border, #e2e8f0);
    box-shadow: var(--shadow-lg);
    z-index: 1600;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
}
.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text, #1a1d23);
}
.sidebar-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: var(--radius-sm, 3px);
    color: var(--text-muted, #8896a6);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-close:hover {
    background: var(--bg-alt, #f0f4fa);
    color: var(--text, #1a1d23);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
}
.sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted, #8896a6);
    font-size: 0.85rem;
}

.nav-left .logo-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.02em;
    line-height: 1;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ═══ Search (in navbar) ═══ */
.search-box {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-full);
    padding: 0.25rem 0.25rem 0.25rem 0.75rem;
    transition: background var(--transition);
    min-width: 420px;
    width: 100%;
    max-width: 550px;
}

.search-box:focus-within { background: rgba(255,255,255,0.25); }

.search-icon {
    color: rgba(255,255,255,0.7);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    transition: color var(--transition);
}

.search-box:focus-within .search-icon { color: white; }

.search-box input {
    width: 320px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: var(--font);
    border: none;
    outline: none;
    background: transparent;
    color: white;
    min-width: 0;
}

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

.search-box button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 30px;
    padding: 0;
    background: white;
    color: #003087;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.search-box button:hover {
    background: rgba(255,255,255,0.9);
    transform: translateY(-1px);
}

.search-box button:active { transform: translateY(0); }
.search-box button:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

/* ═══ Error ═══ */
.error-msg {
    position: fixed;
    top: 64px;
    right: 1.5rem;
    z-index: 2001;
    padding: 0.75rem 1.25rem;
    background: #fef2f2;
    color: var(--danger);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid #fecaca;
    box-shadow: var(--shadow-md);
    max-width: 400px;
}

.error-msg::before {
    content: '!';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-right: 0.5rem;
}

/* ═══ Loading ═══ */
.loading {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 1999;
    height: 3px;
    background: var(--border-light);
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--primary), var(--primary-light), transparent);
    animation: loadSlide 1.2s ease-in-out infinite;
}

@keyframes loadSlide {
    0% { left: -40%; }
    100% { left: 100%; }
}

.loading-content, .skeleton-grid, .skeleton-cards, .skeleton, .skeleton-map, .skeleton-card, .loading-text {
    display: none;
}

/* ═══ AI Chat Section ═══ */
.ai-chat-section {
    background: var(--card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    margin: 0 auto 1.5rem;
    max-width: 900px;
    overflow: hidden;
}

.ai-chat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #0a3d9e, #1565c0);
    color: white;
}

.ai-chat-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-chat-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.ai-chat-subtitle {
    font-size: 0.8rem;
    opacity: 0.8;
    margin: 0;
}

.ai-chat-messages {
    padding: 1rem 1.25rem;
    max-height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ai-chat-messages::-webkit-scrollbar { width: 6px; }
.ai-chat-messages::-webkit-scrollbar-track { background: transparent; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.ai-message {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-message.user-message {
    flex-direction: row-reverse;
}

.ai-avatar {
    width: 18px;
    height: 18px;
    background: transparent;
    border: 2px solid #42a5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 8px;
}

.user-message .ai-avatar {
    display: none;
}

.ai-bubble {
    background: var(--surface);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    max-width: 85%;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text);
}

.user-message .ai-bubble {
    background: #0a3d9e;
    color: white;
}

.ai-bubble p { margin: 0 0 0.5rem 0; }
.ai-bubble p:last-child { margin-bottom: 0; }
.ai-bubble strong { font-weight: 600; }
.ai-bubble ul, .ai-bubble ol { margin: 0.5rem 0; padding-left: 1.25rem; }
.ai-bubble li { margin-bottom: 0.25rem; }

.ai-thinking {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-thinking-icon {
    color: var(--primary-light);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.ai-thinking-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}

.ai-typing {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0;
}

.ai-typing span {
    width: 6px;
    height: 6px;
    background: var(--primary-light);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

.ai-chat-input-area {
    padding: 0.75rem 1.25rem 1rem;
    border-top: 1px solid var(--border-light);
}

.ai-chat-input-wrap {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ai-chat-input-wrap input {
    flex: 1;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.88rem;
    font-family: var(--font);
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: all var(--transition);
}

.ai-chat-input-wrap input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(10,61,158,0.1);
}

.ai-chat-input-wrap button {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}

.ai-chat-input-wrap button:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.ai-chat-input-wrap button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ai-chat-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.6rem;
}

.ai-hint {
    padding: 0.35rem 0.75rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-family: var(--font);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.ai-hint:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.ai-hint-eraldis {
    background: var(--surface);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 500;
}

.ai-hint-eraldis:hover {
    background: #0a3d9e;
    border-color: #0a3d9e;
    color: white;
}

.eraldis-dropdown { display: block; width: 100%; }
.eraldis-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.eraldis-dropdown-toggle svg {
    transition: transform 0.2s ease;
}
.eraldis-dropdown.open .eraldis-dropdown-toggle svg {
    transform: rotate(180deg);
}
.eraldis-dropdown-list {
    display: none;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.4rem;
}
.eraldis-dropdown.open .eraldis-dropdown-list {
    display: flex;
}
.eraldis-dropdown-list .ai-hint {
    white-space: nowrap;
    text-align: left;
}

.ai-hint-custom {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: transparent;
    color: white;
    font-weight: 600;
}

.ai-hint-custom:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a4294);
    border-color: transparent;
    color: white;
}

/* ═══ Dashboard ═══ */
.dashboard { max-width: 1280px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }

/* ═══ Map ═══ */
.map-section { margin-bottom: 2rem; }

.map-wrapper {
    position: relative;
    background: var(--card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

#map { width: 100%; height: 520px; z-index: 0; }

.map-controls { position: absolute; top: 12px; right: 12px; z-index: 1000; }

.layer-toggle {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.3rem 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition);
}

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

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

/* ═══ Metric Cards ═══ */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--card);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all var(--transition);
    opacity: 0;
    transform: translateY(16px);
    animation: cardIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.metric-card:nth-child(1) { animation-delay: 0.05s; }
.metric-card:nth-child(2) { animation-delay: 0.1s; }
.metric-card:nth-child(3) { animation-delay: 0.15s; }
.metric-card:nth-child(4) { animation-delay: 0.2s; }
.metric-card:nth-child(5) { animation-delay: 0.25s; }
.metric-card:nth-child(6) { animation-delay: 0.3s; }
.metric-card:nth-child(7) { animation-delay: 0.35s; }

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

.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    border-color: var(--primary-light);
}

.highlight-card {
    border-color: rgba(10,61,158,0.3);
    background: linear-gradient(135deg, #fff 0%, #eef6ff 100%);
}

.highlight-card:hover { border-color: rgba(10,61,158,0.5); }

/* ═══ Card Header ═══ */
.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--transition-bounce);
}

.metric-card:hover .card-icon { transform: scale(1.1); }

.kataster-icon { background: #e3f2fd; color: #0a3d9e; }
.mets-icon { background: #e8f5e9; color: #1a5e20; }
.vaartus-icon { background: #e3f2fd; color: #0a3d9e; }
.sinik-icon { background: #e0f7fa; color: #00695c; }
.risk-icon { background: #fce4ec; color: var(--danger); }
.eudr-icon { background: #e3f2fd; color: #0a3d9e; }

.card-header h3 { flex: 1; }

.info-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid var(--border);
    flex-shrink: 0;
    transition: all 0.2s ease;
    opacity: 0.6;
}
.info-toggle:hover {
    opacity: 1;
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: scale(1.1);
}

.info-box {
    display: none;
    margin-top: 0.5rem;
    padding: 0.7rem 0.85rem;
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-alt, #f8fafb) 100%);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.55;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.info-box.open { display: block; }

.info-box strong {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.info-box .source {
    margin-top: 0.4rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.q-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted, #999);
    font-size: 9px;
    font-weight: 600;
    cursor: help;
    vertical-align: middle;
    margin-left: 4px;
    line-height: 1;
    border: 1.5px solid var(--border, #ddd);
    transition: all 0.2s ease;
    opacity: 0.5;
}
.q-tip:hover {
    opacity: 1;
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: scale(1.15);
}

/* Info dropdown arrow */
.info-dd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 4px;
    width: 14px;
    height: 14px;
    color: var(--text-muted, #999);
    transition: transform 0.25s ease, color 0.2s ease, opacity 0.2s ease;
    vertical-align: middle;
    user-select: none;
    opacity: 0.5;
}
.info-dd:hover { opacity: 1; color: #0a3d9e; }
.info-dd.open { transform: rotate(180deg); color: #0a3d9e; opacity: 1; }
.info-dd-text {
    display: none;
    font-size: 0.75rem;
    color: var(--text-muted, #666);
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #0a3d9e;
    line-height: 1.5;
    font-weight: 400;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 2px;
}
.info-dd-text.show { display: block; }
.info-dd-text .dd-field {
    font-size: 0.75rem;
    color: var(--text-secondary, #555);
    line-height: 1.5;
}
.info-dd-text .dd-value {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid var(--border, #e0e0e0);
    font-size: 0.73rem;
    color: #0a3d9e;
    font-weight: 500;
    line-height: 1.5;
}
.info-dd-text .dd-value::before {
    content: '▸ ';
    opacity: 0.5;
}

.initial-info {
    padding: 1.2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.initial-info .icon {
    font-size: 1.3rem;
    margin-bottom: 0.6rem;
    opacity: 0.4;
}
.initial-info p { margin: 0.3rem 0; }
.initial-info .hint {
    font-size: 0.78rem;
    margin-top: 0.5rem;
    opacity: 0.7;
}

.section-desc {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin: -0.1rem 0 0.5rem 0;
    line-height: 1.4;
    padding-left: 0.1rem;
    opacity: 0.85;
}

.card-header h3 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

/* ═══ Info Rows ═══ */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}

.info-row:last-child { border-bottom: none; }

.info-row .label { color: var(--text-muted); font-weight: 400; font-size: 0.85rem; }
.info-row .value { font-weight: 600; color: var(--text); text-align: right; }

/* ═══ Big Numbers ═══ */
.big-number {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.big-number .unit { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); margin-left: 0.25rem; }
.big-number.accent { color: var(--primary); }

/* ═══ Traffic Lights ═══ */
.traffic-light {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    transition: transform var(--transition);
}

.traffic-light:hover { transform: scale(1.05); }

.traffic-light .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.traffic-light.green { background: #e6f5e6; color: #1a7a1a; }
.traffic-light.green .dot { background: #28a745; box-shadow: 0 0 8px rgba(40,167,69,0.5); }
.traffic-light.yellow { background: #fff8e1; color: #8a6d00; }
.traffic-light.yellow .dot { background: #ffc107; box-shadow: 0 0 8px rgba(255,193,7,0.5); }
.traffic-light.red { background: #fce4e4; color: #b71c1c; }
.traffic-light.red .dot { background: #e63946; box-shadow: 0 0 8px rgba(230,57,70,0.5); }

/* ═══ Progress Bar ═══ */
.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar .fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(90deg, var(--primary), var(--info));
}

/* ═══ Species Table ═══ */
.comp-table { width: 100%; margin-top: 0.75rem; font-size: 0.82rem; border-collapse: collapse; }
.comp-table td { padding: 0.35rem 0.4rem; border-bottom: 1px solid var(--border-light); }
.comp-table tr:last-child td { border-bottom: none; }
.comp-table .bar-cell { width: 50%; }

.comp-bar {
    height: 8px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-full);
    display: inline-block;
    transition: width 0.6s ease;
}

/* ═══ EUDR ═══ */
.eudr-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.5; }

.btn-eudr {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    font-weight: 600;
    font-family: var(--font);
    font-size: 0.85rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    width: 100%;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(10,61,158,0.3);
}

.btn-eudr:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(10,61,158,0.4); }
.btn-eudr:active { transform: translateY(0); }

/* ═══ Charts ═══ */
.charts-section { margin-bottom: 2rem; }
.section-header { margin-bottom: 1.25rem; }
.section-header h2 { font-size: 1.25rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

.chart-card {
    background: var(--card);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.chart-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.chart-card h3 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.chart-wrapper { position: relative; max-height: 280px; }
.chart-wrapper canvas { max-height: 280px; }

/* ═══ Tables ═══ */
.tables-section { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 2rem; }

.table-card {
    background: var(--card);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow-x: auto;
    transition: all var(--transition);
}

.table-card:hover { box-shadow: var(--shadow-md); }
.table-card .card-header { margin-bottom: 1rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }

th, td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border-light); }

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--surface);
    border-radius: 4px;
}

tr:hover td { background: var(--surface); }
td strong { font-weight: 600; color: var(--text); }

/* ═══ Utility ═══ */
.muted { color: var(--text-muted); font-size: 0.85rem; font-style: italic; }
.hidden { display: none; }

/* ═══ Footer ═══ */
footer {
    text-align: center;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
    background: var(--card);
}

.footer-content { max-width: 1200px; margin: 0 auto; }
.footer-brand { font-weight: 700; color: var(--text); font-size: 0.9rem; margin-bottom: 0.25rem; }
.footer-sources { color: var(--text-muted); font-size: 0.8rem; }

/* ═══ Responsive ═══ */
@media (max-width: 1024px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .search-box { min-width: 280px; }
}

@media (max-width: 900px) {
    #map { height: 400px; }
    .charts-grid { grid-template-columns: 1fr; }
    .tables-section { grid-template-columns: 1fr; }
    .dashboard { padding: 1rem 1rem 2rem; }
}

@media (max-width: 640px) {
    html, body { overflow-x: hidden; width: 100%; max-width: 100vw; }
    .hero { padding: 0 0.5rem; height: 50px; gap: 0.3rem; }
    .nav-left .logo-text h1 { font-size: 0.95rem; }
    .nav-left { gap: 0.4rem; }
    .search-box { min-width: 0; max-width: none; flex: 1; }
    .search-input-wrap { min-width: 0; flex: 1; }
    .search-box input { width: 100%; min-width: 0; font-size: 0.8rem; padding: 0.3rem 0.4rem; }
    .search-box button { width: 30px; height: 28px; padding: 0; }
    .search-box button .btn-text { display: none; }
    .metrics-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .dashboard { padding: 0.75rem 0.75rem 2rem; }
    #map { height: 300px; }
    .map-controls { top: 8px; right: 8px; }
    .layer-toggle { font-size: 0.7rem; padding: 0.5rem 0.7rem; }
    .big-number { font-size: 1.6rem; }
    .error-msg { right: 0.5rem; left: 0.5rem; max-width: none; }
    .metric-card { padding: 1rem; }
    .ai-chat-messages { max-height: 350px; padding: 0.75rem; }
    .ai-chat-input-wrap input { font-size: 0.85rem; padding: 0.5rem 0.75rem; }
    .ai-hint { font-size: 0.7rem; padding: 0.3rem 0.6rem; }
    .info-row { font-size: 0.82rem; padding: 0.4rem 0; }
    .info-row .label { font-size: 0.78rem; }
    .card-header h3 { font-size: 0.72rem; }
    .section-desc { font-size: 0.7rem; }
    footer { padding: 1rem 0.75rem; }
}

/* ═══ Leaflet ═══ */
.leaflet-bar {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.leaflet-control-zoom a {
    background: var(--card) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    font-weight: 600 !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: none !important;
}

.leaflet-control-zoom a:hover { background: var(--surface) !important; }

.leaflet-control-zoom a:first-child { border-radius: var(--radius-sm) !important; }
.leaflet-control-zoom a:last-child { border-radius: var(--radius-sm) !important; }

.center-control { margin-top: 6px !important; }
.center-control a svg { vertical-align: middle; }

.leaflet-control-layers {
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm) !important;
    border: 1px solid var(--border) !important;
}

.leaflet-popup-content-wrapper {
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-md) !important;
    font-family: var(--font) !important;
}

.leaflet-popup-content {
    margin: 0.75rem 1rem !important;
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
}

/* ═══ Scrollbar ═══ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ═══ Selection ═══ */
::selection { background: rgba(10,61,158,0.15); color: var(--text); }

/* ═══ Address Dropdown ═══ */
.search-input-wrap { position: relative; flex: 1; min-width: 0; }
.search-input-wrap input { width: 100%; }

.address-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    max-height: 260px;
    overflow-y: auto;
    margin-top: 2px;
}

.address-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.address-item:last-child { border-bottom: none; }
.address-item:hover { background: var(--surface-alt); }
.address-item .addr-main { font-weight: 500; color: var(--text); }
.address-item .addr-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.address-item .addr-kataster { font-size: 0.72rem; color: var(--primary); margin-top: 2px; }

