/* ==========================================================
   OScar - Tema Escuro Automotivo
   ========================================================== */

:root {
    --preto:        #131313;
    --preto-2:      #1a1a1a;
    --cinza-escuro: #222222;
    --cinza:        #2d2d2d;
    --cinza-claro:  #3a3a3a;
    --borda:        #383838;
    --vermelho:     #c0392b;
    --vermelho-2:   #e04a3a;
    --laranja:      #e67e22;
    --laranja-2:    #f39c12;
    --verde:        #27ae60;
    --azul:         #2980b9;
    --amarelo:      #f1c40f;
    --branco:       #ffffff;
    --texto:        #e8e8e8;
    --texto-suave:  #a0a0a0;
    --texto-fraco:  #6f6f6f;
    --raio:         10px;
    --raio-sm:      6px;
    --sombra:       0 4px 18px rgba(0, 0, 0, .45);
    --sidebar-w:    252px;
    --transicao:    all .2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Roboto', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--preto);
    color: var(--texto);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--laranja); text-decoration: none; transition: var(--transicao); }
a:hover { color: var(--laranja-2); }

h1, h2, h3, h4, h5 { font-weight: 700; line-height: 1.25; color: var(--branco); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

img { max-width: 100%; height: auto; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--preto-2); }
::-webkit-scrollbar-thumb { background: var(--cinza-claro); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--vermelho); }

/* ---------------- Layout ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--preto-2);
    border-right: 1px solid var(--borda);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform .25s ease;
}

.sidebar-brand {
    padding: 20px 18px;
    border-bottom: 1px solid var(--borda);
    display: flex;
    align-items: center;
    gap: 11px;
}

.sidebar-brand .logo-mark {
    width: 40px; height: 40px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--vermelho), var(--laranja));
    display: grid; place-items: center;
    color: #fff; font-size: 19px;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(192, 57, 43, .4);
}

.sidebar-brand .logo-text { min-width: 0; }
.sidebar-brand h1 { font-size: 1.1rem; letter-spacing: .3px; }
.sidebar-brand span { display: block; font-size: .62rem; line-height: 1.35; color: var(--texto-fraco); text-transform: uppercase; letter-spacing: .6px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 10px 24px; }

.nav-section {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: 1.3px;
    color: var(--texto-fraco);
    padding: 16px 12px 7px;
    font-weight: 700;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border-radius: var(--raio-sm);
    color: var(--texto-suave);
    font-size: .92rem;
    font-weight: 500;
    margin-bottom: 2px;
    border-left: 3px solid transparent;
    transition: var(--transicao);
}

.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover { background: var(--cinza); color: var(--branco); }

.nav-item.active {
    background: linear-gradient(90deg, rgba(192, 57, 43, .22), transparent);
    color: var(--branco);
    border-left-color: var(--vermelho);
}

.nav-item.active i { color: var(--laranja); }

.nav-badge {
    margin-left: auto;
    background: var(--vermelho);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
}

.sidebar-footer { padding: 13px 16px; border-top: 1px solid var(--borda); font-size: .72rem; color: var(--texto-fraco); }

.logo-link { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.logo-link:hover { text-decoration: none; }

/* ---------------- Menu recolhivel ---------------- */
:root { --sidebar-w-collapsed: 68px; }

/* Largura recolhida: so os icones. A classe vive no <html>, aplicada antes
   da primeira pintura (ver layouts/app.php) para nao haver "flash" aberto. */
html.is-collapsed .sidebar { width: var(--sidebar-w-collapsed); overflow: visible; z-index: 9999; }

/**
 * O .sidebar-nav tem overflow-y:auto para poder rolar a lista de itens - mas
 * isso tambem recorta (clipa) qualquer filho posicionado que escape para a
 * direita, como o flyout do submenu (left:100%). Sem essa linha o flyout
 * fica cortado/invisivel mesmo com z-index correto, porque overflow corta
 * antes de qualquer coisa ser pintada.
 */
html.is-collapsed .sidebar-nav { overflow: visible; }
html.is-collapsed .main { margin-left: var(--sidebar-w-collapsed); }

/* Grupos (accordion no desktop expandido) */
.nav-toggle {
    background: none;
    border: 0;
    width: 100%;
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.nav-caret { margin-left: auto; flex-shrink: 0; font-size: 12px; opacity: .6; transition: transform .18s ease; }
.nav-group.open > .nav-toggle .nav-caret { transform: rotate(90deg); }
.nav-group.open > .nav-toggle { color: var(--branco); }
.nav-group.open > .nav-toggle i:first-child { color: var(--laranja); }

.nav-sub {
    display: grid;
    grid-template-rows: 0fr;           /* animacao de altura sem JS medir nada */
    transition: grid-template-rows .2s ease;
    margin-left: 23px;
    border-left: 1px solid var(--borda);
    padding-left: 8px;
}
.nav-group.open > .nav-sub { grid-template-rows: 1fr; }

/**
 * Filho UNICO, obrigatoriamente. grid-template-rows:0fr dimensiona so a
 * primeira linha; qualquer irmao vira linha implicita auto e o submenu nao
 * fecha nunca.
 */
.nav-sub-inner { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 2px; }
.nav-sub-title { display: none; }      /* so aparece no flyout do modo recolhido */

@supports not (grid-template-rows: 0fr) {
    .nav-sub { display: none; }
    .nav-group.open > .nav-sub { display: block; }
}

.nav-child { font-size: .82rem; padding: 8px 10px; }
.nav-child.active { border-left-color: var(--vermelho); }

.sidebar-collapse { margin-top: 8px; flex-shrink: 0; }
html.is-collapsed .sidebar-collapse i:first-child { transform: scaleX(-1); }

/* ---------------- Estado recolhido (desktop) ---------------- */
html.is-collapsed .logo-text,
html.is-collapsed .nav-label,
html.is-collapsed .nav-caret,
html.is-collapsed .sidebar-footer { display: none; }
html.is-collapsed .nav-item { justify-content: center; padding: 11px; }

/* Recolhido, o submenu vira flyout no hover - nao empurra o layout. */
html.is-collapsed .nav-sub {
    position: absolute; left: 100%; top: 0; z-index: 60;
    display: block; grid-template-rows: none;
    min-width: 216px; margin-left: 6px; padding: 8px;
    background: var(--cinza-escuro);
    border: 1px solid var(--borda); border-radius: var(--raio);
    box-shadow: var(--sombra);
    opacity: 0; visibility: hidden; transform: translateX(-6px);
    transition: opacity .14s, transform .14s, visibility .14s;
    
}
html.is-collapsed .nav-sub-inner { overflow: visible; min-height: auto; }
html.is-collapsed .nav-group { position: relative; }

/**
 * Ponte invisivel sobre o vao entre o icone e o flyout. Sem ela o mouse sai
 * do .nav-group ao atravessar o espaco, o hover cai e o menu pisca.
 */
html.is-collapsed .nav-group::after {
    content: ''; position: absolute; top: 0; bottom: 0; left: 100%; width: 12px;
    pointer-events: none;
}
html.is-collapsed .nav-group:hover::after,
html.is-collapsed .nav-group:focus-within::after { pointer-events: auto; }

html.is-collapsed .nav-group:hover > .nav-sub,
html.is-collapsed .nav-group:focus-within > .nav-sub {
    opacity: 1; visibility: visible; transform: translateX(0);
}

html.is-collapsed .nav-sub-title {
    display: block; padding: 4px 10px 8px;
    font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--texto-fraco); border-bottom: 1px solid var(--borda); margin-bottom: 6px;
}
html.is-collapsed .nav-child { justify-content: flex-start; padding: 9px 10px; }
html.is-collapsed .nav-child .nav-label { display: block; }

/* Tooltip dos itens simples quando recolhido. Grupos ficam de fora: o
   proprio flyout ja mostra o nome no titulo. */
html.is-collapsed .nav-item[data-tip]:not(.nav-toggle)::after {
    content: attr(data-tip);
    position: absolute; left: 100%; top: 50%; transform: translate(-6px, -50%);
    margin-left: 10px; padding: 6px 10px; z-index: 1150;
    background: var(--cinza-escuro); color: var(--texto);
    border: 1px solid var(--borda); border-radius: 7px;
    font-size: .78rem; font-weight: 400; white-space: nowrap;
    box-shadow: var(--sombra); pointer-events: none;
    opacity: 0; visibility: hidden;
    transition: opacity .12s, transform .12s, visibility .12s;
    transition-delay: 0s;
}
html.is-collapsed .nav-item[data-tip]:not(.nav-toggle):hover::after,
html.is-collapsed .nav-item[data-tip]:not(.nav-toggle):focus-visible::after {
    opacity: 1; visibility: visible; transform: translate(0, -50%);
    transition-delay: .35s;
}

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: 62px;
    background: var(--preto-2);
    border-bottom: 1px solid var(--borda);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 22px;
    position: sticky;
    top: 0;
    z-index: 900;
}

/*
 * min-width: 0 e o pulo do gato aqui: por padrao um item flex nao encolhe
 * abaixo do tamanho "natural" do conteudo (o <input>), entao sem isso a busca
 * empurra os botoes da direita para fora da tela em qualquer janela mais
 * estreita que um desktop bem largo - o bug que fazia a busca "sumir torta".
 */
.topbar-search { flex: 1; min-width: 0; max-width: 420px; position: relative; }
.topbar-search i { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--texto-fraco); font-size: 13px; }
.topbar-search input { padding-left: 36px; height: 38px; }

/* Grupo de acoes da direita nao pode encolher - quem cede espaco e a busca. */
.topbar-actions { margin-left: auto; flex-shrink: 0; }

.btn-icon {
    width: 38px; height: 38px;
    border-radius: var(--raio-sm);
    background: var(--cinza);
    border: 1px solid var(--borda);
    color: var(--texto-suave);
    display: grid; place-items: center;
    cursor: pointer;
    position: relative;
    transition: var(--transicao);
}

.btn-icon:hover { background: var(--cinza-claro); color: var(--branco); }

.btn-icon .dot {
    position: absolute; top: 6px; right: 7px;
    width: 8px; height: 8px;
    background: var(--vermelho);
    border-radius: 50%;
    border: 2px solid var(--preto-2);
}

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 12px 5px 6px;
    background: var(--cinza);
    border: 1px solid var(--borda);
    border-radius: 30px;
    cursor: pointer;
}

.user-chip .avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--vermelho), var(--laranja));
    display: grid; place-items: center;
    color: #fff; font-weight: 700; font-size: .8rem;
}

.user-chip .info { line-height: 1.15; }
.user-chip .info strong { font-size: .82rem; color: var(--branco); display: block; }
.user-chip .info small { font-size: .68rem; color: var(--texto-fraco); text-transform: capitalize; }

.content { padding: 24px; flex: 1; }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.page-head .subtitle { color: var(--texto-suave); font-size: .88rem; margin-top: 3px; }

/* ---------------- Cards ---------------- */
.card {
    background: var(--cinza-escuro);
    border: 1px solid var(--borda);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    overflow: hidden;
}

/* Card de itens do orcamento: o overflow:hidden do .card corta o dropdown
   de busca (.combo-busca-resultados) sempre que ele precisa estourar o
   fundo do card (ex.: ultimo item da lista) - o dropdown fica escondido
   atras dos cards seguintes em vez de flutuar por cima deles. */
.card-itens { overflow: visible; }

/* Mesmo motivo do .card-itens acima, mas para a tabela de itens da ordem de compra
   (.table-wrap usa overflow-x:auto para rolagem horizontal em telas estreitas, o que
   tambem corta overflow vertical - o dropdown de busca do material ficava escondido
   atras das linhas seguintes). Selector composto (.table-wrap.oc-itens-wrap) para
   garantir especificidade maior que a regra .table-wrap (definida mais abaixo). */
.table-wrap.oc-itens-wrap { overflow: visible; }

.card-head {
    padding: 15px 19px;
    border-bottom: 1px solid var(--borda);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
}

.card-head h3 { font-size: 1rem; display: flex; align-items: center; gap: 9px; }
.card-head h3 i { color: var(--laranja); }
.card-body { padding: 19px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.col-span-2 { grid-column: span 2; }

/* ---------------- Inspire-se (galeria de fotos/videos) ---------------- */
.inspire-card { padding: 0; overflow: hidden; }
.inspire-ler-mais {
    background: none; border: none; padding: 0; margin-left: 4px;
    color: var(--laranja); font-size: inherit; font-weight: 700; cursor: pointer;
}
.inspire-ler-mais:hover { text-decoration: underline; }
.inspire-thumb { display: block; position: relative; aspect-ratio: 16 / 9; background: #000; cursor: zoom-in; }
.inspire-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inspire-thumb-video { cursor: pointer; }
.video-thumb-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .35); color: #fff; font-size: 28px;
}

.video-fullscreen-overlay { position: fixed; inset: 0; z-index: 2200; background: #000; }
.video-fullscreen-overlay iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-fullscreen-close {
    position: absolute; top: 16px; right: 20px; z-index: 2201;
    width: 40px; height: 40px; border-radius: 50%; border: none;
    background: rgba(255, 255, 255, .1); color: #fff; font-size: 18px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.video-fullscreen-close:hover { background: rgba(255, 255, 255, .2); }

.inspire-lightbox {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .92);
    display: none;
    align-items: center; justify-content: center;
    z-index: 2200;
    padding: 40px;
    cursor: zoom-out;
}
.inspire-lightbox.open { display: flex; }
.inspire-lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--raio-sm); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); animation: popIn .2s ease; cursor: default; }
.inspire-lightbox-close {
    position: absolute; top: 20px; right: 24px;
    background: rgba(255, 255, 255, .1); border: none; color: #fff;
    width: 40px; height: 40px; border-radius: 50%; font-size: 18px; cursor: pointer;
}
.inspire-lightbox-close:hover { background: rgba(255, 255, 255, .2); }

/* ---------------- Stat cards ---------------- */
.stat {
    background: var(--cinza-escuro);
    border: 1px solid var(--borda);
    border-radius: var(--raio);
    padding: 19px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: var(--transicao);
}

.stat::after {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--vermelho);
}

.stat:hover { transform: translateY(-2px); border-color: var(--cinza-claro); }
.stat.laranja::after  { background: var(--laranja); }
.stat.verde::after    { background: var(--verde); }
.stat.azul::after     { background: var(--azul); }
.stat.amarelo::after  { background: var(--amarelo); }
.stat.vermelho::after { background: var(--vermelho); }

.stat-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: grid; place-items: center;
    font-size: 21px;
    background: rgba(192, 57, 43, .15);
    color: var(--vermelho-2);
    flex-shrink: 0;
}

.stat.laranja .stat-icon { background: rgba(230, 126, 34, .15); color: var(--laranja); }
.stat.verde .stat-icon   { background: rgba(39, 174, 96, .15);  color: var(--verde); }
.stat.azul .stat-icon     { background: rgba(41, 128, 185, .15); color: #4aa3df; }
.stat.amarelo .stat-icon  { background: rgba(241, 196, 15, .15); color: var(--amarelo); }
.stat.vermelho .stat-icon { background: rgba(192, 57, 43, .15);  color: var(--vermelho-2); }

.stat-value { font-size: 1.65rem; font-weight: 700; color: var(--branco); line-height: 1.1; }
.stat-label { font-size: .78rem; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .6px; }

/* ---------------- Botões ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--raio-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transicao);
    white-space: nowrap;
    text-decoration: none;
}

.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--vermelho); color: #fff; }
.btn-primary:hover { background: var(--vermelho-2); color: #fff; box-shadow: 0 4px 14px rgba(192, 57, 43, .35); }
.btn-orange { background: var(--laranja); color: #fff; }
.btn-orange:hover { background: var(--laranja-2); color: #fff; }
.btn-success { background: var(--verde); color: #fff; }
.btn-success:hover { background: #2ecc71; color: #fff; }
.btn-info { background: var(--azul); color: #fff; }
.btn-info:hover { background: #3498db; color: #fff; }
.btn-dark { background: var(--cinza); color: var(--texto); border-color: var(--borda); }
.btn-dark:hover { background: var(--cinza-claro); color: var(--branco); }
.btn-outline { background: transparent; border-color: var(--borda); color: var(--texto-suave); }
.btn-outline:hover { border-color: var(--laranja); color: var(--laranja); }
.btn-danger { background: transparent; border-color: rgba(192, 57, 43, .55); color: var(--vermelho-2); }
.btn-danger:hover { background: var(--vermelho); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .78rem; }
.btn-lg { padding: 13px 26px; font-size: .96rem; }
.btn-block { width: 100%; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- Formulários ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 15px; }
.f1  { grid-column: span 1; }  .f2  { grid-column: span 2; }
.f3  { grid-column: span 3; }  .f4  { grid-column: span 4; }
.f5  { grid-column: span 5; }  .f6  { grid-column: span 6; }
.f7  { grid-column: span 7; }  .f8  { grid-column: span 8; }
.f9  { grid-column: span 9; }  .f10 { grid-column: span 10; }
.f12 { grid-column: span 12; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
    font-size: .79rem;
    font-weight: 600;
    color: var(--texto-suave);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.field label .req { color: var(--vermelho-2); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=tel], input[type=search],
input[type=color], select, textarea {
    width: 100%;
    background: var(--preto-2);
    border: 1px solid var(--borda);
    border-radius: var(--raio-sm);
    color: var(--texto);
    padding: 10px 13px;
    font-family: inherit;
    font-size: .9rem;
    transition: var(--transicao);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--laranja);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, .13);
}

input::placeholder, textarea::placeholder { color: var(--texto-fraco); }
input[type=color] { padding: 4px; height: 42px; cursor: pointer; }
textarea { resize: vertical; min-height: 92px; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23a0a0a0'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    background-size: 19px;
    padding-right: 33px;
}

.field .hint { font-size: .74rem; color: var(--texto-fraco); }
.field .error { font-size: .76rem; color: var(--vermelho-2); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--vermelho); }

/* ---------------- Busca de cliente em tempo real ---------------- */
.combo-busca { position: relative; }

.combo-busca-resultados {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    z-index: 60;
    max-height: 260px;
    overflow-y: auto;
    background: var(--preto-2);
    border: 1px solid var(--borda);
    border-radius: var(--raio-sm);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
}

.combo-busca-resultados.open { display: block; }

.combo-busca-item {
    padding: 9px 13px;
    font-size: .87rem;
    color: var(--texto);
    cursor: pointer;
    border-bottom: 1px solid var(--borda);
}

.combo-busca-item:last-child { border-bottom: none; }
.combo-busca-item:hover, .combo-busca-item.active { background: rgba(230, 126, 34, .13); }

.combo-busca-item .doc { display: block; font-size: .74rem; color: var(--texto-fraco); margin-top: 2px; }

.combo-busca-vazio, .combo-busca-carregando {
    padding: 10px 13px;
    font-size: .84rem;
    color: var(--texto-fraco);
}

.check {
    display: flex; align-items: center; gap: 9px;
    font-size: .88rem; color: var(--texto); cursor: pointer;
    user-select: none;
}

.check input { width: 17px; height: 17px; accent-color: var(--vermelho); cursor: pointer; }

/* Toggle switch (ativar/desativar) - alternativa mais moderna ao checkbox simples do .check */
.toggle-switch {
    display: inline-flex; align-items: center; gap: 9px;
    font-size: .88rem; color: var(--texto); cursor: pointer;
    user-select: none;
}

.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle-switch .toggle-track {
    position: relative; flex-shrink: 0;
    width: 38px; height: 21px;
    background: var(--borda-forte, #555);
    border-radius: 999px;
    transition: background .18s ease;
}

.toggle-switch .toggle-track::before {
    content: '';
    position: absolute; top: 2px; left: 2px;
    width: 17px; height: 17px;
    background: #fff; border-radius: 50%;
    transition: transform .18s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.35);
}

.toggle-switch input:checked + .toggle-track { background: var(--verde); }
.toggle-switch input:checked + .toggle-track::before { transform: translateX(17px); }
.toggle-switch input:focus-visible + .toggle-track { outline: 2px solid var(--azul); outline-offset: 2px; }
.toggle-switch input:disabled + .toggle-track { opacity: .5; cursor: not-allowed; }

.form-actions {
    display: flex; gap: 10px; flex-wrap: wrap;
    padding-top: 17px; margin-top: 17px;
    border-top: 1px solid var(--borda);
}

fieldset { border: 1px solid var(--borda); border-radius: var(--raio); padding: 17px; margin-bottom: 17px; }
legend { padding: 0 9px; font-size: .82rem; font-weight: 700; color: var(--laranja); text-transform: uppercase; letter-spacing: .8px; }

/* ---------------- Tabelas ---------------- */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }

thead th {
    background: var(--preto-2);
    color: var(--texto-suave);
    text-align: left;
    padding: 12px 14px;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .7px;
    font-weight: 700;
    border-bottom: 1px solid var(--borda);
    white-space: nowrap;
}

tbody td { padding: 12px 14px; border-bottom: 1px solid rgba(56, 56, 56, .55); vertical-align: middle; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
tbody tr:last-child td { border-bottom: none; }

td.num, th.num { text-align: right; white-space: nowrap; }

/* Leads por origem (relatorios): card estreito de 1/3 da grid-3 - largura
   fixa por coluna evita que numero/cabecalho fiquem desalinhados quando o
   layout automatico da tabela recalcula em containers apertados. */
.table-leads-origem { table-layout: fixed; }
.table-leads-origem th:first-child, .table-leads-origem td:first-child { width: 40%; }
.table-leads-origem th.num, .table-leads-origem td.num { width: 20%; padding: 24px; }
td.acoes { white-space: nowrap; text-align: right; }
td strong { color: var(--branco); }

.empty { padding: 46px 20px; text-align: center; color: var(--texto-fraco); }
.empty i { font-size: 42px; opacity: .28; display: block; margin-bottom: 13px; }
.empty p { margin-bottom: 14px; }

/* ---------------- Badges ---------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
}

.badge-success   { background: rgba(39, 174, 96, .16);  color: #37d47e; }
.badge-danger    { background: rgba(192, 57, 43, .17);  color: #e8604f; }
.badge-warning   { background: rgba(241, 196, 15, .15); color: #f1c40f; }
.badge-info      { background: rgba(41, 128, 185, .17); color: #56aae0; }
.badge-primary   { background: rgba(155, 89, 182, .17); color: #b07cc6; }
.badge-orange    { background: rgba(230, 126, 34, .17); color: var(--laranja); }
.badge-secondary { background: rgba(160, 160, 160, .13); color: var(--texto-suave); }
.badge-dark      { background: rgba(0, 0, 0, .35); color: var(--texto-fraco); }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--cinza);
    border: 1px solid var(--borda);
    border-radius: 20px;
    padding: 3px 11px;
    font-size: .76rem;
    color: var(--texto-suave);
}

.pill-tabs { display: flex; gap: 7px; flex-wrap: wrap; }

.pill-tabs a {
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--cinza);
    border: 1px solid var(--borda);
    color: var(--texto-suave);
    font-size: .82rem;
    font-weight: 600;
}

.pill-tabs a.active, .pill-tabs a:hover { background: var(--vermelho); border-color: var(--vermelho); color: #fff; }

/* ---------------- Alertas / toasts ---------------- */
.alert {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 13px 16px;
    border-radius: var(--raio-sm);
    border-left: 4px solid;
    margin-bottom: 15px;
    font-size: .89rem;
}

.alert i { margin-top: 2px; }
.alert-success { background: rgba(39, 174, 96, .1);  border-color: var(--verde);    color: #6ee7a0; }
.alert-danger  { background: rgba(192, 57, 43, .1);  border-color: var(--vermelho); color: #f08d80; }
.alert-warning { background: rgba(241, 196, 15, .09); border-color: var(--amarelo); color: #f5d76e; }
.alert-info    { background: rgba(41, 128, 185, .1); border-color: var(--azul);     color: #7fc0ea; }

.toast-stack { position: fixed; top: 76px; right: 22px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; max-width: 370px; }

.toast {
    display: flex; align-items: flex-start; gap: 11px;
    background: var(--cinza-escuro);
    border: 1px solid var(--borda);
    border-left: 4px solid var(--laranja);
    border-radius: var(--raio-sm);
    padding: 13px 16px;
    box-shadow: var(--sombra);
    animation: slideIn .3s ease;
    font-size: .88rem;
}

.toast.success { border-left-color: var(--verde); }
.toast.danger  { border-left-color: var(--vermelho); }
.toast.warning { border-left-color: var(--amarelo); }
.toast.info    { border-left-color: var(--azul); }
.toast .close { margin-left: auto; background: none; border: none; color: var(--texto-fraco); cursor: pointer; font-size: 15px; }

@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Sino de notificações do navbar.
   Ver app/Views/partials/notificacoes.php e o bloco "Notificações" em
   assets/js/app.js — este bloco só cuida da aparência.
   ========================================================================== */

.notif-wrap { position: relative; }

.notif-sino {
    position: relative;
    display: grid; place-items: center;
    width: 36px; height: 36px;
    background: none; border: 0; border-radius: var(--raio-sm); cursor: pointer;
    color: var(--texto-suave);
}
.notif-sino:hover { background: var(--cinza); color: var(--texto); }

.notif-badge {
    position: absolute; top: 2px; right: 2px;
    min-width: 16px; height: 16px; padding: 0 4px;
    display: grid; place-items: center;
    background: var(--vermelho); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 1;
    border-radius: 999px; border: 2px solid var(--cinza-escuro);
}

/* Pulso discreto sempre que a contagem SOBE — chama a atenção sem ser
   irritante: só uma vez por notificação nova, não em loop constante. */
.notif-badge.pulso { animation: notif-pulso .6s ease-out; }
@keyframes notif-pulso {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

.notif-painel {
    position: absolute; top: calc(100% + 8px); right: 0;
    width: 320px; max-width: calc(100vw - 32px);
    background: var(--cinza-escuro); border: 1px solid var(--borda);
    border-radius: var(--raio); box-shadow: var(--sombra);
    z-index: 50;
}

.notif-painel-titulo {
    padding: 12px 14px; font-size: 13px; font-weight: 600;
    border-bottom: 1px solid var(--borda);
}

.notif-painel-lista { max-height: 340px; overflow-y: auto; }

.notif-painel-rodape {
    padding: 8px 14px; border-top: 1px solid var(--borda); text-align: center;
    display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}

.link-btn {
    background: none; border: 0; padding: 0; cursor: pointer;
    color: var(--texto-suave); font-size: 12px; text-decoration: underline;
}
.link-btn:hover { color: var(--texto); }
.link-btn:disabled { cursor: default; opacity: .6; text-decoration: none; }
#btn-ativar-push.active { color: var(--verde); }

.notif-item {
    display: block; padding: 10px 14px; text-decoration: none; color: inherit;
    border-bottom: 1px solid var(--borda);
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--cinza); }
.notif-item strong { display: block; font-size: 13px; color: var(--texto); }
.notif-item span { display: block; font-size: 12px; color: var(--texto-suave); margin-top: 2px; }

.notif-vazio { padding: 18px 14px; text-align: center; color: var(--texto-suave); font-size: 13px; }

/* ---------------- Avisos flutuantes (agendamento amanha) ---------------- */
.floap-stack {
    /* z-index acima do .sidebar recolhido (9999, ver html.is-collapsed .sidebar) - senao a
       propria sidebar pinta por cima da borda esquerda do card. */
    position: fixed; bottom: 22px; right: 22px; z-index: 10050;
    display: flex; flex-direction: column-reverse; gap: 10px; max-width: 340px;
}

.floap {
    display: flex; align-items: flex-start; gap: 11px;
    background: var(--cinza-escuro);
    border: 1px solid var(--borda);
    border-left: 4px solid var(--laranja);
    border-radius: var(--raio-sm);
    padding: 13px 14px;
    box-shadow: var(--sombra);
    animation: slideIn .3s ease;
    font-size: .85rem;
}

.floap i.fa-calendar-clock { color: var(--laranja); margin-top: 2px; }
.floap .floap-body { display: flex; flex-direction: column; gap: 2px; }
.floap .floap-body strong { font-size: .87rem; }
.floap .floap-cliente { color: var(--texto); }
.floap .floap-quando { color: var(--texto-fraco); font-size: .78rem; }
.floap .floap-body a { color: var(--laranja); font-size: .78rem; margin-top: 3px; }
.floap .close { margin-left: auto; background: none; border: none; color: var(--texto-fraco); cursor: pointer; font-size: 15px; }

@media (max-width: 640px) {
    .floap-stack { left: 14px; right: 14px; bottom: 14px; max-width: none; }
}

/* ---------------- Modal ---------------- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .72);
    display: none;
    align-items: center; justify-content: center;
    z-index: 2000;
    padding: 20px;
    backdrop-filter: blur(2px);
}

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

.modal {
    background: var(--cinza-escuro);
    border: 1px solid var(--borda);
    border-radius: var(--raio);
    width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
    animation: popIn .2s ease;
}

/* ---------------- Selecao em massa ---------------- */
.bulk-bar {
    display: none;
    align-items: center;
    gap: 12px;
    background: rgba(230, 126, 34, .13);
    border: 1px solid var(--laranja);
    border-radius: var(--raio-sm);
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: .87rem;
    color: var(--texto);
}

.bulk-bar[data-open] { display: flex; }
.bulk-bar strong { color: var(--laranja); }

.modal.wide { max-width: 780px; }

/* Modal da ordem de compra: a tabela de itens tem varias colunas numericas fixas -
   sem largura extra o campo "nome do material" fica espremido e corta o texto. */
.modal.modal-oc { max-width: 960px; }
.modal-head { padding: 17px 20px; border-bottom: 1px solid var(--borda); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 1.05rem; }
.modal-body { padding: 20px; }
.modal-foot { padding: 15px 20px; border-top: 1px solid var(--borda); display: flex; gap: 10px; justify-content: flex-end; }
.modal .close-x { background: none; border: none; color: var(--texto-fraco); font-size: 19px; cursor: pointer; }

@keyframes popIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: none; } }

/* ---------------- Paginação ---------------- */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 17px; flex-wrap: wrap; }

.pagination a, .pagination span {
    min-width: 36px; height: 36px;
    padding: 0 11px;
    border-radius: var(--raio-sm);
    background: var(--cinza);
    border: 1px solid var(--borda);
    color: var(--texto-suave);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .85rem; font-weight: 600;
}

.pagination a:hover { background: var(--cinza-claro); color: var(--branco); }
.pagination .current { background: var(--vermelho); border-color: var(--vermelho); color: #fff; }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ---------------- Filtros ---------------- */
.filters {
    display: flex; gap: 11px; flex-wrap: wrap; align-items: flex-end;
    background: var(--cinza-escuro);
    border: 1px solid var(--borda);
    border-radius: var(--raio);
    padding: 15px 17px;
    margin-bottom: 18px;
}

.filters .field { flex: 1; min-width: 155px; }

/* ---------------- Timeline ---------------- */
.timeline { position: relative; padding-left: 27px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 5px; bottom: 5px; width: 2px; background: var(--borda); }
.timeline-item { position: relative; padding-bottom: 19px; }

.timeline-item::before {
    content: '';
    position: absolute; left: -24px; top: 5px;
    width: 11px; height: 11px;
    border-radius: 50%;
    background: var(--laranja);
    border: 2px solid var(--cinza-escuro);
    box-shadow: 0 0 0 2px var(--laranja);
}

.timeline-item .time { font-size: .74rem; color: var(--texto-fraco); }
.timeline-item .desc { font-size: .89rem; }

/* ---------------- Calendário ---------------- */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.calendar .dow { text-align: center; font-size: .72rem; font-weight: 700; color: var(--texto-fraco); text-transform: uppercase; padding: 7px 0; }

.calendar .day {
    min-height: 96px;
    background: var(--preto-2);
    border: 1px solid var(--borda);
    border-radius: var(--raio-sm);
    padding: 7px;
    font-size: .78rem;
    overflow: hidden;
}

.calendar .day.out { opacity: .38; }
.calendar .day.today { border-color: var(--laranja); box-shadow: inset 0 0 0 1px var(--laranja); }
.calendar .day .n { font-weight: 700; color: var(--texto-suave); margin-bottom: 5px; display: block; }
.calendar .day.today .n { color: var(--laranja); }

.cal-event {
    display: block;
    background: rgba(192, 57, 43, .2);
    border-left: 3px solid var(--vermelho);
    border-radius: 4px;
    padding: 3px 6px;
    margin-bottom: 3px;
    font-size: .71rem;
    color: var(--texto);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.cal-event.concluido      { background: rgba(39, 174, 96, .18);  border-color: var(--verde); }
.cal-event.cancelado      { background: rgba(120, 120, 120, .16); border-color: #777; opacity: .65; text-decoration: line-through; }
.cal-event.em_atendimento { background: rgba(230, 126, 34, .2);  border-color: var(--laranja); }
.cal-event.solicitado,
.cal-event.agendado,
.cal-event.remarcado      { background: rgba(241, 196, 15, .16); border-color: var(--amarelo); }
.cal-event.atrasado       { background: rgba(192, 57, 43, .2);   border-color: var(--vermelho); }

/* ---------------- Barras / gráficos ---------------- */
.bars { display: flex; flex-direction: column; gap: 13px; }
.bar-row .bar-label { display: flex; justify-content: space-between; font-size: .82rem; margin-bottom: 5px; }
.bar-row .bar-label span:last-child { color: var(--texto-suave); font-weight: 600; }
.bar-track { height: 9px; background: var(--preto-2); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--vermelho), var(--laranja)); border-radius: 6px; transition: width .5s ease; }
.bar-fill.verde  { background: linear-gradient(90deg, #1e8449, var(--verde)); }
.bar-fill.azul   { background: linear-gradient(90deg, #1f618d, #4aa3df); }
.bar-fill.amarelo{ background: linear-gradient(90deg, #b7950b, var(--amarelo)); }

.chart-columns { display: flex; align-items: flex-end; gap: 9px; height: 190px; padding-top: 12px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-col .col-bar { width: 100%; background: linear-gradient(180deg, var(--laranja), var(--vermelho)); border-radius: 5px 5px 0 0; min-height: 3px; transition: var(--transicao); position: relative; }
.chart-col .col-bar:hover { filter: brightness(1.22); }
.chart-col .col-label { font-size: .67rem; color: var(--texto-fraco); white-space: nowrap; }
.chart-col .col-value { font-size: .68rem; color: var(--texto-suave); font-weight: 600; }

/* ---------------- Itens do orçamento ---------------- */
.item-row {
    background: var(--preto-2);
    border: 1px solid var(--borda);
    border-radius: var(--raio);
    padding: 15px;
    margin-bottom: 13px;
    position: relative;
}

.item-row .item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.item-row .item-num { width: 26px; height: 26px; border-radius: 50%; background: var(--vermelho); color: #fff; display: grid; place-items: center; font-size: .76rem; font-weight: 700; flex-shrink: 0; }
.item-row .remove-item { margin-left: auto; background: none; border: none; color: var(--texto-fraco); cursor: pointer; font-size: 15px; padding: 5px; }
.item-row .remove-item:hover { color: var(--vermelho-2); }

.item-extra { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--borda); }
.item-extra.show { display: block; }
.item-extra .legend-mini { font-size: .74rem; font-weight: 700; color: var(--laranja); text-transform: uppercase; letter-spacing: .7px; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }

.totals-box { background: var(--preto-2); border: 1px solid var(--borda); border-radius: var(--raio); padding: 17px; }
.totals-line { display: flex; justify-content: space-between; padding: 7px 0; font-size: .9rem; }
.totals-line.total { border-top: 1px solid var(--borda); margin-top: 9px; padding-top: 13px; font-size: 1.25rem; font-weight: 700; color: var(--laranja); }

/* ---------------- Login ---------------- */
.auth-page {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 22px;
    background:
        radial-gradient(circle at 15% 15%, rgba(192, 57, 43, .16), transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(230, 126, 34, .13), transparent 45%),
        var(--preto);
}

.auth-card {
    width: 100%; max-width: 415px;
    background: var(--cinza-escuro);
    border: 1px solid var(--borda);
    border-radius: 15px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, .55);
    overflow: hidden;
}

.auth-head { padding: 34px 30px 22px; text-align: center; border-bottom: 1px solid var(--borda); }

.auth-head .logo-mark {
    width: 62px; height: 62px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--vermelho), var(--laranja));
    display: grid; place-items: center;
    color: #fff; font-size: 27px;
    margin: 0 auto 15px;
    box-shadow: 0 8px 24px rgba(192, 57, 43, .42);
}

.auth-head h1 { font-size: 1.8rem; letter-spacing: 1px; }
.auth-head p { color: var(--texto-fraco); font-size: .82rem; text-transform: uppercase; letter-spacing: 1.4px; margin-top: 3px; }
.auth-body { padding: 27px 30px 32px; }
.auth-body .field { margin-bottom: 15px; }
.auth-foot { text-align: center; font-size: .82rem; color: var(--texto-fraco); margin-top: 17px; }

/* ---------------- Portal do cliente ---------------- */
.portal-header {
    background: var(--preto-2);
    border-bottom: 1px solid var(--borda);
    padding: 0 22px;
    position: sticky; top: 0; z-index: 900;
}

.portal-header .row { display: flex; align-items: center; gap: 16px; height: 64px; }
.portal-nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 1px; }

.portal-nav a {
    padding: 12px 15px;
    color: var(--texto-suave);
    font-size: .87rem; font-weight: 600;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.portal-nav a:hover { color: var(--branco); }
.portal-nav a.active { color: var(--laranja); border-bottom-color: var(--laranja); }
.portal-main { max-width: 1180px; margin: 0 auto; padding: 26px 22px; }

/* ---------------- Utilitários ---------------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-center { display: flex; align-items: center; gap: 9px; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 7px; } .gap { gap: 12px; } .gap-lg { gap: 20px; }
.mt-0 { margin-top: 0; } .mt { margin-top: 15px; } .mt-lg { margin-top: 25px; }
.mb-0 { margin-bottom: 0; } .mb { margin-bottom: 15px; } .mb-lg { margin-bottom: 25px; }
.text-muted { color: var(--texto-suave); }
.text-faint { color: var(--texto-fraco); }
.text-white { color: var(--branco); }
.text-orange { color: var(--laranja); }
.text-red { color: var(--vermelho-2); }
.text-green { color: var(--verde); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.small { font-size: .8rem; }
.smaller { font-size: .73rem; }
.bold { font-weight: 700; }
.upper { text-transform: uppercase; letter-spacing: .6px; }
.nowrap { white-space: nowrap; }
.w-100 { width: 100%; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--borda); margin: 17px 0; }

/* Aliases no estilo Bootstrap, para trechos que usam essa nomenclatura */
.bg-success { background: rgba(39, 174, 96, .16);  color: #37d47e; }
.bg-danger  { background: rgba(192, 57, 43, .17);  color: #e8604f; }
.bg-warning { background: rgba(241, 196, 15, .15); color: #f1c40f; }
.bg-info    { background: rgba(41, 128, 185, .17); color: #56aae0; }
.ms-1 { margin-left: 5px; }  .ms-2 { margin-left: 9px; }
.me-1 { margin-right: 5px; } .me-2 { margin-right: 9px; }
.mx-1 { margin-left: 5px; margin-right: 5px; }
.my-1 { margin-top: 5px; margin-bottom: 5px; }

.info-list { display: grid; gap: 11px; }
.info-list .row { display: flex; justify-content: space-between; gap: 14px; font-size: .88rem; }
.info-list .row span:first-child { color: var(--texto-suave); }
.info-list .row span:last-child { color: var(--branco); text-align: right; font-weight: 500; }

.plate {
    display: inline-block;
    background: #f0f0f0;
    color: #111;
    font-weight: 800;
    letter-spacing: 1.6px;
    padding: 2px 9px;
    border-radius: 4px;
    font-size: .8rem;
    border: 2px solid #333;
    font-family: 'Courier New', monospace;
}

.sidebar-toggle { display: none; }

/* ==========================================================
   Pagina inicial publica (landing page) e telas de login
   ========================================================== */

/* ---------------- Cabecalho ---------------- */
.site-header {
    position: sticky; top: 0; z-index: 500;
    background: rgba(19, 19, 19, .92);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--borda);
}

.site-header-inner {
    max-width: 1160px; margin: 0 auto;
    padding: 14px 22px;
    display: flex; align-items: center; gap: 24px;
}

.site-logo { display: flex; align-items: center; gap: 11px; color: var(--branco); text-decoration: none; }
.site-logo:hover { text-decoration: none; }
.site-logo img { height: 38px; width: auto; border-radius: 8px; }

.site-logo-mark {
    width: 38px; height: 38px; border-radius: 9px;
    background: linear-gradient(135deg, var(--vermelho), var(--laranja));
    display: grid; place-items: center; color: #fff; font-size: 17px;
    box-shadow: 0 3px 10px rgba(192, 57, 43, .4);
}

.site-logo-text { font-size: 1.1rem; font-weight: 700; letter-spacing: .2px; }

.site-nav { display: flex; gap: 22px; margin-left: auto; }
.site-nav a { color: var(--texto-suave); font-size: .9rem; font-weight: 500; }
.site-nav a:hover { color: var(--branco); text-decoration: none; }

.site-actions { display: flex; gap: 9px; flex-shrink: 0; }
.nav-mobile-only { display: none; }
.site-burger {
    display: none; background: none; border: 1px solid var(--borda);
    color: var(--texto); width: 40px; height: 40px; border-radius: var(--raio-sm);
    font-size: 16px; cursor: pointer;
}

/* ---------------- Hero ---------------- */
.hero {
    background:
        radial-gradient(circle at 12% 8%, rgba(192, 57, 43, .16), transparent 45%),
        radial-gradient(circle at 88% 12%, rgba(230, 126, 34, .13), transparent 45%),
        var(--preto);
    padding: 76px 22px;
}

.hero-inner {
    max-width: 1160px; margin: 0 auto;
    display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px;
    align-items: center;
}

.hero-tag {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(230, 126, 34, .14); border: 1px solid rgba(230, 126, 34, .35);
    color: var(--laranja); font-size: .78rem; font-weight: 700;
    padding: 6px 14px; border-radius: 20px; margin-bottom: 18px;
}

.hero h1 { font-size: 2.5rem; line-height: 1.18; margin-bottom: 18px; letter-spacing: -.3px; }
.hero-text p { color: var(--texto-suave); font-size: 1.05rem; line-height: 1.6; max-width: 560px; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-stats { display: flex; gap: 32px; margin-top: 36px; flex-wrap: wrap; }
.hero-stats strong { display: block; font-size: 1.8rem; color: var(--branco); line-height: 1; }
.hero-stats span { font-size: .78rem; color: var(--texto-fraco); text-transform: uppercase; letter-spacing: .6px; }

.hero-visual { display: flex; justify-content: center; }
.hero-card {
    width: 260px; height: 260px; border-radius: 32px;
    background: linear-gradient(145deg, var(--cinza-escuro), var(--preto-2));
    border: 1px solid var(--borda);
    display: grid; place-items: center;
    box-shadow: var(--sombra);
}
.hero-card i { font-size: 96px; background: linear-gradient(135deg, var(--vermelho), var(--laranja));
    -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------------- Formulario de orcamento ---------------- */
.quote-form {
    max-width: 760px; margin: 0 auto;
    background: var(--cinza-escuro); border: 1px solid var(--borda);
    border-radius: var(--raio); padding: 30px;
    box-shadow: var(--sombra);
}

/* Campo-armadilha: invisivel para uma pessoa (fora da tela, sem foco por
   teclado), mas presente no HTML - a maioria dos robos de spam preenche
   qualquer input que encontrar. */
.quote-honeypot { position: absolute; left: -9999px; top: -9999px; opacity: 0; height: 0; overflow: hidden; }

.doc-toggle { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.doc-toggle-option {
    flex: 1; min-width: 200px;
    display: flex; align-items: center; gap: 9px;
    padding: 12px 16px; border-radius: var(--raio-sm);
    background: var(--preto-2); border: 1px solid var(--borda);
    cursor: pointer; transition: var(--transicao); font-size: .88rem; color: var(--texto-suave);
}
.doc-toggle-option:has(input:checked),
.doc-toggle-option.is-active { border-color: var(--laranja); background: rgba(230, 126, 34, .1); color: var(--branco); }
.doc-toggle-option input { accent-color: var(--laranja); }

.doc-feedback {
    display: block; font-size: .78rem; margin-top: 5px; min-height: 1.2em;
    color: var(--texto-fraco);
}
.doc-feedback.valid   { color: #37d47e; }
.doc-feedback.invalid { color: #e8604f; }
.doc-feedback.warning { color: var(--amarelo); }
.doc-feedback.loading { color: var(--texto-fraco); font-style: italic; }

.quote-submit { width: 100%; margin-top: 6px; }
.quote-privacy { text-align: center; font-size: .76rem; color: var(--texto-fraco); margin-top: 14px; }
.quote-privacy i { margin-right: 4px; }

/* ---------------- Secoes ---------------- */
.site-section { max-width: 1160px; margin: 0 auto; padding: 68px 22px; }
.site-section.alt { max-width: none; background: var(--preto-2); border-top: 1px solid var(--borda); border-bottom: 1px solid var(--borda); }
.site-section.alt > * { max-width: 1160px; margin-left: auto; margin-right: auto; }

.site-section-head { text-align: center; max-width: 620px; margin: 0 auto 40px; }
.site-section-head h2 { font-size: 1.9rem; margin-bottom: 10px; }
.site-section-head p { color: var(--texto-suave); font-size: .98rem; }

.service-card { padding: 26px; text-align: center; }
.service-icon {
    width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 14px;
    background: rgba(230, 126, 34, .14); color: var(--laranja);
    display: grid; place-items: center; font-size: 22px;
}
.service-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.service-card p { color: var(--texto-suave); font-size: .88rem; line-height: 1.55; }

.diff-card { text-align: center; padding: 8px; }
.diff-icon {
    width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%;
    background: rgba(192, 57, 43, .14); color: var(--vermelho-2);
    display: grid; place-items: center; font-size: 20px;
}
.diff-card h3 { font-size: .98rem; margin-bottom: 6px; }
.diff-card p { color: var(--texto-suave); font-size: .85rem; line-height: 1.5; }

/* ---------------- Passos ---------------- */
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; }
.step { position: relative; text-align: center; padding: 22px 14px; background: var(--cinza-escuro);
        border: 1px solid var(--borda); border-radius: var(--raio); }
.step-num {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--vermelho); color: #fff; font-size: .78rem; font-weight: 700;
    display: grid; place-items: center;
}
.step-icon { font-size: 22px; color: var(--laranja); margin: 10px 0 12px; }
.step h3 { font-size: .92rem; margin-bottom: 6px; }
.step p { font-size: .8rem; color: var(--texto-suave); line-height: 1.5; }

/* ---------------- CTA ---------------- */
.site-cta {
    background: linear-gradient(120deg, var(--vermelho), var(--laranja));
    padding: 56px 22px; text-align: center;
}
.site-cta-inner { max-width: 640px; margin: 0 auto; }
.site-cta h2 { font-size: 1.7rem; color: #fff; margin-bottom: 10px; }
.site-cta p { color: rgba(255, 255, 255, .9); margin-bottom: 24px; }
.site-cta .btn-primary { background: #1a1a1a; }
.site-cta .btn-primary:hover { background: #000; }

/* ---------------- Contato ---------------- */
.contact-card { text-align: center; padding: 26px; background: var(--cinza-escuro); border: 1px solid var(--borda); border-radius: var(--raio); }
.contact-card i { font-size: 26px; color: var(--laranja); margin-bottom: 12px; }
.contact-card h3 { font-size: 1rem; margin-bottom: 8px; }
.contact-card p { color: var(--texto-suave); font-size: .9rem; margin-bottom: 8px; line-height: 1.5; }

/* ---------------- Rodape do site ---------------- */
.site-footer { background: var(--preto-2); border-top: 1px solid var(--borda); padding: 30px 22px; }
.site-footer-inner {
    max-width: 1160px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.site-footer-inner strong { color: var(--branco); display: block; }
.site-footer-inner span { color: var(--texto-fraco); font-size: .78rem; }
.site-footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer-links a { color: var(--texto-suave); font-size: .85rem; }
.site-footer-copy { width: 100%; text-align: center; color: var(--texto-fraco); font-size: .76rem; padding-top: 16px; border-top: 1px solid var(--borda); margin-top: 6px; }

/* ---------------- Extras do login ---------------- */
.auth-switch {
    margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--borda);
    text-align: center; font-size: .84rem; color: var(--texto-suave);
    padding-left: 30px; padding-right: 30px; padding-bottom: 4px;
}
.auth-switch i { color: var(--laranja); margin-right: 4px; }
.auth-switch a { font-weight: 600; margin-left: 4px; }

.auth-hint {
    margin: 0 30px 24px; padding: 12px 14px; border-radius: var(--raio-sm);
    background: rgba(41, 128, 185, .1); border: 1px solid rgba(41, 128, 185, .3);
    color: var(--texto-suave); font-size: .8rem; line-height: 1.5;
}
.auth-hint i { color: #56aae0; margin-right: 4px; }

.auth-back {
    display: inline-flex; align-items: center; gap: 7px;
    margin-top: 18px; color: var(--texto-fraco); font-size: .85rem;
}
.auth-back:hover { color: var(--texto); text-decoration: none; }

/* ---------------- Responsivo ---------------- */
@media (max-width: 1200px) {
    .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }

    /* Laptop/desktop mais estreito: a busca cede espaco antes de comecar a
       apertar os botoes da direita. */
    .topbar-search { max-width: 260px; }
}

@media (max-width: 1024px) {
    /* Filtros em pilula (setor/categoria): no tablet/celular a lista nao cabe
       e quebrar em varias linhas empurra a tabela pra muito longe do topo.
       Vira um carrossel horizontal com scroll, igual ao padrao de chips do
       Instagram/Twitter - mantem tudo visivel e a 1 toque, sem esconder
       opcoes atras de um dropdown. */
    .pill-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .pill-tabs::-webkit-scrollbar { display: none; }
    .pill-tabs a { white-space: nowrap; flex: 0 0 auto; }
}

@media (max-width: 992px) {
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .col-span-2 { grid-column: span 1; }
    .f3, .f4, .f5 { grid-column: span 6; }

    /* Tablet: economiza espaco no topo - so o icone do "Novo orcamento"
       e a busca ainda menor, sem sumir de vez (isso so acontece no celular). */
    .topbar { gap: 10px; padding: 0 16px; }
    .topbar-actions .btn-primary .nowrap { display: none; }
    .topbar-actions .btn-primary { padding-left: 11px; padding-right: 11px; }
    .topbar-search { max-width: 160px; }

    .site-burger { display: grid; place-items: center; }
    .site-nav {
        display: none; position: absolute; top: 100%; left: 0; right: 0;
        flex-direction: column; gap: 2px; padding: 10px 22px 16px;
        background: var(--preto-2); border-bottom: 1px solid var(--borda);
    }
    .site-nav.open { display: flex; }
    .site-nav a { padding: 10px 4px; border-bottom: 1px solid var(--borda); }
    .site-nav a:last-child { border-bottom: 0; }
    .site-nav .nav-mobile-only { display: block; }
    .site-actions { display: none; }
    .hero-inner { grid-template-columns: 1fr; text-align: center; }
    .hero-text p { margin-left: auto; margin-right: auto; }
    .hero-actions { justify-content: center; }
    .hero-stats { justify-content: center; }
    .hero-visual { display: none; }
    .steps { grid-template-columns: repeat(2, 1fr); gap: 28px 16px; margin-top: 10px; }
}

@media (max-width: 768px) {
    /* No celular a sidebar vira gaveta sobreposta - o recolher-para-icones
       nao faz sentido numa tela pequena, so a gaveta abre/fecha. */
    .sidebar,
    html.is-collapsed .sidebar { width: var(--sidebar-w); transform: translateX(-100%); }
    .sidebar.open { transform: none; }
    .main,
    html.is-collapsed .main { margin-left: 0; }
    html.is-collapsed .logo-text,
    html.is-collapsed .nav-label,
    html.is-collapsed .nav-caret,
    html.is-collapsed .sidebar-footer { display: revert; }
    html.is-collapsed .nav-item { justify-content: flex-start; padding: 11px 13px; }
    html.is-collapsed .nav-sub {
        position: static; opacity: 1; visibility: visible; transform: none;
        background: none; border: 0; box-shadow: none; padding: 0;
        margin-left: 23px; border-left: 1px solid var(--borda); padding-left: 8px;
        display: grid; grid-template-rows: 0fr; min-width: 0;
    }
    html.is-collapsed .nav-group.open > .nav-sub { grid-template-rows: 1fr; }
    html.is-collapsed .nav-sub-inner { overflow: hidden; min-height: 0; }
    html.is-collapsed .nav-group::after { content: none; }
    html.is-collapsed .nav-sub-title { display: none; }
    html.is-collapsed .nav-item[data-tip]::after { content: none; }
    .sidebar-collapse { display: none; }   /* fechar e pela gaveta/backdrop */
    .sidebar-toggle { display: grid; }
    .content { padding: 16px; }
    .grid-4, .grid-5 { grid-template-columns: 1fr; }
    .form-grid > [class^="f"] { grid-column: span 12; }
    .topbar-search { display: none; }
    .user-chip .info { display: none; }
    /* "Alterar senha" some no celular - o perfil (clique no avatar) ja resolve. */
    .topbar-senha { display: none; }
    .topbar { gap: 6px; padding: 0 12px; }
    .page-head { align-items: flex-start; flex-direction: column; }
    .calendar { font-size: .7rem; }
    .calendar .day { min-height: 66px; }
    .toast-stack { left: 14px; right: 14px; max-width: none; }

    .hero { padding: 52px 18px; }
    .hero h1 { font-size: 1.85rem; }
    .site-section { padding: 48px 18px; }
    .site-section-head h2 { font-size: 1.5rem; }
    .steps { grid-template-columns: 1fr; }
    .site-cta h2 { font-size: 1.4rem; }
    .site-footer-inner { flex-direction: column; text-align: center; }
    .auth-switch, .auth-hint { padding-left: 20px; padding-right: 20px; }

    /* Formulario de busca (.filters) empilha no celular - lado a lado fica
       apertado demais com o campo de texto encolhido. */
    .filters { flex-direction: column; align-items: stretch; }
    .filters .field { min-width: 100%; }
    .filters button { width: 100%; justify-content: center; }

    /* iOS Safari da zoom automatico ao focar um campo com font-size < 16px.
       16px e o minimo pra evitar isso em qualquer input/select/textarea. */
    input[type=text], input[type=email], input[type=password], input[type=number],
    input[type=date], input[type=time], input[type=tel], input[type=search],
    input[type=color], select, textarea {
        font-size: 16px;
    }
}

.backdrop-mobile { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 999; display: none; }
.backdrop-mobile.open { display: block; }

@media (min-width: 769px) { .backdrop-mobile { display: none !important; } }

@media print {
    @page {
        size: A4;
        margin: 10mm 12mm;
    }

    /* O tema e escuro (--branco, --texto-suave etc. sao claros, pensados pra
       fundo preto). Sem redefinir essas variaveis aqui, titulos, valores dos
       stats e textos em negrito ficam brancos sobre o papel branco - some
       o conteudo mais importante do relatorio. Redefinindo na body, toda a
       cascata (cards, tabelas, stats, badges) herda as cores escuras. */
    body {
        background: #fff;
        color: #1a1a1a;
        font-size: 12px;
        line-height: 1.4;
        --preto: #ffffff;
        --preto-2: #f2f2f2;
        --cinza-escuro: #ffffff;
        --cinza: #f5f5f5;
        --cinza-claro: #e3e3e3;
        --borda: #d0d0d0;
        --branco: #141414;
        --texto: #1a1a1a;
        --texto-suave: #4d4d4d;
        --texto-fraco: #767676;
        --sombra: none;
    }

    html { font-size: 68%; }

    /* Por padrao o Chrome imprime sem "imagens/cores de fundo" a nao ser
       que o usuario marque essa opcao no dialogo de impressao. Como as
       barras do grafico, o trilho da barra e os icones usam cor via
       background (sem texto/borda por baixo), eles somem completamente -
       so sobra o numero flutuando. Isso forca o navegador a sempre
       imprimir essas cores, independente da opcao marcada. */
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; color-adjust: exact !important; }

    .sidebar, .topbar, .no-print, .toast-stack, .floap-stack { display: none !important; }
    .main { margin-left: 0; }
    .content { padding: 0; }

    .page-head { margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid #1a1a1a; }
    .page-head h1 { font-size: 1.3rem; }
    .page-head .subtitle { font-size: .85rem; }

    .card { border: 1px solid #ccc; box-shadow: none; border-radius: 4px; break-inside: avoid; }

    /* "Clientes por regiao" limita altura e rola na tela; impresso nao tem
       scroll, entao o card precisa mostrar a lista inteira sem cortar. */
    .card-body { max-height: none !important; overflow: visible !important; }

    /* Relatorios: sem isso os grids de stat (topo da pagina) herdam a regra
       de tela estreita e empilham em 1 coluna, deixando os cards enormes e
       o relatorio com paginas demais. Forca as colunas originais (3 e 4) so
       nesses cards de resumo. */
    .grid { gap: 9px; }
    .grid-3 { grid-template-columns: repeat(3, 1fr) !important; }
    .grid-4 { grid-template-columns: repeat(4, 1fr) !important; }
    .mb-lg { margin-bottom: 9px; }

    /* Os grids de conteudo (graficos/tabelas em .grid-2 e o .grid-cards do
       rodape) tem cards de altura bem diferente lado a lado (ex.: "Ordens
       de compra" curto ao lado de "Faturamento por categoria" alto). Em
       CSS Grid, quando um card de uma linha nao cabe no resto da pagina e
       break-inside:avoid impede ele de cortar, a linha inteira pula pra
       proxima pagina - sobra um vazio enorme na pagina atual embaixo do
       card curto. Empilhando em 1 coluna no impresso, cada card flui e
       quebra de pagina individualmente, sem acoplar com o vizinho. */
    .grid-2, .grid-cards { grid-template-columns: 1fr !important; }

    .stat { padding: 8px 10px; gap: 7px; border: 1px solid #ddd; }
    .stat::after { display: none; }
    .stat-icon { width: 26px; height: 26px; font-size: .78rem; background: #f0f0f0 !important; color: #1a1a1a !important; }
    .stat-value { font-size: 1.05rem; }
    .stat-label { font-size: .62rem; }

    .card-head { padding: 7px 10px; }
    .card-head h3 { font-size: .85rem; }
    .card-head h3 i { color: #1a1a1a; }
    .card-body { padding: 8px 10px; }

    .chart-columns { height: 90px; }
    .chart-col .col-bar { background: #666 !important; }
    .bar-track { background: #e6e6e6; }
    .bar-fill, .bar-fill.verde, .bar-fill.azul, .bar-fill.amarelo { background: #666 !important; }

    table { font-size: .82rem; }
    thead th { padding: 5px 8px; }
    tbody td { padding: 5px 8px; }
    tr { break-inside: avoid; }
    thead { display: table-header-group; }

    /* .table-leads-origem usa table-layout:fixed com padding:24px fixo nas
       colunas numericas, pensado pra tela com o card largo. Mesmo com o
       card em largura total no impresso (.grid-cards acima), mante layout
       auto e padding/branco reduzidos pra nao depender de largura de card
       nenhuma - "GANHOS"/"TAXA"/"100%" sempre tem espaco pra caber. */
    .table-leads-origem { table-layout: auto; }
    .table-leads-origem th.num, .table-leads-origem td.num,
    .table-leads-origem th:first-child, .table-leads-origem td:first-child { width: auto; padding: 5px 8px; white-space: normal; }

    /* Badges usam cores claras pensadas pra contraste em fundo escuro; no
       papel ficam desbotados ou ilegiveis. Troca por versoes com texto
       escuro e fundo bem claro, mantendo a cor de cada status reconhecivel. */
    .badge { border: 1px solid currentColor; }
    .badge-success   { background: #eaf7ef !important; color: #1a7a43 !important; }
    .badge-danger    { background: #fcebe9 !important; color: #a3291d !important; }
    .badge-warning   { background: #fdf6dc !important; color: #8a6d00 !important; }
    .badge-info      { background: #e8f3fa !important; color: #1f5f8b !important; }
    .badge-primary   { background: #f2e9f6 !important; color: #6c3f82 !important; }
    .badge-orange    { background: #fdf0e3 !important; color: #b35900 !important; }
    .badge-secondary { background: #f0f0f0 !important; color: #555555 !important; }
    .badge-dark      { background: #e8e8e8 !important; color: #222222 !important; }

    .empty { padding: 14px; }
    .empty i { display: none; }
}
