:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #17202a;
    --muted: #64748b;
    --line: #dbe3ef;
    --brand: #165d59;
    --brand-2: #2f7f7a;
    --accent: #b83258;
    --ok: #1f8a5b;
    --warn: #b7791f;
    --bad: #b42318;
    --idle: #475569;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    align-items: center;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 20px;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 3;
}

.brand {
    color: var(--brand);
    font-size: 20px;
    font-weight: 700;
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.topbar nav a {
    border-radius: 6px;
    color: var(--muted);
    font-weight: 700;
    padding: 10px 12px;
}

.topbar nav a:hover {
    background: #eef6f5;
    color: var(--brand);
}

.shell {
    margin: 0 auto;
    max-width: 1180px;
    padding: 28px;
}

.login-shell {
    align-items: center;
    display: flex;
    min-height: 100vh;
    justify-content: center;
    padding: 24px;
}

.page-head {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 22px;
}

h1, h2, h3 {
    margin: 0;
}

h1 {
    font-size: 30px;
}

h2 {
    font-size: 20px;
}

p {
    color: var(--muted);
    line-height: 1.5;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel,
.metric,
.login-card,
.contact-row {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.panel {
    padding: 20px;
}

.metric {
    display: block;
    padding: 18px;
}

.metric small {
    color: var(--muted);
    display: block;
    font-weight: 700;
    margin-bottom: 10px;
}

.metric strong {
    display: block;
    font-size: 32px;
}

.metric.pending { border-top: 4px solid var(--idle); }
.metric.confirmed { border-top: 4px solid var(--ok); }
.metric.no_response { border-top: 4px solid var(--warn); }
.metric.wrong_contact { border-top: 4px solid var(--bad); }

.toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tab,
.btn,
button,
input,
select,
textarea {
    border-radius: 6px;
    font: inherit;
}

.tab {
    border: 1px solid var(--line);
    color: var(--muted);
    padding: 10px 12px;
}

.tab.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn,
button {
    background: var(--brand);
    border: 1px solid var(--brand);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 42px;
    padding: 11px 14px;
}

.btn.secondary,
button.secondary {
    background: #fff;
    color: var(--brand);
}

.btn.whatsapp {
    background: #1f8a5b;
    border-color: #1f8a5b;
}

input,
select,
textarea {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
    min-height: 42px;
    padding: 10px 12px;
    width: 100%;
}

textarea {
    min-height: 120px;
}

label {
    color: var(--muted);
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
}

.form-grid {
    display: grid;
    gap: 14px;
}

.login-card {
    max-width: 420px;
    padding: 28px;
    width: 100%;
}

.login-card h1 {
    color: var(--brand);
    margin-bottom: 8px;
}

.contact-row {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 10px;
    padding: 16px;
}

.contact-row h2 {
    font-size: 18px;
    margin-bottom: 8px;
}

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

.badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
}

.badge-pending { background: #e2e8f0; color: #334155; }
.badge-confirmed { background: #d8f5e7; color: #176347; }
.badge-no_response { background: #fff1cf; color: #805300; }
.badge-wrong_contact { background: #ffe0dc; color: #9f1d14; }

.source-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.source-flags span {
    background: #eef2f7;
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    padding: 5px 8px;
}

.timeline {
    display: grid;
    gap: 10px;
}

.timeline-item {
    border-left: 3px solid var(--brand-2);
    padding: 3px 0 8px 12px;
}

.flash {
    border-radius: 8px;
    font-weight: 700;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.flash.success { background: #d8f5e7; color: #176347; }
.flash.error { background: #ffe0dc; color: #9f1d14; }

.pagination {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

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

td,
th {
    border-bottom: 1px solid var(--line);
    padding: 11px 8px;
    text-align: left;
}

th {
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 800px) {
    .topbar,
    .page-head,
    .contact-row {
        display: block;
    }

    .topbar nav {
        margin-top: 10px;
    }

    .grid-4,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .shell {
        padding: 18px;
    }
}
