:root {
    --bg: #0f1115;
    --panel: #1a1d23;
    --accent: #4f8cff;
    --text: #e6e8eb;
    --muted: #9aa0a6;
}

* { box-sizing: border-box; }

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

.card {
    max-width: 360px;
    margin: 12vh auto;
    padding: 2rem;
    background: var(--panel);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.card h1 { margin-top: 0; text-align: center; }

form { display: flex; flex-direction: column; gap: 1rem; }

label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); }

input {
    padding: 0.6rem 0.7rem;
    border: 1px solid #2a2e36;
    border-radius: 8px;
    background: #11141a;
    color: var(--text);
    font-size: 1rem;
}

button {
    padding: 0.65rem;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font-size: 1rem;
    cursor: pointer;
}

button:hover { filter: brightness(1.08); }

.error { color: #ff6b6b; text-align: center; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.5rem;
    background: var(--panel);
    border-bottom: 1px solid #2a2e36;
}

.topbar h1 { font-size: 1.1rem; margin: 0; }

.topbar-right { display: flex; align-items: center; gap: 1rem; color: var(--muted); }

.topbar-right a { color: var(--accent); text-decoration: none; }

.content { padding: 1.5rem; max-width: 900px; margin: 0 auto; }

/* ── tabs ── */
.tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0 1.5rem;
    background: var(--panel);
    border-bottom: 1px solid #2a2e36;
}
.tab {
    background: none;
    color: var(--muted);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.8rem 0.6rem;
    font-size: 0.95rem;
    width: auto;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.badge {
    background: #ff6b6b;
    color: #fff;
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.row-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.row-controls label { flex-direction: row; align-items: center; gap: 0.5rem; }
.row-controls input[type="date"] { width: auto; }
.row-controls button { width: auto; padding: 0.5rem 0.9rem; }

.status { font-size: 0.85rem; color: var(--muted); }
.status.ok { color: #51cf66; }
.status.err { color: #ff6b6b; }

/* ── measurement grid ── */
.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td {
    padding: 0.5rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid #2a2e36;
}
.grid th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.grid .ball-no { font-weight: 700; color: var(--accent); }
.grid input { width: 100%; padding: 0.4rem 0.5rem; }
.grid .m-by { color: var(--muted); font-size: 0.85rem; }
.grid .m-save { width: auto; padding: 0.4rem 0.8rem; font-size: 0.85rem; }

/* ── alert cards ── */
.alert-card {
    background: var(--panel);
    border: 1px solid #2a2e36;
    border-left: 4px solid var(--muted);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.alert-card.pending { border-left-color: #ffd43b; }
.alert-card.approved { border-left-color: #51cf66; }
.alert-card.rejected { border-left-color: #ff6b6b; }

.alert-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; }
.alert-meta { color: var(--muted); font-size: 0.8rem; }

.tag {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}
.tag.pending { background: #ffd43b; color: #1a1d23; }
.tag.approved { background: #51cf66; color: #0f1115; }
.tag.rejected { background: #ff6b6b; color: #0f1115; }

.alert-body {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
    margin: 0.5rem 0;
}
.alert-img-link { flex: 1 1 280px; min-width: 0; }

.alert-img {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    background: #11141a;
}

.alert-result { flex: 0 0 auto; display: flex; gap: 1rem; }
.result-col { flex: 0 0 auto; }
.result-title { color: var(--muted); font-size: 0.8rem; margin-bottom: 0.35rem; }
.result-table { border-collapse: collapse; min-width: 110px; }
.result-table th, .result-table td {
    padding: 0.25rem 0.7rem;
    text-align: center;
    border-bottom: 1px solid #2a2e36;
    font-size: 0.85rem;
}
.result-table th { color: var(--muted); font-weight: 500; }
.result-table .rt-ball { font-weight: 700; color: var(--accent); }
.result-table tr.changed { background: rgba(255, 212, 59, 0.12); }
.result-table tr.changed .rt-ball { color: #ffd43b; }
.result-table .warn { font-size: 0.75rem; }
.result-empty { color: var(--muted); font-size: 0.85rem; padding: 0.25rem 0; }
.alert-img.broken { padding: 2rem; color: var(--muted); border: 1px dashed #2a2e36; }
.alert-note { color: var(--text); font-size: 0.9rem; margin: 0.4rem 0; }

.verdict-actions { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.6rem; }
.verdict-actions .v-note { flex: 1; }
.verdict-actions button { width: auto; padding: 0.45rem 0.9rem; }
.verdict-actions .approve { background: #51cf66; }
.verdict-actions .reject { background: #ff6b6b; }

.verdict-info { color: var(--muted); font-size: 0.82rem; margin-top: 0.5rem; }
.empty { color: var(--muted); text-align: center; padding: 2rem; }

/* ── reports ── */
.presets { display: inline-flex; gap: 0.35rem; }
.preset {
    width: auto;
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    background: #2a2e36;
    color: var(--text);
}
.preset:hover { background: #343943; }

.report-h { font-size: 0.95rem; color: var(--text); margin: 1.5rem 0 0.6rem; }
.report-h small { color: var(--muted); font-weight: 400; }

.report-cards { display: flex; gap: 1rem; flex-wrap: wrap; }
.card-stat {
    flex: 1 1 120px;
    background: var(--panel);
    border: 1px solid #2a2e36;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}
.card-stat.approved { border-top: 3px solid #51cf66; }
.card-stat.rejected { border-top: 3px solid #ff6b6b; }
.card-stat.pending { border-top: 3px solid #ffd43b; }
.cs-num { font-size: 1.8rem; font-weight: 700; }
.cs-label { color: var(--muted); font-size: 0.8rem; margin-top: 0.25rem; }

.trend { display: flex; flex-direction: column; gap: 0.3rem; }
.trend-row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.8rem; }
.trend-date { color: var(--muted); width: 3.2rem; flex: 0 0 auto; }
.trend-bars {
    flex: 1 1 auto;
    display: flex;
    height: 14px;
    background: #11141a;
    border-radius: 4px;
    overflow: hidden;
}
.trend-bars .bar { height: 100%; }
.trend-bars .bar.approved { background: #51cf66; }
.trend-bars .bar.rejected { background: #ff6b6b; }
.trend-bars .bar.pending { background: #ffd43b; }
.trend-counts { color: var(--muted); width: 5rem; flex: 0 0 auto; text-align: right; }
