:root {
    --bg: #f5f7fb;
    --panel: rgba(255,255,255,0.92);
    --panel-solid: #ffffff;
    --border: #dbe4f0;
    --text: #18324b;
    --muted: #60758a;
    --brand: #f57c00;
    --brand-dark: #d96500;
    --accent: #8bc34a;
    --shadow: 0 14px 38px rgba(24, 50, 75, 0.12);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(245,124,0,0.10), transparent 28%),
        radial-gradient(circle at top right, rgba(139,195,74,0.12), transparent 30%),
        var(--bg);
}
img { max-width: 100%; display: block; }
button, input, select { font: inherit; }
a { color: inherit; }

.page-shell {
    max-width: 1480px;
    margin: 0 auto;
    padding: 24px;
}

.hero {
    display: grid;
    grid-template-columns: 1.18fr 0.82fr;
    gap: 24px;
    align-items: stretch;
    margin-bottom: 24px;
}

.hero__content,
.hero__logos,
.panel,
#map,
.empty-state {
    background: var(--panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.65);
    box-shadow: var(--shadow);
}

.hero__content {
    border-radius: var(--radius-xl);
    padding: 32px;
    min-height: 260px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(245,124,0,0.12);
    color: var(--brand-dark);
    font-weight: 700;
    letter-spacing: 0.01em;
}
.hero h1 {
    margin: 16px 0 14px;
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 1.05;
}
.hero h1 span { color: var(--brand); }
.hero p {
    margin: 0;
    max-width: 760px;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}
.hero__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}
.hero__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 28px;
}
.stat-card {
    background: rgba(255,255,255,0.84);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}
.stat-card strong {
    display: block;
    font-size: 1.75rem;
    color: var(--brand-dark);
    margin-bottom: 4px;
}
.stat-card span {
    color: var(--muted);
    font-size: 0.95rem;
}

.hero__logos {
    border-radius: var(--radius-xl);
    padding: 22px;
}
.hero__logos-header { margin-bottom: 16px; }
.hero__logos-header h2 { margin: 0 0 6px; }
.hero__logos-header p { margin: 0; color: var(--muted); }
.logo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    height: calc(100% - 58px);
}
.logo-card {
    background: linear-gradient(180deg, #fff, #fafcff);
    border: 1px solid var(--border);
    border-radius: 22px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}
.logo-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.logo-card img {
    max-height: 88px;
    width: auto;
    object-fit: contain;
}

.main-layout {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
.sidebar {
    display: grid;
    gap: 16px;
    position: sticky;
    top: 18px;
}
.panel {
    border-radius: var(--radius-xl);
    padding: 20px;
}
.panel h2 {
    margin: 0 0 14px;
    font-size: 1.1rem;
}
.panel p {
    margin: 6px 0 0;
    color: var(--muted);
}
.panel--compact { padding: 18px; }
.panel--toolbar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 16px;
}
.toolbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.field-label {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
}
.text-input,
.select-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 15px;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.text-input:focus,
.select-input:focus {
    border-color: rgba(245,124,0,0.55);
    box-shadow: 0 0 0 4px rgba(245,124,0,0.12);
}
.chain-list { display: grid; gap: 10px; }
.chain-option {
    display: grid;
    grid-template-columns: auto 58px 1fr;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255,255,255,0.72);
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.chain-option:hover {
    transform: translateY(-1px);
    border-color: rgba(245,124,0,0.35);
    box-shadow: 0 8px 20px rgba(24, 50, 75, 0.08);
}
.chain-option input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}
.chain-option__logo {
    width: 58px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
}
.chain-option__logo img {
    max-height: 34px;
    max-width: 52px;
    object-fit: contain;
}
.chain-option__name { font-weight: 700; font-size: 0.98rem; }
.text-button,
.secondary-button,
.primary-button {
    border: 0;
    border-radius: 999px;
    padding: 11px 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.text-button:hover,
.secondary-button:hover,
.primary-button:hover { transform: translateY(-1px); }
.text-button {
    background: rgba(24,50,75,0.06);
    color: var(--text);
}
.secondary-button {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 8px 18px rgba(24,50,75,0.06);
}
.primary-button {
    background: linear-gradient(135deg, #f57c00, #ff9f2d);
    color: #fff;
    box-shadow: 0 12px 22px rgba(245,124,0,0.24);
}
.result-summary {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}
.summary-label {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.result-summary strong {
    font-size: 1.65rem;
    color: var(--brand-dark);
}
.geo-status {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(139,195,74,0.12);
    color: #356321;
    font-size: 0.94rem;
    line-height: 1.45;
}

.content-area { min-width: 0; }
#map {
    width: 100%;
    height: 760px;
    border-radius: var(--radius-xl);
    overflow: hidden;
}
.empty-state {
    margin-top: 16px;
    border-radius: var(--radius-xl);
    padding: 28px;
    text-align: center;
}
.empty-state h3 { margin: 0 0 10px; }
.empty-state p { margin: 0; color: var(--muted); }

.popup-card {
    min-width: 250px;
    max-width: 280px;
}
.popup-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px;
    margin-bottom: 12px;
}
.popup-logo img {
    max-width: 120px;
    max-height: 56px;
    object-fit: contain;
}
.popup-chain {
    font-weight: 800;
    color: var(--brand-dark);
    margin-bottom: 10px;
    font-size: 1rem;
}
.popup-meta {
    margin-bottom: 7px;
    line-height: 1.45;
    color: var(--text);
}
.popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.popup-link {
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    background: #fff;
}
.popup-link--primary {
    background: linear-gradient(135deg, #f57c00, #ff9f2d);
    color: #fff;
    border-color: transparent;
}

.user-location-marker {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1976d2;
    border: 3px solid white;
    box-shadow: 0 8px 18px rgba(0,0,0,.18);
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: rgba(245,124,0,0.18);
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: rgba(245,124,0,0.88);
    color: #fff;
    font-weight: 800;
}

@media (max-width: 1180px) {
    .hero,
    .main-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
    }
    #map { height: 650px; }
}

@media (max-width: 760px) {
    .page-shell { padding: 14px; }
    .hero__content,
    .hero__logos,
    .panel { padding: 18px; }
    .hero__stats { grid-template-columns: 1fr; }
    .logo-grid { grid-template-columns: 1fr; }
    .logo-card:last-child:nth-child(odd) { grid-column: auto; }
    .panel--toolbar,
    .result-summary {
        flex-direction: column;
        align-items: stretch;
    }
    .toolbar-actions { width: 100%; }
    .toolbar-actions button,
    .hero__actions button,
    .result-summary button { width: 100%; }
    #map { height: 500px; }
}
