:root {
    --teal: #1e56a8;
    --teal-dark: #0a1c3b;
    --blue-700: #1a4080;
    --blue-500: #2563eb;
    --green: #08a045;
    --blue: #3f8fd8;
    --ink: #111827;
    --muted: #6b7280;
    --line: #dfe3e8;
    --soft: #f4f6f8;
    --panel: #ffffff;
    --sidebar: 64px;
    --sidebar-expanded: 238px;
    --topbar: 68px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f7f7f7;
    color: var(--ink);
    font-family: "Segoe UI", Tahoma, sans-serif;
    font-size: 14px;
}

body.is-sidebar-expanded {
    --sidebar: var(--sidebar-expanded);
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    position: fixed;
    z-index: 20;
    top: 0;
    right: 0;
    left: 0;
    height: var(--topbar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 40px;
    background: linear-gradient(135deg, var(--teal-dark) 0%, var(--blue-700) 60%, var(--blue-500) 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(10, 28, 59, .25);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-toggle {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 34px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}

.topbar-toggle:hover {
    background: rgba(255, 255, 255, .24);
}

body.is-sidebar-expanded .topbar-toggle {
    border-color: rgba(255, 255, 255, .45);
    background: rgba(255, 255, 255, .28);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0;
}

.logo-box {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(255, 255, 255, .25);
    border-radius: 10px;
    background: rgba(255, 255, 255, .15);
    backdrop-filter: blur(4px);
    font-size: 18px;
}

.brand-stack {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-name {
    font-family: "Segoe UI", Tahoma, sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.3px;
}

.brand-sep {
    color: rgba(255, 255, 255, .35);
    font-size: 18px;
}

.brand-sub {
    color: rgba(255, 255, 255, .72);
    font-size: 13px;
    font-weight: 500;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 20px;
    background: rgba(255, 255, 255, .12);
    color: rgba(255, 255, 255, .84);
    padding: 5px 13px;
    font-size: 13px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logout {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.header-logout:hover {
    background: rgba(255, 255, 255, .2);
}

/* Texto so para leitores de tela. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Menu do usuario (bolinha com iniciais no topo, a direita). */
.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.user-avatar {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 34px;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 50%;
    background: rgba(255, 255, 255, .22);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .3px;
}

.user-menu-toggle:hover .user-avatar,
.user-menu-toggle[aria-expanded="true"] .user-avatar {
    background: rgba(255, 255, 255, .34);
}

.user-menu-toggle:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.user-menu-panel {
    position: absolute;
    z-index: 30;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
    box-shadow: 0 12px 28px rgba(10, 28, 59, .18);
}

.user-menu-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
}

.user-menu-head > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-menu-head strong,
.user-menu-head small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-head small {
    color: var(--muted);
    font-size: 12px;
}

.user-avatar.is-large {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    border-color: transparent;
    background: var(--blue-700);
    font-size: 14px;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 5px;
    color: var(--ink);
    font-size: 14px;
    text-decoration: none;
}

.user-menu-item i {
    width: 16px;
    color: var(--muted);
    text-align: center;
}

.user-menu-item:hover,
.user-menu-item:focus-visible {
    background: var(--soft);
    outline: none;
}

/* Tela "Minha conta". */
.conta-panel {
    max-width: 760px;
    padding: 16px 20px 20px;
}

.conta-dados {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0 0;
}

.conta-dados dt {
    color: var(--muted);
    font-size: 12px;
}

.conta-dados dd {
    margin: 2px 0 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.conta-senha-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 12px;
    padding-top: 18px;
}

.conta-help {
    margin: 10px 0 0;
}

.conta-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

@media (max-width: 720px) {
    .conta-dados,
    .conta-senha-grid {
        grid-template-columns: 1fr;
    }
}

.sidebar {
    position: fixed;
    z-index: 15;
    top: var(--topbar);
    bottom: 0;
    left: 0;
    width: var(--sidebar);
    background: #fff;
    border-right: 1px solid var(--line);
    box-shadow: 1px 0 6px rgba(0, 0, 0, .08);
    padding-top: 8px;
    overflow: hidden;
    transition: width .18s ease;
}

.side-link {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    border-bottom: 1px dotted #e0e0e0;
    color: #0b0b0b;
    font-size: 22px;
    overflow: hidden;
}

.side-link span {
    display: none;
}

.side-link i {
    width: 24px;
    flex: 0 0 24px;
    text-align: center;
}

body.is-sidebar-expanded .side-link {
    justify-content: flex-start;
    padding: 0 18px;
}

body.is-sidebar-expanded .side-link span {
    display: inline;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.is-sidebar-expanded .side-link {
    font-size: 18px;
}

body.is-sidebar-expanded .side-link span {
    font-size: 13px;
    font-weight: 700;
}

/* Expansão temporária no hover — o modo fixo continua sendo o do botão de menu */
@media (hover: hover) and (pointer: fine) {
    .sidebar:hover {
        width: var(--sidebar-expanded);
        box-shadow: 2px 0 14px rgba(10, 28, 59, .18);
    }

    .sidebar:hover .side-link {
        justify-content: flex-start;
        padding: 0 18px;
    }

    .sidebar:hover .side-link span {
        display: inline;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sidebar:hover .side-link {
        font-size: 18px;
    }

    .sidebar:hover .side-link span {
        font-size: 13px;
        font-weight: 700;
    }
}

.side-link.is-active,
.side-link:hover {
    color: var(--teal);
    background: #f0f8fa;
}

.page-shell {
    min-height: 100vh;
    padding: calc(var(--topbar) + 18px) 24px 28px calc(var(--sidebar) + 28px);
    transition: padding-left .18s ease;
}

.home {
    min-height: calc(100vh - var(--topbar) - 46px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 34px;
}

.home-header {
    text-align: center;
}

.home-header h1 {
    margin: 0 0 8px;
    font-size: 30px;
}

.home-header p {
    margin: 0;
    color: var(--muted);
}

.card-grid {
    width: min(1280px, 100%);
    display: grid;
    grid-template-columns: repeat(6, minmax(145px, 1fr));
    gap: 18px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.home-card {
    min-height: 165px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(20, 40, 55, .08);
    text-align: center;
    transition: transform .15s ease, box-shadow .15s ease;
}

.home-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(20, 40, 55, .12);
}

.card-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #e8f5f7;
    color: var(--teal);
    font-size: 24px;
}

.home-card small {
    color: var(--muted);
    line-height: 1.35;
}

.module-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.module-narrow {
    align-items: center;
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
}

.page-title > div {
    display: flex;
    align-items: center;
    gap: 18px;
}

.page-title i {
    font-size: 22px;
}

.page-title h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 400;
}

.panel,
.form-card {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--line);
}

.filter-panel {
    padding: 16px 20px 20px;
}

.panel-heading,
.results-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.panel-heading i {
    font-size: 20px;
}

.filter-grid,
.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 12px;
    align-items: end;
    padding-top: 18px;
}

.filter-actions {
    display: flex;
    gap: 12px;
    align-items: end;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-weight: 700;
}

.field span {
    font-size: 13px;
}

.span-1 {
    grid-column: span 1;
}

.span-2 {
    grid-column: span 2;
}

.span-3 {
    grid-column: span 3;
}

.span-4 {
    grid-column: span 4;
}

.span-5 {
    grid-column: span 5;
}

.span-6 {
    grid-column: span 6;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d8dde3;
    border-radius: 3px;
    background: #fff;
    color: var(--ink);
    padding: 9px 11px;
    font: inherit;
    font-weight: 400;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--teal);
    outline: 2px solid rgba(15, 113, 129, .12);
}

input.is-calculated {
    background: #f3f4f6;
    color: #475569;
}

.field-help {
    color: #d60000;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.25;
}

.required-mark {
    color: #d60000;
    font-style: normal;
    font-weight: 700;
}

.btn {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    border-radius: 4px;
    padding: 9px 16px;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.btn-success {
    background: var(--green);
}

.btn-dark {
    background: #202020;
}

.btn-primary {
    background: var(--blue);
}

.btn-muted {
    background: #7d7d7d;
}

.btn-danger {
    background: #b91c1c;
}

.btn-compact {
    min-height: 30px;
    padding: 7px 10px;
    font-size: 12px;
}

.row-actions {
    white-space: nowrap;
}

.row-actions .inline-form + .inline-form {
    margin-left: 6px;
}

.approval-cell {
    white-space: nowrap;
}

.approval-cell .approval-label {
    font-weight: 600;
    margin-right: 6px;
}

.approval-cell.is-approved .approval-label {
    color: #166534;
}

.approval-cell.is-pending .approval-label {
    color: #b45309;
}

.approval-cell .approval-actions {
    display: inline-flex;
    gap: 4px;
    vertical-align: middle;
}

.btn-approve,
.btn-reject {
    border: 0;
    background: transparent;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-approve {
    background: #dcfce7;
    color: #166534;
}

.btn-approve:hover {
    background: #bbf7d0;
}

.btn-reject {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-reject:hover {
    background: #fecaca;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.notice {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #b9e5c8;
    background: #edf9f1;
    color: #166534;
}

.notice-danger {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.global-notice {
    margin-bottom: 16px;
}

.results-panel {
    overflow: hidden;
}

.results-heading {
    justify-content: space-between;
    padding: 16px 12px;
}

/* Indicador exibido enquanto os resultados chegam via AJAX. */
.results-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 160px;
    padding: 24px;
    color: #6b7280;
    font-size: 14px;
}

.results-loading.is-error {
    flex-direction: column;
    color: #b3261e;
}

/* Dentro de uma tabela larga (Projetos), centralizar jogaria o aviso para
   fora da area visivel: fica alinhado a esquerda. */
.results-loading.is-inline-start {
    justify-content: flex-start;
    align-items: center;
}

.results-loading.is-inline-start.is-error {
    align-items: flex-start;
}

.results-spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 3px solid #d8dde5;
    border-top-color: #4b5563;
    border-radius: 50%;
    animation: results-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .results-spinner { animation-duration: 2.4s; }
}

/* Nota discreta: informa o periodo padrao aplicado quando nao ha filtro. */
.results-note {
    margin: 0 12px 12px;
    color: #6b7280;
    font-size: 12.5px;
}

.results-note i {
    margin-right: 6px;
}

/* Aviso de listagem truncada pelo teto de linhas da planilha. */
.results-warning {
    margin: 0 12px 12px;
    padding: 10px 12px;
    border: 1px solid #f0c36d;
    border-left-width: 4px;
    border-radius: 4px;
    background: #fdf6e3;
    color: #7a5b12;
    font-size: 13px;
    line-height: 1.5;
}

.results-warning i {
    margin-right: 6px;
}

/* Paginacao da planilha de apontamentos (acima e abaixo da tabela). */
.results-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 8px 12px;
    color: var(--muted);
    font-size: 13px;
}

.results-pager-links {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.results-pager-current {
    padding: 0 6px;
    color: var(--ink);
    font-weight: 600;
}

.table-wrap {
    overflow: auto;
    max-height: calc(100vh - 360px);
}

.table-wrap.is-wide table {
    min-width: 1760px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 10px 11px;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

th {
    background: #f0f0f0;
    font-weight: 700;
}

td {
    font-size: 13px;
}

.edit-cell {
    width: 54px;
    min-width: 54px;
    text-align: center;
    white-space: nowrap;
}

/* Flex garante lapis e aspas lado a lado, independente do white-space
   herdado das versoes compactas de tabela. */
.edit-cell .edit-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.edit-cell button {
    border: 0;
    background: transparent;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

/* Modulos com acao extra na coluna Editar (ex.: comentario do projeto). */
.module-projetos .edit-cell {
    width: 62px;
    min-width: 62px;
}

.comentario-button {
    color: #4b5563;
}

/* Coluna de texto longo: o span interno define a largura maxima real, ja que
   em table-layout:auto o width do td e apenas uma sugestao. */
.cell-wrap {
    white-space: normal;
    line-height: 1.3;
}

.cell-wrap > span {
    display: inline-block;
    max-width: 230px;
    /* Nomes como MARJAN_IMPLEMENTACAO_DE_ASSINATURA_ELETRONICA nao tem ponto de
       quebra natural, por isso a quebra precisa poder cair em qualquer letra. */
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Colunas de valores (dinheiro e horas): numeros encostados na direita para
   ficarem alinhados entre si; o cabecalho acompanha. */
.cell-right {
    text-align: right;
}

.comentario-button:hover {
    color: var(--teal);
}

/* Semaforo exibido ao lado do valor de uma coluna (consumo das horas). */
.status-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    margin-left: 8px;
    border-radius: 50%;
    vertical-align: middle;
    background: #d1d5db;
}

.status-dot[hidden] {
    display: none;
}

.status-dot.is-verde {
    background: #16a34a;
}

.status-dot.is-amarelo {
    background: #eab308;
}

.status-dot.is-preto {
    background: #111827;
}

.status-dot.is-vermelho {
    background: #dc2626;
}

/* Lista de alinhamentos dentro do modal de edicao da proposta. */
.comentarios-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.comentarios-empty {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.comentario-item {
    border: 1px solid var(--line);
    border-left: 3px solid var(--teal);
    border-radius: 3px;
    background: #fafbfc;
    padding: 10px 12px;
}

.comentario-item-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 14px;
    font-size: 13px;
}

.comentario-item-head small {
    color: var(--muted);
    font-size: 12px;
}

.comentario-item-text {
    margin: 6px 0 0;
    white-space: pre-wrap;
    font-size: 13.5px;
}

/* Nome do projeto no cabecalho do modal de novo comentario. */
.comentario-projeto {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

tr.is-selected {
    background: #dedede;
    color: #1f5fa8;
}

.total-row {
    background: #dedede;
    color: #1f5fa8;
    font-weight: 700;
}

.empty-row {
    padding: 22px;
    color: var(--muted);
    text-align: center;
    white-space: normal;
}

/* Linhas ocultas pela pesquisa instantanea (o [hidden] do navegador nao
   vence o display:table-row em todos os motores). */
tr[hidden] {
    display: none;
}

/* Projetos nao tem mais a coluna "Utilizacao": o estado inativo passa a ser
   sinalizado na propria linha. */
.module-projetos tbody tr[data-row-active="0"] {
    background: #f6f7f8;
    color: var(--muted);
}

/* Barra de pesquisa instantanea sobre uma tabela ja renderizada. */
.table-search {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px 0;
}

.table-search-field {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
}

.table-search-field input[type="search"] {
    padding-left: 36px;
    padding-right: 38px;
}

.table-search-field input[type="search"]::-webkit-search-cancel-button {
    display: none;
}

.table-search-icon {
    position: absolute;
    left: 12px;
    color: var(--muted);
    font-size: 14px;
    pointer-events: none;
}

.table-search-clear {
    position: absolute;
    right: 8px;
    width: 24px;
    height: 24px;
    min-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #eef1f4;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    padding: 0;
}

/* O display:inline-flex acima venceria o [hidden] do navegador. */
.table-search-clear[hidden] {
    display: none;
}

.table-search-clear:hover {
    background: #dfe4e9;
    color: var(--ink);
}

.table-search-count {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12.5px;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .table-search {
        flex-wrap: wrap;
    }

    .table-search-count {
        width: 100%;
        text-align: left;
    }
}

.modal-backdrop {
    position: fixed;
    z-index: 40;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, .48);
}

.modal-backdrop.is-open {
    display: flex;
}

.modal,
.form-card {
    width: min(690px, 100%);
    max-height: calc(100vh - 70px);
    overflow: auto;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 15px 40px rgba(0, 0, 0, .22);
}

.modal-large {
    width: min(880px, 100%);
}

.modal-xlarge {
    width: min(1160px, 100%);
}

.form-card {
    box-shadow: none;
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line);
}

.modal-header > div {
    display: flex;
    align-items: center;
    gap: 14px;
}

.modal-header.static {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.modal-close {
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
}

.modal-body {
    padding: 18px 22px 28px;
}

.modal-footer {
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    background: #fff;
}

.form-section-title {
    grid-column: 1 / -1;
    margin-top: 10px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
}

.parcelas-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px 10px;
    margin-top: 10px;
}

.parcela-row {
    display: grid;
    grid-template-columns: 42px 1fr 1fr;
    gap: 4px;
    align-items: center;
}

.parcela-row span {
    text-align: center;
    color: #1f5fa8;
}

.parcela-row input {
    min-height: 34px;
    padding: 5px 7px;
}

.recent-panel {
    width: min(1180px, 100%);
}

.fechamento-page {
    gap: 16px;
}

.fechamento-import-panel .filter-actions {
    align-items: end;
}

.import-progress {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.import-progress[hidden] {
    display: none;
}

.import-progress-bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #d9e5ed;
}

.import-progress-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--teal);
    transition: width 180ms ease;
}

.import-progress p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.fechamento-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.summary-box {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-height: 74px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    background: #fff;
}

.summary-box span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.summary-box strong {
    color: var(--teal-dark);
    font-size: 18px;
}

.fechamento-results .table-wrap {
    max-height: calc(100vh - 420px);
}

.fechamento-results table {
    min-width: 2920px;
}

.fechamento-results .edit-column,
.fechamento-results .fechamento-edit-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
}

.fechamento-results .edit-column {
    z-index: 3;
    background: #f0f0f0;
}

.fechamento-total-row .fechamento-edit-cell {
    background: #dedede;
}

/* Coluna de acoes do fechamento: editar + excluir lado a lado. */
.fechamento-results .edit-column,
.fechamento-results .fechamento-edit-cell {
    width: 84px;
}

.fechamento-edit-cell button + button {
    margin-left: 4px;
}

.fechamento-edit-cell button.is-danger {
    color: #b91c1c;
}

.fechamento-edit-cell button.is-danger:hover {
    color: #7f1d1d;
}

.fechamento-edit-cell button[disabled] {
    opacity: .5;
    cursor: default;
}

.fechamento-sin-toggle {
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    cursor: pointer;
}

.checkbox-inline input {
    width: auto;
    margin: 0;
}

.notice-sin {
    margin-bottom: 12px;
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
}

.fechamento-results .cell-long {
    min-width: 280px;
    max-width: 380px;
    white-space: normal;
    line-height: 1.35;
}

.fechamento-pdf-panel {
    overflow: hidden;
}

.fechamento-edit-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 12px;
    align-items: start;
}

.fechamento-edit-grid textarea {
    min-height: 86px;
}

.period-action-links {
    display: flex;
    gap: 12px;
    align-items: center;
}

.apontamentos-planilha .filter-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.apontamentos-results .table-wrap {
    max-height: calc(100vh - 390px);
}

/* Listagem de apontamentos: versao compacta para caber na tela sem scroll lateral. */
.apontamentos-results .table-wrap.is-wide table,
.apontamentos-results table {
    min-width: 0;
    table-layout: auto;
}

.apontamentos-results th,
.apontamentos-results td {
    font-size: 10.5px;
    padding: 4px 5px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.25;
}

.apontamentos-results .cell-long {
    min-width: 70px;
    max-width: 140px;
    white-space: normal;
    line-height: 1.25;
}

/* Resumo de horas para pagamento: espacamento e alinhamento iguais aos do
   Aponts original -- tabela menos comprimida que a da planilha, colunas de
   marcacao/aprovacao/tipo centralizadas e numeros encostados a direita. */
.apontamentos-aprovacoes .apontamentos-results th,
.apontamentos-aprovacoes .apontamentos-results td {
    font-size: 12px;
    padding: 8px 10px;
    line-height: 1.3;
    vertical-align: middle;
}

.apontamentos-aprovacoes .apontamentos-results th {
    /* Deixa "Aprovado Gestor" e "Centro de Custo" quebrarem em duas linhas,
       como no original, em vez de esticar a coluna. */
    white-space: normal;
    line-height: 1.2;
}

.apontamentos-aprovacoes .apontamentos-results .check-cell,
.apontamentos-aprovacoes .apontamentos-results .approval-cell,
.apontamentos-aprovacoes .apontamentos-results .cell-center {
    text-align: center;
}

/* Sem botoes de acao nesta tabela: o rotulo fica centralizado de verdade. */
.apontamentos-aprovacoes .apontamentos-results .approval-cell .approval-label {
    margin-right: 0;
}

.apontamentos-aprovacoes .apontamentos-results .cell-num {
    text-align: right;
    white-space: nowrap;
}

/* O centro de custo cabe em uma linha na maioria dos casos, como no original. */
.apontamentos-aprovacoes .apontamentos-results .cell-long {
    min-width: 200px;
    max-width: 340px;
}

/* Listagem de projetos: versao compacta para caber na tela sem scroll lateral. */
.module-projetos .table-wrap.is-wide table,
.module-projetos .results-panel table {
    min-width: 0;
    table-layout: auto;
}

.module-projetos .results-panel th,
.module-projetos .results-panel td {
    font-size: 10.5px;
    padding: 4px 5px;
    /* Uma linha por celula: apenas a coluna Projeto quebra (regra abaixo). */
    white-space: nowrap;
    line-height: 1.25;
}

/* "T002156 - MARJAN_IMPLEMENTACAO_DE_ASSINATURA_ELETRONICA..." e o unico texto
   longo da listagem: largura limitada e quebra em varias linhas, para nao
   empurrar as demais colunas nem alargar a tabela. */
.module-projetos .results-panel th.cell-wrap,
.module-projetos .results-panel td.cell-wrap {
    width: 230px;
    max-width: 230px;
    white-space: normal;
}

/* A largura que a coluna Projeto ganhou sai daqui: nome de cliente e curto e
   pode quebrar em duas linhas. */
.module-projetos .results-panel th[data-column-key="cliente"],
.module-projetos .results-panel td[data-column-key="cliente"] {
    width: 120px;
    max-width: 120px;
    white-space: normal;
}

.module-projetos .results-panel td[data-column-key="cliente"] > span {
    max-width: 120px;
}

/* Lapis e aspas sempre lado a lado, mesmo na versao compacta. */
.module-projetos .results-panel .edit-cell {
    white-space: nowrap;
}

.apontamento-modal-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px 10px;
    align-items: end;
}

.apontamento-modal-grid textarea {
    min-height: 74px;
}

.apontamento-modal-grid input[readonly],
.apontamento-modal-grid textarea[readonly] {
    background: #f3f4f6;
    color: #4b5563;
}

.pdf-client-list {
    padding: 0 16px 16px;
}

.pdf-client-list table {
    min-width: 520px;
}

.pdf-client-list td:last-child,
.pdf-client-list th:last-child {
    width: 160px;
    text-align: right;
}

.fechamento-card {
    overflow: hidden;
}

.fechamento-frame {
    display: block;
    width: 100%;
    height: calc(100vh - 205px);
    min-height: 680px;
    border: 0;
    background: #f8fafc;
}

.kanban-page {
    min-width: 0;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(6, minmax(260px, 1fr));
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.kanban-column {
    min-height: calc(100vh - 180px);
    border: 1px solid var(--line);
    background: #f2f4f7;
}

.kanban-column-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 46px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    font-weight: 700;
}

.kanban-column-header span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.kanban-column-header strong {
    min-width: 28px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    background: #e8f5f7;
    color: var(--teal);
    font-size: 12px;
}

.kanban-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
}

.ticket-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 12px 38px 12px 12px;
    border: 1px solid #d8dde3;
    border-left: 4px solid var(--teal);
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(20, 40, 55, .06);
}

.ticket-card.is-readonly {
    padding-right: 12px;
}

.ticket-card.is-dragging {
    opacity: .55;
}

.ticket-card:hover {
    border-left-color: var(--blue);
    box-shadow: 0 6px 16px rgba(20, 40, 55, .12);
}

.ticket-card strong {
    white-space: normal;
    line-height: 1.3;
    font-size: 13px;
}

.ticket-card small {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    line-height: 1.25;
}

.ticket-id {
    color: var(--blue-700);
    font-weight: 800;
    font-size: 12px;
}

.ticket-drag-handle {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 18px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    color: #9aa4b2;
    cursor: grab;
}

.ticket-card:active .ticket-drag-handle {
    cursor: grabbing;
}

.ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ticket-meta em {
    padding: 3px 7px;
    border-radius: 11px;
    background: #eef2f7;
    color: #374151;
    font-style: normal;
    font-size: 11px;
}

.empty-kanban {
    padding: 18px 10px;
    color: var(--muted);
    text-align: center;
}

.readonly-badge,
.role-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 14px;
    padding: 5px 10px;
    background: #eef2f7;
    color: #374151;
    font-size: 12px;
    font-weight: 700;
}

.role-admin {
    background: #e8f5f7;
    color: var(--teal);
}

.role-user {
    background: #eef2f7;
    color: #374151;
}

.role-gestor {
    background: #fef3c7;
    color: #92400e;
}

.role-consultor {
    background: #e0e7ff;
    color: #3730a3;
}

.modal-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 18px 0 18px;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
}

.modal-tab {
    border: 0;
    background: transparent;
    padding: 9px 14px;
    cursor: pointer;
    font-weight: 600;
    color: #4b5563;
    border-radius: 6px 6px 0 0;
    border-bottom: 2px solid transparent;
}

.modal-tab:hover {
    color: #111827;
}

.modal-tab.is-active {
    background: #fff;
    color: var(--teal);
    border-bottom-color: var(--teal);
}

.modal-pane {
    display: none;
}

.modal-pane.is-active {
    display: block;
}

.modal-audit {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e3e3e3;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.5;
}

.modal-audit-line + .modal-audit-line {
    margin-top: 2px;
}

/* Acoes do registro (desabilitar/excluir) ficam a esquerda no rodape do modal. */
.modal-footer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
}

.modal-footer-actions button[hidden] {
    display: none;
}

.modal-audit[hidden] {
    display: none;
}

.perfil-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4b5563;
    font-size: 13px;
    background: #f3f4f6;
    padding: 8px 12px;
    border-radius: 6px;
}

.field-check .checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.pane-intro {
    margin: 0 0 12px 0;
    color: #4b5563;
    font-size: 13px;
}

.permissoes-grid {
    display: grid;
    gap: 8px;
}

.permissao-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 6px;
}

.permissao-label {
    font-weight: 600;
    color: #111827;
}

.permissao-options {
    display: inline-flex;
    gap: 6px;
}

.permissao-pill {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #d1d5db;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.permissao-pill input {
    accent-color: var(--teal);
}

.permissao-pill:has(input:checked) {
    background: var(--teal);
    color: #fff;
    border-color: var(--teal);
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.login-body {
    min-height: 100vh;
    background: #eef2f7;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(430px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(20, 40, 55, .16);
    overflow: hidden;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--teal-dark) 0%, var(--blue-700) 60%, var(--blue-500) 100%);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
}

.login-heading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-heading h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 500;
}

.login-submit {
    min-height: 44px;
}

.kanban-list.is-reordering {
    outline: 2px dashed rgba(15, 113, 129, .25);
    outline-offset: -4px;
}

.kanban-list.is-saving-order .ticket-card {
    cursor: wait;
}

.kanban-list.has-order-error {
    outline: 2px solid rgba(214, 0, 0, .35);
    outline-offset: -4px;
}

@media (max-width: 1100px) {
    .card-grid {
        grid-template-columns: repeat(6, minmax(150px, 1fr));
    }

    .filter-grid,
    .form-grid,
    .apontamentos-planilha .filter-grid,
    .apontamento-modal-grid,
    .parcelas-grid,
    .fechamento-edit-grid,
    .fechamento-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .span-3,
    .span-4,
    .span-5,
    .span-6 {
        grid-column: span 2;
    }
}

@media (max-width: 720px) {
    :root {
        --sidebar: 0px;
    }

    .sidebar,
    .topbar-toggle {
        display: none;
    }

    .page-shell {
        padding-left: 16px;
        padding-right: 16px;
    }

    .header-badge {
        display: none;
    }

    .header-actions {
        margin-left: auto;
    }

    .topbar {
        padding: 0 18px;
    }

    .brand-name {
        font-size: 18px;
    }

    .brand-sub {
        display: none;
    }

    .filter-grid,
    .form-grid,
    .apontamentos-planilha .filter-grid,
    .apontamento-modal-grid,
    .parcelas-grid,
    .fechamento-edit-grid,
    .fechamento-summary {
        grid-template-columns: 1fr;
    }

    .card-grid {
        grid-template-columns: repeat(6, minmax(145px, 1fr));
    }

    .span-1,
    .span-2,
    .span-3,
    .span-4,
    .span-5,
    .span-6 {
        grid-column: span 1;
    }

    .filter-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .period-action-links {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Select pesquisavel (combobox com filtro por texto) */
.searchable-select.ss-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    min-height: 0;
}

.ss-control {
    position: relative;
    width: 100%;
    font-weight: 400;
}

.ss-display {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #d8dde3;
    border-radius: 3px;
    background: #fff;
    color: var(--ink);
    padding: 9px 11px;
    font: inherit;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
}

.ss-control.is-open .ss-display,
.ss-display:focus {
    border-color: var(--teal);
    outline: 2px solid rgba(15, 113, 129, .12);
}

.ss-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ss-value.is-placeholder {
    color: #8a93a0;
}

.ss-caret {
    font-size: 12px;
    color: #8a93a0;
    transition: transform .15s ease;
}

.ss-control.is-open .ss-caret {
    transform: rotate(180deg);
}

.ss-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 60;
    background: #fff;
    border: 1px solid #d8dde3;
    border-radius: 4px;
    box-shadow: 0 12px 28px rgba(20, 40, 55, .16);
    overflow: hidden;
}

.ss-search-wrap {
    position: relative;
    padding: 8px;
    border-bottom: 1px solid #eef1f4;
}

.ss-search-wrap i {
    position: absolute;
    top: 50%;
    left: 18px;
    transform: translateY(-50%);
    color: #8a93a0;
    font-size: 13px;
    pointer-events: none;
}

.ss-search {
    width: 100%;
    min-height: 38px;
    padding-left: 32px;
}

.ss-options {
    list-style: none;
    margin: 0;
    padding: 4px;
    max-height: 240px;
    overflow-y: auto;
}

.ss-option {
    padding: 9px 11px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
}

.ss-option.is-active,
.ss-option:hover {
    background: rgba(15, 113, 129, .1);
}

.ss-option.is-selected {
    font-weight: 700;
    color: var(--teal);
}

.ss-empty {
    padding: 12px;
    text-align: center;
    color: #8a93a0;
    font-size: 13px;
}
