/* ============================================================
   Sistema PAadvocacia — estilos
   ============================================================ */
:root {
    --azul:      #1e3a5f;
    --azul-esc:  #152a45;
    --azul-cla:  #2c5282;
    --dourado:   #c9a227;
    --bg:        #f4f6f9;
    --card:      #ffffff;
    --texto:     #1f2933;
    --muted:     #6b7280;
    --borda:     #e3e8ef;
    --verde:     #1f9d55;
    --vermelho:  #d64545;
    --amarelo:   #d69e2e;
    --info:      #2c5282;
    --radius:    10px;
    --sombra:    0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--texto);
    font-size: 15px;
    line-height: 1.5;
}
a { color: var(--azul-cla); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 16px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Layout com sidebar ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px;
    background: var(--azul-esc);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
    background: var(--dourado);
    color: var(--azul-esc);
    font-weight: 800;
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: 8px;
    font-size: 14px;
}
.brand-name { color: #fff; font-weight: 600; }
.brand-logo { max-height: 38px; max-width: 150px; object-fit: contain; border-radius: 6px; background: #fff; padding: 3px; }
.auth-logo { max-height: 70px; max-width: 220px; object-fit: contain; margin: 0 auto 10px; display: block; }
.logo-preview { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--borda); }
.logo-preview img { max-height: 80px; max-width: 100%; object-fit: contain; display: block; margin-bottom: 8px; border: 1px solid var(--borda); border-radius: 6px; padding: 6px; background: #fff; }
.sidebar-busca { padding: 12px 14px 0; }
.sidebar-busca input {
    width: 100%; margin: 0; padding: 8px 12px; font-size: 13px;
    border-radius: 8px; border: 1px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.08); color: #fff;
}
.sidebar-busca input::placeholder { color: rgba(255,255,255,.55); }
.sidebar-busca input:focus { outline: none; border-color: var(--dourado); background: rgba(255,255,255,.14); }

.menu { display: flex; flex-direction: column; padding: 12px 10px; gap: 2px; flex: 1; }
.menu a {
    display: flex; align-items: center; gap: 10px;
    color: #cbd5e1;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14.5px;
}
.menu a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.menu a.active { background: var(--azul-cla); color: #fff; }
.menu .ico { width: 18px; text-align: center; opacity: .9; }

/* Grupo de menu com sub-itens (Processos) */
.menu-group { }
.menu-parent {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
    color: #cbd5e1; padding: 10px 12px; border-radius: 8px; font-size: 14.5px;
}
.menu-parent::-webkit-details-marker { display: none; }
.menu-parent::marker { content: ''; }
.menu-parent:hover { background: rgba(255,255,255,.06); color: #fff; }
.menu-caret { margin-left: auto; font-size: 10px; opacity: .7; transition: transform .15s; }
.menu-group[open] .menu-caret { transform: rotate(180deg); }
.submenu { display: flex; flex-direction: column; margin: 2px 0 2px; }
.submenu a { color: #aebacd; padding: 8px 12px 8px 40px; border-radius: 8px; font-size: 13.5px; }
.submenu a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.submenu a.active { background: var(--azul-cla); color: #fff; }
.sidebar-foot {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center; justify-content: space-between;
}
.user-chip { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.user-chip:hover { text-decoration: none; }
.user-chip:hover .user-name { text-decoration: underline; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-papel { font-size: 11px; color: #94a3b8; }
.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--dourado); color: var(--azul-esc);
    display: grid; place-items: center; font-weight: 700; text-transform: uppercase;
}
.user-name { font-size: 13px; color: #e2e8f0; }
.btn-link { background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 13px; }
.btn-link:hover { color: #fff; text-decoration: underline; }

.content { flex: 1; min-width: 0; padding: 28px 36px; }

/* ---------- Cabeçalho de página ---------- */
.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 20px; gap: 16px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--borda);
    border-radius: var(--radius);
    box-shadow: var(--sombra);
    padding: 20px;
    margin-bottom: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.card.stat { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--texto); transition: transform .08s, box-shadow .08s; }
.card.stat:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16,24,40,.1); text-decoration: none; }
.stat-num { font-size: 34px; font-weight: 800; color: var(--azul); line-height: 1; }
.stat-label { font-size: 14px; color: var(--muted); margin-top: 6px; }
.stat-sub { font-size: 12px; color: var(--muted); }

/* ---------- Botões ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; color: var(--texto);
    border: 1px solid var(--borda);
    padding: 8px 14px; border-radius: 8px;
    font-size: 14px; cursor: pointer; font-weight: 500;
    transition: background .1s, border-color .1s;
}
.btn:hover { background: #f7f9fc; text-decoration: none; }
.btn-primary { background: var(--azul); color: #fff; border-color: var(--azul); }
.btn-primary:hover { background: var(--azul-cla); }
.btn-danger { background: #fff; color: var(--vermelho); border-color: #f0c9c9; }
.btn-danger:hover { background: #fdf0f0; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #eef1f6; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Tabelas ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--borda); vertical-align: middle; }
.table th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.table tbody tr:hover { background: #f9fafc; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > form, .table .actions > a, .table .actions > button { display: inline-block; vertical-align: middle; margin-left: 6px; }
.table .actions > *:first-child { margin-left: 0; }
.row-done td { opacity: .55; }
.link { font-weight: 500; }

/* ---------- Formulários ---------- */
label { display: block; margin-bottom: 14px; font-size: 13.5px; color: var(--texto); font-weight: 500; }
input, select, textarea {
    width: 100%; margin-top: 5px;
    padding: 9px 11px;
    border: 1px solid var(--borda); border-radius: 8px;
    font-size: 14px; font-family: inherit;
    background: #fff; color: var(--texto);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul-cla); box-shadow: 0 0 0 3px rgba(44,82,130,.12); }
textarea { resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ---------- Toolbar / busca ---------- */
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.toolbar input, .toolbar select { width: auto; margin: 0; }
.toolbar input[type=text] { min-width: 280px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--borda); }
.tab { padding: 9px 16px; color: var(--muted); border-bottom: 2px solid transparent; }
.tab:hover { text-decoration: none; color: var(--texto); }
.tab.active { color: var(--azul); border-bottom-color: var(--azul); font-weight: 600; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 600; background: #eef1f6; color: #475569;
}
.badge-info { background: #e6effa; color: var(--info); }
.badge-success { background: #e3f6ea; color: var(--verde); }
.badge-warning { background: #fdf3e0; color: var(--amarelo); }
.badge-danger { background: #fbe9e9; color: var(--vermelho); }

/* ---------- Listas e definições ---------- */
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--borda); }
.list li:last-child { border-bottom: none; }
.def { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 0; }
.def dt { color: var(--muted); font-size: 13px; }
.def dd { margin: 0; }
.empty { color: var(--muted); text-align: center; padding: 28px; }

/* ---------- Alertas ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.alert-success { background: #e3f6ea; color: #15663a; border: 1px solid #b7e3c6; }
.alert-error { background: #fbe9e9; color: #9b2c2c; border: 1px solid #f0c2c2; }
.alert-info-box { background: #e6effa; color: #1d4575; border: 1px solid #c2d6f0; }

/* Validação inline de campos (ex.: CPF/CNPJ) */
.campo-invalido { border-color: var(--vermelho) !important; background: #fff7f7; }
.campo-aviso { display: block; margin-top: 4px; font-size: 12px; color: var(--vermelho); min-height: 14px; }

/* Linha de filtros (auditoria e afins) */
.filtros-linha { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 14px 0; }
.filtros-linha label { margin: 0; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.filtros-linha select, .filtros-linha input { margin: 0; }
.filtros-acoes { display: flex; gap: 8px; }

/* Autoria (responsável / criador) em prazos e tarefas */
.meta-autoria { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.meta-autoria span { white-space: nowrap; }
.tarefa-criador { margin-top: 4px; padding-top: 4px; border-top: 1px dashed var(--borda); }

/* Paginação de listas */
.paginacao { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 10px; margin-top: 14px; }
.pg-info { color: var(--muted); font-size: 13px; }
.pg-links { display: flex; flex-wrap: wrap; gap: 4px; }
.pg-item { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px;
    padding: 0 8px; border: 1px solid var(--borda); border-radius: 8px; color: var(--texto);
    text-decoration: none; font-size: 14px; background: #fff; }
a.pg-item:hover { border-color: var(--azul-cla); color: var(--azul-cla); }
.pg-active { background: var(--azul); border-color: var(--azul); color: #fff !important; font-weight: 600; }
.pg-disabled { color: #c0c7d0; background: #f7f9fc; cursor: not-allowed; }
.pg-gap { border: none; background: none; min-width: 18px; }

/* Edição inline (ex.: categorias financeiras) */
.inline-edit { display: inline-block; }
.inline-edit > summary { list-style: none; cursor: pointer; }
.inline-edit > summary::-webkit-details-marker { display: none; }
.inline-edit-form { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center;
    background: #f8fafc; padding: 8px; border: 1px solid var(--borda); border-radius: 8px; }
.inline-edit-form input, .inline-edit-form select { margin: 0; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.kanban-col { background: #eef1f6; border-radius: var(--radius); padding: 10px; }
.kanban-col-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 10px; font-weight: 600; color: #334155; }
.kanban-col-head .count { background: #fff; color: var(--muted); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.kanban-list { min-height: 60px; display: flex; flex-direction: column; gap: 8px; padding: 4px; border-radius: 8px; }
.kanban-list.drop-target { background: #dfe6f0; outline: 2px dashed var(--azul-cla); }
.kanban-card {
    background: #fff; border: 1px solid var(--borda); border-radius: 8px;
    padding: 11px 12px; box-shadow: var(--sombra); cursor: grab; position: relative;
}
.kanban-card.dragging { opacity: .5; }
.kanban-card-title { font-weight: 600; font-size: 14px; padding-right: 16px; }
.kanban-card-desc { font-size: 13px; color: var(--muted); margin-top: 4px; }
.card-del {
    position: absolute; top: 6px; right: 6px;
    background: none; border: none; color: #cbd5e1; cursor: pointer; font-size: 18px; line-height: 1;
}
.card-del:hover { color: var(--vermelho); }

/* ---------- Modal ---------- */
.modal { border: none; border-radius: var(--radius); padding: 24px; width: 440px; max-width: 92vw; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal::backdrop { background: rgba(15,23,42,.45); }

/* ---------- Telas de autenticação ---------- */
.auth-body { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(135deg, var(--azul-esc), var(--azul-cla)); }
.auth-card { background: #fff; border-radius: 14px; padding: 32px; width: 380px; max-width: 92vw; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .brand-mark { width: 48px; height: 48px; font-size: 18px; margin: 0 auto 10px; }
.auth-title { font-size: 20px; margin: 0; }

/* ---------- Financeiro ---------- */
.text-green { color: var(--verde); }
.text-red { color: var(--vermelho); }

/* Abas do financeiro */
.fin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--borda); margin-bottom: 18px; overflow-x: auto; }
.fin-tab { padding: 11px 18px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.fin-tab:hover { color: var(--texto); text-decoration: none; }
.fin-tab.active { color: var(--azul); border-bottom-color: var(--azul); font-weight: 600; }
.fin-tab.disabled { color: #c2cad6; cursor: default; }
.tag-soon { background: #fdecc8; color: #9a6a12; font-size: 9.5px; font-weight: 700; padding: 1px 5px; border-radius: 4px; vertical-align: middle; letter-spacing: .04em; }

/* Busca + filtros */
.fin-filtros { margin-bottom: 14px; }
.fin-search { position: relative; margin-bottom: 12px; }
.fin-search-ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); opacity: .5; font-size: 14px; }
.fin-search input { width: 100%; margin: 0; padding: 11px 14px 11px 40px; border-radius: 10px; }
.fin-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; margin: 0;
    background: #fff; border: 1px solid var(--borda); border-radius: 999px;
    padding: 0 14px; height: 38px; line-height: 1; font-size: 13.5px; color: var(--texto); cursor: pointer; font-weight: 500;
}
.chip:hover { text-decoration: none; border-color: #c7d0dd; }
.chip-on { font-weight: 600; }
.chip-danger { background: #fbe9e9; border-color: #f0c2c2; color: var(--vermelho); }
.chip-warning { background: #fdf3e0; border-color: #f0dcb0; color: #9a6a12; }
.chip-clear { color: var(--muted); }
.chip-select { padding: 0 6px 0 14px; color: var(--muted); }
.chip-select select { border: none; background: transparent; margin: 0; padding: 0 6px; width: auto; height: 28px; line-height: 1; font-size: 13.5px; color: var(--texto); font-weight: 600; cursor: pointer; }
.chip-select select:focus { outline: none; box-shadow: none; }

/* Navegador de meses */
.fin-meses { display: flex; align-items: center; gap: 4px; margin-bottom: 18px; flex-wrap: wrap; }
.mes-item { padding: 7px 14px; border-radius: 8px; font-size: 13.5px; color: var(--muted); font-weight: 500; }
.mes-item:hover { background: #eef1f6; text-decoration: none; color: var(--texto); }
.mes-item.active { background: var(--azul); color: #fff; font-weight: 600; }
.mes-nav { padding: 7px 10px; color: var(--muted); font-size: 16px; border-radius: 8px; }
.mes-nav:hover { background: #eef1f6; text-decoration: none; }

/* Cards de resumo (novo) */
.fin-resumo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.fin-rcard { background: var(--card); border: 1px solid var(--borda); border-radius: var(--radius); box-shadow: var(--sombra); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.fin-rlabel { font-size: 13px; color: var(--muted); }
.fin-rval { font-size: 22px; font-weight: 800; }
@media (max-width: 700px) { .fin-resumo { grid-template-columns: 1fr; } }

.cards-fin .stat-num { font-size: 22px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-green { background: var(--verde); }
.dot-red { background: var(--vermelho); }
.seg { display: flex; gap: 10px; margin-bottom: 18px; }
.seg-opt { margin: 0; flex: 1; cursor: pointer; }
.seg-opt input { width: auto; margin: 0 6px 0 0; }
.seg-opt span { display: inline-flex; align-items: center; }
.seg-green { color: var(--verde); font-weight: 600; }
.seg-red { color: var(--vermelho); font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; margin: 0; }

/* ---------- Upload de documentos ---------- */
.upload-form { background: #f7f9fc; border: 1px dashed var(--borda); border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.upload-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.upload-row input[type=file] { width: auto; margin: 0; flex: 1 1 220px; }
.upload-row input[type=text] { width: auto; margin: 0; flex: 1 1 180px; }
.upload-row select { width: auto; margin: 0; }

/* ---------- Relatórios / gráficos ---------- */
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.sw-green { background: var(--verde); }
.sw-red { background: var(--vermelho); }

.barchart { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 10px; overflow-x: auto; }
.barchart-col { flex: 1 1 0; min-width: 34px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.barchart-col .bars { flex: 1; display: flex; align-items: flex-end; gap: 3px; width: 100%; justify-content: center; }
.barchart .bar { width: 14px; border-radius: 4px 4px 0 0; transition: height .2s; }
.bar-green { background: var(--verde); }
.bar-red { background: var(--vermelho); }
.barchart-label { font-size: 11px; color: var(--muted); margin-top: 6px; white-space: nowrap; }

.catbar { margin-bottom: 12px; }
.catbar-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.catbar-track { background: #eef1f6; border-radius: 6px; height: 12px; overflow: hidden; }
.catbar-fill { height: 100%; border-radius: 6px; }
.fill-green { background: var(--verde); }
.fill-red { background: var(--vermelho); }

/* ---------- Agenda / calendário ---------- */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.cal-title { margin: 0; font-size: 18px; color: var(--azul); text-transform: capitalize; }
.cal-nav-right { display: flex; gap: 8px; }
.cal-card { padding: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { margin-bottom: 6px; }
.cal-weekday { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; padding: 4px 0; }
.cal-grid + .cal-grid { margin-top: 6px; }
.cal-day { min-height: 96px; background: #fff; border: 1px solid var(--borda); border-radius: 8px; padding: 5px 6px; display: flex; flex-direction: column; }
.cal-day.cal-out { background: #f7f9fc; }
.cal-day.cal-out .cal-day-num { color: #c2cad6; }
.cal-day.cal-today { border-color: var(--azul-cla); box-shadow: 0 0 0 2px rgba(44,82,130,.15); }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; }
.cal-day-num { font-size: 13px; font-weight: 600; color: var(--texto); }
.cal-today .cal-day-num { background: var(--azul); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.cal-add { color: #c2cad6; font-weight: 700; text-decoration: none; font-size: 15px; line-height: 1; padding: 0 3px; }
.cal-add:hover { color: var(--azul-cla); text-decoration: none; }
.cal-events { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; overflow: hidden; }
.cal-ev { font-size: 11px; padding: 2px 5px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.cal-ev:hover { text-decoration: none; filter: brightness(.96); }
.cal-ev-comp { background: #e6effa; color: var(--azul-cla); }
.cal-ev-prazo { background: #fdf3e0; color: #9a6a12; }
.cal-ev-done { text-decoration: line-through; opacity: .6; }
.form-del-sep { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--borda); }

@media (max-width: 700px) {
    .cal-day { min-height: 70px; }
    .cal-ev { font-size: 10px; }
}

/* ---------- Painel: atalhos ---------- */
.atalhos { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.atalho {
    display: inline-flex; align-items: center; gap: 8px;
    background: #fff; border: 1px solid var(--borda); border-radius: 10px;
    padding: 10px 16px; color: var(--texto); font-weight: 500; font-size: 14px;
    box-shadow: var(--sombra); transition: transform .08s, border-color .08s;
}
.atalho:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--azul-cla); }
.atalho-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--azul); color: #fff; font-size: 14px; }

/* ---------- Painel: mini financeiro ---------- */
.fin-mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.fin-mini-item { display: flex; flex-direction: column; gap: 3px; padding: 6px 0; }
.fin-mini-label { font-size: 12.5px; color: var(--muted); }
.fin-mini-val { font-size: 19px; font-weight: 700; }

/* ---------- Painel: listas com lateral ---------- */
.list .li-main { flex: 1; min-width: 0; }
.list .li-side { text-align: right; white-space: nowrap; font-size: 13px; }
.list li { align-items: flex-start; }

@media (max-width: 700px) {
    .fin-mini { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- CRM ---------- */
.crm-eyebrow { font-size: 13px; font-weight: 700; color: var(--azul-cla); letter-spacing: .06em; }
.crm-title { font-size: 22px; max-width: 620px; line-height: 1.25; }
.crm-filtros { margin-bottom: 16px; }

.kanban-crm { grid-template-columns: repeat(5, 1fr); align-items: start; }
.crm-col { background: #f4f6fa; padding: 0 8px 10px; position: relative; overflow: hidden; }
.crm-col-bar { height: 4px; margin: 0 -8px 10px; background: var(--cor-etapa); }
.crm-col-head { padding: 4px 4px 10px; }
.crm-col-titulo { font-weight: 600; font-size: 14px; color: #334155; }
.crm-col-titulo::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--cor-etapa); margin-right: 7px; vertical-align: middle; }
.crm-col-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.crm-card { padding: 12px; }
.crm-card-link { display: block; color: var(--texto); text-decoration: none; }
.crm-card-link:hover { text-decoration: none; }
.crm-card-title { font-weight: 700; font-size: 13.5px; text-transform: uppercase; letter-spacing: .01em; line-height: 1.3; margin-bottom: 7px; }
.crm-prio { display: flex; align-items: center; gap: 3px; margin-bottom: 7px; }
.pdot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.pdot-label { font-size: 11.5px; color: var(--muted); margin-left: 5px; }
.crm-card-row { font-size: 12.5px; color: #475569; margin-top: 3px; }
.crm-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.etq { display: inline-block; color: #fff; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.crm-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--borda); }
.crm-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--azul); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; text-transform: uppercase; }
.crm-valor { font-weight: 700; font-size: 13.5px; color: var(--azul); }

/* Seletor de etiquetas no formulário */
.etq-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.etq-opt { display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; }
.etq-opt input { width: auto; margin: 0; }
.cor-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cor-opt { margin: 0; cursor: pointer; }
.cor-opt input { display: none; }
.cor-bola { width: 26px; height: 26px; border-radius: 50%; display: inline-block; border: 3px solid transparent; transition: .1s; }
.cor-opt input:checked + .cor-bola { border-color: #1f2933; transform: scale(1.1); }
.interacao-form { background: #f7f9fc; border: 1px solid var(--borda); border-radius: 8px; padding: 12px; margin-bottom: 16px; }
.interacao-row { display: flex; gap: 8px; margin-bottom: 8px; }
.interacao-row select, .interacao-row input { margin: 0; }
.interacao-form textarea { margin-bottom: 8px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid var(--borda); padding: 0 0 14px 14px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--azul-cla); }
.timeline-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.timeline-body { font-size: 13.5px; line-height: 1.5; }

/* ---------- Tarefas (cards enriquecidos) ---------- */
.tarefa-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.tarefa-card-acts { display: flex; align-items: center; gap: 4px; }
.pontos-badge { background: #eef2fb; color: var(--azul-cla); font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.card-edit { color: #c2cad6; text-decoration: none; font-size: 13px; line-height: 1; }
.card-edit:hover { color: var(--azul-cla); text-decoration: none; }
.tarefa-card .card-del { position: static; }
.tarefa-tempo { font-size: 11.5px; color: #9a6a12; background: #fdf3e0; border-radius: 6px; padding: 3px 7px; margin-top: 7px; display: inline-block; }
.tarefa-tempo.done { color: var(--verde); background: #e3f6ea; }
.tarefa-card-foot { display: flex; align-items: center; gap: 7px; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--borda); }

/* Ranking de desempenho */
.rank-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--borda); }
.rank-item:last-child { border-bottom: none; }
.rank-pos { width: 32px; text-align: center; font-size: 18px; font-weight: 700; color: var(--muted); }
.rank-main { flex: 1; min-width: 0; }
.rank-nome { font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.rank-track { background: #eef1f6; border-radius: 6px; height: 10px; overflow: hidden; }
.rank-fill { height: 100%; background: linear-gradient(90deg, var(--azul-cla), var(--azul)); border-radius: 6px; }
.rank-stats { text-align: right; white-space: nowrap; }
.rank-pontos { display: block; font-weight: 800; color: var(--azul); font-size: 16px; }

/* ---------- Motor de Workflow ---------- */
.wf-banner { background: linear-gradient(120deg, var(--azul-esc), var(--azul-cla)); color: #fff; border-radius: var(--radius); padding: 26px 28px; margin-bottom: 22px; }
.wf-eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; opacity: .8; }
.wf-banner h1 { font-size: 22px; margin: 6px 0 0; max-width: 560px; line-height: 1.3; }
.wf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.wf-card { background: var(--card); border: 1px solid var(--borda); border-radius: var(--radius); box-shadow: var(--sombra); padding: 16px; display: flex; flex-direction: column; }
.wf-card.wf-off { opacity: .7; }
.wf-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.wf-flow { display: flex; align-items: center; gap: 6px; }
.wf-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; }
.wf-ic-trigger { background: #fdecc8; color: #b7791f; }
.wf-ic-action { background: #d6f0e0; color: var(--verde); }
.wf-arrow { color: #c2cad6; font-size: 18px; }
.wf-toggle-form { display: flex; align-items: center; gap: 8px; }
.wf-status { font-size: 12.5px; color: var(--muted); }
.wf-status.on { color: var(--verde); font-weight: 600; }
.wf-card-body { display: block; color: var(--texto); text-decoration: none; flex: 1; }
.wf-card-body:hover { text-decoration: none; }
.wf-title { font-size: 15px; margin: 0 0 5px; }
.wf-desc { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0; }
.wf-card-foot { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--borda); }
.wf-author { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: #475569; }
.wf-card-actions { display: flex; gap: 6px; margin-top: 10px; }
.wf-card-actions form { display: inline; }

/* Switch (liga/desliga) */
.switch { width: 40px; height: 22px; border-radius: 999px; background: #cbd5e1; border: none; cursor: pointer; padding: 0; position: relative; transition: background .15s; }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch-on { background: var(--verde); }
.switch-on .switch-knob { left: 20px; }

/* ---------- Intimações ---------- */
.menu-badge {
    margin-left: auto; background: var(--vermelho); color: #fff;
    font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; line-height: 1.5;
}
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar-row .tabs { margin-bottom: 0; border-bottom: none; }
.intim-list { display: flex; flex-direction: column; }
/* Rolagem interna: a lista não empurra a página (o menu fica sempre à mostra). */
.intim-scroll { max-height: calc(100vh - 380px); min-height: 160px; overflow-y: auto; padding-right: 4px; }
/* Rolagem interna para listas/tabelas dentro de um card (cabeçalho fixo no topo). */
.card-scroll { max-height: calc(100vh - 320px); overflow-y: auto; }
.card-scroll table.table thead th { position: sticky; top: 0; background: #fff; z-index: 1; box-shadow: inset 0 -1px 0 var(--borda); }
@media (max-width: 880px) { .card-scroll { max-height: calc(100vh - 260px); } }
.intim-item {
    display: block; padding: 14px 12px; border-bottom: 1px solid var(--borda);
    color: var(--texto); text-decoration: none; transition: background .1s;
}
.intim-item:last-child { border-bottom: none; }
.intim-item:hover { background: #f9fafc; text-decoration: none; }
.intim-naolida { border-left: 3px solid var(--azul-cla); background: #fbfdff; }
.intim-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 5px; }
.intim-data { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.intim-proc { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.intim-resumo { font-size: 13px; color: var(--muted); line-height: 1.45; }
.intim-teor {
    max-height: 460px; overflow: auto; border: 1px solid var(--borda); border-radius: 8px;
    padding: 14px; background: #fcfcfd; font-size: 14px; line-height: 1.6;
}
.intim-teor table { width: 100%; border-collapse: collapse; }
.intim-teor td { padding: 2px 4px; vertical-align: top; }
.codebox {
    background: #0f1b2d; color: #e2e8f0; padding: 10px 12px; border-radius: 8px;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px;
    overflow-x: auto; white-space: pre; margin: 4px 0 12px;
}

/* ---------- Barra superior (mobile) e overlay ---------- */
.topbar { display: none; }
.overlay { display: none; }
.hamburger {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 40px; height: 40px; padding: 9px; border: none; background: rgba(255,255,255,.12);
    border-radius: 8px; cursor: pointer;
}
.hamburger span { display: block; height: 2px; background: #fff; border-radius: 2px; transition: .2s; }
.topbar-brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; }
.topbar-logo { max-height: 28px; max-width: 110px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px; }

/* ---------- Transições de página ---------- */
/* Crossfade nativo entre páginas (Chrome/Edge recentes). */
@view-transition { navigation: auto; }
/* Suaviza o crossfade nativo. */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; }

/* Animação de entrada do conteúdo (alternativa p/ navegadores sem View Transitions). */
.content > * { animation: pageIn .30s ease both; }
@keyframes pageIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}
/* Onde houver crossfade nativo, dispensa a animação manual (evita efeito duplo). */
@supports (view-transition-name: none) {
    .content > * { animation: none; }
}

/* Suaviza navegação por âncoras e respeita quem prefere menos movimento. */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    .content > * { animation: none; }
    html { scroll-behavior: auto; }
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- Temas (sobrescrevem a paleta principal) ---------- */
body[data-tema="verde"]   { --azul:#1f7a4d; --azul-esc:#14532d; --azul-cla:#2f9e6b; --info:#1f7a4d; }
body[data-tema="roxo"]    { --azul:#6b46c1; --azul-esc:#4c2d92; --azul-cla:#805ad5; --info:#6b46c1; }
body[data-tema="vinho"]   { --azul:#8b2942; --azul-esc:#5f1a2d; --azul-cla:#a83a57; --info:#8b2942; }
body[data-tema="grafite"] { --azul:#374151; --azul-esc:#1f2937; --azul-cla:#4b5563; --info:#374151; }

/* Seletor de temas */
.tema-grid { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0 16px; }
.tema-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; margin: 0; border: 2px solid var(--borda); border-radius: 10px; padding: 12px 16px; min-width: 96px; }
.tema-opt.sel { border-color: var(--azul-cla); }
.tema-opt input { display: none; }
.tema-amostra { width: 44px; height: 44px; border-radius: 10px; }
.tema-nome { font-size: 12.5px; font-weight: 600; }

/* Grade de permissões (checkboxes de módulos) */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 8px 0 16px; }
.perm-opt { display: flex; align-items: center; gap: 8px; margin: 0; background: #f7f9fc; border: 1px solid var(--borda); border-radius: 8px; padding: 9px 12px; cursor: pointer; }
.perm-opt input { width: auto; margin: 0; }

/* ---------- Responsivo ---------- */
@media (max-width: 880px) {
    /* Barra superior fixa com o hambúrguer. */
    .topbar {
        display: flex; align-items: center; gap: 12px;
        position: sticky; top: 0; z-index: 80;
        background: var(--azul-esc); padding: 10px 14px;
        box-shadow: 0 2px 8px rgba(0,0,0,.15);
    }
    /* Menu lateral vira gaveta deslizante. */
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; width: 250px; z-index: 100;
        transform: translateX(-100%); transition: transform .25s ease; overflow-y: auto;
    }
    body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.45); }
    /* Fundo escurecido quando o menu está aberto. */
    body.sidebar-open .overlay { display: block; position: fixed; inset: 0; background: rgba(8,15,30,.5); z-index: 90; }

    .content { padding: 18px; }
    .cards { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .kanban { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: flex-start; }
    .toolbar { flex-wrap: wrap; }
    .toolbar input[type=text] { min-width: 0; flex: 1 1 100%; }

    /* Permite que itens de grid/flex encolham (senão estouram a tela). */
    .cards > *, .grid-2 > *, .fin-mini > *, .cards-fin > * { min-width: 0; }

    /* Tabelas: rolagem horizontal de verdade (não espremem nem estouram). */
    .card { overflow-x: auto; }
    .card .table { width: auto; min-width: 100%; white-space: nowrap; }

    /* Textos longos (e-mails, números de processo) quebram em vez de vazar. */
    .def dd, .li-main, .kanban-card, .card { overflow-wrap: anywhere; word-break: break-word; }
    .def { grid-template-columns: 96px 1fr; }

    /* Garante que nada ultrapasse a largura da tela. */
    .content { max-width: 100%; overflow-x: hidden; overflow-x: clip; }
    img { max-width: 100%; height: auto; }
}

@media (max-width: 700px) {
    /* Calendário rola na horizontal em vez de espremer 7 colunas. */
    .cal-card { overflow-x: auto; }
    .cal-grid { min-width: 520px; }
}

@media (max-width: 560px) {
    .cards { grid-template-columns: 1fr; }
    .fin-mini { grid-template-columns: 1fr; }
    .atalhos { flex-direction: column; }
    .atalho { justify-content: flex-start; }
    /* Formulário de upload empilha os campos. */
    .upload-row { flex-direction: column; align-items: stretch; }
    .upload-row > * { width: 100%; flex: none; }
    /* Barra de ações e navegação do calendário quebram em telas pequenas. */
    .form-actions { flex-wrap: wrap; }
    .cal-nav { flex-wrap: wrap; }
    .cal-title { flex: 1 1 100%; order: -1; text-align: center; }
    /* Botões de ação nas tabelas podem quebrar em telas pequenas. */
    .table .actions { white-space: normal; text-align: left; }
}
