:root {
    --bg: #f3f1ea;
    --bg-side: #1e2a22;
    --side-text: #e8efe9;
    --side-muted: #9fb0a4;
    --card: #fff;
    --text: #152019;
    --muted: #5f6b62;
    --accent: #2f7d4a;
    --accent-hover: #256339;
    --accent-soft: #e4f0e8;
    --border: #e0dbd0;
    --warn: #b45309;
    --shadow: 0 1px 2px rgba(21, 32, 25, 0.06), 0 8px 24px rgba(21, 32, 25, 0.05);
    --radius: 12px;
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

.side {
    background: var(--bg-side);
    color: var(--side-text);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.brand {
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
    color: #fff;
}

.brand small {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--side-muted);
    margin-top: 0.2rem;
}

.nav a {
    display: block;
    color: var(--side-muted);
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    font-size: 0.9rem;
    text-decoration: none;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.side-foot {
    margin-top: auto;
    font-size: 0.72rem;
    color: var(--side-muted);
    line-height: 1.5;
}

.main {
    padding: 1.25rem 1.5rem 2.5rem;
    max-width: 1100px;
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.topbar h1 {
    margin: 0;
    font-size: 1.45rem;
    letter-spacing: -0.02em;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.bad { background: #fde8e8; color: #b91c1c; }

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

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

.kpi span { font-size: 0.78rem; color: var(--muted); }
.kpi strong {
    display: block;
    font-size: 1.5rem;
    margin-top: 0.15rem;
    font-variant-numeric: tabular-nums;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
}

.card-head {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.95rem;
    background: linear-gradient(180deg, #faf9f7, #fff);
}

.card-body { padding: 1rem; }

.chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 160px;
    padding-top: 0.5rem;
}

.chart-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.chart-bar-wrap {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.chart-bar {
    width: 72%;
    max-width: 28px;
    background: linear-gradient(180deg, #4caf73, var(--accent));
    border-radius: 4px 4px 2px 2px;
    min-height: 2px;
    transition: opacity 0.15s;
}

.chart-col:hover .chart-bar { opacity: 0.85; }

.chart-label {
    font-size: 0.62rem;
    color: var(--muted);
    transform: rotate(-45deg);
    transform-origin: top left;
    white-space: nowrap;
    margin-top: 8px;
    height: 24px;
}

.chart-tip {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 0.5rem;
}

.site-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.site-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    background: #fafcf9;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.site-card h3 {
    margin: 0;
    font-size: 1rem;
}

.site-card .meta { font-size: 0.75rem; color: var(--muted); }

.site-metrics {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
}

.site-metrics b { font-size: 1.1rem; display: block; }

.site-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.btn {
    font-size: 0.78rem;
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    color: var(--text);
    text-decoration: none;
    display: inline-block;
}

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

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

.btn.primary:hover {
    background: var(--accent-hover);
    color: #fff;
    text-decoration: none;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

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

table.data th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

.url-cell {
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--mono);
    font-size: 0.75rem;
}

.snippet {
    width: 100%;
    font-family: var(--mono);
    font-size: 0.68rem;
    padding: 0.45rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8f7f4;
    resize: vertical;
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: #fef3c7;
    color: #92400e;
    margin-bottom: 1rem;
    border: 1px solid #fde68a;
}

.empty {
    color: var(--muted);
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .side { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .side-foot { display: none; }
    .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .main { padding: 1rem; }
    .chart-label { display: none; }
}
