* {
    box-sizing: border-box;
}

:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --text: #14213d;
    --muted: #687385;
    --line: #dde4ee;
    --primary: #1d4ed8;
    --primary-dark: #163ea8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --hot: #ef4444;
    --warm: #f59e0b;
    --cold: #2563eb;
    --neutral: #64748b;
    --purple: #7c3aed;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

html {
    scroll-behavior: smooth;
}

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

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

h1, h2, h3, h4, p {
    margin-top: 0;
}

.topbar {
    background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 100%);
    color: #fff;
    padding: 32px 24px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
}

.topbar h1 {
    margin-bottom: 8px;
    font-size: 2rem;
}

.topbar p {
    max-width: 760px;
    color: rgba(255, 255, 255, 0.88);
}

.page {
    max-width: 1480px;
    margin: -32px auto 48px;
    padding: 0 20px;
}

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

.metric-card,
.panel,
.login-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.metric-card {
    padding: 18px;
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 8px;
}

.metric-card strong {
    font-size: 1.9rem;
    font-weight: 700;
}

.panel {
    padding: 20px;
    margin-bottom: 20px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.panel-head p {
    color: var(--muted);
    margin-bottom: 0;
}

.layout-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.9fr;
    gap: 20px;
    align-items: start;
}

.column-main,
.column-side {
    min-width: 0;
}

.filters-grid,
.two-cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.stack {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--text);
}

label span {
    font-weight: 600;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #cdd6e1;
    background: #fff;
    color: var(--text);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #7aa2ff;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

textarea {
    resize: vertical;
    min-height: 96px;
}

.checkbox-line {
    display: flex;
    gap: 10px;
    align-items: center;
    align-self: end;
    padding-bottom: 10px;
}

.checkbox-line input {
    width: 18px;
    height: 18px;
}

.filter-actions {
    display: flex;
    align-items: end;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    transition: 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

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

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

.btn-light {
    background: #eef3fb;
    color: var(--text);
}

.btn-light:hover {
    background: #e2eaf7;
}

.btn-danger {
    background: #fee2e2;
    color: #991b1b;
}

.btn-danger:hover {
    background: #fecaca;
}

.btn-xs {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.86rem;
    border-radius: 10px;
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: inherit;
    font-size: 0.82rem;
    margin-bottom: 14px;
}

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 18px;
    border: 1px solid;
}

.alert-success {
    background: #ecfdf3;
    color: #166534;
    border-color: #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
}

.theme-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
    background: #fff;
}

.theme-table th,
.theme-table td {
    padding: 14px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: top;
    text-align: left;
}

.theme-table thead th {
    background: #f8fafc;
    font-size: 0.9rem;
    color: var(--muted);
    position: sticky;
    top: 0;
    z-index: 2;
}

.theme-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.theme-meta {
    color: var(--muted);
    font-size: 0.86rem;
}

.row-selected {
    background: #f8fbff;
}

.inline-status-form select {
    min-width: 140px;
    padding: 9px 12px;
    border-radius: 10px;
}

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

.actions-cell form {
    margin: 0;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.77rem;
    font-weight: 700;
    margin-right: 6px;
    margin-bottom: 6px;
}

.pill-neutral {
    background: #e2e8f0;
    color: #334155;
}

.pill-quente {
    background: #fee2e2;
    color: #b91c1c;
}

.pill-morna {
    background: #fef3c7;
    color: #b45309;
}

.pill-fria {
    background: #dbeafe;
    color: #1d4ed8;
}

.pill-inusitada {
    background: #ede9fe;
    color: #6d28d9;
}

.pill-dores {
    background: #ffedd5;
    color: #c2410c;
}

.pill-desejo {
    background: #dcfce7;
    color: #15803d;
}

.pill-duvidas {
    background: #e0f2fe;
    color: #0369a1;
}

.pagination-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pagination-summary {
    color: var(--muted);
    font-size: 0.92rem;
}

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

.selected-card {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
}

.selected-card h3 {
    margin: 8px 0 12px;
    line-height: 1.35;
}

.empty-box,
.empty-state {
    padding: 18px;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    color: var(--muted);
    background: #fafcff;
}

.empty-state {
    text-align: center;
}

.subsection {
    margin-top: 20px;
    border-top: 1px solid var(--line);
    padding-top: 20px;
}

.roteiros-list {
    display: grid;
    gap: 14px;
}

.roteiro-card {
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
}

.roteiro-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.roteiro-top h4 {
    margin-bottom: 8px;
}

.roteiro-card p {
    color: #334155;
    margin-bottom: 10px;
    line-height: 1.55;
}

.roteiro-texto {
    padding: 14px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    line-height: 1.6;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

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

.login-card h1 {
    margin-bottom: 8px;
}

.login-card p {
    color: var(--muted);
}

@media (max-width: 1180px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .layout-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .topbar {
        padding: 24px 16px 40px;
        flex-direction: column;
    }

    .page {
        padding: 0 12px;
        margin-top: -26px;
    }

    .dashboard-grid,
    .filters-grid,
    .two-cols {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 16px;
    }

    .panel-head,
    .roteiro-top {
        flex-direction: column;
    }

    .theme-table {
        min-width: 820px;
    }

    .metric-card strong {
        font-size: 1.6rem;
    }

    .top-actions {
        width: 100%;
        justify-content: stretch;
    }

    .top-actions .btn {
        flex: 1;
    }
}
