/* ============================================================
   TIMMI — Design System v1 (Fase 3.1)
   Fonte: Montserrat | Referência: mockup dashboard/login
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
    /* Marca */
    --brand-yellow: #FFD832;
    --brand-dark: #1D212D;

    /* Cores funcionais */
    --primary: #1F7BFB;
    --primary-hover: #1668DE;
    --primary-soft: #E8F1FE;
    --success: #0DAB55;
    --success-strong: #0F8B4B;
    --success-soft: #E7F7EE;
    --danger: #DE0C0F;
    --danger-hover: #B90A0D;
    --danger-soft: #FDEAEA;
    --warning: #FFD832;
    --warning-soft: #FFF6D2;

    /* Superfícies */
    --bg: #F6F6F6;
    --surface: #FFFFFF;
    --border: #E6E7E8;

    /* Texto */
    --ink: #1D212D;
    --muted: #7A8090;
    --muted-2: #A9AEBA;

    /* Forma */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    /* Sombras (dropshadow padrão dos cards) */
    --shadow-card: 0 4px 0px rgba(29, 33, 45, .06);
    --shadow-pop: 0 18px 44px rgba(29, 33, 45, .16);

    /* Layout */
    --sidebar-w: 256px;
    --font: 'Montserrat', system-ui, Arial, sans-serif;
}

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    overflow-x: hidden;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; font-weight: 700; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 12px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); }
.text-strong { font-weight: 700; }
:focus-visible { outline: 3px solid rgba(31, 123, 251, .45); outline-offset: 2px; border-radius: 4px; }

/* ---------- 3. Shell (sidebar + conteúdo) ---------- */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    gap: 22px;
    padding: 16px 22px;
    max-width: 1760px;
    margin: 0 auto;
    transition: grid-template-columns .28s ease;
}

.sidebar {
    background: var(--brand-dark);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 22px 0 18px;
    position: sticky;
    top: 16px;
    height: calc(100vh - 32px);
    border-radius: 22px;
    box-shadow: 0 4px 0px rgba(29, 33, 45, .12);
}
.sidebar .brand { padding: 0 22px 20px; }
.sidebar .brand img { height: 40px; width: auto; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 22px;
    color: #C9CDD6;
    font-weight: 500;
    font-size: 13.5px;
    text-decoration: none;
    border: 0;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, color .15s, padding .28s ease;
}
.sidebar .nav-item svg { width: 20px; height: 20px; flex: none; }
.sidebar .nav-item:hover,
.sidebar .nav-item.active {
    background: var(--brand-yellow);
    color: var(--brand-dark);
    font-weight: 700;
    text-decoration: none;
}
/* Cabeçalhos de seção do menu (pai da categoria: clicável, com seta) */
.sidebar .nav-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 20px 22px 6px;
    color: #7B8190;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.sidebar .nav-section .ti {
    font-size: 14px;
    transition: transform .15s ease;
}
.sidebar .nav-section:hover { color: #AEB4C0; }
.sidebar .nav-section.closed .ti { transform: rotate(-90deg); }
.sidebar .nav-items { display: flex; flex-direction: column; gap: 2px; }
.sidebar .nav-section.closed + .nav-items { display: none; }
.sidebar .nav-footer { margin-top: auto; padding-top: 16px; padding-bottom: 6px; display: flex; flex-direction: column; gap: 2px; }

.main-content { min-width: 0; padding: 4px 2px 24px; }

/* ---------- 4. Topbar ---------- */
.topbar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
}
.topbar .user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary);
    display: grid; place-items: center;
    font-weight: 700; font-size: 14px; flex: none;
}
.topbar .user-name { font-weight: 700; font-size: 14px; white-space: nowrap; }
.topbar .user-role { color: var(--muted); font-size: 12px; font-style: italic; }
.topbar .divider { width: 1px; align-self: stretch; background: #E1E1E1; }
.topbar .date-chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 14px;
    font-weight: 600; font-size: 13px; white-space: nowrap;
}
.topbar .search { margin-left: auto; position: relative; width: min(340px, 100%); }
.topbar .search input { padding-left: 40px; padding-right: 64px; background: var(--bg); }
.topbar .search svg { position: absolute; left: 13px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--muted); }
.topbar .search kbd {
    position: absolute; right: 10px; top: 50%; translate: 0 -50%;
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
    padding: 2px 8px; font-size: 11px; color: var(--muted); font-family: inherit;
}
.search-panel {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #E6E7E8);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, .14);
    z-index: 130;
    overflow: hidden;
    max-height: 420px; overflow-y: auto;
    text-align: left;
}
.search-panel-empty { padding: 14px 16px; color: var(--muted); font-size: 13px; }
.search-group { padding: 8px 0; border-bottom: 1px solid var(--border, #F0F1F2); }
.search-group:last-child { border-bottom: none; }
.search-group-label {
    display: block; padding: 2px 16px 6px;
    font-size: 11px; font-weight: 800; letter-spacing: .04em;
    text-transform: uppercase; color: var(--muted);
}
.search-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 16px; text-decoration: none; color: inherit;
    transition: background .12s ease;
}
.search-item:hover { background: var(--primary-soft, #EEF4FF); }
.search-item strong { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item small { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.icon-button {
    width: 40px; height: 40px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--surface);
    display: grid; place-items: center; cursor: pointer; color: var(--ink);
    position: relative; flex: none;
    transition: background .15s;
}
.icon-button:hover { background: var(--bg); }
.icon-button svg { width: 19px; height: 19px; }
.icon-button .dot {
    position: absolute; top: 6px; right: 7px; width: 8px; height: 8px;
    border-radius: 50%; background: #FF5A6E; border: 2px solid var(--surface);
}

/* ---------- 5. Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 20px;
}
.card-title { font-weight: 700; font-size: 15px; margin-bottom: 14px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.kpi { display: flex; align-items: center; gap: 16px; }
.kpi .kpi-icon {
    width: 56px; height: 56px; border-radius: 50%;
    display: grid; place-items: center; flex: none;
}
.kpi .kpi-icon svg { width: 26px; height: 26px; }
.kpi-icon.blue { background: var(--primary-soft); color: var(--primary); }
.kpi-icon.green { background: var(--success-soft); color: var(--success-strong); }
.kpi-icon.red { background: var(--danger-soft); color: var(--danger); }
.kpi-icon.yellow { background: var(--warning-soft); color: #B58900; }
.kpi .kpi-label { color: var(--ink); font-weight: 600; font-size: 13.5px; }
.kpi .kpi-label small { color: var(--muted); font-weight: 600; }
.kpi .kpi-value { font-size: 22px; font-weight: 800; letter-spacing: -.2px; }
.kpi .kpi-trend { font-size: 12px; font-weight: 700; margin-top: 2px; }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }
.kpi-trend span { color: var(--muted); font-weight: 500; }

/* Ação rápida */
.quick-action {
    display: flex; align-items: center; gap: 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
    padding: 14px 18px; width: 100%;
    font: inherit; font-weight: 500; color: var(--ink);
    cursor: pointer; text-decoration: none;
    transition: translate .12s, box-shadow .12s;
}
.quick-action:hover { translate: 0 -2px; box-shadow: 0 5px 1px rgba(29, 33, 45, .16); text-decoration: none; color: var(--ink); }
.quick-action .qa-icon {
    width: 40px; height: 40px; border-radius: 50%; flex: none;
    display: grid; place-items: center; color: #fff;
}
.quick-action .qa-icon svg { width: 20px; height: 20px; }
.qa-icon.blue { background: var(--primary); }
.qa-icon.yellow { background: var(--brand-yellow); color: var(--brand-dark); }
.qa-icon.green { background: var(--success); }
.quick-action strong { font-weight: 700; }

/* ---------- 6. Tabela "card por linha" ---------- */
.table-cards { display: flex; flex-direction: column; gap: 12px; }
.table-cards .t-head,
.table-cards .t-row {
    display: grid;
    grid-template-columns: var(--cols, 2fr 1fr 1.4fr 1fr .8fr);
    gap: 16px;
    align-items: center;
    padding: 0 22px;
}
/* t-head e t-row: primeira coluna alinhada a esquerda, ultima a direita, demais centralizadas */
.table-cards .t-head > *:first-child,
.table-cards .t-row > *:first-child { text-align: left; justify-self: start; }
.table-cards .t-head > *:last-child,
.table-cards .t-row > *:last-child { text-align: right; justify-self: end; }
.table-cards .t-row > *.folha-flow:last-child { text-align: left; justify-self: stretch; }
.table-cards .t-head > *:not(:first-child):not(:last-child),
.table-cards .t-row > *:not(:first-child):not(:last-child) { text-align: center; justify-self: center; }
.table-cards .t-head {
    background: var(--brand-dark); color: #fff;
    border-radius: var(--radius);
    padding-top: 13px; padding-bottom: 13px;
    font-weight: 700; font-size: 14px;
}
.table-cards .t-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding-top: 14px; padding-bottom: 14px;
    box-shadow: 0 4px 2px rgba(29, 33, 45, .06);
    transition: box-shadow .12s, translate .12s;
}
.table-cards .t-row:hover { box-shadow: 0 5px 1px rgba(29, 33, 45, .16); translate: 0 -1px; }
.t-row .cell-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.t-row .cell-main .avatar {
    width: 44px; height: 44px; border-radius: 50%; flex: none;
    background: var(--primary-soft); color: var(--primary);
    display: grid; place-items: center; font-weight: 700;
}
.t-row .cell-main .title { font-weight: 700; font-size: 14.5px; }
.t-row .cell-main .subtitle { color: var(--muted); font-size: 12.5px; font-style: italic; }
.t-row .cell-strong { font-weight: 700; }
.table-empty {
    background: var(--surface); border: 1px dashed var(--border);
    border-radius: var(--radius-lg); padding: 34px; text-align: center; color: var(--muted);
}

/* ---------- 7. Botões ---------- */
.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; cursor: pointer;
    font-family: inherit; font-size: 17px; font-weight: 500;
    border-radius: 10px;
    padding: 11px 24px;
    transition: background .15s, box-shadow .15s;
    text-decoration: none;
}
.button strong { font-weight: 700; }
.button:hover { text-decoration: none; }
.button.primary { background: var(--primary); color: #fff; box-shadow: 0 4px 2px rgba(31, 123, 251, .28); }
.button.primary:hover { background: var(--primary-hover); }
.button.secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.button.secondary:hover { background: var(--bg); }
.button.dark { background: var(--brand-dark); color: #fff; }
.button.dark:hover { background: #2A3040; }
.button.warning { background: var(--brand-yellow); color: var(--brand-dark); }
.button.warning:hover { background: #F2C914; }
.button.danger { background: var(--danger); color: #fff; }
.button.danger:hover { background: var(--danger-hover); }
.button.success { background: var(--success-strong); color: #fff; }
.button.success:hover { background: var(--success); }
.button.ghost { background: transparent; color: var(--primary); }
.button.ghost:hover { background: var(--primary-soft); }
.button.small { padding: 7px 14px; font-size: 14px; }
.button:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.button svg { width: 18px; height: 18px; }

/* ---------- 8. Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 700;
    border: 1px solid transparent;
}
.badge.success { background: var(--success-soft); color: var(--success); border-color: rgba(13,171,85,.25); }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(222,12,15,.22); }
.badge.warning { background: var(--warning-soft); color: #8A6D00; border-color: rgba(255,216,50,.6); }
.badge.info { background: var(--primary-soft); color: var(--primary); border-color: rgba(31,123,251,.25); }
.badge.neutral { background: var(--bg); color: var(--muted); border-color: var(--border); }

.badge.mini { padding: 3px 9px; font-size: 14px; border-radius: 7px; }

/* ---------- 9. Formulários ---------- */
label { display: grid; gap: 7px; font-weight: 600; font-size: 13.5px; }
input, select, textarea {
    width: 100%; font: inherit; color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 14px;
    transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31,123,251,.18);
}
input:disabled, select:disabled { background: var(--bg); color: var(--muted); }
.field-error-msg { color: var(--danger); font-size: 12.5px; font-weight: 600; }
input.field-error, select.field-error { border-color: var(--danger); }
.form-grid { display: grid; gap: 16px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }
.hint { color: var(--muted); font-size: 12.5px; font-weight: 500; }

/* ---------- 10. Alertas ---------- */
.alert { padding: 13px 16px; border-radius: var(--radius); font-weight: 600; border: 1px solid transparent; }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: rgba(222,12,15,.22); }
.alert.success { background: var(--success-soft); color: var(--success-strong); border-color: rgba(13,171,85,.25); }
.alert.info { background: var(--primary-soft); color: var(--primary-hover); border-color: rgba(31,123,251,.25); }
.alert.warning { background: var(--warning-soft); color: #8A6D00; border-color: rgba(255,216,50,.6); }

/* ---------- 11. Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(29,33,45,.5);
    display: grid; place-items: center; padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
    background: var(--surface); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-pop);
    width: min(520px, 100%);
    max-height: 90vh; overflow: auto;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; }
.modal-close { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 8px; }
.modal-close:hover { background: var(--bg); color: var(--ink); }
.modal-body { padding: 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 22px; border-top: 1px solid var(--border); }

/* ---------- 12. Notificações (lista) ---------- */
.notif { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.notif:last-child { border-bottom: 0; padding-bottom: 0; }
.notif .n-icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.notif .n-icon svg { width: 20px; height: 20px; }
.notif strong { display: block; font-size: 13.5px; }
.notif p { margin: 0; color: var(--muted); font-size: 12.5px; }
.notif time { color: var(--muted-2); font-size: 11.5px; }

/* ---------- 13. Página de autenticação ---------- */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: #fff; }
.auth-box { width: min(420px, 100%); text-align: center; }
.auth-box .auth-logo { height: 64px; width: auto; margin: 0 auto 22px; }
.auth-box .auth-title { color: var(--ink); font-size: 17px; font-weight: 500; margin-bottom: 30px; }
.auth-box form { display: grid; gap: 16px; text-align: left; }
.auth-box .button.primary { margin: 14px auto 0; min-width: 240px; }
.auth-help { margin-top: 48px; text-align: left; }
.auth-help strong { font-size: 14.5px; }
.auth-help p { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

/* ---------- 14. Utilitários ---------- */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }

/* ---------- 15. Responsivo ---------- */
@media (max-width: 1100px) {
    .grid.cols-3 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; padding: 12px 14px; }
    .sidebar { position: fixed; z-index: 40; width: var(--sidebar-w); top: 10px; left: 10px; height: calc(100vh - 20px); translate: calc(-100% - 14px) 0; transition: translate .2s; }
    .sidebar.open { translate: 0 0; box-shadow: var(--shadow-pop); }
    .menu-toggle { display: grid !important; }
    .topbar { flex-wrap: wrap; }
    .topbar .search { order: 10; width: 100%; margin-left: 0; }
    .table-cards .t-head { display: none; }
    .table-cards .t-row { grid-template-columns: 1fr; gap: 8px; }
    .grid.cols-2, .form-grid.cols-2 { grid-template-columns: 1fr; }
}
.menu-toggle { display: none; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ============================================================
   v1.1 — Sidebar com ícones PNG, modo recolhido e avatares
   ============================================================ */

/* Ícones PNG da sidebar (troca normal/active) */
.nav-ico {
    width: 20px; height: 20px; flex: none;
    background: var(--nav-ico) center / contain no-repeat;
}
.sidebar .nav-item:hover .nav-ico,
.sidebar .nav-item.active .nav-ico { background-image: var(--nav-ico-active); }

/* Marca: logo + tag em HTML */
.sidebar .brand { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; position: relative; }
.sidebar .brand .brand-tag { color: #8A8F9C; font-size: 10.5px; font-weight: 600; letter-spacing: .4px; align-self: flex-end; }
.sidebar .brand .brand-tag b { color: #C9CDD6; font-weight: 700; }
.sidebar .brand .brand-icon { display: none; height: 34px; width: auto; }

/* Toggle da sidebar */
.sidebar-toggle {
    position: absolute; top: 34px; right: -14px; z-index: 45;
    width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer;
}
.sidebar-toggle img { width: 28px; height: 28px; filter: drop-shadow(0 2px 3px rgba(29,33,45,.3)); }

.sidebar .sidebar-scroll { overflow-y: auto; display: flex; flex-direction: column; flex: 1; scrollbar-width: none; }
.sidebar .sidebar-scroll::-webkit-scrollbar { display: none; }

/* Modo recolhido */
.app-shell.nav-collapsed { grid-template-columns: 78px 1fr; }
.nav-collapsed .sidebar .nav-item span:not(.nav-ico),
.nav-collapsed .sidebar .brand .brand-full,
.nav-collapsed .sidebar .brand .brand-tag,
.nav-collapsed .sidebar .nav-section { display: none; }
.nav-collapsed .sidebar .brand .brand-icon { display: block; }
.nav-collapsed .sidebar .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
.nav-collapsed .sidebar .brand { align-items: center; }

/* Divisor entre seções no modo recolhido */
.nav-collapsed .sidebar .nav-section { display: block; padding: 14px 22px 2px; font-size: 0; }
.nav-collapsed .sidebar .nav-section > * { display: none; }
.nav-collapsed .sidebar .nav-section::after {
    content: '';
    display: block;
    width: 26px; height: 2px;
    background: rgba(201, 205, 214, .16);
    border-radius: 2px;
    margin: 0 auto;
}

/* No modo recolhido os subitens sempre mostram o ícone,
   independente do pai estar aberto ou fechado */
.nav-collapsed .sidebar .nav-section.closed + .nav-items { display: flex; }

/* Flyout da sidebar recolhida (position:fixed no body, sem corte de overflow) */
.nav-collapsed .nav-item { position: relative; }
.fly-tip {
    position: fixed; z-index: 130;
    background: var(--brand-dark); color: #fff;
    padding: 7px 12px; border-radius: 8px;
    font-size: 12.5px; font-weight: 600; white-space: nowrap;
    box-shadow: var(--shadow-pop);
    pointer-events: none;
}
.fly-menu {
    position: fixed; z-index: 130;
    min-width: 230px; max-width: 300px;
    background: var(--brand-dark); color: #fff;
    border-radius: 12px; padding: 7px;
    box-shadow: var(--shadow-pop);
}
.fly-menu .fly-menu-title {
    padding: 6px 12px 6px; font-size: 10.5px;
    text-transform: uppercase; letter-spacing: 1px;
    color: #9AA1AE; font-weight: 700;
}
.fly-menu a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: 8px;
    color: #E7E9EE; text-decoration: none;
    font-size: 13px; font-weight: 500;
}
.fly-menu a:hover,
.fly-menu a.active { background: var(--brand-yellow); color: var(--brand-dark); font-weight: 700; }
.fly-menu a .nav-ico { width: 18px; height: 18px; flex: none; }

/* Avatar com foto + status */
.avatar-wrap { position: relative; width: 44px; height: 44px; flex: none; }
.avatar-wrap img.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-wrap .status-ico { position: absolute; right: -5px; bottom: -3px; width: 19px; height: 19px; }
.avatar-wrap .online-dot {
    position: absolute; right: 0; bottom: 1px; width: 11px; height: 11px;
    border-radius: 50%; background: var(--success); border: 2px solid var(--surface);
}
.topbar .avatar-wrap { width: 42px; height: 42px; }

/* Ícones PNG utilitários */
.img-icon { width: 20px; height: 20px; object-fit: contain; display: inline-block; }
.icon-button .img-icon { width: 19px; height: 19px; }
.kpi .kpi-icon-img { width: 56px; height: 56px; flex: none; }
.qa-icon-img { width: 40px; height: 40px; flex: none; }
.notif .n-icon-img { width: 42px; height: 42px; flex: none; }
.topbar .search .img-icon { position: absolute; left: 13px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; }

/* Aniversariantes */
.bday { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.bday:last-child { border-bottom: 0; padding-bottom: 0; }
.bday .bday-date {
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    text-align: center; padding: 6px 10px; min-width: 52px;
}
.bday .bday-date strong { display: block; font-size: 16px; }
.bday .bday-date small { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .5px; }
.bday .bday-name { flex: 1; min-width: 0; }
.bday .bday-name strong { display: block; font-size: 13.5px; }
.bday .bday-name span { color: var(--muted); font-size: 12px; }
.bday img { width: 56px; height: 56px; }

/* Login — fonte maior */
.auth-box .auth-title { font-size: 19px; }
.auth-box input { font-size: 25px; padding: 13px 16px; text-align: center; letter-spacing: .5px; }
.auth-box input::placeholder { text-align: center; }

@media (max-width: 900px) {
    .sidebar-toggle { display: none; }
    .app-shell.nav-collapsed { grid-template-columns: 1fr; }
}

.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; }

/* ============================================================
   v1.2 — Padrão de página (breadcrumb, filtros, paginação)
   e wizard vertical nos modais SweetAlert2
   ============================================================ */

/* Cabeçalho de página */
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb .sep { color: var(--muted-2); }
.breadcrumb .atual { color: var(--ink); }

/* Barra de filtros */
.filter-bar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
    padding: 14px 16px; margin-bottom: 18px;
}
.filter-bar .search { flex: 1; min-width: 200px; }
.filter-bar select { width: auto; min-width: 150px; }

/* Paginação */
.pagination-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.pagination { display: flex; gap: 6px; }
.page-btn {
    min-width: 36px; height: 36px; padding: 0 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
    color: var(--ink); font-weight: 600; font-size: 13.5px; text-decoration: none;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.page-btn.atual { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.page-btn.off { opacity: .4; }

/* Ações da linha */
.t-row .row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.action-btn {
    width: 40px; height: 40px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--surface);
    display: grid; place-items: center; cursor: pointer;
    color: var(--muted); font-size: 20px;
    text-decoration: none;
    transition: color .15s, border-color .15s, background .15s;
    position: relative;
}
.action-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--bg); }
.action-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

/* Tooltip CSS para tabelas e botoes (NAO sidebar — sidebar usa JS fly-tip) */
.action-btn[data-tip], .t-row [data-tip], .badge[data-tip], .button[data-tip], td[data-tip], th[data-tip] {
    position: relative;
}
.action-btn[data-tip]::after, .t-row [data-tip]::after, .badge[data-tip]::after, .button[data-tip]::after, td[data-tip]::after, th[data-tip]::after {
    content: attr(data-tip);
    position: absolute; left: 50%; bottom: calc(100% + 9px);
    translate: -50% 4px;
    background: var(--brand-dark); color: #fff;
    padding: 6px 11px; border-radius: 7px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
    box-shadow: var(--shadow-pop);
    opacity: 0; pointer-events: none; transition: opacity .12s, translate .12s;
    z-index: 60;
}
.action-btn[data-tip]::before, .t-row [data-tip]::before, .badge[data-tip]::before, .button[data-tip]::before, td[data-tip]::before, th[data-tip]::before {
    content: '';
    position: absolute; left: 50%; bottom: calc(100% + 3px);
    translate: -50% 0;
    border: 6px solid transparent; border-top-color: var(--brand-dark);
    opacity: 0; pointer-events: none; transition: opacity .12s;
    z-index: 60;
}
.action-btn[data-tip]:hover::after, .t-row [data-tip]:hover::after, .badge[data-tip]:hover::after, .button[data-tip]:hover::after, td[data-tip]:hover::after, th[data-tip]:hover::after,
.action-btn[data-tip]:hover::before, .t-row [data-tip]:hover::before, .badge[data-tip]:hover::before, .button[data-tip]:hover::before, td[data-tip]:hover::before, th[data-tip]:hover::before { opacity: 1; }
.action-btn[data-tip]:hover::after, .t-row [data-tip]:hover::after, .badge[data-tip]:hover::after, .button[data-tip]:hover::after, td[data-tip]:hover::after, th[data-tip]:hover::after { translate: -50% 0; }

/* ── Tabs ── */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border, #E6E7E8); }
.tab {
    padding: 10px 20px; background: transparent; border: none;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    color: var(--muted, #667085); font-weight: 600; font-size: 14px;
    font-family: inherit; cursor: pointer; transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--ink, #101828); }
.tab.active { color: var(--primary, #115EA6); border-bottom-color: var(--primary, #115EA6); }

/* ---------- Wizard vertical dentro do SweetAlert2 ---------- */
.swal2-popup.timmi-swal { font-family: var(--font); border-radius: var(--radius-lg); }
.swal2-popup.timmi-wizard-popup { padding: 0; width: 980px; max-width: 96vw; border-radius: var(--radius-lg); }
.timmi-wizard-popup .swal2-html-container { margin: 0; padding: 0; text-align: left; }

.wiz { display: grid; grid-template-columns: 240px 1fr; min-height: 440px; }
.wiz-side {
    background: var(--brand-dark); color: #fff;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    padding: 26px 20px; display: flex; flex-direction: column; gap: 4px;
}
.wiz-side h3 { color: #fff; font-size: 16px; margin-bottom: 18px; }
.wiz-step {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px; border-radius: 10px;
    color: #C9CDD6; font-weight: 600; font-size: 13.5px;
}
.wiz-step .num {
    width: 26px; height: 26px; border-radius: 50%; flex: none;
    display: grid; place-items: center;
    border: 2px solid #4A5064; font-size: 12.5px; font-weight: 700;
}
.wiz-step.atual { background: rgba(255, 216, 50, .12); color: #fff; }
.wiz-step.atual .num { border-color: var(--brand-yellow); color: var(--brand-yellow); }
.wiz-step.feito { color: #fff; }
.wiz-step.feito .num { background: var(--success); border-color: var(--success); color: #fff; }

.wiz-main { display: flex; flex-direction: column; padding: 26px 28px 20px; }
.wiz-main h4 { font-size: 17px; margin: 0 0 4px; }
.wiz-main .wiz-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.wiz-panels { flex: 1; }
.wiz-panel[hidden] { display: none; }
.wiz-footer {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px;
    padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--border);
}
.wiz-footer .right { display: flex; gap: 12px; margin-left: auto; }
.wiz-erro {
    flex: 1 1 100%; order: -1;
    color: var(--danger); font-weight: 600; font-size: 13px;
    background: var(--danger-soft); border: 1px solid rgba(222,12,15,.22);
    border-radius: 9px; padding: 9px 12px;
}
.wiz-erro:empty { display: none; }

@media (max-width: 760px) {
    .wiz { grid-template-columns: 1fr; }
    .wiz-side { border-radius: var(--radius-lg) var(--radius-lg) 0 0; flex-direction: row; overflow-x: auto; }
    .wiz-side h3 { display: none; }
}

/* ============================================================
   v1.3 — Modal de visualização (TimmiView) e lista de seleção
   ============================================================ */
.swal2-popup.timmi-view-popup { padding: 0; width: 960px; max-width: 94vw; border-radius: var(--radius-lg); font-family: var(--font); }
.timmi-view-popup .swal2-html-container { margin: 0; padding: 0; text-align: left; }

.view-head {
    display: flex; align-items: center; gap: 16px;
    background: var(--brand-dark); color: #fff;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 22px 24px;
}
.view-head .view-avatar {
    width: 52px; height: 52px; border-radius: 50%; flex: none;
    background: var(--brand-yellow); color: var(--brand-dark);
    display: grid; place-items: center; font-weight: 800; font-size: 18px;
}
.view-head h4 { margin: 0; color: #fff; font-size: 17px; }
.view-head .view-sub { color: #C9CDD6; font-size: 12.5px; }
.view-head .badge { margin-left: auto; }

.view-body { padding: 20px 24px 22px; max-height: 62vh; overflow-y: auto; }
.view-contadores { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.view-contadores span {
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-pill);
    padding: 6px 14px; font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.view-contadores span b { color: var(--ink); font-weight: 800; }
.view-grupo { margin-bottom: 18px; }
.view-grupo:last-child { margin-bottom: 0; }
.view-grupo h5 {
    margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .6px;
    text-transform: uppercase; color: var(--muted);
    border-bottom: 2px solid var(--brand-yellow); display: inline-block; padding-bottom: 3px;
}
.view-grupo dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 0; }
.view-grupo dl .full { grid-column: 1 / -1; }
.view-grupo dt { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.view-grupo dd { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.view-footer { display: flex; justify-content: flex-end; padding: 14px 24px; border-top: 1px solid var(--border); }

/* Lista de seleção com checkboxes (ex.: setores filhos) */
.check-list {
    border: 1px solid var(--border); border-radius: var(--radius);
    max-height: 200px; overflow-y: auto; padding: 6px;
    display: flex; flex-direction: column; gap: 2px;
}
.check-list label {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px; cursor: pointer;
    font-weight: 500; font-size: 13.5px;
}
.check-list label:hover { background: var(--bg); }
.check-list input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--primary); flex: none; }
.check-list .cl-vazio { color: var(--muted); padding: 10px; font-size: 13px; }

/* ============================================================
   v1.4 — Sub-navegação fixa das telas de Configurações
   ============================================================ */
.config-subnav {
    display: flex; gap: 6px; flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
    padding: 6px;
}
.config-subnav-item {
    padding: 9px 16px; border-radius: 9px;
    font-size: 13px; font-weight: 600; color: var(--muted);
    text-decoration: none; white-space: nowrap;
    transition: background .12s, color .12s;
}
.config-subnav-item:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.config-subnav-item.active { background: var(--brand-dark); color: #fff; }

@media (max-width: 700px) {
    .config-subnav { overflow-x: auto; flex-wrap: nowrap; }
}

/* ============================================================
   Sininho de notificações (topbar)
   ============================================================ */
.notif-bell { position: relative; }
.notif-bell .icon-button { position: relative; }
.notif-badge {
    position: absolute; top: 2px; right: 2px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 999px;
    background: var(--danger-strong, #D64545);
    color: #fff;
    font-size: 10px; font-weight: 800; line-height: 16px;
    text-align: center;
    display: inline-block;
    border: 2px solid var(--surface, #fff);
}
.notif-badge[hidden] { display: none; }
.notif-dropdown {
    position: absolute; right: 0; top: calc(100% + 8px);
    width: 340px; max-width: calc(100vw - 24px);
    background: var(--surface, #fff);
    border: 1px solid var(--border, #E6E7E8);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, .14);
    z-index: 120;
    overflow: hidden;
}
.notif-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border, #E6E7E8);
    font-size: 13.5px;
}
.notif-head a { font-size: 12.5px; color: var(--brand-dark, #2563EB); text-decoration: none; }
.notif-head a:hover { text-decoration: underline; }
.notif-list {
    max-height: 380px; overflow-y: auto;
    padding: 6px 0;
}
.notif-item {
    display: block;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-soft, #F0F1F3);
    text-decoration: none;
    color: var(--ink, #1D2939);
    transition: background .12s;
}
.notif-item:hover { background: var(--bg-soft, #F7F8F9); }
.notif-item.nao-lida { background: rgba(37, 99, 235, .06); }
.notif-item-nao-lida .notif-dot {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background: var(--brand-dark, #2563EB); margin-right: 6px;
}
.notif-item strong { display: block; font-size: 13px; margin-bottom: 2px; }
.notif-item .notif-msg { font-size: 12px; color: var(--muted, #667085); line-height: 1.4; }
.notif-item .notif-time { font-size: 11px; color: var(--muted-light, #98A2B3); margin-top: 4px; display: block; }
.notif-empty { padding: 22px 16px; text-align: center; color: var(--muted, #667085); font-size: 13px; }

/* ============================================================
   Página de notificações
   ============================================================ */
.notif-row {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft, #F0F1F3);
}
.notif-row.nao-lida { background: rgba(37, 99, 235, .05); }
.notif-row-icone {
    width: 34px; height: 34px; flex: none;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: var(--bg-soft, #F1F2F3);
    color: var(--brand-dark, #2563EB);
    font-size: 16px;
}
.notif-row.nao-lida .notif-row-icone { background: rgba(37, 99, 235, .12); }
.notif-row-corpo { flex: 1; min-width: 0; }
.notif-row-corpo strong { display: block; font-size: 13.5px; }
.notif-row .notif-msg { display: block; font-size: 12.5px; color: var(--muted, #667085); margin-top: 2px; line-height: 1.45; }
.notif-row .notif-time { display: block; font-size: 11.5px; color: var(--muted-light, #98A2B3); margin-top: 4px; }
.notif-row-acoes { flex: none; display: flex; align-items: center; gap: 6px; }

/* ============================================================
   Loader global — overlay bloqueante durante requisições
   ============================================================ */
#timmi-loader {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(18, 22, 34, .5);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
}
#timmi-loader.visivel {
    opacity: 1;
    pointer-events: auto;
}
.timmi-loader-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 28px 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-pop);
}
.timmi-loader-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--primary-soft);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: timmi-loader-girar .8s linear infinite;
}
.timmi-loader-text {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}
body.timmi-busy { user-select: none; cursor: progress; }
@keyframes timmi-loader-girar {
    to { transform: rotate(360deg); }
}


