﻿:root {
    --brand-950: #0d1e31;
    --brand-900: #122940;
    --brand-850: #173450;
    --brand-800: #1f4362;
    --brand-700: #2a5c7d;
    --accent-600: #1f8c7f;
    --accent-700: #197569;
    /* v13.61: verde da logo do escritório — mediana dos pontos verdes da imagem da
       logo (#37693a); claro/escuro/vivo derivados no mesmo matiz. Claro/escuro pintam o
       quadrado da casinha do Home (v13.62); a SELEÇÃO do Home em verde foi recusada. */
    --logo-verde: #37693a;
    --logo-verde-claro: #4a8c4d;
    --logo-verde-escuro: #274928;
    --logo-verde-vivo: #5eba63;
    --bg: #f2f5f9;
    --surface: #ffffff;
    --surface-alt: #f7f9fc;
    --border: #d8e1ea;
    --text: #1c2c3a;
    --muted: #607287;
    --success: #1c875c;
    --warning: #a87a18;
    --danger: #b14444;
    --lucros-sticky-top: 72px;
    --shadow-soft: 0 10px 30px rgba(18, 41, 64, 0.08);
    --shadow-card: 0 4px 18px rgba(18, 41, 64, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    scroll-padding-top: 108px;
}

body {
    margin: 0;
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

.portal-content section[id] {
    scroll-margin-top: 108px;
}

@keyframes fade-up-soft {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--brand-900);
    letter-spacing: -0.01em;
    margin-bottom: 0;
}

p {
    color: inherit;
}

a {
    color: var(--brand-700);
}

.text-muted {
    color: var(--muted) !important;
}

.portal-shell {
    min-height: 100vh;
}

.portal-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    width: 286px;
    height: 100vh;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--brand-900) 0%, #10283f 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    transition: width 0.25s ease;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 26, 41, 0.45);
    z-index: 1035;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.sidebar-brand-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1.15rem 1.15rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

/* v13.55: logo + nome são um link para a Home, com o mesmo espaçamento de antes. */
.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
    border-radius: 12px;
}

.sidebar-brand-link:hover .brand-title {
    color: #fff;
}

.sidebar-brand-link:focus-visible {
    outline: 2px solid rgba(96, 225, 207, 0.7);
    outline-offset: 4px;
}

.brand-title {
    font-size: 0.95rem;
    color: #eef4fb;
    font-weight: 700;
}

.brand-subtitle {
    font-size: 0.74rem;
    color: rgba(238, 244, 251, 0.72);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-close {
    color: rgba(255, 255, 255, 0.75);
    margin-left: auto;
    font-size: 1rem;
}

.sidebar-section {
    padding: 1rem 0.85rem;
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.45rem 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    background: #0e2840;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.sidebar-settings-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-decoration: none;
    color: #f2f8ff;
    background: linear-gradient(135deg, rgba(31, 140, 127, 0.38), rgba(31, 140, 127, 0.17));
    border: 1px solid rgba(96, 225, 207, 0.42);
    border-radius: 12px;
    padding: 0.62rem 0.72rem;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.sidebar-settings-link:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(10, 25, 40, 0.3);
}

.sidebar-settings-link.active {
    background: linear-gradient(135deg, rgba(31, 140, 127, 0.52), rgba(31, 140, 127, 0.2));
}

.sidebar-footer-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-decoration: none;
    color: #f2f8ff;
    padding: 0.5rem 0.6rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 8px;
    transition: background 0.18s ease, color 0.18s ease;
}

.sidebar-footer-link + .sidebar-footer-link,
.sidebar-footer-link + .sidebar-version {
    margin-top: 0.45rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.sidebar-footer-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-footer-link.active {
    color: #fff;
    background: rgba(96, 225, 207, 0.18);
}

.sidebar-footer-link i {
    font-size: 1rem;
}

.sidebar-version {
    margin: 0;
    color: rgba(232, 240, 249, 0.85);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-align: center;
    line-height: 1.2;
}

.sidebar-settings-link + .sidebar-version {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.sidebar-section-title {
    margin: 0 0 0.65rem;
    padding: 0 0.65rem;
    color: rgba(230, 239, 248, 0.72);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.module-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0.5rem 0.75rem;
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #eaf2fb;
    font-size: 0.82rem;
    font-weight: 700;
}

.sidebar-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

/* v13.54: "Home" no topo do menu de um módulo, separado dos itens do módulo. */
.sidebar-nav-list.sidebar-home {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.58rem 0.72rem;
    border-radius: 10px;
    text-decoration: none;
    color: rgba(228, 238, 248, 0.85);
    transition: all 0.2s ease;
    font-size: 0.88rem;
    font-weight: 600;
}

.sidebar-link i {
    width: 1.15rem;
    text-align: center;
    font-size: 0.95rem;
}

/* Contador de pendencias no item do menu (RCC Digital, v10.53).
   margin-left: auto empurra pra direita - o .sidebar-link e flex. */
.sidebar-badge {
    margin-left: auto;
    min-width: 1.25rem;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    background: #d92d20;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
}

/* O badge tem que aparecer mesmo com o menu recolhido (so icones). */
.sidebar-collapsed .sidebar-badge,
.sidebar-mini .sidebar-badge {
    position: absolute;
    top: 0.15rem;
    right: 0.15rem;
    margin-left: 0;
    min-width: 0.95rem;
    padding: 0 0.2rem;
    font-size: 0.6rem;
}

.sidebar-collapsed .sidebar-link,
.sidebar-mini .sidebar-link {
    position: relative;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(31, 140, 127, 0.26), rgba(31, 140, 127, 0.12));
    color: #fff;
    border: 1px solid rgba(96, 225, 207, 0.32);
}

.sidebar-link.disabled {
    opacity: 0.55;
    pointer-events: none;
}

.sidebar-section-future {
    border-top: 1px dashed rgba(255, 255, 255, 0.16);
    margin-top: 0.6rem;
}

.future-module-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.future-module-list li {
    display: grid;
    grid-template-columns: 16px 1fr auto;
    align-items: center;
    gap: 9px;
    padding: 0.45rem 0.58rem;
    border-radius: 10px;
    color: rgba(228, 238, 248, 0.85);
    font-size: 0.78rem;
}

.badge-soft {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.66rem;
    padding: 0.2rem 0.48rem;
    font-weight: 700;
}

.portal-main {
    margin-left: 286px;
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}

.portal-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(242, 245, 249, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.4rem;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.btn-topbar {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--brand-850);
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 8px;
    display: grid;
    place-items: center;
}

.topbar-kicker {
    margin: 0;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: var(--muted);
    font-weight: 700;
}

.topbar-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.portal-notification-center {
    position: relative;
}

.portal-notification-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    /* explicitamente visible para nao cortar o badge em nenhum browser */
    overflow: visible;
}

.portal-notification-btn .bi-bell {
    line-height: 1;
}

.portal-notification-badge {
    /* Estrategia: o badge fica 100% DENTRO do botao. Sem top/right
       negativos. Isso garante que ele nunca sera cortado pelo topbar
       sticky (que poderia clipar se extendesse para acima do viewport)
       nem por qualquer overflow de ancestral. */
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: #e03d3d;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    /* Halo via box-shadow (por fora do circulo, sem reduzir area interna).
       A cor do outline combina com o fundo do botao/topbar para dar o
       efeito de "sticker flutuante" separado do sino. Redefinido por
       variante de topbar (.portal-topbar--internal-requests) abaixo. */
    box-shadow:
        0 0 0 2px var(--surface),
        0 1px 2px rgba(18, 41, 64, 0.28);
    z-index: 2;
    pointer-events: none;
    white-space: nowrap;
}

.portal-notification-menu {
    width: min(420px, 92vw);
    max-height: 72vh;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid #d2deea;
    box-shadow: 0 14px 28px rgba(18, 41, 64, 0.16);
    padding: 0;
}

.portal-notification-header {
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid #e1e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: #f6f9fc;
}

.portal-notification-markall {
    font-size: 0.73rem;
    text-decoration: none;
}

.portal-notification-permission {
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid #e6edf5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    background: #fbfdff;
}

.portal-notification-list {
    max-height: calc(72vh - 112px);
    overflow-y: auto;
    display: grid;
    align-content: start;
}

.portal-notification-empty {
    margin: 0;
    padding: 0.9rem 0.85rem;
    color: #6b7f94;
    font-size: 0.82rem;
}

.portal-notification-item {
    padding: 0.62rem 0.8rem;
    border-bottom: 1px solid #edf2f7;
    color: #19344d;
    text-decoration: none;
    display: grid;
    gap: 0.22rem;
}

.portal-notification-item:hover {
    background: #f4f9ff;
    text-decoration: none;
    color: #163149;
}

.portal-notification-item.is-unread {
    background: #eef5ff;
    border-left: 3px solid #2b74c7;
    padding-left: 0.62rem;
}

.portal-notification-item-title {
    font-size: 0.8rem;
    font-weight: 800;
}

.portal-notification-item-message {
    font-size: 0.78rem;
    color: #2f4d68;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.portal-notification-item-meta {
    font-size: 0.7rem;
    color: #6f8297;
}

.portal-topbar--internal-requests {
    background: linear-gradient(110deg, #123553 0%, #1f4b70 100%);
    border-bottom-color: rgba(255, 255, 255, 0.18);
    padding-top: 0.58rem;
    padding-bottom: 0.58rem;
}

.portal-topbar--internal-requests .btn-topbar {
    color: #f0f7ff;
    border-color: rgba(255, 255, 255, 0.26);
    background: rgba(255, 255, 255, 0.08);
}

.portal-topbar--internal-requests .btn-topbar:hover,
.portal-topbar--internal-requests .btn-topbar:focus {
    background: rgba(255, 255, 255, 0.16);
}

.portal-topbar--internal-requests .topbar-kicker {
    display: none;
}

.portal-topbar--internal-requests .topbar-title {
    color: #f5fbff;
    font-size: 1.12rem;
}

.portal-topbar--internal-requests + .portal-content {
    padding-top: 0.65rem;
}

.portal-topbar--internal-requests .module-chip {
    color: #d9ecff;
    background: rgba(255, 255, 255, 0.14);
}

.portal-topbar--internal-requests .portal-notification-badge {
    /* No topbar escuro o botao do sino tem background transparente sobre o
       azul do topbar. Usamos outline sutil com a cor do topbar para dar
       definicao ao badge sem criar contraste estranho. */
    box-shadow:
        0 0 0 2px #1b4066,
        0 1px 2px rgba(0, 0, 0, 0.4);
}

.module-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.35rem 0.62rem;
    border-radius: 999px;
    font-size: 0.72rem;
    color: var(--brand-850);
    background: rgba(31, 140, 127, 0.12);
    font-weight: 700;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.58rem;
    padding: 0.34rem 0.52rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.user-avatar {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand-850);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
}

.user-name {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.1;
    font-weight: 700;
}

.user-role {
    margin: 0;
    font-size: 0.68rem;
    color: var(--muted);
    line-height: 1.1;
}

.portal-content {
    position: relative;
    padding: 1.25rem 1.4rem 1.75rem;
}

.portal-content::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% 0%, rgba(31, 140, 127, 0.08) 0, transparent 36%),
        radial-gradient(circle at 88% 14%, rgba(42, 92, 125, 0.08) 0, transparent 30%);
}

.portal-content > :not(.modal) {
    /* v12.87: `backwards`, nao `both`; e o .modal fica de fora (display:none
       nao anima, e o estado "from" ficaria pendurado nele). Com `both` o ultimo keyframe
       (transform: translateY(0)) ficava aplicado para sempre, e todo filho
       direto virava contexto de empilhamento + referencia de position:fixed:
       qualquer modal do Bootstrap aqui dentro abria ESMAECIDO, por baixo do
       backdrop, sem responder ao clique (agenda 10/09, cancelar NFS-e 11/09).
       O estado final da animacao e' o natural (opacity 1, sem transform), entao
       `backwards` da o mesmo visual e some ao terminar. */
    animation: fade-up-soft 0.34s ease backwards;
}

.flash-stack {
    display: grid;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.alert {
    border: 1px solid transparent;
    border-radius: 12px;
    box-shadow: var(--shadow-card);
}

.alert-info {
    border-color: rgba(42, 92, 125, 0.24);
    background: #eef4fa;
    color: var(--brand-850);
}

.alert-success {
    border-color: rgba(28, 135, 92, 0.26);
    background: #eaf8f1;
    color: #146a45;
}

.alert-warning {
    border-color: rgba(168, 122, 24, 0.34);
    background: #fff8ea;
    color: #876215;
}

.alert-danger {
    border-color: rgba(177, 68, 68, 0.32);
    background: #fdeeee;
    color: #912f2f;
}

.card {
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    background: var(--surface);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-1px);
    box-shadow: 0 9px 24px rgba(18, 41, 64, 0.08);
}

.module-card .card-body {
    padding: 1.25rem;
}

.module-card--in-dev {
    position: relative;
    overflow: hidden;
}

.module-card--in-dev::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    height: 3px;
    width: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        #f59e0b 40%,
        #fbbf24 50%,
        #f59e0b 60%,
        transparent 100%
    );
    animation: module-dev-sweep 2.2s linear infinite;
}

.module-dev-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    background: linear-gradient(
        90deg,
        rgba(245, 158, 11, 0.12) 0%,
        rgba(251, 191, 36, 0.22) 50%,
        rgba(245, 158, 11, 0.12) 100%
    );
    border-bottom: 1px solid rgba(245, 158, 11, 0.35);
    color: #92400e;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.module-dev-spinner {
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    border: 2px solid rgba(146, 64, 14, 0.25);
    border-top-color: #92400e;
    animation: module-dev-spin 0.9s linear infinite;
}

.module-dev-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    animation: module-dev-pulse 1.4s ease-in-out infinite;
}

@keyframes module-dev-sweep {
    0%   { left: -100%; }
    100% { left: 100%; }
}

@keyframes module-dev-spin {
    to { transform: rotate(360deg); }
}

@keyframes module-dev-pulse {
    0%, 100% { opacity: 0.35; transform: scale(0.85); }
    50%      { opacity: 1;    transform: scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
    .module-card--in-dev::before,
    .module-dev-spinner,
    .module-dev-dot {
        animation: none;
    }
}

.module-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.8rem;
    display: grid;
    place-items: center;
    background: rgba(31, 67, 98, 0.1);
    color: var(--brand-850);
    font-size: 1.1rem;
}

.card-header {
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    color: var(--brand-850);
    border-top-left-radius: 16px !important;
    border-top-right-radius: 16px !important;
}

.card-stat {
    border: 1px solid rgba(31, 67, 98, 0.12);
    background: linear-gradient(165deg, #fff 0%, #f8fbff 100%);
}

.card-stat small {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.68rem;
}

.card-stat h4 {
    margin-top: 0.35rem;
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--brand-900);
}

.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.table thead th {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 800;
    border-bottom-color: var(--border);
    background: #f6f9fd;
    vertical-align: middle;
}

.table td,
.table th {
    vertical-align: middle;
    border-color: var(--border);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: #fbfdff;
}

.form-control,
.form-select {
    border-radius: 10px;
    border-color: #cdd8e4;
    padding-top: 0.56rem;
    padding-bottom: 0.56rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #7ba9c9;
    box-shadow: 0 0 0 0.2rem rgba(42, 92, 125, 0.18);
}

.btn {
    border-radius: 10px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--brand-850);
    border-color: var(--brand-850);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--brand-900);
    border-color: var(--brand-900);
}

.btn-outline-secondary,
.btn-outline-dark,
.btn-outline-warning,
.btn-outline-info,
.btn-outline-success,
.btn-outline-primary,
.btn-outline-danger {
    border-width: 1.5px;
}

.rcc-action-btn {
    width: 110px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.85rem;
    white-space: nowrap;
    font-size: 1rem;
    line-height: 1;
}

.rcc-filter-form .form-control,
.rcc-filter-form .form-select {
    min-height: 44px;
}

.rcc-filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.rcc-filter-actions .btn {
    min-width: 108px;
}


.rcc-table-btn {
    min-height: 34px;
    padding: 0.34rem 0.7rem;
    line-height: 1.1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.rcc-table-actions form {
    margin: 0;
}

.page-hero-rcc {
    margin-bottom: 1rem;
}

.card-stat--active {
    border-left: 4px solid #1f5b99;
}

.card-stat--open {
    border-left: 4px solid #f2b705;
}

.card-stat--completed {
    border-left: 4px solid #1f8c7f;
}

.card-stat--inactive {
    border-left: 4px solid #8a97a5;
}

/* KPIs clicaveis na Listagem RCC - os cards <a.card-stat> viram filtros
   rapidos. O estado ".rcc-stat-active" destaca o filtro atualmente
   aplicado e um hover sutil indica que sao interativos. */
a.card-stat {
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
a.card-stat:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(18, 41, 64, 0.12);
    text-decoration: none;
}
a.card-stat.rcc-stat-active {
    outline: 2px solid rgba(31, 91, 153, 0.55);
    outline-offset: -2px;
    box-shadow: 0 6px 16px rgba(18, 41, 64, 0.12);
}

.lucros-entry-table th,
.lucros-entry-table td {
    vertical-align: middle;
    white-space: nowrap;
}

.lucros-table-responsive {
    overflow: visible;
}

.lucros-entry-table thead th {
    position: sticky;
    top: var(--lucros-sticky-top);
    z-index: 11;
    background: #edf3fa;
    color: #35577a;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    border-bottom: 2px solid #ccd9e6;
}

.lucros-entry-table tbody td {
    background: var(--surface);
}

.lucros-entry-table .form-control {
    min-width: 118px;
}

.lucros-entry-table td:first-child .form-control {
    min-width: 260px;
}

.lucros-entry-table td:nth-child(2) .form-control {
    min-width: 150px;
}

.lucros-entry-table td:nth-child(7) .form-control {
    min-width: 145px;
}

.lucros-entry-table .badge {
    font-size: 0.62rem;
    font-weight: 700;
}

.rcc-table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.rcc-company-name {
    max-width: 360px;
    overflow-wrap: anywhere;
}

.rcc-record-row {
    transition: background-color 0.16s ease;
}

.rcc-record-row:hover {
    background: rgba(31, 67, 98, 0.04);
}

.lucros-record-row {
    cursor: pointer;
    transition: background-color 0.16s ease;
}

.lucros-record-row:hover > * {
    --bs-table-accent-bg: #eef5ff;
}

.badge {
    font-weight: 700;
    border-radius: 999px;
    padding: 0.35rem 0.52rem;
}

.list-group-item {
    border-color: var(--border);
    background: transparent;
}

.page-hero {
    border: 1px solid rgba(31, 67, 98, 0.18);
    border-radius: 18px;
    background: linear-gradient(120deg, var(--brand-900) 0%, var(--brand-700) 100%);
    color: #f3f8fd;
    padding: 1.35rem 1.4rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-soft);
}

.page-hero h2,
.page-hero p,
.page-hero small {
    color: inherit;
    margin: 0;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.75rem;
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    padding: 0.82rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    color: var(--brand-900);
    background: var(--surface);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-card);
}

.quick-link:hover {
    transform: translateY(-1px);
    border-color: #a8bfd3;
}

.quick-link i {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 10px;
    background: rgba(31, 67, 98, 0.1);
    display: grid;
    place-items: center;
}

.portal-settings-fab {
    position: fixed;
    right: 1.4rem;
    bottom: 1.25rem;
    z-index: 1015;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.72rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(16, 40, 63, 0.22);
    background: var(--brand-850);
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    box-shadow: 0 14px 28px rgba(18, 41, 64, 0.22);
}

.portal-settings-fab:hover {
    color: #fff;
    background: var(--brand-900);
}

.public-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(280px, 480px) 1fr;
}

.public-brand-panel {
    background: linear-gradient(160deg, var(--brand-900) 0%, #1f4566 100%);
    padding: 2.2rem;
    display: grid;
    place-items: center;
}

.public-brand-card {
    max-width: 340px;
    color: #eef4fb;
}

.public-kicker {
    display: inline-block;
    margin-bottom: 0.85rem;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.public-brand-card h1 {
    color: #fff;
    margin-bottom: 0.8rem;
    font-size: 1.75rem;
    line-height: 1.25;
}

.public-brand-card p {
    color: rgba(237, 245, 252, 0.86);
    margin-bottom: 1rem;
}

.public-meta {
    display: inline-flex;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.13);
    color: rgba(245, 250, 255, 0.95);
    font-size: 0.74rem;
    font-weight: 700;
}

.public-content-panel {
    display: grid;
    place-items: center;
    padding: 1.8rem;
}

.portal-public .public-content-panel .row {
    width: 100%;
}

.portal-public .card {
    width: min(430px, 100%);
}

.history-compact-list {
    display: grid;
    gap: 0.7rem;
}

.history-compact-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-alt);
    padding: 0.78rem 0.86rem;
}

.history-timeline {
    position: relative;
    display: grid;
    gap: 1rem;
}

.history-timeline::before {
    content: "";
    position: absolute;
    top: 0.6rem;
    bottom: 0.6rem;
    left: 11px;
    width: 2px;
    background: linear-gradient(180deg, rgba(31, 67, 98, 0.3), rgba(31, 140, 127, 0.22));
}

.history-timeline-item {
    position: relative;
    padding-left: 2rem;
}

.history-timeline-marker {
    position: absolute;
    left: 0;
    top: 0.35rem;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid #d9ebeb;
    background: var(--accent-600);
    box-shadow: 0 0 0 4px rgba(31, 140, 127, 0.14);
}

.history-timeline-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-alt);
    padding: 0.92rem 0.96rem;
}

.history-summary-grid {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.history-summary-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 0.52rem 0.58rem;
    display: grid;
    gap: 0.2rem;
}

.history-summary-item small {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.66rem;
}

.history-summary-item strong {
    font-size: 0.88rem;
    color: var(--brand-900);
}

.history-list-events {
    display: grid;
    gap: 0.45rem;
}

.history-list-event {
    border: 1px dashed #c8d7e7;
    background: #fff;
    border-radius: 10px;
    padding: 0.5rem 0.62rem;
    font-size: 0.84rem;
    color: var(--brand-900);
}

.rcc-tax-sections {
    display: grid;
    gap: 0.85rem;
}

.rcc-tax-panel {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-alt);
    padding: 0.85rem 0.95rem;
}

.rcc-tax-group {
    min-height: 100%;
}

.rcc-tax-title {
    margin: 0 0 0.7rem;
    font-size: 0.78rem;
    color: var(--brand-850);
    letter-spacing: 0.09em;
    text-transform: uppercase;
    font-weight: 800;
}

.rcc-tax-panel .form-check {
    margin-bottom: 0;
}

.rcc-tax-panel .form-check-label {
    font-size: 0.88rem;
    font-weight: 600;
}

.rcc-tax-panel .form-label {
    margin-bottom: 0.22rem;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 700;
}

.upload-dropzone {
    border: 2px dashed #b9cadb;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    text-align: center;
    background: #f8fbff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-dropzone i {
    font-size: 1.55rem;
    color: var(--brand-700);
    display: block;
    margin-bottom: 0.35rem;
}

.upload-dropzone:hover,
.upload-dropzone.is-dragover {
    border-color: var(--accent-600);
    background: rgba(31, 140, 127, 0.08);
}

.upload-dropzone.has-files {
    padding: 0.62rem 0.78rem;
    text-align: left;
    background: #f2f8ff;
    border-style: solid;
}

.upload-dropzone.has-files .upload-dropzone-content {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.upload-dropzone.has-files i {
    margin-bottom: 0;
    font-size: 1.05rem;
}

.upload-dropzone.has-files .upload-dropzone-title {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.upload-dropzone.has-files .upload-dropzone-hint {
    display: block;
    margin-left: auto;
    font-size: 0.76rem;
}

.internal-message-list {
    display: grid;
    gap: 0.6rem;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.internal-message-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-alt);
    padding: 0.75rem 0.85rem;
}

.internal-message-item.is-internal {
    border-color: rgba(168, 122, 24, 0.28);
    background: #fff8ea;
}

.kanban-toolbar {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    padding: 0.5rem 0.6rem;
    border: 1px solid #d6e0ea;
    border-radius: 14px;
    background: linear-gradient(180deg, #edf2f7 0%, #e6edf5 100%);
}

.kanban-toolbar .btn-outline-secondary {
    background: #eef3f8;
    border-color: #c5d2e0;
    color: #4a627b;
}

.kanban-toolbar .btn-outline-secondary:hover,
.kanban-toolbar .btn-outline-secondary:focus {
    background: #e2ebf5;
    border-color: #afc0d2;
    color: #2f4c68;
}

.kanban-layout-toggle {
    margin-left: auto;
}

.kanban-search-form {
    flex: 1 1 320px;
    max-width: 540px;
    min-width: 240px;
}

.kanban-search-form .input-group-text {
    background: #eef3f8;
    border-color: #c5d2e0;
    color: #4a627b;
}

.kanban-search-form .form-control {
    border-color: #c5d2e0;
    background: #f8fbff;
}

.kanban-search-form .form-control:focus {
    border-color: #8aa9c6;
    box-shadow: 0 0 0 0.18rem rgba(49, 112, 177, 0.15);
}

.kanban-notices {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.kanban-notice {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    padding: 0.65rem 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    box-shadow: 0 4px 14px rgba(18, 41, 64, 0.06);
}

.kanban-notice.is-new {
    border-color: rgba(31, 67, 98, 0.25);
    background: linear-gradient(150deg, #f4f9ff 0%, #ffffff 100%);
}

.kanban-notice.is-done {
    border-color: rgba(28, 135, 92, 0.28);
    background: linear-gradient(150deg, #ecfbf4 0%, #ffffff 100%);
}

.kanban-notice.is-canceled {
    border-color: rgba(177, 68, 68, 0.28);
    background: linear-gradient(150deg, #fff4f4 0%, #ffffff 100%);
}

.kanban-notice-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: var(--brand-850);
    background: rgba(31, 67, 98, 0.12);
}

.kanban-notice-content {
    min-width: 0;
    flex: 1 1 auto;
}

.kanban-notice-content p {
    margin: 0;
}

.internal-kanban {
    display: grid;
    /* v5.31: gap minimo entre colunas pra caber mais coluna na tela. */
    gap: 0.3rem;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(290px, 290px);
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.35rem;
    min-height: 0;
}

/* v5.31/v5.32: layout compacto so na pagina do Kanban (body.kanban-compact-
   layout). Encolhe a sidebar pra sobrar mais espaco horizontal pro quadro -
   sem afetar outros modulos. :not(.sidebar-collapsed) garante que quando o
   user recolhe a sidebar o estado colapsado (92px) prevalece em vez do nosso
   230px. */
body.kanban-compact-layout:not(.sidebar-collapsed) .portal-sidebar {
    width: 230px;
}
body.kanban-compact-layout:not(.sidebar-collapsed) .portal-main {
    margin-left: 230px;
}

.internal-kanban:not(.kanban-layout-vertical) .kanban-column {
    inline-size: var(--kanban-column-width, 290px);
    width: var(--kanban-column-width, 290px);
    min-width: var(--kanban-column-width, 290px);
    max-width: var(--kanban-column-width, 290px);
    height: 100%;
    min-height: 0;
    max-height: none;
}

.internal-kanban:not(.kanban-layout-vertical) {
    grid-auto-columns: var(--kanban-column-width, 290px);
}

.internal-kanban .kanban-column {
    inline-size: 290px;
    width: 290px;
    min-width: 290px;
    max-width: 290px;
    justify-self: start;
}

.internal-kanban.kanban-layout-vertical {
    grid-auto-flow: row;
    grid-auto-columns: minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr);
    justify-content: start;
    justify-items: start;
    overflow-x: hidden;
    overflow-y: auto;
}

.internal-kanban.kanban-layout-vertical .kanban-column {
    inline-size: auto;
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 7cm;
    min-height: 7cm;
    max-height: 7cm;
}

.internal-kanban.kanban-layout-vertical .kanban-column-body {
    display: flex;
    flex-wrap: nowrap;
    align-content: flex-start;
    align-items: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
}

.internal-kanban.kanban-layout-vertical .kanban-card {
    flex: 0 0 calc(290px - 1.24rem);
    width: calc(290px - 1.24rem);
    height: auto;
    align-self: flex-start;
}

.internal-kanban.kanban-layout-vertical .kanban-add-task {
    flex: 0 0 calc(290px - 1.24rem);
    width: calc(290px - 1.24rem);
    white-space: nowrap;
}

.modern-kanban .kanban-column {
    border: 1px solid #d2dde8;
    border-radius: 16px;
    height: clamp(500px, 74vh, 820px);
    min-height: 500px;
    display: flex;
    flex-direction: column;
    background: var(--kanban-column-bg, #f8fbff);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.modern-kanban .kanban-column[data-status="nova"] {
    background: var(--kanban-column-bg, #f3f4f7) !important;
    border-color: #d7dce4;
}

.modern-kanban .kanban-column[data-status="em_analise"] {
    background: var(--kanban-column-bg, #f5eef9) !important;
    border-color: #decbe9;
}

.modern-kanban .kanban-column[data-status="em_andamento"] {
    background: var(--kanban-column-bg, #fdf1e8) !important;
    border-color: #efd3bf;
}

.modern-kanban .kanban-column[data-status="aguardando_usuario"] {
    background: var(--kanban-column-bg, #edf4fd) !important;
    border-color: #cddff3;
}

.modern-kanban .kanban-column[data-status="aguardando_terceiro"] {
    background: var(--kanban-column-bg, #fbf3de) !important;
    border-color: #ead8ab;
}

.modern-kanban .kanban-column[data-status="concluida"] {
    background: var(--kanban-column-bg, #edf5f1) !important;
    border-color: #cbddd3;
}

.modern-kanban .kanban-column[data-status="cancelada"] {
    background: var(--kanban-column-bg, #eef2f2) !important;
    border-color: #d0dbdb;
}

.modern-kanban .kanban-column-header {
    border-bottom: 1px solid rgba(18, 41, 64, 0.12);
    padding: 0.52rem 0.64rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.35rem;
}

.kanban-column-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.34rem;
    padding: 0.2rem 0.5rem;
    border-radius: 9px;
    border: 1px solid rgba(18, 41, 64, 0.14);
    background: rgba(255, 255, 255, 0.78);
    max-width: calc(100% - 2.2rem);
    flex: 1 1 auto;
    min-width: 0;
}

.internal-kanban.kanban-layout-vertical .kanban-column-header {
    justify-content: center;
    position: relative;
}

.internal-kanban.kanban-layout-vertical .kanban-column-title-wrap {
    flex: 0 0 auto;
    width: auto;
    max-width: fit-content;
    margin-inline: auto;
    padding: 0.16rem 0.56rem;
}

.internal-kanban.kanban-layout-vertical .kanban-column-header h3 {
    text-align: center;
}

.internal-kanban.kanban-layout-vertical .kanban-count {
    position: absolute;
    right: 0.64rem;
    top: 50%;
    transform: translateY(-50%);
}

.modern-kanban .kanban-column[data-status="nova"] .kanban-column-title-wrap {
    background: #eceef2;
}

.modern-kanban .kanban-column[data-status="em_analise"] .kanban-column-title-wrap {
    background: #a32ecf;
    border-color: rgba(255, 255, 255, 0.28);
}

.modern-kanban .kanban-column[data-status="em_andamento"] .kanban-column-title-wrap {
    background: #f36a06;
    border-color: rgba(255, 255, 255, 0.28);
}

.modern-kanban .kanban-column[data-status="aguardando_usuario"] .kanban-column-title-wrap {
    background: #1f84dc;
    border-color: rgba(255, 255, 255, 0.28);
}

.modern-kanban .kanban-column[data-status="aguardando_terceiro"] .kanban-column-title-wrap {
    background: #f2bf28;
}

.modern-kanban .kanban-column[data-status="concluida"] .kanban-column-title-wrap {
    background: #2f9f69;
    border-color: rgba(255, 255, 255, 0.28);
}

.modern-kanban .kanban-column[data-status="cancelada"] .kanban-column-title-wrap {
    background: #5f6f73;
    border-color: rgba(255, 255, 255, 0.28);
}

.modern-kanban .kanban-column[data-status="em_analise"] .kanban-column-header h3,
.modern-kanban .kanban-column[data-status="em_andamento"] .kanban-column-header h3,
.modern-kanban .kanban-column[data-status="aguardando_usuario"] .kanban-column-header h3,
.modern-kanban .kanban-column[data-status="concluida"] .kanban-column-header h3,
.modern-kanban .kanban-column[data-status="cancelada"] .kanban-column-header h3 {
    color: #ffffff;
}

.modern-kanban .kanban-column-header h3 {
    font-size: 0.84rem;
    margin: 0;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #233e5a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #68778a;
    border: 1px solid rgba(18, 41, 64, 0.18);
}

.kanban-count {
    font-size: 0.82rem;
    font-weight: 900;
    color: #2b4560;
    flex: 0 0 auto;
}

.kanban-add-task {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.34rem;
    width: 100%;
    min-height: 46px;
    margin-top: 0.1rem;
    padding: 0.55rem 0.75rem;
    border: 1px dashed currentColor;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.62);
    color: #1f5b99;
    font-weight: 800;
    font-size: 1rem;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.kanban-add-task:hover {
    background: rgba(255, 255, 255, 0.88);
    border-color: currentColor;
    color: #16497e;
    text-decoration: none;
    transform: translateY(-1px);
}

.modern-kanban .kanban-column[data-status="em_analise"] .kanban-add-task {
    color: #8d3ac2;
}

.modern-kanban .kanban-column[data-status="em_andamento"] .kanban-add-task {
    color: #de6d0b;
}

.modern-kanban .kanban-column[data-status="aguardando_usuario"] .kanban-add-task {
    color: #207be0;
}

.modern-kanban .kanban-column[data-status="aguardando_terceiro"] .kanban-add-task {
    color: #c9930a;
}

.modern-kanban .kanban-column[data-status="concluida"] .kanban-add-task {
    color: #1f8c5f;
}

.modern-kanban .kanban-column[data-status="cancelada"] .kanban-add-task {
    color: #5f6f73;
}

.modern-kanban .kanban-column-body {
    display: grid;
    /* v5.30: força o track a 1fr com min 0 - senao o grid implicito usa
       'auto' (= max-content) e os cards expandem ate caber o texto sem
       quebrar, transbordando os 290px da coluna e cortando o conteudo.
       Scoped em .modern-kanban (so o kanban das Solicitacoes Internas). */
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 0.55rem;
    padding: 0.62rem;
    flex: 1 1 auto;
    overflow: auto;
    transition: background-color 0.18s ease;
}

.modern-kanban .kanban-column-body.is-drop-target {
    background: rgba(31, 140, 127, 0.14);
    outline: 2px dashed rgba(31, 140, 127, 0.45);
    outline-offset: -8px;
}

.modern-kanban .kanban-column.is-drop-target {
    border-color: rgba(31, 140, 127, 0.72);
    box-shadow: 0 0 0 3px rgba(31, 140, 127, 0.18);
    transform: translateY(-1px);
}

.modern-kanban .kanban-card {
    border: 1px solid #d4dde7;
    border-radius: 12px;
    background: #ffffff !important;
    padding: 0.68rem 0.7rem;
    font-size: 0.93rem;
    color: #23384c;
    box-shadow: 0 3px 10px rgba(18, 41, 64, 0.06);
    transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
    cursor: pointer;
}

.modern-kanban .kanban-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 7px 14px rgba(18, 41, 64, 0.09);
}

.modern-kanban .kanban-card.is-unread {
    border-color: rgba(31, 91, 153, 0.45);
    box-shadow: 0 0 0 2px rgba(31, 91, 153, 0.12), 0 6px 14px rgba(18, 41, 64, 0.08);
}

.modern-kanban .kanban-card.is-dragging {
    opacity: 0.65;
    transform: scale(0.99);
}

.kanban-card-number {
    display: inline-flex;
    align-items: center;
    padding: 0.16rem 0.58rem;
    border-radius: 999px;
    border: 1px solid #c9d7e6;
    background: #eef3f9;
    font-size: 0.84rem;
    color: #17324a;
    font-weight: 800;
}

.modern-kanban .kanban-card .text-truncate-3 {
    font-size: 0.89rem;
    line-height: 1.35;
    color: #1f3347;
}

.kanban-unread-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.12rem 0.5rem;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #1f5b99;
    background: rgba(31, 91, 153, 0.12);
    border: 1px solid rgba(31, 91, 153, 0.22);
}

.kanban-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.45rem;
}

.kanban-card-tags .badge.text-bg-light {
    border: 1px solid #d2deea;
    color: #34506d;
}

.kanban-card-meta {
    display: grid;
    gap: 0.2rem;
    font-size: 0.74rem;
    color: #40576d;
}

.kanban-card-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.kanban-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    min-width: 0;
    max-width: 100%;
}

.kanban-user-avatar {
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--kanban-user-avatar-bg, #5b2a5d);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    flex: 0 0 auto;
}

.kanban-user-name {
    font-size: 0.78rem;
    color: #1f3347;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-card-datetime {
    font-size: 0.78rem;
    color: #1f3347;
    font-weight: 700;
    white-space: nowrap;
}

.kanban-card-meta > .text-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.kanban-empty {
    border: 1px dashed #c7d5e4;
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.84rem;
    background: rgba(255, 255, 255, 0.72);
}

.kanban-theme-neutral {
    background: #f2f5f8;
}

.kanban-theme-analysis {
    background: #f5eefb;
}

.kanban-theme-progress {
    background: #fff2e8;
}

.kanban-theme-waiting-user {
    background: #ecf4ff;
}

.kanban-theme-waiting-third {
    background: #fff7e5;
}

.kanban-theme-done {
    background: #ecf8f1;
}

.kanban-theme-closed {
    background: #ecf1f1;
}

.kanban-theme-neutral .kanban-status-dot {
    background: #7d8796;
}

.kanban-theme-analysis .kanban-status-dot {
    background: #8d3ac2;
}

.kanban-theme-progress .kanban-status-dot {
    background: #de6d0b;
}

.kanban-theme-waiting-user .kanban-status-dot {
    background: #207be0;
}

.kanban-theme-waiting-third .kanban-status-dot {
    background: #c9930a;
}

.kanban-theme-done .kanban-status-dot {
    background: #1f8c5f;
}

.kanban-theme-closed .kanban-status-dot {
    background: #5f6f73;
}

.kanban-move-feedback {
    position: fixed;
    right: 1.1rem;
    bottom: 1rem;
    z-index: 1080;
    background: #163553;
    color: #fff;
    border-radius: 10px;
    padding: 0.56rem 0.82rem;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 12px 22px rgba(18, 41, 64, 0.22);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: all 0.2s ease;
}

.kanban-move-feedback.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.kanban-move-feedback.is-error {
    background: #8f2f2f;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow: hidden;
}

.kanban-columns-grid {
    display: grid;
    gap: 0.75rem;
}

.kanban-column-editor {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-alt);
    padding: 0.85rem 0.9rem;
}

.kanban-preset-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
}

.kanban-preset-swatch {
    display: inline-flex;
    align-items: center;
    gap: 0.18rem;
}

.kanban-preset-swatch span {
    width: 13px;
    height: 13px;
    border-radius: 4px;
    border: 1px solid rgba(18, 41, 64, 0.16);
    display: inline-block;
}

.sidebar-collapsed .portal-sidebar {
    width: 92px;
}

.sidebar-collapsed .portal-main {
    margin-left: 92px;
}

.sidebar-collapsed .brand-text,
.sidebar-collapsed .sidebar-section-title,
.sidebar-collapsed .module-label span,
.sidebar-collapsed .sidebar-link span,
.sidebar-collapsed .sidebar-settings-link span,
.sidebar-collapsed .sidebar-footer-link span,
.sidebar-collapsed .future-module-list span,
.sidebar-collapsed .badge-soft {
    display: none;
}

.sidebar-collapsed .future-module-list li,
.sidebar-collapsed .module-label,
.sidebar-collapsed .sidebar-link,
.sidebar-collapsed .sidebar-settings-link,
.sidebar-collapsed .sidebar-footer-link {
    justify-content: center;
}

.sidebar-collapsed .module-label,
.sidebar-collapsed .sidebar-link,
.sidebar-collapsed .sidebar-settings-link,
.sidebar-collapsed .sidebar-footer-link {
    padding-left: 0;
    padding-right: 0;
}

.sidebar-collapsed .future-module-list li {
    grid-template-columns: 1fr;
}

@media (max-width: 1199px) {
    .topbar-right .module-chip {
        display: none;
    }
}

@media (max-width: 991.98px) {
    html {
        scroll-padding-top: 90px;
    }

    .portal-content section[id] {
        scroll-margin-top: 90px;
    }

    .portal-sidebar {
        transform: translateX(-100%);
        width: 286px;
    }

    .portal-main {
        margin-left: 0;
    }

    .sidebar-collapsed .portal-sidebar {
        width: 286px;
    }

    .sidebar-collapsed .brand-text,
    .sidebar-collapsed .sidebar-section-title {
        display: block;
    }

    .sidebar-collapsed .module-label span,
    .sidebar-collapsed .sidebar-link span,
    .sidebar-collapsed .sidebar-settings-link span,
    .sidebar-collapsed .sidebar-footer-link span,
    .sidebar-collapsed .future-module-list span {
        display: inline;
    }

    .sidebar-collapsed .badge-soft {
        display: inline-flex;
    }

    .sidebar-collapsed .future-module-list li {
        grid-template-columns: 16px 1fr auto;
    }

    .sidebar-collapsed .future-module-list li,
    .sidebar-collapsed .module-label,
    .sidebar-collapsed .sidebar-link,
    .sidebar-collapsed .sidebar-settings-link,
    .sidebar-collapsed .sidebar-footer-link {
        justify-content: flex-start;
    }

    .sidebar-collapsed .module-label,
    .sidebar-collapsed .sidebar-link,
    .sidebar-collapsed .sidebar-settings-link,
    .sidebar-collapsed .sidebar-footer-link {
        padding-left: 0.72rem;
        padding-right: 0.72rem;
    }

    .sidebar-open .portal-sidebar {
        transform: translateX(0);
    }

    .sidebar-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    .public-shell {
        grid-template-columns: 1fr;
    }

    .public-brand-panel {
        display: none;
    }

    .topbar-right .user-pill {
        display: none;
    }

    .portal-topbar,
    .portal-content {
        padding-left: 0.95rem;
        padding-right: 0.95rem;
    }

    .portal-settings-fab {
        right: 1rem;
        bottom: 0.9rem;
    }
}

@media (max-width: 575.98px) {
    .topbar-title {
        font-size: 1rem;
    }

    .btn-outline-secondary.btn-sm {
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }

    .rcc-tax-panel {
        padding: 0.7rem 0.75rem;
    }

    .rcc-action-btn {
        width: auto;
        min-width: 98px;
        height: 40px;
        font-size: 0.92rem;
    }

    .rcc-filter-actions .btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
    }
}

@media (max-width: 1199.98px) {
    .rcc-company-name {
        max-width: 260px;
    }
}

@media (max-width: 767.98px) {
    .rcc-company-name {
        max-width: 100%;
    }
}

@media (max-width: 991.98px) {
    .lucros-table-responsive {
        overflow-x: auto;
        overflow-y: visible;
    }

    .lucros-entry-table thead th {
        position: static;
    }

    .internal-kanban {
        grid-template-columns: repeat(7, minmax(230px, 1fr));
    }

    .kanban-search-form {
        max-width: none;
        min-width: 0;
        flex: 1 1 100%;
    }

    .kanban-layout-toggle {
        margin-left: 0;
    }
}

/* ========================================================================
   DCTFWeb - Stepper + Timeline
   ======================================================================== */

/* Stepper horizontal: estados done | current | pending */
.dctfweb-stepper {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow-x: auto;
    box-shadow: var(--shadow-card);
}
.dctfweb-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 82px;
    flex: 0 0 auto;
    text-align: center;
}
.dctfweb-step__icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.05rem;
    background: #e9eef3;
    color: #64748b;
    border: 2px solid #e1e7ec;
    transition: all 0.2s ease;
}
.dctfweb-step__label {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 600;
    white-space: nowrap;
}
.dctfweb-step--done .dctfweb-step__icon {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}
.dctfweb-step--done .dctfweb-step__label { color: #166534; }
.dctfweb-step--current .dctfweb-step__icon {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
    animation: dctfweb-pulse 1.6s infinite ease-in-out;
}
.dctfweb-step--current .dctfweb-step__label { color: #1e3a8a; }
.dctfweb-step__sep {
    flex: 1 1 auto;
    min-width: 18px;
    height: 3px;
    border-radius: 3px;
    background: #e1e7ec;
}
.dctfweb-step__sep--done { background: #16a34a; }

@keyframes dctfweb-pulse {
    0%,100% { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18); }
    50%     { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.08); }
}

/* Timeline vertical usada em transmissao_detalhe */
.dctfweb-timeline {
    position: relative;
    padding-left: 0;
}
.dctfweb-timeline::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 18px;
    width: 2px;
    background: var(--border);
    border-radius: 2px;
}
.dctfweb-timeline__item {
    position: relative;
    padding: 0 0 1.1rem 48px;
}
.dctfweb-timeline__item:last-child { padding-bottom: 0; }
.dctfweb-timeline__marker {
    position: absolute;
    left: 0;
    top: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e9eef3;
    color: #64748b;
    display: grid;
    place-items: center;
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 2px var(--border);
    z-index: 1;
}
.dctfweb-timeline__item--success .dctfweb-timeline__marker { background: #dcfce7; color: #166534; box-shadow: 0 0 0 2px #86efac; }
.dctfweb-timeline__item--info    .dctfweb-timeline__marker { background: #dbeafe; color: #1e3a8a; box-shadow: 0 0 0 2px #93c5fd; }
.dctfweb-timeline__item--danger  .dctfweb-timeline__marker { background: #fee2e2; color: #7f1d1d; box-shadow: 0 0 0 2px #fca5a5; }
.dctfweb-timeline__item--neutral .dctfweb-timeline__marker { background: #e9eef3; color: #475569; box-shadow: 0 0 0 2px var(--border); }
.dctfweb-timeline__content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem 0.8rem;
}
.dctfweb-timeline__head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: 2px;
}
.dctfweb-timeline__body {
    color: #334155;
    word-break: break-word;
}
.dctfweb-timeline__body code {
    word-break: break-all;
}

/* Responsivo: stepper scroll em telas pequenas */
@media (max-width: 576px) {
    .dctfweb-step { min-width: 70px; }
    .dctfweb-step__icon { width: 32px; height: 32px; font-size: 0.9rem; }
    .dctfweb-step__label { font-size: 0.7rem; }
    .dctfweb-timeline__item { padding-left: 42px; }
    .dctfweb-timeline::before { left: 16px; }
    .dctfweb-timeline__marker { width: 34px; height: 34px; }
}

/* ========================================================================
   Solicitacoes Internas - Dashboard (KPIs, donut, barras horizontais)
   ======================================================================== */

/* KPI cards coloridos */
.ir-kpi {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.1rem;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    height: 100%;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ir-kpi:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(18, 41, 64, 0.1);
}
.ir-kpi__icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    flex: 0 0 auto;
}
.ir-kpi__body { min-width: 0; flex: 1 1 auto; }
.ir-kpi__label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.02em;
    line-height: 1.2;
    margin-bottom: 0.15rem;
}
.ir-kpi__value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--brand-900);
    line-height: 1.05;
}
.ir-kpi__hint {
    display: block;
    color: #64748b;
    font-size: 0.72rem;
    margin-top: 0.15rem;
}
.ir-kpi__hint a { color: inherit; }

/* Variantes por tom (icon background + accent na borda esquerda) */
.ir-kpi--primary .ir-kpi__icon { background: rgba(37, 99, 235, 0.12); color: #2563eb; }
.ir-kpi--primary { border-left: 4px solid #2563eb; }

.ir-kpi--info .ir-kpi__icon    { background: rgba(14, 165, 233, 0.12); color: #0ea5e9; }
.ir-kpi--info    { border-left: 4px solid #0ea5e9; }

.ir-kpi--success .ir-kpi__icon { background: rgba(22, 163, 74, 0.12); color: #16a34a; }
.ir-kpi--success { border-left: 4px solid #16a34a; }

.ir-kpi--warning .ir-kpi__icon { background: rgba(234, 179, 8, 0.14); color: #b45309; }
.ir-kpi--warning { border-left: 4px solid #eab308; }

.ir-kpi--danger .ir-kpi__icon  { background: rgba(220, 38, 38, 0.12); color: #dc2626; }
.ir-kpi--danger  { border-left: 4px solid #dc2626; }

.ir-kpi--neutral .ir-kpi__icon { background: #e9eef3; color: #64748b; }
.ir-kpi--neutral { border-left: 4px solid #cbd5e1; }

/* Variante "compact" (KPIs secundarios, sem hint) */
.ir-kpi--compact {
    padding: 0.75rem 0.9rem;
    gap: 0.7rem;
}
.ir-kpi--compact .ir-kpi__icon { width: 36px; height: 36px; font-size: 1.05rem; border-radius: 10px; }
.ir-kpi--compact .ir-kpi__value { font-size: 1.4rem; }

/* Donut chart (conic-gradient + hole) */
.ir-donut-wrap {
    display: grid;
    place-items: center;
    padding: 0.75rem 0;
}
.ir-donut {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
}
.ir-donut__hole {
    position: absolute;
    inset: 18%;
    background: var(--surface);
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
    text-align: center;
}
.ir-donut__value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--brand-900);
    line-height: 1;
}
.ir-donut__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.03em;
    margin-top: 0.15rem;
}

/* Legenda do donut */
.ir-legend {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
}
.ir-legend li {
    display: grid;
    grid-template-columns: 10px 1fr auto auto;
    gap: 8px;
    align-items: center;
    font-size: 0.82rem;
    padding: 2px 0;
}
.ir-legend__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.ir-legend__label { color: #334155; }
.ir-legend__count { font-weight: 700; color: var(--brand-900); }
.ir-legend__pct {
    color: #64748b;
    min-width: 36px;
    text-align: right;
}

/* Barras horizontais simples */
.ir-bars {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}
.ir-bars__label {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 0.82rem;
    color: #334155;
    margin-bottom: 3px;
    min-width: 0;
}
.ir-bars__label .text-truncate {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ir-bars__count {
    margin-left: auto;
    font-weight: 700;
    color: var(--brand-900);
    flex: 0 0 auto;
}
.ir-bars__track {
    height: 8px;
    border-radius: 4px;
    background: #e9eef3;
    overflow: hidden;
}
.ir-bars__fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.25s ease;
}

/* Responsivo: mobile */
@media (max-width: 576px) {
    .ir-kpi { padding: 0.85rem; gap: 0.7rem; }
    .ir-kpi__icon { width: 40px; height: 40px; font-size: 1.15rem; }
    .ir-kpi__value { font-size: 1.5rem; }
    .ir-donut { width: 140px; height: 140px; }
    .ir-donut__value { font-size: 1.5rem; }
}

/* ==========================================================================
   RCC - tela de detalhe (v10.47)
   Escopo restrito a .rcc-detail-*: nao altera card/badge de outros modulos.
   Antes a tela era toda branca com "Rotulo: valor" corrido, sem separacao
   entre os blocos - com 60+ campos ficava impossivel achar informacao.
   ========================================================================== */
.rcc-detail-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    margin-bottom: 1rem;
    background: var(--surface);
}

.rcc-detail-card > .rcc-detail-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem 1rem;
    background: linear-gradient(90deg, var(--brand-800), var(--brand-700));
    color: #fff;
    font-weight: 600;
    font-size: .95rem;
    letter-spacing: .01em;
}

.rcc-detail-head .bi {
    opacity: .85;
}

.rcc-detail-body {
    padding: 1rem;
}

/* Campo: rotulo pequeno em cima, valor destacado embaixo. Muito mais legivel
   que "Rotulo: valor" na mesma linha quando sao dezenas de campos. */
.rcc-detail-field {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .5rem .7rem;
    height: 100%;
}

.rcc-detail-field .rcc-detail-label {
    display: block;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    margin-bottom: .15rem;
}

.rcc-detail-field .rcc-detail-value {
    font-size: .92rem;
    color: var(--text);
    word-break: break-word;
}

.rcc-detail-field.is-empty .rcc-detail-value {
    color: #a9b4c0;
}

/* Texto longo (coleta de dados, observacoes): preserva as quebras de linha. */
.rcc-detail-field.is-long .rcc-detail-value {
    white-space: pre-wrap;
}

/* Ficha do socio dentro da secao 5. */
.rcc-detail-partner {
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand-700);
    border-radius: 10px;
    padding: .85rem;
    background: var(--surface);
}

.rcc-detail-partner + .rcc-detail-partner {
    margin-top: .85rem;
}

.rcc-detail-partner.is-company {
    border-left-color: var(--accent-600);
}

.rcc-detail-partner-name {
    font-weight: 600;
    color: var(--brand-800);
    margin-bottom: .6rem;
}

/* Marcadores de checkbox (alvaras, ISS/MEI). */
.rcc-detail-mark {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .8rem;
    border: 1px solid var(--border);
}

.rcc-detail-mark.is-on {
    background: rgba(31, 140, 127, .12);
    border-color: rgba(31, 140, 127, .35);
    color: var(--accent-700);
    font-weight: 600;
}

.rcc-detail-mark.is-off {
    background: var(--surface-alt);
    color: #a0abb8;
}

/* RCC - linha nao visualizada na listagem (v10.55).
   Mesma fonte do contador do menu: RCC incluida/alterada que este usuario
   ainda nao abriu. Escopo em .rcc-* para nao afetar tabela de outro modulo. */
.rcc-record-row.rcc-row-unread {
    background: #fffdf5;
    box-shadow: inset 3px 0 0 #d92d20;
}

.rcc-record-row.rcc-row-unread:hover {
    background: #fff9e8;
}

.rcc-record-row.rcc-row-unread .rcc-company-name {
    font-weight: 700;
}

/* Bolinha ao lado do numero do RCC. */
.rcc-unread-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    margin-left: 0.35rem;
    border-radius: 50%;
    background: #d92d20;
    vertical-align: middle;
}

/* Etiqueta ao lado do nome da empresa. */
.rcc-unread-tag {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: #d92d20;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    vertical-align: middle;
}

/* ==========================================================================
   v13.57 — Menu lateral no visual novo (modelo enviado pelo usuário em
   25/09/2026): ícone em quadrado colorido por módulo, item ativo na faixa da
   seleção (v13.62: a mesma em todo o menu), engrenagem e cartão do usuário
   no rodapé. Tudo preso a .portal-sidebar (as classes só existem no menu).
   A cor vem de data-modulo (mesma chave de menu_modulos.MODULOS_MENU) e da
   paleta única logo abaixo (v13.59), a mesma dos cartões da tela inicial.
   ========================================================================== */
.portal-sidebar {
    --sb-texto: #e8f0fc;
    --sb-texto-suave: rgba(206, 222, 245, 0.62);
    --sb-linha: rgba(255, 255, 255, 0.09);
    --sb-hover: rgba(255, 255, 255, 0.06);
    /* v13.62: UMA seleção no menu inteiro — a de dentro dos módulos (cor da Central
       de Notas, v13.60), também no Home e no Configurações do rodapé. O azul
       translúcido (v13.57) e o verde da logo (v13.61) foram recusados. */
    --sb-selecao: linear-gradient(90deg, #0c4a6e 0%, #0c4a6e 45%, #1e3a8a 100%);
    --sb-selecao-sombra: 0 4px 12px rgba(3, 12, 30, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    --sb-fundo-fim: #0a1b35;
    --portal-c1: #64748b;
    --portal-c2: #334155;
    background: linear-gradient(180deg, #0d2446 0%, var(--sb-fundo-fim) 100%);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.portal-sidebar::-webkit-scrollbar { width: 6px; }
.portal-sidebar::-webkit-scrollbar-track { background: transparent; }
.portal-sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 6px; }

/* v13.59 — PALETA ÚNICA DOS MÓDULOS (pedido do usuário: "tudo na mesma paleta
   das cores do menu central"). A cor de cada módulo mora SÓ aqui e vale para o
   cartão da tela inicial (data-accent, portal/home.html) e o quadrado da lista
   do menu (data-modulo). As cores são as que os cartões já usavam. Módulo novo:
   uma linha aqui. A seleção de dentro do módulo NÃO usa esta paleta (v13.60). */
.module-card[data-accent="internal_requests"], .portal-sidebar [data-modulo="internal_requests"] { --portal-c1: #3b82f6; --portal-c2: #1e40af; }
.module-card[data-accent="cadastro_clientes"], .portal-sidebar [data-modulo="cadastro_clientes"] { --portal-c1: #475569; --portal-c2: #1e293b; }
.module-card[data-accent="nfsync"],            .portal-sidebar [data-modulo="nfsync"]            { --portal-c1: #1e3a8a; --portal-c2: #0c4a6e; }
.module-card[data-accent="rcc"],               .portal-sidebar [data-modulo="rcc"]               { --portal-c1: #10b981; --portal-c2: #047857; }
.module-card[data-accent="lucros"],            .portal-sidebar [data-modulo="lucros"]            { --portal-c1: #f59e0b; --portal-c2: #d97706; }
.module-card[data-accent="tributaria"],        .portal-sidebar [data-modulo="tributaria"]        { --portal-c1: #8b5cf6; --portal-c2: #6d28d9; }
.module-card[data-accent="noticias"],          .portal-sidebar [data-modulo="noticias"]          { --portal-c1: #6366f1; --portal-c2: #4338ca; }
.module-card[data-accent="agenda"],            .portal-sidebar [data-modulo="agenda"]            { --portal-c1: #ec4899; --portal-c2: #be185d; }
.module-card[data-accent="dctfweb"],           .portal-sidebar [data-modulo="dctfweb"]           { --portal-c1: #ef4444; --portal-c2: #b91c1c; }
.module-card[data-accent="reports"],           .portal-sidebar [data-modulo="reports"]           { --portal-c1: #06b6d4; --portal-c2: #0891b2; }
.module-card[data-accent="zen"],               .portal-sidebar [data-modulo="zen"]               { --portal-c1: #14b8a6; --portal-c2: #0f766e; }
.module-card[data-accent="tax_xml"],           .portal-sidebar [data-modulo="tax_xml"]           { --portal-c1: #64748b; --portal-c2: #334155; }
.module-card[data-accent="utilidades"],        .portal-sidebar [data-modulo="utilidades"]        { --portal-c1: #0ea5e9; --portal-c2: #0369a1; }
/* só do menu: quadrado da casinha do Home no verde da logo (v13.62, opção escolhida
   pelo usuário entre vidro, azul e verde). Dentro do módulo ela fica sem quadrado,
   como os demais itens de lá (regra do bloco v13.58). */
.portal-sidebar [data-modulo="home"] { --portal-c1: var(--logo-verde-claro); --portal-c2: var(--logo-verde-escuro); }

/* logo e nome */
.portal-sidebar .sidebar-brand-wrap {
    border-bottom: 0;
    padding: 1.25rem 1.15rem 0.85rem;
}

/* v13.61: logo do escritório (img/logo_bertotto.png, recorte redondo da imagem
   enviada pelo usuário; o fundo branco e a sombra clara em volta saíram) */
.portal-sidebar .brand-logo {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    display: block;
    border-radius: 50%;
    filter: drop-shadow(0 3px 8px rgba(3, 12, 30, 0.45));
}

.portal-sidebar .brand-title { color: #fff; }
.portal-sidebar .brand-subtitle { color: var(--sb-texto-suave); }

/* itens */
.portal-sidebar .sidebar-section { padding: 0.65rem 0.85rem 1rem; }
.portal-sidebar .sidebar-nav-list { gap: 0.3rem; }

.portal-sidebar .sidebar-nav-list.sidebar-home {
    margin-bottom: 0.3rem;
    padding-bottom: 0;
    border-bottom: 0;
}

.portal-sidebar .sidebar-link {
    gap: 12px;
    padding: 0.42rem 0.6rem;
    border: 0;
    border-radius: 12px;
    color: var(--sb-texto);
    font-size: 0.92rem;
    font-weight: 600;
}

.portal-sidebar .sidebar-link > i:first-child {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 1rem;
    color: #fff;
    background: linear-gradient(135deg, var(--portal-c1) 0%, var(--portal-c2) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 3px 8px rgba(3, 12, 30, 0.35);
}

/* sub-itens (Notas › NFS-e, Emissor › Lotes...): ícone simples, sem quadrado */
.portal-sidebar .sidebar-link.ps-5 {
    padding-top: 0.38rem;
    padding-bottom: 0.38rem;
    font-weight: 500;
}

.portal-sidebar .sidebar-link.ps-5 > i:first-child {
    flex: 0 0 auto;
    width: 1.15rem;
    height: auto;
    display: inline-block;
    border-radius: 0;
    font-size: 0.9rem;
    color: inherit;
    background: none;
    box-shadow: none;
}

.portal-sidebar .sidebar-link:hover {
    color: #fff;
    background: var(--sb-hover);
}

.portal-sidebar .sidebar-link.active {
    color: #fff;
    border: 0;
    background: var(--sb-selecao);
    box-shadow: var(--sb-selecao-sombra);
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

/* rodapé: Configurações, cartão do usuário e versão */
.portal-sidebar .sidebar-footer {
    padding: 0.6rem 0.85rem 0.7rem;
    border-top: 1px solid var(--sb-linha);
    background: var(--sb-fundo-fim);
}

.portal-sidebar .sidebar-footer-link {
    gap: 12px;
    padding: 0.5rem 0.6rem;
    border-radius: 12px;
    color: var(--sb-texto);
    font-size: 0.92rem;
}

.portal-sidebar .sidebar-footer-link i {
    flex: 0 0 34px;
    width: 34px;
    text-align: center;
    font-size: 1.2rem;
}

.portal-sidebar .sidebar-footer-link:hover { background: var(--sb-hover); }

.portal-sidebar .sidebar-footer-link.active {
    color: #fff;
    background: var(--sb-selecao);
    box-shadow: var(--sb-selecao-sombra);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.portal-sidebar .sidebar-user { margin-top: 0.55rem; }

.portal-sidebar .sidebar-user-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--sb-texto);
    text-align: left;
    transition: background 0.18s ease;
}

.portal-sidebar .sidebar-user-btn:hover,
.portal-sidebar .sidebar-user-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.07); }

.portal-sidebar .sidebar-user-avatar {
    position: relative;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    background: linear-gradient(135deg, #2b4f86 0%, #1b3560 100%);
}

.portal-sidebar .sidebar-user-info {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.25;
}

.portal-sidebar .sidebar-user-nome {
    display: block;
    overflow: hidden;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.portal-sidebar .sidebar-user-papel {
    display: block;
    color: var(--sb-texto-suave);
    font-size: 0.78rem;
}

.portal-sidebar .sidebar-user-seta { color: var(--sb-texto-suave); }

.portal-sidebar .sidebar-user-menu { min-width: 12rem; }

.portal-sidebar .sidebar-version {
    margin-top: 0.6rem;
    color: var(--sb-texto-suave);
}

/* versão compacta (menu recolhido no computador): só os quadrados */
@media (min-width: 992px) {
    .sidebar-collapsed .portal-sidebar .sidebar-brand-wrap { justify-content: center; }

    .sidebar-collapsed .portal-sidebar .sidebar-user-info,
    .sidebar-collapsed .portal-sidebar .sidebar-user-seta,
    .sidebar-collapsed .portal-sidebar .sidebar-version { display: none; }

    .sidebar-collapsed .portal-sidebar .sidebar-user-btn {
        justify-content: center;
        padding: 0.4rem 0;
        border-color: transparent;
        background: transparent;
    }

    .sidebar-collapsed .portal-sidebar .sidebar-user-avatar::after {
        content: "";
        position: absolute;
        right: -1px;
        bottom: -1px;
        width: 11px;
        height: 11px;
        border: 2px solid var(--sb-fundo-fim);
        border-radius: 50%;
        background: #22c55e;
    }
}

/* ==========================================================================
   v13.58 — Dentro de um módulo o menu fica leve (modelo "Opção 2" enviado
   pelo usuário): ícone simples, sem quadrado colorido, itens agrupados em
   seções com título (nome do módulo, Tributação, Processamento,
   Configurações) e ativo em faixa azul. O quadrado colorido fica só na
   lista de módulos da Home.
   ========================================================================== */
.portal-sidebar .sidebar-section--modulo .sidebar-nav-list { gap: 0.15rem; }

.portal-sidebar .sidebar-section--modulo .sidebar-link {
    gap: 12px;
    padding: 0.44rem 0.7rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

.portal-sidebar .sidebar-section--modulo .sidebar-link > i:first-child {
    flex: 0 0 1.25rem;
    width: 1.25rem;
    height: auto;
    display: inline-block;
    border-radius: 0;
    font-size: 1.05rem;
    color: rgba(214, 228, 248, 0.85);
    background: none;
    box-shadow: none;
}

.portal-sidebar .sidebar-section--modulo .sidebar-link:hover > i:first-child { color: #fff; }

.portal-sidebar .sidebar-section--modulo .sidebar-link.active {
    color: #fff;
    /* v13.60: a MESMA cor em todo módulo, a da Central de Notas (na v13.59 cada
       módulo tinha a sua). Desde a v13.62 é a seleção do menu inteiro (--sb-selecao). */
    background: var(--sb-selecao);
    box-shadow: var(--sb-selecao-sombra);
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.portal-sidebar .sidebar-section--modulo .sidebar-link.active > i:first-child { color: #fff; }

.portal-sidebar .sidebar-nav-titulo {
    margin: 0.9rem 0 0.25rem;
    padding: 0 0.7rem;
    color: rgba(206, 222, 245, 0.55);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.portal-sidebar .sidebar-nav-list.sidebar-home + .sidebar-nav-list > .sidebar-nav-titulo:first-child { margin-top: 0.55rem; }

@media (min-width: 992px) {
    /* recolhido: o título vira uma linha fina entre os grupos */
    .sidebar-collapsed .portal-sidebar .sidebar-nav-titulo {
        height: 1px;
        margin: 0.45rem 0.9rem;
        padding: 0;
        overflow: hidden;
        font-size: 0;
        background: var(--sb-linha);
    }

    /* recolhido: sem a seta do submenu e sub-item alinhado aos demais
       (o ps-5 do Bootstrap é !important e empurrava o ícone para a direita) */
    .sidebar-collapsed .portal-sidebar .sidebar-link > .bi-chevron-down { display: none; }
    .sidebar-collapsed .portal-sidebar .sidebar-link.ps-5 { padding-left: 0.7rem !important; }
}
