:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #687385;
    --line: #dce3ee;
    --primary: #1457d9;
    --primary-dark: #0f43a6;
    --danger: #b42318;
    --warning: #8a5a00;
    --success: #067647;
    --soft: #eef3ff;
    --shadow: 0 10px 30px rgba(20, 40, 80, 0.08);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef1f6; padding: 2px 6px; border-radius: 6px; }
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--panel);
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
}
.auth-card.wide { max-width: 720px; }
.brand {
    display: inline-block;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 10px;
}
.brand.small { margin-bottom: 4px; }
h1, h2, h3 { margin-top: 0; }
h1 { font-size: 28px; margin-bottom: 8px; }
h2 { font-size: 18px; margin-bottom: 16px; }
p { line-height: 1.5; }
label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 650; color: #2b3648; }
input, select, button {
    font: inherit;
}
input, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 11px;
    background: #fff;
    color: var(--text);
}
button, .file-button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
button:hover, .file-button:hover { border-color: #aebbd0; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-dark); }
button.danger { color: var(--danger); }
button[disabled], button.disabled { opacity: .45; cursor: not-allowed; }
button.full { width: 100%; margin-top: 10px; }
.file-button input { display: none; }
.alert, .notice {
    border-radius: 12px;
    padding: 12px 14px;
    margin: 12px 0;
    line-height: 1.45;
}
.alert.error, .notice.error { background: #fff1f1; color: var(--danger); border: 1px solid #ffd0d0; }
.alert.warning, .notice.warning { background: #fff8e8; color: var(--warning); border: 1px solid #ffe2a5; }
.notice.success { background: #edfdf5; color: var(--success); border: 1px solid #bdebd4; }
.notice.info { background: #eef3ff; color: #17418f; border: 1px solid #ccd9ff; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding: 26px 32px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.topbar p { margin: 0; color: var(--muted); }
.topbar nav { display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 800;
}
.pill.ok { background: #ecfdf3; color: var(--success); }
.pill.warn { background: #fff8e8; color: var(--warning); }
.layout { padding: 24px 32px 48px; max-width: 1680px; margin: 0 auto; }
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}
.panel-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-5 { grid-template-columns: 1fr 1fr 1fr 2fr 1.25fr; }
.controls .filters { margin-top: 14px; }
.checkline { flex-direction: row; align-items: center; align-self: end; padding-bottom: 10px; }
.checkline input { width: auto; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.kpi-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 16px;
}
.kpi-card .label { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.kpi-card .value { font-size: 25px; font-weight: 850; margin-top: 8px; word-break: break-word; }
.kpi-card .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
canvas { width: 100%; border: 1px solid #eef1f6; border-radius: 14px; background: #fff; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; border-bottom: 1px solid #edf1f7; text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: #f8fafc; z-index: 1; color: #42526a; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.details { max-height: 620px; }
.details td { white-space: nowrap; }
.details td.body { white-space: normal; min-width: 280px; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 999px; background: #eef3ff; color: #17418f; font-weight: 800; font-size: 12px; }
.badge.sms { background: #ecfdf3; color: #067647; }
.badge.whatsapp { background: #f0f5ff; color: #175cd3; }
.badge.fail { background: #fff1f1; color: #b42318; }
.meaning-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.meaning { border: 1px solid var(--line); background: #fbfcff; border-radius: 14px; padding: 12px; }
.meaning strong { display: block; margin-bottom: 6px; }
.help { margin-bottom: 0; }
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .cols-4, .cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .meaning-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .topbar { flex-direction: column; padding: 20px; }
    .layout { padding: 16px; }
    .cols-2, .cols-4, .cols-5, .kpi-grid, .meaning-grid { grid-template-columns: 1fr; }
    .panel { padding: 16px; }
    h1 { font-size: 24px; }
}
