/* =====================================================================
   Vamos de Bahêa — Painel da agência
   Identidade: azul-marinho e branco da logo, tipografia Plus Jakarta Sans.
   ===================================================================== */

@font-face { font-family: 'Jakarta'; font-style: normal; font-display: swap; font-weight: 200 800;
    src: url('../assets/fonts/jakarta-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Jakarta'; font-style: normal; font-display: swap; font-weight: 200 800;
    src: url('../assets/fonts/jakarta-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
    /* Marca — o azul-marinho da logo e seus tons */
    --navy: #00113d;          /* cor oficial da logo */
    --navy-2: #0a2263;
    --navy-3: #173a8c;
    --brand-50: #eef2fa; --brand-100: #dfe6f5; --brand-200: #bfcceb; --brand-300: #8fa3d6;
    --brand-400: #5572b8; --brand-500: #1f3f94; --brand-600: #13307a; --brand-700: #0a2263;

    /* Neutros levemente azulados */
    --n-0: #ffffff; --n-25: #fafbfd; --n-50: #f3f5f9; --n-100: #e9edf4; --n-150: #dde2ec;
    --n-200: #c9d0de; --n-300: #a7b0c4; --n-400: #7d879f; --n-500: #5a637b; --n-600: #414960;
    --n-700: #2c3246; --n-800: #1a1f30; --n-900: #0c1122;

    /* Feedback */
    --success-50: #e8f6ef; --success-500: #12945a; --success-600: #0c7446;
    --warning-50: #fff5e0; --warning-500: #e59a0b; --warning-600: #c47d05;
    --danger-50: #fdeef1; --danger-500: #e23a57; --danger-600: #c81f3e;

    /* Semânticos */
    --bg: var(--n-50);
    --surface: var(--n-0);
    --surface-2: var(--brand-50);
    --text: var(--n-900);
    --text-muted: var(--n-500);
    --text-subtle: var(--n-400);
    --border: var(--n-150);
    --border-strong: var(--n-200);
    --primary: var(--navy);
    --primary-hover: var(--navy-2);
    --primary-ink: var(--brand-500);
    --sidebar: var(--navy);

    --r-xs: 6px; --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 16px; --r-full: 999px;

    --shadow-sm: 0 1px 2px rgba(0, 17, 61, .06);
    --shadow-md: 0 2px 4px rgba(0, 17, 61, .05), 0 10px 24px rgba(0, 17, 61, .08);
    --shadow-lg: 0 20px 50px rgba(0, 17, 61, .18);

    --ease: cubic-bezier(.2, .8, .2, 1);
    --dur: 180ms;

    --font: 'Jakarta', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --sidebar-w: 248px;
    --topbar-h: 68px;
    color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    min-height: 100dvh;
}
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
img, video, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
fieldset { border: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
::selection { background: var(--brand-100); }
.num { font-variant-numeric: tabular-nums; }

.icon {
    width: 18px; height: 18px; flex-shrink: 0;
    fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.spin { animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Rótulo pequeno acima dos títulos */
.eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-400); }

/* Selo no formato do "DE" da logo */
.selo {
    display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px;
    background: #fff; color: var(--navy); font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }

.sidebar {
    position: sticky; top: 0; height: 100dvh;
    display: flex; flex-direction: column;
    background: var(--sidebar); color: #fff;
    z-index: 40;
}
.sidebar-marca { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px 22px 22px; }
.sidebar-marca img { height: 46px; width: auto; }


.nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 4px 12px; overflow-y: auto; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .4); padding: 18px 12px 6px; }
.nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--r-md);
    font-size: 14.5px; font-weight: 600; color: rgba(255, 255, 255, .72);
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a[aria-current="page"] { background: #fff; color: var(--navy); }
.nav a[aria-current="page"] .icon { color: var(--brand-500); }
.nav .contador {
    margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full);
    display: grid; place-items: center; font-size: 11px; font-weight: 800;
    background: var(--danger-500); color: #fff;
}

.sidebar-footer { border-top: 1px solid rgba(255, 255, 255, .1); padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-md); transition: background-color var(--dur); }
.sidebar-user:hover { background: rgba(255, 255, 255, .08); }
.sidebar-user .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.sidebar-user-info { min-width: 0; line-height: 1.3; }
.sidebar-user-info strong { display: block; font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info span { font-size: 12px; color: rgba(255, 255, 255, .55); }
.btn-sair { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); width: 100%; font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, .65); transition: background-color var(--dur), color var(--dur); }
.btn-sair:hover { background: rgba(226, 58, 87, .18); color: #ffc2cd; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 14px;
    padding: 0 32px;
    background: rgba(243, 245, 249, .9);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar-titulo { font-size: 20px; font-weight: 800; color: var(--navy); letter-spacing: -.02em; }
.topbar-acoes { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.btn-icone.btn-menu { display: none; }

.conteudo { padding: 28px 32px 56px; width: 100%; max-width: 1320px; }

/* ---------- Avatares ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--n-100); flex-shrink: 0; }
.avatar-lg { width: 64px; height: 64px; }
.avatar-xl { width: 96px; height: 96px; }

/* ---------- Botões ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 18px; border-radius: var(--r-md); border: 1px solid transparent;
    font-weight: 700; font-size: 14px; white-space: nowrap; user-select: none;
    transition: background-color var(--dur) var(--ease), border-color var(--dur), color var(--dur), box-shadow var(--dur), transform .1s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primario { background: var(--navy); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primario:hover:not(:disabled) { background: var(--navy-3); }
.btn-secundario { background: var(--surface); color: var(--navy); border-color: var(--border-strong); }
.btn-secundario:hover:not(:disabled) { border-color: var(--navy); }
.btn-fantasma { background: transparent; color: var(--text-muted); border-color: var(--border-strong); }
.btn-fantasma:hover:not(:disabled) { color: var(--navy); border-color: var(--navy); }
.btn-branco { background: #fff; color: var(--navy); }
.btn-branco:hover:not(:disabled) { background: var(--brand-50); }
.btn-contorno-claro { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn-contorno-claro:hover:not(:disabled) { border-color: #fff; background: rgba(255, 255, 255, .08); }
.btn-perigo { background: var(--danger-600); color: #fff; }
.btn-perigo:hover:not(:disabled) { background: #a8162f; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-bloco { width: 100%; height: 48px; font-size: 15px; }

.btn-icone {
    width: 40px; height: 40px; border-radius: var(--r-md);
    display: inline-grid; place-items: center; color: var(--n-600);
    border: 1px solid var(--border); background: var(--surface);
    transition: border-color var(--dur), color var(--dur), background-color var(--dur);
    position: relative;
}
.btn-icone:hover { border-color: var(--navy); color: var(--navy); }
.btn-icone.sm { width: 32px; height: 32px; border-radius: var(--r-sm); }
.btn-icone.nu { border-color: transparent; background: transparent; color: var(--text-subtle); }
.btn-icone.nu:hover { background: var(--n-100); color: var(--navy); }
.btn-icone.perigo:hover { border-color: var(--danger-500); color: var(--danger-600); background: var(--danger-50); }
.btn-icone[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }

.badge-ponto {
    position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: var(--r-full); background: var(--danger-500); color: #fff; border: 2px solid var(--bg);
    font-size: 10px; font-weight: 800; display: grid; place-items: center; line-height: 1;
}

/* ---------- Cabeçalho de página ---------- */
.cabecalho { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.cabecalho h2 { font-size: clamp(24px, 2.6vw, 30px); color: var(--navy); margin-top: 4px; }
.cabecalho p { color: var(--text-muted); margin-top: 4px; max-width: 62ch; }

/* ---------- Cartões ---------- */
.cartao { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-sm); }
.bloco { padding: 22px 24px; }
.bloco-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.bloco-topo h3 { font-size: 16px; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; color: var(--navy); }
.link { color: var(--brand-500); font-weight: 700; font-size: 13.5px; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Formulários ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo + .campo, .campo + .linha, .linha + .campo, .linha + .linha { margin-top: 16px; }
.linha { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.linha > .campo { margin-top: 0; }
.rotulo { font-size: 13px; font-weight: 700; color: var(--n-700); }
.dica { font-size: 12.5px; color: var(--text-subtle); }
.input, .select, .textarea {
    width: 100%; height: 44px; padding: 0 14px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
    font-size: 15px; color: var(--text);
    transition: border-color var(--dur), box-shadow var(--dur);
}
.input::placeholder, .textarea::placeholder { color: var(--n-300); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--n-300); }
.textarea { height: auto; min-height: 140px; padding: 12px 14px; resize: vertical; line-height: 1.6; }
.select {
    appearance: none; padding-right: 38px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237d879f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(31, 63, 148, .15); }
.input:disabled { background: var(--n-50); color: var(--text-subtle); }
.input-icone { position: relative; }
.input-icone > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-subtle); pointer-events: none; }
.input-icone .input { padding-left: 42px; }
.input-icone .btn-olho { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.input-icone:has(.btn-olho) .input { padding-right: 46px; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); cursor: pointer; }
.checks-grade { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--n-25); }

.busca { position: relative; min-width: 260px; }
.busca .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-subtle); }
.busca .input { padding-left: 40px; height: 42px; }
.barra-filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.barra-filtros .select { height: 42px; min-width: 200px; }

/* Filtros */
.segmentado { display: inline-flex; padding: 4px; gap: 2px; background: var(--n-100); border-radius: var(--r-md); }
.segmentado button {
    display: inline-flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 14px; border-radius: var(--r-sm);
    font-size: 13.5px; font-weight: 700; color: var(--text-muted);
    transition: background-color var(--dur), color var(--dur), box-shadow var(--dur);
}
.segmentado button:hover { color: var(--navy); }
.segmentado button[aria-pressed="true"] { background: var(--surface); color: var(--navy); box-shadow: var(--shadow-sm); }
.segmentado .qtd { font-size: 12px; font-weight: 700; color: var(--text-subtle); }
.segmentado .qtd:empty { display: none; }

/* ---------- Etiquetas ---------- */
.tag {
    display: inline-flex; align-items: center; gap: 5px;
    height: 24px; padding: 0 9px; border-radius: var(--r-xs);
    font-size: 12px; font-weight: 700; white-space: nowrap; letter-spacing: 0;
    background: var(--brand-50); color: var(--brand-500);
}
.tag-escura { background: var(--navy); color: #fff; }
.tag-perigo { background: var(--danger-50); color: var(--danger-600); }
.tag-neutra { background: var(--n-100); color: var(--n-600); }

/* ---------- Estados vazios ---------- */
.vazio { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 48px 20px; color: var(--text-muted); }
.vazio .icon { width: 28px; height: 28px; color: var(--n-300); margin-bottom: 4px; }
.vazio strong { color: var(--navy); font-weight: 700; font-size: 15px; }
.vazio-mini { padding: 28px 10px; font-size: 14px; }
.vazio-mini .icon { width: 22px; height: 22px; }

/* ---------- Modais ---------- */
dialog.modal {
    width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
    margin: auto; padding: 0; border: 0; border-radius: var(--r-xl);
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
    overflow: hidden;
}
dialog.modal[open] { display: flex; flex-direction: column; animation: modalEntra .22s var(--ease); }
dialog.modal::backdrop { background: rgba(0, 17, 61, .45); animation: fundoEntra .2s ease-out; }
dialog.modal.largo { width: min(760px, calc(100vw - 32px)); }
dialog.modal.estreito { width: min(440px, calc(100vw - 32px)); }
@keyframes modalEntra { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes fundoEntra { from { opacity: 0; } }
.modal-topo { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-topo h3 { font-size: 18px; color: var(--navy); }
.modal-topo .btn-icone { margin-left: auto; }
.modal-corpo { padding: 20px 22px; overflow-y: auto; }
.modal-rodape { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--n-25); }
.modal form { display: contents; }

.confirmar-icone { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--danger-50); color: var(--danger-600); margin-bottom: 14px; }
.confirmar-icone.neutro { background: var(--brand-50); color: var(--brand-500); }
.confirmar-icone .icon { width: 22px; height: 22px; }
.confirmar-texto { padding-top: 24px; }
.confirmar-texto h3 { font-size: 19px; color: var(--navy); margin-bottom: 6px; }
.confirmar-texto p { color: var(--text-muted); }

/* ---------- Toasts (camada do topo: ficam acima de modais) ---------- */
.toasts {
    position: fixed; inset: auto 20px 20px auto; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toasts:popover-open { display: flex; }
.toast {
    display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 400px;
    padding: 12px 16px; border-radius: var(--r-lg);
    background: var(--navy); color: #fff;
    box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 600; pointer-events: auto;
    animation: toastEntra .28s var(--ease);
}
.toast-icone { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .15); color: #fff; flex-shrink: 0; }
.toast-icone .icon { width: 14px; height: 14px; stroke-width: 2.6; }
.toast.ok .toast-icone { background: var(--success-500); }
.toast.erro .toast-icone { background: var(--danger-500); }
.toast.sai { animation: toastSai .2s ease-in forwards; }
@keyframes toastEntra { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastSai { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Notificações ---------- */
.notif { position: relative; }
.notif-painel {
    position: absolute; right: 0; top: calc(100% + 10px); width: 360px; max-width: calc(100vw - 24px);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
    overflow: hidden; transform-origin: top right; animation: popEntra .16s var(--ease);
}
@keyframes popEntra { from { opacity: 0; transform: scale(.97) translateY(-4px); } }
.notif-topo { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif-topo strong { font-size: 15px; font-weight: 800; color: var(--navy); }
.notif-lista { max-height: 380px; overflow-y: auto; }
/* Celular: o painel ocupa a largura da tela (com margem) e cabe na altura, em vez de sair pela lateral. */
@media (max-width: 600px) {
    .notif-painel { position: fixed; left: 12px; right: 12px; top: calc(var(--topbar-h, 64px) + 8px); width: auto; max-width: none; }
    .notif-lista { max-height: calc(100dvh - var(--topbar-h, 64px) - 140px); }
}
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); transition: background-color var(--dur); }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--n-25); }
.notif-item .bolinha { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-500); flex-shrink: 0; }
.notif-item.importante .bolinha { background: var(--danger-50); color: var(--danger-600); }
.notif-item strong { display: block; font-size: 14px; font-weight: 700; line-height: 1.35; }
.notif-item.nao-lido strong::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--danger-500); vertical-align: middle; }
.notif-item span { font-size: 12px; color: var(--text-subtle); }

.usuario-topo { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 12px; border-radius: var(--r-full); transition: background-color var(--dur); }
.usuario-topo:hover { background: var(--n-100); }
.usuario-topo-info { line-height: 1.25; text-align: right; }
.usuario-topo-info strong { display: block; font-size: 13.5px; font-weight: 700; color: var(--navy); }
.usuario-topo-info span { font-size: 11.5px; color: var(--text-subtle); }


/* ---------- Cores dos cargos (etiquetas, capas e amostras) ---------- */
.tag-cor-marinho  { background: #e3e8f4; color: #00113d; }
.tag-cor-azul     { background: #e4ecfd; color: #1f3f94; }
.tag-cor-roxo     { background: #efe9fb; color: #5a38b0; }
.tag-cor-rosa     { background: #fce8f0; color: #b02a62; }
.tag-cor-vermelho { background: #fde9e9; color: #b42323; }
.tag-cor-laranja  { background: #fdefe1; color: #b55a0c; }
.tag-cor-amarelo  { background: #fcf4d6; color: #8a6800; }
.tag-cor-verde    { background: #e3f5ec; color: #11704a; }
.tag-cor-turquesa { background: #dff4f3; color: #0d6e6e; }
.tag-cor-cinza    { background: var(--n-100); color: var(--n-600); }

.capa-cor-marinho, .cor-marinho   { --cor: #00113d; }
.capa-cor-azul, .cor-azul         { --cor: #1f3f94; }
.capa-cor-roxo, .cor-roxo         { --cor: #5a38b0; }
.capa-cor-rosa, .cor-rosa         { --cor: #c2336f; }
.capa-cor-vermelho, .cor-vermelho { --cor: #c12b2b; }
.capa-cor-laranja, .cor-laranja   { --cor: #d0680f; }
.capa-cor-amarelo, .cor-amarelo   { --cor: #c89b06; }
.capa-cor-verde, .cor-verde       { --cor: #14805a; }
.capa-cor-turquesa, .cor-turquesa { --cor: #0f7f7f; }
.capa-cor-cinza, .cor-cinza       { --cor: #5a637b; }
[class*="capa-cor-"] { background-color: var(--cor, var(--navy)); }

/* ---------- Abas ---------- */
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.abas button {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: -1px;
    font-size: 14px; font-weight: 700; color: var(--text-muted); border-bottom: 2px solid transparent;
    transition: color var(--dur), border-color var(--dur);
}
.abas button:hover { color: var(--navy); }
.abas button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--navy); }

/* ---------- Responsivo ---------- */
.overlay-menu { display: none; }

@media (max-width: 1024px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; width: min(280px, 84vw);
        transform: translateX(-100%); transition: transform .3s var(--ease);
        box-shadow: var(--shadow-lg);
    }
    .app.menu-aberto .sidebar { transform: none; }
    .overlay-menu { display: block; position: fixed; inset: 0; background: rgba(0, 17, 61, .5); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .25s; }
    .app.menu-aberto .overlay-menu { opacity: 1; pointer-events: auto; }
    .btn-icone.btn-menu { display: inline-grid; }
    .topbar { padding: 0 16px; }
    .conteudo { padding: 22px 16px 40px; }
    .usuario-topo-info { display: none; }
    .usuario-topo { padding: 0; }
}
@media (max-width: 600px) {
    .linha, .checks-grade { grid-template-columns: 1fr; }
    .busca { min-width: 0; flex: 1 1 100%; }
    .barra-filtros .select { flex: 1; }
    .toasts { inset: auto 16px 16px 16px; }
    .toast { min-width: 0; max-width: none; }
    .modal-rodape { flex-direction: column-reverse; }
    .modal-rodape .btn { width: 100%; }
    .input, .select, .textarea { font-size: 16px; } /* evita zoom automático no iPhone */
}

@media (hover: none) {
    .btn-icone:hover { border-color: var(--border); color: var(--n-600); }
}

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

/* Sino: texto da notificação e rodapé */
.notif-item em { display: block; font-style: normal; font-size: 12.5px; color: var(--text-muted); line-height: 1.4; margin: 2px 0; }
.notif-item.tipo-seguranca .bolinha { background: var(--warning-50); color: var(--warning-600); }
.notif-item.tipo-aviso-importante .bolinha { background: var(--danger-50); color: var(--danger-600); }
.notif-topo .link { font-size: 12.5px; }
.notif-rodape { display: block; padding: 11px 16px; border-top: 1px solid var(--border); text-align: center; font-size: 13px; font-weight: 700; color: var(--brand-500); }
.notif-rodape:hover { background: var(--n-25); color: var(--navy); }

/* ---------- Rascunho recuperado ---------- */
.rascunho-aviso {
    display: flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 8px 8px 8px 12px;
    border-radius: var(--r-md); background: var(--brand-50); color: var(--brand-600); font-size: 13px; font-weight: 600;
}
.rascunho-aviso .btn { margin-left: auto; }

/* ---------- Barras de rolagem ---------- */
/* Finas, sem setas, no tom azulado do painel (Chrome, Edge, Firefox). */
* { scrollbar-width: thin; scrollbar-color: var(--n-200) transparent; }
*:hover { scrollbar-color: var(--n-300) transparent; }
/* Safari (Mac/iPhone) ainda usa o modelo antigo */
@supports not (scrollbar-width: thin) {
    ::-webkit-scrollbar { width: 10px; height: 10px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--n-200); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
    ::-webkit-scrollbar-thumb:hover { background-color: var(--n-300); }
    ::-webkit-scrollbar-button { display: none; }
}
.sidebar, .sidebar * { scrollbar-color: rgba(255, 255, 255, .22) transparent; }

/* ---------- Tela de bloqueio por inatividade ---------- */
dialog.tela-bloqueio {
    width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 16px;
    border: 0; background: transparent; display: none;
}
dialog.tela-bloqueio[open] { display: grid; place-items: center; animation: fundoEntra .25s ease-out; }
/* Fundo bem fechado: o conteúdo atrás não dá para ler */
dialog.tela-bloqueio::backdrop { background: rgba(0, 17, 61, .92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.bloqueio-cartao {
    width: min(380px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 32px 28px 24px; text-align: center;
    background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
}
.bloqueio-cartao .avatar { border: 3px solid var(--brand-100); }
.bloqueio-selo {
    display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--r-full);
    background: var(--brand-50); color: var(--brand-600); font-size: 12.5px; font-weight: 700;
}
.bloqueio-cartao h2 { font-size: 22px; color: var(--navy); }
.bloqueio-cartao p { font-size: 14px; color: var(--text-muted); }
.bloqueio-cartao .input { text-align: center; }
.bloqueio-erro { color: var(--danger-600) !important; font-weight: 600; font-size: 13.5px; }
.bloqueio-cartao .link { margin-top: 4px; font-size: 13px; }

/* Tela "Você foi desconectado" (usa o mesmo fundo da tela de bloqueio) */
.desconectado-icone { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--danger-50); color: var(--danger-600); }
.desconectado-icone .icon { width: 26px; height: 26px; }

/* Aviso "o painel foi atualizado" (aba aberta durante uma atualização) */
.aviso-atualizacao {
    position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60;
    display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: var(--r-lg);
    background: var(--navy); color: #fff; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
    max-width: calc(100vw - 32px);
}
.aviso-atualizacao.aviso-conexao { background: var(--danger-600); padding: 10px 16px; }

/* Arquivo do computador sendo arrastado por cima de "Arquivos"/"Mídia" no menu */
.nav a.recebe-arrasto { background: var(--brand-500); color: #fff; box-shadow: inset 0 0 0 2px #fff; }
.nav a.recebe-arrasto .icon { color: #fff; }

/* Emojis desenhados do painel (iguais em qualquer aparelho) */
img.emoji { display: inline-block; width: 1.25em; height: 1.25em; max-width: none; vertical-align: -0.25em; object-fit: contain; }
span.emoji-texto { display: inline-block; line-height: 1; }

/* Enviar na Geralzona (a partir de Arquivos/Mídia) */
.gz-previa { position: relative; width: 100%; max-height: 260px; border-radius: 12px; overflow: hidden; background: var(--n-100); display: grid; place-items: center; }
.gz-previa img { max-width: 100%; max-height: 260px; object-fit: contain; }
.gz-previa .item-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.gz-nome { margin: 8px 0 12px; font-size: 13px; color: var(--text-muted); word-break: break-word; }
.gz-aviso { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--warning-50); color: var(--warning-600); font-size: 13px; }
.gz-aviso .icon { flex-shrink: 0; margin-top: 1px; }

/* ---------- Ícone próprio de cada tipo de arquivo (folha com a sigla) e miniaturas ---------- */
.icone-formato { position: relative; display: inline-grid; place-items: center; width: 56px; height: 64px; color: var(--cor-formato, var(--n-500)); }
.icone-formato .icon { width: 100%; height: 100%; stroke-width: 1.2; fill: var(--n-0); }
.icone-formato b {
    position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%);
    padding: 1px 5px; border-radius: 4px; background: var(--cor-formato, var(--n-500)); color: #fff;
    font-size: 11px; font-weight: 800; letter-spacing: .02em; line-height: 1.3;
}
.icone-formato.pequeno { width: 22px; height: 26px; }
.icone-formato.pequeno b { font-size: 6.5px; padding: 0 2px; border-radius: 2px; }
.icone-formato.cor-azul { --cor-formato: #1f5fbf; }
.icone-formato.cor-azul-escuro { --cor-formato: #1f3f94; }
.icone-formato.cor-laranja { --cor-formato: #c4610f; }
.icone-formato.cor-vermelho { --cor-formato: #c62f3f; }
.icone-formato.cor-verde { --cor-formato: #13804f; }
.icone-formato.cor-cinza { --cor-formato: #5a637b; }
.mini-icone { display: grid; place-items: center; color: var(--n-400); }
.mini-icone .icon { width: 30px; height: 30px; stroke-width: 1.5; }
/* A miniatura fica por cima do ícone; se não existir, ela some e o ícone aparece. */
img.mini-img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; background: var(--n-100); }
.gz-previa { min-height: 140px; }
.gz-previa img.mini-img { object-fit: contain; }
