:root {
    --bg: #faf9f7;
    --surface: #ffffff;
    --text: #1c1917;
    --muted: #78716c;
    --border: #e7e5e4;
    --primary: #c2410c;
    --primary-hover: #9a3412;
    --ok: #15803d;
    --error: #b91c1c;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(28, 25, 23, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.container {
    width: min(1100px, 92vw);
    margin: 0 auto;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.9rem 0;
}

.brand {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.nav a.active,
.nav a:hover {
    color: var(--primary);
    background: #fff7ed;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-email {
    color: var(--muted);
    font-size: 0.875rem;
}

.main-content {
    padding: 2rem 0 4rem;
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    color: var(--muted);
    font-size: 0.875rem;
}

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

.page-header h1 {
    margin: 0;
    font-size: 1.75rem;
}

.status-badge {
    font-size: 0.8125rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
}

.status-ok {
    background: #dcfce7;
    color: var(--ok);
}

.status-error {
    background: #fee2e2;
    color: var(--error);
}

.meta, .hint {
    color: var(--muted);
    font-size: 0.9375rem;
}

.hint-inline {
    font-size: 0.75rem;
    color: var(--muted);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.metric-card h2 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-card dl {
    margin: 0;
    display: grid;
    gap: 0.65rem;
}

.metric-card dl div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.metric-card dt {
    color: var(--muted);
    font-size: 0.875rem;
}

.metric-card dd {
    margin: 0;
    font-weight: 700;
    font-size: 1.125rem;
}

.chart-section {
    margin-top: 2.5rem;
}

.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.chart-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

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

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #fafaf9;
    font-size: 0.8125rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.load-more-wrap,
.load-more-cell {
    text-align: center;
    padding: 1rem;
}

.auth-card {
    max-width: 420px;
    margin: 3rem auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.auth-card.wide {
    max-width: 480px;
}

.auth-card h1 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
}

.subtitle {
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.qr-wrap {
    margin: 1rem 0 1.5rem;
}

.form {
    text-align: left;
    display: grid;
    gap: 0.75rem;
}

.form-input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 0.9375rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #f5f5f4;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    padding: 0.4rem 0.75rem;
}

.btn-google {
    width: 100%;
}

.btn-sm {
    padding: 0.45rem 0.9rem;
    font-size: 0.875rem;
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fee2e2;
    color: var(--error);
}

.error {
    color: var(--error);
}

.success {
    color: var(--ok);
}

.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: #eff6ff;
}

code {
    background: #f5f5f4;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-size: 0.875em;
}
