/* JDC Autos — portal. Linguagem visual alinhada com o JDC Portal (reference). Marca: #FECB00 / #1C3632 / #85CDDB */

@font-face{font-family:"Axiforma";src:url("../fonts/axiforma/Axiforma-Regular.otf") format("opentype");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"Axiforma";src:url("../fonts/axiforma/Axiforma-Medium.otf") format("opentype");font-weight:500;font-style:normal;font-display:swap}
@font-face{font-family:"Axiforma";src:url("../fonts/axiforma/Axiforma-SemiBold.otf") format("opentype");font-weight:600;font-style:normal;font-display:swap}
@font-face{font-family:"Axiforma";src:url("../fonts/axiforma/Axiforma-Bold.otf") format("opentype");font-weight:700;font-style:normal;font-display:swap}

:root{
  --jdc-yellow:#FECB00; --jdc-green:#1C3632; --jdc-blue:#85CDDB;
  --jdc-ink:#0b0b0b; --jdc-muted:rgba(11,11,11,.70); --jdc-line:rgba(28,54,50,.14);
  --jdc-bg:#f4f6f4; --jdc-card:#fff; --jdc-danger:#b42318; --jdc-success:#1a7f37; --jdc-warn:#b54708;
  --jdc-radius:12px; --jdc-shadow:0 10px 30px rgba(0,0,0,.06);
  --jdc-font-title:"Axiforma",Arial,sans-serif;
  --jdc-font-body:Arial,system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,sans-serif;
}
*{box-sizing:border-box}
/* hidden tem de vencer qualquer display definido por classe (ex.: .jdc-btn inline-flex) */
[hidden]{display:none!important}
html,body{margin:0;height:100%}
body{font-family:var(--jdc-font-body);color:var(--jdc-ink);background:var(--jdc-bg);font-size:14px;line-height:1.45}
h1,h2,h3,h4{font-family:var(--jdc-font-title);color:var(--jdc-green)}
#jdc-app{display:flex;flex-direction:column;min-height:100vh}
a{color:var(--jdc-green)}

/* ───────── Topbar ───────── */
.jdc-top{position:sticky;top:0;z-index:100;display:flex;align-items:center;justify-content:space-between;gap:12px;
  background:#fff;border-bottom:2px solid rgba(28,54,50,.08);box-shadow:0 4px 20px rgba(28,54,50,.07);
  padding:12px 24px;flex:none}
.jdc-brand{display:flex;align-items:center;gap:12px;text-decoration:none;min-width:0}
.jdc-logo-box{width:42px;height:42px;border-radius:13px;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,#1C3632,#2a5048);box-shadow:0 4px 12px rgba(28,54,50,.20);flex-shrink:0}
.jdc-logo{height:26px;width:auto;display:block;filter:brightness(0) invert(1)}
.jdc-brand-txt{display:flex;flex-direction:column;min-width:0}
.jdc-wordmark{font-family:var(--jdc-font-title);font-weight:700;font-size:17px;color:var(--jdc-green);line-height:1.1;letter-spacing:-.01em}
.jdc-sub{font-size:11px;font-weight:400;color:var(--jdc-muted);text-transform:uppercase;letter-spacing:.10em;white-space:nowrap}
.jdc-user{display:flex;align-items:center;gap:12px;min-width:0}
.jdc-user-info{display:flex;flex-direction:column;align-items:flex-end;min-width:0;line-height:1.2}
.jdc-user-name{font-family:var(--jdc-font-title);font-weight:700;font-size:14px;color:var(--jdc-green);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:180px}
.jdc-user-role{font-size:11px;color:var(--jdc-muted);text-transform:uppercase;letter-spacing:.06em}
.jdc-avatar{width:38px;height:38px;border-radius:12px;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,#1C3632,#2a5048);font-family:var(--jdc-font-title);font-weight:700;font-size:13px;color:#fff;
  box-shadow:0 2px 8px rgba(28,54,50,.20);flex-shrink:0}
.jdc-logout{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:11px;
  color:var(--jdc-green);border:1px solid var(--jdc-line);text-decoration:none;transition:.12s;flex-shrink:0}
.jdc-logout:hover{background:rgba(28,54,50,.06)}
.jdc-lang{height:38px;padding:0 8px;border-radius:11px;border:1px solid var(--jdc-line);background:#fff;
  color:var(--jdc-green);font-family:var(--jdc-font-title);font-weight:700;font-size:12px;cursor:pointer;transition:.12s}
.jdc-lang:hover{background:rgba(28,54,50,.06)}
.jdc-lang:focus-visible,.jdc-logout:focus-visible{outline:none;border-color:rgba(28,54,50,.45);box-shadow:0 0 0 4px rgba(133,205,219,.25)}

/* ───────── Shell: sidebar + content ───────── */
.jdc-shell{display:flex;flex:1;min-height:0}
.jdc-side{width:228px;flex-shrink:0;background:#fff;border-right:1px solid rgba(28,54,50,.08);padding:16px 12px;
  position:sticky;top:67px;height:calc(100vh - 67px);overflow-y:auto;display:flex;flex-direction:column;gap:4px}
.jdc-navlink{display:flex;align-items:center;gap:11px;padding:10px 13px;border-radius:10px;text-decoration:none;
  font-family:var(--jdc-font-title);font-size:13px;font-weight:600;color:var(--jdc-muted);transition:.12s}
.jdc-navlink .jdc-nav-ic{opacity:.55;flex-shrink:0}
.jdc-navlink:hover{background:rgba(28,54,50,.05);color:var(--jdc-green)}
.jdc-navlink.active{background:var(--jdc-green);color:#fff;box-shadow:0 4px 12px rgba(28,54,50,.18)}
.jdc-navlink.active .jdc-nav-ic{opacity:1}

/* Coluna de conteúdo (view + rodapé), como no JDC Portal: o footer é o último filho desta coluna */
.jdc-main{flex:1;min-width:0;display:flex;flex-direction:column}
.jdc-view{flex:1;min-width:0;padding:26px 30px;max-width:1400px;width:100%;margin:0 auto}
.jdc-empty{color:var(--jdc-muted);padding:40px 8px;text-align:center}

/* Toolbar / page header */
.jdc-page-h{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:18px;flex-wrap:wrap}
.jdc-page-h h1{font-size:24px;margin:0;letter-spacing:-.015em}
.jdc-crumbs{font-size:12px;color:var(--jdc-muted);margin-bottom:6px}
.jdc-crumbs a{color:var(--jdc-muted);text-decoration:none}
.jdc-crumbs a:hover{color:var(--jdc-green)}
.jdc-actions{display:flex;gap:8px;flex-wrap:wrap}
.jdc-page-desc{margin:-8px 0 18px;font-size:15px;line-height:1.55;color:var(--jdc-muted);max-width:62ch}
.jdc-tab-desc{margin:0 0 12px;font-size:13.5px;line-height:1.5;color:var(--jdc-muted);max-width:72ch}

/* ───────── Buttons (valores exactos do JDC Portal) ───────── */
.jdc-btn{display:inline-flex;align-items:center;justify-content:center;gap:10px;border:1px solid transparent;background:#fff;
  color:var(--jdc-green);padding:11px 14px;border-radius:12px;font-size:13px;font-weight:600;font-family:var(--jdc-font-title);
  cursor:pointer;text-decoration:none;line-height:1;transition:transform .06s ease,opacity .12s ease,box-shadow .12s ease}
.jdc-btn:active{transform:translateY(1px)}
.jdc-btn.primary{background:var(--jdc-yellow);color:#111}
.jdc-btn.primary:hover{box-shadow:0 10px 20px rgba(254,203,0,.18);text-decoration:none}
.jdc-btn.secondary{background:var(--jdc-green);color:#fff}
.jdc-btn.secondary:hover{box-shadow:0 10px 20px rgba(28,54,50,.20);text-decoration:none}
.jdc-btn.ghost{background:transparent;border-color:var(--jdc-line);color:var(--jdc-green)}
.jdc-btn.ghost:hover{background:rgba(28,54,50,.04);text-decoration:none}
.jdc-btn.danger{background:var(--jdc-danger);color:#fff;border-color:var(--jdc-danger)}
.jdc-btn.danger:hover{box-shadow:0 10px 20px rgba(180,35,24,.18);text-decoration:none}
.jdc-btn.ghost-danger{background:transparent;border-color:rgba(180,35,24,.35);color:var(--jdc-danger)}
.jdc-btn.ghost-danger:hover{background:rgba(180,35,24,.06);text-decoration:none}
.jdc-btn.sm{padding:7px 10px;border-radius:10px;font-size:13px;font-weight:600}
.jdc-btn[disabled]{opacity:.55;cursor:not-allowed}
/* Desactivado não deve sinalizar interactividade no hover (as variantes têm sombra/hover próprios) */
.jdc-btn[disabled]:hover{box-shadow:none}
.jdc-btn.ghost[disabled]:hover,.jdc-btn.ghost-danger[disabled]:hover{background:transparent}
/* Anel de foco de teclado — a mesma assinatura dos inputs do formulário */
.jdc-btn:focus-visible{outline:2px solid #1C3632;outline-offset:2px;box-shadow:0 0 0 4px rgba(133,205,219,.4)}
.jdc-btn svg{flex-shrink:0;display:block}

/* Botões icon-only + tooltip (padrão do JDC Portal): title → tooltip; label só p/ leitores de ecrã */
.jdc-btn-icon{gap:0;position:relative}
.jdc-btn-icon .jdc-btn-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.jdc-btn-icon[title]::after{content:attr(title);position:absolute;bottom:calc(100% + 6px);left:50%;transform:translateX(-50%);
  background:var(--jdc-green);color:#fff;font-size:11px;font-weight:600;font-family:var(--jdc-font-title);
  padding:4px 10px;border-radius:6px;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .15s ease;z-index:9998}
.jdc-btn-icon[title]:hover::after,.jdc-btn-icon[title]:focus-visible::after{opacity:1}
/* Na última coluna (td.act, encostada à direita) a tooltip ancora à direita — nunca sai do viewport */
.jdc-tbl td.act .jdc-btn-icon[title]::after{left:auto;right:0;transform:none}
/* Dentro do corpo do modal (overflow:auto corta o ::after) fica o title nativo do browser */
.jdc-modal-b .jdc-btn-icon[title]::after{display:none}
.jdc-btn-icon.sm{padding:7px 8px;min-width:32px;min-height:32px}

/* ───────── Cards (contracts) ───────── */
.jdc-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(290px,1fr));gap:14px}
.jdc-card{position:relative;background:var(--jdc-card);border:1px solid var(--jdc-line);border-radius:16px;padding:18px 20px;cursor:pointer;
  box-shadow:0 2px 10px rgba(28,54,50,.04);transition:.14s}
/* Chip branco sólido com sombra: os botões aparecem SOBRE o título do card e têm de o tapar
   por completo (sem backdrop-filter — criaria stacking context e prendia as tooltips). */
.jdc-card-act{position:absolute;top:10px;right:10px;display:flex;gap:4px;opacity:0;transition:opacity .12s ease;
  background:#fff;border:1px solid var(--jdc-line);border-radius:12px;padding:3px;box-shadow:0 4px 14px rgba(28,54,50,.14)}
.jdc-card:hover .jdc-card-act,.jdc-card:focus-within .jdc-card-act{opacity:1}
.jdc-card-act .jdc-btn{background:#fff;border-color:transparent}
/* top:-1px em vez de transform — o transform criava stacking context e prendia a tooltip abaixo da topbar */
.jdc-card:hover{border-color:rgba(28,54,50,.30);box-shadow:0 10px 28px rgba(28,54,50,.10);top:-1px}
.jdc-card .t{font-family:var(--jdc-font-title);font-weight:700;margin-bottom:3px;color:var(--jdc-green)}
.jdc-card .m{font-size:12px;color:var(--jdc-muted)}
.jdc-card .v{margin-top:10px;font-family:var(--jdc-font-title);font-size:18px;font-weight:700;color:var(--jdc-green)}

/* ───────── Badges / pills ───────── */
/* Type-ahead (search-select) nos formulários */
.jdc-ss{position:relative}
.jdc-ss-list{position:absolute;top:calc(100% + 4px);left:0;right:0;max-height:260px;overflow-y:auto;z-index:9997;
  background:#fff;border:1px solid var(--jdc-line);border-radius:10px;box-shadow:0 10px 30px rgba(28,54,50,.14)}
.jdc-ss-item{padding:8px 12px;font-size:13px;cursor:pointer}
.jdc-ss-item:hover,.jdc-ss-item.hi{background:rgba(28,54,50,.06)}

/* Paginação client-side */
.jdc-pager{margin-top:12px;align-items:center;justify-content:center}
.jdc-pg-nums{display:inline-flex;gap:4px}
.jdc-pg-info{font-size:12px;margin-right:6px}

/* Overlay de operação longa */
.jdc-busy{position:fixed;inset:0;z-index:10002;background:rgba(28,54,50,.35);backdrop-filter:blur(1px);
  display:flex;align-items:center;justify-content:center}
.jdc-busy-box{background:#fff;border-radius:14px;padding:18px 26px;font-family:var(--jdc-font-title);font-weight:600;
  color:var(--jdc-green);box-shadow:0 18px 50px rgba(0,0,0,.25);display:flex;align-items:center;gap:12px}
.jdc-busy-spin{width:18px;height:18px;border:3px solid var(--jdc-line);border-top-color:var(--jdc-yellow);
  border-radius:50%;animation:jdc-spin .8s linear infinite;flex:none}
@keyframes jdc-spin{to{transform:rotate(360deg)}}

/* Vista mobile: tabelas em cartões (data-label gerado do thead) */
@media (max-width:768px){
  .jdc-tbl.jdc-mcards thead{display:none}
  .jdc-tbl.jdc-mcards,.jdc-tbl.jdc-mcards tbody,.jdc-tbl.jdc-mcards tr,.jdc-tbl.jdc-mcards td{display:block;width:100%}
  .jdc-tbl.jdc-mcards tr{border:1px solid var(--jdc-line);border-radius:12px;margin-bottom:10px;padding:10px 12px;background:#fff}
  .jdc-tbl.jdc-mcards td{border:none;padding:4px 0;display:flex;justify-content:space-between;align-items:baseline;gap:12px;text-align:right}
  .jdc-tbl.jdc-mcards td[data-label]::before{content:attr(data-label);font-weight:600;font-size:12px;color:var(--jdc-muted);text-align:left;flex:none}
  .jdc-tbl.jdc-mcards td.act{justify-content:flex-end}
  .jdc-tbl.jdc-mcards td.jdc-chk-col{justify-content:flex-start}
  .jdc-tbl.jdc-mcards td[colspan]{display:block;text-align:left}
}

/* Árvore da estrutura: nós colapsáveis + série de pisos */
.jdc-tree li.jdc-tree-collapsed > ul{display:none}
.jdc-tree .jdc-node{cursor:default}
.jdc-tree li:has(> ul) > .jdc-node{cursor:pointer}
.jdc-tree .jdc-caret{display:inline-block;width:14px;color:var(--jdc-muted);font-size:11px}
.jdc-node-count{font-size:11px}

/* Grelha de quantidades por frente */
.jdc-qty-cell{width:120px;text-align:right;padding:6px 8px;border:1px solid var(--jdc-line);border-radius:8px;font:inherit}

/* Dica de seleção mista nas ações em lote */
.jdc-bulk-hint{font-size:12px;align-self:center}

/* KPIs no card do contrato */
.jdc-card-kpis{margin-top:8px;font-size:11.5px}

/* Ordenação por cabeçalho (chevrons do padrão jdc-portal) */
.jdc-tbl th[data-sort]{cursor:pointer;user-select:none;white-space:nowrap}
.jdc-tbl th[data-sort]:hover{color:var(--jdc-green)}
.jdc-tbl th[data-sort]::after{content:'';display:inline-block;width:14px;height:14px;vertical-align:-2px;margin-left:4px;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 15l5 5 5-5'/%3E%3Cpath d='M7 9l5-5 5 5'/%3E%3C/svg%3E") no-repeat center;opacity:.4}
.jdc-tbl th[data-sort].sort-asc::after{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231C3632' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 9l5-5 5 5'/%3E%3C/svg%3E");opacity:1}
.jdc-tbl th[data-sort].sort-desc::after{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231C3632' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 15l5 5 5-5'/%3E%3C/svg%3E");opacity:1}

/* Coluna de seleção (import DW sempre visível; nas tabelas CRUD só em modo de seleção) */
.jdc-tbl th.jdc-chk-col,.jdc-tbl td.jdc-chk-col{width:34px;text-align:center}
.jdc-tbl.jdc-bulk .jdc-chk-col{display:none}
.jdc-tbl.jdc-bulk.jdc-selecting .jdc-chk-col{display:table-cell}
.jdc-chk-col input[type=checkbox]{cursor:pointer}
.jdc-dw-bar{margin-bottom:12px;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
/* Tabela do modal de importação DW: cabe sempre no modal, sem transbordo horizontal (#UX 17/07).
   Sem botão por linha — a linha inteira é clicável para seleccionar. */
.jdc-dw-tbl{table-layout:auto}
.jdc-dw-tbl th{white-space:nowrap}
.jdc-dw-tbl td,.jdc-dw-tbl th{word-break:break-word}
.jdc-dw-tbl .act{width:1%;white-space:nowrap;text-align:right}
.jdc-dw-tbl tr.jdc-row-pick{cursor:pointer}
.jdc-dw-tbl tr.jdc-row-pick:hover td{background:rgba(28,54,50,.035)}
/* Rodapé do modal de importação: botão centrado, sempre visível ao fundo (fora do scroll),
   aparece só quando há selecção — sem faixa nem conteúdo a espreitar por baixo (#UX 17/07). */
.jdc-dw-foot{justify-content:center}
.jdc-dw-foot[hidden]{display:none}
/* Relatório de comparação: no modo só-consulta (leitura por IA) não há seleção de linhas. */
.jdc-cmp-ro .jdc-chk-col{display:none}
/* Designação longa não pode rebentar a altura da linha: uma linha com reticências + tooltip. */
.jdc-cmp-tbl td.jdc-desig{max-width:460px}
.jdc-cmp-tbl td.jdc-desig>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.jdc-badge{display:inline-flex;vertical-align:middle;align-items:center;gap:5px;font-family:var(--jdc-font-title);font-size:11px;font-weight:700;
  line-height:1;padding:4px 10px;border-radius:999px;border:1px solid var(--jdc-line);background:rgba(28,54,50,.03);color:var(--jdc-green)}
.jdc-badge.active{background:rgba(26,127,55,.08);color:var(--jdc-success);border-color:rgba(26,127,55,.20)}
.jdc-badge.dw{background:rgba(59,83,181,.08);color:#3b53b5;border-color:rgba(59,83,181,.20)}
.jdc-badge.portal,.jdc-badge.subcontractor{background:rgba(254,203,0,.14);color:#7a5a00;border-color:rgba(254,203,0,.45)}

/* Detail header / KPI / tabs */
.jdc-dh{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;border-bottom:1px solid var(--jdc-line);padding-bottom:16px;margin-bottom:18px}
.jdc-dh h1{font-size:24px;margin:0 0 4px;letter-spacing:-.015em}
.jdc-dh .sub{color:var(--jdc-muted);font-size:13px}
.jdc-kpi{text-align:right}
.jdc-kpi .v{font-family:var(--jdc-font-title);font-size:22px;font-weight:700;color:var(--jdc-green);letter-spacing:-.02em}
.jdc-kpi .l{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--jdc-muted)}
.jdc-tabs{display:flex;gap:4px;border-bottom:2px solid rgba(28,54,50,.08);margin-bottom:18px;flex-wrap:wrap}
.jdc-tab{padding:9px 16px;cursor:pointer;text-decoration:none;font-family:var(--jdc-font-title);font-size:13px;font-weight:600;
  color:var(--jdc-muted);border-bottom:2px solid transparent;margin-bottom:-2px;transition:.12s}
.jdc-tab:hover{color:var(--jdc-green)}
.jdc-tab.active{color:var(--jdc-green);border-bottom-color:var(--jdc-yellow)}

/* ───────── Tables ─────────
   border-collapse:separate + raios nos cantos (SEM overflow:hidden — cortava as tooltips) */
table.jdc-tbl{width:100%;border-collapse:separate;border-spacing:0;background:var(--jdc-card);border:1px solid var(--jdc-line);border-radius:16px}
.jdc-tbl thead th:first-child{border-top-left-radius:15px}
.jdc-tbl thead th:last-child{border-top-right-radius:15px}
.jdc-tbl tbody tr:last-child td:first-child{border-bottom-left-radius:15px}
.jdc-tbl tbody tr:last-child td:last-child{border-bottom-right-radius:15px}
.jdc-tbl th{text-align:left;font-family:var(--jdc-font-title);font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;
  color:var(--jdc-muted);background:#fafbfa;padding:11px 14px;border-bottom:2px solid rgba(28,54,50,.08)}
.jdc-tbl td{padding:12px 14px;border-bottom:1px solid rgba(28,54,50,.06);vertical-align:middle;font-size:14px}
.jdc-tbl tr:last-child td{border-bottom:none}
.jdc-tbl tbody tr:hover td{background:rgba(28,54,50,.02)}
.jdc-tbl td.num{text-align:right;font-variant-numeric:tabular-nums}
.jdc-tbl td.act{text-align:right;white-space:nowrap}
.jdc-tbl td.act .jdc-btn{margin-left:4px}
.jdc-cell-sub{font-size:12px;color:var(--jdc-muted);line-height:1.3;margin-top:2px;max-width:380px;white-space:normal;word-break:break-word}

/* Tree */
.jdc-tree{font-size:13px}
.jdc-tree ul{list-style:none;margin:0;padding-left:20px;border-left:1px dashed var(--jdc-line)}
.jdc-tree>ul{padding-left:0;border:none}
.jdc-tree li{margin:4px 0}
.jdc-node{display:flex;align-items:center;gap:8px}
.jdc-node .code{display:inline-block;min-width:54px;color:var(--jdc-muted);font-variant-numeric:tabular-nums}
.jdc-node .nm{font-weight:500}
.jdc-node .row-act{opacity:0;display:flex;gap:4px;margin-left:6px}
.jdc-node:hover .row-act{opacity:1}
.lvl-subsection>.jdc-node .nm{font-weight:700}
.jdc-section-title{font-family:var(--jdc-font-title);font-size:13px;font-weight:700;color:var(--jdc-green);margin:20px 0 8px;display:flex;justify-content:space-between;align-items:center}

/* Capítulos colapsáveis + pesquisa live */
.jdc-chap-h{cursor:pointer;user-select:none}
.jdc-caret{display:inline-block;width:14px;color:var(--jdc-blue)}
.jdc-chap.jdc-collapsed table.jdc-tbl{display:none}
.jdc-search{min-width:220px}

/* MQT item expand */
tr.jdc-item{cursor:pointer}
tr.jdc-item:hover{background:rgba(28,54,50,.02)}
.jdc-exp{display:inline-block;width:12px;color:var(--jdc-blue);font-size:11px}
tr.jdc-item-detail>td{background:#f7faf9;padding:0}
.jdc-det{display:flex;gap:40px;padding:12px 16px 14px 34px;flex-wrap:wrap}
.jdc-det-col h4{margin:0 0 6px;font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--jdc-muted);display:flex;gap:8px;align-items:center}
.jdc-det-col .ln{padding:2px 0;display:flex;align-items:center;gap:8px}
.jdc-det-col b{color:var(--jdc-green)}
.jdc-act{margin:6px 0;padding:6px 8px;border:1px solid var(--jdc-line);border-radius:8px;background:rgba(28,54,50,.02)}
.jdc-act-h{display:flex;align-items:center;gap:8px;margin-bottom:2px}
.jdc-act-nm{font-weight:600}
.jdc-act-def{font-size:11px;text-transform:none;letter-spacing:0}
.jdc-ai-form{max-width:760px}
.jdc-ai-form textarea{width:100%;font-family:inherit;line-height:1.4;resize:vertical}
.jdc-ai-actions{margin-top:14px}
.jdc-ai-model select,.jdc-ai-model>input{display:block;width:100%;margin-bottom:5px}
.jdc-ai-modelbar{display:flex;align-items:center;gap:10px;margin-top:6px}
.jdc-ai-live{font-size:12px;color:var(--jdc-muted)}
.jdc-ai-status{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:8px 0 4px;font-size:12px}
.jdc-ai-form label>.jdc-btn{margin-left:8px}
.jdc-muted{color:var(--jdc-muted)}

/* ───────── Forms / modal ───────── */
.jdc-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.40);display:flex;align-items:flex-start;justify-content:center;
  padding:48px 16px;z-index:9999;overflow:auto;backdrop-filter:blur(2px)}
.jdc-modal{background:#fff;border-radius:20px;width:100%;max-width:520px;box-shadow:0 24px 64px rgba(0,0,0,.18)}
.jdc-modal.wide{max-width:760px}
.jdc-modal.mwide{max-width:980px}  /* tabelas de poucas colunas (planeamento por frente) */
.jdc-modal.xwide{max-width:1400px} /* relatórios com muitas colunas (comparador) respiram melhor */
.jdc-modal-h{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--jdc-line)}
.jdc-modal-h h3{margin:0;font-size:18px}
.jdc-modal-x{border:none;background:none;font-size:22px;cursor:pointer;color:var(--jdc-muted);line-height:1;border-radius:8px;width:32px;height:32px}
.jdc-modal-x:hover{background:rgba(28,54,50,.06);color:var(--jdc-green)}
.jdc-modal-b{padding:20px 24px;max-height:65vh;overflow:auto}
.jdc-form .jdc-field{margin-bottom:14px}
.jdc-form label{display:block;font-family:var(--jdc-font-title);font-size:13px;font-weight:600;color:var(--jdc-green);margin-bottom:6px}
.jdc-form input,.jdc-form select,.jdc-form textarea{width:100%;border:1px solid var(--jdc-line);border-radius:10px;padding:10px 12px;font-size:14px;font-family:inherit;background:#fff;color:var(--jdc-ink)}
.jdc-form input:focus,.jdc-form select:focus,.jdc-form textarea:focus{outline:none;border-color:rgba(28,54,50,.45);box-shadow:0 0 0 4px rgba(133,205,219,.25)}
.jdc-form textarea{min-height:64px;resize:vertical}
.jdc-form .row2{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.jdc-date-row{display:flex;gap:8px;align-items:stretch}
.jdc-date-row input{flex:1}
.jdc-date-row .jdc-today{flex:none;white-space:nowrap}
.jdc-form-err{background:rgba(180,35,24,.06);color:var(--jdc-danger);border:1px solid rgba(180,35,24,.25);border-radius:10px;padding:10px 12px;font-size:13px;margin-bottom:12px}
.jdc-modal-f{display:flex;justify-content:flex-end;gap:8px;padding:16px 24px;border-top:1px solid var(--jdc-line)}
.jdc-hint{font-size:12px;color:var(--jdc-muted);margin-top:6px}
.jdc-banner-warn{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:10px 0;padding:10px 14px;border-radius:8px;background:rgba(254,203,0,.14);border:1px solid rgba(254,203,0,.5);color:#7a5a00;font-size:13px}
.jdc-pre{background:#f7faf9;border:1px solid var(--jdc-line);border-radius:10px;padding:10px 12px;font-size:13px;margin-top:10px;white-space:pre-line}

/* Estados de produção (badges) + selector inline */
.jdc-badge.st-draft{background:rgba(28,54,50,.06);color:var(--jdc-muted);border-color:rgba(28,54,50,.10)}
.jdc-badge.st-validated{background:rgba(43,95,181,.08);color:#2b5fb5;border-color:rgba(43,95,181,.20)}
.jdc-badge.st-registered{background:rgba(43,107,122,.08);color:#2b6b7a;border-color:rgba(43,107,122,.20)}
.jdc-badge.st-available{background:rgba(26,127,55,.08);color:var(--jdc-success);border-color:rgba(26,127,55,.20)}
.jdc-badge.st-in_auto{background:rgba(254,203,0,.14);color:#7a5a00;border-color:rgba(254,203,0,.45)}
.jdc-badge.st-billed{background:var(--jdc-green);color:var(--jdc-yellow);border-color:var(--jdc-green)}
.jdc-badge.st-generated{background:rgba(26,127,55,.08);color:var(--jdc-success);border-color:rgba(26,127,55,.20)}
.jdc-badge.st-closed{background:var(--jdc-green);color:var(--jdc-yellow);border-color:var(--jdc-green)}
.jdc-badge.st-archived{background:rgba(43,107,122,.08);color:#2b6b7a;border-color:rgba(43,107,122,.20)}
.jdc-inline-sel{border:1px solid var(--jdc-line);border-radius:9px;padding:7px 10px;font-size:13px;background:#fff;font-family:inherit}

/* QR label */
.jdc-qr{display:inline-block}
.jdc-qr svg{width:220px;height:auto}

/* ───────── Ficheiros (SharePoint) ───────── */
.jdc-files-h{font-family:var(--jdc-font-title);font-size:15px;margin-bottom:14px;color:var(--jdc-green);display:flex;align-items:center;gap:6px}
.jdc-card.jdc-lib{display:flex;flex-direction:column;justify-content:center;min-height:74px}
.jdc-card.jdc-lib .t{font-size:14px;display:flex;align-items:center;gap:7px}
/* Ícones de tipo de ficheiro (SVG do sistema ICONS, cor por extensão) */
.jdc-fi{display:inline-flex}
.jdc-fi svg{flex:none}
.jdc-fi-xls{color:#1D6F42}
.jdc-fi-pdf{color:#C0392B}
.jdc-fi-doc{color:#2B579A}
.jdc-fi-ppt{color:#D24726}
.jdc-fi-img{color:var(--jdc-blue)}
.jdc-fi-mail,.jdc-fi-zip,.jdc-fi-gen{color:var(--jdc-muted)}
.jdc-files-bc{font-size:13px;color:var(--jdc-muted);margin-bottom:14px;display:flex;flex-wrap:wrap;gap:3px;align-items:center}
.jdc-files-bc a{color:var(--jdc-green);text-decoration:none;font-weight:600}
.jdc-files-bc a:hover{text-decoration:underline}
.jdc-file-name{display:inline-flex;align-items:center;gap:7px}
a.jdc-file-name{color:var(--jdc-green);text-decoration:none;font-weight:600}
a.jdc-file-name:hover{text-decoration:underline}

/* ───────── Adiantamentos (regra dos 5 meses) ───────── */
.jdc-adv-banner{background:rgba(180,35,24,.06);border:1px solid rgba(180,35,24,.25);color:#922018;border-radius:12px;padding:11px 14px;font-size:13.5px;margin-bottom:14px}
.jdc-badge.adv-ok{background:rgba(26,127,55,.08);color:var(--jdc-success);border-color:rgba(26,127,55,.20)}
.jdc-badge.adv-warning{background:rgba(217,119,6,.12);color:#b54708;border-color:rgba(181,71,8,.35)}
.jdc-badge.adv-overdue{background:rgba(180,35,24,.10);color:var(--jdc-danger);border-color:rgba(180,35,24,.35)}
.jdc-badge.adv-deducted{background:rgba(28,54,50,.06);color:var(--jdc-muted);border-color:rgba(28,54,50,.12)}
.jdc-badge.adv-cleared{background:rgba(43,107,122,.08);color:#2b6b7a;border-color:rgba(43,107,122,.20)}
.adv-lim{font-weight:800}
.adv-lim-warning{color:#b54708}
.adv-lim-overdue{color:var(--jdc-danger)}
.jdc-adv-list{margin:8px 0 4px;padding-left:20px;font-size:13.5px}
.jdc-adv-list li{margin:3px 0}

/* ───────── Toast ───────── */
.jdc-toast{position:fixed;right:24px;top:24px;background:#fff;color:#1a5c2a;padding:13px 16px;border-radius:10px;
  box-shadow:0 10px 30px -8px rgba(0,0,0,.18),0 4px 12px -4px rgba(0,0,0,.08);border-left:4px solid var(--jdc-success);
  font-size:14px;font-weight:500;max-width:380px;z-index:10001}
.jdc-toast.err{color:#922018;border-left-color:var(--jdc-danger)}

/* ───────── Responsivo ───────── */
@media (max-width:820px){
  .jdc-shell{flex-direction:column}
  .jdc-side{width:100%;height:auto;position:static;flex-direction:row;overflow-x:auto;gap:6px;
    border-right:none;border-bottom:1px solid rgba(28,54,50,.08);padding:8px 12px}
  .jdc-navlink{flex-shrink:0;white-space:nowrap}
  .jdc-view{padding:18px 16px;overflow-x:auto}
  .jdc-btn{padding:9px 12px}
  .jdc-btn.sm{padding:6px 8px;font-size:12px}
  .jdc-user-info{display:none}
}
@media (max-width:520px){
  .jdc-top{padding:10px 14px}
  .jdc-sub{display:none}
  .jdc-toast{left:16px;right:16px;top:auto;bottom:16px;max-width:none}
}

/* ── Rodapé de página (login + portal), como no Portal de Cliente ── */
.jdc-portal-footer{padding:24px 8px 16px;text-align:center;font-size:11px;color:var(--jdc-muted);opacity:.7}
.jdc-portal-footer a{color:var(--jdc-blue);text-decoration:none;font-weight:600}
.jdc-portal-footer a:hover{text-decoration:underline}

/* ── Editor de layouts de documento (F3) ── */
.jdc-layout-cols td{vertical-align:middle}
.jdc-layout-cols tr.jdc-custom td:first-child{box-shadow:inset 3px 0 0 var(--jdc-yellow, #FECB00)}
.jdc-layout-cols input.jdc-inline-sel,.jdc-layout-cols select.jdc-inline-sel{margin:0}
.jdc-hint code{background:rgba(28,54,50,.06);padding:1px 4px;border-radius:4px;font-size:11px}

/* ── Lote E: linhas clicáveis, saldos negativos, totais de tabela ── */
.jdc-row-link{cursor:pointer}
.jdc-row-link:hover td{background:rgba(133,205,219,.08)}
.jdc-neg{color:var(--jdc-danger, #c0392b);font-weight:700}
tr.jdc-tfoot td{font-weight:700;border-top:2px solid rgba(28,54,50,.25);color:var(--jdc-green)}
.jdc-adv-banner-click{cursor:pointer}

/* ── Lote G: stat-cards (#8/#46) ── */
.jdc-stats{display:flex;gap:12px;flex-wrap:wrap;margin:14px 0 4px}
.jdc-stat{flex:1 1 160px;min-width:150px;background:#fff;border:1px solid rgba(28,54,50,.1);border-radius:10px;padding:12px 14px;box-shadow:inset 4px 0 0 var(--jdc-blue)}
.jdc-stat .v{font-weight:800;font-size:17px;color:var(--jdc-green)}
.jdc-stat .l{font-size:11.5px;color:var(--jdc-muted);margin-top:2px}
.jdc-stat-billed{box-shadow:inset 4px 0 0 var(--jdc-yellow)}
.jdc-stat-avail{box-shadow:inset 4px 0 0 #4caf7d}
.jdc-stat-month{box-shadow:inset 4px 0 0 var(--jdc-blue)}
.jdc-stat-gap{box-shadow:inset 4px 0 0 var(--jdc-danger,#c0392b)}
.jdc-stat-last{box-shadow:inset 4px 0 0 rgba(28,54,50,.25)}

/* ── #41: entidades desativadas ── */
tr.jdc-inactive td{opacity:.55}

/* botões desativados (ex.: leitura assistida antes de ligada no ambiente) */
.jdc-btn:disabled{opacity:.45;cursor:not-allowed}

/* Matriz de permissões (RBAC administrável) */
.jdc-tbl-scroll { overflow-x: auto; }
.jdc-perm-tbl th { position: sticky; top: 0; background: var(--jdc-bg, #fff); }
.jdc-perm-tbl td.num, .jdc-perm-tbl th.num { text-align: center; min-width: 110px; }
.jdc-perm-group td { background: rgba(28, 54, 50, .06); }
.jdc-perm-tbl input[type="checkbox"] { cursor: pointer; }
.jdc-perm-tbl input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .45; }

/* ── Inputs de ficheiro e checkboxes com o design do portal ── */
input[type="file"] { font: inherit; color: var(--muted, #5b6b66); }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 8px 14px; margin-right: 10px;
  border: 1.5px solid #1C3632; border-radius: 10px;
  background: #fff; color: #1C3632;
  transition: background .15s ease;
}
input[type="file"]::file-selector-button:hover { background: #eef3f1; }
.jdc-file-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; flex: 0 0 auto;
  border: 1.5px solid #93a5a0; border-radius: 5px;
  background: #fff; cursor: pointer; position: relative;
  vertical-align: middle; transition: background .12s ease, border-color .12s ease;
}
input[type="checkbox"]:hover:not(:disabled) { border-color: #1C3632; }
input[type="checkbox"]:checked { background: #1C3632; border-color: #1C3632; }
input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FECB00' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 12px 12px; background-position: center; background-repeat: no-repeat;
}
input[type="checkbox"]:indeterminate { background: #1C3632; border-color: #1C3632; }
input[type="checkbox"]:indeterminate::after {
  content: ""; position: absolute; left: 3.5px; top: 7px; width: 9px; height: 2.5px; background: #FECB00;
}
input[type="checkbox"]:disabled { opacity: .45; cursor: not-allowed; }
input[type="checkbox"]:focus-visible { outline: 2px solid #85CDDB; outline-offset: 2px; }

/* ── Sidepanel de perfil (fiel ao jdc-portal) ── */
.jdc-avatar-btn { border: none; cursor: pointer; transition: transform .12s; }
.jdc-avatar-btn:hover { transform: scale(1.06); }
.jdc-hamburger-btn { background: none; border: none; cursor: pointer; padding: 8px; border-radius: 10px; color: #1C3632; display: flex; align-items: center; transition: background .12s; }
.jdc-hamburger-btn:hover { background: rgba(28,54,50,.08); }
.jdc-hamburger-btn:focus-visible, .jdc-avatar-btn:focus-visible { outline: 2px solid #85CDDB; outline-offset: 2px; }
.jdc-sidepanel-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 9998; backdrop-filter: blur(2px); }
.jdc-sidepanel-backdrop.is-open { display: block; }
.jdc-sidepanel { position: fixed; top: 0; right: 0; width: 360px; max-width: 90vw; height: 100vh; background: #fff; z-index: 9999;
  box-shadow: -8px 0 40px rgba(0,0,0,.12); transform: translateX(100%); transition: transform .25s ease; display: flex; flex-direction: column; overflow-y: auto; }
.jdc-sidepanel.is-open { transform: translateX(0); }
.jdc-sidepanel-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 16px; border-bottom: 1px solid #e3e9e6; }
.jdc-sidepanel-header h3 { margin: 0; font-size: 16px; color: #1C3632; }
.jdc-sidepanel-close { background: none; border: none; cursor: pointer; padding: 6px; border-radius: 8px; color: #1C3632; display: flex; align-items: center; transition: background .12s; }
.jdc-sidepanel-close:hover { background: rgba(28,54,50,.06); }
.jdc-sidepanel-body { flex: 1; padding: 16px 22px; }
.jdc-profile-card { display: flex; align-items: center; gap: 14px; padding: 16px; background: #f4f6f4; border-radius: 14px; margin-bottom: 16px; }
.jdc-profile-card .jdc-avatar { width: 48px; height: 48px; font-size: 16px; flex: 0 0 auto; }
.jdc-profile-name { font-weight: 700; font-size: 15px; color: #1C3632; }
.jdc-profile-email { font-size: 12px; color: #5b6b66; margin-top: 2px; }
.jdc-profile-company { font-size: 11px; color: #5b6b66; margin-top: 2px; }
.jdc-sidepanel-divider { height: 1px; background: #e3e9e6; margin: 14px 0; }
.jdc-sidepanel-sec { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #5b6b66; margin-bottom: 8px; padding: 0 4px; display: flex; align-items: center; gap: 6px; }
.jdc-lang-selector { display: flex; gap: 6px; padding: 4px; }
.jdc-lang-btn { padding: 6px 14px; border-radius: 8px; border: 1px solid #e3e9e6; background: #fff; cursor: pointer; font-size: 13px; font-weight: 600; color: #5b6b66; transition: all .12s; }
.jdc-lang-btn:hover { border-color: rgba(28,54,50,.3); }
.jdc-lang-btn.is-active { background: #1C3632; color: #fff; border-color: #1C3632; }
.jdc-sidepanel-nav { list-style: none; margin: 8px 0 20px; padding: 0; }
.jdc-sidepanel-nav a { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; color: #1C3632; text-decoration: none; transition: background .12s; }
.jdc-sidepanel-nav a:hover { background: rgba(28,54,50,.04); }
.jdc-sidepanel-nav svg { flex-shrink: 0; opacity: .6; }
.jdc-sidepanel-nav .jdc-panel-logout { color: #b3261e; }
.jdc-lbl { display: block; font-size: 12px; font-weight: 600; color: #5b6b66; margin-bottom: 4px; }
.jdc-inp { width: 100%; padding: 9px 12px; border: 1.5px solid #dde5e2; border-radius: 10px; font: inherit; }

/* File picker personalizado (o botão nativo não é traduzível) */
.jdc-filepick input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.jdc-filepick { position: relative; display: inline-flex; align-items: center; gap: 10px; }
.jdc-filepick .jdc-file-name-lbl { color: #5b6b66; font-size: 13px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Barras de secção com ações integradas (Equipas/Afetações) */
.jdc-section-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.jdc-section-title > span:first-child { margin-right: 2px; }
.jdc-section-title .jdc-sec-search { margin-left: auto; display: flex; align-items: center; gap: 8px; }


/* Foco de teclado visível em elementos operáveis não-nativos (a11y) */
.jdc-card[role="button"]:focus-visible, .jdc-node[role="button"]:focus-visible,
.jdc-chap-h[role="button"]:focus-visible, th[data-sort]:focus-visible,
.jdc-item[role="button"]:focus-visible, a.jdc-navlink:focus-visible, .jdc-tab:focus-visible {
  outline: 2px solid #1C3632; outline-offset: 2px; border-radius: 8px;
}
th[data-sort] { cursor: pointer; }
/* setas de expandir/colapsar: azul demasiado claro para indicador funcional → verde de marca */
.jdc-caret, .jdc-exp { color: #1C3632; }
/* link do rodapé legível (azul claro sobre fundo claro falhava contraste) */
.jdc-portal-footer a { color: #16606f; }
.jdc-navlink[aria-current="page"], .jdc-tab[aria-current="page"] { font-weight: 700; }

/* Campo só-de-leitura num formulário (ex.: código ERP vindo do DW): visivelmente não-editável. */
.jdc-form input.jdc-ro{background:rgba(28,54,50,.05);color:var(--jdc-muted);cursor:not-allowed}
.jdc-form input.jdc-ro:focus{outline:none;border-color:var(--jdc-line);box-shadow:none}

/* ── Ajuda contextual por ecrã (botão "?" + modal-guia) ── */
.jdc-tabs .jdc-help-btn { margin-left: auto; align-self: center; }
.jdc-help-intro { margin: 0 0 4px; line-height: 1.55; }
.jdc-help-h { font-weight: 700; color: var(--jdc-green, #1C3632); margin: 18px 0 8px; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.jdc-help-steps { margin: 0; padding-left: 20px; line-height: 1.6; }
.jdc-help-steps li { margin-bottom: 5px; }
.jdc-help-acts { list-style: none; margin: 0; padding: 0; }
.jdc-help-acts li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid rgba(28,54,50,.08); line-height: 1.5; }
.jdc-help-acts li:last-child { border-bottom: none; }
.jdc-help-ic { flex: 0 0 auto; width: 22px; height: 22px; color: var(--jdc-green, #1C3632); display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.jdc-help-ic svg { width: 18px; height: 18px; }
.jdc-help-txt b { color: var(--jdc-green, #1C3632); }
.jdc-help-note { background: rgba(133,205,219,.12); border-left: 3px solid var(--jdc-blue, #85CDDB); padding: 8px 12px; margin: 12px 0 0; border-radius: 4px; line-height: 1.5; font-size: .94rem; }

/* Marcador da entidade de uma receção (artigo vs item legado) na listagem de Receções */
.jdc-ent-kind { font-size: .72rem; color: var(--jdc-muted, #6b7d79); margin-left: 7px; text-transform: uppercase; letter-spacing: .03em; vertical-align: middle; }

/* Nota de ajuda por baixo de um campo de formulário (ex.: armazém controlado) */
.jdc-field-hint { margin-top: 4px; font-size: .82rem; line-height: 1.4; color: var(--jdc-muted, #6b7d79); }

/* Barra de ações no topo de um separador do contrato (ex.: Stock) */
.jdc-tab-actions { margin-bottom: 12px; }

/* Sumário das entradas de material do SAP (importação DW) */
.jdc-me-sum { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0; font-size: .95rem; }
.jdc-me-sum span { padding: 4px 10px; border-radius: 6px; background: rgba(28,54,50,.05); }
.jdc-me-sum .ok { background: rgba(133,205,219,.20); }
.jdc-me-sum .warn { background: rgba(254,203,0,.16); }
.jdc-me-sum .muted { color: var(--jdc-muted, #6b7d79); }

/* Painel de consumos no registo de produção (motor de consumos) */
.jdc-cons { margin-top: 16px; border-top: 1px solid rgba(28,54,50,.10); padding-top: 12px; }
.jdc-cons-h { font-weight: 700; color: var(--jdc-green, #1C3632); margin-bottom: 4px; }
.jdc-cons-desc { font-size: .85rem; color: var(--jdc-muted, #6b7d79); line-height: 1.45; margin-bottom: 8px; }
.jdc-cons-tbl td { vertical-align: middle; }
.jdc-cons-tbl select, .jdc-cons-q { padding: 4px 6px; }
.jdc-cons-q { width: 90px; text-align: right; }
.jdc-cons-add { margin-top: 8px; }

/* 8.1 — reconciliação controlada do comparador */
.jdc-cmp-qty { width: 96px; padding: 4px 6px; border: 1px solid #ccc; border-radius: 6px; text-align: right; }
.jdc-cmp-extras { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.jdc-cmp-extra-row { display: flex; gap: 8px; align-items: center; }
.jdc-cmp-extra-row select { max-width: 520px; }
.jdc-cmp-extra-row .jdc-cmp-fil { max-width: 150px; flex: 0 0 auto; }
.jdc-cmp-extra-row { flex-wrap: wrap; }
.jdc-cmp-totais { font-size: 0.95em; }


/* Versão em execução no rodapé + registo de alterações (cliente, 26/08) */
.jdc-versao-sep { margin-left: 10px; }
.jdc-versao-sep::before { content: '·'; margin-right: 10px; opacity: .5; }
button.jdc-versao { background: none; border: 0; padding: 0; font: inherit; color: inherit;
  cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
button.jdc-versao:hover { color: #1C3632; }
.jdc-changelog { max-height: 62vh; overflow-y: auto; line-height: 1.55; }
.jdc-changelog h2 { font-size: 1.02rem; color: #1C3632; margin: 18px 0 6px; }
.jdc-changelog h3 { font-size: .92rem; margin: 14px 0 4px; text-transform: uppercase;
  letter-spacing: .04em; color: #6b7773; }
.jdc-changelog h4 { font-size: .9rem; margin: 10px 0 4px; }
.jdc-changelog ul { margin: 4px 0 10px; padding-left: 20px; }
.jdc-changelog li { margin: 3px 0; }
.jdc-changelog p { margin: 6px 0; }
.jdc-changelog code { background: #f1f3f2; padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* Associação de itens ao RRME: barra de filtros do modal de saldos. */
.jdc-chk-lbl{display:inline-flex;align-items:center;gap:6px;cursor:pointer;white-space:nowrap}
.jdc-dw-bar .jdc-inline-sel{margin:0}

/* Itens em planeamento: lista no separador Planeamento e janela por frente no Articulado. */
.jdc-plan-itens{margin-bottom:22px}
.jdc-plan-h{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.jdc-plan-h .jdc-actions{gap:14px}
/* Terminado/retirado: distingue-se por fundo, não por opacidade — a .55 a designação ficava a
   ~2,6:1 e os botões Estender/Retirar apagavam com ela, justamente na linha onde é preciso decidir. */
.jdc-plan-fora td{background:#f5f6f6;color:#5a6360}
.jdc-plan-fora .jdc-cell-sub,.jdc-plan-fora .jdc-plan-desc{color:#5a6360}
.jdc-plan-tbl td{vertical-align:middle}
.jdc-plan-tbl .jdc-qty-cell{width:76px}
.jdc-plan-fim{font-variant-numeric:tabular-nums;color:var(--jdc-muted)}
input.jdc-full{width:100%}
/* Itens em planeamento: a designação do articulado tem parágrafos inteiros — trunca-se numa
   linha (o texto completo fica no title) para a tabela continuar legível. */
.jdc-plan-desc{max-width:420px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* Na lista de planeamento a designação cede espaço: com o prazo numa linha só, 420px empurravam
   as acções para fora do ecrã num portátil. */
.jdc-plan-itens .jdc-plan-desc{max-width:230px}
.jdc-plan-urgente td{background:#fffaf0}
.jdc-plan-urgente td:nth-child(4){font-weight:700;color:#a15c00}
/* Associação ao RRME: nota do rodapé e código sem quebra a meio. */
.jdc-modal-nota{margin:0 auto 0 0;align-self:center}
.jdc-rrme-cod{white-space:nowrap;font-weight:600}

/* Prazo: a frase cabe numa linha; sem isto partia-se em três num ecrã de portátil. */
.jdc-plan-itens td:nth-child(4){white-space:nowrap}
.jdc-plan-itens th{white-space:nowrap}
.jdc-plan-tbl th{white-space:nowrap}
/* Receções: a designação do articulado tem parágrafos inteiros e a data de entrada não pode
   quebrar a meio — sem isto uma linha ocupava dez. */
.jdc-adv-desc{max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* A frente é identificada pelo código; o nome longo do cliente ("SUB-SECÇÃO A.5.1 - ESTAÇÃO
   ESTRELA") só precisa de caber, não de ocupar duas linhas. */
/* A regra é POSICIONAL e a classe .jdc-bulk é partilhada por várias tabelas: no Articulado a
   terceira coluna não é a frente, é a DESIGNAÇÃO, e cortá-la aos 150px deixava todas as linhas a
   dizer "Encomenda, fornecimento e …" — indistinguíveis, porque é assim que as designações do
   contrato começam. Quem precisa de espaço marca-se com .jdc-desig-longa e fica de fora. */
.jdc-bulk td:nth-child(3):not(.jdc-desig-longa){max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* duas linhas cheias e o texto todo no tooltip: é a coluna que identifica o artigo */
.jdc-bulk td.jdc-desig-longa{max-width:none;min-width:280px;white-space:normal;overflow:hidden;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;line-height:1.35}
.jdc-bulk td:nth-child(4){white-space:nowrap}
.jdc-bulk th{white-space:nowrap}

/* Pôr em planeamento: a nota fica acima do formulário e a tabela de frentes cabe sem
   deslocamento lateral — o nome longo da frente cede, as colunas de decisão não. */
.jdc-modal-intro{margin-bottom:14px}
.jdc-plan-tbl{width:100%;table-layout:fixed}
.jdc-plan-tbl td:first-child,.jdc-plan-tbl th:first-child{width:auto}
.jdc-plan-tbl .jdc-chk-lbl{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;display:flex}
.jdc-plan-tbl td:nth-child(2),.jdc-plan-tbl th:nth-child(2){width:104px}
.jdc-plan-tbl td:nth-child(3),.jdc-plan-tbl th:nth-child(3){width:158px}
.jdc-plan-tbl td:nth-child(4),.jdc-plan-tbl th:nth-child(4){width:118px}
.jdc-plan-tbl input[type=date]{width:100%;min-width:0}
.jdc-plan-tbl .jdc-qty-cell{width:100%;max-width:82px}
/* Produção vinda da app de obra: a proveniência fica visível depois de validada. */
.jdc-badge.jdc-badge-app{background:#e8f4f7;color:#1b5e6b;border-color:#bfe0e8}

/* Atalho para a app de obra: o QR é para ser lido de longe, com o telemóvel na mão de outra
   pessoa — por isso ocupa o modal e não se encolhe. */
.jdc-app-atalho { text-align: center; }
.jdc-app-atalho .jdc-qr { display: flex; justify-content: center; margin: 14px 0 10px; }
.jdc-app-atalho .jdc-qr svg { width: 230px; height: 230px; display: block; }
.jdc-app-urlrow { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.jdc-app-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
  color: var(--jdc-green); background: rgba(28,54,50,.04); border: 1px solid var(--jdc-line);
  border-radius: 10px; padding: 8px 12px; display: inline-block; word-break: break-all; }
.jdc-app-passos { text-align: left; margin: 14px auto 0; padding-left: 22px; max-width: 380px;
  font-size: 13.5px; line-height: 1.6; color: var(--jdc-muted); }
.jdc-app-passos li { margin-bottom: 4px; }
.jdc-app-atalho .jdc-hint { text-align: left; }
.jdc-badge.warn{background:rgba(254,203,0,.14);color:#7a5a00;border-color:rgba(254,203,0,.45)}
.jdc-req{color:#b42318;font-weight:700}
.jdc-form input.jdc-invalid{border-color:#b42318;box-shadow:0 0 0 3px rgba(180,35,24,.15)}
.jdc-badge-btn{cursor:pointer;margin-right:4px}
.jdc-badge-btn:hover{filter:brightness(.95)}
.jdc-plan-n-sem-desc{margin-left:8px;font-size:11px}
.jdc-th-tipo{white-space:normal;text-align:center;font-size:11px;max-width:130px}
/* visor de fotos da produção: em grande + descarregar (03/09) */
.jdc-foto-mini{border:0;padding:0;background:none;cursor:zoom-in;border-radius:8px;overflow:hidden;display:block;width:100%}
.jdc-foto-mini img{width:100%;display:block;border-radius:8px}
.jdc-foto-visor{position:fixed;inset:0;z-index:10000;background:rgba(10,20,18,.92);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:20px}
.jdc-foto-visor img{max-width:96vw;max-height:82vh;border-radius:10px;box-shadow:0 8px 40px rgba(0,0,0,.5)}
.jdc-foto-visor-b{display:flex;gap:10px}
.jdc-foto-visor-b .jdc-btn{text-decoration:none}
/* o «Fechar» ghost é para fundos claros — no visor escuro ficava ilegível (visto pelo Francisco) */
.jdc-foto-visor-b .jdc-btn.ghost{color:#fff;border:1px solid rgba(255,255,255,.55);background:rgba(255,255,255,.10)}
.jdc-foto-visor-b .jdc-btn.ghost:hover{background:rgba(255,255,255,.2)}
