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

:root {
    --bg: #08080c;
    --bg-card: rgba(255,255,255,0.033);
    --bg-card-hover: rgba(255,255,255,0.058);
    --border: rgba(255,255,255,0.072);
    --border-hover: rgba(255,255,255,0.14);
    --text: #ebebec;
    --text-2: #8c8ca0;
    --text-3: #4e4e62;
    --text-muted: #8c8ca0;
    --green: #10b981;
    --green-dark: #059669;
    --emerald: #10b981;
    --accent: #10b981;
    --accent-soft: rgba(16,185,129,0.09);
    --accent-glow: rgba(16,185,129,0.2);
    --accent-border: rgba(16,185,129,0.22);
    --blue: #60a5fa;
    --gold: #fbbf24;
    --red: #f87171;
    --purple: #a78bfa;
    --ease: cubic-bezier(.4, 0, .2, 1);
    --dur: 0.18s;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 0 24px 60px;
    max-width: 1200px;
    margin: 0 auto;
    -webkit-font-smoothing: antialiased;
    animation: pageIn .32s var(--ease) both;
}
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 36px;
    position: sticky; top: 0; z-index: 50;
    background: rgba(8,8,12,.88);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    margin-left: -24px; margin-right: -24px;
    padding-left: 24px; padding-right: 24px;
    isolation: isolate;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
}

.logo-mark {
    width: 26px; height: 26px;
    background: var(--accent);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; color: #000; flex-shrink: 0;
}

.logo-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.015em;
}

.badge {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent-border);
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

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

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

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.stat-card, .chart-card, .esg-card {
    animation: fadeInUp 0.5s ease-out;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.header-nav {
    display: flex;
    gap: 2px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.hnav-link {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-2);
    text-decoration: none;
    transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.hnav-link:hover {
    color: var(--text);
    background: var(--bg-card-hover);
}

.header-right {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--dur) var(--ease);
    display: inline-flex; align-items: center; gap: 5px;
}

.btn-primary {
    background: var(--accent);
    color: #000;
    border: none;
}

.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-outline {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
}

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

.full-width {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    margin-top: 12px;
    justify-content: center;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: all var(--dur) var(--ease);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.3);
}

.stat-card.green .stat-dot { background: var(--accent); }
.stat-card.emerald .stat-dot { background: var(--emerald); }
.stat-card.blue .stat-dot { background: var(--blue); }
.stat-card.gold .stat-dot { background: var(--gold); }

.stat-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

/* Equivalents Bar */
.equivalents-bar {
    display: flex;
    justify-content: space-around;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 20px;
    margin-bottom: 20px;
    transition: border-color var(--dur) var(--ease);
}
.equivalents-bar:hover { border-color: var(--border-hover); }

.eq-item {
    font-size: 12px; font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}
.eq-item span { font-weight: 700; color: var(--text); }

.eq-icon {
    font-size: 16px;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s;
}

.chart-card:hover {
    border-color: var(--border-hover);
}

.chart-card.wide {
    grid-column: 1 / -1;
}

.chart-card h3 {
    font-size: 12px;
    color: var(--text-2);
    margin-bottom: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ESG Section */
.esg-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.esg-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s;
}

.esg-card:hover {
    border-color: var(--border-hover);
}

.esg-card h3 {
    font-size: 12px;
    color: var(--text-2);
    margin-bottom: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.esg-grade {
    font-size: 68px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    letter-spacing: -0.03em;
}

.esg-label {
    color: var(--text-muted);
    font-size: 13px;
    margin: 12px 0;
}

.reduction-circle {
    width: 140px;
    height: 140px;
    margin: 0 auto;
    position: relative;
}

.reduction-circle svg {
    width: 100%;
    height: 100%;
}

.reduction-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: 800;
    color: var(--green);
}

/* Recent Requests Table */
.recent-section {
    margin-bottom: 24px;
}

.recent-section h3 {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--text-2);
    margin-bottom: 12px;
}

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px 14px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

th {
    background: rgba(255,255,255,0.02);
    color: var(--text-3);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.07em;
}

td.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

tr:hover td {
    background: var(--bg-card-hover);
}

.complexity-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.complexity-simple { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-border); }
.complexity-medium { background: rgba(251,191,36,0.08); color: var(--gold); border: 1px solid rgba(251,191,36,0.2); }
.complexity-complex { background: rgba(248,113,113,0.08); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }

/* API Section */
.api-section {
    margin-bottom: 24px;
}

.api-section h3 {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--text-2);
    margin-bottom: 12px;
}

.code-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-2);
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all var(--dur) var(--ease);
}

.copy-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

pre {
    padding: 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--text-muted);
}

.highlight {
    color: var(--green);
    font-weight: 700;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #0e0e14;
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 500px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-size: 16px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-body label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    margin-top: 12px;
}

.modal-body label:first-child {
    margin-top: 0;
}

textarea, select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

textarea:focus, select:focus {
    outline: none;
    border-color: var(--green);
}

.test-result {
    margin-top: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.result-header {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

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

.result-label {
    color: var(--text-muted);
}

.result-value {
    font-weight: 600;
}

.result-value.green { color: var(--green); }
.result-value.gold { color: var(--gold); }
.result-value.blue { color: var(--blue); }

/* Footer */
.footer {
    text-align: center;
    padding: 24px 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
}

.footer p + p {
    margin-top: 4px;
    font-size: 11px;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .esg-section {
        grid-template-columns: 1fr;
    }
    .equivalents-bar {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
    .header {
        flex-direction: column;
        gap: 12px;
    }
    .header-nav { display: none; }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
