:root {
    --gold: #f07b49; --gold-light: #f2af4c; --gold-dark: #fe701a;
    --bg-primary: #0f1219; --bg-secondary: #161a24; --bg-card: #1a1f2b;
    --bg-surface: #1e2433; --text-primary: #ede8dc; --text-secondary: #8b93a6;
    --border-color: #2a3040; --sidebar-bg: #0d1017; --sidebar-hover: #1a1f2b;
}
[data-theme="light"] {
    --bg-primary: #f5f3ef; --bg-secondary: #ffffff; --bg-card: #ffffff;
    --bg-surface: #f9f7f4; --text-primary: #1a1a2e; --text-secondary: #6b7280;
    --border-color: #e5e2db; --sidebar-bg: #ffffff; --sidebar-hover: #f5f3ef;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Montserrat', sans-serif; background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; overflow-x: hidden; transition: background 0.3s, color 0.3s; }
h1,h2,h3,h4,h5 { font-family: 'Funnel Display', serif; }
input,
select,
textarea,
button {
    max-width: 100%;
}
.admin-layout { display: flex; flex-direction: column; min-height: 100vh; }
.admin-has-trial-banner {
    --admin-trial-banner-height: 53px;
    padding-top: var(--admin-trial-banner-height);
}
.admin-sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; background: var(--sidebar-bg); border-right: 1px solid var(--border-color); z-index: 1000; display: flex; flex-direction: column; transition: background 0.3s; }
.admin-has-trial-banner .admin-sidebar {
    top: var(--admin-trial-banner-height);
}
.sidebar-brand { padding: 24px 20px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 12px; }
.sidebar-brand .brand-icon { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--gold), var(--gold-dark)); display: flex; align-items: center; justify-content: center; font-size: 18px; color: #fff; }
.sidebar-brand h4 { color: var(--gold); margin: 0; font-size: 1.2rem; }
.sidebar-brand small { color: var(--text-secondary); font-size: 0.75rem; }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 10px; color: var(--text-secondary); text-decoration: none; font-size: 0.9rem; font-weight: 500; transition: all 0.2s; margin-bottom: 4px; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: var(--sidebar-hover); color: var(--gold); }
.sidebar-nav a.active { background: linear-gradient(135deg, rgba(200,149,46,0.15), rgba(200,149,46,0.05)); }
.sidebar-nav a i { font-size: 1.1rem; width: 22px; text-align: center; }
.sidebar-nav .nav-section { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-secondary); padding: 20px 16px 8px; font-weight: 600; }
.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--border-color); }
.sidebar-footer a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 10px; color: var(--text-secondary); text-decoration: none; font-size: 0.9rem; transition: all 0.2s; }
.sidebar-footer a:hover { color: #e74c3c; background: rgba(231,76,60,0.1); }
.admin-main { margin-left: 260px; min-height: 100vh; }
.admin-layout-top .admin-main { margin-left: 0; width: 100%; }
.admin-trial-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    min-height: var(--admin-trial-banner-height, 53px);
    padding: 10px 28px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.86rem;
    font-weight: 600;
}
.admin-trial-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.admin-trial-banner-content span {
    overflow-wrap: anywhere;
}
.admin-trial-banner-content i {
    flex: 0 0 auto;
    font-size: 1rem;
}
.admin-trial-banner-warning {
    background: color-mix(in srgb, #f59e0b 16%, var(--bg-secondary));
    color: #fbbf24;
    border-color: color-mix(in srgb, #f59e0b 36%, var(--border-color));
}
.admin-trial-banner-danger-soft {
    background: color-mix(in srgb, #f97316 18%, var(--bg-secondary));
    color: #fb923c;
    border-color: color-mix(in srgb, #f97316 42%, var(--border-color));
}
.admin-trial-banner-danger {
    background: color-mix(in srgb, #ef4444 18%, var(--bg-secondary));
    color: #fca5a5;
    border-color: color-mix(in srgb, #ef4444 44%, var(--border-color));
}
.admin-trial-banner-cta {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: currentColor;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.admin-trial-banner-cta:hover {
    color: currentColor;
    background: rgba(255, 255, 255, 0.18);
}
.admin-topnav {
    position: sticky;
    top: 0;
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 28px;
    background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
}
.admin-has-trial-banner .admin-topnav,
.admin-has-trial-banner .admin-topbar {
    top: var(--admin-trial-banner-height);
}
.topnav-brand { flex-shrink: 0; display: flex; align-items: center; }
.topnav-mobile-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.topnav-mobile-toggle:hover { color: var(--gold); border-color: var(--gold); }
.topnav-logo-link { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-logo-dark { display: none; }
[data-theme="dark"] .brand-logo-light { display: none; }
[data-theme="dark"] .brand-logo-dark { display: block; }
.topnav-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
}
.topnav-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.topnav-dropdown { position: relative; }
.topnav-dropdown-toggle {
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 12px;
    min-height: 44px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.topnav-dropdown-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.topnav-dropdown.active .topnav-dropdown-toggle,
.topnav-dropdown-toggle:hover,
.topnav-dropdown-toggle:focus-visible {
    color: var(--gold);
    border-color: color-mix(in srgb, var(--gold) 60%, var(--border-color));
    background: color-mix(in srgb, var(--bg-card) 84%, var(--gold) 16%);
    outline: none;
}
.topnav-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 220px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-card);
    box-shadow: 0 18px 48px rgba(0,0,0,0.28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.2s;
}
.topnav-dropdown:hover .topnav-dropdown-menu,
.topnav-dropdown:focus-within .topnav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.topnav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
    transition: all 0.2s;
}
.topnav-dropdown-item:hover,
.topnav-dropdown-item.active {
    color: var(--gold);
    background: var(--bg-surface);
}
.admin-topbar { position: sticky; top: 0; z-index: 100; background: var(--bg-secondary); border-bottom: 1px solid var(--border-color); padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; backdrop-filter: blur(20px); transition: background 0.3s; }
.admin-layout-top .admin-topbar {
    position: static;
    width: 100%;
    padding: 14px 28px;
    justify-content: flex-end;
}
.admin-layout-top .topbar-left {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 320px);
}
.admin-layout-top .topbar-left .page-title,
.admin-layout-top .topbar-left small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-layout-top .topbar-right { width: 100%; justify-content: flex-end; }
@media (min-width: 768px) {
    /* A direita ocupa só o conteúdo; com width:100% ela espremia títulos longos à esquerda */
    .admin-layout-top .topbar-left { margin-right: auto; }
    .admin-layout-top .topbar-right { flex: 0 0 auto; width: auto; }
}
.admin-layout-top .unit-selector { margin-left: auto; }
.topbar-left h2,
.topbar-left .page-title { font-size: 1.4rem; margin: 0; }
.topbar-left small { color: var(--text-secondary); font-size: 0.8rem; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-btn { width: 40px; height: 40px; border-radius: 10px; background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; font-size: 1.1rem; }
.topbar-btn:hover { color: var(--gold); border-color: var(--gold); }
.topbar-avatar { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, var(--gold), var(--gold-dark)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 0.9rem; border: 0; cursor: pointer; }
.unit-selector-btn { border: 1px solid var(--border-color); }
.unit-dropdown-item { width: 100%; border: 0; background: transparent; text-align: left; font-family: inherit; }
.unit-dropdown-item .item-dot { background: var(--gold); box-shadow: 0 0 8px rgba(240,123,73,0.4); }
.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}
.sidebar-logout-btn:hover { color: #e74c3c; background: rgba(231,76,60,0.1); }

.admin-content { padding: 32px; max-width: 100%; }
.admin-content > *,
.filter-bar > *,
.data-card-header > *,
.topnav-menu > *,
.topbar-right > *,
.row > * {
    min-width: 0;
}

/* Plan limit bar */
.plan-limit-bar { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.plan-limit-bar .limit-label { font-size: 1rem; font-weight: 700; font-family: 'Funnel Display', serif; white-space: nowrap; width:80%}
.plan-limit-bar .limit-track { flex: 1; height: 10px; background: var(--bg-surface); border-radius: 5px; overflow: hidden; position: relative; }
.plan-limit-bar .limit-fill { height: 100%; border-radius: 5px; transition: width 0.6s ease; }
.plan-limit-bar .limit-fill.green { background: #10b981; }
.plan-limit-bar .limit-fill.yellow { background: #f59e0b; }
.plan-limit-bar .limit-fill.red { background: #ef4444; }
.plan-limit-bar .limit-text { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.plan-limit-bar .limit-pct { font-size: 0.82rem; font-weight: 700; white-space: nowrap; }

.filter-bar { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 14px; padding: 20px; margin-bottom: 24px; display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-group { display: flex; flex: 1 1 180px; flex-direction: column; gap: 4px; min-width: 0; }
.filter-group label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.filter-group input, .filter-group select { background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-primary); padding: 8px 14px; border-radius: 8px; font-size: 0.85rem; font-family: 'Montserrat', sans-serif; outline: none; transition: border-color 0.2s; }
.filter-group input:focus, .filter-group select:focus { border-color: var(--gold); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #fff; border: none; padding: 9px 20px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: opacity 0.2s; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn-gold:hover { opacity: 0.9; color: #fff; }
.btn-outline-gold { background: transparent; border: 1px solid var(--gold); color: var(--gold); padding: 8px 20px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-outline-gold:hover { background: rgba(200,149,46,0.1); color: var(--gold); }

.data-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px; overflow-x: auto; overflow-y: hidden; }
.data-card-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.data-card-header h5 { margin: 0; font-size: 1rem; }
.table-responsive,
.data-card .table-responsive,
.data-card-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.admin-table {
    --bs-table-bg: var(--bg-card);
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-color);
    --bs-table-striped-bg: var(--bg-surface);
    --bs-table-striped-color: var(--text-primary);
    --bs-table-hover-bg: var(--bg-surface);
    --bs-table-hover-color: var(--text-primary);
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary);
}
.data-card > .admin-table,
.table-responsive > .admin-table,
.data-card .table-responsive > .admin-table {
    min-width: 720px;
}
.admin-table th { padding: 12px 24px; text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-secondary); font-weight: 600; border-bottom: 1px solid var(--border-color); font-family: 'Montserrat', sans-serif; }
.admin-table td { padding: 16px 24px; font-size: 0.88rem; border-bottom: 1px solid var(--border-color); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg-surface); }
.table-pagination { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.table-pagination span { font-size: 0.82rem; color: var(--text-secondary); }

.prof-avatar-sm { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, var(--gold), var(--gold-dark)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.status-badge { padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.status-badge.active { background: rgba(16,185,129,0.12); color: #10b981; }
.status-badge.inactive { background: rgba(239,68,68,0.12); color: #ef4444; }

/* Status de agendamento: paleta única para dashboard, calendário e listas.
   --status-*       cor de preenchimento (barras, pontos, bordas)
   --status-*-text  cor de texto legível sobre fundo do tema (escuro / claro) */
:root {
    --status-scheduled: #3b82f6;
    --status-confirmed: #f59e0b;
    --status-completed: #10b981;
    --status-canceled: #ef4444;
    --status-no-show: #8b5cf6;
    --status-scheduled-text: #60a5fa;
    --status-confirmed-text: #fbbf24;
    --status-completed-text: #34d399;
    --status-canceled-text: #f87171;
    --status-no-show-text: #a78bfa;
}
[data-theme="light"] {
    --status-scheduled-text: #1d4ed8;
    --status-confirmed-text: #b45309;
    --status-completed-text: #047857;
    --status-canceled-text: #b91c1c;
    --status-no-show-text: #6d28d9;
}
.status-badge.scheduled { background: color-mix(in srgb, var(--status-scheduled) 14%, transparent); color: var(--status-scheduled-text); }
.status-badge.confirmed { background: color-mix(in srgb, var(--status-confirmed) 14%, transparent); color: var(--status-confirmed-text); }
.status-badge.completed { background: color-mix(in srgb, var(--status-completed) 14%, transparent); color: var(--status-completed-text); }
.status-badge.canceled { background: color-mix(in srgb, var(--status-canceled) 14%, transparent); color: var(--status-canceled-text); }
.status-badge.draft { background: var(--bg-surface); color: var(--text-secondary); }
.status-badge.no_show { background: color-mix(in srgb, var(--status-no-show) 14%, transparent); color: var(--status-no-show-text); }
.action-btn { background: none; border: 1px solid var(--border-color); color: var(--text-secondary); width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; font-size: 0.85rem; text-decoration: none; }
.action-btn:hover { border-color: var(--gold); color: var(--gold); }
.action-btn.danger:hover { border-color: #ef4444; color: #ef4444; }

.sidebar-toggle { display: none; }
@media(max-width: 991px) {
    .admin-sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .sidebar-toggle { display: flex; }
    .admin-topnav { padding: 14px 18px; align-items: flex-start; }
    .topnav-menu { width: 100%; justify-content: flex-start; order: 3; }
    .topnav-actions { margin-left: auto; order: 2; }
    .topnav-dropdown-menu { left: auto; right: 0; }
    .admin-layout-top .admin-topbar { padding-left: 18px; padding-right: 18px; }
    .admin-layout-top .topbar-left { max-width: calc(100% - 260px); }
    .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; display: none; }
    .sidebar-overlay.show { display: block; }
}
@media(max-width: 767px) {
    .admin-content { padding: 20px 16px; }
    .admin-has-trial-banner {
        --admin-trial-banner-height: 104px;
    }
    .admin-trial-banner {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
        padding: 12px 16px;
        text-align: center;
    }
    .admin-trial-banner-content {
        justify-content: center;
    }
    .admin-trial-banner-cta {
        width: 100%;
    }
    .admin-topnav { flex-direction: column; align-items: stretch; gap: 14px; }
    .topnav-brand { width: 100%; justify-content: space-between; }
    .topnav-mobile-toggle { display: inline-flex; }
    .topnav-menu { flex-direction: column; align-items: stretch; display: none; }
    .topnav-actions { justify-content: flex-end; }
    .topnav-dropdown { width: 100%; }
    .topnav-dropdown-toggle { width: 100%; justify-content: space-between; }
    .topnav-dropdown-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; margin-top: 8px; display: none; }
    .topnav-dropdown.is-open .topnav-dropdown-menu { display: block; }
    .topnav-actions { display: none; }
    .admin-layout-top .admin-topbar { display: none; padding: 14px 18px; flex-direction: column; align-items: stretch; gap: 12px; }
    .admin-layout-top .topbar-left { min-width: 0; }
    .admin-layout-top .topbar-left .page-title { font-size: 1.02rem; line-height: 1.25; white-space: normal; overflow-wrap: anywhere; }
    .admin-layout-top .topbar-left small { font-size: 0.72rem; line-height: 1.35; display: block; margin-top: 2px; }
    .admin-layout-top .topbar-right { justify-content: stretch; }
    .admin-layout-top .unit-selector,
    .admin-layout-top .unit-selector-btn { width: 100%; }
    .filter-bar { padding: 14px; gap: 10px; }
    .filter-bar,
    .table-pagination,
    .data-card-header {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-group {
        flex: 1 1 100%;
        width: 100%;
        gap: 5px;
    }
    .filter-group label {
        margin-bottom: 0;
    }
    .filter-group input,
    .filter-group select {
        width: 100%;
        padding: 10px 12px;
    }
    .filter-bar [class*='filter-actions'] {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        margin-left: 0;
        margin-top: 2px;
    }
    .filter-bar .btn-gold,
    .filter-bar .btn-outline-gold {
        justify-content: center;
        width: 100%;
    }
    .table-pagination {
        gap: 12px;
        padding: 16px;
    }
    .admin-table th,
    .admin-table td {
        padding: 12px 16px;
        white-space: nowrap;
    }
    .data-card > .admin-table,
    .table-responsive > .admin-table,
    .data-card .table-responsive > .admin-table {
        min-width: 640px;
    }
    body.topnav-mobile-open .topnav-menu { display: flex; }
    body.topnav-mobile-open .topnav-actions { display: flex; }
    body.topnav-mobile-open.admin-layout-top .admin-topbar { display: flex; }
}

/* Avisos de sessão (sucesso/erro) exibidos pelo layout em todas as telas do admin */
.admin-flash-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    bottom: 24px;
    left: 50%;
    max-width: min(480px, calc(100vw - 32px));
    pointer-events: none;
    position: fixed;
    transform: translateX(-50%);
    width: max-content;
    z-index: 1500;
}

.admin-flash {
    align-items: flex-start;
    animation: adminFlashIn 0.25s ease both;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--status-completed);
    border-radius: 12px;
    box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    display: flex;
    font-size: 0.88rem;
    font-weight: 600;
    gap: 12px;
    padding: 13px 14px 13px 16px;
    pointer-events: auto;
}

.admin-flash.is-error {
    border-left-color: var(--status-canceled);
}

.admin-flash > i:first-child {
    color: var(--status-completed-text);
    flex: 0 0 auto;
    font-size: 1.05rem;
    margin-top: 1px;
}

.admin-flash.is-error > i:first-child {
    color: var(--status-canceled-text);
}

.admin-flash-text {
    flex: 1;
    line-height: 1.4;
}

.admin-flash-close {
    background: transparent;
    border: 0;
    color: var(--text-secondary);
    cursor: pointer;
    flex: 0 0 auto;
    font-size: 0.8rem;
    padding: 2px 4px;
}

.admin-flash-close:hover,
.admin-flash-close:focus-visible {
    color: var(--text-primary);
}

.admin-flash.is-leaving {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
}

@keyframes adminFlashIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 767px) {
    .admin-flash-stack {
        bottom: 16px;
        left: 16px;
        right: 16px;
        max-width: none;
        transform: none;
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .admin-flash { animation: none; }
    .admin-flash.is-leaving { transition: none; }
}

/* Texto de apoio do Bootstrap fica ilegível no tema escuro: usa o token do admin */
.admin-content .text-muted,
.admin-content .form-text {
    color: var(--text-secondary) !important;
}


/* ==========================================================================
   Cabeçalho do admin: menu com grupos, breadcrumb e seletor de unidade
   ========================================================================== */

/* Logo: altura fixa e área de clique confortável */
.topnav-logo-link {
    border-radius: 10px;
    padding: 4px 6px;
    margin-left: -6px;
}
.topnav-logo-link:focus-visible,
.topnav-dropdown-item:focus-visible,
.topbar-btn:focus-visible,
.topbar-avatar:focus-visible,
.unit-selector-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
.brand-logo { height: 32px; }

/* Menu: abre por hover, foco ou clique; a "ponte" evita fechar ao mover o mouse até o menu */
.topnav-dropdown-menu::before {
    content: '';
    position: absolute;
    inset: -12px 0 auto 0;
    height: 12px;
}
.topnav-dropdown.is-open .topnav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.topnav-dropdown.is-open .topnav-chevron,
.topnav-dropdown:hover .topnav-chevron {
    transform: rotate(180deg);
}
.topnav-chevron {
    font-size: 0.7rem;
    transition: transform 0.2s;
}
.topnav-dropdown.active .topnav-dropdown-toggle {
    box-shadow: inset 0 -2px 0 var(--gold);
}

/* Itens agrupados: "Gestão" abre em colunas com título por grupo */
.topnav-dropdown-menu.is-wide {
    display: grid;
    grid-template-columns: repeat(3, minmax(190px, 1fr));
    gap: 4px 8px;
    min-width: 620px;
    padding: 14px;
}
.topnav-group-title {
    padding: 4px 12px 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0.8;
}
.topnav-dropdown-item.active {
    font-weight: 700;
    background: color-mix(in srgb, var(--gold) 12%, var(--bg-card));
}
.topnav-dropdown-item i {
    width: 1.1rem;
    text-align: center;
}

/* Cabeçalho da página: breadcrumb, título e seletor de unidade */
.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.page-breadcrumb i {
    font-size: 0.6rem;
    opacity: 0.7;
}
.page-breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}
.page-breadcrumb a:hover {
    color: var(--gold);
}
.admin-layout-top .admin-topbar {
    padding-top: 18px;
    padding-bottom: 18px;
    background: transparent;
    backdrop-filter: none;
    border-bottom: 1px solid var(--border-color);
}

@media (max-width: 991px) {
    .topnav-dropdown-menu.is-wide {
        grid-template-columns: 1fr;
        min-width: 240px;
    }
}
@media (min-width: 768px) and (max-width: 1099px) {
    .topnav-dropdown-toggle { padding: 0 12px; }
    .topnav-dropdown-label span { font-size: 0.82rem; }
}
@media (max-width: 767px) {
    .topnav-dropdown-menu.is-wide {
        display: none;
        min-width: 0;
        padding: 10px;
    }
    .topnav-dropdown.is-open .topnav-dropdown-menu.is-wide { display: block; }
    .topnav-group + .topnav-group { margin-top: 6px; }
    .page-breadcrumb { display: none; }
}
