:root {
    color-scheme: light;
    --page: #f4f6f5;
    --surface: #ffffff;
    --ink: #14211d;
    --muted: #566660;
    --line: #dfe5e2;
    --accent: #0e3d35;
    --data: #0f8a65;
    --on-accent: #ffffff;
    --error: #a32020;
    --success: #12683f;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --page: #0c1412;
        --surface: #15211e;
        --ink: #e8efec;
        --muted: #9db0a9;
        --line: #2a3a35;
        --accent: #e5b869;
        --data: #2f9e7e;
        --on-accent: #14211d;
        --error: #ff9a9a;
        --success: #7fd6a8;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font: 16px/1.7 "Segoe UI", Tahoma, "Noto Naskh Arabic", sans-serif;
}

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 1.4rem; margin: 0 0 8px; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
a { color: var(--accent); }
.muted { color: var(--muted); }

.top {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand img { border-radius: 8px; }
nav { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
nav a { text-decoration: none; }
nav a[aria-current="page"] { font-weight: 700; border-bottom: 2px solid var(--accent); }
nav form { margin: 0; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 16px;
    min-width: 0;
}
.narrow { max-width: 400px; margin: 48px auto; display: flex; flex-direction: column; gap: 14px; }
.narrow h1 { text-align: center; }
.center { align-self: center; border-radius: 14px; }
.text { max-width: 760px; margin-inline: auto; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; margin: 0; }
.tile b { font-size: 2rem; line-height: 1.3; }

.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.columns .card { margin: 0; }

label { display: flex; flex-direction: column; gap: 4px; }
input {
    font: inherit;
    color: var(--ink);
    background: var(--page);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 12px;
    width: 100%;
}
button {
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    color: var(--on-accent);
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    padding: 9px 20px;
}
button.link { background: none; color: var(--accent); padding: 0; font-weight: 400; }
:focus-visible { outline: 2px solid var(--data); outline-offset: 2px; }

.notice { margin: 0; padding: 8px 12px; border-radius: 8px; border: 1px solid currentColor; }
.error { color: var(--error); }
.success { color: var(--success); }

.search { display: flex; gap: 8px; margin-bottom: 16px; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--line); }
thead th { color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody th { font-weight: 400; }
td.num { text-align: left; font-variant-numeric: tabular-nums; width: 1%; white-space: nowrap; }
.breakdown th { max-width: 160px; overflow-wrap: anywhere; }
.breakdown .meter { width: 40%; }
.breakdown svg { display: block; }
.wrap { overflow-wrap: anywhere; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--muted); }

.chart { display: block; width: 100%; min-width: 560px; height: auto; }
.bar { fill: var(--data); }
.grid { stroke: var(--line); stroke-width: 1; }
.axis { fill: var(--muted); font-size: 12px; }
.hit { fill: transparent; }
.hit:hover, .hit:focus { fill: var(--ink); fill-opacity: 0.07; outline: none; }

#tooltip {
    position: fixed;
    z-index: 5;
    pointer-events: none;
    background: var(--ink);
    color: var(--surface);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.pager { display: flex; gap: 16px; justify-content: center; margin-top: 14px; }
