:root {
    font-family: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #fff;
    color: #0f3d91;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid #dbe6ff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-weight: 700;
    letter-spacing: .3px;
    color: #0f3d91;
}

.nav a,
.auth a {
    color: #0f3d91;
    text-decoration: none;
    margin-right: 14px;
    font-weight: 600;
}

    .nav a:hover,
    .auth a:hover {
        text-decoration: underline;
    }

.auth {
    margin-left: auto;
    display: flex;
    gap: 12px;
    align-items: center;
}

.me {
    opacity: .85;
    font-size: 14px;
}

.topbar .container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.main {
    padding-top: 18px;
}

.card {
    background: #fff;
    border: 1px solid #dbe6ff;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 6px 20px rgba(15,61,145,.06);
}

.h1 {
    font-size: 24px;
    margin: 0 0 10px 0;
    color: #0f3d91;
}

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

.input,
.btn,
select,
textarea {
    border-radius: 10px;
    border: 1px solid #b7caf4;
    background: #fff;
    color: #0f3d91;
    padding: 10px 12px;
    font: inherit;
}

.input,
select,
textarea {
    min-width: 280px;
    max-width: 100%;
}

.btn {
    cursor: pointer;
    background: #0f3d91;
    color: #fff;
    border-color: #0f3d91;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

    .btn.secondary {
        background: #fff;
        color: #0f3d91;
    }

    .btn:hover {
        filter: brightness(1.05);
    }

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    background: #fff;
}

    .table th,
    .table td {
        padding: 10px;
        border-bottom: 1px solid #e4edff;
        text-align: left;
        font-size: 14px;
        vertical-align: top;
    }

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: #edf4ff;
    border: 1px solid #cfe0ff;
    font-size: 12px;
    color: #0f3d91;
}

.footer {
    opacity: .8;
    font-size: 12px;
    border-top: 1px solid #dbe6ff;
    margin-top: 28px;
    color: #335a9a;
}

.error {
    color: #b42318;
    margin-top: 8px;
}

.success {
    color: #05603a;
    margin-top: 8px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(280px,1fr));
    gap: 12px;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.small {
    font-size: 12px;
    color: #49679b;
}

/* =========================
   Header padrão reutilizável
   ========================= */

.page-header-block {
    margin-bottom: 16px;
}

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

.page-header-main {
    flex: 1 1 420px;
    min-width: 280px;
}

.page-title {
    margin: 0 0 6px 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.15;
    color: #0f3d91;
}

.page-subtitle {
    color: #49679b;
    font-size: 14px;
    line-height: 1.4;
}

.page-header-actions {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
    white-space: nowrap;
}

.page-header-status {
    margin-top: 2px;
}

/* =========================
   Formulários padronizados
   ========================= */

.form-page-card {
    padding: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(12,minmax(0,1fr));
    gap: 12px;
    align-items: start;
}

.form-col-12 {
    grid-column: span 12;
}

.form-col-8 {
    grid-column: span 8;
}

.form-col-6 {
    grid-column: span 6;
}

.form-col-4 {
    grid-column: span 4;
}

.form-col-3 {
    grid-column: span 3;
}

.form-field {
    min-width: 0;
}

    .form-field label,
    .form-label {
        display: block;
        font-weight: 600;
        margin-bottom: 4px;
    }

    .form-field .input,
    .form-field .form-control,
    .form-field select,
    .form-field textarea {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

.form-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

    .form-actions .btn {
        min-width: 110px;
    }

/* =========================
   Página: Boloes/Edit
   ========================= */

.bolao-edit-page .bolao-edit-content {
    align-items: stretch;
}

.bolao-edit-page .bolao-main-card,
.bolao-edit-page .bolao-summary-card,
.bolao-edit-page .bolao-history-card,
.bolao-edit-page .bolao-workflow-card,
.bolao-edit-page .bolao-admin-card {
    border-radius: 14px;
}

.bolao-edit-page .bolao-side-column {
    min-height: 100%;
}

.bolao-edit-page .bolao-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.bolao-edit-page .bolao-action-form {
    min-width: 180px;
    margin: 0;
}

.bolao-edit-page .bolao-history-card {
    overflow: hidden;
}

    .bolao-edit-page .bolao-history-card .card-body {
        overflow-wrap: anywhere;
    }

.bolao-edit-page .list-group-item {
    background: transparent;
}

/* =========================
   Inputs genéricos para páginas antigas
   ========================= */

input[type="text"],
input[type="number"],
input[type="datetime-local"],
input[type="file"],
select,
textarea {
    max-width: 100%;
}

/* =========================
   Responsividade
   ========================= */

@media (min-width:992px) {
    .bolao-edit-page .col-lg-8,
    .bolao-edit-page .col-lg-4 {
        display: flex;
        flex-direction: column;
    }

    .bolao-edit-page .bolao-history-card {
        margin-top: auto;
    }
}

@media (max-width:991.98px) {
    .page-header-row {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header-actions {
        justify-content: flex-start;
        white-space: normal;
    }

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

    .form-col-12,
    .form-col-8,
    .form-col-6,
    .form-col-4,
    .form-col-3 {
        grid-column: span 1;
    }

    .bolao-edit-page .bolao-action-form {
        min-width: 100%;
    }

    .input,
    select,
    textarea {
        min-width: 0;
        width: 100%;
    }
}
/* =========================
   Compatibilidade com classes tipo Bootstrap
   ========================= */

.form-control,
.form-select {
    border-radius: 10px;
    border: 1px solid #b7caf4;
    background: #fff;
    color: #0f3d91;
    padding: 10px 12px;
    font: inherit;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.btn-primary {
    background: #0f3d91;
    color: #fff;
    border: 1px solid #0f3d91;
}

.btn-outline-primary {
    background: #fff;
    color: #0f3d91;
    border: 1px solid #0f3d91;
}

.btn-success {
    background: #0f3d91;
    color: #fff;
    border: 1px solid #0f3d91;
}

.btn-outline-secondary {
    background: #fff;
    color: #0f3d91;
    border: 1px solid #0f3d91;
}

.btn-outline-danger {
    background: #fff;
    color: #b42318;
    border: 1px solid #b42318;
}

.btn-outline-warning {
    background: #fff;
    color: #9a6700;
    border: 1px solid #e3b341;
}

.w-100 {
    width: 100%;
}

.text-end {
    text-align: right;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.alert {
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid transparent;
}

.alert-danger {
    color: #b42318;
    background: #fff5f5;
    border-color: #f1c0c0;
}

.alert-success {
    color: #05603a;
    background: #f1fff7;
    border-color: #b7ebcd;
}

.page-toolbar-right {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.password-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

    .password-input-group .form-control {
        padding-right: 48px;
    }

.password-toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    padding: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #49679b;
    cursor: pointer;
}

    .password-toggle-btn:focus {
        outline: none;
        box-shadow: none;
    }

.password-icon {
    font-size: 16px;
    line-height: 1;
}

.login-form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

.login-form-actions .btn {
    min-width: 120px;
}

.password-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-sm {
    padding: 5px 8px;
    font-size: 12px;
    line-height: 1.2;
    border-radius: 8px;
}

.pool-table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    flex-wrap: nowrap;
}

.pool-table-actions .btn {
    min-width: 0;
    white-space: nowrap;
}

/* =========================
   Feedback e ajuda contextual
   ========================= */

.toast-message {
    border-radius: 12px;
    padding: 12px 14px;
    margin: 0 0 14px 0;
    border: 1px solid;
    box-shadow: 0 10px 24px rgba(15,61,145,.10);
    font-weight: 600;
}

.toast-success {
    color: #05603a;
    background: #f1fff7;
    border-color: #b7ebcd;
}

.toast-error {
    color: #b42318;
    background: #fff5f5;
    border-color: #f1c0c0;
}

.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 5px;
    border-radius: 999px;
    border: 1px solid #b7caf4;
    color: #0f3d91;
    background: #edf4ff;
    font-size: 12px;
    font-weight: 700;
    cursor: help;
    vertical-align: text-top;
}

.review-list {
    display: grid;
    gap: 8px;
}

.review-item {
    border: 1px solid #dbe6ff;
    border-radius: 10px;
    padding: 10px;
    background: #fbfdff;
}

.form-label,
.form-field label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.form-label + .help-tip,
.form-field label + .help-tip {
    margin-left: 0;
    margin-bottom: 4px;
}

/* Ajustes operacionais: ajuda contextual e data/hora compacta */
.help-tip {
    position: relative;
}

.help-tip:hover::after,
.help-tip:focus::after {
    content: attr(title);
    position: absolute;
    z-index: 50;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: max-content;
    max-width: 260px;
    white-space: normal;
    border: 1px solid #b7caf4;
    border-radius: 10px;
    background: #0f2544;
    color: #fff;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.35;
    box-shadow: 0 10px 24px rgba(15,61,145,.18);
}

.datetime-compact {
    max-width: 220px;
}
