:root {
    --bg: #f3f7fb;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #0f766e;
    --primary-dark: #0b5f59;
    --border: #e5e7eb;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius: 16px;
    --ok: #059669;
    --warn: #d97706;
    --danger: #dc2626;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, #e8f5f3 0%, var(--bg) 220px);
    color: var(--text);
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 18px 24px;
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
}

.brand strong {
    display: block;
    font-size: 18px;
}

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

.content {
    width: min(1100px, calc(100% - 32px));
    margin: 24px auto 40px;
    flex: 1;
}

.dashboard-top-fixed {
    margin-bottom: 24px;
}

.welcome {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.welcome-label,
.card-label {
    color: var(--muted);
    font-size: 14px;
}

.welcome h2 {
    margin: 4px 0;
    font-size: 28px;
}

.welcome-email {
    margin: 0;
    color: var(--muted);
}

.welcome-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.period-filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.period-filter-form label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text);
}

.period-filter-form input[type='radio'] {
    accent-color: var(--primary);
}

.period-clear {
    color: var(--primary);
    text-decoration: none;
    font-size: 12px;
    margin-left: 2px;
}

.period-clear:hover {
    text-decoration: underline;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 0;
}

.card,
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.card-value {
    display: block;
    font-size: 32px;
    margin: 10px 0;
}

.card-value small {
    font-size: 16px;
    color: var(--muted);
}

.card-meta,
.empty-state {
    margin: 0;
    color: var(--muted);
}

.panel-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.panel h3,
.legenda h3 {
    margin-top: 0;
}

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

.form-coleta label {
    display: grid;
    gap: 6px;
    font-size: 14px;
    color: var(--muted);
}

.form-coleta input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border-radius: 10px;
    border: none;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.logout-form {
    margin: 0;
}

.alert {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.alert-erro {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-sucesso {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.table-wrap {
    overflow-x: auto;
}

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

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

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

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
}

.status-baixa {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-normal {
    background: #d1fae5;
    color: var(--ok);
}

.status-elevada {
    background: #fef3c7;
    color: var(--warn);
}

.status-alta {
    background: #fee2e2;
    color: var(--danger);
}

.legenda ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.footer {
    text-align: center;
    color: var(--muted);
    padding: 20px;
}

@media (max-width: 900px) {
    .cards,
    .panel-grid {
        grid-template-columns: 1fr;
    }

    .welcome {
        flex-direction: column;
        align-items: flex-start;
    }

    .welcome-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
}

@media (min-width: 901px) {
    .dashboard-top-fixed {
        position: sticky;
        top: 0;
        z-index: 20;
        background: var(--bg);
        padding-top: 8px;
    }
}
