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

:root {
    --primary: #0d5171;
    --primary-light: #1a6d96;
    --primary-dark: #083a52;
    --accent: #e8604c;
    --accent-light: #f0806f;
    --bg: #ffffff;
    --bg-card: #f5f7fa;
    --bg-hover: #edf1f5;
    --border: #dde3ea;
    --text: #1a2332;
    --text-muted: #5a6a7a;
    --text-dim: #8b96a3;
    --green: #2eab5b;
    --mono: 'SF Mono', 'Cascadia Code', 'Courier New', monospace;
    --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
}

.header h1 span {
    color: var(--accent);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.version {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-family: var(--mono);
}

/* Summary card */
.summary {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: var(--primary);
    border-radius: 12px;
    margin-bottom: 2rem;
    color: #fff;
}

.total-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255,255,255,0.7);
    margin-bottom: 0.5rem;
}

.total-value {
    font-family: var(--mono);
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

.total-sub {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.55);
    margin-top: 0.4rem;
}

/* Charts row */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
}

.chart-card .section-title {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 1rem;
}

.chart-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.donut-chart {
    position: relative;
}

.donut-legend {
    margin-top: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-value {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text);
    font-weight: 500;
}

.bar-chart {
    width: 100%;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.bar-label {
    width: 120px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.bar-track {
    flex: 1;
    height: 22px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.bar-amount {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    min-width: 55px;
    text-align: right;
}

/* Section */
.section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
}

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

thead th {
    text-align: left;
    padding: 0.65rem 1rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    white-space: nowrap;
    background: var(--bg-card);
}

thead th.num {
    text-align: right;
}

tbody td {
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: none;
}

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

td.num {
    text-align: right;
    font-family: var(--mono);
    font-size: 0.82rem;
}

td.token-name {
    font-weight: 600;
    color: var(--primary-dark);
}

td.pct-bar {
    width: 80px;
}

.pct-bar-inner {
    height: 6px;
    border-radius: 3px;
    background: var(--accent);
}

td.holder-name {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--primary-dark);
    font-weight: 500;
}

/* Footer / status */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

.status-text {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-family: var(--mono);
}

.btn-refresh {
    font-family: var(--sans);
    font-size: 0.75rem;
    padding: 0.35rem 0.9rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.btn-refresh:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-refresh:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Loading / error states */
.state-msg {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.state-msg.error {
    color: var(--accent);
}

.spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2.5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-bottom: 0.8rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Login screen */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
}

.login-card {
    text-align: center;
    padding: 3rem 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 400px;
    width: 100%;
}

.login-card h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.login-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.btn-google {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1.5rem;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 6px;
    font-family: var(--sans);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.btn-google:hover {
    background: #f7f8f8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.login-status {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.login-error {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--accent);
    display: none;
}

/* User info */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
}

.user-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-logout {
    font-family: var(--sans);
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-dim);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.btn-logout:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Footer links */
.footer {
    text-align: center;
    padding-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Mobile */
@media (max-width: 700px) {
    .container {
        padding: 1rem;
    }

    .total-value {
        font-size: 2.2rem;
    }

    .header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .bar-label {
        width: 80px;
        font-size: 0.7rem;
    }

    table {
        font-size: 0.82rem;
    }

    thead th, tbody td {
        padding: 0.5rem 0.7rem;
    }
}
