:root {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1d2733;
    background: #f3f6f8;
    font-synthesis: none;
    --brand: #42a7ad;
    --brand-dark: #2f7f84;
    --brand-soft: #e8f6f7;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: #f3f6f8;
    color: #1d2733;
}

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

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

button {
    cursor: pointer;
}

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px;
    background: #18222f;
    color: #fff;
}

.main-area {
    min-width: 0;
}

.topbar {
    min-height: 70px;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: #fff;
    border-bottom: 1px solid #dfe5e9;
}

.topbar-subtitle {
    margin-left: 8px;
    color: #6e7c89;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.page-content {
    padding: 28px;
}

.admin-logo {
    display: block;
    width: auto;
    height: auto;
    object-fit: contain;
}

.admin-logo-login {
    width: 140px;
    max-width: 100%;
    margin: 0 auto;
}

.admin-logo-sidebar {
    width: 72px;
    max-height: 46px;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px 24px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.brand small {
    display: block;
    margin-top: 2px;
    color: #aeb9c3;
}

.brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #fff;
    color: #18222f;
    font-weight: 800;
}

.brand-mark-large {
    width: 58px;
    height: 58px;
    margin: 0 auto;
    font-size: 24px;
    background: #18222f;
    color: #fff;
}

.nav-section {
    padding-top: 22px;
    display: grid;
    gap: 6px;
}

.nav-section a {
    padding: 11px 12px;
    border-radius: 9px;
    color: #d9e0e5;
    transition: background .15s ease, color .15s ease;
}

.nav-section a:hover,
.nav-section a.active {
    background: rgba(255,255,255,.10);
    color: #fff;
}

.nav-public-form {
    margin: 18px 12px 0;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

    .nav-public-form a {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 14px;
        color: #ffffff;
        background: #42a7ad;
        border: 1px solid rgba(255, 255, 255, 0.22);
        border-radius: 10px;
        font-weight: 700;
        text-decoration: none;
        transition: background-color 0.2s ease, transform 0.2s ease;
    }

        .nav-public-form a:hover {
            color: #ffffff;
            background: #378f94;
            transform: translateY(-1px);
        }

    .nav-public-form .bi-eye-fill {
        font-size: 1.1rem;
    }

.nav-public-external {
    margin-left: auto;
    font-size: 0.85rem;
    opacity: 0.8;
}

.page-header,
.panel-header,
.actions-row,
.form-footer,
.modal-header,
.modal-actions,
.pagination,
.participant-header,
.modality-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-header {
    margin-bottom: 22px;
}

.page-header h1,
.panel-header h2,
.modal-header h2,
.participant-header h3 {
    margin: 0;
}

.page-header p,
.panel-header p,
.modal-header p,
.empty-state p {
    margin: 5px 0 0;
    color: #6e7c89;
}

.panel {
    margin-bottom: 22px;
    padding: 22px;
    border: 1px solid #dfe5e9;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(22, 35, 48, .04);
}

.panel-narrow {
    max-width: 620px;
}

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

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

.stat-card {
    min-height: 145px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid #dfe5e9;
    border-radius: 14px;
    background: #fff;
}

.stat-card span,
.stat-card small,
.detail-grid span {
    color: #6e7c89;
}

.stat-card strong {
    margin: 6px 0;
    font-size: 30px;
}

.filters-grid,
.form-grid,
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

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

.inscriptions-filters-grid {
    grid-template-columns: minmax(140px, 1fr) minmax(145px, 1fr) minmax(135px, .9fr) minmax(125px, .8fr) minmax(85px, .55fr);
}

    .inscriptions-filters-grid .field-search {
        grid-column: span 2;
    }

.inscriptions-actions-summary {
    margin-top: 18px;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 16px;
}

.inscriptions-actions-buttons {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.inscriptions-filter-totals {
    display: grid;
    grid-template-columns: repeat(2, 240px);
    gap: 10px;
}

.inscriptions-filter-total {
    min-width: 0;
    min-height: 58px;
    padding: 9px 11px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid #dfe5e9;
    border-radius: 8px;
    background: #f8fafb;
}

    .inscriptions-filter-total span {
        color: #6e7c89;
        font-size: 12px;
    }

    .inscriptions-filter-total strong {
        margin-top: 2px;
        font-size: 19px;
    }

.field-search {
    grid-column: span 2;
}

.field {
    min-width: 0;
}

.field-grow,
.field-full {
    grid-column: 1 / -1;
}

.field label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 650;
}

.field small {
    display: block;
    margin-top: 5px;
    color: #6e7c89;
}

.input {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #cfd8de;
    border-radius: 8px;
    background: #fff;
    color: #1d2733;
    outline: none;
}

.input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(66, 167, 173, .18);
}

.textarea {
    min-height: 105px;
    resize: vertical;
}

.checkbox-field {
    align-self: center;
}

.recovery-settings {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 16px;
}

.recovery-options {
    display: grid;
    gap: 12px;
    padding-top: 28px;
}

    .recovery-options .checkbox-field {
        align-self: auto;
    }

        .recovery-options .checkbox-field label {
            margin-bottom: 0;
        }

.checkbox-field label,
.switch-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.validation-message {
    margin-top: 5px;
    color: #b42318;
    font-size: 12px;
}

.button {
    min-height: 40px;
    padding: 9px 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 650;
    transition: opacity .15s ease, transform .15s ease;
}

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

.button:disabled {
    cursor: default;
    opacity: .55;
    transform: none;
}

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

.button-secondary {
    border-color: #cfd8de;
    background: #fff;
    color: #1d2733;
}

.button-small {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 13px;
}

.button-block {
    width: 100%;
}

.link-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: #264f73;
    font-weight: 650;
}

.danger-link {
    color: #b42318;
}

.actions-row,
.form-footer {
    margin-top: 18px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th,
td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #e6ebee;
    font-size: 13px;
}

th {
    color: #5d6b78;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.sortable-header {
    margin: -6px;
    padding: 6px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    white-space: nowrap;
}

.sortable-header:hover,
.sortable-header:focus-visible {
    color: var(--brand-dark);
}

.actions-column {
    min-width: 150px;
}

.row-actions {
    display: flex;
    gap: 11px;
}

.status-chip {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2f5;
    font-size: 12px;
}

.pagination {
    margin-top: 18px;
    color: #6e7c89;
}

.pagination > div {
    display: flex;
    gap: 8px;
}

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

.alert-success {
    border-color: #a6d7be;
    background: #edf8f2;
    color: #17603a;
}

.alert-error {
    border-color: #f0b5b0;
    background: #fff1f0;
    color: #8d211b;
}

.loading-block,
.page-loading {
    padding: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #6e7c89;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #cfd8de;
    border-top-color: #18222f;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    padding: 50px 20px;
    text-align: center;
}

.empty-state.compact {
    padding: 25px;
}

.login-shell {
    min-height: 100vh;
    padding: 24px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top left, rgba(112, 133, 153, .20), transparent 34%),
        #eef2f5;
}

.login-card {
    width: min(430px, 100%);
    padding: 30px;
    border: 1px solid #d7dfe4;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 55px rgba(22, 35, 48, .12);
}

.login-header {
    margin-bottom: 24px;
    text-align: center;
}

.login-header h1 {
    margin: 14px 0 4px;
}

.login-header p {
    margin: 0;
    color: #6e7c89;
}

.login-card .field {
    margin-bottom: 16px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    padding: 22px;
    display: grid;
    place-items: center;
    background: rgba(17, 25, 33, .60);
    overflow-y: auto;
}

.modal-card {
    width: min(720px, 100%);
    max-height: calc(100vh - 44px);
    overflow-y: auto;
    padding: 24px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0,0,0,.22);
}

.modal-large {
    width: min(920px, 100%);
}

.modal-small {
    width: min(520px, 100%);
}

.modal-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: #eef2f5;
    font-size: 24px;
    line-height: 1;
}

.modal-actions {
    margin-top: 22px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.confirmation-backdrop {
    z-index: 1100;
}

.message-modal-backdrop {
    z-index: 1200;
}

.message-modal-card {
    width: min(470px, 100%);
    text-align: center;
}

.message-modal-card h2 {
    margin: 14px 0 8px;
}

.message-modal-card p {
    margin: 0;
    color: #5d6b78;
    line-height: 1.55;
}

.message-modal-icon {
    width: 54px;
    height: 54px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 28px;
    font-weight: 800;
}

.message-modal-icon.is-success {
    background: #e4f5ed;
    color: #17603a;
}

.message-modal-icon.is-error {
    background: #fff1f0;
    color: #b42318;
}

.message-modal-card .modal-actions {
    justify-content: center;
}

.detail-grid {
    margin: 18px 0 22px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-grid > div {
    padding: 14px;
    border-radius: 9px;
    background: #f5f7f9;
}

.detail-grid strong {
    display: block;
    margin-top: 4px;
}

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

.dorsal-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    border: 1px solid #dfe5e9;
    border-radius: 10px;
    text-align: center;
}

.dorsal-card strong {
    font-size: 34px;
}

.dorsal-card small {
    color: #6e7c89;
}

.detail-action-sections {
    margin-top: 22px;
    display: grid;
    gap: 14px;
}

.detail-action-group {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid #dfe5e9;
    border-radius: 10px;
    background: #f8fafb;
}

.detail-action-group h3 {
    margin: 0 0 4px;
    font-size: 15px;
}

.detail-action-group p {
    margin: 0;
    color: #6e7c89;
    font-size: 13px;
}

.detail-action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.participants-list {
    display: grid;
    gap: 16px;
}

.participant-card {
    padding: 18px;
    border: 1px solid #dfe5e9;
    border-radius: 11px;
    background: #fafcfd;
}

.participant-header {
    margin-bottom: 16px;
}

.modality-list {
    display: grid;
    gap: 10px;
}

.modality-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px auto;
    align-items: center;
    gap: 16px;
    padding: 14px;
    border: 1px solid #dfe5e9;
    border-radius: 10px;
}

.modality-main,
.modality-summary {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.modality-main span,
.modality-summary {
    color: #6e7c89;
    font-size: 13px;
}

.config-edition-select {
    max-width: 560px;
}

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

.design-color-grid {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 10px;
}

.color-picker {
    width: 52px;
    min-height: 42px;
    padding: 3px;
    border: 1px solid #cfd8de;
    border-radius: 8px;
    background: #fff;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: 0;
    border-radius: 5px;
}

.color-picker::-moz-color-swatch {
    border: 0;
    border-radius: 5px;
}

.switch-control {
    font-size: 14px;
    font-weight: 650;
}

.break-all {
    word-break: break-all;
}

@media (max-width: 1080px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .inscriptions-filters-grid .field-search {
        grid-column: span 2;
    }

    .inscriptions-actions-summary {
        align-items: stretch;
    }

    .inscriptions-filter-totals {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 760px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
    }

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

    .topbar {
        padding: 14px 18px;
    }

    .topbar-user > span {
        display: none;
    }

    .page-content {
        padding: 18px;
    }

    .page-header,
    .panel-header,
    .modal-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .edition-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .stats-grid,
    .filters-grid,
    .form-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .field-grow,
    .field-full,
    .field-search {
        grid-column: auto;
    }

    .inscriptions-filters-grid .field-search {
        grid-column: auto;
    }

    .inscriptions-actions-summary {
        flex-direction: column;
    }

    .inscriptions-actions-buttons {
        width: 100%;
    }

    .inscriptions-filter-totals {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-action-buttons {
        width: 100%;
        justify-content: flex-start;
    }

    .recovery-settings {
        grid-template-columns: 1fr;
    }

    .recovery-options {
        padding-top: 0;
    }

    .modality-card {
        grid-template-columns: 1fr;
        align-items: start;
    }
}
