/* ============================================================
   SanCastro ERP — identidade visual

   Paleta extraída da marca: verde profundo e taupe sobre fundo
   claro e quente. Traço fino, muito respiro, rótulos em caixa
   alta com espaçamento largo — a assinatura tipográfica da marca.

   O verde é o único acento. Tudo o mais é neutro ou semântico.
   ============================================================ */
:root {
    /* --- Marca --- */
    --sc-verde:        #1D4034;
    --sc-verde-claro:  #2A5A49;
    --sc-verde-escuro: #14302716;
    --sc-taupe:        #9B9187;
    --sc-taupe-claro:  #B7AFA6;
    --sc-ouro:         #B99B6B;

    /* --- Neutros (levemente quentes, na linha da marca) --- */
    --sc-fundo:        #F6F5F2;
    --sc-superficie:   #FFFFFF;
    --sc-superficie-2: #FAF9F7;
    --sc-borda:        #E5E3DD;
    --sc-borda-forte:  #D2CFC7;
    --sc-texto:        #2B2E2C;
    --sc-texto-sec:    #7C7F79;

    /* --- Semânticos, dessaturados para conviver com a marca --- */
    --sc-ok:      #4C8C6B;
    --sc-atencao: #B8873F;
    --sc-erro:    #A8524A;
    --sc-info:    #6E7F87;

    --sidebar-largura: 246px;
    --topbar-altura:   62px;

    /* --- Bootstrap alinhado à marca --- */
    --bs-primary: #1D4034;
    --bs-primary-rgb: 29, 64, 52;
    --bs-body-color: #2B2E2C;
    --bs-body-bg: #F6F5F2;
    --bs-border-color: #E5E3DD;
    --bs-border-radius: 4px;
    --bs-link-color: #1D4034;
    --bs-link-hover-color: #2A5A49;

    --bs-success: #4C8C6B;  --bs-success-rgb: 76, 140, 107;
    --bs-warning: #B8873F;  --bs-warning-rgb: 184, 135, 63;
    --bs-danger:  #A8524A;  --bs-danger-rgb: 168, 82, 74;
    --bs-info:    #6E7F87;  --bs-info-rgb: 110, 127, 135;
    --bs-secondary: #9B9187; --bs-secondary-rgb: 155, 145, 135;

    --bs-primary-bg-subtle:      #E8EDEA;
    --bs-primary-border-subtle:  #C6D3CC;
    --bs-primary-text-emphasis:  #1D4034;
    --bs-success-bg-subtle:      #E6F0EA;
    --bs-success-border-subtle:  #C4DCCF;
    --bs-success-text-emphasis:  #35674E;
    --bs-warning-bg-subtle:      #F7EFE2;
    --bs-warning-border-subtle:  #E7D5B7;
    --bs-warning-text-emphasis:  #8A6329;
    --bs-danger-bg-subtle:       #F5E7E5;
    --bs-danger-border-subtle:   #E4C7C3;
    --bs-danger-text-emphasis:   #813B34;
    --bs-info-bg-subtle:         #ECEFF0;
    --bs-info-border-subtle:     #D2D9DC;
    --bs-info-text-emphasis:     #4F5D63;
    --bs-secondary-bg-subtle:    #F1EFEC;
    --bs-secondary-border-subtle:#DDD8D1;
    --bs-secondary-text-emphasis:#6B635B;
}

body {
    background: var(--sc-fundo);
    color: var(--sc-texto);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: .9rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* Rótulo da marca: caixa alta, traço fino, muito espaçamento */
.rotulo-marca {
    text-transform: uppercase;
    letter-spacing: .16em;
    font-weight: 500;
}

/* ---------- Topbar ---------- */
.topbar {
    height: var(--topbar-altura);
    background: var(--sc-superficie);
    border-bottom: 1px solid var(--sc-borda);
    z-index: 1035;
}
.navbar-brand { color: var(--sc-verde) !important; line-height: 1.05; }
.marca-selo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
}
.marca-selo img { width: 100%; height: 100%; display: block; }
.marca-nome {
    font-size: .98rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .13em; color: var(--sc-verde);
}
.marca-nome b { font-weight: 600; color: var(--sc-verde); }
.marca-nome span { font-weight: 400; color: var(--sc-taupe); }
.marca-sub {
    font-size: .58rem; color: var(--sc-taupe);
    text-transform: uppercase; letter-spacing: .19em; margin-top: 2px;
}
.btn-menu { background: transparent; border: 1px solid var(--sc-borda); color: var(--sc-verde); }
.btn-usuario { background: transparent; border: 0; font-size: .84rem; }
.btn-usuario::after { color: var(--sc-taupe); }
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 33px; height: 33px; border-radius: 50%;
    background: var(--sc-verde); color: #fff;
    font-size: .7rem; font-weight: 600; letter-spacing: .04em;
}

/* ---------- Layout ---------- */
.app-corpo { display: flex; min-height: calc(100vh - var(--topbar-altura)); }
.sidebar {
    width: var(--sidebar-largura); flex: 0 0 var(--sidebar-largura);
    background: var(--sc-superficie);
    border-right: 1px solid var(--sc-borda);
    position: sticky; top: var(--topbar-altura);
    height: calc(100vh - var(--topbar-altura));
    overflow-y: auto;
}
.sidebar-offcanvas { background: var(--sc-superficie); width: var(--sidebar-largura) !important; }
.conteudo { flex: 1 1 auto; padding: 1.75rem 2rem 4rem; min-width: 0; }

/* ---------- Menu ---------- */
.menu-nav { padding: 1.1rem 0; display: flex; flex-direction: column; min-height: 100%; }
.menu-nav .nav-link {
    display: flex; align-items: center; gap: .8rem;
    color: var(--sc-texto-sec); padding: .5rem 1.35rem;
    font-size: .845rem; border-radius: 0;
    border-left: 2px solid transparent;
    transition: color .15s, border-color .15s, background .15s;
}
.menu-nav .nav-link i { font-size: 1rem; width: 18px; text-align: center; opacity: .75; }
.menu-nav .nav-link:hover { color: var(--sc-verde); background: var(--sc-superficie-2); }
.menu-nav .nav-link:hover i { opacity: 1; }
.menu-nav .nav-link.ativo {
    color: var(--sc-verde); font-weight: 600;
    border-left-color: var(--sc-verde);
    background: var(--bs-primary-bg-subtle);
}
.menu-nav .nav-link.ativo i { opacity: 1; }
.menu-titulo {
    color: var(--sc-taupe); font-size: .6rem;
    text-transform: uppercase; letter-spacing: .18em;
    padding: 1.5rem 1.35rem .5rem; font-weight: 600;
}
.menu-nav > ul + .menu-titulo { border-top: 1px solid var(--sc-borda); margin-top: .8rem; padding-top: 1.2rem; }
.menu-rodape {
    margin-top: auto; padding: 1.2rem 1.35rem;
    color: var(--sc-taupe); font-size: .62rem;
    text-transform: uppercase; letter-spacing: .14em;
    border-top: 1px solid var(--sc-borda);
}

/* ---------- Cabeçalho de página ---------- */
.pagina-cabecalho {
    display: flex; flex-wrap: wrap; align-items: center; gap: .85rem;
    margin-bottom: 1.6rem; padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--sc-borda);
}
.pagina-cabecalho h1 {
    font-size: 1.25rem; font-weight: 600; margin: 0;
    color: var(--sc-verde); letter-spacing: .01em;
}
.pagina-cabecalho .subtitulo {
    font-size: .78rem; color: var(--sc-texto-sec); margin: .2rem 0 0;
}

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--sc-borda);
    border-radius: 4px;
    background: var(--sc-superficie);
    box-shadow: none;
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--sc-borda);
    font-size: .72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .12em;
    color: var(--sc-verde);
    padding: .9rem 1.15rem;
    border-radius: 0 !important;
}
.card-header .badge, .card-header .btn { text-transform: none; letter-spacing: normal; }
.card-body { padding: 1.15rem; }

/* KPI — sem faixa colorida; a hierarquia é tipográfica */
.kpi { position: relative; height: 100%; }
.kpi .card-body { padding: 1.15rem 1.2rem; }
.kpi-rotulo {
    font-size: .62rem; text-transform: uppercase; letter-spacing: .16em;
    color: var(--sc-taupe); font-weight: 600; margin-bottom: .5rem;
}
.kpi-valor {
    font-size: 1.7rem; font-weight: 600; line-height: 1.1;
    color: var(--sc-verde); letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}
.kpi-nota { font-size: .72rem; color: var(--sc-texto-sec); margin-top: .35rem; }
.kpi-icone {
    position: absolute; right: 1.1rem; top: 1.1rem;
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .9rem; background: transparent !important;
    color: var(--sc-taupe) !important;
    border: 1px solid var(--sc-borda);
}
/* A faixa vira um fio de 2px no topo — presente, mas discreta */
.kpi-faixa { position: absolute; left: 0; right: 0; top: 0; height: 2px; width: auto; }

/* ---------- Tabelas ---------- */
.table { font-size: .845rem; margin-bottom: 0; }
.table > thead th {
    background: var(--sc-superficie-2); color: var(--sc-taupe); font-weight: 600;
    font-size: .63rem; text-transform: uppercase; letter-spacing: .13em;
    border-bottom: 1px solid var(--sc-borda); white-space: nowrap;
    padding: .8rem .9rem;
}
.table > tbody td { padding: .72rem .9rem; vertical-align: middle; border-color: var(--sc-borda); }
.table-hover > tbody > tr:hover > * { background: var(--sc-superficie-2); }
.table > tfoot td, .table > tfoot th { border-color: var(--sc-borda); }
.tabela-vazia { padding: 3.2rem 1rem; text-align: center; color: var(--sc-texto-sec); font-size: .84rem; }
.tabela-vazia i { font-size: 1.6rem; opacity: .3; display: block; margin-bottom: .7rem; }

/* ---------- Formulários ---------- */
.form-label {
    font-size: .66rem; font-weight: 600; color: var(--sc-taupe);
    text-transform: uppercase; letter-spacing: .12em; margin-bottom: .4rem;
}
.form-control, .form-select {
    font-size: .875rem; border-color: var(--sc-borda-forte);
    border-radius: 3px; padding: .45rem .7rem; color: var(--sc-texto);
}
.form-control:focus, .form-select:focus {
    border-color: var(--sc-verde);
    box-shadow: 0 0 0 3px rgba(29, 64, 52, .08);
}
.form-control::placeholder { color: var(--sc-taupe-claro); }
.form-secao {
    font-size: .64rem; text-transform: uppercase; letter-spacing: .16em;
    font-weight: 600; color: var(--sc-verde); padding-bottom: .5rem;
    border-bottom: 1px solid var(--sc-verde); display: inline-block; margin-bottom: 1.3rem;
}
.obrigatorio::after { content: ' *'; color: var(--sc-erro); }
.form-check-input:checked { background-color: var(--sc-verde); border-color: var(--sc-verde); }
.form-check-input:focus { border-color: var(--sc-verde); box-shadow: 0 0 0 3px rgba(29, 64, 52, .08); }

/* ---------- Botões ---------- */
.btn {
    font-size: .8rem; border-radius: 3px; padding: .45rem .95rem;
    text-transform: uppercase; letter-spacing: .09em; font-weight: 600;
}
.btn-sm { font-size: .72rem; padding: .32rem .7rem; letter-spacing: .07em; }
.btn-sc { background: var(--sc-verde); border-color: var(--sc-verde); color: #fff; }
.btn-sc:hover, .btn-sc:focus { background: var(--sc-verde-claro); border-color: var(--sc-verde-claro); color: #fff; }
/* O antigo "âmbar" passa a ser o taupe da marca */
.btn-ambar { background: transparent; border-color: var(--sc-taupe); color: var(--sc-taupe); }
.btn-ambar:hover, .btn-ambar:focus { background: var(--sc-taupe); border-color: var(--sc-taupe); color: #fff; }
.btn-outline-secondary { border-color: var(--sc-borda-forte); color: var(--sc-texto-sec); }
.btn-outline-secondary:hover { background: var(--sc-verde); border-color: var(--sc-verde); color: #fff; }
.btn-icone {
    padding: .2rem .42rem; line-height: 1.25;
    letter-spacing: normal; text-transform: none;
}

/* ---------- Diversos ---------- */
.badge {
    font-weight: 600; font-size: .62rem; padding: .38em .7em;
    border-radius: 2px; text-transform: uppercase; letter-spacing: .09em;
}
.progresso-mini { height: 3px; border-radius: 0; background: var(--sc-borda); min-width: 70px; }
.progress-bar { transition: width .4s ease; }
.filtro-barra {
    background: var(--sc-superficie); border: 1px solid var(--sc-borda);
    border-radius: 4px; padding: 1rem 1.15rem; margin-bottom: 1.4rem;
}
.grafico-caixa { position: relative; height: 260px; }
.grafico-caixa-sm { position: relative; height: 210px; }
.lista-simples { list-style: none; padding: 0; margin: 0; }
.lista-simples li {
    display: flex; align-items: center; gap: .8rem;
    padding: .75rem 1.15rem; border-bottom: 1px solid var(--sc-borda); font-size: .83rem;
}
.lista-simples li:last-child { border-bottom: 0; }
.ponto-cor { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px; }
.texto-mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.link-limpo { color: var(--sc-verde); text-decoration: none; font-weight: 600; }
.link-limpo:hover { color: var(--sc-verde-claro); text-decoration: underline; text-underline-offset: 3px; }
.foto-rdo {
    width: 100%; height: 120px; object-fit: cover;
    border-radius: 3px; border: 1px solid var(--sc-borda);
}
.alert {
    border-radius: 3px; font-size: .84rem;
    border-width: 1px; border-left-width: 2px;
}
.modal-content { border-radius: 4px; border-color: var(--sc-borda); }
.modal-header, .modal-footer { border-color: var(--sc-borda); }
.modal-title { font-size: .74rem; text-transform: uppercase; letter-spacing: .13em; color: var(--sc-verde); font-weight: 600; }
.dropdown-menu { border-radius: 4px; border-color: var(--sc-borda); font-size: .85rem; }
.list-group-item { border-color: var(--sc-borda); }
hr { border-color: var(--sc-borda); opacity: 1; }

/* ---------- Login ---------- */
.tela-login {
    min-height: 100vh; display: flex; align-items: stretch;
    background: var(--sc-fundo);
}
.login-lateral {
    flex: 1 1 50%; position: relative; overflow: hidden;
    background: var(--sc-superficie-2);
    display: none;
}
@media (min-width: 992px) { .login-lateral { display: block; } }
/* Bloco verde e fio dourado: a composição da marca */
.login-lateral::before {
    content: ""; position: absolute; left: 0; bottom: 0;
    width: 62%; height: 58%;
    background: var(--sc-verde);
    clip-path: polygon(0 32%, 100% 100%, 0 100%);
}
.login-lateral::after {
    content: ""; position: absolute; left: 8%; bottom: 0;
    width: 1px; height: 74%;
    background: linear-gradient(to bottom, transparent, var(--sc-ouro));
    opacity: .55;
}
.login-marca {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 1.5rem;
    padding: 3rem;
}
.login-marca img { width: 92px; height: 92px; }
/* Arquivo oficial da marca: proporção livre e maior, pois já inclui o texto */
.login-marca img.logo-completa { width: auto; height: auto; max-width: 300px; max-height: 300px; }
.logo-completa { display: block; margin: 0 auto; }
.login-valores {
    position: absolute; bottom: 2.6rem; left: 0; right: 0;
    display: flex; justify-content: center; gap: 1.6rem;
    font-size: .56rem; text-transform: uppercase; letter-spacing: .2em;
    color: var(--sc-taupe);
}
.login-painel {
    flex: 1 1 50%; display: flex; align-items: center; justify-content: center;
    padding: 2rem 1.5rem; background: var(--sc-superficie);
}
.caixa-login { width: 100%; max-width: 360px; }
.login-selo {
    width: 62px; height: 62px; margin: 0 auto 1.6rem;
    display: flex; align-items: center; justify-content: center;
}
.login-selo img { width: 100%; height: 100%; }

/* ---------- Impressão ---------- */
@media print {
    .topbar, .sidebar, .sidebar-offcanvas, .sem-impressao, .btn { display: none !important; }
    .conteudo { padding: 0; }
    .card { border: 1px solid #ccc !important; box-shadow: none !important; break-inside: avoid; }
    body { background: #fff; font-size: 11pt; }
    .card-header { color: #000; }
}

@media (max-width: 991.98px) {
    .conteudo { padding: 1.25rem 1.1rem 3rem; }
}
@media (max-width: 575.98px) {
    .conteudo { padding: 1rem .85rem 2.5rem; }
    .kpi-valor { font-size: 1.4rem; }
    .pagina-cabecalho { margin-bottom: 1.2rem; }
}
