/* FCP AI Dashboard Styles — Warm Light Theme */
:root {
    --bg-primary: #faf7f4;
    --bg-secondary: #f0ebe5;
    --bg-card: #ffffff;
    --bg-sidebar: #1b4332;
    --green-primary: #059669;
    --green-dark: #065f46;
    --green-glow: rgba(5, 150, 105, 0.1);
    --blue-primary: #2563eb;
    --blue-glow: rgba(37, 99, 235, 0.08);
    --red-primary: #dc2626;
    --orange-primary: #ea580c;
    --text-primary: #1c1917;
    --text-secondary: #57534e;
    --text-muted: #a8a29e;
    --border-color: rgba(0, 0, 0, 0.08);
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s;
}
.sidebar-brand {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-brand .brand-name {
    font-size: 18px;
    font-weight: 700;
}
.sidebar-brand .brand-name { color: #fff; }
.sidebar-brand .brand-name span { color: #6ee7b7; }
/* 29-sep: logo nuevo (FC_Logo26) sobre placa blanca; el sidebar sigue verde (opción B, Ruby). */
.sidebar-brand .brand-logo { background: #fff; border-radius: 10px; padding: 10px 14px; }
.sidebar-brand .brand-logo img { width: 100%; display: block; }
.sidebar-brand .brand-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 2px;
}
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}
.nav-section-title {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 16px 12px 8px;
    font-weight: 600;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
}
.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.nav-item.active {
    background: rgba(110, 231, 183, 0.15);
    color: #6ee7b7;
}
.nav-item .material-icons { font-size: 20px; }

/* Filters relocated into the left sidebar (control panel) */
.sidebar .filter-bar {
    position: static;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    border-radius: 0;
    padding: 4px 0 10px;
    margin: 0 0 6px;
}
.sidebar .filter-bar-header { margin-bottom: 12px; padding: 0 2px; }
.sidebar .filter-bar-title { color: rgba(255,255,255,0.9); }
.sidebar .filter-bar-title .material-icons { color: #6ee7b7; }
.sidebar .filter-clear-btn { color: #fca5a5; border-color: rgba(252,165,165,0.35); }
.sidebar .filter-clear-btn:hover { background: rgba(252,165,165,0.12); }
.sidebar .filter-controls { flex-direction: column; gap: 12px; }
.sidebar .filter-group { max-width: none; min-width: 0; width: 100%; }
.sidebar .filter-label { color: rgba(255,255,255,0.5); }
/* Inline (accordion) dropdowns so they aren't clipped by the scrolling sidebar */
.sidebar .filter-dd-menu {
    position: static;
    min-width: 0 !important;
    max-width: none !important;
    box-shadow: none;
    border-radius: 0 0 8px 8px;
}
.sidebar .filter-active-tags { padding: 0 2px; }

/* Histórico season multi-select relocated into the dark sidebar (fills the empty
   left panel on the Histórico tab). Overrides the light-card inline styles. */
.sidebar #historico-season-filter {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 0 6px !important;
}
.sidebar #historico-season-filter .season-filter-body {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
}
.sidebar #historico-season-label {
    color: rgba(255,255,255,0.65) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}
.sidebar #historico-season-chips {
    flex-direction: column !important;
    gap: 7px !important;
    width: 100%;
}
.sidebar #historico-season-chips button {
    width: 100% !important;
    justify-content: center !important;
    font-size: 14px !important;
}
/* Dark-sidebar contrast: the light-card chip colors are unreadable on dark green.
   Active = brighter translucent pill + colored border + white text; inactive = dim. */
.sidebar #historico-season-chips .season-chip.on {
    background: rgba(255,255,255,0.13) !important;
    color: #fff !important;
}
.sidebar #historico-season-chips .season-chip.off {
    background: rgba(255,255,255,0.04) !important;
    border-color: rgba(255,255,255,0.14) !important;
    color: rgba(255,255,255,0.55) !important;
}
.sidebar #historico-season-reset {
    margin-left: 0 !important;
    width: 100%;
    font-size: 14px !important;
    padding: 8px 13px !important;
    color: rgba(255,255,255,0.7) !important;
    border-color: rgba(255,255,255,0.25) !important;
}
.sidebar #historico-season-reset:hover { background: rgba(255,255,255,0.08) !important; }

/* Horizontal section tabs (Resumen | Mi Empresa | Análisis Perú) */
.section-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.section-tab {
    padding: 9px 22px;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-family: inherit;
}
.section-tab:hover { border-color: var(--green-primary); color: var(--green-primary); }
.section-tab.active {
    background: var(--green-primary);
    border-color: var(--green-primary);
    color: #fff;
}

/* Sidebar Table of Contents (collapsible book-style index) */
.toc-group { margin-bottom: 2px; }
.nav-toc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 11px 12px;
    margin-top: 4px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}
.nav-toc-head:first-child { margin-top: 0; }
.nav-toc-head:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.05); }
.nav-toc-head.active { color: #6ee7b7; }
.toc-chevron { font-size: 18px; opacity: 0.55; transition: transform 0.2s; }
.toc-group.expanded .toc-chevron { transform: rotate(180deg); }
.toc-group-items {
    display: none;
    padding: 2px 0 6px;
}
.toc-group.expanded .toc-group-items { display: block; }
.nav-toc-item {
    display: block;
    padding: 6px 12px 6px 20px;
    font-size: 12.5px;
    line-height: 1.35;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.nav-toc-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-toc-item.active {
    color: #6ee7b7;
    border-left-color: #6ee7b7;
    background: rgba(110,231,183,0.10);
    font-weight: 600;
}
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}
.data-freshness {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}
.freshness-dot {
    width: 8px;
    height: 8px;
    background: var(--green-primary);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(74,222,128,0.4); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(74,222,128,0); }
}

/* Top Bar */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: rgba(250, 247, 244, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 90;
}
.topbar-greeting h1 {
    font-size: 18px;
    font-weight: 600;
}
.topbar-greeting h1 span { color: var(--green-dark); }
.topbar-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.data-range-row {
    margin-bottom: 14px;
}
/* Spy mode banner (shown when an exporter views the dashboard as another exporter) */
.spy-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: linear-gradient(90deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 10px;
    margin-bottom: 16px;
    color: #78350f;
    font-size: 14px;
}
.spy-banner .spy-icon {
    font-size: 20px;
    color: #b45309;
}
.spy-banner .spy-text {
    flex: 1;
}
.spy-banner strong {
    font-weight: 700;
    color: #78350f;
}
.spy-banner .spy-exit {
    background: #fff;
    border: 1px solid #f59e0b;
    color: #78350f;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.spy-banner .spy-exit:hover {
    background: #fde68a;
}
.data-range-chip {
    display: inline-block;
    padding: 5px 12px;
    background: var(--green-glow);
    color: var(--green-primary);
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.2px;
    white-space: nowrap;
}
/* Fruit Selector */
.topbar-center {
    display: flex;
    align-items: center;
}
.fruit-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.04);
    border-radius: 10px;
    padding: 3px;
}
.fruit-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.fruit-tab:hover {
    background: rgba(0,0,0,0.04);
    color: var(--text-primary);
}
.fruit-tab.active {
    background: #fff;
    color: var(--green-dark);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.fruit-emoji { font-size: 16px; }

/* Fruit selector — single dropdown of the client's fruits (scales 2→21) */
.fruit-dd { position: relative; }
.fruit-static {
    display: flex; align-items: center; gap: 7px;
    padding: 7px 14px; font-size: 14px; font-weight: 600; color: var(--text-primary);
}
.fruit-dd-trigger {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 13px; background: #fff; border: 1px solid var(--border-color);
    border-radius: 10px; font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
    color: var(--text-primary); cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.15s;
}
.fruit-dd-trigger:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.fruit-dd-trigger .lbl-sm {
    font-size: 11px; color: var(--text-muted); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.fruit-dd-trigger .material-icons { font-size: 18px; color: var(--text-muted); }
.fruit-dd-menu {
    position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    background: #fff; border: 1px solid var(--border-color); border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.14); padding: 6px; min-width: 210px; z-index: 95; display: none;
}
.fruit-dd-menu.open { display: block; }
.fruit-dd-item {
    display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px;
    font-size: 13.5px; color: var(--text-primary); cursor: pointer; white-space: nowrap;
}
.fruit-dd-item > span:first-child { flex: 1; }
.fruit-dd-item:hover { background: rgba(0,0,0,0.04); }
.fruit-dd-item.active { background: var(--green-glow); color: var(--green-dark); font-weight: 600; }
.fruit-dd-item.soon { color: var(--text-muted); cursor: default; }
.fruit-dd-item .chk { font-size: 16px; color: var(--green-primary); visibility: hidden; }
.fruit-dd-item.active .chk { visibility: visible; }
.fruit-dd-item .soon-tag {
    font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
    background: #fef3c7; color: #92400e; border-radius: 7px; padding: 1px 6px;
}

/* FCP System (database) button — solid dark green like the sidebar so it reads
   as the gateway back to the full system, not just another filter control */
.btn-classic-portal {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
    gap: 7px;
    padding: 8px 16px;
    border: 1px solid var(--green-dark);
    border-radius: 10px;
    background: var(--green-dark);
    color: #fff;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.btn-classic-portal:hover {
    background: var(--green-primary);
    border-color: var(--green-primary);
    box-shadow: 0 2px 8px rgba(5,150,105,0.35);
}
.btn-classic-portal:hover .classic-arrow {
    transform: translateX(2px);
}
/* "Go to" call-to-action prefix — small, so the action reads but the name leads */
.classic-cta {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.78);
}
.classic-label {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.2px;
}
.classic-paren {
    font-size: 11px;
    font-weight: 400;
    color: rgba(255,255,255,0.62);
}
.classic-arrow {
    font-size: 19px;
    transition: transform 0.2s;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-icon:hover {
    background: rgba(0,0,0,0.04);
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 28px 32px;
    min-height: calc(100vh - var(--topbar-height));
}

/* Main Tabs: Actual vs Histórico */
.main-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}
.main-tab {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.main-tab:hover {
    color: var(--text-primary);
}
.main-tab.active {
    color: var(--green-primary);
    border-bottom-color: var(--green-primary);
}

/* Histórico KPI Cards */
.historico-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}
.historico-kpi-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
}
.historico-kpi-card.current {
    border-color: var(--green-primary);
    background: rgba(5,150,105,0.05);
}
.historico-kpi-card .season-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.historico-kpi-card .kpi-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
}
.historico-kpi-card .kpi-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.historico-kpi-card .kpi-bar {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}
.historico-kpi-card .kpi-bar-fill {
    height: 100%;
    background: var(--green-primary);
    border-radius: 3px;
}
.historico-kpi-card .kpi-yoy {
    font-size: 11px;
    font-weight: 600;
    margin-top: 6px;
}
.historico-kpi-card .kpi-yoy.up { color: var(--green-primary); }
.historico-kpi-card .kpi-yoy.down { color: #dc2626; }

/* Season Toggle */
.season-toggle {
    margin-bottom: 16px;
}
.season-tabs {
    display: inline-flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}
.season-tab {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.season-tab:hover {
    color: var(--text-primary);
    background: rgba(0,0,0,0.04);
}
.season-tab.active {
    background: var(--green-primary);
    color: #fff;
    font-weight: 600;
}

/* YoY Indicators */
.metric-yoy {
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.metric-yoy:empty { display: none; }
.metric-yoy.up { color: var(--green-primary); }
.metric-yoy.down { color: var(--red-primary); }
.metric-yoy .material-icons { font-size: 14px; }

/* Filter Bar — sticky below topbar */
.filter-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 24px;
    position: sticky;
    top: calc(var(--topbar-height) + 8px);
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.96);
}
.filter-bar.is-sticky {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.filter-bar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.filter-bar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.filter-bar-title .material-icons { font-size: 18px; color: var(--green-primary); }
.filter-count {
    background: var(--green-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.filter-clear-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    background: none;
    border: 1px solid rgba(248,113,113,0.3);
    color: var(--red-primary);
    padding: 5px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.filter-clear-btn:hover { background: rgba(248,113,113,0.1); }
.filter-clear-btn .material-icons { font-size: 14px; }
.filter-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.filter-group {
    flex: 1;
    min-width: 130px;
    max-width: 200px;
    position: relative;
}
.filter-label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    font-weight: 600;
}
.filter-select-wrap { position: relative; }
.filter-select {
    display: none; /* Hidden native select, we use custom dropdown */
}
.filter-range-select {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s;
    appearance: auto;
}
.filter-range-select:hover { border-color: rgba(0,0,0,0.15); }
.filter-range-select:focus { border-color: var(--green-primary); outline: none; }
.filter-range-select.active { border-color: var(--green-primary); color: var(--green-primary); font-weight: 500; }
.filter-dropdown {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s;
    overflow: hidden;
}
.filter-dropdown:hover { border-color: rgba(0,0,0,0.15); }
.filter-dropdown.active { border-color: var(--green-primary); }
.filter-dd-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    gap: 4px;
    user-select: none;
}
.filter-dd-trigger .dd-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.filter-dd-trigger .dd-text.has-selection { color: var(--green-primary); font-weight: 500; }
.filter-dd-trigger .material-icons { font-size: 16px; color: var(--text-muted); transition: transform 0.2s; }
.filter-dropdown.open .filter-dd-trigger .material-icons { transform: rotate(180deg); }
.filter-dd-menu {
    display: none;
    max-height: 240px;
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
    padding: 4px 0;
}
.filter-dropdown.open .filter-dd-menu { display: block; }
/* Variety group dropdown: wider so labels like "WHITE SEEDLESS" fit */
#dd-variety.open .filter-dd-menu { min-width: 200px; }
#dd-variety .filter-dd-option { white-space: nowrap; }
/* Long-name dropdowns (exporter/importer/port): widen menu so full names are readable */
#dd-exporter .filter-dd-menu,
#dd-importer .filter-dd-menu,
#dd-port .filter-dd-menu {
    right: auto;
    min-width: 340px;
    max-width: 460px;
}
#dd-exporter .filter-dd-item-text,
#dd-importer .filter-dd-item-text,
#dd-port .filter-dd-item-text {
    white-space: normal;
    line-height: 1.3;
}
.filter-dd-search {
    width: calc(100% - 12px);
    margin: 4px 6px 6px;
    padding: 6px 8px;
    background: rgba(0,0,0,0.04);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 11px;
    font-family: inherit;
    outline: none;
}
.filter-dd-search::placeholder { color: var(--text-muted); }
.filter-dd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 12px;
}
.filter-dd-item:hover { background: rgba(0,0,0,0.03); }
.filter-dd-item.selected { color: var(--green-primary); }
.filter-dd-check {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--text-muted);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.filter-dd-item.selected .filter-dd-check {
    background: var(--green-primary);
    border-color: var(--green-primary);
}
.filter-dd-check .material-icons {
    font-size: 13px;
    color: #fff;
    display: none;
}
.filter-dd-item.selected .filter-dd-check .material-icons { display: block; }
.filter-dd-item-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Active filter tags */
.filter-active-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.filter-active-tags:empty { margin-top: 0; }
.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    background: var(--green-glow);
    color: var(--green-primary);
    border-radius: 14px;
    font-weight: 500;
    cursor: default;
}
.filter-tag .remove-tag {
    cursor: pointer;
    font-size: 14px;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.filter-tag .remove-tag:hover { opacity: 1; }
/* Overlay for closing dropdowns */
.filter-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
}
.filter-overlay.active { display: block; }
/* Z-index for open dropdowns */
.filter-group { z-index: 1; }
.filter-group:has(.filter-dropdown.open) { z-index: 60; }
.filter-dd-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 0 0 8px 8px;
    z-index: 61;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

/* Briefing Section */
.briefing-section {
    background: linear-gradient(135deg, rgba(5,150,105,0.06) 0%, rgba(37,99,235,0.04) 100%);
    border: 1px solid rgba(5,150,105,0.15);
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 28px;
}
.briefing-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.briefing-header .material-icons {
    font-size: 28px;
    color: var(--green-primary);
}
.briefing-header h2 {
    font-size: 18px;
    font-weight: 600;
}
.briefing-header .ai-badge {
    font-size: 11px;
    background: var(--green-glow);
    color: var(--green-primary);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
    margin-left: 8px;
}
.briefing-items {
    display: grid;
    gap: 14px;
}
.briefing-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.6);
    border-radius: 10px;
}
.briefing-item .material-icons {
    font-size: 20px;
    color: var(--green-primary);
    margin-top: 2px;
    flex-shrink: 0;
}
.briefing-item p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.briefing-item strong { color: var(--text-primary); font-weight: 600; }

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 22px;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.metric-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 6px;
}
.metric-value.green { color: var(--green-primary); }
.metric-change {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.metric-change.up { color: var(--green-primary); }
.metric-change.down { color: var(--red-primary); }
.metric-change .material-icons { font-size: 16px; }
.metric-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Charts Grid */
.section-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0 4px;
}
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}
.section-divider-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}
.charts-grid {
    display: grid;
    /* 10 columnas con cartas de span 5 = las mismas dos mitades de siempre, pero
       permite pares asimetricos (Mis Variedades 6 / Navieras 4 via inline style). */
    grid-template-columns: repeat(10, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    /* Media fila por defecto (5 de 10 columnas) */
    grid-column: auto / span 5;
    /* Offset for sticky filter bar so card titles aren't hidden when navigated to */
    scroll-margin-top: calc(var(--topbar-height) + 280px);
    /* Prevent grid cells from blowing out their column width when content is wider than the column */
    min-width: 0;
    overflow: hidden;
}
.chart-card .chart-body {
    overflow-x: auto;
    /* Never grow a vertical scrollbar: cards size to their content, so the only
       vertical overflow is 1-4px of chart-margin rounding — which otherwise triggers
       a scrollbar deadlock (V-bar steals width → phantom H-bar appears). */
    overflow-y: hidden;
}
.chart-card.full-width {
    grid-column: 1 / -1;
}
/* El anclaje de seccion (div de altura 0 en la grilla) sigue consumiendo media
   fila, igual que cuando la grilla era de 2 columnas: los emparejados curados
   por fruta (variedades+navieras, etc.) dependen de ese desplazamiento. */
#section-peru {
    grid-column: auto / span 5;
}
.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.seg-toggle {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.seg-toggle button {
    padding: 7px 12px;
    border: none;
    background: #fff;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
    font-family: inherit;
}
.seg-toggle button + button { border-left: 1px solid var(--border-color); }
.seg-toggle button.active { background: var(--green-primary); color: #fff; }
.seg-toggle button:not(.active):hover { background: #f5f5f4; }
.chart-title {
    font-size: 15px;
    font-weight: 600;
}
.chart-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.chart-legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
    flex-shrink: 0;
    white-space: nowrap;
}
.chart-header > div:first-child {
    min-width: 0;
    flex: 1;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}
.chart-body {
    width: 100%;
    min-height: 280px;
}
.chart-body:has(.top20-table) {
    min-height: auto;
}
/* Estado vacío (ej. En Tránsito sin embarques): la carta no reserva la altura
   completa de una tabla que no existe. */
.chart-body:has(.empty-note) {
    min-height: auto;
}
/* Cartas de barras HTML (participación por puerto, comparativos YoY): miden lo
   que mide su contenido — con 1 solo puerto el min-height de 280px pensado para
   ApexCharts dejaba media carta vacía (Ruby, jul-26). */
.chart-body.html-bars,
.chart-body:has(.html-bars) {
    min-height: auto;
}

/* Alerts Section */
.alerts-section {
    margin-bottom: 28px;
}
.alerts-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alerts-title .material-icons { color: var(--orange-primary); font-size: 20px; }
.alerts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.alert-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    border-left: 3px solid var(--orange-primary);
}
.alert-card.info { border-left-color: var(--blue-primary); }
.alert-card.success { border-left-color: var(--green-primary); }
.alert-card .alert-tag {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}
.alert-card .alert-tag.warn { color: var(--orange-primary); }
.alert-card .alert-tag.info { color: var(--blue-primary); }
.alert-card .alert-tag.success { color: var(--green-primary); }
.alert-card p {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1200px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    /* En una sola columna toda carta ocupa la fila completa (pisa el span 5/6/4,
       incluido el inline de la pareja Variedades/Navieras). El anclaje #section-peru
       tambien: su span 5 en grilla de 1 columna creaba 4 columnas implicitas y una
       franja muerta a la derecha en TODAS las filas (auditoria jul-21). */
    .charts-grid .chart-card, .charts-grid #section-peru { grid-column: 1 / -1 !important; }
    .alerts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .topbar, .main-content { margin-left: 0; }
    .metrics-grid { grid-template-columns: 1fr; }
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, rgba(0,0,0,0.03) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Emerging Exporters Section */
.emerging-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    margin-top: 20px;
}
.emerging-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.emerging-header .material-icons {
    font-size: 22px;
    color: var(--orange-primary);
}
.emerging-header .chart-subtitle {
    margin-top: 0;
    margin-left: 8px;
}
.emerging-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.emerging-table th {
    text-align: left;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}
.emerging-table td {
    padding: 10px 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.emerging-table tr:last-child td {
    border-bottom: none;
}
.emerging-table tr:hover td {
    background: rgba(0,0,0,0.02);
}
.emerging-name {
    color: var(--text-primary);
    font-weight: 500;
}
.top20-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.top20-table th {
    text-align: left;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}
.top20-table th.num,
.top20-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
/* Force all columns left-aligned in tables that opt in (per Ruby's preference for some exporter tables) */
.top20-table.table-left-align th,
.top20-table.table-left-align td {
    text-align: left !important;
    font-variant-numeric: tabular-nums;
    padding: 8px 6px;
    white-space: normal;
}
.top20-table.table-left-align td:last-child,
.top20-table.table-left-align th:last-child {
    padding-right: 6px;
}
/* Peru Analysis + Histórico tables → left-aligned for consistency with My Company
   (Ruby Jun 9). Scoped by card/section id so it covers num + inline-centered cells via
   !important, without touching the exporter's own My Company tables. */
#card-top20-exporters table th, #card-top20-exporters table td,
#card-top20-importers table th, #card-top20-importers table td,
#card-vartypes table th, #card-vartypes table td,
#card-exp-imp-flows table th, #card-exp-imp-flows table td,
#card-competitive-ranking table th, #card-competitive-ranking table td,
#card-fob-by-destination table th, #card-fob-by-destination table td,
#tab-historico table th, #tab-historico table td {
    text-align: left !important;
    font-variant-numeric: tabular-nums;
}
#card-top20-exporters table th:last-child, #card-top20-exporters table td:last-child,
#card-top20-importers table th:last-child, #card-top20-importers table td:last-child,
#card-vartypes table th:last-child, #card-vartypes table td:last-child,
#card-exp-imp-flows table th:last-child, #card-exp-imp-flows table td:last-child,
#card-competitive-ranking table th:last-child, #card-competitive-ranking table td:last-child,
#card-fob-by-destination table th:last-child, #card-fob-by-destination table td:last-child,
#tab-historico table th:last-child, #tab-historico table td:last-child {
    padding-right: 12px !important;
}
.top20-table td {
    padding: 8px 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    white-space: nowrap;
}
.top20-table td:first-child {
    color: var(--text-muted);
    text-align: center;
}
.top20-table td:nth-child(2) {
    color: var(--text-primary);
    font-weight: 500;
    white-space: normal;
}
.top20-table td:last-child,
.top20-table th:last-child {
    padding-right: 48px;
}
.top20-table tr:last-child td {
    border-bottom: none;
}
/* Supplier-buyers table: tidy multi-line competitors column, no oversized right gutter */
.supplier-buyers-table td { vertical-align: top; }
.supplier-buyers-table td:last-child,
.supplier-buyers-table th:last-child { padding-right: 14px; }
.top20-table tr:hover td {
    background: rgba(0,0,0,0.02);
}
.top20-table tr.highlight-row td {
    background: rgba(5,150,105,0.08);
    color: var(--green-dark);
    font-weight: 600;
}

/* Lightened ranking tables (importer "My Company"): compact rows, subtle zebra, and a
   data-bar behind the volume column so the table reads as a visual ranking, not a dense grid. */
.top20-table.tbl-light th { padding: 6px 11px; }
.top20-table.tbl-light td { padding: 6px 11px; }
.top20-table.tbl-light.table-left-align th,
.top20-table.tbl-light.table-left-align td { padding: 6px 8px; }
.top20-table.tbl-light td:last-child,
.top20-table.tbl-light th:last-child { padding-right: 16px; }
.top20-table.tbl-light tbody tr:hover td { background: rgba(5,150,105,0.06); }
/* Data-bar + zebra generalised to any .tbl-light table (top20-table AND monthly-table). */
.tbl-light tbody tr:nth-child(even) td { background: rgba(0,0,0,0.018); }
.tbl-light td.bar-cell { position: relative; }
.tbl-light td.bar-cell .bar-fill { position: absolute; left: 7px; top: 5px; bottom: 5px; background: rgba(5,150,105,0.16); border-radius: 3px; pointer-events: none; }
.tbl-light td.bar-cell span { position: relative; }

.monthly-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 13px;
}
.monthly-table colgroup .col-month { width: 42%; }
.monthly-table colgroup .col-boxes { width: 33%; }
.monthly-table colgroup .col-share { width: 25%; }
.monthly-table th {
    text-align: left;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}
.monthly-table td {
    padding: 10px 8px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    text-align: left;
    font-variant-numeric: tabular-nums;
}
.monthly-table td:first-child,
.monthly-table th:first-child {
    color: var(--text-primary);
    font-weight: 500;
}
/* Importer / shipper variants: left-aligned to match the Supplier Performance table
   (header sits directly above its data — Ruby's preferred tidy look). */
.monthly-table-importer th:nth-child(n+2),
.monthly-table-importer td:nth-child(n+2) {
    text-align: left;
}
.monthly-table tr:last-child td {
    border-bottom: none;
}
.monthly-table tr:hover td {
    background: rgba(0,0,0,0.02);
}
.monthly-table-importer {
    table-layout: auto !important;
    width: auto !important;
    min-width: 500px;
}
.monthly-table-importer th:first-child,
.monthly-table-importer td:first-child {
    padding-right: 40px;
}

/* Concentration Risk */
.concentration-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.concentration-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.concentration-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.concentration-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}
.concentration-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(0,0,0,0.06);
    border-radius: 4px;
    overflow: hidden;
}
.concentration-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}
.concentration-value {
    font-size: 14px;
    font-weight: 600;
}
.concentration-risk {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.8;
    margin-left: 6px;
}

/* YoY Arrow indicators */
.yoy-arrow {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 600;
}
.yoy-arrow.up { color: var(--green-primary); }
.yoy-arrow.down { color: var(--red-primary); }

/* FOB/Kg value display */
.fobkg-value {
    font-weight: 600;
    color: var(--green-primary);
    font-size: 13px;
}

.map-tooltip {
    background: #fff !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1) !important;
    color: #1c1917 !important;
}
.map-tooltip::before {
    border-top-color: rgba(0,0,0,0.1) !important;
}

/* Benchmark — controls (top selector) */
.benchmark-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}
.benchmark-controls label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.benchmark-controls select {
    display: inline-block !important;
    padding: 6px 28px 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background: #fff;
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.benchmark-controls select:hover {
    border-color: var(--accent);
}
.benchmark-controls select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(5,150,105,0.12);
}

/* Benchmark — Mi Posición indicator */
.benchmark-my-position {
    background: linear-gradient(135deg, rgba(5,150,105,0.08) 0%, rgba(5,150,105,0.02) 100%);
    border: 1px solid rgba(5,150,105,0.2);
    border-radius: 12px;
    padding: 16px 18px;
    margin-top: 8px;
}
.pos-header {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: 0.3px;
}
.pos-header strong { color: var(--green-primary); }
.pos-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.pos-block { padding: 4px 0; }
.pos-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}
.pos-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.pos-var {
    font-size: 12px;
    font-weight: 600;
}
.pos-var.pos-up { color: var(--green-primary); }
.pos-var.pos-down { color: var(--red-primary, #dc2626); }
@media (max-width: 700px) {
    .pos-body { grid-template-columns: 1fr; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }


/* Hero Stats Strip — 4 key KPIs at top of dashboard */
.hero-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.hero-stat {
    background: linear-gradient(135deg, #ffffff 0%, rgba(5,150,105,0.04) 100%);
    border: 1px solid rgba(5,150,105,0.18);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.hero-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
    margin-bottom: 6px;
}
.hero-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--green-primary);
    line-height: 1.05;
    letter-spacing: -0.5px;
}
.hero-value.neutral { color: var(--text-primary); }
.hero-value.up { color: var(--green-primary); }
.hero-value.down { color: var(--red-primary, #dc2626); }
.hero-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
}
.hero-sub-extra {
    display: inline-block;
    margin-top: 2px;
    font-weight: 600;
    color: var(--text-secondary);
}
.hero-sub-extra.up { color: var(--green-primary); }
.hero-sub-extra.down { color: var(--red-primary, #dc2626); }
@media (max-width: 1100px) {
    .hero-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Alerts section — full width, 3 columns of compact cards */
.alerts-section-full {
    margin-bottom: 24px;
}
.alerts-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.alerts-section-header .material-icons {
    color: var(--orange-primary);
    font-size: 20px;
}
.alerts-section-header h2 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}
.alerts-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    align-items: stretch; /* even card heights per row (Ruby, Jul 9) */
}
/* Uniform white cards — no colored edges (avoids the rainbow "mezcla de colores").
   The only color is a small dot before the tag + the tag text, both subtle. */
.alerts-grid-3 .alert-card {
    padding: 15px 18px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.alerts-grid-3 .alert-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(0,0,0,0.07);
}
/* Tag: neutral uppercase label with a tiny colored dot — the dot is the ONLY color.
   Extra `.alert-card` in the selector beats the base `.alert-card .alert-tag.info` color rule. */
.alerts-grid-3 .alert-card .alert-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    padding: 0;
    background: none;
    margin-bottom: 8px;
    color: var(--text-secondary);
}
.alerts-grid-3 .alert-card .alert-tag::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--orange-primary);
    flex-shrink: 0;
}
.alerts-grid-3 .alert-card .alert-tag.info::before { background: var(--blue-primary); }
.alerts-grid-3 .alert-card .alert-tag.success::before { background: var(--green-primary); }
.alerts-grid-3 .alert-headline {
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-primary);
    font-weight: 600;
}
.alerts-grid-3 .alert-detail {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
    margin-top: 5px;
}
@media (max-width: 1100px) {
    .alerts-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
    .alerts-grid-3 { grid-template-columns: 1fr; }
}

/* Competitor + Peers contextual card (in Mercado Perú section) */
.competitor-peers-card {
    background: linear-gradient(135deg, rgba(5,150,105,0.05) 0%, rgba(37,99,235,0.03) 100%);
    border: 1px solid rgba(5,150,105,0.15);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.compete-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.compete-row .material-icons {
    font-size: 18px;
    color: var(--green-primary);
    flex-shrink: 0;
    margin-top: 2px;
}
.compete-row .compete-body p { margin: 0; }
.compete-row .compete-headline {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.compete-row .compete-detail {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Compact alerts — stacked vertically */
.today-alerts .alerts-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.today-alerts .alert-card {
    padding: 10px 12px;
    border-radius: 8px;
    border-left-width: 3px;
}
.today-alerts .alert-card .alert-tag {
    font-size: 10px;
    margin-bottom: 4px;
}
.alert-headline {
    font-size: 13px;
    line-height: 1.35;
    color: var(--text-primary);
    font-weight: 600;
}
.alert-detail {
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--text-muted);
    margin-top: 3px;
}
/* Responsive: collapse to single column on narrow screens */
@media (max-width: 1100px) {
    .today-panel { grid-template-columns: 1fr; }
}

/* Sidebar view switching: hide blocks not in the active view (layered over
   the per-client-type display logic, hence !important). */
.view-hidden { display: none !important; }
/* Linked-entity drill-down: hide Mi Empresa chart sections when the selected
   sub-entity has no exports of this fruit (only the toggle + notice remain). */
.entity-empty-hide { display: none !important; }

/* Badge "Filtrado/Filtered" en el título de cada carta cuando hay filtros activos:
   una captura de una carta suelta debe revelar que está filtrada. */
/* Tooltip propio (28-sep): el "title" nativo no se mostraba en el Chrome de Ruby.
   Instantáneo, mismo estilo oscuro de los tooltips de los gráficos. */
.ptip { position: relative; cursor: default; }
.ptip::after {
    content: attr(data-tip);
    position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
    background: #1c1917; color: #fff; font-size: 11px; font-weight: 500; line-height: 1.3;
    padding: 5px 8px; border-radius: 6px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 20;
}
.ptip:hover::after { opacity: 1; }
.ptip.below::after { bottom: auto; top: calc(100% + 6px); }
/* Conteo de embarques con FOB junto al precio en las tablas FOB (28-sep). */
.fobn { font-size: 10px; color: var(--text-muted); font-weight: 400; margin-left: 4px; white-space: nowrap; }

/* Etiqueta de ALCANCE (26-sep): "Tú vs Perú" / "Todo el Perú" (exportador) y
   "You vs market" / "Whole market" (importador), solo en Mi Empresa, donde empieza la
   mezcla con el mercado. Negro = tú, verde = mercado, el mismo código de las líneas. */
.scope-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 8px;
    padding: 2px 8px 2px 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 999px;
    vertical-align: middle;
    border: 1px solid transparent;
    white-space: nowrap;
}
.scope-badge i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.scope-badge.peru { color: #065f46; background: #d1fae5; border-color: #a7f3d0; }
.scope-badge.peru i { background: #059669; }
.scope-badge.both { color: #1c1917; background: linear-gradient(90deg, #f5f5f4 50%, #d1fae5 50%); border-color: #d6d3d1; }
.scope-badge.both i { background: linear-gradient(90deg, #1c1917 50%, #059669 50%); }
.scope-row { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 11px; color: var(--text-muted); flex-wrap: wrap; }
.scope-row .scope-badge { margin-left: 0; }

.filter-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 999px;
    vertical-align: middle;
}
