@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}
@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}
@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --accent: #00b85c;
    --accent-soft: #dcfce7;
    --navy: #1e293b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--ink);
    min-height: 100vh;
}

.topbar {
    background: #0f2942;
    border-bottom: 3px solid #d97706;
    position: sticky;
    top: 0;
    z-index: 20;
    color: #ffffff;
    transition: transform 0.35s ease, opacity 0.35s ease, max-height 0.35s ease, border-width 0.35s ease;
    max-height: 120px;
    overflow: hidden;
}

.tv-body.topbar-idle .tv-topbar {
    transform: translateY(-100%);
    opacity: 0;
    max-height: 0;
    border-bottom-width: 0;
    pointer-events: none;
}

.topbar-inner {
    max-width: 1360px;
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-badge {
    background: #d97706;
    color: #fff;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    white-space: nowrap;
}

.brand h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
}

.brand p {
    font-size: 0.78rem;
    color: #cbd5e1;
}

.btn-outline, .btn-secondary, .btn-tour, .btn-primary, .btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-sm {
    padding: 0.42rem 0.75rem;
    font-size: 0.78rem;
}

.btn-outline {
    border-color: var(--border);
    color: var(--ink);
    background: var(--surface);
}
.btn-outline:hover { background: var(--bg); }

.topbar .btn-outline {
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}
.topbar .btn-outline:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-secondary {
    background: #e2e8f0;
    color: var(--ink);
}
.btn-secondary:hover { background: #cbd5e1; }

.btn-primary {
    background: var(--navy);
    color: #fff;
}
.btn-primary:hover { background: #0f172a; }

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
}
.btn-danger:hover { background: #fecaca; }

.btn-tour {
    background: var(--accent-soft);
    color: #15803d;
    border-color: #bbf7d0;
}
.btn-tour:hover { background: #bbf7d0; }

/* Admin container */
.container {
    max-width: 1360px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem 1.15rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.75rem;
}

.card-header h2 {
    font-size: 0.95rem;
    font-weight: 700;
}

.card-sub {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-group select,
.filter-group input {
    height: 38px;
    padding: 0 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--ink);
    background: #fff;
}

/* =========================================================
   TV / WIDESCREEN 100vh EXECUTIVE DASHBOARD (Compact 80%-scale feel at 100% zoom)
   ========================================================= */
.tv-topbar-inner {
    max-width: 100%;
    padding: 0.35rem 0.9rem;
}

.tv-body .brand-badge {
    font-size: 0.62rem;
    padding: 0.25rem 0.48rem;
}

.tv-body .brand h1 {
    font-size: 0.88rem;
}

.tv-body .brand p {
    font-size: 0.66rem;
}

.tv-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.tv-controls select,
.tv-controls input {
    height: 27px;
    padding: 0 0.45rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.72rem;
    color: var(--ink);
    background: #fff;
}

.tv-controls input {
    width: 155px;
}

.tv-body .btn-sm {
    padding: 0.26rem 0.55rem;
    font-size: 0.7rem;
}

.is-embed .tv-topbar .btn-outline[href="admin"] {
    display: none !important;
}

.tv-container {
    width: 100%;
    max-width: 100%;
    padding: 0.45rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.tv-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.45rem;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid #0f2942;
    border-radius: 8px;
    padding: 0.4rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
}

.kpi-navy { border-top-color: #0f2942; background: #ffffff; }
.kpi-navy .kpi-value { color: #0f2942; }

.kpi-blue { border-top-color: #1d4ed8; background: #f8faff; }
.kpi-blue .kpi-value { color: #1e40af; }

.kpi-emerald { border-top-color: #059669; background: #f0fdf4; }
.kpi-emerald .kpi-value { color: #047857; }

.kpi-teal { border-top-color: #0d9488; background: #f0fdfa; }
.kpi-teal .kpi-value { color: #0f766e; }

.kpi-amber { border-top-color: #d97706; background: #fffbeb; }
.kpi-amber .kpi-value { color: #b45309; }

.kpi-label {
    font-size: 0.61rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.kpi-value {
    font-size: 1.06rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.15;
}

.kpi-sub {
    font-size: 0.6rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-bento {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 0.45rem;
    min-height: 0;
}

.tv-map-card {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.75rem;
    position: relative;
}

.tv-map-card:fullscreen {
    background: var(--surface);
    padding: 1rem 1.25rem;
    width: 100vw;
    height: 100vh;
}

.tv-map-card:fullscreen #map {
    height: calc(100vh - 80px);
    min-height: 0;
}

.map-split-body {
    display: grid;
    grid-template-columns: 0.9fr 1.5fr;
    gap: 0.6rem;
    flex: 1;
    min-height: 0;
}

@media (max-width: 768px) {
    .map-split-body {
        grid-template-columns: 1fr;
    }
}

#map {
    width: 100%;
    height: 100%;
    min-height: 320px;
    border-radius: 8px;
    overflow: hidden;
}

.active-country-panel {
    display: flex;
    flex-direction: column;
    padding: 0.55rem 0.65rem;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-top: 3px solid #059669;
    border-radius: 8px;
    min-height: 0;
    overflow-y: auto;
}

.acp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.acp-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f2942;
    text-transform: uppercase;
}

.acp-stats {
    font-size: 0.72rem;
    font-weight: 700;
    color: #047857;
    background: #dcfce7;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.acp-companies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.acp-chip {
    font-size: 0.66rem;
    color: #334155;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.18rem 0.45rem;
    white-space: nowrap;
}

.acp-empty {
    font-size: 0.72rem;
    color: var(--muted);
}

.tv-right-col {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.tv-chart-card {
    padding: 0.45rem 0.75rem;
    min-width: 0;
}

.tv-lists-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
    flex: 1;
    min-height: 0;
}

.tv-list-card {
    padding: 0.4rem 0.65rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-left: 3px solid #0f2942;
}

.tv-list-card:nth-child(2) {
    border-left-color: #1d4ed8;
}
.tv-list-card:nth-child(2) .rank-num {
    background: #1d4ed8;
}

.tv-list-card:nth-child(3) {
    border-left-color: #d97706;
}
.tv-list-card:nth-child(3) .rank-num {
    background: #d97706;
}

.tv-ranking-list {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    overflow: visible;
}

@media (max-width: 1199px) {
    .tv-ranking-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .tv-ranking-list {
        grid-template-columns: 1fr;
    }
}

.tv-card-header {
    margin-bottom: 0.35rem;
}

.tv-card-header h2 {
    font-size: 0.78rem;
}

@media (min-width: 1100px) {
    .tv-body {
        height: 100vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    .tv-container {
        flex: 1;
        min-height: 0;
    }
    .tv-bento {
        flex: 1;
        min-height: 0;
    }
    .tv-right-col {
        min-height: 0;
        overflow: hidden;
    }
    .tv-lists-grid {
        flex: 1;
        min-height: 0;
    }
    .tv-list-card {
        min-height: 0;
        overflow: hidden;
    }
    #map {
        min-height: 0;
    }
}

@media (max-width: 1099px) {
    .tv-kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
    .tv-bento {
        grid-template-columns: 1fr;
    }
    #map {
        height: 360px;
    }
}

/* Ranking Lists */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
    min-height: 0;
}

.rank-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.24rem 0.42rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 6px;
    gap: 0.3rem;
}

.rank-left {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.rank-num {
    width: 17px;
    height: 17px;
    border-radius: 4px;
    background: var(--navy);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rank-name {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-meta {
    font-size: 0.58rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-val {
    font-size: 0.65rem;
    font-weight: 700;
    color: #047857;
    white-space: nowrap;
}

/* Monthly Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.3rem;
    height: 66px;
    padding-top: 0.5rem;
    overflow-x: auto;
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    gap: 0.2rem;
}

.bar-fill {
    width: 100%;
    max-width: 24px;
    background: linear-gradient(180deg, #00d26a 0%, #059669 100%);
    border-radius: 4px 4px 2px 2px;
    min-height: 3px;
    transition: height 0.3s ease;
}

.bar-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--muted);
}

.bar-val {
    font-size: 0.58rem;
    color: var(--ink);
    font-weight: 600;
}

/* Tooltip Customization (amCharts) */
.tooltip-container {
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    max-width: 340px;
    white-space: normal;
    padding: 8px;
}

.tooltip-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 6px;
    text-transform: uppercase;
    color: #0f172a;
    border-bottom: 3px solid #00d26a;
    padding-bottom: 4px;
    display: inline-block;
}

.tooltip-summary {
    font-size: 0.8rem;
    color: #475569;
    margin-bottom: 8px;
    font-weight: 600;
}

.tooltip-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tooltip-list li {
    font-size: 0.8rem;
    margin-bottom: 6px;
    padding-left: 14px;
    position: relative;
    line-height: 1.4;
    color: #334155;
    border-bottom: 1px dashed #e2e8f0;
    padding-bottom: 5px;
}

.tooltip-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.tooltip-list li::before {
    content: "■";
    color: #00d26a;
    position: absolute;
    left: 0;
    top: 1px;
    font-size: 0.6rem;
}
