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

:root {
    --color-bg: #f5f5f5;
    --color-text: #1a1a1a;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-btn-bg: #ffffff;
    --color-btn-border: #e5e5e5;
    --color-footer: #666;
    --shadow: 0 2px 4px rgba(0,0,0,0.08);
    --radius: 12px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #121212;
        --color-text: #f0f0f0;
        --color-primary: #60a5fa;
        --color-primary-hover: #93c5fd;
        --color-btn-bg: #1e1e1e;
        --color-btn-border: #333;
        --color-footer: #999;
        --shadow: 0 2px 4px rgba(0,0,0,0.3);
    }
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    padding: 1.5rem 1rem;
}

.container {
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 3rem);
}

.container--text {
    max-width: 640px;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header-img {
    width: 100%;
    max-width: 480px;
    height: auto;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.claim {
    font-size: 1rem;
    color: var(--color-footer);
}

.cta {
    text-align: center;
    font-size: 0.9375rem;
    color: var(--color-text);
    margin-bottom: 1.25rem;
    font-weight: 500;
}

.links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 52px;
    padding: 0.875rem 1.25rem;
    background: var(--color-btn-bg);
    border: 1px solid var(--color-btn-border);
    border-radius: var(--radius);
    color: var(--color-text);
    text-decoration: none;
    font-size: 1.0625rem;
    font-weight: 500;
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.link-btn:hover,
.link-btn:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

.link-btn:active {
    transform: translateY(0);
}

.link-btn--primary {
    background: #25D366;
    border-color: #25D366;
    color: #fff;
}

.link-btn--primary:hover,
.link-btn--primary:focus {
    background: #1ebe5a;
    border-color: #1ebe5a;
}

.icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.footer {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-footer);
}

.footer-legal {
    margin-bottom: 0.5rem;
}

.footer-powered {
    font-size: 0.75rem;
    opacity: 0.7;
}

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

.footer a:hover {
    text-decoration: underline;
}

.separator {
    margin: 0 0.5rem;
}

.about {
    margin-top: 2rem;
    padding: 1.25rem;
    background: var(--color-btn-bg);
    border: 1px solid var(--color-btn-border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--color-footer);
}

.about p {
    margin: 0;
}

/* Text pages */
.content {
    flex: 1;
}

.content h2 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
}

.content h2:first-child {
    margin-top: 0;
}

.content h3 {
    font-size: 1rem;
    margin: 1rem 0 0.5rem;
}

.content p {
    margin-bottom: 1rem;
}

/* Login Form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
}

.form-group input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-btn-border);
    border-radius: var(--radius);
    background: var(--color-btn-bg);
    color: var(--color-text);
    font-size: 1rem;
}

.form-group input:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: -1px;
}

.error-box {
    padding: 0.75rem 1rem;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: var(--radius);
    color: #b91c1c;
    font-size: 0.875rem;
}

@media (prefers-color-scheme: dark) {
    .error-box {
        background: #450a0a;
        border-color: #7f1d1d;
        color: #fca5a5;
    }
}

/* Dashboard */
.dashboard {
    max-width: 600px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--color-btn-bg);
    border: 1px solid var(--color-btn-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--color-footer);
}

.dashboard-section {
    margin-bottom: 2rem;
}

.dashboard-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 120px;
    padding: 1rem;
    background: var(--color-btn-bg);
    border: 1px solid var(--color-btn-border);
    border-radius: var(--radius);
}

.chart-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.chart-bar {
    width: 100%;
    background: var(--color-primary);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    height: calc(var(--height) * 8px);
    max-height: 80px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-top: auto;
}

.chart-value {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #fff;
    padding-top: 2px;
}

.chart-label {
    font-size: 0.6875rem;
    color: var(--color-footer);
    margin-top: 0.375rem;
}

.scan-list {
    background: var(--color-btn-bg);
    border: 1px solid var(--color-btn-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.scan-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-btn-border);
    font-size: 0.8125rem;
}

.scan-item:last-child {
    border-bottom: none;
}

.scan-time {
    font-weight: 500;
    white-space: nowrap;
}

.scan-device {
    color: var(--color-footer);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-left: 1rem;
}

.no-data {
    padding: 2rem;
    text-align: center;
    color: var(--color-footer);
}
