:root {
    --admin-bg: #f7f8fa;
    --admin-surface: #ffffff;
    --admin-border: #e5e7eb;
    --admin-border-strong: #d8dce3;
    --admin-text: #252832;
    --admin-muted: #737b8c;
    --admin-primary: #d6336c;
    --admin-primary-dark: #b92759;
    --admin-primary-soft: #fce8ef;
    --admin-radius: 8px;
    --admin-shadow: 0 5px 18px rgba(27, 34, 48, 0.055);
}

#content-wrapper,
#content {
    background: var(--admin-bg);
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1025;
    display: flex;
    width: 100%;
    height: 72px;
    margin: 0 0 20px;
    padding: 0 28px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--admin-border);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 2px 10px rgba(24, 31, 43, 0.035);
    backdrop-filter: blur(12px);
}

.app-topbar__left,
.app-topbar__actions,
.app-topbar__profile-button,
.app-topbar__create {
    display: flex;
    align-items: center;
}

.app-topbar__menu-button {
    display: grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--admin-border);
    border-radius: 7px;
    outline: 0;
    background: #fff;
    color: #555e6e;
}

.app-topbar__context {
    flex-direction: column;
    line-height: 1.2;
}

.app-topbar__context span {
    color: #9299a7;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.app-topbar__context strong {
    margin-top: 3px;
    color: var(--admin-text);
    font-size: 14px;
    font-weight: 800;
}

.app-topbar__actions {
    margin: 0;
    gap: 12px;
}

.app-topbar__create {
    height: 38px;
    padding: 0 13px;
    gap: 8px;
    border: 1px solid var(--admin-border-strong);
    border-radius: 7px;
    outline: 0;
    background: #fff;
    color: #454c59;
    font-size: 12px;
    font-weight: 800;
    transition: border-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.app-topbar__create::after,
.app-topbar__profile-button::after { display: none; }
.app-topbar__create:hover { border-color: #b9bec8; color: var(--admin-primary); }
.app-topbar__create-chevron { margin-left: 2px; color: #9299a7; font-size: 8px; }

.app-topbar__profile {
    padding-left: 0;
}

.app-topbar__profile-button {
    min-width: 0;
    height: 48px;
    padding: 4px 6px 4px 10px;
    border: 0;
    border-radius: 7px;
    outline: 0;
    background: transparent;
    color: var(--admin-text);
    transition: background-color 160ms ease;
}

.app-topbar__profile-button:hover,
.app-topbar__profile.show .app-topbar__profile-button { background: #f4f5f7; }

.app-topbar__profile-copy {
    max-width: 170px;
    margin-right: 11px;
    align-items: flex-end;
    flex-direction: column;
    line-height: 1.2;
}

.app-topbar__profile-copy strong,
.app-topbar__profile-copy small {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-topbar__profile-copy strong { font-size: 12px; font-weight: 800; }
.app-topbar__profile-copy small { margin-top: 3px; color: var(--admin-muted); font-size: 10px; }
.app-topbar__avatar-wrap { position: relative; width: 34px; height: 34px; }
.app-topbar__avatar {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 7px;
    object-fit: cover;
}

.app-topbar__avatar--initials {
    background: linear-gradient(145deg, #e64b80, #b92759);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.app-topbar__online {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 9px;
    height: 9px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #22a06b;
}

.app-topbar__profile-chevron { margin: 0 6px 0 10px; color: #9ba1ad; font-size: 8px; }

.app-topbar__dropdown {
    min-width: 250px;
    margin-top: 8px;
    padding: 7px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(24, 31, 43, 0.16);
}

.app-topbar__dropdown .dropdown-header {
    padding: 8px 10px;
    color: #8a92a1;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.app-topbar__dropdown .dropdown-item {
    display: flex;
    min-height: 42px;
    padding: 7px 9px;
    align-items: center;
    border-radius: 6px;
    color: #424956;
    font-size: 12px;
}

.app-topbar__dropdown .dropdown-item:hover { background: #f5f6f8; }
.app-topbar__dropdown-icon {
    display: grid;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    margin-right: 10px;
    place-items: center;
    border-radius: 6px;
    background: var(--admin-primary-soft);
    color: var(--admin-primary);
}

.app-topbar__dropdown .dropdown-item > span:last-child { display: flex; flex-direction: column; }
.app-topbar__dropdown .dropdown-item strong { font-size: 12px; }
.app-topbar__dropdown .dropdown-item small { margin-top: 2px; color: var(--admin-muted); font-size: 10px; }
.app-topbar__profile-menu { min-width: 230px; }
.app-topbar__profile-menu .dropdown-item i { width: 24px; color: #858d9d; }
.app-topbar__profile-summary { display: flex; padding: 8px 10px; flex-direction: column; }
.app-topbar__profile-summary strong { color: var(--admin-text); font-size: 12px; }
.app-topbar__profile-summary small { margin-top: 3px; color: var(--admin-muted); font-size: 10px; }

.app-breadcrumb-wrap,
.app-flash-wrap,
.crud-page {
    max-width: 1540px;
}

.app-breadcrumb-wrap { margin-bottom: 4px; }
.app-breadcrumb {
    margin: 0;
    padding: 0;
    background: transparent;
    color: var(--admin-muted);
    font-size: 11px;
    font-weight: 700;
}

.app-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: #b5bac4; content: '/'; }
.app-breadcrumb a { color: #777f8e; }
.app-breadcrumb a:hover { color: var(--admin-primary); text-decoration: none; }
.app-breadcrumb i { margin-right: 6px; font-size: 10px; }
.app-breadcrumb .active { color: #a0a6b1; }

.app-flash-wrap { margin-bottom: 12px; }
.app-flash {
    display: flex;
    min-height: 48px;
    margin: 0;
    padding: 12px 44px 12px 14px;
    align-items: center;
    gap: 10px;
    border-width: 1px;
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow);
    font-size: 13px;
    font-weight: 700;
}

.app-flash > i { font-size: 16px; }
.app-flash .close { top: 50%; padding: 10px 14px; transform: translateY(-50%); }

.crud-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 24px;
    padding-bottom: 32px;
}

.crud-page > h1 {
    grid-column: 1;
    margin: 8px 0 24px !important;
    align-self: center;
    color: var(--admin-text) !important;
    font-size: 24px !important;
    font-weight: 800;
    line-height: 1.2;
}

.crud-page > h1::after {
    display: block;
    margin-top: 6px;
    color: var(--admin-muted);
    content: 'Consulte e gerencie os registros deste módulo';
    font-size: 12px;
    font-weight: 500;
}

.crud-page--new > h1::after { content: 'Preencha as informações para criar um novo registro'; }
.crud-page--edit > h1::after { content: 'Revise e atualize as informações deste registro'; }
.crud-page--show > h1::after { content: 'Visualize as informações completas deste registro'; }

.crud-page > .card {
    grid-column: 1 / -1;
    min-width: 0;
    margin-bottom: 20px !important;
    overflow: hidden;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    background: var(--admin-surface);
    box-shadow: var(--admin-shadow) !important;
}

.crud-page > .card:first-of-type {
    grid-column: 2;
    grid-row: 1;
    margin: 8px 0 24px !important;
    align-self: center;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none !important;
}

.crud-page > .card:first-of-type .card-header { display: none; }
.crud-page > .card:first-of-type .card-body {
    display: flex;
    padding: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.crud-page .card-header {
    display: flex;
    min-height: 58px;
    padding: 0 20px !important;
    align-items: center;
    border-bottom: 1px solid var(--admin-border);
    background: #fff;
}

.crud-page .card-header h6 {
    display: flex;
    align-items: center;
    color: var(--admin-text) !important;
    font-size: 13px;
    font-weight: 800 !important;
}

.crud-page .card-header h6 > i {
    display: grid;
    width: 30px;
    height: 30px;
    margin-right: 10px;
    place-items: center;
    border-radius: 6px;
    background: #f3f4f6;
    color: #777f8e;
    font-size: 12px;
}

.crud-page .card-body { padding: 20px; }
.crud-page .btn {
    min-height: 38px;
    padding: 8px 13px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
    line-height: 20px;
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.crud-page .btn i { margin-right: 7px; }
.crud-page .btn:hover { transform: translateY(-1px); }
.crud-page .btn-primary { border-color: var(--admin-primary); background: var(--admin-primary); }
.crud-page .btn-primary:hover { border-color: var(--admin-primary-dark); background: var(--admin-primary-dark); }
.crud-page .btn-light { border-color: var(--admin-border-strong); background: #fff; color: #555d6b; }
.crud-page .btn-outline-secondary { border-color: var(--admin-border-strong); color: #596170; }
.crud-page .btn.is-loading { opacity: 0.72; pointer-events: none; }

.crud-page--index > .card:nth-of-type(2) .card-header { cursor: default; }
.crud-page--index > .card:nth-of-type(2) .card-body { padding-bottom: 12px; background: #fafbfc; }
.crud-page--index > .card:nth-of-type(3) .card-body { padding: 0; }

.crud-page .table-responsive {
    max-height: min(68vh, 760px);
    margin: 0;
    overflow: auto;
    scrollbar-color: #c9ced7 transparent;
    scrollbar-width: thin;
}

.crud-page .table {
    width: 100% !important;
    margin: 0;
    border: 0 !important;
    color: #454c59;
    font-size: 12px;
}

.crud-page .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    height: 46px;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid var(--admin-border-strong) !important;
    background: #f8f9fb;
    color: #737b8a;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
}

.crud-page .table tbody td {
    height: 50px;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid #edf0f3;
    vertical-align: middle;
}

.crud-page .table tbody tr:nth-child(even) { background: #fbfcfd; }
.crud-page .table tbody tr:hover { background: #f7f8fb; }
.crud-page .table tbody tr:last-child td { border-bottom: 0; }
.crud-page .table th:first-child,
.crud-page .table td:first-child { padding-left: 20px; }
.crud-page .table th:last-child,
.crud-page .table td:last-child { padding-right: 20px; }

.crud-table-action {
    display: inline-grid;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0 3px;
    place-items: center;
    border: 1px solid #cdd8ea;
    border-radius: 6px;
    background: #fff;
    color: #3971b9;
    cursor: pointer;
    font: inherit;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.crud-table-action i { margin: 0; font-size: 11px; }
.crud-table-action:hover { border-color: #3971b9; background: #eff6ff; color: #245a9d; text-decoration: none; transform: translateY(-1px); }
.crud-table-action--edit { border-color: #ead39e; color: #a66b00; }
.crud-table-action--edit:hover { border-color: #d79a26; background: #fff8e7; color: #855400; }
.crud-table-action:disabled,
.crud-table-action:disabled:hover {
    cursor: not-allowed;
    opacity: .45;
    transform: none;
}
.crud-table-actions { white-space: nowrap; }

.crud-status {
    display: inline-flex;
    min-height: 24px;
    padding: 4px 8px;
    align-items: center;
    border-radius: 6px;
    background: #eef1f5;
    color: #687180;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.crud-status::before {
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-radius: 50%;
    background: currentColor;
    content: '';
}

.crud-status--success { background: #e8f7f0; color: #167a52; }
.crud-status--danger { background: #fdecee; color: #bd3345; }
.crud-status--warning { background: #fff5df; color: #946200; }
.crud-status--info { background: #eaf2fc; color: #316dab; }

.crud-empty {
    display: flex;
    min-height: 250px;
    padding: 36px 20px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--admin-muted);
    text-align: center;
}

.crud-empty__icon {
    display: grid;
    width: 54px;
    height: 54px;
    margin-bottom: 14px;
    place-items: center;
    border-radius: 8px;
    background: var(--admin-primary-soft);
    color: var(--admin-primary);
    font-size: 20px;
}

.crud-empty strong { color: var(--admin-text); font-size: 14px; }
.crud-empty p { max-width: 360px; margin: 6px 0 16px; font-size: 12px; }

.crud-page form .row > [class*='col-'] { margin-bottom: 16px !important; }
.crud-page form label {
    margin-bottom: 7px;
    color: #4a5260;
    font-size: 11px;
    font-weight: 800;
}

.crud-page form label.is-required::after { margin-left: 3px; color: #dc3545; content: '*'; }
.crud-page .form-control,
.crud-page .custom-select {
    min-height: 42px;
    border: 1px solid #d8dde5;
    border-radius: 6px;
    background-color: #fff;
    color: #343944;
    font-size: 13px;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.crud-page textarea.form-control { min-height: 112px; resize: vertical; }
.crud-page .form-control:focus,
.crud-page .custom-select:focus {
    border-color: #e46a94;
    box-shadow: 0 0 0 3px rgba(214, 51, 108, 0.11);
}

.crud-page input[type='file'].form-control { height: auto; padding: 8px; }
.crud-page input[type='checkbox'].form-control {
    position: relative;
    width: 42px;
    min-height: 22px;
    height: 22px;
    margin-top: 9px;
    padding: 0;
    appearance: none;
    border: 0;
    border-radius: 12px;
    background: #cbd0d8;
    cursor: pointer;
}

.crud-page input[type='checkbox'].form-control::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(20, 25, 35, 0.25);
    content: '';
    transition: transform 160ms ease;
}

.crud-page input[type='checkbox'].form-control:checked { background: var(--admin-primary); }
.crud-page input[type='checkbox'].form-control:checked::after { transform: translateX(20px); }
.crud-page form ul {
    margin: 0 0 5px;
    padding: 7px 10px;
    border-radius: 5px;
    background: #fdecee;
    color: #b52d40;
    font-size: 11px;
    list-style: none;
}

.crud-page form small,
.crud-page .form-text { color: var(--admin-muted); font-size: 10px; }
.crud-page form img { max-width: min(100%, 400px) !important; height: auto; border-radius: 7px; }

.crud-page--show > .card:nth-of-type(2) .card-body { padding: 6px 20px 20px; }
.crud-page--show > .card:nth-of-type(2) table,
.crud-page--show > .card:nth-of-type(2) tbody { display: block; width: 100%; }
.crud-page--show > .card:nth-of-type(2) tbody {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 28px;
}

.crud-page--show > .card:nth-of-type(2) tr {
    display: grid;
    grid-template-columns: minmax(120px, 35%) minmax(0, 1fr);
    min-height: 54px;
    align-items: center;
    border-bottom: 1px solid #edf0f3;
}

.crud-page--show > .card:nth-of-type(2) th,
.crud-page--show > .card:nth-of-type(2) td {
    display: block;
    height: auto;
    padding: 12px 8px;
    border: 0;
    background: transparent;
    font-size: 12px;
    text-align: left;
}

.crud-page--show > .card:nth-of-type(2) th { color: var(--admin-muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.crud-page--show > .card:nth-of-type(2) td { color: var(--admin-text); font-weight: 700; overflow-wrap: anywhere; }

.pagination { margin: 20px 0 0; gap: 4px; }
.page-link {
    min-width: 34px;
    height: 34px;
    padding: 7px 10px;
    border-color: var(--admin-border);
    border-radius: 6px !important;
    color: #5a6372;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}
.page-item.active .page-link { border-color: var(--admin-primary); background: var(--admin-primary); }

.app-delete-modal .modal-content {
    overflow: hidden;
    border: 0;
    border-radius: 8px;
    box-shadow: 0 22px 55px rgba(20, 25, 35, 0.24);
}
.app-delete-modal .modal-body { padding: 28px 28px 16px; text-align: center; }
.app-delete-modal__icon {
    display: grid;
    width: 48px;
    height: 48px;
    margin: 0 auto 14px;
    place-items: center;
    border-radius: 8px;
    background: #fdecee;
    color: #c9384c;
}
.app-delete-modal h5 { color: var(--admin-text); font-size: 17px; font-weight: 800; }
.app-delete-modal p { margin: 7px 0 0; color: var(--admin-muted); font-size: 12px; }
.app-delete-modal .modal-footer { padding: 14px 20px 20px; justify-content: center; border: 0; gap: 6px; }
.app-delete-modal .btn { min-width: 108px; border-radius: 6px; font-size: 12px; font-weight: 800; }
.app-delete-modal .btn i { margin-right: 7px; }

@media (max-width: 991.98px) {
    .crud-page--show > .card:nth-of-type(2) tbody { grid-template-columns: 1fr; }
}

@media (max-width: 767.98px) {
    .app-topbar { height: 64px; margin-bottom: 16px; padding: 0 16px; }
    .app-topbar__actions { margin-left: auto; }
    .app-topbar__profile { padding-left: 0; border-left: 0; }
    .app-topbar__profile-button { padding: 4px; }
    .app-topbar__profile-chevron { margin-left: 8px; }
    .app-breadcrumb-wrap { margin-bottom: 2px; }
    .crud-page { display: block; }
    .crud-page > h1 { margin: 8px 0 18px !important; font-size: 21px !important; }
    .crud-page > .card:first-of-type { margin: 0 0 18px !important; }
    .crud-page > .card:first-of-type .card-body { justify-content: flex-start; flex-wrap: wrap; }
    .crud-page > .card:first-of-type .btn { flex: 1 1 auto; }
    .crud-page .card-header { min-height: 54px; padding: 0 16px !important; }
    .crud-page .card-body { padding: 16px; }
    .crud-page .table-responsive { max-height: none; }
    .crud-page .table { min-width: 680px; }
    .crud-page--show > .card:nth-of-type(2) table { min-width: 0; }
    .crud-page--show > .card:nth-of-type(2) tr { grid-template-columns: 110px minmax(0, 1fr); }
    .crud-page--new > .card:nth-of-type(2) .card-body > form,
    .crud-page--edit > .card:nth-of-type(2) .card-body > form { width: 100%; }
    .crud-page form .btn:not([style*='display: none']) { width: 100%; }
}

@media (max-width: 479.98px) {
    .app-topbar__profile-chevron { display: none; }
    .crud-page > .card:first-of-type .card-body { display: grid; grid-template-columns: 1fr 1fr; }
    .crud-page > .card:first-of-type .btn:first-child:last-child { grid-column: 1 / -1; }
    .crud-page > .card:first-of-type .btn { width: 100%; }
    .crud-page--show > .card:nth-of-type(2) tr { display: block; padding: 10px 0; }
    .crud-page--show > .card:nth-of-type(2) th,
    .crud-page--show > .card:nth-of-type(2) td { padding: 3px 4px; }
}

@media (prefers-reduced-motion: reduce) {
    .app-topbar *,
    .crud-page *,
    .app-delete-modal * { transition-duration: 0.01ms !important; }
}
