/* ============================================================
   Laser Build — Orçamentos
   Sistema visual estilo Apple (muito branco, sombras suaves,
   amarelo de marca #FECE00 com parcimónia, mono nos números).
   Adaptado do design Laser Build (Claude Design).
   Sem framework. Variáveis CSS para afinação fácil.
   ============================================================ */

:root {
    /* ---- Marca / tinta ---- */
    --brand: #FECE00;
    --brand-deep: #E7B900;
    --brand-soft: #FFF6D6;
    --ink: #1A1A17;
    --ink-soft: #6C6C64;
    --ink-faint: #A0A096;
    --bg: #F3F3F0;
    --surface: #FFFFFF;
    --surface-2: #FAFAF8;
    --line: #E9E9E3;
    --line-soft: #F1F1EC;

    /* ---- Tons (estados / badges) ---- */
    --tone-neutro-bg: #EFEFEA;   --tone-neutro-fg: #74746B;
    --tone-azul-bg: #E9F0F6;     --tone-azul-fg: #3672A0;
    --tone-amarelo-bg: #FBF0D2;  --tone-amarelo-fg: #997400;
    --tone-verde-bg: #E6F1E9;    --tone-verde-fg: #2E7D52;
    --tone-vermelho-bg: #F8E9E7; --tone-vermelho-fg: #BF453C;

    /* ---- Sombras / raios / tipografia ---- */
    --sh-card: 0 1px 2px rgba(26,26,23,.04), 0 5px 18px rgba(26,26,23,.045);
    --sh-hover: 0 2px 6px rgba(26,26,23,.06), 0 16px 38px rgba(26,26,23,.09);
    --sh-pop: 0 8px 30px rgba(26,26,23,.12);
    --r-lg: 20px; --r-md: 14px; --r-sm: 10px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Monaco, "Cascadia Code", monospace;
    --side-w: 248px;

    /* ---- Aliases de compatibilidade (nomes antigos) ---- */
    --cor-primaria: var(--brand-deep);
    --cor-primaria-escura: #C9A300;
    --cor-texto: var(--ink);
    --cor-suave: var(--ink-soft);
    --cor-borda: var(--line);
    --cor-fundo: var(--bg);
    --cor-branco: var(--surface);
    --cor-ok: var(--tone-verde-fg);
    --cor-ok-fundo: var(--tone-verde-bg);
    --cor-erro: var(--tone-vermelho-fg);
    --cor-erro-fundo: var(--tone-vermelho-bg);
    --cor-aviso: var(--tone-amarelo-fg);
    --cor-aviso-fundo: var(--tone-amarelo-bg);
    --raio: var(--r-sm);
    --sidebar-largura: var(--side-w);
    --sombra: var(--sh-card);
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[x-cloak] { display: none !important; }
svg { display: block; }
::selection { background: var(--brand); color: var(--ink); }

body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input { font: inherit; color: inherit; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: 0.88em; font-family: var(--mono); }
h1, h2, h3 { letter-spacing: -0.02em; }

.mono { font-family: var(--mono); font-feature-settings: "tnum" 1; letter-spacing: -0.02em; }
.dim, .texto-suave { color: var(--ink-soft); }
.r { text-align: right; }

/* ============ ESTRUTURA GERAL ============ */
.app { display: flex; min-height: 100vh; }

/* ---- Barra lateral (clara, estilo Apple) ---- */
.sidebar {
    width: var(--side-w); flex-shrink: 0;
    background: var(--surface); color: var(--ink-soft);
    border-right: 1px solid var(--line);
    display: flex; flex-direction: column;
    padding: 22px 16px 18px;
}
.sidebar__marca { display: flex; align-items: center; padding: 4px 10px 22px; overflow: hidden; }
.sidebar__marca a { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-weight: 800; font-size: 18px; letter-spacing: -0.04em; max-width: 100%; }
.sidebar__logo { height: 30px; max-height: 30px; width: auto; max-width: 100%; object-fit: contain; display: block; }
.sidebar__sub { display: none; }

.principal { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---- Topo ---- */
.topo {
    height: 64px; flex-shrink: 0;
    display: flex; align-items: center; gap: 14px;
    padding: 0 26px;
    background: rgba(255,255,255,.72);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    position: sticky; top: 0; z-index: 30;
}
.topo__menu {
    display: none; width: 38px; height: 38px; border-radius: var(--r-sm);
    place-items: center; color: var(--ink); font-size: 20px;
}
.topo__menu:hover { background: var(--surface-2); }
.topo__pesquisa {
    flex: 1; max-width: 440px; display: flex; align-items: center; gap: 9px;
    padding: 9px 13px; background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 11px; color: var(--ink-faint); transition: border-color .15s;
}
.topo__pesquisa:focus-within { border-color: var(--ink-faint); }
.topo__pesquisa input { flex: 1; font-size: 13.5px; color: var(--ink); border: 0; outline: none; background: none; }
.topo__pesquisa input::placeholder { color: var(--ink-faint); }
.topo__pesquisa svg { color: var(--ink-faint); flex-shrink: 0; }
.topo__direita { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Chip de utilizador no topo */
.topo__user {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 5px 12px 5px 6px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--surface);
    font-weight: 600; font-size: 13.5px; color: var(--ink);
}
.topo__user:hover { background: var(--surface-2); }
.topo__user-av {
    width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--brand);
    display: grid; place-items: center; font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.topo__sair, .topo__cal {
    width: 38px; height: 38px; border-radius: var(--r-sm); display: grid; place-items: center;
    color: var(--ink-soft);
}
.topo__sair:hover, .topo__cal:hover { background: var(--surface-2); color: var(--ink); }

.conteudo { flex: 1; padding: 34px 40px 80px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ============ MENU (navegação lateral) ============ */
.menu ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.menu__li { position: relative; }
.menu__item {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--r-sm); color: var(--ink-soft);
    font-size: 14.5px; font-weight: 500; letter-spacing: -0.01em; transition: all .16s ease;
}
.menu__item:hover { background: var(--surface-2); color: var(--ink); }
.menu__item--ativo { background: var(--ink); color: #fff; }
.menu__item--ativo:hover { background: var(--ink); color: #fff; }
/* Ícone sempre em amarelo (marca). Sobre fundo claro usa-se o tom mais
   carregado (legível); sobre a barra preta do item ativo, o amarelo vivo. */
.menu__icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 20px; height: 20px; color: var(--brand-deep); }
.menu__item--ativo .menu__icon { color: var(--brand); }
.menu__label { white-space: nowrap; }
.menu__badge {
    flex-shrink: 0; margin-left: auto;
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
    background: var(--tone-vermelho-bg, #F6D9D6); color: var(--tone-vermelho-fg, #BF453C);
    font-size: 11px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.menu__item--ativo .menu__badge { background: #fff; color: var(--ink); }
/* Badge clicável (link próprio) sobreposto ao item — ex.: Obras Em Análise. */
a.menu__badge {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    margin: 0; text-decoration: none; cursor: pointer; transition: filter .16s ease;
}
a.menu__badge:hover { filter: brightness(.95); }
.menu__badge--analise { background: #99740022; color: #997400; }
/* Quando o item Obras está ativo (barra preta), o badge passa a branco para
   se ler bem por cima do fundo escuro. */
.menu__li:has(.menu__item--ativo) a.menu__badge--analise { background: #fff; color: var(--ink); }
.acoes-validar { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.contador-fila {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 28px; height: 28px; padding: 0 9px; border-radius: 999px;
    background: var(--tone-vermelho-bg, #F6D9D6); color: var(--tone-vermelho-fg, #BF453C);
    font-size: 15px; font-weight: 700; vertical-align: middle; margin-left: 8px;
}
.menu__vazio { padding: 12px; color: var(--ink-faint); font-size: 13px; }

/* ============ SINO (notificações) ============ */
.sino { position: relative; }
.sino__btn {
    height: 38px; padding: 0 10px; border-radius: var(--r-sm);
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--ink-soft); transition: all .15s;
}
.sino__btn:hover { background: var(--surface-2); color: var(--ink); }
.sino__contador {
    min-width: 18px; height: 18px;
    background: var(--brand); color: var(--ink);
    font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 0 5px;
    display: inline-grid; place-items: center;
}
.sino__lista {
    position: absolute; right: 0; top: 120%;
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--r-md); box-shadow: var(--sh-pop);
    width: 300px; padding: 12px; z-index: 40;
}
.sino__vazio { color: var(--ink-soft); margin: 0; font-size: 14px; }

/* ============ CABEÇALHO DE PÁGINA ============ */
.cabecalho-pagina { margin-bottom: 26px; }
.cabecalho-pagina h1 { font-size: 30px; font-weight: 700; line-height: 1.05; margin: 0 0 9px; }
.cabecalho-pagina .texto-suave { font-size: 14.5px; color: var(--ink-soft); margin: 0; max-width: 70ch; line-height: 1.45; }
.cabecalho-pagina--acoes {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 24px; flex-wrap: wrap;
}

/* ============ CARTÕES ============ */
.cartao {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 22px 24px; margin-bottom: 20px;
    box-shadow: var(--sh-card);
}
.cartao h2 { font-size: 16px; font-weight: 650; margin: 0 0 16px; }
.cartao--info { background: var(--brand-soft); border-color: #F4E2A4; }

/* ============ TABELAS ============ */
.tabela { width: 100%; border-collapse: collapse; margin-top: 12px; }
.tabela th, .tabela td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line-soft); }
.tabela th {
    font-size: 11.5px; text-transform: uppercase; color: var(--ink-faint);
    letter-spacing: 0.04em; font-weight: 600; border-bottom-color: var(--line);
}
.tabela tbody tr { transition: background .14s; }
.tabela tbody tr:hover { background: var(--surface-2); }
.tabela .num, th.num { text-align: right; font-family: var(--mono); font-feature-settings: "tnum" 1; }

/* ============ BOTÕES ============ */
.btn {
    display: inline-flex; align-items: center; gap: 7px; justify-content: center;
    background: var(--brand); color: var(--ink);
    padding: 9px 16px; border: 0; border-radius: var(--r-sm);
    cursor: pointer; font-size: 13.5px; font-weight: 650; letter-spacing: -0.01em;
    box-shadow: 0 1px 2px rgba(231,185,0,.4); transition: all .15s ease; white-space: nowrap;
}
.btn:hover { background: var(--brand-deep); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(231,185,0,.4); text-decoration: none; }
.btn svg { flex-shrink: 0; }
.btn--bloco { width: 100%; }
.btn--secundario {
    background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: none; font-weight: 550;
}
.btn--secundario:hover { background: var(--surface-2); border-color: var(--ink-faint); transform: none; box-shadow: none; }
.btn--pequeno { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; box-shadow: none; }

/* ============ MENSAGENS FLASH ============ */
.flashes { padding: 16px 40px 0; max-width: 1180px; width: 100%; margin: 0 auto; }
.flash {
    display: flex; justify-content: space-between; align-items: center;
    padding: 11px 16px; border-radius: var(--r-md); margin-bottom: 8px;
    border: 1px solid transparent; font-weight: 500; font-size: 14px;
}
.flash button { background: none; border: 0; font-size: 18px; cursor: pointer; line-height: 1; color: inherit; }
.flash--ok    { background: var(--tone-verde-bg);    color: var(--tone-verde-fg);    border-color: #C6E2CF; }
.flash--erro  { background: var(--tone-vermelho-bg); color: var(--tone-vermelho-fg); border-color: #ECCFCB; }
.flash--aviso { background: var(--tone-amarelo-bg);  color: var(--tone-amarelo-fg);  border-color: #EFDFB0; }

/* ============ PÁGINAS DE ERRO ============ */
.erro-pagina { text-align: center; padding: 80px 20px; }
.erro-pagina h1 { font-size: 72px; margin: 0; color: var(--brand-deep); font-family: var(--mono); }

/* ============ FORMULÁRIOS ============ */
.form { margin: 0; }
.form--estreito { max-width: 440px; }
.campo { margin-bottom: 16px; }
.campo label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13.5px; }
.campo input[type="text"],
.campo input[type="email"],
.campo input[type="password"],
.campo input[type="number"],
.campo input[type="date"],
.campo input[type="search"],
.campo select,
.campo textarea {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--line); border-radius: var(--r-sm);
    font-size: 14.5px; font-family: inherit; background: #fff; color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
.campo input:focus, .campo select:focus, .campo textarea:focus {
    outline: none; border-color: var(--brand-deep);
    box-shadow: 0 0 0 3px rgba(254,206,0,.25);
}
.campo--check label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.campo--check input { width: auto; }
.ajuda { color: var(--ink-soft); font-weight: 400; }
small.ajuda { display: inline-block; margin-top: 4px; font-size: 12.5px; }
.form__botoes { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.form__linha { display: flex; gap: 12px; flex-wrap: wrap; }
.form__linha .campo { flex: 1; min-width: 120px; }

/* ============ LOGIN ============ */
.auth-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: var(--ink); padding: 20px;
    background-image: radial-gradient(circle at 50% 0%, rgba(254,206,0,.10), transparent 60%);
}
.auth-cartao {
    background: #fff; border-radius: var(--r-lg); padding: 34px;
    width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.auth-marca { text-align: center; margin-bottom: 24px; }
.auth-marca__logo { height: 52px; max-height: 52px; width: auto; max-width: 80%; object-fit: contain; }
.auth-marca__nome { display: block; font-size: 22px; font-weight: 800; color: var(--ink); letter-spacing: -0.04em; }
.auth-marca__sub { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.auth-titulo { font-size: 18px; margin: 0 0 20px; font-weight: 650; }
.auth-body .flashes { padding: 0; margin: 0 0 16px; max-width: none; }

/* ============ TABELAS: AÇÕES / ESTADOS / LINKS ============ */
.tabela__acoes { white-space: nowrap; }
.tabela__acoes a { margin-right: 12px; }
.inline { display: inline; }
.link {
    background: none; border: 0; color: var(--brand-deep); cursor: pointer; padding: 0;
    font-size: inherit; font-weight: 600; text-decoration: none;
}
.link:hover { text-decoration: underline; }
.link-perigo { background: none; border: 0; color: var(--tone-vermelho-fg); cursor: pointer; font-size: inherit; padding: 0; font-weight: 600; }
.link-perigo:hover { text-decoration: underline; }

.estado { font-size: 13px; font-weight: 600; }
.estado--ok { color: var(--tone-verde-fg); }
.estado--off { color: var(--ink-faint); }

/* ============ ETIQUETAS / BADGES ============ */
.etiqueta {
    display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; text-transform: capitalize; letter-spacing: -0.005em;
}
.etiqueta--admin     { background: var(--tone-vermelho-bg); color: var(--tone-vermelho-fg); }
.etiqueta--gestor    { background: var(--tone-amarelo-bg);  color: var(--tone-amarelo-fg); }
.etiqueta--comercial { background: var(--tone-azul-bg);     color: var(--tone-azul-fg); }
.etiqueta--contabilista { background: var(--tone-verde-bg, #E3F0E4); color: var(--tone-verde-fg, #2E7D32); }
.etiqueta--convidado    { background: #ECECE8; color: #6B6B63; }

/* Badges de estado de orçamento */
.estado-badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
    border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: -0.005em;
}
.estado-badge--pendente     { background: var(--tone-azul-bg);     color: var(--tone-azul-fg); }
.estado-badge--em_progresso { background: var(--tone-amarelo-bg);  color: var(--tone-amarelo-fg); }
.estado-badge--ganho        { background: var(--tone-verde-bg);    color: var(--tone-verde-fg); }
.estado-badge--perdido      { background: var(--tone-vermelho-bg); color: var(--tone-vermelho-fg); }
.estado-badge--anulado      { background: var(--tone-neutro-bg);   color: var(--tone-neutro-fg); }

/* ============ LISTA DE DADOS (dl) ============ */
.dados { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; margin: 0; }
.dados dt { font-weight: 600; color: var(--ink-soft); }
.dados dd { margin: 0; }

/* ============ BARRA DE PESQUISA ============ */
.barra-pesquisa { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.barra-pesquisa input[type="search"] {
    flex: 1; max-width: 360px; padding: 9px 13px;
    border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 14.5px; background: #fff;
}
.barra-pesquisa input[type="search"]:focus { outline: none; border-color: var(--brand-deep); box-shadow: 0 0 0 3px rgba(254,206,0,.25); }

/* ============ AUTOCOMPLETE ============ */
.auto-resultados {
    position: relative; border: 1px solid var(--line); border-radius: var(--r-sm);
    margin-top: 4px; background: #fff; max-height: 240px; overflow-y: auto; box-shadow: var(--sh-card);
}
.auto-item { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; cursor: pointer; font-size: 14px; }
.auto-item:hover { background: var(--surface-2); }
.auto-vazio { padding: 10px 12px; color: var(--ink-soft); font-size: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }

/* ============ CHIPS ============ */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--tone-azul-bg); color: var(--tone-azul-fg);
    padding: 4px 8px 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
.chip button { background: none; border: 0; cursor: pointer; font-size: 15px; line-height: 1; color: inherit; }

/* Caixa inline */
.caixa-inline { border: 1px dashed var(--line); border-radius: var(--r-sm); padding: 12px; margin-top: 8px; background: var(--surface-2); }
.caixa-inline input { width: 100%; margin-bottom: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.erro-inline { color: var(--tone-vermelho-fg); font-size: 13px; margin: 6px 0 0; }
.select-curto { padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }

/* ============ ATALHOS (início) ============ */
.atalhos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.atalho {
    display: flex; flex-direction: column; gap: 12px; align-items: flex-start;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 22px; box-shadow: var(--sh-card);
    color: var(--ink); font-weight: 600;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.atalho:hover { transform: translateY(-2px); box-shadow: var(--sh-hover); border-color: #E0E0D8; text-decoration: none; }
.atalho__icon { width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink); }

/* ============ ORÇAMENTOS ============ */
.barra-estados { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn--estado-em_progresso { background: var(--tone-azul-fg); color: #fff; box-shadow: none; }
.btn--estado-ganho        { background: var(--tone-verde-fg); color: #fff; box-shadow: none; }
.btn--estado-perdido      { background: var(--tone-vermelho-fg); color: #fff; box-shadow: none; }
.btn--estado-anulado      { background: var(--tone-neutro-fg); color: #fff; box-shadow: none; }
.btn--estado-em_progresso:hover,
.btn--estado-ganho:hover,
.btn--estado-perdido:hover,
.btn--estado-anulado:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: none; }

.grelha-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Histórico de revisões */
.lista-revisoes { list-style: none; margin: 0; padding: 0; }
.lista-revisoes li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.lista-revisoes li:last-child { border-bottom: 0; }
.lista-revisoes .num { margin-left: auto; font-family: var(--mono); }
.lista-revisoes a { display: inline-flex; align-items: center; gap: 6px; }
.lista-revisoes a.atual { font-weight: 700; }
.rev-val { display: inline-flex; flex-shrink: 0; }
.rev-val--ok { color: #2E7D52; }   /* validado */
.rev-val--pend { color: #997400; } /* por validar */

/* Totais nas tabelas de linhas */
.tabela--linhas tfoot td, .tabela--editor tfoot td { border-bottom: 0; padding-top: 5px; padding-bottom: 5px; }
.total-final td { border-top: 2px solid var(--line); font-size: 16px; font-weight: 700; }

/* Editor de linhas */
.tabela-scroll { overflow-x: auto; }
.in-tabela { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.in-tabela:focus { outline: none; border-color: var(--brand-deep); box-shadow: 0 0 0 3px rgba(254,206,0,.2); }
.in-num { text-align: right; font-family: var(--mono); }
.tabela--editor td { padding: 4px 6px; vertical-align: middle; }
.tabela--editor th { padding: 8px 6px; }

/* ============ DEFINIÇÕES: SUB-NAVEGAÇÃO ============ */
.subnav { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.subnav__item { padding: 9px 14px; color: var(--ink-soft); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; font-weight: 500; }
.subnav__item:hover { color: var(--ink); }
.subnav__item--ativo { color: var(--ink); border-bottom-color: var(--brand); font-weight: 650; }

.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.check-inline input { width: auto; }

/* Campo de imagem */
.campo-imagem { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.campo-imagem:last-child { border-bottom: 0; }
.campo-imagem > div { flex: 1; }
.preview-img { max-width: 120px; max-height: 160px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }

/* Condições: lista de escolha */
.lista-condicoes { display: flex; flex-direction: column; gap: 8px; }
.cond-item { display: flex; gap: 11px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; transition: all .14s; }
.cond-item:hover { background: var(--surface-2); border-color: #DEDED6; }
.cond-item input { width: auto; margin-top: 3px; }
.cond-item span { display: flex; flex-direction: column; gap: 2px; }

/* ============ PUBLICIDADES: GRELHA (mosaico) ============ */
.grelha-pub { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.pub-card {
    border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden;
    display: flex; flex-direction: column; background: var(--surface); box-shadow: var(--sh-card);
    transition: transform .18s ease, box-shadow .18s ease;
}
.pub-card:hover { transform: translateY(-2px); box-shadow: var(--sh-hover); }
.pub-thumb { width: 100%; height: 160px; object-fit: contain; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.pub-info { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.pub-acoes { display: flex; gap: 12px; align-items: center; margin-top: 8px; }

/* ============ RESPONSIVO ============ */
@media (max-width: 900px) {
    .grelha-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
        transform: translateX(-100%); transition: transform .26s cubic-bezier(.3,.8,.3,1);
        box-shadow: var(--sh-pop);
    }
    .sidebar.aberto { transform: translateX(0); }
    .sidebar::after {
        content: ''; position: fixed; inset: 0; left: var(--side-w);
        background: rgba(20,20,18,.32); opacity: 0; pointer-events: none; transition: opacity .2s;
    }
    .sidebar.aberto::after { opacity: 1; }
    .topo__menu { display: grid; }
    .topo__pesquisa { display: none; }
    .conteudo { padding: 24px 18px 70px; }
    .cabecalho-pagina h1 { font-size: 25px; }
    .cabecalho-pagina--acoes { flex-direction: column; align-items: stretch; }
    .flashes { padding: 16px 18px 0; }
    .dados { grid-template-columns: 1fr; gap: 4px 0; }
    .dados dt { margin-top: 8px; }
}

/* ============================================================
   OBRAS — resumo operacional, estados e interações
   ============================================================ */

/* Letra de estado (círculo colorido) */
.estado-letra {
    display: inline-grid; place-items: center; width: 24px; height: 24px;
    border-radius: 50%; border: 1px solid var(--line); font-weight: 700;
    font-size: 12px; line-height: 1; flex-shrink: 0; vertical-align: middle;
}

/* Sigla do comercial (iniciais) */
.sigla {
    display: inline-grid; place-items: center; min-width: 28px; height: 28px;
    padding: 0 6px; border-radius: 8px; background: var(--surface-2);
    border: 1px solid var(--line); color: var(--ink); font-weight: 700;
    font-size: 11.5px; letter-spacing: 0.02em; vertical-align: middle;
}
.sigla--sm { min-width: 22px; height: 22px; font-size: 10.5px; border-radius: 6px; }

/* Urgência do próximo contacto */
.urg-atraso { color: var(--tone-vermelho-fg); font-weight: 700; }
.urg-hoje   { color: var(--brand-deep); font-weight: 700; }
.urg-breve  { color: var(--tone-amarelo-fg); font-weight: 600; }
.urg-tag {
    display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
    font-family: var(--font); vertical-align: middle;
}
.urg-tag--atraso { background: var(--tone-vermelho-bg); color: var(--tone-vermelho-fg); }
.urg-tag--hoje   { background: var(--brand-soft); color: var(--brand-deep); }

/* Resumo de obras: colunas */
.tabela--obras .col-data { white-space: nowrap; }
.tabela--obras .col-estado { text-align: center; width: 1%; }
.form-estado { display: inline-flex; margin: 0; }

/* Barra de datas (detalhe da obra) */
.datebar { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.datebar-item {
    display: flex; align-items: center; gap: 14px; padding: 15px 18px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
    box-shadow: var(--sh-card);
}
.datebar-item--next { background: var(--brand-soft); border-color: #F4E2A4; box-shadow: none; }
.datebar-item--next.is-atraso { background: var(--tone-vermelho-bg); border-color: #ECCFCB; }
.datebar-item--next.is-hoje { background: var(--brand-soft); border-color: #F4E2A4; }
.datebar-ico {
    width: 42px; height: 42px; border-radius: 11px; background: var(--surface-2);
    border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink); flex-shrink: 0;
}
.datebar-item--next .datebar-ico { background: #fff; border-color: #F4E2A4; color: var(--brand-deep); }
.datebar-item--next.is-atraso .datebar-ico { border-color: #ECCFCB; color: var(--tone-vermelho-fg); }
.datebar-lbl { font-size: 12.5px; color: var(--ink-soft); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.datebar-val { font-size: 20px; font-weight: 700; margin-top: 3px; letter-spacing: -0.02em; }

/* Timeline de interações */
.timeline { display: flex; flex-direction: column; margin-top: 18px; }
.tl-item { display: flex; gap: 13px; padding-bottom: 16px; position: relative; }
.tl-item:not(:last-child)::before {
    content: ''; position: absolute; left: 4.5px; top: 16px; bottom: 0; width: 1.5px; background: var(--line);
}
.tl-dot {
    width: 11px; height: 11px; border-radius: 50%; background: var(--brand);
    border: 2px solid #fff; box-shadow: 0 0 0 1px var(--brand); flex-shrink: 0; margin-top: 3px; z-index: 1;
}
.tl-corpo { flex: 1; min-width: 0; }
.tl-topo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tl-quando { font-size: 13px; font-weight: 650; }
.tl-prox { font-size: 12px; color: var(--ink-soft); }
.tl-texto { font-size: 13.5px; margin-top: 4px; color: var(--ink); }

@media (max-width: 768px) {
    .datebar { grid-template-columns: 1fr; }
}

/* ============================================================
   DASHBOARDS por perfil (KPIs, barras, gráfico, finanças)
   ============================================================ */

.kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px; margin-bottom: 20px;
}
.kpi-grid--3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kpi {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
    padding: 16px 18px; box-shadow: var(--sh-card);
}
.kpi--destaque { background: var(--brand-soft); border-color: #F4E2A4; box-shadow: none; }
.kpi--alerta { background: var(--tone-vermelho-bg); border-color: #ECCFCB; box-shadow: none; }
.kpi__lbl { font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }
.kpi__val { font-size: 27px; font-weight: 750; letter-spacing: -0.02em; margin: 4px 0 2px; line-height: 1.1; }
.kpi__sub { font-size: 12px; color: var(--ink-soft); }

/* Variação percentual (delta) */
.delta { font-weight: 700; }
.delta--sobe { color: var(--tone-verde-fg); }
.delta--desce { color: var(--tone-vermelho-fg); }
.delta--neutro { color: var(--ink-soft); }

/* Barras horizontais (obras por estado) */
.barras { display: flex; flex-direction: column; gap: 11px; margin-top: 14px; }
.barra-linha { display: flex; align-items: center; gap: 10px; }
.barra-nome { font-size: 13px; min-width: 92px; flex-shrink: 0; }
.barra-trilho { flex: 1; height: 9px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.barra-fill { display: block; height: 100%; border-radius: 999px; min-width: 2px; }
.barra-num { font-size: 13px; font-weight: 700; min-width: 24px; text-align: right; }

/* Gráfico de barras (valor ganho por mês: ano atual vs anterior) */
.barchart {
    display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px;
    align-items: end; height: 180px; margin-top: 18px;
}
.bc-col { display: flex; flex-direction: column; align-items: center; height: 100%; }
.bc-bars { display: flex; align-items: flex-end; justify-content: center; gap: 3px; flex: 1; width: 100%; }
.bc-bar { width: 42%; max-width: 16px; border-radius: 4px 4px 0 0; min-height: 2px; transition: opacity .15s; }
.bc-bar--atual { background: var(--brand); }
.bc-bar--ant { background: #D8D6CC; }
.bc-bar:hover { opacity: 0.75; }
.bc-lbl { font-size: 11px; color: var(--ink-soft); margin-top: 6px; }
.bc-lbl--atual { color: var(--brand-deep); font-weight: 700; }

/* Legenda */
.legenda { display: flex; gap: 16px; flex-wrap: wrap; }
.legenda__item { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.legenda__cor { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* Cartões-atalho de administração */
.cartao--link { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.cartao--link:hover { border-color: var(--brand-deep); box-shadow: var(--sh-card); }
.cartao--desativado { opacity: 0.6; }
.ferr-ico { width: 46px; height: 46px; border-radius: 12px; background: var(--brand-soft); display: grid; place-items: center; color: var(--brand-deep); flex-shrink: 0; }
.badge-soft { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); padding: 1px 7px; border-radius: 999px; }
.sep-titulo { margin: 26px 0 14px; font-size: 16px; }

/* ============================================================
   Estados/permissões: banners, pills, botão de perigo, matriz
   ============================================================ */

.banner-ok, .banner-aviso {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; flex-wrap: wrap;
}
.banner-ok    { background: var(--tone-verde-bg);    border-color: #BfE0CC; }
.banner-aviso { background: var(--tone-vermelho-bg); border-color: #ECCFCB; }

.pill-ganho {
    display: inline-block; font-size: 10.5px; font-weight: 700; vertical-align: middle;
    background: var(--tone-verde-bg); color: var(--tone-verde-fg);
    border: 1px solid #BfE0CC; padding: 1px 7px; border-radius: 999px; margin-left: 6px;
}

.btn--perigo { background: var(--tone-vermelho-fg); border-color: var(--tone-vermelho-fg); color: #fff; }
.btn--perigo:hover { filter: brightness(0.94); }

/* Agrupador de campos (ex.: faturação no formulário da obra) */
.campo-grupo { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 16px 4px; margin-bottom: 16px; }
.campo-grupo > legend { font-weight: 650; font-size: 13.5px; padding: 0 6px; }

/* Matriz de permissões (perfil × estado) */
.tabela--matriz td.num, .tabela--matriz th.num { text-align: center; }
.tabela--matriz input[type="checkbox"] { width: 18px; height: 18px; }

/* ============================================================
   DASHBOARDS (Comercial · Gestão: Visão Geral / Performance)
   ============================================================ */

/* -- Cabeçalho + toggles -------------------------------------- */
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.dash-eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--brand-deep); }
.dash-titulo { font-size: 30px; line-height: 1.1; margin: 2px 0 4px; letter-spacing: -.02em; }
.dash-sub { margin: 0; font-size: 14px; }
.dash-toggles { display: flex; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; box-shadow: var(--sh-card); }
.seg__item { display: inline-flex; align-items: center; gap: 6px; padding: 7px 15px; border-radius: 999px; font-size: 13.5px; font-weight: 650; color: var(--ink-soft); white-space: nowrap; }
.seg__item.is-ativo { background: var(--ink); color: #fff; }
.seg__item:not(.is-ativo):hover { color: var(--ink); }

/* -- KPI cards ------------------------------------------------- */
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 18px; }
.dash-kpi { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; box-shadow: var(--sh-card); }
.dash-kpi__ico { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); margin-bottom: 12px; }
.dash-kpi__topo { position: absolute; top: 18px; right: 18px; }
.dash-kpi__val { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.dash-kpi__lbl { margin-top: 4px; font-size: 14px; font-weight: 600; }
.dash-kpi__foot { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--ink-faint); }
.dash-kpi--amarelo { background: var(--brand); border-color: var(--brand); }
.dash-kpi--amarelo .dash-kpi__ico { background: rgba(0,0,0,.08); border-color: transparent; color: var(--ink); }
.dash-kpi--amarelo .dash-kpi__foot { border-top-color: rgba(0,0,0,.12); color: rgba(26,26,23,.6); }
.dash-kpi--solo { margin: 0; }
.delta { font-size: 12.5px; font-weight: 800; }
.delta.is-pos { color: var(--tone-verde-fg); }
.delta.is-neg { color: var(--tone-vermelho-fg); }

/* -- Banner de faturação (em breve) --------------------------- */
.fatura-banner { margin-bottom: 18px; }
.fatura-banner--amarelo { background: var(--brand); border-color: var(--brand); }
.fatura-banner__top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.fatura-banner__titulo { font-size: 17px; margin: 0; }
.fatura-banner__sub { margin: 2px 0 0; font-size: 13px; }
.fatura-banner__ico { color: var(--ink-soft); }
.fatura-banner--amarelo .fatura-banner__ico { color: rgba(26,26,23,.6); }
.fatura-grid { display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: flex-end; }
.fatura-bloco { min-width: 130px; }
.fatura-lbl { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 6px; }
.fatura-banner--amarelo .fatura-lbl { color: rgba(26,26,23,.7); }
.fatura-val { font-size: 22px; font-weight: 800; }
.fatura-nota { margin: 14px 0 0; font-size: 12px; display: flex; align-items: center; gap: 5px; }

/* -- Painel genérico (cartão com topo) ------------------------ */
.painel__topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.painel__titulo { font-size: 16px; margin: 0; }
.painel__sub { margin: 2px 0 0; font-size: 12.5px; }
.contador { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 800; }
.dash-cols { gap: 16px; }

/* -- Avatar --------------------------------------------------- */
.av { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; font-size: 12.5px; font-weight: 800; flex-shrink: 0; }

/* -- Agenda de contactos -------------------------------------- */
.agenda { display: flex; flex-direction: column; }
.agenda-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line-soft); color: inherit; }
.agenda-row:first-child { border-top: 0; }
.agenda-row:hover { background: var(--surface-2); border-radius: 10px; }
.agenda-data { width: 52px; text-align: center; flex-shrink: 0; border-left: 3px solid var(--line); padding-left: 8px; }
.agenda-data.is-atraso { border-left-color: var(--tone-vermelho-fg); }
.agenda-data.is-hoje { border-left-color: var(--brand-deep); }
.agenda-data__lbl { display: block; font-size: 10px; font-weight: 800; letter-spacing: .05em; color: var(--ink-faint); }
.agenda-data.is-atraso .agenda-data__lbl { color: var(--tone-vermelho-fg); }
.agenda-data__dia { display: block; font-size: 14px; font-weight: 700; }
.agenda-corpo { flex: 1; min-width: 0; }
.agenda-nome { font-weight: 650; font-size: 14.5px; }
.agenda-obra { font-size: 13px; }
.agenda-meta { font-size: 11.5px; color: var(--ink-faint); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.agenda-dir { text-align: right; flex-shrink: 0; }
.agenda-valor { font-weight: 800; font-size: 14px; }
.badge-estado { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; color: var(--ink-soft); margin-top: 3px; }
.badge-estado::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--ink-faint)); }
.agenda-call { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand-deep); flex-shrink: 0; }

/* -- Obras recém-abertas -------------------------------------- */
.obra-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line-soft); color: inherit; }
.obra-row:first-child { border-top: 0; }
.obra-row:hover { background: var(--surface-2); border-radius: 10px; }
.obra-ico { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--ink); color: var(--brand); flex-shrink: 0; }
.obra-corpo { flex: 1; min-width: 0; }
.obra-nome { font-weight: 650; font-size: 14.5px; }
.obra-local { font-size: 12px; display: flex; align-items: center; gap: 4px; }
.obra-datas { display: flex; gap: 18px; text-align: right; flex-shrink: 0; }
.obra-datas__lbl { display: block; font-size: 9.5px; font-weight: 800; letter-spacing: .06em; color: var(--ink-faint); }
.obra-prox { color: var(--brand-deep); }

/* -- Aviso de fila (perdidas a rever) ------------------------- */
.aviso-fila { display: flex; align-items: center; gap: 10px; padding: 13px 16px; margin-bottom: 16px; border-radius: var(--r-md); background: var(--tone-vermelho-bg); border: 1px solid #ECCFCB; color: var(--ink); font-size: 13.5px; }
.aviso-fila__pt { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--tone-vermelho-fg); color: #fff; font-weight: 800; font-size: 12.5px; }

/* -- Performance: layout -------------------------------------- */
.perf-grid { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 16px; margin-bottom: 16px; align-items: start; }
.perf-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; align-content: start; }

/* Banner amarelo de volume adjudicado */
.banner-adjud { background: var(--brand); border-color: var(--brand); }
.banner-adjud__lbl { font-size: 11.5px; font-weight: 800; letter-spacing: .1em; color: rgba(26,26,23,.65); }
.banner-adjud__val { font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.banner-adjud__delta { font-size: 13px; margin-top: 4px; }
.qbars { display: flex; gap: 12px; margin-top: 22px; }
.qbar { flex: 1; text-align: center; }
.qbar-trilho { height: 80px; display: flex; align-items: flex-end; justify-content: center; }
.qbar-fill { display: block; width: 60%; min-height: 4px; background: var(--ink); border-radius: 7px 7px 0 0; }
.qbar-lbl { font-size: 11.5px; font-weight: 700; margin-top: 8px; }
.qbar-val { font-size: 11px; color: rgba(26,26,23,.7); }

/* Donut de conversão */
.perf-donut { display: flex; flex-direction: column; align-items: center; }
.donut-wrap { position: relative; width: 156px; height: 156px; margin: 4px 0 12px; }
.donut-centro { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-centro strong { display: block; font-size: 30px; font-weight: 800; }
.donut-centro span { font-size: 12px; color: var(--ink-soft); }
.donut-legenda { display: flex; flex-direction: column; gap: 6px; width: 100%; font-size: 13px; color: var(--ink-soft); }
.donut-legenda .dot, .grafico-legenda .dot, .donut-legenda span > .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* -- Ranking por comercial ------------------------------------ */
.rank { display: flex; flex-direction: column; }
.rank-row { display: flex; align-items: center; gap: 14px; padding: 12px 2px; border-top: 1px solid var(--line-soft); }
.rank-row:first-child { border-top: 0; }
.rank-idx { width: 22px; color: var(--ink-faint); font-size: 13px; }
.rank-nome { width: 150px; font-weight: 650; font-size: 14px; flex-shrink: 0; }
.rank-trilho { flex: 1; height: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.rank-fill { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.rank-val { width: 96px; text-align: right; font-weight: 800; font-size: 14px; }

/* -- Gráfico (legenda + totais) ------------------------------- */
.grafico-legenda { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-soft); }
.grafico-totais { display: flex; gap: 40px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.grafico-totais__v { font-size: 20px; font-weight: 800; }

/* -- Responsivo ----------------------------------------------- */
@media (max-width: 1000px) {
    .perf-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .obra-datas { gap: 12px; }
}

/* -- Correção infinite-grow do Chart.js: contentor de altura fixa -- */
.grafico-box { position: relative; height: 200px; width: 100%; }
.grafico-box > canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.donut-wrap > canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

/* -- Ficha de cliente: filtro + lista de orçamentos -- */
.dados--2col { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; align-items: baseline; }
.dados--2col dt { color: var(--ink-soft); font-size: 13px; }
.ficha-filtro { display: flex; align-items: center; gap: 8px; }
.ficha-filtro select { padding: 7px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 13.5px; }
.ficha-filtro__datas { display: inline-flex; align-items: center; gap: 6px; }
.ficha-filtro__datas input { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.ficha-mais { text-align: center; margin-top: 14px; }

/* -- Ligação de regresso (ex.: orçamento → obra) -- */
.ligacao-voltar { display: inline-block; margin-bottom: 6px; font-size: 13px; color: var(--ink-soft); }
.ligacao-voltar:hover { color: var(--ink); }

/* -- Chips de cliente (escolher outro cliente na revisão) -- */
.chips-cliente { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.chip-cliente { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-size: 12.5px; color: var(--ink); }
.chip-cliente:hover { border-color: var(--ink-faint); background: var(--surface); }

/* -- Modal (confirmação de edição de orçamento) -- */
.modal-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(26,26,23,.45); backdrop-filter: blur(2px); }
.modal { position: relative; width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-pop); padding: 26px 24px 22px; }
.modal h3 { margin: 0 0 8px; }
.modal__botoes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.modal__fechar { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border-radius: 8px; font-size: 22px; line-height: 1; color: var(--ink-soft); }
.modal__fechar:hover { background: var(--surface-2); color: var(--ink); }

/* -- Filtros do localizador de orçamentos -- */
.filtros-orc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.filtros-orc input[type="search"] { flex: 1; min-width: 160px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); font-size: 13.5px; }
.filtros-orc .select-curto { padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); font-size: 13.5px; }
.filtros-orc__data { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-soft); }
.filtros-orc__data input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; }

/* -- Orçamentos da obra: último por cliente, expansível -- */
.tabela--orcamentos-obra tbody { border: 0; }
.col-expandir { width: 36px; text-align: center; padding-left: 6px !important; padding-right: 6px !important; }
.btn-expandir { width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 7px; font-size: 16px; line-height: 1; color: var(--ink-soft); display: inline-grid; place-items: center; }
.btn-expandir:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-faint); }
.linha-anterior > td { background: var(--surface-2); }
.linha-anterior code { opacity: .85; }

/* -- Contador de orçamentos/revisões (só o dígito, pill discreta) -- */
.contador-rev { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); font-size: 11.5px; font-weight: 600; vertical-align: middle; }

/* -- Conversão de desconto a líquido (orçamento) -- */
.liq-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 9px; background: #eef6f0; border: 1px solid #cfe6d8; color: #2e7d52; font-size: 11px; font-weight: 600; white-space: nowrap; }
.acoes-linha { white-space: nowrap; text-align: right; }
.link-acao { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; margin-left: 3px; cursor: pointer; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.link-acao:hover { background: var(--surface-2); color: var(--ink); }
.aplicar-desc__sep { color: var(--line); margin: 0 2px; }

/* -- Observações da obra (caixa recolhida com contador) -- */
.bloco-recolhe { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.bloco-recolhe > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.bloco-recolhe > summary::-webkit-details-marker { display: none; }
.bloco-recolhe > summary::before { content: '▸'; color: var(--ink-soft); font-size: 11px; transition: transform .15s; }
.bloco-recolhe[open] > summary::before { transform: rotate(90deg); }
.ver-mais-int { margin-top: 6px; }
.ver-mais-int > summary { cursor: pointer; color: var(--ink-soft); font-size: 13px; list-style: none; }
.ver-mais-int > summary::-webkit-details-marker { display: none; }

/* -- Sino: dropdown de próximos contactos -- */
.sino__cab { padding: 10px 12px 6px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line); }
.sino__item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
a.sino__item:hover { background: var(--surface-2); }
.sino__item--info { color: var(--ink-soft); }
.sino__num { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 6px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.sino__item.is-atraso .sino__num { background: #fdecec; border-color: #f3c7c4; color: #bf453c; }
.sino__item.is-hoje .sino__num { background: #fff5e0; border-color: #f0dca8; color: #997400; }
.sino__rodape { display: block; padding: 9px 12px; font-size: 13px; font-weight: 600; color: var(--acento, #997400); text-decoration: none; }
.sino__rodape:hover { background: var(--surface-2); }

/* -- Chip de filtro ativo (lista de obras) -- */
.chip-filtro { margin: 10px 0 0; padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip-filtro a { margin-left: auto; font-size: 13px; }

/* -- Aviso de limite (contador) -- */
.ajuda--erro { color: #bf453c; font-weight: 600; }
/* Ajuste do contentor do dropdown para itens de largura total */
.sino__lista { padding: 0; width: 320px; overflow: hidden; }
.sino__vazio { padding: 14px; }
.sino__item:last-of-type { border-bottom: none; }

/* -- Modal de adjudicação: lista de orçamentos -- */
.lista-radio { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; max-height: 320px; overflow:auto; }
.radio-linha { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 14px; }
.radio-linha:hover { background: var(--surface-2); }
.radio-linha:has(input:checked) { border-color: #2e7d52; background: #eef6f0; }

/* -- Timeline de auditoria -- */
a.tl-link { display: flex; align-items: flex-start; gap: 10px; text-decoration: none; color: inherit; padding: 9px 8px; border-radius: 8px; }
a.tl-link:hover { background: var(--surface-2); }
.audit-tag { display: inline-block; padding: 0 7px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); font-size: 11px; font-weight: 600; color: var(--ink-soft); }
.tl-ir { margin-left: auto; align-self: center; color: var(--ink-soft); font-weight: 700; }
.tl-dot--adjudicado, .tl-dot--orcamento_criado { background: #2e7d52; }
.tl-dot--desadjudicado, .tl-dot--obra_editada { background: #bf453c; }
.tl-dot--estado { background: #3672a0; }
.tl-dot--fatura, .tl-dot--recibo { background: #997400; }

/* -- Células de duas linhas (info principal + secundária) -- */
.cel-2l { display: flex; flex-direction: column; line-height: 1.25; text-decoration: none; }
a.cel-2l:hover .cel-1 { text-decoration: underline; }
.cel-2l .cel-1 { font-weight: 600; color: var(--ink); }
.cel-2l .cel-2 { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }
.tabela--lista2l td { vertical-align: middle; }

/* -- Matriz de permissões de acesso -- */
.tabela--permissoes th.centro, .tabela--permissoes td.centro { text-align: center; }
.tabela--permissoes thead tr:first-child th { border-bottom: none; }
.tabela--permissoes .subcabecalho th { font-weight: 500; font-size: 12px; color: var(--ink-soft); padding-top: 0; }
.tabela--permissoes tbody td { border-left: 1px solid var(--line); }
.tabela--permissoes tbody td:first-child { border-left: none; }
.tabela--permissoes input[type=checkbox] { width: 17px; height: 17px; cursor: pointer; }

/* ===== Polish de estilo (mockups) ===== */
/* Rótulo dourado por cima do título da página */
.eyebrow { text-transform: uppercase; letter-spacing: 0.09em; font-size: 11.5px; font-weight: 700; color: var(--brand-deep); margin: 0 0 7px; }

/* Ponto colorido antes do estado (pill) */
.estado-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; flex: 0 0 auto; }

/* Linha de lista: avatar de iniciais + duas linhas */
.cel-ent { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.cel-ent .sigla { flex: 0 0 auto; }
.cel-ent:hover .cel-1 { text-decoration: underline; }

/* Localização com pin */
.cel-loc { display: inline-flex; align-items: center; gap: 5px; }
.cel-loc svg { color: var(--ink-faint); flex: 0 0 auto; margin-top: -1px; }

/* ===== Pills de filtro + barra de filtros ===== */
.barra-filtros { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill:hover { background: var(--surface-2); color: var(--ink); }
.pill--ativo { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.barra-pesquisa--fim { margin: 0; flex: 0 1 auto; }
@media (max-width: 720px) { .barra-pesquisa--fim { width: 100%; } }

/* ===== Pesquisa global (barra do topo) ===== */
.topo__pesquisa-wrap { position: relative; flex: 1 1 auto; max-width: 520px; }
.pesquisa-pop { position: absolute; left: 0; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md, 12px); box-shadow: var(--sh-pop, 0 12px 32px rgba(0,0,0,.12)); padding: 6px; z-index: 50; max-height: 70vh; overflow: auto; }
.pesquisa-vazio { padding: 14px; color: var(--ink-soft); font-size: 14px; }
.pesquisa-grupo { padding: 4px 0; }
.pesquisa-grupo__tit { text-transform: uppercase; letter-spacing: 0.07em; font-size: 11px; font-weight: 700; color: var(--ink-faint); padding: 6px 10px 3px; }
.pesquisa-item { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 8px; text-decoration: none; }
.pesquisa-item:hover { background: var(--surface-2); }
.pesquisa-item__1 { font-weight: 600; color: var(--ink); font-size: 14px; }
.pesquisa-item__2 { font-size: 12px; color: var(--ink-soft); }

/* Totais não quebram linha */
.tabela .num, .nowrap { white-space: nowrap; }
/* Visto verde de adjudicado (só símbolo) */
.visto-adj { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--tone-verde-bg); color: var(--tone-verde-fg); }
/* Chevron de "abrir" no fim da linha */
.ir-detalhe { color: var(--ink-faint); display: inline-flex; vertical-align: middle; margin-left: 4px; }
.ir-detalhe:hover { color: var(--ink); }

/* "Aberto por" sob o 1º contacto da datebar */
.datebar-sub { margin-top: 4px; font-size: 12.5px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 6px; }

/* ===== Calendário mensal ===== */
.cal-nav { gap: 6px; }
.cal-grelha { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cab { text-align: center; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); padding: 4px 0; }
.cal-cab--fds { color: var(--ink-faint); }
.cal-dia { min-height: 104px; border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 6px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.cal-dia--vazio { background: transparent; border-color: transparent; }
.cal-dia--fds { background: var(--surface-2); }
.cal-dia--feriado { background: var(--tone-vermelho-bg, #F6D9D6); border-color: #E9C3BF; }
.cal-dia--hoje { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.cal-dia__topo { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; }
.cal-dia__num { font-weight: 700; font-size: 13px; color: var(--ink); }
.cal-feriado { font-size: 10px; color: var(--tone-vermelho-fg, #BF453C); font-weight: 600; text-align: right; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70%; }
.cal-marcacoes { display: flex; flex-direction: column; gap: 3px; }
.cal-marc { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink); text-decoration: none; padding: 2px 4px; border-radius: 5px; }
.cal-marc:hover { background: var(--surface-2); }
.cal-marc__dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cal-marc__txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-mais { font-size: 11px; color: var(--ink-soft); padding: 0 4px; }
@media (max-width: 720px) {
    .cal-dia { min-height: 72px; }
    .cal-marc__txt { display: none; }
    .cal-marc { justify-content: center; }
}

/* Cadeia de responsáveis (atual + anteriores desvanecidos) */
.resp-cadeia{display:inline-flex;align-items:center;gap:6px;flex-wrap:wrap}
.resp-cadeia--form{margin-top:8px}
.sigla--ant{background:var(--cor-fundo);color:var(--cor-suave);border-color:var(--cor-borda);opacity:.6;font-size:.72rem}
.resp-seta{opacity:.5}

/* Filtro de intervalo de datas (Obras/Projetos) */
.barra-datas{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-left:auto}
.barra-datas--full{margin-left:0;margin-bottom:14px}
.campo-data{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600;color:var(--cor-suave);background:var(--cor-branco);border:1px solid var(--cor-borda);border-radius:999px;padding:5px 12px}
.campo-data input[type=date]{border:0;background:transparent;font:inherit;color:var(--cor-texto);padding:0;outline:none;min-width:104px}
.barra-datas .select-curto{border-radius:999px;padding:7px 14px;background:var(--cor-branco);font-size:13px;font-weight:600;color:var(--cor-suave)}
.barra-datas .btn{border-radius:999px}
.contador-resultados{margin:0 0 12px;font-size:13px;color:var(--cor-suave)}
.contador-resultados strong{color:var(--cor-texto);font-weight:700;font-size:14px}

/* Dia do calendário clicável (ver tudo desse dia) */
a.cal-dia__num--link{color:inherit;text-decoration:none;cursor:pointer}
a.cal-dia__num--link:hover{text-decoration:underline}
a.cal-mais{cursor:pointer;text-decoration:none}
a.cal-mais:hover{text-decoration:underline}

/* Grupo de campos com permissão: invisível no layout, mas desativa o conteúdo quando bloqueado */
.grupo-campo{display:contents;border:0;margin:0;padding:0;min-width:0}
fieldset.grupo-campo[disabled]{opacity:.75}

/* Volume adjudicado: barras mensais compactas (hover = comparação homóloga) */
.mbars { display: flex; gap: 4px; margin-top: 18px; align-items: flex-end; }
.mbar { flex: 1; text-align: center; cursor: default; }
.mbar-trilho { height: 60px; display: flex; align-items: flex-end; justify-content: center; }
.mbar-fill { display: block; width: 72%; min-height: 3px; background: var(--ink); border-radius: 4px 4px 0 0; transition: opacity .15s; }
.mbar:hover .mbar-fill { opacity: .7; }
.mbar-lbl { font-size: 9px; font-weight: 700; margin-top: 5px; color: rgba(26,26,23,.6); }

/* Performance: gráfico+conversão em cima, KPIs em grelha fluida por baixo */
.perf-top { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 16px; align-items: start; }
.perf-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
@media (max-width: 760px) { .perf-top { grid-template-columns: 1fr; } }

.rev-data { font-size: 11px; color: var(--cor-suave); margin-left: 4px; }

/* Pesquisa dentro das Observações da ficha de obra */
.obs-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.obs-busca { display: inline-flex; align-items: center; gap: 7px; }
.obs-busca input[type=search] { padding: 5px 10px; border: 1px solid var(--cor-borda); border-radius: 999px; font-size: 12.5px; background: var(--cor-branco); min-width: 170px; }
.obs-busca__n { font-size: 11.5px; white-space: nowrap; }
.obs-texto { white-space: pre-wrap; margin: 0; color: var(--cor-texto); max-height: 360px; overflow: auto; }
mark { background: #FFE082; color: inherit; padding: 0 1px; border-radius: 2px; }

/* Painel "Aplicar descontos" — layout limpo (Desc.1, Desc.2, converter) */
.aplicar-desc { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; padding: 12px 14px; background: var(--cor-fundo); border: 1px solid var(--cor-borda); border-radius: var(--raio); }
.aplicar-desc__linha { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aplicar-desc__lbl { font-size: 13px; color: var(--cor-suave); min-width: 156px; }
.aplicar-desc__pct { width: 90px; }
.aplicar-desc__linha--fim { margin-top: 2px; padding-top: 9px; border-top: 1px solid var(--cor-borda); }

.tabela--editor { table-layout: fixed; }
.tabela--editor .in-tabela { min-width: 0; }

/* Ordenar o menu (Definições) */
.ordem-menu { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ordem-menu__item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--cor-borda); border-radius: var(--raio); background: var(--cor-branco); }
.ordem-menu__pos { color: var(--cor-suave); width: 22px; }
.ordem-menu__lbl { flex: 1; font-weight: 600; }
.ordem-menu__acoes { display: flex; gap: 6px; }
