/* ============================================================
   Guarabyte ITSM — Layout Gentelella-like
   ============================================================ */

:root {
    --sidebar-w: 230px;
    --sidebar-collapsed-w: 70px;
    --topbar-h: 57px;
    --bg: #1a2332;
    --bg-body: #141b27;
    --sidebar-bg: #2a3f54;
    --sidebar-hover: #1b2e3f;
    --sidebar-active: #172a3a;
    --topbar-bg: #ededed;
    --topbar-text: #5a5a5a;
    --surface: #2a3f54;
    --surface-2: #243447;
    --border: #355068;
    --border-light: #ddd;
    --text: #e8ecf6;
    --text-dark: #73879C;
    --muted: #8a95b2;
    --primary: #1abb9c;
    --primary-dark: #169f85;
    --danger: #e74c3c;
    --danger-dark: #c0392b;
    --success: #26B99A;
    --warning: #f0ad4e;
    --info: #3498db;
    --radius: 4px;
    --radius-sm: 3px;
    --shadow: 0 2px 4px rgba(0,0,0,.2);
    --font: 'Inter', 'Helvetica Neue', Roboto, Arial, sans-serif;
}

/* Light theme */
[data-theme="light"] {
    --bg: #f0f3f6;
    --bg-body: #e9ecef;
    --sidebar-bg: #2a3f54;
    --sidebar-hover: #1b2e3f;
    --sidebar-active: #172a3a;
    --topbar-bg: #ffffff;
    --topbar-text: #5a5a5a;
    --surface: #ffffff;
    --surface-2: #f5f7fa;
    --border: #d9dee4;
    --border-light: #e0e4e8;
    --text: #2a3f54;
    --text-dark: #73879C;
    --muted: #7b8a9e;
}
[data-theme="light"] code {
    background: rgba(0,0,0,.07);
    color: #476582;
}
[data-theme="light"] .panel,
[data-theme="light"] .profile-card {
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
[data-theme="light"] .form input[type=text],
[data-theme="light"] .form input[type=email],
[data-theme="light"] .form input[type=password],
[data-theme="light"] .form input[type=tel],
[data-theme="light"] .form input[type=url],
[data-theme="light"] .form input[type=number],
[data-theme="light"] .form input[type=search],
[data-theme="light"] .form input[type=date],
[data-theme="light"] .form input[type=time],
[data-theme="light"] .form input[type=month],
[data-theme="light"] .form input[type=week],
[data-theme="light"] .form input[type=datetime-local],
[data-theme="light"] .form select,
[data-theme="light"] .form textarea {
    background: #fff;
    border-color: #d1d5db;
    color: #333;
}
[data-theme="light"] .table th {
    background: #f5f7fa;
    color: #5a5a5a;
}
[data-theme="light"] .table td {
    border-color: #e8ecf0;
    color: #333;
}
[data-theme="light"] .table tr:hover td {
    background: #f0f4f7;
}
[data-theme="light"] .stat-card {
    background: #fff;
    border-color: #d9dee4;
}
[data-theme="light"] .alert--error {
    background: #fef2f2;
    border-left-color: var(--danger);
    color: #991b1b;
}
[data-theme="light"] .alert--success {
    background: #f0fdf4;
    border-left-color: var(--success);
    color: #166534;
}
[data-theme="light"] .alert--info {
    background: #f0fdfa;
    border-left-color: var(--primary);
    color: #0f766e;
}
[data-theme="light"] .modal {
    background: #fff;
    border-color: #d9dee4;
}
[data-theme="light"] .modal__header {
    border-color: #e8ecf0;
    color: #333;
}
[data-theme="light"] .btn--cancel {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 13px; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-body);
    min-height: 100vh;
    display: flow-root; /* contém o margin-top do .app-body (evita margin-collapse p/ o html e scroll fantasma de 57px) */
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: rgba(0,0,0,.25);
    padding: 2px 6px; border-radius: 3px;
    font-size: .92em; color: #b8c7db;
}

/* ════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════ */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex; flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width .25s ease;

    /* Barra de rolagem: reservada sempre (sem reflow), mas transparente até o hover. */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-button { display: none; height: 0; }
/* Sem transition: o Chrome não anima pseudo-elementos de scrollbar e a
   troca de cor pode ficar sem repaint até a próxima interação. */
.sidebar::-webkit-scrollbar-thumb {
    background-color: transparent;
    border: 2px solid transparent;
    background-clip: content-box;
    border-radius: 4px;
}
.sidebar:hover { scrollbar-color: rgba(255,255,255,.22) transparent; }
.sidebar:hover::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.22); }
.sidebar:hover::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,.4); }

/* ── Fade dos rótulos ao recolher/expandir ──
   Os rótulos somem com `display: none` (para não ocupar espaço nem serem lidos
   por leitor de tela), mas `allow-discrete` adia essa troca até o fim do fade;
   o `@starting-style` faz o caminho de volta (expandir) entrar suave.
   Só vale depois do primeiro toggle (classe `sidebar-anim` posta pelo JS), para
   o carregamento da página não animar rótulo nenhum. Precisa vir ANTES das
   regras de recolhido: mesma especificidade, quem vence é a ordem. */
html.sidebar-anim .sidebar__name, html.sidebar-anim .sidebar__role,
html.sidebar-anim .sidebar__link-text, html.sidebar-anim .sidebar__footer span,
html.sidebar-anim .sidebar__heading-text, html.sidebar-anim .sidebar__heading-line,
html.sidebar-anim .sidebar__heading-caret {
    opacity: 1;
    transition: opacity .18s ease, display .18s allow-discrete;
}
@starting-style {
    html.sidebar-anim .sidebar__name, html.sidebar-anim .sidebar__role,
    html.sidebar-anim .sidebar__link-text, html.sidebar-anim .sidebar__footer span,
    html.sidebar-anim .sidebar__heading-text, html.sidebar-anim .sidebar__heading-line,
    html.sidebar-anim .sidebar__heading-caret { opacity: 0; }
}

/* Collapsed sidebar */
.sidebar--collapsed, html.sidebar-is-collapsed .sidebar { width: var(--sidebar-collapsed-w); }
.sidebar--collapsed .sidebar__profile, html.sidebar-is-collapsed .sidebar__profile { padding: 16px 8px 12px; }
.sidebar--collapsed .sidebar__name, html.sidebar-is-collapsed .sidebar__name,
.sidebar--collapsed .sidebar__role, html.sidebar-is-collapsed .sidebar__role { display: none; opacity: 0; }
.sidebar--collapsed .sidebar__link, html.sidebar-is-collapsed .sidebar__link {
    justify-content: center; padding: 11px 0; gap: 0; border-left-width: 0;
}
.sidebar--collapsed .sidebar__link span, html.sidebar-is-collapsed .sidebar__link span,
.sidebar--collapsed .sidebar__link-text, html.sidebar-is-collapsed .sidebar__link-text { display: none; opacity: 0; }
.sidebar--collapsed .sidebar__link svg, html.sidebar-is-collapsed .sidebar__link svg { width: 22px; height: 22px; }
.sidebar--collapsed .sidebar__footer, html.sidebar-is-collapsed .sidebar__footer { justify-content: center; padding: 14px 8px; }
.sidebar--collapsed .sidebar__footer span, html.sidebar-is-collapsed .sidebar__footer span { display: none; opacity: 0; }
.sidebar--collapsed .sidebar__footer-link svg, html.sidebar-is-collapsed .sidebar__footer-link svg { width: 20px; height: 20px; }

/* O ícone/coluna acompanham a largura no mesmo tempo da sidebar */
.sidebar__link svg, .sidebar__heading-icon svg, .sidebar__footer-link svg {
    transition: width .25s ease, height .25s ease;
}
.sidebar--collapsed + .topbar,
html.sidebar-is-collapsed .topbar { left: var(--sidebar-collapsed-w); }
.sidebar--collapsed ~ .app-body,
html.sidebar-is-collapsed .app-body { margin-left: var(--sidebar-collapsed-w); }
/* Estado recolhido vindo do localStorage: sem transição, para não animar no load.
   Depois do 1º toggle (`sidebar-anim`) a transição de largura volta a valer. */
html.sidebar-is-collapsed:not(.sidebar-anim) .sidebar,
html.sidebar-is-collapsed:not(.sidebar-anim) .topbar,
html.sidebar-is-collapsed:not(.sidebar-anim) .app-body { transition: none; }

/* Profile */
.sidebar__profile {
    padding: 16px 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-align: center;
}
.sidebar__avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    display: inline-grid; place-items: center;
    position: relative;
    font-size: 22px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--primary), #169f85);
    border: 2px solid rgba(255,255,255,.2);
    margin-bottom: 8px;
}
.sidebar__avatar-img {
    /* Posicionamento absoluto em vez de width/height:100%: dentro de um
       display:grid sem align-content:stretch, a row se ajusta ao conteúdo
       (auto), então height:100% cai para "auto" e a imagem usa a proporção
       intrínseca dela — uma foto vertical de celular vira uma "azeitona"
       em vez de preencher o círculo. inset:0 ignora o grid e sempre cobre
       exatamente a caixa 52x52, qualquer que seja a proporção da foto. */
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
/* Com imagem: sem gradiente verde para não "piscar" enquanto o base64 decodifica no reload */
.sidebar__avatar--has-img { background: transparent; border-color: rgba(255,255,255,.2); }
.sidebar__name { font-size: 14px; font-weight: 600; color: #fff; display: block; }
.sidebar__role { font-size: 11px; color: rgba(255,255,255,.5); display: block; margin-top: 2px; }

/* Nav */
.sidebar__nav { flex: 1; padding: 12px 0; }

/* Início: item fixo acima dos grupos. Fica fora de qualquer grupo para não
   sumir quando a Navegação é recolhida. */
.sidebar__link--solo { margin-bottom: 4px; }

/* ── Cabeçalho do grupo ──
   Ícone + rótulo + linha de apoio + caret. O grupo aberto ganha a cor de
   destaque; o hover acende ícone e rótulo juntos. */
.sidebar__heading {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 11px 18px;
    background: none; border: 0; border-left: 3px solid transparent; cursor: pointer; text-align: left;
    font-family: inherit;
    font-size: 13px; font-weight: 600;
    color: rgba(255,255,255,.7);
    transition: color .18s;
}
.sidebar__heading:hover { color: rgba(255,255,255,.9); }
.sidebar__group.open > .sidebar__heading { color: rgba(255,255,255,.95); }

.sidebar__heading-icon {
    display: flex; flex-shrink: 0;
    transition: transform .25s ease, color .18s;
}
.sidebar__heading-icon svg {
    width: 18px; height: 18px;
    stroke: currentColor; fill: none;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.sidebar__heading:hover .sidebar__heading-icon { transform: scale(1.12); }
.sidebar__group.open > .sidebar__heading .sidebar__heading-icon { color: var(--primary); }

.sidebar__heading-text { flex-shrink: 0; }

/* Linha que preenche o espaço até o caret e sublinha o grupo. */
.sidebar__heading-line {
    flex: 1; height: 1px; min-width: 8px;
    background: currentColor; opacity: .18;
    transition: opacity .18s;
}
.sidebar__heading:hover .sidebar__heading-line { opacity: .32; }

.sidebar__heading-caret { flex-shrink: 0; opacity: .7; transition: transform .22s ease; }
.sidebar__group.open .sidebar__heading-caret { transform: rotate(180deg); }

.sidebar__group-items {
    display: grid; grid-template-rows: 0fr;
    transition: grid-template-rows .22s ease;
}
.sidebar__group-inner { min-height: 0; overflow: hidden; }
/* Itens do grupo entram recuados em relação ao cabeçalho, para dar o efeito
   de árvore/hierarquia entre grupo e filhos. */
.sidebar__group-inner .sidebar__link { padding-left: 38px; }
.sidebar__group.open .sidebar__group-items { grid-template-rows: 1fr; }
.sidebar__group:not(.open) .sidebar__group-items { visibility: hidden; }
.sidebar__group.open .sidebar__group-items { visibility: visible; }
/* ── Sidebar recolhida: agrupamento vira flyout ──
   O heading fica só com o ícone (a "capa" do grupo) e os itens saem do fluxo,
   aparecendo num painel à direita no hover/foco. Assim o agrupamento continua
   legível em 70px, sem empilhar todos os ícones soltos. */
.sidebar--collapsed .sidebar__group,
html.sidebar-is-collapsed .sidebar__group { position: relative; }

.sidebar--collapsed .sidebar__heading,
html.sidebar-is-collapsed .sidebar__heading {
    justify-content: center; padding: 11px 0; gap: 0; border-left-width: 0;
}
.sidebar--collapsed .sidebar__heading-text,
html.sidebar-is-collapsed .sidebar__heading-text,
.sidebar--collapsed .sidebar__heading-line,
html.sidebar-is-collapsed .sidebar__heading-line,
.sidebar--collapsed .sidebar__heading-caret,
html.sidebar-is-collapsed .sidebar__heading-caret { display: none; opacity: 0; }
.sidebar--collapsed .sidebar__heading-icon svg,
html.sidebar-is-collapsed .sidebar__heading-icon svg { width: 22px; height: 22px; }
/* Grupo da página atual continua destacado mesmo recolhido */
.sidebar--collapsed .sidebar__group.open > .sidebar__heading,
html.sidebar-is-collapsed .sidebar__group.open > .sidebar__heading { color: var(--primary); }

.sidebar--collapsed .sidebar__group-items,
html.sidebar-is-collapsed .sidebar__group-items {
    position: absolute; top: 0; left: 100%;
    min-width: 200px;
    display: block; grid-template-rows: none;
    background: var(--sidebar-bg);
    border-radius: 0 8px 8px 0;
    box-shadow: 0 12px 30px rgba(0,0,0,.45);
    padding: 6px 0;
    opacity: 0; visibility: hidden; pointer-events: none;
    transform: translateX(-6px);
    transition: opacity .15s ease, transform .15s ease;
    z-index: 130;
}
.sidebar--collapsed .sidebar__group:hover > .sidebar__group-items,
.sidebar--collapsed .sidebar__group:focus-within > .sidebar__group-items,
html.sidebar-is-collapsed .sidebar__group:hover > .sidebar__group-items,
html.sidebar-is-collapsed .sidebar__group:focus-within > .sidebar__group-items {
    opacity: 1; visibility: visible; pointer-events: auto;
    transform: translateX(0);
}
/* Dentro do flyout os links voltam ao formato normal (ícone + rótulo) */
.sidebar--collapsed .sidebar__group-items .sidebar__link,
html.sidebar-is-collapsed .sidebar__group-items .sidebar__link {
    justify-content: flex-start; padding: 9px 16px; gap: 10px;
}
.sidebar--collapsed .sidebar__group-items .sidebar__link-text,
html.sidebar-is-collapsed .sidebar__group-items .sidebar__link-text {
    display: inline; opacity: 1;
}
.sidebar--collapsed .sidebar__group-items .sidebar__link svg,
html.sidebar-is-collapsed .sidebar__group-items .sidebar__link svg { width: 18px; height: 18px; }

/* O flyout precisa escapar da coluna: recolhida, a sidebar não corta nem rola. */
.sidebar--collapsed, html.sidebar-is-collapsed .sidebar { overflow: visible; }
.sidebar__link {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 18px;
    color: rgba(255,255,255,.75);
    font-size: 13px; font-weight: 500;
    transition: background .15s, color .15s;
    border-left: 3px solid transparent;
}
.sidebar__link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
.sidebar__link.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: var(--primary);
}
.sidebar__link svg {
    width: 18px; height: 18px; flex-shrink: 0;
    stroke: currentColor; fill: none;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.sidebar__badge {
    margin-left: auto;
    font-size: 10px; font-weight: 700;
    padding: 2px 7px; border-radius: 10px;
    background: var(--primary); color: #fff;
}

/* Footer */
.sidebar__footer {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: 11px; color: rgba(255,255,255,.35);
    display: flex; align-items: center;
    position: relative;
}
.sidebar__footer span {
    flex: 1; text-align: center;
}
.sidebar__footer-link {
    color: rgba(255,255,255,.4);
    transition: color .2s;
    display: flex; align-items: center;
}
.sidebar__footer-link:hover { color: rgba(255,255,255,.85); }

/* ════════════════════════════════════════
   TOPBAR
   ════════════════════════════════════════ */
.sidebar-toggle {
    width: 36px; height: 36px; display: grid; place-items: center;
    border: none; background: none; cursor: pointer; border-radius: var(--radius);
    color: var(--topbar-text); transition: background .15s;
}
.sidebar-toggle:hover { background: rgba(0,0,0,.08); }
.sidebar-toggle svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Backdrop da gaveta: só existe no celular (ver @media max-width:768px). */
.nav-backdrop { display: none; }

.topbar {
    position: fixed; top: 0; left: var(--sidebar-w); right: 0;
    height: var(--topbar-h);
    transition: left .25s ease;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px;
    z-index: 90;
}
.topbar__left {
    display: flex; align-items: center; gap: 14px;
}
.topbar__env {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    padding: 4px 10px; border-radius: 3px;
}
.topbar__env--hml { background: #f0ad4e; color: #fff; }
.topbar__env--prd { background: var(--success); color: #fff; }
.topbar__title {
    font-size: 15px; font-weight: 500; color: var(--topbar-text);
}
.topbar__right {
    display: flex; align-items: center; gap: 6px;
}
.topbar__icon-btn {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border: none; background: none;
    color: var(--topbar-text); font-size: 16px;
    cursor: pointer; border-radius: 50%;
    transition: background .15s;
    position: relative;
}
.topbar__icon-btn:hover { background: rgba(0,0,0,.08); }
.topbar__icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar__dot {
    position: absolute; top: 5px; right: 6px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--danger);
}

/* Theme toggle */
.theme-toggle {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border: 2px solid transparent;
    background: transparent;
    color: var(--topbar-text);
    cursor: pointer;
    border-radius: 8px;
    transition: border-color .2s, background .2s, color .2s;
}
.theme-toggle:hover {
    border-color: var(--primary);
    background: rgba(26,187,156,.1);
    color: var(--primary);
}
[data-theme="dark"] .theme-toggle__icon--sun { display: block; }
[data-theme="dark"] .theme-toggle__icon--moon { display: none; }
[data-theme="light"] .theme-toggle__icon--sun { display: none; }
[data-theme="light"] .theme-toggle__icon--moon { display: block; }

/* Notification bell */
.notif-bell { position: relative; }
.notif-bell__btn {
    width: 36px; height: 36px; display: grid; place-items: center;
    border: 2px solid transparent; background: none; cursor: pointer; border-radius: 50%;
    color: var(--topbar-text); transition: background .15s, border-color .15s;
    position: relative;
}
.notif-bell__btn:hover { border-color: var(--primary); color: var(--primary); }
.notif-bell__badge {
    position: absolute; top: 2px; right: 2px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 8px; background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}

/* Notification dropdown */
.notif-dropdown {
    display: none; position: absolute; top: calc(100% + 8px); right: 0;
    width: 380px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.25);
    z-index: 200; overflow: hidden;
}
.notif-bell.open .notif-dropdown { display: block; }
.notif-dropdown__header {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.notif-dropdown__title { font-size: 15px; font-weight: 700; color: var(--text); }
.notif-dropdown__count {
    font-size: 12px; font-weight: 600; color: var(--primary);
}
.notif-dropdown__mark-all {
    margin-left: auto; background: none; border: 1px solid var(--primary);
    color: var(--primary); font-size: 11px; font-weight: 600;
    padding: 4px 10px; border-radius: var(--radius); cursor: pointer;
    transition: background .15s, color .15s;
}
.notif-dropdown__mark-all:hover { background: var(--primary); color: #fff; }
.notif-dropdown__list {
    max-height: 360px; overflow-y: auto; overflow-x: hidden;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent;
}
.notif-dropdown__list::-webkit-scrollbar { width: 6px; }
.notif-dropdown__list::-webkit-scrollbar-track { background: transparent; }
.notif-dropdown__list::-webkit-scrollbar-button { display: none; height: 0; }
.notif-dropdown__list::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.18); border-radius: 3px; }
.notif-dropdown__list::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,.4); }
[data-theme="light"] .notif-dropdown__list { scrollbar-color: rgba(0,0,0,.18) transparent; }
[data-theme="light"] .notif-dropdown__list::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,.18); }
[data-theme="light"] .notif-dropdown__list::-webkit-scrollbar-thumb:hover { background-color: rgba(0,0,0,.4); }
.notif-dropdown__item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}
.notif-dropdown__item:last-child { border-bottom: none; }
.notif-dropdown__item:hover { background: var(--surface-2); }
.notif-dropdown__item--unread { background: rgba(26,187,156,.04); }
.notif-dropdown__item-dot {
    width: 8px; flex-shrink: 0; padding-top: 6px;
}
.notif-dropdown__item-dot span {
    display: block; width: 8px; height: 8px;
    border-radius: 50%; background: var(--primary);
}
.notif-dropdown__item-icon { flex-shrink: 0; padding-top: 2px; }
.notif-icon {
    width: 22px; height: 22px; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round; fill: none;
}
.notif-icon--info   { stroke: var(--info); }
.notif-icon--success { stroke: var(--success); }
.notif-icon--warning { stroke: var(--warning); }
.notif-icon--danger  { stroke: var(--danger); }
.notif-dropdown__item-body { flex: 1; min-width: 0; }
.notif-dropdown__item-body strong { font-size: 13px; color: var(--text); display: block; overflow-wrap: break-word; }
.notif-dropdown__item-body p { font-size: 12px; color: var(--muted); margin: 2px 0 0; line-height: 1.4; overflow-wrap: break-word; }
.notif-dropdown__item-time {
    flex-shrink: 0; font-size: 11px; color: var(--muted); padding-top: 2px; white-space: nowrap;
}
.notif-dropdown__footer {
    padding: 10px 16px; text-align: center;
    border-top: 1px solid var(--border);
}
.notif-dropdown__footer a {
    color: var(--primary); font-size: 13px; text-decoration: none; font-weight: 500;
}
.notif-dropdown__footer a:hover { text-decoration: underline; }

/* Full notification list page */
.notif-full-list { }
.notif-full-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
    transition: background .12s;
}
.notif-full-item:last-child { border-bottom: none; }
.notif-full-item:hover { background: var(--surface-2); }
.notif-full-item--unread { background: rgba(26,187,156,.04); }
.notif-full-item__icon { flex-shrink: 0; padding-top: 2px; }
.notif-full-item__body { flex: 1; min-width: 0; }
.notif-full-item__body strong { font-size: 14px; color: var(--text); display: block; }
.notif-full-item__body p { font-size: 13px; color: var(--muted); margin: 3px 0 0; }
.notif-full-item__meta {
    flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.notif-full-item__time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.notif-full-item__read {
    display: inline-block; margin-top: 6px;
    font-size: 11px; color: var(--muted); opacity: .8;
}

/* Filtros da caixa de entrada (/inbox).
   `justify-content: start` + largura máxima na busca: sem isso o campo esticava
   por toda a linha e empurrava os botões para a outra ponta da tela. */
.inbox-filters__row {
    display: grid; grid-template-columns: 170px 170px minmax(200px, 520px) auto;
    gap: 10px; align-items: end; justify-content: start;
}
/* Os botões usam `.af-field--btn`, que já iguala a altura deles à dos campos
   (ver o bloco AUDIT: filters). Aqui só falta impedir que a coluna estique. */
.inbox-filters__row .af-field--btn { min-width: 0; }

/* Central de Notificações: título + prévia da mensagem numa célula só.
   A prévia é cortada em uma linha — a mensagem inteira está no detalhe. */
.notif-cell { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.notif-cell strong { display: block; font-size: 13px; color: var(--text); }
.notif-cell__msg {
    display: block; margin-top: 2px;
    font-size: 12px; color: var(--muted);
    max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.notif-visao { display: flex; align-items: center; gap: 6px; font-size: 12px; }

/* Detalhe do envio */
.notif-lote-meta {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px; margin: 0; padding: 14px 0 0; border-top: 1px solid var(--border);
}
.notif-lote-meta dt {
    font-size: 10px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .3px;
}
.notif-lote-meta dd { margin: 3px 0 0; font-size: 13px; color: var(--text); }

/* Formulário de envio */
.notif-modo { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 4px; }
/* `.form__row label` é caixa-alta por padrão (é o rótulo do campo). Estes são
   rótulos de opção, não de campo: voltam ao texto normal. O `.form__row` no
   seletor não é decoração — sem ele a regra perde em especificidade. */
.form__row .notif-modo__opcao,
.form__row .notif-destinatarios__item {
    text-transform: none; letter-spacing: normal; font-weight: 400;
    color: var(--text);
}
.notif-modo__opcao {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; cursor: pointer;
}
.notif-destinatarios {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px;
    max-height: 220px; overflow-y: auto;
    padding: 10px; border: 1px solid var(--border); border-radius: 6px;
}
.notif-destinatarios__item {
    display: flex; align-items: center; gap: 5px;
    font-size: 13px; cursor: pointer;
}

@media (max-width: 768px) {
    .inbox-filters__row { grid-template-columns: 1fr; }
    .notif-cell__msg { max-width: 200px; }
}

/* User dropdown */
.user-menu { position: relative; }
.user-menu__trigger {
    width: 34px; height: 34px;
    border-radius: 50%; border: none;
    display: grid; place-items: center;
    position: relative;
    font-size: 14px; font-weight: 700; color: #fff;
    background: var(--primary);
    cursor: pointer;
    transition: box-shadow .15s;
}
.user-menu__trigger:hover { box-shadow: 0 0 0 3px rgba(26,187,156,.3); }
/* Com avatar: sem fundo verde para não "piscar" enquanto a imagem base64 decodifica no reload */
.user-menu__trigger--has-avatar { background: transparent; }
/* position:absolute em vez de width/height:100% pelo mesmo motivo do
   .sidebar__avatar-img: dentro de display:grid sem stretch, height:100%
   cai para "auto" e a imagem usa a proporção intrínseca dela. */
.user-menu__avatar {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.user-menu__dropdown {
    display: none;
    position: absolute; top: calc(100% + 8px); right: 0;
    width: 200px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(0,0,0,.4);
    overflow: hidden;
    z-index: 200;
}
.user-menu.open .user-menu__dropdown { display: block; }
.user-menu__item {
    display: block;
    padding: 11px 16px;
    font-size: 13px; color: rgba(255,255,255,.8);
    transition: background .15s;
    border: none; background: none;
    width: 100%; text-align: left;
    font-family: inherit; cursor: pointer;
}
.user-menu__item:hover { background: var(--sidebar-hover); color: #fff; }
.user-menu__item--sep { border-top: 1px solid rgba(255,255,255,.1); }
.user-menu__item--danger { color: var(--danger); }
.user-menu__item--danger:hover { background: rgba(231,76,60,.15); }

/* ════════════════════════════════════════
   CAMPO DE SENHA (exibir/ocultar)
   ════════════════════════════════════════ */
/* Uso: .input-password envolvendo o <input type="password"> + um
   <button class="input-password__toggle" data-password-toggle="idDoInput">.
   O handler é delegado no layout.php — não precisa de JS por página. */
.input-password { position: relative; width: 100%; }
.input-password > input { width: 100%; padding-right: 44px; box-sizing: border-box; }
.input-password__toggle {
    position: absolute; right: 1px; top: 1px; bottom: 1px; width: 42px;
    background: transparent; border: none; cursor: pointer;
    color: var(--muted);
    display: flex; align-items: center; justify-content: center;
    transition: color .15s;
}
.input-password__toggle:hover { color: var(--text); }
.input-password__toggle svg {
    width: 18px; height: 18px;
    stroke: currentColor; fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ════════════════════════════════════════
   MAIN CONTENT
   ════════════════════════════════════════ */
.app-body {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    min-height: calc(100vh - var(--topbar-h));
    display: flex; flex-direction: column;
    transition: margin-left .25s ease;
}
.main { flex: 1; padding: 24px 24px 40px; display: flex; flex-direction: column; }

/* Page header */
.page-header {
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.page-header p { color: var(--muted); margin: 0; font-size: 13px; }

/* ════════════════════════════════════════
   MODAL (Sign out confirmation)
   ════════════════════════════════════════ */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    /* Acima de .overlay (900): modais de confirmação/reautenticação são
       disparados de dentro do drawer e precisam ficar na frente dele. */
    z-index: 1000;
    place-items: center;
}
.modal-overlay.open { display: grid; }
.modal {
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 420px; max-width: 92vw;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
    overflow: hidden;
}
/* Modal largo (formulários com seletor lateral). O conteúdo cabe sem rolagem;
   o max-height é só uma salvaguarda para telas muito baixas. */
.modal--wide { width: 1060px; max-width: 94vw; }
.modal--wide .modal__body { max-height: 76vh; overflow-y: auto; }
.modal--wide .modal__body::-webkit-scrollbar { width: 6px; }
.modal--wide .modal__body::-webkit-scrollbar-track { background: transparent; }
.modal--wide .modal__body::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.18); border-radius: 3px; }
.modal__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.modal__header h3 { font-size: 16px; margin: 0; }
.modal__close {
    width: 28px; height: 28px; display: grid; place-items: center;
    background: none; border: none; color: var(--muted);
    font-size: 20px; cursor: pointer; border-radius: 4px;
}
.modal__close:hover { background: rgba(255,255,255,.1); color: #fff; }
.modal__body { padding: 20px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.modal__footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
}

/* ════════════════════════════════════════
   GRID DE SERVIÇOS (Home)
   ════════════════════════════════════════ */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}
.card {
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:not(.card--disabled):hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 6px 20px rgba(26,187,156,.2);
}
.card--disabled { opacity: .5; }
.card__icon {
    width: 48px; height: 48px;
    display: grid; place-items: center;
    border-radius: 8px;
    margin-bottom: 14px;
    background: rgba(26,187,156,.15);
    color: var(--primary);
}
.card__icon svg { width: 24px; height: 24px; }
.card__icon--audit { background: rgba(52,152,219,.15); color: var(--info); }
.card__icon--database { background: rgba(155,89,182,.15); color: #9b59b6; }
.card__icon--soon { background: rgba(138,149,178,.12); color: var(--muted); }
.card__tag {
    display: inline-block;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    color: var(--primary); background: rgba(26,187,156,.1);
    padding: 3px 8px; border-radius: 3px;
    margin-bottom: 8px;
}
.card__title { margin: 0 0 6px; font-size: 16px; }
.card__desc { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; overflow-wrap: break-word; word-break: break-all; }
.card__desc code { word-break: break-all; }
.card__cta { margin-top: 14px; font-weight: 600; color: var(--primary); font-size: 13px; }
.card__cta--muted { color: var(--muted); }

/* Central de Serviços (/apps): blocos mais baixos para caber mais na tela. */
.apps-grid { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.apps-grid .card { padding: 14px 16px; }
.apps-grid .card__icon { width: 36px; height: 36px; margin-bottom: 8px; }
.apps-grid .card__icon svg { width: 18px; height: 18px; }
.apps-grid .card__tag { margin-bottom: 4px; }
.apps-grid .card__title { font-size: 14px; margin-bottom: 3px; }
.apps-grid .card__desc {
    font-size: 12px; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.apps-grid .card__cta { margin-top: 8px; font-size: 12px; }
.apps-grid .card__icon--vault { background: rgba(231,76,60,.15); color: var(--danger); }
.apps-grid .card__icon--users { background: rgba(52,152,219,.15); color: var(--info); }
.apps-grid .card__icon--shield { background: rgba(240,173,78,.15); color: var(--warning); }
.apps-grid .card__icon--smartphone { background: rgba(155,89,182,.15); color: #9b59b6; }

/* ════════════════════════════════════════
   PANELS
   ════════════════════════════════════════ */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}
.panel--narrow { max-width: 540px; margin: 0 auto; }
.panel.center { text-align: center; }
.panel__head { margin-bottom: 18px; }
.panel__head h2 { margin: 0 0 4px; font-size: 18px; }
.panel__head p { margin: 0; color: var(--muted); font-size: 13px; }
.panel__head--row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }

/* ════════════════════════════════════════
   BREADCRUMB
   ════════════════════════════════════════ */
.breadcrumb {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    color: var(--muted); font-size: 13px; margin-bottom: 18px;
}
.breadcrumb a { color: var(--muted); transition: color .15s; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb strong { color: var(--text); font-weight: 600; }
.breadcrumb span { opacity: .4; }

/* ════════════════════════════════════════
   FORMS
   ════════════════════════════════════════ */
.form__row { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
/* Vínculo do Chatwoot (Meu Perfil): campo e botão na mesma linha, com o campo
   limitado — um e-mail não precisa de um input do tamanho do painel. */
.chatwoot-link { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.chatwoot-link .form__row { flex: 1 1 260px; max-width: 420px; }

.form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form__grid--3 { grid-template-columns: repeat(3, 1fr); }
.form__grid--span2 { grid-column: span 2; }
/* Blocos temáticos para formulários largos (ex.: agenda). */
.form__section { margin-bottom: 22px; }
.form__section > h3 {
    margin: 0 0 12px; padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 12px; font-weight: 700; letter-spacing: .5px;
    text-transform: uppercase; color: #99afc0;
}
.form__checks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 14px; }
.form__checks .checkbox { margin: 4px 0; }
@media (max-width: 1080px) {
    .form__grid--3 { grid-template-columns: 1fr 1fr; }
    .form__grid--span2 { grid-column: auto; }
    .form__checks { grid-template-columns: 1fr 1fr; }
}
.form label { font-size: 12px; font-weight: 600; color: #99afc0; text-transform: uppercase; letter-spacing: .3px; }
.form input[type=text],
.form input[type=email],
.form input[type=password],
.form input[type=tel],
.form input[type=url],
.form input[type=number],
.form input[type=search],
.form input[type=date],
.form input[type=time],
.form input[type=month],
.form input[type=week],
.form input[type=datetime-local],
.form select,
.form textarea {
    background: rgba(0,0,0,.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 10px 12px;
    font-size: 13px; font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
    width: 100%; box-sizing: border-box;
}
/* Seta nativa do <select> é cinza-OS e não segue o tema — troca por um chevron
   próprio (SVG embutido) e cor por tema, mantendo o popup nativo do browser. */
.form select {
    cursor: pointer;
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%238a95b2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 34px;
}
/* Repete repeat/position/size aqui porque a regra de tema claro em
   `[data-theme="light"] .form select` (acima, `background: #fff`) usa o
   shorthand `background` — ele zera esses sub-valores, e tem mais
   especificidade que a regra base `.form select`, então venceria mesmo vindo
   antes no arquivo. Sem isso o chevron volta a repetir (`background-repeat`
   cai para o padrão `repeat`) no tema claro. */
[data-theme="light"] .form select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%237b8a9e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
}
/* Widgets nativos (calendário/relógio/setas) seguem o tema em vez do padrão do browser. */
.form input[type=number],
.form input[type=date],
.form input[type=time],
.form input[type=month],
.form input[type=week],
.form input[type=datetime-local] { color-scheme: dark; }
[data-theme="light"] .form input[type=number],
[data-theme="light"] .form input[type=date],
[data-theme="light"] .form input[type=time],
[data-theme="light"] .form input[type=month],
[data-theme="light"] .form input[type=week],
[data-theme="light"] .form input[type=datetime-local] { color-scheme: light; }
.form select option { background: var(--surface); color: var(--text); }
.form textarea { resize: vertical; min-height: 60px; }
.form input:focus,
.form select:focus,
.form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,187,156,.18);
}
.form small { color: var(--muted); font-size: 11px; }

/* Checkbox/radio nativos: tamanho e cor de acento consistentes em qualquer
   tela, sem precisar de uma classe wrapper. Componentes com estilo próprio
   (`.perm-seg`, `.login-check`) têm seletores mais específicos e vencem esta
   regra de base — ver design-system.md#form-controls. */
input[type=checkbox],
input[type=radio] {
    width: 15px; height: 15px;
    accent-color: var(--primary);
    cursor: pointer;
    vertical-align: middle;
}
.checkbox {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--muted); margin: 4px 0 18px;
    cursor: pointer; font-weight: 500;
}
.form__actions { display: flex; gap: 10px; }

/* ════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 9px 16px;
    font-size: 13px; font-weight: 600;
    font-family: inherit; cursor: pointer;
    transition: background .15s, border-color .15s, transform .08s;
}
.btn:active { transform: translateY(1px); }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: var(--danger-dark); }
.btn--danger-outline { background: transparent; border-color: rgba(231,76,60,.4); color: var(--danger); }
.btn--danger-outline:hover { background: var(--danger); color: #fff; }
.btn--cancel { background: rgba(255,255,255,.08); color: var(--text); border-color: var(--border); }
.btn--cancel:hover { background: rgba(255,255,255,.14); }
.btn--block { width: 100%; }
.btn--outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn--outline:hover { border-color: var(--primary); color: var(--primary); }

/* Badge */
.btn--disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge--success { background: rgba(38,166,91,.15); color: #26a65b; }
.badge--danger { background: rgba(231,76,60,.15); color: #e74c3c; }
.badge--info { background: rgba(52,152,219,.15); color: #3498db; }
.badge--warning { background: rgba(240,173,78,.15); color: #d68910; }
.badge--urgent { background: rgba(142,68,173,.15); color: #8e44ad; }

/* ════════════════════════════════════════
   TABLE
   ════════════════════════════════════════ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }

/* Barra de rolagem horizontal das tabelas: a mesma fina e translúcida da sidebar
   e da lista de notificações, em vez da barra nativa do navegador (larga, branca,
   com setas). Também cobre o `.panel__body` com rolagem no mobile (ver @media). */
.table-wrap,
.panel__body {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.18) transparent;
}
.table-wrap::-webkit-scrollbar,
.panel__body::-webkit-scrollbar { height: 8px; width: 8px; }
.table-wrap::-webkit-scrollbar-track,
.panel__body::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-button,
.panel__body::-webkit-scrollbar-button { display: none; height: 0; width: 0; }
.table-wrap::-webkit-scrollbar-corner,
.panel__body::-webkit-scrollbar-corner { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb,
.panel__body::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,.18);
    border: 2px solid transparent;
    background-clip: content-box;
    border-radius: 4px;
}
.table-wrap::-webkit-scrollbar-thumb:hover,
.panel__body::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,.4); }
[data-theme="light"] .table-wrap,
[data-theme="light"] .panel__body { scrollbar-color: rgba(0,0,0,.22) transparent; }
[data-theme="light"] .table-wrap::-webkit-scrollbar-thumb,
[data-theme="light"] .panel__body::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,.22); }
[data-theme="light"] .table-wrap::-webkit-scrollbar-thumb:hover,
[data-theme="light"] .panel__body::-webkit-scrollbar-thumb:hover { background-color: rgba(0,0,0,.4); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
    text-align: left;
    color: var(--muted); font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: .4px;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
}
.table tbody td { padding: 10px 12px; border-bottom: 1px solid rgba(53,80,104,.5); }
.table tbody tr:hover { background: rgba(26,187,156,.04); }
.table .num { text-align: right; white-space: nowrap; }
.table .actions-col { text-align: right; white-space: nowrap; }
.row-link { color: var(--text); font-weight: 500; transition: color .15s; }
.row-link:hover { color: var(--primary); }
.ic { display: inline-block; width: 16px; opacity: .7; margin-right: 3px; }
.ic--folder { color: #f0ad4e; }
.ic--file { color: var(--muted); }
.ic--up { color: var(--primary); }
.inline { display: inline; margin-left: 5px; }
.empty { text-align: center; color: var(--muted); padding: 28px 0; }
.muted { color: var(--muted); }

/* ════════════════════════════════════════
   BULK SELECT (S3)
   ════════════════════════════════════════ */
.check-col { width: 34px; text-align: center; padding-right: 0 !important; }
.check-col input[type=checkbox], .row-check {
    width: 15px; height: 15px; accent-color: var(--primary);
    cursor: pointer; vertical-align: middle;
}
.bulk-bar {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 12px; padding: 10px 14px;
    background: rgba(26,187,156,.1);
    border: 1px solid rgba(26,187,156,.3);
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.bulk-bar__count strong { color: var(--primary); }
.bulk-bar [type=submit] { margin-left: auto; }

/* ════════════════════════════════════════
   ALERTS
   ════════════════════════════════════════ */
.alert {
    border-radius: var(--radius-sm);
    padding: 12px 14px; margin-bottom: 18px;
    font-size: 13px; border-left: 4px solid;
}
.alert ul { margin: 0; padding-left: 16px; }
.alert--error { background: rgba(231,76,60,.12); border-color: var(--danger); color: #f1a9a0; }
.alert--success { background: rgba(38,185,154,.12); border-color: var(--success); color: #a3d9cc; }
.alert--info { background: rgba(52,152,219,.12); border-color: var(--info); color: #93c6e8; }

/* ════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════ */
.footer {
    border-top: 1px solid var(--border);
    padding: 14px 24px;
    color: var(--muted);
    font-size: 12px;
    display: flex; justify-content: space-between;
}

/* ════════════════════════════════════════
   AUDIT: stat cards
   ════════════════════════════════════════ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px; margin-bottom: 18px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px; text-align: center;
}
.stat-card__value { display: block; font-size: 28px; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.stat-card__label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; font-weight: 600; }
.stat-card--success .stat-card__value { color: var(--success); }
.stat-card--danger  .stat-card__value { color: var(--danger); }
.stat-card--warning .stat-card__value { color: var(--warning); }

/* ════════════════════════════════════════
   AUDIT: summary bars
   ════════════════════════════════════════ */
.summary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.summary-block {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px;
}
.summary-block h4 { margin: 0 0 12px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.summary-bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bar-label { width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); font-weight: 500; }
.bar-track { flex: 1; height: 6px; background: rgba(0,0,0,.3); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 3px; min-width: 3px; }
.bar-value { width: 30px; text-align: right; font-weight: 600; color: var(--muted); font-size: 11px; }

/* ════════════════════════════════════════
   AUDIT: filters
   ════════════════════════════════════════ */
.audit-filters { padding: 0; }
.af-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.af-field { display: flex; flex-direction: column; gap: 4px; min-width: 110px; }
.af-field label { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.af-field input, .af-field select {
    background: rgba(0,0,0,.2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    padding: 8px 10px; font-size: 12px; font-family: inherit;
}
.af-field input:focus, .af-field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(26,187,156,.18); }
.af-field select { cursor: pointer; color-scheme: dark; }
.af-field--btn { flex-direction: row; gap: 8px; align-items: flex-end; }

/*
 * Botões na mesma linha dos campos (filtros lado a lado, sem linha própria).
 *
 * Repetem o padding, o tamanho de fonte e a borda de .af-field input/select, e
 * fixam line-height 1.3 para que a altura do texto bata com a do select — é o
 * que faz os dois terem exatamente a mesma altura. Antes o botão saía 5px mais
 * baixo, porque .btn--sm usa padding menor.
 *
 * Preferimos derivar a altura das mesmas regras dos campos em vez de cravar um
 * valor: mexer no padding dos campos continua movendo os dois juntos.
 */
.af-field--btn .btn {
    padding: 8px 14px;
    font-size: 12px;
    line-height: 1.3;
    border-width: 1px;
    min-width: 82px;          /* Filtrar e Limpar com a mesma largura */
    justify-content: center;
}

/* ════════════════════════════════════════
   AUDIT: event table
   ════════════════════════════════════════ */
.audit-table { font-size: 12px; }
.audit-table th { font-size: 10px; }

/* Paginação da auditoria */
.audit-perpage {
    display: flex; align-items: center; gap: 6px;
    margin-top: 10px; font-size: 12px; flex-wrap: wrap;
}
.audit-pager {
    display: flex; justify-content: center; align-items: center;
    gap: 6px; margin-top: 18px; flex-wrap: wrap;
}
.audit-pager__gap { color: var(--muted); padding: 0 2px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.outcome-badge {
    display: inline-block; font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .3px;
    padding: 2px 8px; border-radius: 3px;
}
.outcome-badge--success { background: rgba(38,185,154,.2); color: var(--success); }
.outcome-badge--failure { background: rgba(231,76,60,.2); color: var(--danger); }
.sev-dot {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    margin-right: 4px; vertical-align: middle;
}
.event-label { font-weight: 500; }
.detail-reason {
    max-width: 160px; display: inline-block; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
    color: var(--muted); cursor: default;
}
.row--failure { background: rgba(231,76,60,.04); }
.row--failure:hover { background: rgba(231,76,60,.08) !important; }

/* ════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════ */
/* Tokens próprios: o card de login não segue as cores do painel (topo escuro
   fixo com a logo negativa), então tem sua própria paleta clara/escura. */
:root {
    --login-bg: #1b2434;
    --login-card-bg: #253347;
    --login-card-border: #3d5170;
    --login-input-bg: #26334a;
    --login-input-border: #4c6483;
    --login-input-text: #f1f4fb;
    --login-label: #aab8ce;
    --login-strong: #ffffff;
    --login-divider: #364a63;
    --login-footer-text: #97a4bd;
    --login-shadow: 0 6px 24px rgba(0,0,0,.35);
}
[data-theme="light"] {
    --login-bg: #f7f7f7;
    --login-card-bg: #ffffff;
    --login-card-border: #e5e5e5;
    --login-input-bg: #ffffff;
    --login-input-border: #ddd;
    --login-input-text: #333;
    --login-label: #888;
    --login-strong: #111111;
    --login-divider: #eee;
    --login-footer-text: #aaa;
    --login-shadow: 0 1px 3px rgba(0,0,0,.08);
}
body.login-page {
    background: var(--login-bg);
    display: grid; place-items: center;
    min-height: 100vh;
}

/* Alternador de tema: discreto, canto superior direito. */
.login-theme-toggle {
    position: fixed; top: 16px; right: 16px;
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border: 1px solid var(--login-card-border);
    border-radius: 8px;
    background: var(--login-card-bg);
    color: var(--login-label);
    cursor: pointer; opacity: .65;
    transition: opacity .2s, color .2s, border-color .2s;
}
.login-theme-toggle:hover { opacity: 1; color: var(--primary); border-color: var(--primary); }
[data-theme="dark"] .login-theme-toggle__icon--sun,
[data-theme="light"] .login-theme-toggle__icon--moon { display: block; }
[data-theme="dark"] .login-theme-toggle__icon--moon,
[data-theme="light"] .login-theme-toggle__icon--sun { display: none; }
.login-wrap {
    width: 100%; max-width: 430px;
    padding: 0 20px;
}
.login-card {
    background: var(--login-card-bg);
    border: 1px solid var(--login-card-border);
    border-radius: 4px;
    padding: 0;
    box-shadow: var(--login-shadow);
    overflow: hidden;
}
.login-card__top {
    background: var(--sidebar-bg);
    padding: 30px 32px 24px;
    text-align: center;
    color: #fff;
}
.login-card__logo {
    max-width: 220px;
    height: auto;
    margin-bottom: 16px;
}
.login-card__top h1 { font-size: 20px; margin: 0 0 4px; font-weight: 600; }
.login-card__top p { margin: 0; font-size: 13px; color: rgba(255,255,255,.6); }
.login-card__body { padding: 28px 32px 32px; }
.login-card__body .form__row label { color: var(--login-label); }
.login-card__body .form input {
    background: var(--login-input-bg);
    border: 1px solid var(--login-input-border);
    color: var(--login-input-text);
    padding: 11px 14px;
    font-size: 14px;
    border-radius: 3px;
}
.login-card__body .form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26,187,156,.15);
}
.login-card__body .btn--primary {
    margin-top: 6px;
    padding: 12px;
    font-size: 15px;
}
.login-card__body .btn--primary:hover:not(:disabled) { color: var(--login-strong); }
/* .btn--outline herda color:var(--text) do painel, que não acompanha a paleta
   própria do card de login — daí o override. */
.login-card__body .btn--outline {
    border: 1px solid var(--primary);
    color: var(--primary);
    background: rgba(26,187,156,.06);
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
}
.login-card__body .btn--outline:hover:not(:disabled) {
    border-color: var(--login-strong);
    color: var(--login-strong);
    background: rgba(26,187,156,.14);
}
.login-card__body .btn--outline:disabled {
    border-color: var(--login-input-border);
    color: var(--login-label);
    background: transparent;
}
.login-card__footer {
    text-align: center; padding: 14px;
    border-top: 1px solid var(--login-divider);
    font-size: 12px; color: var(--login-footer-text);
}
.login-card__footer strong { color: var(--warning); }

/* ── Layout split (tela de login principal): painel de marca à esquerda +
   formulário à direita. Estrutura e tratamento visual (headline em caixas,
   cantos "bracket", chips flutuantes, grão de textura) espelham o padrão de
   login de produtos B2B como o da Graphify (app.graphify.com/login),
   adaptado à paleta e ao conteúdo da Guarabyte. As demais telas de auth (2FA,
   recuperação de senha...) continuam usando .login-wrap/.login-card
   centralizados, sem o painel de marca. ─────────────────────────────────── */
:root {
    --gf-box-bg: #062314;
    --font-mono-display: ui-monospace, "Cascadia Code", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}
body.login-page.login-page--split {
    display: block;
    width: 100%;
    background: var(--login-bg);
}
.login-split {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(380px, 1fr) minmax(380px, 1fr);
    min-height: 100vh;
}

/* Utilitário "bracket corners": 4 pares de traços (vertical + horizontal)
   posicionados nos cantos via múltiplos background-image, sem marcar
   nenhum elemento extra no DOM. --mk controla o comprimento do traço. */
.mk-corners {
    position: relative;
    --mk: 8px;
    --mk-color: rgba(255,255,255,.5);
    background-repeat: no-repeat;
    background-image:
        linear-gradient(var(--mk-color), var(--mk-color)), linear-gradient(var(--mk-color), var(--mk-color)),
        linear-gradient(var(--mk-color), var(--mk-color)), linear-gradient(var(--mk-color), var(--mk-color)),
        linear-gradient(var(--mk-color), var(--mk-color)), linear-gradient(var(--mk-color), var(--mk-color)),
        linear-gradient(var(--mk-color), var(--mk-color)), linear-gradient(var(--mk-color), var(--mk-color));
    background-size:
        1px var(--mk), var(--mk) 1px,
        1px var(--mk), var(--mk) 1px,
        1px var(--mk), var(--mk) 1px,
        1px var(--mk), var(--mk) 1px;
    background-position:
        0% 0%, 0% 0%,
        100% 0%, 100% 0%,
        0% 100%, 0% 100%,
        100% 100%, 100% 100%;
}

.login-brand {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    color: var(--brand-text);
    padding: clamp(28px, 4vw, 48px) clamp(24px, 5vw, 56px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;

    /* Paleta escura: gradiente do painel de marca, com a rede de partículas
       verdes por cima. É o padrão (tema "dark" é o default do login). */
    --brand-text: rgba(255,255,255,.82);
    --brand-text-strong: #fff;
    --brand-chip-bg: rgba(243,255,241,.78);
    --brand-chip-text: #17472c;
    --brand-chip-mk: rgba(23,71,44,.35);
    --brand-border: rgba(255,255,255,.18);
    background: linear-gradient(135deg, #1d1d1d 2%, #002025 100%);
}
[data-theme="light"] .login-brand {
    --brand-text: rgba(11,35,24,.72);
    --brand-text-strong: #0b2318;
    --brand-chip-bg: rgba(6,35,20,.06);
    --brand-chip-text: #0b2318;
    --brand-chip-mk: rgba(11,35,24,.2);
    --brand-border: rgba(11,35,24,.14);
    background: linear-gradient(135deg, #eefcf5 0%, #cdeedd 100%);
}
.login-brand::after {
    /* Grão sutil sobre o gradiente, via ruído SVG (feTurbulence). */
    content: '';
    position: absolute; inset: 0;
    opacity: .1;
    mix-blend-mode: overlay;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.login-brand > * { position: relative; z-index: 2; }

/* Rede de partículas (particleground): dois canvases, um de fundo (lento,
   esparso) e um de frente (mais denso), como no preloader do site
   institucional. O truque do inset negativo + scale evita bordas vazias
   quando as partículas se movem perto da margem do painel. */
.login-brand__scene {
    position: absolute; inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}
.login-brand__particles {
    position: absolute;
    left: -51%; top: -51%;
    width: 202%; height: 202%;
    transform: scale3d(.5, .5, 1);
}

.login-brand__top {
    display: flex; align-items: center; gap: 10px;
}
.login-brand__logo { height: 32px; width: auto; display: none; }
.login-brand__logo--dark { display: block; }
/* logo.png (tema light) tem quase nenhuma margem transparente ao redor da
   arte, enquanto logo-negativo-branco.png (tema dark) tem bastante — na
   mesma altura de caixa a versão light rendia bem maior que a dark. */
.login-brand__logo--light { height: 24.7px; }
[data-theme="light"] .login-brand__logo--dark { display: none; }
[data-theme="light"] .login-brand__logo--light { display: block; }
/* Selo Quanthum Architecture · QAI no lugar do logo (canto superior esquerdo). */
.login-brand__logo.login-brand__selo { height: 44px; }
/* No cabeçalho dos cards (fundo escuro nos dois temas) vale a versão dark. */
.login-card__logo.login-card__selo { max-width: 260px; width: 100%; }

.login-brand__copy { max-width: 440px; }
.login-brand__headline {
    margin: 0 0 16px;
    font-family: var(--font-mono-display);
    font-size: clamp(20px, 2.1vw, 27px);
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -.01em;
}
.login-brand__headline span {
    display: inline-block;
    background: var(--gf-box-bg);
    color: #fff;
    padding: 1px 9px;
    border-radius: 2px;
    text-shadow: rgba(255,26,29,.55) 0 -2px 2px, rgba(51,99,255,.55) 0 2px 2px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}
.login-brand__desc {
    max-width: 340px;
    color: var(--brand-text);
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 18px;
}
.login-brand__chips { display: flex; flex-wrap: wrap; gap: 10px; }
.login-brand__chip {
    --mk: 6px;
    --mk-color: var(--brand-chip-mk);
    display: inline-flex; align-items: center; gap: 7px;
    background-color: var(--brand-chip-bg);
    color: var(--brand-chip-text);
    font-family: var(--font-mono-display);
    font-size: 11px;
    padding: 7px 10px;
}
.login-brand__chip svg { width: 13px; height: 13px; flex: 0 0 13px; }

.login-brand__features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    padding-top: 20px;
    border-top: 1px solid var(--brand-border);
}
.login-brand__feature {
    --mk: 7px;
    --mk-color: var(--brand-border);
    padding: 10px;
}
.login-brand__num {
    display: block;
    font-family: var(--font-mono-display);
    font-size: 11px;
    color: var(--brand-text-strong);
    margin-bottom: 6px;
}
.login-brand__feature p { margin: 0; font-size: 12px; color: var(--brand-text); line-height: 1.4; }

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    /* Leve realce radial: evita que o lado do formulário pareça um vazio
       plano, sem virar um "card" (mantém o espírito flat da referência). */
    background: radial-gradient(120% 100% at 50% 0%, rgba(255,255,255,.035), transparent 60%);
}
[data-theme="light"] .login-panel {
    background: radial-gradient(120% 100% at 50% 0%, rgba(17,141,79,.04), transparent 60%);
}
.login-panel .login-card--plain {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    max-width: 400px;
    width: 100%;
}
.login-panel .login-card--plain .login-card__body { padding: 0; }
.login-card__head { margin-bottom: 22px; }
.login-card__head h2 { margin: 0 0 6px; font-size: 26px; font-weight: 500; color: var(--login-strong); }
.login-card__head p { margin: 0; font-size: 13px; color: var(--login-label); }
.login-panel .login-card--plain .login-card__footer {
    border-top: none;
    padding: 24px 0 0;
    text-align: left;
}
/* Cantos retos e traço mais fino, no espírito da referência (sem pílulas). */
.login-panel .login-card--plain .form input,
.login-panel .login-card--plain .btn {
    border-radius: 2px;
}

@media (max-width: 900px) {
    .login-split { grid-template-columns: 1fr; min-height: auto; }
    .login-brand { padding: 28px 24px 22px; border-radius: 0; }
    .login-brand__headline { font-size: 20px; }
    .login-brand__features { display: none; }
    .login-panel { padding: 32px 24px 40px; }
}

/* Checkbox "Lembrar-me": o nativo ignora o tema escuro (fica um quadrado
   branco), então é desenhado do zero. */
.login-check {
    display: flex; align-items: center; gap: 9px;
    font-weight: 400; cursor: pointer;
    color: var(--login-label); font-size: 13px;
    user-select: none;
}
.login-card__body .form .login-check input[type=checkbox] {
    appearance: none; -webkit-appearance: none;
    width: 18px; height: 18px; flex: 0 0 18px;
    margin: 0; padding: 0;
    border: 1px solid var(--login-input-border);
    border-radius: 4px;
    background: var(--login-input-bg);
    position: relative; cursor: pointer;
    transition: background .15s, border-color .15s;
}
.login-card__body .form .login-check input[type=checkbox]:hover { border-color: var(--primary); }
.login-card__body .form .login-check input[type=checkbox]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(26,187,156,.25);
}
.login-card__body .form .login-check input[type=checkbox]:checked {
    background: var(--primary);
    border-color: var(--primary);
}
/* Traço do "v" desenhado com duas bordas + rotação. */
.login-card__body .form .login-check input[type=checkbox]:checked::after {
    content: '';
    position: absolute; left: 5px; top: 1px;
    width: 5px; height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Campo dos códigos de 6 dígitos (2FA, verificação de e-mail, recuperação). */
.login-card__body .form input.login-code {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 8px;
    /* O letter-spacing deixa um vão após o último dígito, jogando o texto
       visualmente para a esquerda; o indent devolve o código ao centro. */
    text-indent: 8px;
}
.login-hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--login-label);
}

/* Botões do card (login e telas de recuperação): mesma paleta e mesmos
   afetos de hover/foco em qualquer uma das telas. */
.login-card__body .btn {
    transition: background .2s, border-color .2s, color .2s, box-shadow .2s, transform .08s;
}
.login-card__body a.btn {
    text-decoration: none;
    display: flex;
}
.login-card__body .btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(26,187,156,.3);
}
.login-card__body .btn--primary:hover:not(:disabled) {
    box-shadow: 0 3px 12px rgba(26,187,156,.28);
}
/* Ação secundária ("Voltar ao login", "Cancelar"): discreta, mas seguindo o
   tema — antes era um cinza-claro fixo que brigava com o modo escuro. */
.login-card__body .btn--ghost {
    margin-top: 10px;
    padding: 12px;
    font-size: 13px;
    background: transparent;
    border: 1px solid var(--login-input-border);
    color: var(--login-label);
}
.login-card__body .btn--ghost:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(26,187,156,.06);
}

/* "Esqueci minha senha": sublinhado que cresce do centro no hover. */
.login-forgot {
    display: inline-block;
    position: relative;
    color: var(--login-label);
    font-size: 13px;
    text-decoration: none;
    padding-bottom: 2px;
    transition: color .2s;
}
.login-forgot::after {
    content: '';
    position: absolute; left: 0; right: 0; bottom: 0;
    height: 1px; background: var(--primary);
    transform: scaleX(0);
    transition: transform .2s ease;
}
.login-forgot:hover,
.login-forgot:focus-visible { color: var(--primary); }
.login-forgot:hover::after,
.login-forgot:focus-visible::after { transform: scaleX(1); }
.login-forgot:focus-visible { outline: none; }

@media (prefers-reduced-motion: reduce) {
    .login-forgot::after { transition: none; }
}

/* ── Envio em andamento: Entrar, 2FA e verificação por e-mail ─────── */
.btn-spinner {
    display: inline-block;
    width: 15px; height: 15px; flex: 0 0 15px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: passkey-spin .7s linear infinite;
}
/* O :disabled apagaria o botão justo quando ele precisa chamar atenção; aqui a
   cor fica viva e o pulso mostra que a página está trabalhando. */
.btn.is-submitting:disabled {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    opacity: 1;
    cursor: progress;
    animation: passkey-pulse-solid 1.4s ease-in-out infinite;
}
@keyframes passkey-pulse-solid { 50% { filter: brightness(.9); } }

/* Os demais botões do cartão ficam apagados: só um envio por vez. */
.login-card__body button:disabled:not(.is-submitting) { opacity: .45; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
    .btn-spinner { animation-duration: 1.6s; }
    .btn.is-submitting:disabled { animation: none; }
}

/* ── Passkey: feedback de processamento ───────────────────────────── */
.passkey-btn__spinner {
    width: 15px; height: 15px; flex: 0 0 15px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: passkey-spin .7s linear infinite;
}
@keyframes passkey-spin { to { transform: rotate(360deg); } }

.login-card__body .btn--outline.is-busy,
.login-card__body .btn--outline.is-ok {
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
/* Aguardando o dispositivo: mantém a cor viva (o :disabled apagaria o botão)
   e pulsa de leve para indicar que a página não travou. */
.login-card__body .btn--outline.is-busy:disabled {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(26,187,156,.06);
    animation: passkey-pulse 1.6s ease-in-out infinite;
}
@keyframes passkey-pulse { 50% { background: rgba(26,187,156,.16); } }

/* Verificado: confirmação curta antes do redirecionamento. */
.login-card__body .btn--outline.is-ok:disabled {
    border-color: var(--success);
    color: #fff;
    background: var(--success);
    animation: passkey-pop .35s ease-out;
}
@keyframes passkey-pop {
    0%   { transform: scale(.97); }
    60%  { transform: scale(1.02); }
    100% { transform: scale(1); }
}
.passkey-btn__check {
    width: 18px; height: 18px; flex: 0 0 18px;
}
.passkey-btn__check path {
    stroke-dasharray: 24; stroke-dashoffset: 24;
    animation: passkey-draw .3s ease-out .05s forwards;
}
@keyframes passkey-draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
    .passkey-btn__spinner { animation-duration: 1.6s; }
    .login-card__body .btn--outline.is-busy:disabled,
    .login-card__body .btn--outline.is-ok:disabled,
    .passkey-btn__check path { animation: none; }
    .passkey-btn__check path { stroke-dashoffset: 0; }
}

/* ════════════════════════════════════════
   PROFILE PAGE
   ════════════════════════════════════════ */

/* Row layout */
.profile-row {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    align-items: stretch;
    margin-bottom: 20px;
}
.profile-row--bottom {
    grid-template-columns: 1fr 1fr;
}
.profile-col-left, .profile-col-right, .profile-col-half { display: flex; }
.profile-col-left > *, .profile-col-right > *, .profile-col-half > * { flex: 1; }

/* Left card */
.profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px 24px;
    text-align: center;
}
.profile-card__avatar-wrap {
    width: 110px; height: 110px;
    margin: 0 auto 16px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--border);
}
.profile-card__avatar-img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.profile-card__avatar-placeholder {
    width: 100%; height: 100%;
    background: var(--primary);
    color: #fff;
    font-size: 44px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.profile-card__name {
    font-size: 17px; font-weight: 600;
    color: var(--text); margin: 0 0 4px;
}
.profile-card__email {
    font-size: 13px; color: var(--muted); margin: 0 0 16px;
}
.profile-card__actions { margin-bottom: 0; }
.profile-card__divider {
    border: none; border-top: 1px solid var(--border);
    margin: 22px 0;
}
.toggle-switch {
    position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch__slider {
    position: absolute; inset: 0; background: var(--border, #4b5563); border-radius: 24px; transition: background .2s;
}
.toggle-switch__slider::before {
    content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%; transition: transform .2s;
}
.toggle-switch input:checked + .toggle-switch__slider { background: var(--success, #22c55e); }
.toggle-switch input:checked + .toggle-switch__slider::before { transform: translateX(20px); }
.profile-card__section-title {
    font-size: 14px; font-weight: 600;
    color: var(--text); margin: 0 0 14px;
    text-align: left;
}
.profile-card__password-form .form__row { text-align: left; }
.profile-card__password-form .form__row label { font-size: 12px; }
.profile-card__password-form .form__row input { font-size: 13px; }

/* Form Grid (2-col) */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

/* Notification list */
.notification-list { display: flex; flex-direction: column; }
.notification-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.notification-item:last-child { border-bottom: none; }
.notification-item__info { flex: 1; }
.notification-item__info strong { font-size: 14px; color: var(--text); display: block; margin-bottom: 2px; }
.notification-item__info p { font-size: 12px; color: var(--muted); margin: 0; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__slider {
    position: absolute; inset: 0;
    background: #4a5568; border-radius: 24px;
    cursor: pointer; transition: background .3s;
}
.toggle__slider::before {
    content: ''; position: absolute;
    width: 18px; height: 18px;
    left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%;
    transition: transform .3s;
}
.toggle input:checked + .toggle__slider { background: var(--primary); }
.toggle input:checked + .toggle__slider::before { transform: translateX(20px); }
.toggle input:disabled + .toggle__slider { opacity: .5; cursor: not-allowed; }

/* Sessions table */
.table--sessions { font-size: 13px; }
.table--sessions th { font-size: 10px; letter-spacing: .5px; }
.table--sessions td { vertical-align: middle; }

/* ════════════════════════════════════════
   AGENDA — abas, grade semanal e horários
   ════════════════════════════════════════ */
.ag-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.ag-tab {
    padding: 9px 16px; font-size: 13px; font-weight: 600; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s;
    display: flex; align-items: center; gap: 6px;
}
.ag-tab:hover { color: var(--text); }
.ag-tab--active { color: var(--primary); border-bottom-color: var(--primary); }

.ag-day {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 0; border-bottom: 1px solid var(--border);
}
.ag-day:last-of-type { border-bottom: none; }
.ag-day__label { width: 90px; font-size: 13px; font-weight: 600; color: var(--text); flex-shrink: 0; }
.ag-day__ranges { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.ag-range { display: flex; align-items: center; gap: 6px; }
.ag-range input[type=time] {
    /* Mais compacto que o padrão do .form, e lado a lado em vez de 100% da linha. */
    width: auto; padding: 6px 8px; font-size: 13px;
}
.ag-range__remove {
    background: none; border: none; color: var(--danger); font-size: 18px; line-height: 1;
    cursor: pointer; padding: 0 4px;
}

/* Modal "Marcar reunião": calendário | horários | dados, lado a lado,
   para o conteúdo caber sem rolagem vertical no modal. */
.mk-picker {
    display: grid;
    grid-template-columns: 236px minmax(168px, .8fr) minmax(250px, 1.15fr);
    gap: 22px; align-items: start;
}
.mk-dados { min-width: 0; }
.mk-dados .pub-chosen { margin-bottom: 14px; padding: 8px 12px; font-size: 13px; }
.mk-picker .pub-month { width: 236px; }
.mk-picker .pub-month__day { line-height: 30px; height: 30px; border: none; background: none; font-family: inherit; cursor: default; }
.mk-picker button.pub-month__day { cursor: pointer; }
.mk-horarios { flex: 1; min-width: 200px; }
.mk-horarios__head {
    font-size: 12px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .3px; margin-bottom: 12px;
}
.mk-horarios__list {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 8px; max-height: 268px; overflow-y: auto; padding-right: 4px;
}
.mk-horarios__list::-webkit-scrollbar { width: 6px; }
.mk-horarios__list::-webkit-scrollbar-track { background: transparent; }
.mk-horarios__list::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.18); border-radius: 3px; }

/* Campo somente-leitura que exibe o link público da agenda.
   Cresce com o espaço disponível para caber endereços longos. */
.link-field {
    flex: 1; min-width: 0; width: 100%;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius); padding: 7px 10px;
    font-size: 12px; font-family: inherit; text-overflow: ellipsis;
}
.link-field:focus { outline: none; border-color: var(--primary); }

.ag-months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ag-month {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface-2); font-size: 13px; color: var(--text);
    transition: border-color .15s, background .15s;
}
.ag-month:hover { border-color: var(--primary); }
.ag-month input { width: 16px; height: 16px; accent-color: var(--primary); }
.ag-month:has(input:checked) { border-color: var(--primary); background: rgba(26,187,156,.12); }
.ag-month small { margin-left: auto; font-size: 10px; color: var(--muted); text-transform: uppercase; }
.ag-month--past { opacity: .6; }

.ag-request {
    display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
    padding: 12px 0; border-bottom: 1px solid var(--border);
}
.ag-request:last-child { border-bottom: none; }
.ag-request__when {
    width: 62px; flex-shrink: 0; text-align: center; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 0;
}
.ag-request__when strong { display: block; font-size: 15px; color: var(--text); }
.ag-request__when span { display: block; font-size: 12px; color: var(--muted); }
.ag-request__body { flex: 1; min-width: 180px; }
.ag-request__body p { margin: 2px 0 0; font-size: 12px; }
.ag-request__actions { display: flex; gap: 6px; }

/* Grade de 7 dias (padrão do painel público e do calendário interno) */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; flex: 1; min-width: 0; }
.cal-col { min-width: 0; }
.cal-col__head { text-align: center; padding-bottom: 10px; }
.cal-col__dow { display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.cal-col__day { display: block; font-size: 20px; font-weight: 500; color: var(--text); margin-top: 2px; }
.cal-col__head--today .cal-col__day {
    background: var(--primary); color: #fff; border-radius: 999px;
    width: 34px; height: 34px; line-height: 34px; margin: 2px auto 0;
}
.cal-col__slots { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.cal-slot {
    display: block; width: 100%; padding: 9px 4px; border-radius: 999px; text-align: center;
    border: 1px solid var(--border); background: transparent; color: var(--primary);
    font-size: 13px; font-weight: 500; font-family: var(--font); cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}
.cal-slot:hover { border-color: var(--primary); background: rgba(26,187,156,.12); }
.cal-slot--static { cursor: default; color: var(--text); }
.cal-slot--static:hover { border-color: var(--border); background: transparent; }
/* Horário escolhido no modal "Marcar reunião". */
.cal-slot--sel { border-color: var(--primary); background: var(--primary); color: #fff; }
.cal-slot--sel:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.cal-empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* ════════════════════════════════════════
   AGENDA — páginas públicas (sem login)
   ════════════════════════════════════════ */
.pub-body { background: var(--bg-body); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
.pub-topbar {
    background: var(--topbar-bg); color: var(--topbar-text); height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; box-shadow: var(--shadow);
}
.pub-topbar__left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.pub-topbar__logo { height: 30px; width: auto; flex-shrink: 0; }
.pub-topbar__title {
    font-size: 15px; font-weight: 600; color: var(--topbar-text);
    padding-left: 14px; border-left: 1px solid rgba(0,0,0,.12);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* O padding inferior reserva espaço para a barra de seleção fixa. */
.pub-main { flex: 1; padding: 24px 16px 96px; }
.pub-footer {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 16px 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px;
}
.pub-footer a { color: var(--primary); }
.pub-footer a:hover { text-decoration: underline; }

.pub-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px 24px; max-width: 1180px; margin: 0 auto 16px; box-shadow: var(--shadow);
}
.pub-card--narrow { max-width: 520px; margin-top: 40px; }
.pub-card__head { display: flex; gap: 28px; flex-wrap: wrap; }
.pub-card__owner { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.pub-card__owner strong { display: block; font-size: 15px; color: var(--text); }
.pub-card__owner span { display: block; font-size: 12px; color: var(--muted); }
.pub-card__avatar {
    width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; flex-shrink: 0;
}
.pub-card__info { flex: 1; min-width: 240px; }
.pub-card__manage {
    align-self: flex-start; flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.pub-card__manage svg { stroke: currentColor; }
.pub-card__info h1 { font-size: 20px; font-weight: 600; margin: 0 0 10px; }
.pub-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.pub-meta svg { flex-shrink: 0; stroke: var(--muted); }
.pub-meta--warn { color: var(--warning); }
.pub-meta--warn svg { stroke: var(--warning); }
.pub-desc { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 8px 0 0; }

.pub-picker__head {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    flex-wrap: wrap; margin-bottom: 18px;
}
.pub-picker__head h2 { font-size: 16px; font-weight: 600; margin: 0; }
.pub-picker__head .muted { font-size: 12px; }
.pub-picker { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }

.pub-month { width: 260px; flex-shrink: 0; }
.pub-month__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 14px; }
.pub-month__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.pub-month__dow { font-size: 11px; color: var(--muted); padding-bottom: 4px; }
.pub-month__day {
    display: block; line-height: 30px; height: 30px; border-radius: 50%;
    font-size: 13px; color: var(--muted);
}
.pub-month__day--free { color: var(--primary); background: rgba(26,187,156,.12); font-weight: 600; }
.pub-month__day--free:hover { background: rgba(26,187,156,.28); }
.pub-month__day--active { background: var(--primary); color: #fff; }
.pub-month__day--off { text-decoration: line-through; opacity: .45; }

.pub-week { display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 300px; }
.pub-nav {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%; color: var(--muted); font-size: 18px;
    /* Serve tanto para <a> (painel público) quanto para <button> (modal interno). */
    background: none; border: none; padding: 0; cursor: pointer; font-family: inherit;
}
.pub-nav:hover { background: var(--surface-2); color: var(--primary); }
.pub-nav--side { margin-top: 18px; flex-shrink: 0; }

.pub-chosen {
    background: var(--surface-2); border-left: 3px solid var(--primary); border-radius: var(--radius);
    padding: 10px 14px; margin: 0 0 16px; font-size: 14px; font-weight: 600; color: var(--text);
    display: flex; flex-wrap: wrap; gap: 6px 14px;
}

/* Barra fixa com os horários já escolhidos (seleção múltipla). */
.pub-selecao {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -6px 20px rgba(0,0,0,.25);
    transform: translateY(110%); transition: transform .2s ease;
}
.pub-selecao--visivel { transform: translateY(0); }
.pub-selecao__inner {
    max-width: 1180px; margin: 0 auto; padding: 12px 24px;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.pub-selecao__lista {
    flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap; font-size: 13px; color: var(--text); max-height: 84px; overflow-y: auto;
}
.pub-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(26,187,156,.14); border: 1px solid var(--primary); color: var(--primary);
    border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 12px; font-weight: 600;
}
.pub-chip button {
    background: none; border: none; color: inherit; cursor: pointer;
    font-size: 15px; line-height: 1; padding: 0 4px;
}
.pub-chip button:hover { color: var(--danger); }
.pub-check {
    width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 18px;
    display: flex; align-items: center; justify-content: center;
}
.pub-check--ok { background: rgba(38,166,91,.15); color: var(--success); }
.pub-check--wait { background: rgba(240,173,78,.15); color: var(--warning); }
.pub-check--err { background: rgba(231,76,60,.15); color: var(--danger); }

.pub-summary { text-align: left; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.pub-summary > div {
    display: flex; justify-content: space-between; gap: 14px;
    padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.pub-summary > div:last-child { border-bottom: none; }
.pub-summary span { color: var(--muted); }
.pub-summary strong { color: var(--text); text-align: right; }

/* Botões "adicionar à minha agenda" (Google, Outlook, .ics). */
.pub-exportar { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.pub-exportar__label { font-size: 12px; color: var(--muted); }
.pub-exportar__acoes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pub-exportar .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; white-space: nowrap; }
.pub-exportar .btn svg { stroke: currentColor; flex: 0 0 auto; }
.pub-card--narrow .pub-exportar { align-items: center; margin-top: 20px; }
.pub-card--narrow .pub-exportar__label { text-align: center; }
.pub-card--narrow .pub-exportar__acoes { width: 100%; }
@media (max-width: 480px) {
    .pub-exportar__acoes { grid-template-columns: 1fr; }
}

.pub-list { display: flex; flex-direction: column; }
.pub-item {
    display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
    padding: 14px 0; border-bottom: 1px solid var(--border);
}
.pub-item:last-child { border-bottom: none; }
.pub-item--off { opacity: .6; }
.pub-item__date {
    width: 62px; flex-shrink: 0; text-align: center; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 0;
}
.pub-item__date strong { display: block; font-size: 15px; color: var(--text); }
.pub-item__date span { display: block; font-size: 12px; color: var(--muted); }
.pub-item__body { flex: 1; min-width: 180px; }
.pub-item__body p { margin: 2px 0 0; font-size: 12px; }
.pub-item__actions { display: flex; gap: 8px; align-items: center; }

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (max-width: 1080px) {
    /* Sem largura para as três colunas: dados descem para baixo do seletor. */
    .mk-picker { grid-template-columns: 236px minmax(168px, 1fr); }
    .mk-dados { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
    .mk-picker { grid-template-columns: 1fr; }
    .mk-picker .pub-month { width: 100%; }
}
@media (max-width: 900px) {
    .pub-picker { flex-direction: column; }
    .pub-month { width: 100%; }
    .cal-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 768px) {
    .cal-grid { grid-template-columns: repeat(3, 1fr); }
    .ag-day__label { width: 100%; }
    .ag-months { grid-template-columns: repeat(2, 1fr); }
    /* ── Sidebar vira gaveta sobreposta ──
       No desktop ela empurra o conteúdo (margin-left); no celular não há
       largura para isso, então desliza por cima com um backdrop. O modo
       "recolhida" (70px) não se aplica aqui — a gaveta é sempre inteira.
       O JS (toggleSidebar) remove as classes de recolhimento no mobile. */
    .sidebar,
    .sidebar--collapsed,
    html.sidebar-is-collapsed .sidebar {
        width: var(--sidebar-w);
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 120;
    }
    .sidebar--open,
    html.sidebar-is-collapsed .sidebar--open {
        transform: translateX(0);
        box-shadow: 0 0 34px rgba(0,0,0,.55);
    }

    .nav-backdrop {
        display: block;
        position: fixed; inset: 0;
        background: rgba(0,0,0,.5);
        opacity: 0; pointer-events: none;
        transition: opacity .25s ease;
        z-index: 110;
    }
    .nav-backdrop--show { opacity: 1; pointer-events: auto; }

    /* O conteúdo nunca desloca no celular. */
    .topbar, html.sidebar-is-collapsed .topbar { left: 0; }
    .app-body, html.sidebar-is-collapsed .app-body { margin-left: 0; }

    /* ── Tabelas: rolagem horizontal em vez de estourar o painel ──
       18 views já usam .table-wrap; as outras 23 põem a <table> direto no
       .panel__body. A regra abaixo cobre as duas formas de uma vez. */
    .panel { padding: 16px; }
    .panel__body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { min-width: 600px; }

    /* ── Topbar: o conteúdo não cabe em 375px ──
       Somados, logo + selo de ambiente + título + 3 botões passavam de 650px e
       eram a causa real da rolagem horizontal da página. O título sai (o
       breadcrumb logo abaixo já diz onde se está) e o resto encolhe. */
    .topbar { padding: 0 10px; }
    .topbar__left { gap: 8px; min-width: 0; }
    .topbar__right { gap: 2px; }
    .topbar__title { display: none; }
    .topbar__env { font-size: 9px; padding: 3px 6px; letter-spacing: .3px; }
    .topbar__logo { height: 26px; }

    /* Cabeçalho de página: título e botão empilhados. */
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }

    .summary-row { grid-template-columns: 1fr; }
    .af-row { flex-direction: column; }
    .af-field { min-width: 100%; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form__grid { grid-template-columns: 1fr; }
    .form__grid--3 { grid-template-columns: 1fr; }
    .form__checks { grid-template-columns: 1fr; }
    .profile-row { grid-template-columns: 1fr; }
    .profile-row--bottom { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════
   GRADE DE PERMISSÕES (perfis & usuários)
   Segmented control por módulo. Ver docs/modulos/perfis-permissoes.md
   ════════════════════════════════════════ */
.perm-intro {
    color: var(--muted); font-size: 12px; line-height: 1.6;
    margin: 0 0 16px;
}
.perm-intro strong { color: var(--text); font-weight: 600; }

/* Os grupos se distribuem em colunas conforme a largura disponível.
   560px é o mínimo em que o nome do módulo e o segmented control convivem
   na mesma linha sem quebrar. */
/* Multi-coluna em vez de grid: os grupos têm alturas bem diferentes e o grid
   deixaria vãos grandes sob os menores. As colunas equilibram a altura. */
.perm-groups {
    column-width: 560px;
    column-gap: 18px;
}
.perm-groups .perm-group {
    break-inside: avoid;
    /* Sem isso o Chrome ignora o break-inside dentro de fieldset. */
    display: inline-block; width: 100%;
}

.perm-group {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,.12);
    padding: 6px 16px 10px;
    margin: 0 0 14px;
}
/* ============================================================
   Módulo Tarefas — board Kanban, calendário e cards
   Reaproveita as variáveis de tema já existentes (funciona em
   light e dark automaticamente, como .ag-* / .pub-*).
   ============================================================ */
.tf-toolbar {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
    gap: 10px; margin-bottom: 16px;
}
/* Altura única (38px) para o filtro, o botão e o seletor de visão ficarem
   perfeitamente alinhados na mesma linha, com o mesmo box model. */
.tf-toolbar__filtro select,
.tf-toolbar__nova,
.view-switch {
    height: 38px;
    box-sizing: border-box;
}
.tf-toolbar__filtro select {
    min-width: 220px;
}
.tf-toolbar__nova {
    padding-top: 0; padding-bottom: 0;
}

/* ════════════════════════════════════════
   ALTERNADOR DE VISÃO (componente compartilhado)
   Segmented control de ícones para alternar a visualização de uma listagem
   (kanban/lista/calendário em Tarefas; bloco/lista em Database Manager etc).
   Funciona com <a> (navegação por URL, como em Tarefas) ou <button type="button">
   (alternância só em JS/CSS, como em Database Manager) — por isso o reset
   explícito de aparência/borda/fundo abaixo: sem ele um <button> nativo traz
   fundo branco e borda do navegador, quebrando o visual no tema dark.
   Ver docs/nucleo/layout-helpers.md.
   ════════════════════════════════════════ */
.view-switch {
    display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 2px;
}
.view-switch__btn {
    -webkit-appearance: none; appearance: none;
    background: none; border: none; margin: 0; padding: 0;
    font: inherit; text-decoration: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; width: 32px; height: 32px;
    border-radius: calc(var(--radius-sm) - 2px); color: var(--muted); transition: background .15s, color .15s;
}
.view-switch__btn:hover { color: var(--text); }
.view-switch__btn.is-active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* O atributo [hidden] do navegador tem a mesma especificidade de uma classe —
   sem isso, `.grid[hidden]` perde para `.grid { display: grid }` (definida
   depois, no CSS do autor) e o container "escondido" continua visível. */
[hidden] { display: none !important; }

.tf-board {
    display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px;
    flex: 1; min-height: 0;
}
.tf-col {
    flex: 0 0 250px; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius); display: flex; flex-direction: column;
}
.tf-col__head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .3px; color: var(--muted); border-bottom: 1px solid var(--border);
}
.tf-col__dot {
    width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; vertical-align: middle;
}
.tf-col__dot--muted   { background: var(--muted); }
.tf-col__dot--info    { background: var(--info); }
.tf-col__dot--warning { background: var(--warning); }
.tf-col__dot--success { background: var(--success, #26a65b); }
.tf-col__count {
    background: var(--surface); border-radius: 10px; padding: 1px 8px; font-size: 11px;
}
.tf-col__body { flex: 1; overflow-y: visible; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.tf-col__body--over { background: rgba(26,187,156,.08); }
.tf-col__add {
    display: block; text-align: center; margin: 0 8px 8px; padding: 8px; font-size: 12px;
    color: var(--muted); text-decoration: none; border: 1px dashed var(--border); border-radius: var(--radius-sm);
    transition: border-color .15s, color .15s;
}
.tf-col__add:hover { border-color: var(--primary); color: var(--primary); }

.tf-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px; cursor: pointer; display: block; transition: border-color .15s;
}
.tf-card:hover { border-color: var(--primary); }
.tf-card[draggable="true"] { cursor: grab; }
.tf-card__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.tf-card__proj { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; margin-right: 5px; vertical-align: middle; }
.tf-card__titulo { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--text); }
.tf-card__desc {
    margin: 0 0 10px; font-size: 12px; line-height: 1.4; color: var(--muted);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tf-card__footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
    font-size: 11px; color: var(--muted);
}
.tf-card__who { display: flex; align-items: center; gap: 6px; }
.tf-avatar {
    width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; flex-shrink: 0;
}
.tf-lista__grupo td {
    background: var(--surface-2); font-weight: 700; font-size: 11px; text-transform: uppercase;
    letter-spacing: .3px; color: var(--muted); padding: 8px 12px;
}

/* Tags do card (Kanban) */
.tf-card__tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; }
.tf-tagchip {
    display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 10px;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}

/* Pilha de avatares (múltiplos responsáveis) */
.tf-avatar-stack { display: flex; align-items: center; }
.tf-avatar-stack .tf-avatar { border: 2px solid var(--surface); margin-left: -8px; }
.tf-avatar-stack .tf-avatar:first-child { margin-left: 0; }
.tf-avatar--more { background: var(--surface-2); color: var(--muted); font-size: 8px; }

/* ============================================================
   Formulário de tarefa — Tags (chips), Assignees (avatares) e
   Description (editor rico mínimo, sem lib externa).
   ============================================================ */
.tf-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.tf-chip {
    display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 14px; padding: 3px 6px 3px 10px; font-size: 12px;
}
.tf-chip__remove {
    background: none; border: none; color: var(--muted); cursor: pointer; font-size: 15px;
    line-height: 1; padding: 0 2px;
}
.tf-chip__remove:hover { color: var(--danger); }

.tf-assignees { display: flex; flex-wrap: wrap; gap: 10px; }
.tf-assignee { cursor: pointer; display: inline-block; border-radius: 50%; }
.tf-assignee input { position: absolute; opacity: 0; width: 0; height: 0; }
.tf-assignee .tf-avatar {
    width: 32px; height: 32px; font-size: 12px; border: 2px solid transparent; box-sizing: border-box;
}
.tf-assignee.is-selected .tf-avatar { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(26,187,154,.25); }

.tf-richtoolbar { display: flex; gap: 2px; margin-bottom: 4px; }
.tf-richtoolbar button {
    width: 28px; height: 28px; border: 1px solid var(--border); background: var(--surface-2);
    color: var(--text); border-radius: var(--radius-sm); cursor: pointer; font-size: 12px;
}
.tf-richtoolbar button:hover { border-color: var(--primary); color: var(--primary); }
.tf-richtext {
    min-height: 90px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font-size: 13px; line-height: 1.5;
}
.tf-richtext:focus { outline: none; border-color: var(--primary); }
.tf-richtext ul, .tf-richtext ol { margin: 4px 0 4px 20px; padding: 0; }
.tf-richtext a { color: var(--primary); }

.tf-anexos { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tf-anexos li {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px;
}
.tf-anexos li a { color: var(--text); text-decoration: none; flex: 1; }
.tf-anexos li a:hover { color: var(--primary); }
.tf-upload { display: flex; gap: 8px; align-items: center; }
.tf-upload input[type="file"] { flex: 1; font-size: 12px; color: var(--muted); }

/* ============================================================
   Editor de tarefa — cabeçalho de status, grade principal/detalhes,
   progresso de subtarefas, botão de avançar esteira e abas
   Subtarefas/Comentários/Atividade.
   ============================================================ */
.badge--muted { background: var(--surface-2); color: var(--muted); }

.tf-editor__topline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -6px 0 16px; }
.tf-editor__meta { font-size: 12px; color: var(--muted); }

.tf-editor { display: grid; grid-template-columns: 1fr 260px; gap: 24px; align-items: start; }
.tf-editor__side {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; display: flex; flex-direction: column; gap: 4px;
}
.tf-editor__side-title { margin: 0 0 4px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); }
.tf-editor__side .form__grid { grid-template-columns: 1fr; gap: 0; }
.tf-editor__side .form__row { margin-bottom: 12px; }

.tf-sideprogress { margin: 4px 0 12px; }
.tf-sideprogress__head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; margin-bottom: 6px; }
.tf-sideprogress__head span { color: var(--muted); }
.tf-progressbar { height: 6px; border-radius: 4px; background: var(--surface); overflow: hidden; }
.tf-progressbar span { display: block; height: 100%; background: var(--primary); border-radius: 4px; transition: width .2s ease; }

.tf-advance-btn { width: 100%; justify-content: center; margin-top: 4px; }
.tf-advance-hint { display: block; text-align: center; margin-top: 6px; }
.tf-advance-done { display: block; text-align: center; margin-top: 4px; }

@media (max-width: 720px) {
    .tf-editor { grid-template-columns: 1fr; }
}

.tf-tabs { margin-top: 22px; }
.tf-tabs__nav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tf-tabs__btn {
    background: none; border: none; cursor: pointer; padding: 9px 14px; margin-bottom: -1px;
    font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent;
}
.tf-tabs__btn:hover { color: var(--text); }
.tf-tabs__btn.is-active { color: var(--primary); border-bottom-color: var(--primary); }

.tf-checklist { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tf-checklist__item {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 7px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.tf-checklist__toggle { flex: 1; min-width: 0; }
.tf-checklist__toggle label { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; }
.tf-checklist__toggle input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); flex-shrink: 0; }
.tf-checklist__item.is-done .tf-checklist__toggle span { color: var(--muted); text-decoration: line-through; }
.tf-checklist__remove {
    background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px;
}
.tf-checklist__remove:hover { color: var(--danger); }
.tf-checklist__add { display: flex; gap: 8px; }
.tf-checklist__add input[type="text"] { flex: 1; }

.tf-comments { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.tf-comment { display: flex; gap: 10px; align-items: flex-start; }
.tf-comment .tf-avatar { width: 28px; height: 28px; font-size: 10px; }
.tf-comment__body { flex: 1; min-width: 0; }
.tf-comment__head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.tf-comment__head strong { font-size: 13px; }
.tf-comment__head span { font-size: 11px; }
.tf-comment__body p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text); }
.tf-comment-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.tf-comment-form textarea { width: 100%; resize: vertical; }

.tf-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.tf-activity__item { display: flex; gap: 10px; align-items: flex-start; }
.tf-activity__dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0;
}
.tf-activity__item p { margin: 0 0 2px; font-size: 13px; color: var(--text); }
.tf-activity__item span { font-size: 11px; }

.tf-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.tf-modal__box {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
}

.tf-cal {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
}
.tf-cal__dow {
    font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted);
    text-align: center; padding-bottom: 6px;
}
.tf-cal__cell {
    min-height: 90px; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 6px; display: flex; flex-direction: column; gap: 4px;
}
.tf-cal__cell--empty { background: transparent; border: none; }
.tf-cal__num { font-size: 11px; color: var(--muted); }
.tf-cal__tarefa {
    display: block; font-size: 11px; padding: 2px 6px; border-radius: var(--radius-sm);
    background: var(--surface); border-left: 3px solid var(--muted); color: var(--text);
    text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tf-cal__tarefa--baixa   { border-left-color: var(--info); }
.tf-cal__tarefa--media   { border-left-color: var(--muted); }
.tf-cal__tarefa--alta    { border-left-color: var(--warning); }
.tf-cal__tarefa--urgente { border-left-color: var(--danger); }

[data-theme="light"] .perm-group { background: var(--surface-2); }

.perm-group__legend {
    padding: 0 6px; margin-left: -6px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .6px;
    color: var(--muted);
}

.perm-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 9px 0;
    border-bottom: 1px solid var(--border);
}
.perm-row:last-child { border-bottom: none; }

.perm-row__name {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 13px; color: var(--text);
}

/* Selo do nível herdado do perfil (atualizado por JS ao trocar o perfil). */
.perm-row__inherit {
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .4px;
    padding: 2px 8px; border-radius: 10px;
    background: rgba(52,152,219,.15); color: #3498db;
    white-space: nowrap;
}
.perm-row__inherit--none { background: rgba(138,149,178,.15); color: var(--muted); }
.perm-row__inherit[hidden] { display: none; }

/* ── Segmented control ── */
.perm-seg {
    display: inline-flex; flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,.18);
    padding: 2px; gap: 2px;
}
[data-theme="light"] .perm-seg { background: var(--bg-body); }

.perm-seg__opt { position: relative; display: block; margin: 0; }
.perm-seg__opt input {
    position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
/* Neutraliza o .form label (uppercase/12px) herdado do formulário. */
.perm-seg__opt span {
    display: block; cursor: pointer; user-select: none;
    padding: 5px 12px; border-radius: calc(var(--radius-sm) - 2px);
    font-size: 12px; font-weight: 600; letter-spacing: 0;
    text-transform: none; color: var(--muted);
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.perm-seg__opt span:hover { color: var(--text); background: rgba(255,255,255,.05); }
[data-theme="light"] .perm-seg__opt span:hover { background: rgba(0,0,0,.05); }

.perm-seg__opt input:focus-visible + span {
    box-shadow: 0 0 0 2px rgba(26,187,156,.5);
}

.perm-seg__opt input:checked + span { color: #fff; }
.perm-seg__opt--herdar   input:checked + span { background: var(--border); color: var(--text); }
.perm-seg__opt--ver      input:checked + span { background: #3498db; }
.perm-seg__opt--gerenciar input:checked + span { background: var(--primary); }
.perm-seg__opt--bloquear input:checked + span { background: #e74c3c; }

@media (max-width: 720px) {
    .perm-row { flex-direction: column; align-items: flex-start; gap: 8px; }
    .perm-seg { width: 100%; }
    .perm-seg__opt { flex: 1; }
    .perm-seg__opt span { text-align: center; padding: 6px 4px; }
}

/* Rótulo de checkbox em texto normal. Precisa de `.form label.perm-check`
   para vencer a especificidade de `.form label` (uppercase). */
.form label.perm-check,
.perm-check {
    display: flex; align-items: center; gap: 9px;
    cursor: pointer; font-size: 13px; font-weight: 500;
    text-transform: none; letter-spacing: 0; color: var(--text);
}
.perm-check input { width: 15px; height: 15px; accent-color: var(--primary); }
.perm-check strong { font-weight: 700; }
.perm-check__hint { color: var(--muted); font-weight: 400; }

/* ════════════════════════════════════════
   OVERLAYS DE CADASTRO — tipos 2 (modal) e 3 (drawer)
   Ver docs/nucleo/ui-telas-cadastro.md
   ════════════════════════════════════════ */
body.overlay-open { overflow: hidden; }

.overlay { position: fixed; inset: 0; z-index: 900; }
.overlay__backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.55);
    opacity: 0; transition: opacity .2s ease;
}
.overlay.is-open .overlay__backdrop { opacity: 1; }

.overlay__panel {
    position: absolute;
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 18px 50px rgba(0,0,0,.45);
    transition: transform .22s ease, opacity .22s ease;
}
.overlay__head {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 18px 22px; border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}
.overlay__title { margin: 0; font-size: 17px; font-weight: 700; }
.overlay__close {
    background: none; border: 0; cursor: pointer;
    color: var(--muted); font-size: 26px; line-height: 1;
    padding: 0 4px; transition: color .15s;
}
.overlay__close:hover { color: var(--text); }
.overlay__body {
    flex: 1 1 auto; overflow-y: auto; padding: 22px;

    /* Mesma barra de rolagem discreta da sidebar: reservada sempre (sem reflow),
       transparente até o ponteiro entrar no painel. */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}
.overlay__body::-webkit-scrollbar { width: 8px; }
.overlay__body::-webkit-scrollbar-track { background: transparent; }
.overlay__body::-webkit-scrollbar-button { display: none; height: 0; }
.overlay__body::-webkit-scrollbar-thumb {
    background-color: transparent;
    border: 2px solid transparent;
    background-clip: content-box;
    border-radius: 4px;
}
.overlay__panel:hover .overlay__body { scrollbar-color: rgba(255,255,255,.22) transparent; }
.overlay__panel:hover .overlay__body::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.22); }
.overlay__panel:hover .overlay__body::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,.4); }
[data-theme="light"] .overlay__panel:hover .overlay__body { scrollbar-color: rgba(0,0,0,.22) transparent; }
[data-theme="light"] .overlay__panel:hover .overlay__body::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,.22); }
[data-theme="light"] .overlay__panel:hover .overlay__body::-webkit-scrollbar-thumb:hover { background-color: rgba(0,0,0,.4); }
.overlay__loading { color: var(--muted); font-size: 13px; text-align: center; padding: 40px 0; }
/* O formulário embutido não repete painel nem breadcrumb. */
.overlay__body .panel { background: none; border: 0; padding: 0; }

/* Tipo 3 — drawer lateral (direita → esquerda). */
.overlay--drawer .overlay__panel {
    top: 0; right: 0; bottom: 0;
    width: min(880px, 92vw);
    border-width: 0 0 0 1px; border-radius: 0;
    transform: translateX(100%);
}
.overlay--drawer.is-open .overlay__panel { transform: translateX(0); }

/* Tipo 2 — modal cheio centralizado. */
.overlay--modal .overlay__panel {
    top: 50%; left: 50%;
    width: min(900px, 92vw); max-height: 90vh;
    border-radius: var(--radius);
    transform: translate(-50%, -46%); opacity: 0;
}
.overlay--modal.is-open .overlay__panel { transform: translate(-50%, -50%); opacity: 1; }

/* Barra de ações fixa no rodapé do overlay. */
.overlay__body .form__actions {
    position: sticky; bottom: -22px;
    margin: 22px -22px -22px; padding: 16px 22px;
    background: var(--surface); border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
    .overlay--drawer .overlay__panel { width: 100vw; }
    .overlay--modal .overlay__panel { width: 94vw; max-height: 94vh; }
}
@media (prefers-reduced-motion: reduce) {
    .overlay__panel, .overlay__backdrop { transition: none; }
}

/* ════════════════════════════════════════
   CADASTROS DO SERVICE DESK
   Abas, árvore de unidades, grades de configuração (SLA, metas).
   Ver docs/modulos/cadastros.md
   ════════════════════════════════════════ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 0 18px; flex-wrap: wrap; }
.tab {
    padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
    transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab--active { color: var(--primary); border-bottom-color: var(--primary); }

.alert--warning { background: rgba(240,173,78,.12); border-color: #f0ad4e; color: #f3c985; }
[data-theme="light"] .alert--warning { color: #8a5a00; }

.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 720px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 6px; } }

.acoes { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.acoes form { display: inline; margin: 0; }

.tree-name { display: inline-flex; align-items: center; gap: 6px; }
.tree-name__marker { color: var(--muted); font-family: monospace; }
.tree-tipo { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }

.cfg-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cfg-table th, .cfg-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.cfg-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.cfg-table input[type=number] { width: 84px; }
.cfg-table input[type=text] { width: 100%; min-width: 140px; }
.cfg-table select { min-width: 120px; }
.cfg-table .cfg-sub { color: var(--muted); font-size: 11px; display: block; }
.cfg-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 14px;
    background: var(--surface-2); border: 1px solid var(--border); font-size: 12px;
}

.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 16px; }
.check-list label { display: flex; align-items: center; gap: 8px; font-size: 13px; text-transform: none; letter-spacing: normal; font-weight: 400; color: var(--text); }
.check-list--tree label { grid-column: 1 / -1; }

.faixas-dia { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; align-items: center; }
.faixas-dia input[type=text] { max-width: 340px; }
.check-list label[hidden] { display: none; }
/* Cabeçalho de painel com título à esquerda e contagem/ação à direita
   (usado pelas listas de cadastro e pelas telas de Perfis e Usuários). */
.panel__header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel__header h2 { margin: 0; font-size: 16px; }
.panel__count { color: var(--muted); font-size: 12px; }
.cfg-table input.cfg-max { width: 110px; }

/* ════════════════════════════════════════
   ATIVOS DO SERVICE DESK
   Inventário, validação, importação. Ver docs/modulos/ativos.md
   ════════════════════════════════════════ */
/* Linha de apoio sob um valor (a mesma que as listas dos cadastros já usavam). */
.cfg-sub { color: var(--muted); font-size: 11px; display: block; }
.panel--flush .panel__body { padding: 0; }
a.stat-card { display: block; }
a.stat-card:hover { border-color: var(--primary); }
.chip.badge--danger, .chip.badge--warning, .chip.badge--info, .chip.badge--success { border-color: transparent; text-decoration: none; }
#form-lote .marca, #form-etiquetas .marca { cursor: pointer; }

/* ════════════════════════════════════════
   CHAMADOS DO SERVICE DESK
   Fila, detalhe, linha do tempo, relógios de SLA. Ver docs/modulos/service-desk.md
   ════════════════════════════════════════ */
.badge--muted { background: rgba(138,149,178,.18); color: var(--muted); }
.badge--primary { background: rgba(26,187,156,.16); color: var(--primary); }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; text-transform: none; letter-spacing: normal; cursor: pointer; }
.link-btn { background: none; border: 0; padding: 0 4px; cursor: pointer; color: var(--primary); font: inherit; font-size: 12px; text-decoration: underline; }
.link-btn.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.form__secao { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.kv--compact { grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 12.5px; }

/* Colunas do detalhe */
.chamado-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.chamado-grid__main, .chamado-grid__side { min-width: 0; }
@media (max-width: 1100px) { .chamado-grid { grid-template-columns: 1fr; } }
.subpanel { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; }

/* Fila */
.table--chamados td { vertical-align: top; }
.sla { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: rgba(38,166,91,.15); color: #26a65b; white-space: nowrap; }
.sla--risco { background: rgba(240,173,78,.18); color: #d68910; }
.sla--violado { background: rgba(231,76,60,.16); color: #e74c3c; }
.sla--pausado { background: rgba(138,149,178,.18); color: var(--muted); }
.sla--aceite { background: rgba(52,152,219,.15); color: #3498db; }

/* Relógios de SLA no detalhe */
.relogio { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.relogio:last-of-type { border-bottom: 0; }
.barra { height: 5px; background: var(--surface-2); border-radius: 3px; margin-top: 5px; overflow: hidden; }
.barra > span { display: block; height: 100%; background: #26a65b; }
.relogio--risco .barra > span { background: #d68910; }
.relogio--violado .barra > span { background: #e74c3c; }
.relogio--pausado .barra > span { background: var(--muted); }

/* Linha do tempo */
.timeline { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.timeline__item { border-left: 3px solid var(--border); padding: 4px 0 4px 12px; }
.timeline__item--comentario_publico, .timeline__item--comentario_cliente, .timeline__item--resolucao, .timeline__item--aceite { border-left-color: var(--primary); }
.timeline__item--interno { border-left-color: #d68910; background: rgba(240,173,78,.06); }
.timeline__item--reabertura, .timeline__item--grave, .timeline__item--grave_atualizacao, .timeline__item--cancelamento { border-left-color: #e74c3c; }
.timeline__meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; font-size: 12.5px; }
.timeline__texto { font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }

/* Tarefas e buscas do formulário de abertura */
.lista-tarefas { list-style: none; margin: 0; padding: 0; }
.lista-tarefas li { display: flex; gap: 8px; align-items: center; padding: 4px 0; font-size: 13px; }
.lista-tarefas li.feita span:first-of-type { text-decoration: line-through; color: var(--muted); }
.lista-busca { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.lista-busca__item { text-align: left; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer; color: inherit; font: inherit; }
.lista-busca__item:hover { border-color: var(--primary); }
