:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #1f2933;
    --muted: #65748b;
    --line: #d9e2ec;
    --primary: var(--cor-primaria, #4e2cc9);
    --primary-dark: var(--cor-secundaria, #4e2cc9);
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

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

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.auth-panel {
    width: min(420px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
}

.auth-panel h1,
.page-header h1 {
    margin: 0 0 8px;
}

.auth-panel p,
.page-header p {
    margin: 0 0 20px;
    color: var(--muted);
}

.auth-links {
    margin: 16px 0 0;
    text-align: center;
    font-size: 0.92rem;
}

.auth-forgot {
    margin: 14px 0 0;
    text-align: center;
    font-size: 0.92rem;
}

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

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
}

.button-primary,
.button-secondary,
.button-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 0;
    border-radius: 6px;
    padding: 0 14px;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.button-primary {
    background: var(--primary);
}

.button-primary:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.button-secondary {
    background: #52606d;
}

.button-danger {
    background: var(--danger);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.topbar div {
    display: flex;
    gap: 16px;
    align-items: center;
}

.app-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: calc(100vh - 56px);
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    background: #102a43;
}

.sidebar a {
    color: #f0f4f8;
    border-radius: 6px;
    padding: 10px 12px;
}

.sidebar a:hover {
    background: rgba(255, 255, 255, 0.12);
    text-decoration: none;
}

.content {
    padding: 24px;
}

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

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

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

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

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

tr:last-child td {
    border-bottom: 0;
}

.actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.form-card {
    display: grid;
    gap: 16px;
    width: min(620px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
}

.field-hint {
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}

.stat-card strong {
    display: block;
    font-size: 28px;
}

.alert {
    border-radius: 6px;
    margin-bottom: 16px;
    padding: 12px;
}

.alert-error {
    background: #ffebe8;
    color: var(--danger);
}

.alert-success {
    background: #e3fcef;
    color: #0b6b3a;
}

.empty-state {
    color: var(--muted);
    padding: 24px;
}

.inline-form {
    display: inline;
    margin: 0;
}

.link-button {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-decoration: underline;
}

.link-button:hover {
    color: var(--primary-dark, #1a4fd6);
}

@media (max-width: 760px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        flex-direction: row;
        overflow-x: auto;
    }

    .page-header {
        display: grid;
    }
}
