:root {
    --admin-bg: #080b09;
    --admin-bg-soft: #0d120f;
    --admin-sidebar: #090d0a;
    --admin-surface: #111713;
    --admin-surface-2: #171f19;
    --admin-surface-3: #1d281f;
    --admin-border: #28332b;
    --admin-border-light: #354239;
    --admin-text: #f5f7f5;
    --admin-muted: #94a098;
    --admin-green: #74d64d;
    --admin-green-dark: #55af35;
    --admin-gold: #d7b84d;
    --admin-danger: #ef6666;
    --admin-info: #68a9ff;
    --admin-sidebar-width: 264px;
    --admin-topbar-height: 68px;
    --admin-radius-sm: 9px;
    --admin-radius: 13px;
    --admin-radius-lg: 17px;
    --admin-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    overflow-x: hidden;
    color-scheme: dark;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 85% -10%, rgba(116, 214, 77, 0.07), transparent 28%),
        var(--admin-bg);
    color: var(--admin-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
    accent-color: var(--admin-green);
}

/* Estrutura */
.admin-app {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    display: flex;
    width: var(--admin-sidebar-width);
    flex-direction: column;
    padding: 20px 14px;
    overflow: hidden;
    background: linear-gradient(180deg, #090d0a 0%, #080b09 100%);
    border-right: 1px solid var(--admin-border);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 4px 8px 17px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-brand > span {
    display: grid;
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    place-items: center;
    border: 1px solid rgba(116, 214, 77, 0.7);
    border-radius: 12px;
    background: rgba(116, 214, 77, 0.06);
    color: var(--admin-green);
    font-weight: 900;
    letter-spacing: -0.04em;
}

.admin-brand strong,
.admin-brand small {
    display: block;
}

.admin-brand strong {
    font-size: 14px;
    letter-spacing: 0.04em;
}

.admin-brand small {
    margin-top: 2px;
    color: var(--admin-muted);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.admin-sidebar nav {
    flex: 1;
    padding: 9px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--admin-border-light) transparent;
    -webkit-overflow-scrolling: touch;
}

.admin-sidebar nav p {
    margin: 18px 11px 7px;
    color: #667169;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.16em;
}

.admin-sidebar nav a,
.admin-logout {
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 10px;
    padding: 10px 11px;
    border-radius: 9px;
    color: #b4bdb6;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.admin-sidebar nav a:hover,
.admin-logout:hover {
    background: var(--admin-surface-2);
    color: var(--admin-text);
}

.admin-sidebar nav a.active,
.admin-sidebar nav a[aria-current="page"] {
    background: linear-gradient(90deg, rgba(116, 214, 77, 0.16), rgba(116, 214, 77, 0.04));
    color: var(--admin-green);
    box-shadow: inset 3px 0 var(--admin-green);
}

.admin-sidebar nav svg,
.admin-logout svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
}

.sidebar-dropdown-toggle {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    gap: 10px;
    padding: 10px 11px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #b4bdb6;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: color .18s ease, background .18s ease;
}

.sidebar-dropdown-toggle:hover,
.sidebar-dropdown-toggle.has-active {
    background: var(--admin-surface-2);
    color: var(--admin-text);
}

.sidebar-dropdown-toggle.has-active {
    box-shadow: inset 3px 0 var(--admin-green);
}

.sidebar-dropdown-toggle > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-dropdown-toggle .sidebar-dropdown-chevron {
    width: 15px;
    height: 15px;
    margin-left: auto;
    flex: 0 0 15px;
    transition: transform .18s ease;
}

.sidebar-dropdown.open .sidebar-dropdown-chevron {
    transform: rotate(180deg);
}

.sidebar-dropdown-menu {
    margin: 4px 0 7px 18px;
    padding-left: 8px;
    border-left: 1px solid var(--admin-border-light);
}

.sidebar-dropdown-menu[hidden] {
    display: none;
}

.admin-sidebar nav .sidebar-dropdown-menu a {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 12px;
}

.admin-logout {
    margin-top: 10px;
    border: 1px solid var(--admin-border);
}

.admin-main {
    width: calc(100% - var(--admin-sidebar-width));
    min-width: 0;
    margin-left: var(--admin-sidebar-width);
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    height: var(--admin-topbar-height);
    align-items: center;
    justify-content: flex-end;
    padding: 0 26px;
    background: rgba(8, 11, 9, 0.88);
    border-bottom: 1px solid rgba(40, 51, 43, 0.85);
    backdrop-filter: blur(18px);
}

.admin-topbar > button {
    display: none;
}

.admin-topbar > div {
    text-align: right;
}

.admin-topbar strong,
.admin-topbar span {
    display: block;
}

.admin-topbar strong {
    font-size: 13px;
}

.admin-topbar span {
    margin-top: 2px;
    color: var(--admin-muted);
    font-size: 10px;
}

.admin-content {
    width: 100%;
    max-width: 1580px;
    min-width: 0;
    margin: 0 auto;
    padding: 26px;
}

.sidebar-backdrop {
    display: none;
}

/* Cabeçalhos e ações */
.admin-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.admin-page-header > div:first-child {
    min-width: 0;
}

.admin-page-header span,
.modal-eyebrow {
    color: var(--admin-green);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.15em;
}

.admin-page-header h1 {
    margin: 5px 0 4px;
    font-size: clamp(27px, 3vw, 35px);
    line-height: 1.08;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
}

.admin-page-header p,
.admin-card-header p,
.muted {
    margin: 0;
    color: var(--admin-muted);
    font-size: 13px;
}

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

.admin-primary-button,
.admin-secondary-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, filter 0.16s ease;
}

.admin-primary-button {
    border: 0;
    background: linear-gradient(135deg, var(--admin-green), #a4e96b);
    color: #071008;
}

.admin-secondary-button {
    border: 1px solid var(--admin-border-light);
    background: var(--admin-surface-2);
    color: var(--admin-text);
}

.admin-primary-button:hover,
.admin-secondary-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.admin-primary-button svg,
.admin-secondary-button svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
}

/* Superfícies e cards */
.admin-panel-card,
.admin-stats-grid article,
.admin-finance-grid article {
    min-width: 0;
    padding: 17px;
    background: linear-gradient(180deg, rgba(18, 24, 20, 0.98), rgba(15, 21, 17, 0.98));
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 15px;
}

.admin-card-header h2,
.admin-panel-card > h2,
.quick-links > h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.admin-card-header p {
    margin-top: 4px;
}

.admin-card-header > a:not(.modal-close) {
    color: var(--admin-green);
    font-size: 12px;
    font-weight: 800;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.admin-stats-grid span,
.admin-finance-grid span {
    display: block;
    color: var(--admin-muted);
    font-size: 11px;
    line-height: 1.35;
}

.admin-stats-grid strong,
.admin-finance-grid strong {
    display: block;
    margin-top: 6px;
    font-size: 23px;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.admin-finance-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

/* Dashboard */
.dashboard-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-kpis article {
    position: relative;
    display: flex;
    min-height: 84px;
    flex-direction: column;
    justify-content: center;
    padding: 13px 15px 13px 17px;
    overflow: hidden;
}

.dashboard-kpis article::after {
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    content: "";
}

.dashboard-kpis .kpi-count::after {
    background: var(--admin-green);
}

.dashboard-kpis .kpi-money::after {
    background: var(--admin-gold);
}

.dashboard-kpis .kpi-money strong {
    font-size: 19px;
}

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

.dashboard-charts > .admin-panel-card {
    display: flex;
    grid-column: span 6;
    height: 310px;
    flex-direction: column;
    overflow: hidden;
}

.dashboard-charts > .chart-wide {
    grid-column: span 8;
    height: 340px;
}

.dashboard-charts > .admin-panel-card:nth-child(2) {
    grid-column: span 4;
    height: 340px;
}

.dashboard-chart-body {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    margin-top: 10px;
}

.dashboard-chart-body canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
}

.dashboard-tables {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 12px;
    margin-bottom: 15px;
}

.activity-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(40, 51, 43, 0.7);
}

.activity-row:last-child {
    border-bottom: 0;
}

.activity-row > div {
    min-width: 0;
}

.activity-row svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    margin-top: 2px;
    color: var(--admin-green);
}

.activity-row strong,
.activity-row small {
    display: block;
    overflow-wrap: anywhere;
}

.activity-row strong {
    font-size: 12px;
}

.activity-row small {
    margin-top: 3px;
    color: var(--admin-muted);
    font-size: 10px;
}

.quick-links {
    margin-bottom: 15px;
}

.quick-links > div {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    margin-top: 13px;
}

.quick-links a {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    background: var(--admin-surface-2);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-sm);
    color: #d9dfda;
    font-size: 12px;
    font-weight: 700;
}

.quick-links a:hover {
    border-color: rgba(116, 214, 77, 0.45);
    color: var(--admin-green);
}

.quick-links svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    color: var(--admin-green);
}

/* Tabelas */
.admin-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--admin-border-light) transparent;
    -webkit-overflow-scrolling: touch;
}

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

th,
td {
    padding: 12px 13px;
    border-bottom: 1px solid var(--admin-border);
    text-align: left;
    white-space: nowrap;
}

th {
    color: var(--admin-muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

td {
    color: #dce2dd;
    font-size: 12px;
}

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.018);
}

td a {
    color: var(--admin-green);
    font-weight: 800;
}

.admin-status {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(116, 214, 77, 0.12);
    color: #c9f6b8;
    font-size: 10px;
    font-weight: 700;
}

.admin-status.inactive {
    background: rgba(239, 102, 102, 0.12);
    color: #ffbaba;
}

.table-actions {
    display: table-cell;
    vertical-align: middle;
}

.table-actions > a,
.table-actions > form {
    margin-right: 6px;
    vertical-align: middle;
}

.table-actions form {
    display: inline-flex;
    margin: 0;
}

.table-actions a,
.table-actions button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    background: var(--admin-surface-2);
    color: var(--admin-green);
    cursor: pointer;
}

.table-actions button {
    color: var(--admin-danger);
}

.table-actions a:hover,
.table-actions button:hover {
    border-color: var(--admin-border-light);
    background: var(--admin-surface-3);
}

.table-actions svg {
    width: 15px;
    height: 15px;
}

.empty-cell {
    padding: 30px;
    color: var(--admin-muted);
    text-align: center;
}

/* Formulários e filtros */
input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    outline: 0;
    background: #0b110d;
    border: 1px solid var(--admin-border-light);
    border-radius: var(--admin-radius-sm);
    color: var(--admin-text);
    font-size: 13px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

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

input:focus,
select:focus,
textarea:focus {
    border-color: var(--admin-green);
    box-shadow: 0 0 0 3px rgba(116, 214, 77, 0.1);
}

input[type="color"] {
    padding: 5px;
}

input[type="file"] {
    padding: 8px;
}

.admin-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 14px;
}

.admin-filter-bar input {
    flex: 1 1 230px;
}

.admin-filter-bar select {
    flex: 1 1 170px;
}

.admin-filter-bar button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border: 0;
    border-radius: var(--admin-radius-sm);
    background: var(--admin-green);
    color: #071008;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.admin-filter-bar svg {
    width: 16px;
    height: 16px;
}

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

.admin-form-grid label,
.admin-form label,
.admin-login-card label {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
    color: #dce3dd;
    font-size: 12px;
    font-weight: 600;
}

.admin-form-grid .full-field {
    grid-column: 1 / -1;
}

.admin-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 14px;
    margin-top: 14px;
}

.permission-check {
    width: 20px;
    height: 20px;
    min-height: 20px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
}

.pagination a {
    display: grid;
    min-width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    background: var(--admin-surface);
    font-size: 12px;
}

.pagination a.active {
    background: var(--admin-green);
    border-color: var(--admin-green);
    color: #071008;
    font-weight: 900;
}

/* Modal */
.admin-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding:
        max(18px, env(safe-area-inset-top))
        max(18px, env(safe-area-inset-right))
        max(18px, env(safe-area-inset-bottom))
        max(18px, env(safe-area-inset-left));
    overflow: auto;
    background: rgba(0, 0, 0, 0.74);
    backdrop-filter: blur(6px);
}

.admin-modal-dialog {
    width: min(920px, 100%);
    max-height: calc(100vh - 36px);
    max-height: calc(100dvh - 36px);
    margin: auto;
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: var(--admin-radius-lg);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.56);
}

.admin-modal .admin-editor,
.admin-modal .budget-form {
    margin: 0;
}

.modal-eyebrow {
    display: block;
    margin-bottom: 4px;
}

.modal-close {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    border: 1px solid var(--admin-border);
    border-radius: 9px;
    background: var(--admin-surface-2);
    color: var(--admin-text) !important;
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

body.modal-open,
body.sidebar-open {
    overflow: hidden;
}

/* Orçamentos */
.budget-form h3 {
    margin: 20px 0 10px;
    font-size: 15px;
}

.budget-totals {
    margin-top: 16px;
}

.budget-filters {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(130px, 1fr)) auto;
}

.budget-filters button {
    min-height: 42px;
}

.remove-item {
    border: 0;
    background: transparent;
    color: var(--admin-danger);
    cursor: pointer;
}

.attachment-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 0;
    color: var(--admin-green);
    font-size: 12px;
}

/* Mensagens */
.messages-layout {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 12px;
}

.conversation-list {
    max-height: 620px;
    overflow: auto;
}

.conversation-list a {
    position: relative;
    display: block;
    padding: 11px;
    border-bottom: 1px solid var(--admin-border);
}

.conversation-list a.active {
    background: var(--admin-surface-2);
    border-radius: 8px;
}

.conversation-list strong,
.conversation-list small {
    display: block;
}

.conversation-list strong {
    font-size: 12px;
}

.conversation-list small {
    margin-top: 3px;
    color: var(--admin-muted);
    font-size: 10px;
}

.conversation-list span {
    position: absolute;
    top: 9px;
    right: 9px;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--admin-green);
    color: #071008;
    font-size: 10px;
    font-weight: 900;
}

.message-thread {
    min-width: 0;
}

.messages-box {
    height: 420px;
    padding: 11px;
    overflow: auto;
    background: #090e0b;
    border: 1px solid rgba(40, 51, 43, 0.55);
    border-radius: 11px;
}

.message {
    width: fit-content;
    max-width: 76%;
    margin: 7px 0;
    padding: 9px 11px;
    background: var(--admin-surface-2);
    border-radius: 11px 11px 11px 3px;
}

.message.empresa {
    margin-left: auto;
    background: #1d3a22;
    border-radius: 11px 11px 3px;
}

.message p {
    margin: 0 0 4px;
    font-size: 12px;
}

.message small {
    color: var(--admin-muted);
    font-size: 9px;
}

.message-compose {
    display: flex;
    gap: 9px;
    margin-top: 10px;
}

.message-compose textarea {
    min-height: 68px;
}

/* Galeria */
.gallery-admin {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.gallery-admin article {
    overflow: hidden;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
}

.gallery-admin img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.gallery-admin form {
    padding: 9px;
}

.gallery-admin button {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px;
    border: 0;
    background: transparent;
    color: var(--admin-danger);
    cursor: pointer;
}

/* Agenda */
.calendar-card {
    margin-bottom: 14px;
}

.fc {
    --fc-border-color: var(--admin-border);
    --fc-page-bg-color: var(--admin-surface);
    --fc-neutral-bg-color: var(--admin-surface-2);
    --fc-list-event-hover-bg-color: var(--admin-surface-2);
    --fc-button-bg-color: var(--admin-surface-2);
    --fc-button-border-color: var(--admin-border-light);
    --fc-button-hover-bg-color: var(--admin-surface-3);
    --fc-button-active-bg-color: var(--admin-green-dark);
    --fc-today-bg-color: rgba(116, 214, 77, 0.07);
}

.fc .fc-toolbar-title {
    font-size: 18px;
}

.fc a {
    color: inherit;
}

/* Alertas */
.admin-alert {
    margin-bottom: 14px;
    padding: 11px 13px;
    border-radius: 9px;
    font-size: 12px;
}

.admin-alert.success {
    background: rgba(116, 214, 77, 0.13);
    border: 1px solid rgba(116, 214, 77, 0.22);
    color: #c9f6b8;
}

.admin-alert.error {
    background: rgba(239, 102, 102, 0.12);
    border: 1px solid rgba(239, 102, 102, 0.22);
    color: #ffc1c1;
}

/* Login */
.admin-login-body {
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    place-items: center;
    padding:
        max(16px, env(safe-area-inset-top))
        max(16px, env(safe-area-inset-right))
        max(16px, env(safe-area-inset-bottom))
        max(16px, env(safe-area-inset-left));
    background:
        radial-gradient(circle at 50% 35%, rgba(116, 214, 77, 0.12), transparent 32%),
        var(--admin-bg);
}

.admin-login-card {
    width: min(410px, 100%);
    padding: 28px;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 18px;
    box-shadow: var(--admin-shadow);
    text-align: center;
}

.admin-login-logo {
    display: grid;
    width: 62px;
    height: 62px;
    place-items: center;
    margin: 0 auto;
    background: rgba(116, 214, 77, 0.06);
    border: 1px solid var(--admin-green);
    border-radius: 16px;
    color: var(--admin-green);
    font-size: 20px;
    font-weight: 900;
}

.admin-login-card h1 {
    margin: 14px 0 2px;
    font-size: 27px;
}

.admin-login-card > p,
.admin-login-card > a {
    color: var(--admin-muted);
    font-size: 12px;
}

.admin-login-card label {
    text-align: left;
}

.admin-login-card button {
    width: 100%;
    min-height: 44px;
    margin: 4px 0 12px;
    border: 0;
    border-radius: 9px;
    background: var(--admin-green);
    color: #071008;
    font-weight: 900;
    cursor: pointer;
}

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

    .dashboard-tables {
        grid-template-columns: 1fr;
    }

    .quick-links > div {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .admin-sidebar {
        width: min(86vw, 300px);
        height: 100vh;
        height: 100dvh;
        padding:
            max(18px, env(safe-area-inset-top))
            14px
            max(18px, env(safe-area-inset-bottom))
            max(14px, env(safe-area-inset-left));
        transform: translateX(-105%);
        box-shadow: 18px 0 45px rgba(0, 0, 0, 0.4);
        transition: transform 0.22s ease;
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 55;
        display: block;
        padding: 0;
        visibility: hidden;
        opacity: 0;
        background: rgba(0, 0, 0, 0.64);
        border: 0;
        backdrop-filter: blur(2px);
        transition: opacity 0.22s ease, visibility 0.22s ease;
    }

    .sidebar-backdrop.open {
        visibility: visible;
        opacity: 1;
    }

    .admin-main {
        width: 100%;
        margin-left: 0;
    }

    .admin-topbar {
        height: calc(62px + env(safe-area-inset-top));
        justify-content: space-between;
        padding:
            env(safe-area-inset-top)
            max(15px, env(safe-area-inset-right))
            0
            max(12px, env(safe-area-inset-left));
    }

    .admin-topbar > button {
        display: grid;
        width: 42px;
        height: 42px;
        place-items: center;
        padding: 0;
        background: var(--admin-surface);
        border: 1px solid var(--admin-border);
        border-radius: 9px;
        color: var(--admin-text);
    }

    .admin-topbar > button svg {
        width: 21px;
        height: 21px;
    }

    .admin-topbar strong {
        max-width: 58vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .admin-content {
        padding:
            20px
            max(16px, env(safe-area-inset-right))
            max(24px, env(safe-area-inset-bottom))
            max(16px, env(safe-area-inset-left));
    }

    .dashboard-charts > .admin-panel-card,
    .dashboard-charts > .chart-wide,
    .dashboard-charts > .admin-panel-card:nth-child(2) {
        grid-column: span 6;
        height: 315px;
    }

    .admin-detail-grid,
    .messages-layout {
        grid-template-columns: 1fr;
    }

    .conversation-list {
        max-height: 230px;
    }

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

    .budget-filters input:first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .admin-content {
        padding-top: 15px;
        padding-right: max(12px, env(safe-area-inset-right));
        padding-left: max(12px, env(safe-area-inset-left));
    }

    .admin-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }

    .admin-page-header h1 {
        font-size: 28px;
    }

    .admin-page-header > .form-actions > a,
    .admin-page-header > .form-actions > button,
    .admin-page-header > .admin-primary-button,
    .admin-page-header > .admin-secondary-button {
        min-height: 44px;
        flex: 1 1 135px;
    }

    .admin-panel-card,
    .admin-stats-grid article,
    .admin-finance-grid article {
        padding: 13px;
        border-radius: 11px;
    }

    .admin-stats-grid,
    .dashboard-kpis,
    .admin-finance-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .dashboard-kpis article {
        min-height: 80px;
        padding: 11px 11px 11px 14px;
    }

    .dashboard-kpis strong,
    .dashboard-kpis .kpi-money strong {
        font-size: 18px;
    }

    .dashboard-charts {
        grid-template-columns: 1fr;
    }

    .dashboard-charts > .admin-panel-card,
    .dashboard-charts > .chart-wide,
    .dashboard-charts > .admin-panel-card:nth-child(2) {
        grid-column: auto;
        height: 285px;
    }

    .dashboard-tables {
        grid-template-columns: 1fr;
    }

    .quick-links > div {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .quick-links a {
        min-height: 52px;
        padding: 9px;
        font-size: 11px;
    }

    .admin-card-header {
        align-items: flex-start;
    }

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

    .admin-form-grid .full-field {
        grid-column: auto;
    }

    input,
    select,
    textarea {
        min-height: 45px;
        font-size: 16px;
    }

    textarea {
        min-height: 98px;
    }

    .admin-filter-bar,
    .budget-filters {
        display: grid;
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .admin-filter-bar input,
    .admin-filter-bar select,
    .budget-filters input:first-child {
        grid-column: auto;
        width: 100%;
        min-width: 0;
    }

    .admin-filter-bar button {
        width: 100%;
        min-height: 45px;
    }

    .admin-table-wrap {
        margin-right: -13px;
        margin-left: -13px;
        padding: 0 13px 4px;
    }

    table {
        min-width: 650px;
    }

    #budgetItems {
        min-width: 720px;
    }

    th,
    td {
        padding: 10px 11px;
    }

    .table-actions a,
    .table-actions button {
        width: 42px;
        height: 42px;
    }

    .admin-modal {
        place-items: end center;
        padding: env(safe-area-inset-top) 0 0;
    }

    .admin-modal-dialog {
        width: 100%;
        max-height: calc(100vh - env(safe-area-inset-top));
        max-height: calc(100dvh - env(safe-area-inset-top));
        margin: 0;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        border-radius: 17px 17px 0 0;
    }

    .admin-modal-dialog .admin-card-header {
        align-items: flex-start;
    }

    .admin-modal-dialog .admin-card-header > .form-actions {
        width: auto;
        flex-wrap: nowrap;
    }

    .message {
        max-width: 88%;
    }

    .message-compose {
        flex-direction: column;
    }

    .messages-box {
        height: 44vh;
    }

    .gallery-admin {
        grid-template-columns: 1fr;
    }

    .gallery-admin img {
        height: 210px;
    }

    .fc .fc-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 9px;
    }

    .fc .fc-toolbar-chunk {
        display: flex;
        flex-wrap: wrap;
    }

    .fc .fc-button {
        min-height: 39px;
        padding: 0.4em 0.6em;
    }

    .fc .fc-toolbar-title {
        font-size: 16px;
    }

    .admin-login-card {
        width: 100%;
        padding: 23px 18px;
        border-radius: 15px;
    }
}

@media (max-width: 360px) {
    .admin-stats-grid,
    .dashboard-kpis,
    .admin-finance-grid,
    .quick-links > div {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    .admin-sidebar {
        width: min(72vw, 300px);
    }

    .messages-box {
        height: 58vh;
    }
}

@media (hover: none) and (pointer: coarse) {
    .admin-sidebar nav a,
    .admin-logout,
    .table-actions a,
    .table-actions button {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
