/* =====================================================================
   PRODENKI — tema visual "Futuro" (escuro por defeito, claro opcional)
   A folha da proposta (#printable-proposal-sheet) nunca é afetada:
   continua branca para imprimir e gerar PDF.
   ===================================================================== */

:root {
  --accent: #F26522;
  --accent-2: #ff8a3d;
  --navy: #0B2545;
  --bg: #eef2f8;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #edf1f7;
  --line: rgba(15, 23, 42, 0.08);
  --line-2: rgba(15, 23, 42, 0.14);
  --text: #0b1730;
  --text-2: #334155;
  --text-3: #64748b;
  --text-4: #94a3b8;
  --hover: rgba(15, 23, 42, 0.045);
  --field: #ffffff;
  --field-line: rgba(15, 23, 42, 0.15);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px -12px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 30px 80px -20px rgba(11, 37, 69, 0.35);
  --topbar: rgba(255, 255, 255, 0.72);
  --sidebar: linear-gradient(180deg, #0c2242 0%, #081830 100%);
  --grid-line: rgba(11, 37, 69, 0.045);
  --orb-1: rgba(242, 101, 34, 0.16);
  --orb-2: rgba(56, 189, 248, 0.14);
  --orb-3: rgba(99, 102, 241, 0.10);
  --btn-dark: linear-gradient(135deg, #16365f, #0B2545);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #050a14;
  --surface: rgba(14, 23, 41, 0.86);
  --surface-solid: #0e182b;
  --surface-2: rgba(148, 163, 184, 0.045);
  --surface-3: rgba(148, 163, 184, 0.085);
  --line: rgba(148, 163, 184, 0.12);
  --line-2: rgba(148, 163, 184, 0.22);
  --text: #e8eef8;
  --text-2: #c2cede;
  --text-3: #8d9db5;
  --text-4: #66768f;
  --hover: rgba(148, 163, 184, 0.085);
  --field: rgba(3, 8, 20, 0.55);
  --field-line: rgba(148, 163, 184, 0.22);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.035) inset, 0 18px 40px -18px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 40px 100px -20px rgba(0, 0, 0, 0.8);
  --topbar: rgba(6, 11, 22, 0.66);
  --sidebar: linear-gradient(180deg, rgba(10, 20, 38, 0.92) 0%, rgba(5, 10, 20, 0.95) 100%);
  --grid-line: rgba(148, 163, 184, 0.045);
  --orb-1: rgba(242, 101, 34, 0.20);
  --orb-2: rgba(34, 211, 238, 0.13);
  --orb-3: rgba(99, 102, 241, 0.16);
  --btn-dark: linear-gradient(135deg, #24497a, #163259);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
html, body { background: var(--bg); }
body {
  color: var(--text);
  font-feature-settings: "cv11", "ss01";
  letter-spacing: -0.005em;
}
body::before { /* grelha técnica subtil */
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 60% 0%, #000 0%, transparent 75%);
}
.fx-bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.fx-bg-orbs span { position: absolute; border-radius: 50%; filter: blur(90px); animation: fxFloat 26s ease-in-out infinite alternate; }
.fx-bg-orbs span:nth-child(1) { width: 560px; height: 560px; right: -140px; top: -180px; background: var(--orb-1); }
.fx-bg-orbs span:nth-child(2) { width: 620px; height: 620px; left: 10%; bottom: -320px; background: var(--orb-2); animation-delay: -8s; }
.fx-bg-orbs span:nth-child(3) { width: 420px; height: 420px; left: 45%; top: 30%; background: var(--orb-3); animation-delay: -15s; }
@keyframes fxFloat { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-40px, 30px, 0) scale(1.08); } }

::selection { background: rgba(242, 101, 34, 0.28); color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); background-clip: padding-box; border: 3px solid transparent; }

/* ---------------------------------------------------------------- layout */
#app-shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }
#app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#app-main > main { width: 100%; }
#app-main > main > section:not(.hidden) { animation: fxIn .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes fxIn { from { transform: translateY(6px); } to { transform: none; } }

/* ---------------------------------------------------------------- menu lateral */
#app-sidebar {
  position: sticky; top: 0; height: 100vh; width: 256px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 14px 14px;
  background: var(--sidebar);
  border-right: 1px solid rgba(148, 163, 184, 0.12);
  color: #b9c6d8;
  backdrop-filter: blur(18px);
  transition: width .28s cubic-bezier(.2, .8, .2, 1), transform .28s cubic-bezier(.2, .8, .2, 1);
  z-index: 60; overflow: hidden;
}
#app-sidebar::after { /* linha de luz */
  content: ""; position: absolute; top: 0; right: -1px; width: 1px; height: 100%;
  background: linear-gradient(180deg, transparent, rgba(242, 101, 34, 0.55), transparent 60%);
}
.sb-brand { cursor: pointer; padding: 2px 2px 10px; }
.sb-logo-plate {
  background: #fff; border-radius: 14px; padding: 8px 10px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6), 0 10px 30px -10px rgba(242, 101, 34, 0.45);
}
.sb-logo-full { height: 42px; width: auto; max-width: none; }
.sb-logo-mini { height: 34px; width: 34px; display: none; }
.sb-brand-sub { margin-top: 9px; text-align: center; font: 600 9.5px/1 "JetBrains Mono", monospace; letter-spacing: .22em; text-transform: uppercase; color: #6f819b; white-space: nowrap; }
.sb-cta {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 11px 14px; margin: 4px 0 8px; border-radius: 13px;
  font-weight: 700; font-size: 13px; color: #fff; white-space: nowrap;
  background: linear-gradient(135deg, #ff8a3d 0%, #F26522 50%, #d9480f 100%);
  box-shadow: 0 10px 26px -8px rgba(242, 101, 34, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.sb-cta:hover { filter: brightness(1.08); box-shadow: 0 14px 34px -8px rgba(242, 101, 34, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.sb-cta:active { transform: scale(.98); }
.sb-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overflow-x: hidden; margin: 0 -4px; padding: 0 4px; }
.sb-group { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #5d6f88; padding: 14px 12px 6px; white-space: nowrap; }
.sb-item {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: 12px; font-size: 13px; font-weight: 600; color: #aebbd0;
  white-space: nowrap; transition: background .18s, color .18s;
}
.sb-item i { width: 20px; text-align: center; font-size: 15px; color: #7f91ab; transition: color .18s, filter .18s; }
.sb-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sb-item:hover i { color: #dbe6f5; }
.sb-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(242, 101, 34, 0.24), rgba(242, 101, 34, 0.04) 85%);
  box-shadow: inset 0 0 0 1px rgba(242, 101, 34, 0.22);
}
.sb-item.active::before { content: ""; position: absolute; left: -4px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.sb-item.active i { color: var(--accent-2); filter: drop-shadow(0 0 6px rgba(242, 101, 34, 0.6)); }
.sb-badge {
  margin-left: auto; min-width: 22px; text-align: center; padding: 2px 7px; border-radius: 999px;
  font: 700 10px/1.3 "JetBrains Mono", monospace; color: #c9d5e6; background: rgba(255, 255, 255, 0.08);
}
.sb-badge-alert { color: #fff; background: linear-gradient(135deg, #fb7185, #e11d48); box-shadow: 0 0 14px rgba(244, 63, 94, 0.6); animation: fxPulse 2s infinite; }
@keyframes fxPulse { 50% { box-shadow: 0 0 4px rgba(244, 63, 94, 0.3); } }
.sb-footer { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid rgba(148, 163, 184, 0.12); }
#conn-indicator { padding: 0 10px; white-space: nowrap; }
.sb-user { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 12px; text-align: left; color: #c9d5e6; transition: background .18s; }
.sb-user:hover { background: rgba(255, 255, 255, 0.06); }
.sb-avatar {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; color: #fff; background: linear-gradient(135deg, #ff8a3d, #c2410c);
  box-shadow: 0 6px 16px -6px rgba(242, 101, 34, 0.8);
}
.sb-user-text { flex: 1; min-width: 0; line-height: 1.25; }
#user-display-name { font-size: 12.5px; font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#user-display-title { font-size: 10.5px; color: #fb923c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-collapse { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; font-size: 11.5px; color: #6f819b; white-space: nowrap; }
.sb-collapse:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.sb-collapse i { width: 20px; text-align: center; transition: transform .28s; }

/* menu recolhido */
@media (min-width: 1024px) {
  html.sb-collapsed #app-sidebar { width: 78px; }
  html.sb-collapsed .sb-label, html.sb-collapsed .sb-brand-sub, html.sb-collapsed .sb-group, html.sb-collapsed .sb-logo-full, html.sb-collapsed #conn-text { display: none !important; }
  html.sb-collapsed .sb-logo-mini { display: block; }
  html.sb-collapsed .sb-logo-plate { padding: 6px; }
  html.sb-collapsed .sb-group { display: block !important; height: 14px; padding: 0; font-size: 0; }
  html.sb-collapsed .sb-item, html.sb-collapsed .sb-cta, html.sb-collapsed .sb-collapse { justify-content: center; padding-left: 0; padding-right: 0; }
  html.sb-collapsed .sb-badge { position: absolute; top: 3px; right: 5px; min-width: 0; padding: 1px 5px; font-size: 9px; }
  html.sb-collapsed .sb-collapse i { transform: rotate(180deg); }
  html.sb-collapsed .sb-user { justify-content: center; }
  html.sb-collapsed #conn-indicator { justify-content: center; padding: 0; }
}

/* telemóvel / ecrã pequeno: menu deslizante */
#sidebar-backdrop { display: none; }
@media (max-width: 1023px) {
  #app-sidebar { position: fixed; left: 0; top: 0; transform: translateX(-105%); box-shadow: var(--shadow-lg); }
  html.sb-open #app-sidebar { transform: none; }
  html.sb-open #sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 59; background: rgba(2, 6, 23, 0.55); backdrop-filter: blur(3px); }
  .sb-collapse { display: none; }
}

/* ---------------------------------------------------------------- barra superior */
#app-topbar {
  position: sticky; top: 0; z-index: 50; height: 66px; flex-shrink: 0;
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: var(--topbar); backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.tb-title { min-width: 0; }
#topbar-title { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); white-space: nowrap; }
#topbar-subtitle { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-search {
  margin-left: auto; flex: 0 1 440px; min-width: 0; height: 40px; display: flex; align-items: center; gap: 10px;
  padding: 0 8px 0 14px; border-radius: 12px; font-size: 12.5px; color: var(--text-3);
  background: var(--surface-2); border: 1px solid var(--line); transition: border-color .2s, box-shadow .2s;
}
.tb-search span { flex: 1; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tb-search:hover { border-color: rgba(242, 101, 34, 0.45); box-shadow: 0 0 0 4px rgba(242, 101, 34, 0.08); }
kbd { font: 600 10px/1 "JetBrains Mono", monospace; padding: 4px 6px; border-radius: 6px; color: var(--text-3); background: var(--surface-3); border: 1px solid var(--line); }
.tb-actions { display: flex; align-items: center; gap: 8px; }
.tb-icon {
  width: 40px; height: 40px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); transition: all .18s;
}
.tb-icon:hover { color: var(--accent); border-color: rgba(242, 101, 34, 0.45); }
.fx-btn-success {
  height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border-radius: 12px;
  font-size: 12.5px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #34d399, #059669);
  box-shadow: 0 10px 24px -10px rgba(16, 185, 129, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.fx-btn-success:hover { filter: brightness(1.07); }
.fx-btn-success.hidden { display: none; }
@media (max-width: 767px) {
  #app-topbar { padding: 0 12px; gap: 8px; }
  .tb-search { flex: 0 0 40px; padding: 0; justify-content: center; }
  .tb-search span, .tb-search kbd { display: none; }
  #topbar-subtitle { display: none; }
}

/* menus suspensos */
.fx-menu {
  position: absolute; z-index: 90; min-width: 270px; padding: 6px; border-radius: 16px;
  background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg);
  color: var(--text-2); font-size: 12.5px; animation: fxIn .18s ease-out;
}
.fx-menu.hidden { display: none; }
.fx-menu > button, .fx-menu > label {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px;
  text-align: left; cursor: pointer; font-weight: 500; color: var(--text-2);
}
.fx-menu > button:hover, .fx-menu > label:hover { background: var(--hover); color: var(--text); }
.fx-menu > button i, .fx-menu > label i { width: 16px; text-align: center; color: var(--accent); }
.fx-menu .fx-danger, .fx-menu .fx-danger i { color: #f43f5e; }
.fx-menu-head { padding: 8px 10px 2px; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--text-4); }
.fx-menu-note { padding: 2px 10px 8px; margin-bottom: 4px; font-size: 11px; color: var(--text-3); border-bottom: 1px solid var(--line); }
.fx-menu .hidden { display: none !important; }

/* ---------------------------------------------------------------- pesquisa rápida */
#cmd-palette { position: fixed; inset: 0; z-index: 95; background: rgba(2, 6, 23, 0.55); backdrop-filter: blur(6px); padding: 12vh 16px 16px; }
#cmd-palette.hidden { display: none; }
.cmd-box {
  max-width: 660px; margin: 0 auto; border-radius: 20px; overflow: hidden;
  background: var(--surface-solid); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(242, 101, 34, 0.18), 0 0 60px -10px rgba(242, 101, 34, 0.35);
  animation: fxPop .2s cubic-bezier(.2, .8, .2, 1);
}
@keyframes fxPop { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
.cmd-input-wrap { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); color: var(--text-3); }
.cmd-input-wrap i { color: var(--accent); }
#cmd-palette #cmd-input { flex: 1; border: 0 !important; background: transparent !important; box-shadow: none !important; font-size: 16px; color: var(--text); padding: 0; outline: none; }
#cmd-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.cmd-section { padding: 10px 12px 4px; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--text-4); }
.cmd-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; color: var(--text-2); }
.cmd-item .cmd-ico { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--surface-3); color: var(--text-3); }
.cmd-item .cmd-main { flex: 1; min-width: 0; }
.cmd-item .cmd-t { font-size: 13px; font-weight: 700; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cmd-item .cmd-s { font-size: 11px; color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cmd-item .cmd-r { font: 600 11px "JetBrains Mono", monospace; color: var(--text-3); white-space: nowrap; }
.cmd-item.sel { background: linear-gradient(90deg, rgba(242, 101, 34, 0.16), rgba(242, 101, 34, 0.03)); box-shadow: inset 0 0 0 1px rgba(242, 101, 34, 0.25); }
.cmd-item.sel .cmd-ico { background: linear-gradient(135deg, #ff8a3d, #F26522); color: #fff; }
.cmd-empty { padding: 28px; text-align: center; color: var(--text-3); font-size: 13px; }
.cmd-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 11px; color: var(--text-3); }
.cmd-foot kbd { margin-right: 3px; }

/* ---------------------------------------------------------------- avisos (toasts) */
.fx-toast {
  display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 12px 16px; border-radius: 14px;
  font-size: 12.5px; font-weight: 600; color: var(--text);
  background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px); animation: fxPop .25s ease-out;
}
.fx-toast i { font-size: 16px; }
.fx-toast-success { box-shadow: var(--shadow-lg), inset 3px 0 0 #10b981; } .fx-toast-success i { color: #10b981; }
.fx-toast-error { box-shadow: var(--shadow-lg), inset 3px 0 0 #f43f5e; } .fx-toast-error i { color: #f43f5e; }
.fx-toast-info { box-shadow: var(--shadow-lg), inset 3px 0 0 var(--accent); } .fx-toast-info i { color: var(--accent); }

/* =====================================================================
   Re-estilização dos componentes existentes (Tailwind) — fora da folha
   ===================================================================== */
/* superfícies */
.bg-white:not(#printable-proposal-sheet, #printable-proposal-sheet *),
.bg-fiori-card:not(#printable-proposal-sheet *) { background-color: var(--surface); }
:is(.bg-slate-50, .bg-gray-50, .bg-fiori-kpiBg, .bg-fiori-bg, .bg-slate-50\/50, .bg-slate-50\/60, .bg-slate-50\/70, .bg-slate-50\/80):not(#printable-proposal-sheet, #printable-proposal-sheet *) { background-color: var(--surface-2); }
:is(.bg-slate-100, .bg-gray-100, .bg-slate-100\/70, .bg-slate-200\/60):not(#printable-proposal-sheet, #printable-proposal-sheet *) { background-color: var(--surface-3); }
.bg-slate-200:not(#printable-proposal-sheet, #printable-proposal-sheet *) { background-color: var(--line-2); }

/* cartões: cantos, sombra e vidro */
:is(.rounded-lg):not(#printable-proposal-sheet *):not(#printable-proposal-sheet) { border-radius: 16px; }
:is(.rounded-md):not(#printable-proposal-sheet *) { border-radius: 11px; }
:is(.rounded):not(#printable-proposal-sheet *) { border-radius: 9px; }
:is(.rounded-xl):not(#printable-proposal-sheet *) { border-radius: 20px; }
.rounded-t:not(#printable-proposal-sheet *) { border-radius: 10px 10px 0 0; }
:is(.shadow-sm, .shadow, .shadow-xs, .shadow-md):not(#printable-proposal-sheet, #printable-proposal-sheet *) { box-shadow: var(--shadow); }

/* linhas e divisores */
:is(.border-slate-100, .border-slate-200, .border-fiori-border, .border-gray-200, .border-gray-100):not(#printable-proposal-sheet, #printable-proposal-sheet *) { border-color: var(--line); }
:is(.border-slate-300, .border-gray-300):not(#printable-proposal-sheet, #printable-proposal-sheet *) { border-color: var(--line-2); }
:is(.divide-slate-100, .divide-slate-200, .divide-gray-100, .divide-gray-200):not(#printable-proposal-sheet *) > :not([hidden]) ~ :not([hidden]) { border-color: var(--line); }

/* texto */
:is(.text-slate-900, .text-slate-800, .text-gray-900, .text-gray-800, .text-fiori-textPrimary, .text-fiori-shell):not(#printable-proposal-sheet, #printable-proposal-sheet *) { color: var(--text); }
:is(.text-slate-700, .text-slate-600, .text-gray-700, .text-gray-600):not(#printable-proposal-sheet, #printable-proposal-sheet *) { color: var(--text-2); }
:is(.text-slate-500, .text-gray-500, .text-fiori-textSecondary):not(#printable-proposal-sheet, #printable-proposal-sheet *) { color: var(--text-3); }
:is(.text-slate-400, .text-gray-400):not(#printable-proposal-sheet, #printable-proposal-sheet *) { color: var(--text-4); }
main h1 { letter-spacing: -0.02em; }

/* hover */
:is(.hover\:bg-slate-50, .hover\:bg-slate-100, .hover\:bg-gray-50, .hover\:bg-gray-100, .hover\:bg-white):hover:not(#printable-proposal-sheet *) { background-color: var(--hover); }
.hover\:bg-slate-200:hover:not(#printable-proposal-sheet *) { background-color: var(--line-2); }
:is(.hover\:text-slate-900, .hover\:text-slate-800):hover:not(#printable-proposal-sheet *) { color: var(--text); }

/* botões principais */
.bg-fiori-accent:not(#printable-proposal-sheet *) {
  background-image: linear-gradient(135deg, #ff8a3d, #F26522 55%, #dc4f10);
  box-shadow: 0 8px 22px -10px rgba(242, 101, 34, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.bg-fiori-shell:not(#printable-proposal-sheet *):not(#auth-overlay) {
  background-image: var(--btn-dark);
  box-shadow: 0 8px 20px -10px rgba(11, 37, 69, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
html[data-theme="dark"] .bg-fiori-shell:not(#printable-proposal-sheet *):not(#auth-overlay) { box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
:is(.bg-emerald-600, .bg-blue-600, .bg-rose-600, .bg-amber-600, .bg-slate-800):not(#printable-proposal-sheet *) { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16); }
html[data-theme="dark"] .bg-slate-800:not(#printable-proposal-sheet *) { background-color: #1e293b; box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2); }
button:not(:disabled) { transition: filter .15s, background-color .15s, color .15s, border-color .15s, box-shadow .2s, transform .1s; }
button:not(:disabled):active { transform: scale(.985); }

/* campos de formulário */
:is(input, select, textarea):not([type=checkbox], [type=radio], [type=range], [type=file], [type=color]):not(#printable-proposal-sheet *) {
  background-color: var(--field);
  color: var(--text);
  border-color: var(--field-line);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
:is(input, select, textarea):not([type=checkbox], [type=radio], [type=range], [type=file], [type=color]):not(#printable-proposal-sheet *):focus {
  outline: none;
  border-color: rgba(242, 101, 34, 0.75);
  box-shadow: 0 0 0 4px rgba(242, 101, 34, 0.16);
}
input[readonly]:not(#printable-proposal-sheet *) { background-color: var(--surface-3); }
input::placeholder, textarea::placeholder { color: var(--text-4); opacity: 1; }
select option { background: var(--surface-solid); color: var(--text); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }

/* tabelas */
main table thead tr:not(#printable-proposal-sheet *) { color: var(--text-3); }
main table thead th { letter-spacing: .06em; }
main table tbody tr { transition: background-color .12s; }

/* separadores do editor de proposta */
.cpq-tab-active {
  color: var(--text) !important;
  background: linear-gradient(180deg, rgba(242, 101, 34, 0.16), rgba(242, 101, 34, 0.02)) !important;
  border-bottom: 2px solid var(--accent) !important;
  box-shadow: 0 8px 18px -12px rgba(242, 101, 34, 0.9);
}

/* janelas (modais) */
[id^="modal-"]:is(.fixed) { backdrop-filter: blur(6px); }
[id^="modal-"] .bg-white:not(#printable-proposal-sheet *) { background-color: var(--surface-solid); }
[id^="modal-"] > div { box-shadow: var(--shadow-lg); }

/* ecrã de entrada */
#auth-overlay {
  background:
    radial-gradient(800px 500px at 85% 0%, rgba(242, 101, 34, 0.30), transparent 60%),
    radial-gradient(700px 600px at 0% 100%, rgba(34, 211, 238, 0.16), transparent 60%),
    linear-gradient(160deg, #0b1d3a, #040913) !important;
}
#auth-overlay::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 50% 40%, #000, transparent 70%);
}
#auth-overlay > div { position: relative; }
#auth-overlay button[type=submit] {
  background-image: linear-gradient(135deg, #ff8a3d, #F26522 55%, #dc4f10) !important;
  box-shadow: 0 12px 30px -10px rgba(242, 101, 34, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
  padding-top: 11px; padding-bottom: 11px;
}
#auth-overlay [id^="auth-panel"] { border: 1px solid var(--line-2); box-shadow: var(--shadow-lg), 0 0 80px -20px rgba(242, 101, 34, 0.45); backdrop-filter: blur(16px); border-radius: 20px; }

/* =====================================================================
   v1.7 — Engenharia futurista: blueprint, HUD
   ===================================================================== */
body::before { /* grelha de desenho técnico: linhas finas + linhas principais a cada 5 */
  background-image:
    linear-gradient(var(--grid-line-strong, rgba(56, 189, 248, 0.07)) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-strong, rgba(56, 189, 248, 0.07)) 1px, transparent 1px),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 220px 220px, 220px 220px, 44px 44px, 44px 44px;
}
:root { --grid-line-strong: rgba(11, 37, 69, 0.07); --cyan: #22d3ee; }
html[data-theme="dark"] { --grid-line-strong: rgba(56, 189, 248, 0.075); }

/* linha de varrimento sob a barra superior */
#app-topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, transparent 30%, rgba(242, 101, 34, .9) 45%, rgba(34, 211, 238, .9) 55%, transparent 70%, transparent 100%);
  background-size: 250% 100%; animation: fxScan 7s linear infinite; opacity: .8;
}
@keyframes fxScan { from { background-position: 150% 0; } to { background-position: -100% 0; } }

/* relógio do sistema */
.tb-clock { display: none; align-items: center; gap: 8px; padding: 0 12px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font: 600 12px "JetBrains Mono", monospace; color: var(--text-2); white-space: nowrap; }
.tb-clock-d { color: var(--text-4); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; }
.tb-clock-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 10px #34d399; animation: fxPulse 2s infinite; }
@media (min-width: 1280px) { .tb-clock { display: inline-flex; } }

/* menu lateral: traçado de circuito subtil */
#app-sidebar::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' fill='none' stroke='%2338bdf8' stroke-opacity='.10' stroke-width='1'%3E%3Cpath d='M10 0v30h40l10 10v40h50l10-10V0M0 120h30l10 10v30M160 100h-40l-10 10v50M70 160v-30l10-10h20'/%3E%3Ccircle cx='60' cy='80' r='2.5'/%3E%3Ccircle cx='120' cy='60' r='2.5'/%3E%3Ccircle cx='40' cy='130' r='2.5'/%3E%3Ccircle cx='110' cy='110' r='2.5'/%3E%3C/svg%3E");
  mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 75%, transparent 100%);
}
#app-sidebar > * { position: relative; }
/* indicadores com moldura HUD (cantos técnicos) */
.fx-hud { position: relative; overflow: visible !important; transition: transform .2s, box-shadow .25s, border-color .25s; }
.fx-hud::before, .fx-hud::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; transition: all .25s;
  border-color: rgba(242, 101, 34, .75);
}
.fx-hud::before { top: -1px; left: -1px; border-top: 2px solid; border-left: 2px solid; border-top-left-radius: 16px; }
.fx-hud::after { bottom: -1px; right: -1px; border-bottom: 2px solid; border-right: 2px solid; border-bottom-right-radius: 16px; border-color: rgba(34, 211, 238, .7); }
.fx-hud:hover { transform: translateY(-2px); box-shadow: var(--shadow), 0 0 0 1px rgba(242, 101, 34, .25), 0 18px 40px -18px rgba(242, 101, 34, .45); }
.fx-hud:hover::before, .fx-hud:hover::after { width: 26px; height: 26px; }
.fx-panel { position: relative; }
.fx-panel::before { content: ""; position: absolute; left: 24px; right: 24px; top: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(34, 211, 238, .55), rgba(242, 101, 34, .55), transparent); pointer-events: none; }
main h1 i { filter: drop-shadow(0 0 8px currentColor); }

/* =====================================================================
   Impressão / PDF: só a folha da proposta, em papel branco
   ===================================================================== */
@media print {
  html, body { background: #fff !important; color-scheme: light !important; }
  #app-shell, #app-main, main { background: transparent !important; }
  #app-main > main > section, #printable-proposal-sheet, #printable-proposal-sheet * { animation: none !important; opacity: 1 !important; }
  .doc-watermark, .doc-watermark * { opacity: 1 !important; }
  body::before, .fx-bg-orbs, #app-sidebar, #app-topbar, #sidebar-backdrop, #cmd-palette, #sap-toast-container { display: none !important; }
}

/* =====================================================================
   Ecrã de arranque: robô a pensar (5 s)
   ===================================================================== */
#boot-splash {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background:
    radial-gradient(700px 500px at 80% 10%, rgba(242, 101, 34, .22), transparent 60%),
    radial-gradient(700px 600px at 10% 100%, rgba(34, 211, 238, .14), transparent 60%),
    linear-gradient(160deg, #0b1d3a, #040913);
  transition: opacity .6s ease, transform .6s ease, filter .6s ease;
}
#boot-splash.bs-done { opacity: 0; transform: scale(1.04); filter: blur(4px); pointer-events: none; }
.bs-grid { position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(56, 189, 248, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(56, 189, 248, .08) 1px, transparent 1px),
    linear-gradient(rgba(148, 163, 184, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, .05) 1px, transparent 1px);
  background-size: 220px 220px, 220px 220px, 44px 44px, 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 45%, #000 0%, transparent 70%);
  animation: bsGrid 5s linear both; }
@keyframes bsGrid { from { background-position: 0 0, 0 0, 0 0, 0 0; } to { background-position: 0 44px, 0 0, 0 44px, 0 0; } }
.bs-stage { position: relative; display: flex; flex-direction: column; align-items: center; padding: 16px; width: min(460px, 100%); animation: bsIn .8s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes bsIn { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
.bs-robot { width: min(360px, 80vw); height: auto; overflow: visible; }

/* robô a flutuar e cabeça a inclinar (pensativo) */
.bs-bot { animation: bsFloat 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes bsFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.bs-shadow { animation: bsShadow 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes bsShadow { 0%, 100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(.86); opacity: .6; } }
.bs-head { transform-box: fill-box; transform-origin: 50% 90%; animation: bsTilt 3.2s ease-in-out infinite; }
@keyframes bsTilt { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(4deg); } }
.bs-arm { transform-box: fill-box; transform-origin: 0% 90%; animation: bsTap 1.6s ease-in-out infinite; }
@keyframes bsTap { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-4deg); } }

/* olhos: olham para cima (a pensar) e piscam */
.bs-eyes { animation: bsLook 2.4s ease-in-out infinite; }
@keyframes bsLook { 0%, 30% { transform: translate(0, 0); } 45%, 75% { transform: translate(6px, -5px); } 90%, 100% { transform: translate(-4px, -3px); } }
.bs-eye { transform-box: fill-box; transform-origin: center; animation: bsBlink 3s infinite; }
@keyframes bsBlink { 0%, 44%, 50%, 100% { transform: scaleY(1); } 47% { transform: scaleY(.1); } }
.bs-mouth rect { fill: #22d3ee; transform-box: fill-box; transform-origin: center; animation: bsEq .9s ease-in-out infinite; }
.bs-mouth rect:nth-child(2) { animation-delay: .15s; } .bs-mouth rect:nth-child(3) { animation-delay: .3s; }
.bs-mouth rect:nth-child(4) { animation-delay: .45s; } .bs-mouth rect:nth-child(5) { animation-delay: .6s; }
@keyframes bsEq { 0%, 100% { transform: scaleY(.5); opacity: .6; } 50% { transform: scaleY(1.2); opacity: 1; } }

/* antena e LEDs */
.bs-bulb { animation: bsBulb 1.2s ease-in-out infinite; }
.bs-bulb-halo { transform-box: fill-box; transform-origin: center; animation: bsHalo 1.2s ease-in-out infinite; }
@keyframes bsBulb { 50% { fill: #ffd2b0; } }
@keyframes bsHalo { 0%, 100% { transform: scale(.8); opacity: .6; } 50% { transform: scale(1.4); opacity: 1; } }
.bs-led { animation: bsLed 1.4s infinite; } .bs-led.l2 { animation-delay: .3s; } .bs-led.l3 { animation-delay: .6s; }
@keyframes bsLed { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* balões de pensamento e engrenagens */
.bs-dot, .bs-cloud path { fill: rgba(232, 238, 248, .92); }
.bs-dot { transform-box: fill-box; transform-origin: center; opacity: 0; animation: bsPop 5s ease-out both; }
.bs-dot.d1 { animation-delay: .5s; } .bs-dot.d2 { animation-delay: .8s; }
.bs-cloud { transform-box: fill-box; transform-origin: 0% 100%; opacity: 0; animation: bsPop 5s ease-out 1.1s both, bsBob 2.2s ease-in-out 1.6s infinite; }
@keyframes bsPop { 0% { opacity: 0; transform: scale(.2); } 8% { opacity: 1; transform: scale(1.08); } 12%, 100% { opacity: 1; transform: scale(1); } }
@keyframes bsBob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }
.bs-gear-teeth { fill: none; stroke: #0b2545; stroke-width: 5; stroke-dasharray: 3.2 2.6; }
.bs-gear-hub { fill: #F26522; }
.bs-gear > * { transform-box: fill-box; transform-origin: center; }
.bs-gear.g1 > * { animation: bsSpin 2.4s linear infinite; }
.bs-gear.g2 > * { animation: bsSpin 1.7s linear infinite reverse; }
@keyframes bsSpin { to { transform: rotate(360deg); } }

/* marca, estado e barra de progresso */
.bs-brand { margin-top: 10px; font-weight: 900; font-size: 30px; letter-spacing: .04em; color: #fff; }
.bs-brand span { color: #F26522; }
/* logotipo da empresa por baixo do robô (placa branca: o logotipo tem letras escuras) */
.bs-logo { margin-top: 8px; padding: 12px 20px; border-radius: 16px; background: #fff; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .08);
  opacity: 0; animation: bsLogo .9s cubic-bezier(.2, .8, .2, 1) .35s forwards; }
.bs-logo img { display: block; width: min(300px, 70vw); height: auto; }
@keyframes bsLogo { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
.bs-sub { margin-top: 2px; font: 600 10.5px "JetBrains Mono", monospace; letter-spacing: .24em; text-transform: uppercase; color: #6f819b; text-align: center; }
.bs-status { margin-top: 26px; width: 100%; display: flex; justify-content: space-between; gap: 12px; font: 600 12px "JetBrains Mono", monospace; color: #b9c6d8; }
#bs-pct { color: #ff8a3d; }
.bs-bar { margin-top: 8px; width: 100%; height: 6px; border-radius: 999px; background: rgba(148, 163, 184, .15); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .12); }
.bs-bar > div { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #F26522, #ff8a3d 45%, #22d3ee); box-shadow: 0 0 14px rgba(242, 101, 34, .8); animation: bsFill 5s cubic-bezier(.45, .05, .35, 1) forwards; }
@keyframes bsFill { to { width: 100%; } }
@media print { #boot-splash { display: none !important; } }

/* =====================================================================
   Permissões: utilizador normal (não administrador)
   Sem registos, sem exportações, sem custos por item nem valor da hora.
   ===================================================================== */
html.role-user .adm,
html.role-user:not(.has-compras):not(.has-financeiro):not(.has-estoque) .cost-col,
html.role-user #btn-cpq-tab-finance,
html.role-user #cpq-tab-finance { display: none !important; }
@media (min-width: 640px) { html.role-user #cpq-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* =====================================================================
   v1.10 — aprovação de margem, notificações e marca d'água
   ===================================================================== */
.appr-banner { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: 14px; font-size: 12.5px; line-height: 1.5; border: 1px solid; }
.appr-banner > i { font-size: 18px; margin-top: 1px; }
.appr-banner.hidden { display: none; }
.appr-warn { background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .45); color: var(--text); }
.appr-warn > i { color: #f59e0b; }
.appr-pending { background: rgba(59, 130, 246, .12); border-color: rgba(59, 130, 246, .45); color: var(--text); }
.appr-pending > i { color: #3b82f6; }
.appr-ok-banner { background: rgba(16, 185, 129, .12); border-color: rgba(16, 185, 129, .45); color: var(--text); }
.appr-ok-banner > i { color: #10b981; }
.appr-rejected { background: rgba(244, 63, 94, .12); border-color: rgba(244, 63, 94, .45); color: var(--text); }
.appr-rejected > i { color: #f43f5e; }
.appr-btn { margin-left: 6px; padding: 4px 12px; border-radius: 8px; font-weight: 700; font-size: 11.5px; color: #fff; background: linear-gradient(135deg, #ff8a3d, #F26522); }
.appr-btn.appr-ok { background: linear-gradient(135deg, #34d399, #059669); }
.appr-btn.appr-no { background: linear-gradient(135deg, #fb7185, #e11d48); }

.tb-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font: 700 10px/18px "JetBrains Mono", monospace; text-align: center; color: #fff; background: linear-gradient(135deg, #fb7185, #e11d48); box-shadow: 0 0 10px rgba(244, 63, 94, .6); }
.tb-badge.hidden { display: none; }
#notif-btn { position: relative; }
.notif-item { display: flex !important; align-items: flex-start; gap: 10px; text-align: left; white-space: normal; line-height: 1.4; }
.notif-item i { margin-top: 2px; }
.notif-unread { background: rgba(242, 101, 34, .08); font-weight: 600; }

/* marca d'água na folha da proposta */
@media screen { #printable-proposal-sheet { position: relative; } } /* na impressão a folha fica no início da página */
.doc-watermark { position: absolute; inset: 0; z-index: 5; pointer-events: none; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.doc-watermark.hidden { display: none !important; }
.doc-watermark span { transform: rotate(-30deg); font: 900 clamp(54px, 10vw, 120px)/1 Inter, sans-serif; letter-spacing: .12em; color: rgba(220, 38, 38, .14); border: 8px solid rgba(220, 38, 38, .14); padding: 6px 28px; border-radius: 18px; }
.doc-watermark small { transform: rotate(-30deg); margin-top: 18px; font: 800 18px/1 Inter, sans-serif; letter-spacing: .2em; text-transform: uppercase; color: rgba(220, 38, 38, .32); }
@media print {
  .doc-watermark { position: fixed; inset: 0; }
  .doc-watermark span { font-size: 130px; color: rgba(220, 38, 38, .13) !important; border-color: rgba(220, 38, 38, .13) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-watermark small { color: rgba(220, 38, 38, .3) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* =====================================================================
   v1.13 — menu por módulos e acessos por utilizador
   ===================================================================== */
.sb-group { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; }
.sb-group:hover { color: #93a6c2; }
.sb-group-caret { font-size: 8px; transition: transform .2s; opacity: .7; }
.sb-group.collapsed .sb-group-caret { transform: rotate(-90deg); }
.sb-nav .sb-item.grp-hidden { display: none !important; }
html.sb-collapsed .sb-nav .sb-item.grp-hidden { display: flex !important; }
html:not(.has-comercial) .m-comercial,
html:not(.has-compras) .m-compras,
html:not(.has-logistica) .m-logistica,
html:not(.has-faturacao) .m-faturacao,
html:not(.has-financeiro) .m-financeiro,
html:not(.has-operacoes) .m-operacoes,
html:not(.has-financas) .m-financas,
html:not(.has-comercial) .sb-nav .m-comercial,
html:not(.has-operacoes) .sb-nav .m-operacoes,
html:not(.has-financas) .sb-nav .m-financas { display: none !important; }

/* páginas dos novos módulos */
.erp-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--fx-border, #e2e8f0); }
.erp-tab { padding: 8px 14px; font-size: 12px; font-weight: 700; border-radius: 10px 10px 0 0; color: #64748b; }
.erp-tab:hover { color: #0f172a; }
.erp-tab.active { color: #F26522; box-shadow: inset 0 -2px 0 #F26522; }
.erp-pill { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.erp-table th { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: #64748b; text-align: left; padding: 8px; }
.erp-table td { padding: 8px; border-top: 1px solid rgba(148,163,184,.18); vertical-align: top; }
.erp-table tr:hover td { background: rgba(148,163,184,.06); }
/* v1.14 — seletor de área no menu lateral */
.sb-area { position: relative; margin: 4px 10px 6px; }
.sb-area-cap { font-size: 9px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: #5d6f88; padding: 0 4px 4px; }
.sb-area-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; font-size: 14px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, rgba(242,101,34,.28), rgba(30,75,143,.35)); border: 1px solid rgba(242,101,34,.45); box-shadow: 0 4px 18px rgba(242,101,34,.15); }
.sb-area-btn:hover { border-color: #F26522; }
.sb-area-btn > i:first-child { color: #ff9a5c; width: 18px; text-align: center; }
.sb-area-caret { margin-left: auto; font-size: 10px; opacity: .8; }
.sb-area-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60; background: #0d1626; border: 1px solid rgba(148,163,184,.25); border-radius: 12px; padding: 6px; box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.sb-area-list button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; font-size: 13px; font-weight: 700; color: #c8d3e3; text-align: left; }
.sb-area-list button i { width: 18px; text-align: center; color: #8ea2bf; }
.sb-area-list button:hover { background: rgba(148,163,184,.12); color: #fff; }
.sb-area-list button.active { background: rgba(242,101,34,.18); color: #fff; }
.sb-area-list button.active i { color: #ff9a5c; }
html.sb-collapsed .sb-area { margin: 4px 6px; }
html.sb-collapsed .sb-area-btn { justify-content: center; padding: 10px 0; }
html.sb-collapsed .sb-area-list { left: 0; right: auto; width: 210px; }
html[data-theme="light"] .sb-area-list { background: #fff; }
html[data-theme="light"] .sb-area-list button { color: #334155; }
.erp-steps { display: flex; gap: 4px; flex-wrap: wrap; }
.erp-step { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(148,163,184,.15); color: #94a3b8; white-space: nowrap; }
.erp-step.done { background: rgba(16,185,129,.16); color: #059669; }
.erp-step.now { background: rgba(242,101,34,.18); color: #ea580c; }
.sb-area-list.hidden { display: none !important; }
.sb-area-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* v1.15 — submenus no menu lateral */
.sb-item.sb-sub { font-weight: 700; }
.sb-item.sb-sub .sb-sub-caret { margin-left: auto; font-size: 9px; opacity: .6; }
.sb-item.sb-sub.sb-sub-active { color: #fff; }
.sb-children { margin: 2px 0 6px 18px; padding-left: 8px; border-left: 1px solid rgba(148,163,184,.22); }
.sb-item.sb-child { padding: 7px 10px; font-size: 12.5px; font-weight: 600; border-radius: 10px; }
.sb-item.sb-child i { font-size: 11px; width: 14px; }
html.sb-collapsed .sb-children { margin-left: 0; padding-left: 0; border-left: 0; }
@keyframes fxSlideIn { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
/* =====================================================================
   v1.16 — VISUAL LIMPO: menos efeitos, mais espaço e hierarquia clara
   (mantém as cores da marca e o modo escuro/claro)
   ===================================================================== */
/* fundo liso: sem grelha, sem bolas de luz, sem traçados de circuito */
body::before, .fx-bg-orbs, #app-sidebar::before, #app-sidebar::after, #app-topbar::after, .fx-panel::before { display: none !important; content: none !important; }
.fx-hud::before, .fx-hud::after { display: none !important; }
.fx-hud:hover { transform: none !important; box-shadow: none !important; }
.tb-clock { display: none !important; }
.sb-item.active::before { box-shadow: none; }
/* cartões: borda fina, sombra quase nula */
main .shadow, main .shadow-sm, main .shadow-xs, main .shadow-md { box-shadow: 0 1px 2px rgba(2, 6, 23, .08) !important; }
/* títulos pequenos em maiúsculas: menos espaçados (lêem-se melhor) */
main [class*="tracking-wider"], main [class*="tracking-wide"] { letter-spacing: .03em !important; }
main table thead th { letter-spacing: .02em; }

/* botões: um primário (laranja) e os restantes discretos */
.btn-primary, .btn-soft { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 7px 12px; border-radius: 9px; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn-primary { background: var(--accent, #F26522); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-soft { border: 1px solid var(--line, rgba(148,163,184,.3)); background: transparent; color: var(--text-2, #475569); }
.btn-soft:hover { border-color: var(--accent, #F26522); color: var(--text, #0f172a); }

/* cabeçalho da proposta: número + cliente à esquerda, totais em linha à direita */
.cpq-stats { gap: 0; }
.cpq-stat { padding: 2px 18px; border-left: 1px solid var(--line, rgba(148,163,184,.25)); }
.cpq-stat:first-child { border-left: 0; }
.cpq-stat-l { font-size: 11px; font-weight: 600; color: var(--text-3, #64748b); }
.cpq-stat-v { font: 700 15px/1.3 "JetBrains Mono", ui-monospace, monospace; color: var(--text, #0f172a); white-space: nowrap; }
.cpq-stat-main { font-size: 20px; color: var(--accent, #F26522); }
/* separadores da proposta: texto simples, o ativo sublinhado */
.cpq-tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 12px 12px 10px; color: var(--text-3, #64748b); border-bottom: 2px solid transparent; white-space: nowrap; background: transparent !important; border-radius: 0 !important; }
.cpq-tabs button i { font-size: 12px; opacity: .8; }
.cpq-tabs button:hover { color: var(--text, #0f172a); }
.cpq-tabs button.cpq-tab-active { color: var(--text, #0f172a) !important; border-bottom-color: var(--accent, #F26522); background: transparent !important; box-shadow: none !important; }
.cpq-tabs button.cpq-tab-active i { color: var(--accent, #F26522); opacity: 1; }
.cpq-tab-count { font: 700 10px/1 "JetBrains Mono", monospace; padding: 2px 6px; border-radius: 999px; background: rgba(148,163,184,.18); color: var(--text-2, #475569); }
/* barra de ações do documento */
.doc-actions { padding: 2px 0 6px; border-bottom: 1px solid var(--line, rgba(148,163,184,.25)); }
/* lista de materiais: o nº de linha não acrescenta nada */
#cpq-tab-bom table th:nth-child(2), #bom-table-body td:nth-child(2) { display: none; }/* menu lateral mais limpo */
.sb-brand-sub { display: none !important; }
#sb-nav > .sb-group:first-child { display: none; }            /* o nome da área já está no seletor */
.sb-cta { padding: 9px 12px !important; font-size: 13px !important; box-shadow: none !important; }
.sb-area { margin-bottom: 10px; }
.btn-soft.hidden, .btn-primary.hidden { display: none !important; }
/* pipeline: colunas neutras, a cor fica só no ponto e no título */
#pipeline-kanban-container > div { background: rgba(148, 163, 184, .06) !important; border-color: var(--line, rgba(148,163,184,.2)) !important; }
#pipeline-kanban-container > div > div:first-child { border-bottom-color: var(--line, rgba(148,163,184,.2)) !important; }
/* =====================================================================
   v1.16.4 — LETRAS MAIS LEGÍVEIS
   Segoe UI é a letra do Windows (muito nítida no ecrã); nos tablets usa a Inter.
   Os números deixam de usar letra de "código" e ficam alinhados (tabular).
   ===================================================================== */
body, button, input, select, textarea, body :not(i):not([class*="fa-"]):not(#printable-proposal-sheet *) {
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, Roboto, Arial, sans-serif !important;
}
body { font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.font-mono, .cpq-stat-v, .cpq-tab-count, .sb-badge, .erp-pill { font-variant-numeric: tabular-nums; letter-spacing: 0 !important; }

/* tamanhos mínimos (fora do documento da proposta, que tem o seu próprio formato A4) */
body .text-\[9px\]:not(#printable-proposal-sheet *)  { font-size: 11px !important; }
body .text-\[10px\]:not(#printable-proposal-sheet *) { font-size: 11.5px !important; }
body .text-\[11px\]:not(#printable-proposal-sheet *) { font-size: 12.5px !important; }
body .text-xs:not(#printable-proposal-sheet *)       { font-size: 13px !important; line-height: 1.45 !important; }
body .text-sm:not(#printable-proposal-sheet *)       { font-size: 14.5px !important; }
.sb-item { font-size: 14px; }
.sb-item.sb-child { font-size: 13.5px; }
.erp-table th, main table thead th { font-size: 11.5px !important; }
.cpq-stat-l { font-size: 12px; }
.cpq-stat-v { font-size: 16px; font-weight: 700; }
.cpq-stat-main { font-size: 22px; }

/* textos cinzentos com mais contraste (eram difíceis de ler no fundo escuro) */
html[data-theme="dark"] .text-slate-400:not(#printable-proposal-sheet *) { color: #a3b1c6 !important; }
html[data-theme="dark"] .text-slate-500:not(#printable-proposal-sheet *) { color: #b3c0d3 !important; }
html[data-theme="dark"] .text-slate-600:not(#printable-proposal-sheet *) { color: #c6d1e0 !important; }
html:not([data-theme="dark"]) .text-slate-400:not(#printable-proposal-sheet *) { color: #64748b !important; }
html:not([data-theme="dark"]) .text-slate-500:not(#printable-proposal-sheet *) { color: #526075 !important; }
/* ===== v1.17 — Fase 2 comercial: oportunidades, agenda, modelos, revisões ===== */
.cpq-mini { display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:999px; border:1px solid #e2e8f0; background:#fff; font-size:12px; font-weight:600; color:#475569; line-height:1.5; }
.cpq-mini:hover { border-color:#F26522; color:#c2410c; }
.cpq-mini i { font-size:11px; opacity:.8; }
html[data-theme="dark"] .cpq-mini { background:#111827; border-color:#334155; color:#cbd5e1; }
.opp-col.opp-drop { outline:2px dashed #F26522; outline-offset:-2px; background:#fff7ed; }
html[data-theme="dark"] .opp-col.opp-drop { background:#2a1a0e; }
.opp-card { transition: border-color .12s, box-shadow .12s; }
.opp-card:active { cursor:grabbing; }

/* v1.19 — mapa de clientes (Leaflet): o estilo base das imagens não pode afetar os quadrados do mapa */
.leaflet-container img.leaflet-tile { max-width: none !important; max-height: none !important; width: 256px; height: 256px; }
.leaflet-container { font: inherit; background: #e5e7eb; }
html[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.85) contrast(1.05); }

/* ===== v1.20 — Sistema simples: separadores de família, cartões de relatórios, proposta em passos, botão Criar ===== */
.hub-tabs, .hub-back { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.hub-tab { display:inline-flex; align-items:center; gap:7px; padding:8px 14px; border-radius:999px; border:1px solid #e2e8f0; background:#fff; color:#475569; font-size:13.5px; font-weight:600; }
.hub-tab i { font-size:12px; opacity:.75; }
.hub-tab:hover { border-color:#F26522; color:#c2410c; }
.hub-tab.active { background:#F26522; border-color:#F26522; color:#fff; }
.hub-tab.active i { opacity:1; }
.hub-badge { min-width:18px; height:18px; padding:0 5px; border-radius:999px; background:#ef4444; color:#fff; font-size:10.5px; font-weight:700; display:inline-flex; align-items:center; justify-content:center; }
.hub-select { padding:8px 12px; border-radius:999px; border:1px solid #e2e8f0; background:#fff; font-size:13.5px; font-weight:600; color:#334155; }
html[data-theme="dark"] .hub-tab, html[data-theme="dark"] .hub-select { background:#111827; border-color:#334155; color:#cbd5e1; }
html[data-theme="dark"] .hub-tab.active { background:#F26522; border-color:#F26522; color:#fff; }

.report-card { display:flex; align-items:flex-start; gap:12px; text-align:left; padding:16px; border-radius:12px; border:1px solid #e2e8f0; background:#fff; transition:border-color .12s, box-shadow .12s, transform .12s; }
.report-card > i { width:38px; height:38px; flex:none; border-radius:10px; background:#fff1e8; color:#F26522; display:flex; align-items:center; justify-content:center; font-size:16px; }
.report-card:hover { border-color:#F26522; box-shadow:0 4px 14px rgba(242,101,34,.12); transform:translateY(-1px); }
html[data-theme="dark"] .report-card { background:#0f172a; border-color:#1f2937; }
html[data-theme="dark"] .report-card > i { background:#2a1a0e; }

.fx-menu-sep { height:1px; margin:4px 6px; background:rgba(148,163,184,.25); }
.create-menu button { display:flex !important; align-items:flex-start; gap:10px; text-align:left; padding:9px 12px !important; }
.create-menu button > i { margin-top:3px; width:16px; color:#F26522; }

/* proposta em passos: os separadores passam a ser passos numerados */
.cpq-tabs.cpq-steps { counter-reset: step; gap:2px; }
.cpq-tabs.cpq-steps > button { position:relative; margin-left:0 !important; }
.cpq-tabs.cpq-steps > button > i:first-child { display:none; }
.cpq-tabs.cpq-steps > button::before { content: attr(data-step); display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:999px; border:2px solid #cbd5e1; color:#64748b; font-size:11px; font-weight:800; margin-right:2px; flex:none; }
.cpq-tabs.cpq-steps > button.cpq-tab-active::before { background:#F26522; border-color:#F26522; color:#fff; }
.cpq-tabs.cpq-steps > button.step-done::before { content:'✓'; background:#10b981; border-color:#10b981; color:#fff; }
.cpq-wizard-nav { position:sticky; bottom:0; z-index:20; display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:16px; padding:12px 16px; border-radius:12px; border:1px solid #e2e8f0; background:rgba(255,255,255,.96); backdrop-filter:blur(6px); box-shadow:0 -4px 16px rgba(15,23,42,.06); }
html[data-theme="dark"] .cpq-wizard-nav { background:rgba(15,23,42,.96); border-color:#1f2937; }
.wiz-progress { text-align:center; flex:1; min-width:0; }
.wiz-dots { display:flex; justify-content:center; gap:5px; margin-top:5px; }
.wiz-dots span { width:22px; height:5px; border-radius:99px; background:#e2e8f0; }
.wiz-dots span.done { background:#10b981; }
.wiz-dots span.cur { background:#F26522; }
html[data-theme="dark"] .wiz-dots span { background:#334155; }
@media (max-width: 640px) { .cpq-wizard-nav { flex-wrap:wrap; } .wiz-progress { order:-1; flex-basis:100%; } }
.sb-cta { display:flex; align-items:center; }

/* ===== v1.21 — LEITURA FÁCIL: menos negrito, sem MAIÚSCULAS, mais espaço, menos caixas ===== */
/* (o documento da proposta para o cliente não é tocado) */
body :is(.uppercase):not(#printable-proposal-sheet *) { text-transform: none !important; }
body :is(.tracking-wider, .tracking-wide, .tracking-widest, .tracking-tight):not(#printable-proposal-sheet *) { letter-spacing: 0 !important; }
body :is(.font-extrabold, .font-black):not(#printable-proposal-sheet *) { font-weight: 700 !important; }
body td.font-bold:not(#printable-proposal-sheet *), body td .font-bold:not(#printable-proposal-sheet *) { font-weight: 600 !important; }
/* rótulos pequenos (ex.: "Em aberto", "Custo"): cinzento calmo, peso normal */
body .text-\[10px\].font-bold:not(#printable-proposal-sheet *), body .text-\[11px\].font-semibold.text-slate-500:not(#printable-proposal-sheet *) { font-weight: 500 !important; }
/* subtítulo do topo cortado a meio: retirado (o título chega) */
#topbar-subtitle { display: none !important; }
/* cabeçalhos das tabelas: normais, sem maiúsculas */
.erp-table th, table thead th { text-transform: none !important; letter-spacing: 0 !important; font-weight: 600 !important; }
/* mais ar entre blocos e dentro dos cartões */
main > section > .space-y-4 > * + *, main > section.space-y-4 > * + * { margin-top: 1.1rem !important; }
.rounded-lg.border.border-fiori-border.p-3 { padding: 1rem !important; }
.rounded-lg.border.border-fiori-border.p-4 { padding: 1.15rem !important; }
/* cartões: cantos mais suaves, borda clara, sombra quase invisível */
html:not([data-theme="dark"]) .border-fiori-border { border-color: #e5e9f0 !important; }
html:not([data-theme="dark"]) main .shadow-sm, html:not([data-theme="dark"]) main .shadow-xs { box-shadow: 0 1px 2px rgba(15, 23, 42, .04) !important; }
main .rounded-lg { border-radius: 12px; }
/* fundo da página um pouco mais claro e texto mais escuro (contraste) */
html:not([data-theme="dark"]) body { background: #f6f8fb; }
html:not([data-theme="dark"]) .text-slate-500 { color: #5b6779 !important; }
html:not([data-theme="dark"]) .text-slate-400 { color: #7b8698 !important; }
/* menu lateral: um pouco mais de margem à esquerda */
.sb-nav { padding: 0 10px !important; }
.sb-item { border-radius: 10px; }
#com-myday, #com-reports { display: flex; flex-direction: column; gap: 1.1rem; }
#com-myday > *, #com-reports > * { margin-top: 0 !important; }
/* só um ecrã está visível de cada vez: sem margem extra herdada dos ecrãs escondidos */
main.space-y-6 > section { margin-top: 0 !important; }
main.space-y-6 > #hub-tabs { margin-top: 0 !important; margin-bottom: 1.1rem; }
/* passo "Cliente": sem caixas dentro de caixas; condições e assinatura em secções que abrem */
#cpq-tab-client .p-4.bg-slate-50.rounded-lg.border { background: transparent !important; border: 0 !important; padding: 0 !important; }
#cpq-tab-client label { font-size: 13px !important; font-weight: 500 !important; color: #475569; }
html[data-theme="dark"] #cpq-tab-client label { color: #b3c0d3; }
#cpq-tab-client input, #cpq-tab-client select { font-size: 14px !important; border-radius: 8px !important; padding-top: 9px !important; padding-bottom: 9px !important; }
.cpq-fold { border: 1px solid #e5e9f0; border-radius: 12px; background: #fff; }
html[data-theme="dark"] .cpq-fold { background: #0f172a; border-color: #1f2937; }
.cpq-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; font-size: 14px; }
.cpq-fold > summary::-webkit-details-marker { display: none; }
.cpq-fold > summary::after { content: '\f078'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 11px; color: #94a3b8; margin-left: auto; margin-top: 4px; transition: transform .15s; }
.cpq-fold[open] > summary::after { transform: rotate(180deg); }
.cpq-fold > summary > i { margin-top: 3px; }
.cpq-fold > summary b { display: block; font-weight: 600; color: #1e293b; }
html[data-theme="dark"] .cpq-fold > summary b { color: #e2e8f0; }
.cpq-fold-sub { display: block; font-size: 12.5px; color: #64748b; margin-top: 1px; }
.cpq-fold-body { padding: 4px 16px 16px; }
#cpq-tab-client .space-y-5 > * + * { margin-top: 1rem !important; }
/* vendedor da proposta: o administrador vê só a lista para escolher; sem texto de ajuda comprido */
html:not(.role-user) #prop-seller-display { display: none !important; }
#prop-seller-select + span { display: none !important; }
/* etiquetas de estado sempre numa linha; título do topo não fica cortado pela pesquisa */
.erp-pill, span.rounded-full.text-\[10px\], #cpq-status-badge { white-space: nowrap; }
#app-topbar .tb-title { flex: 0 0 auto; max-width: 40%; }
#app-topbar .tb-title #topbar-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#app-topbar .tb-search { min-width: 0; flex: 1 1 auto; }
/* botões só para utilizadores normais (ex.: "Pedir cliente novo"); o administrador tem os seus */
html:not(.role-user) .user-only { display: none !important; }

/* ===================================================================== v1.24 — ajuda "?" e visita guiada */
#help-drawer { position: fixed; inset: 0; z-index: 95; }
#help-drawer .help-back { position: absolute; inset: 0; background: rgba(2, 6, 23, 0.35); }
#help-drawer .help-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); display: flex; flex-direction: column;
  background: var(--surface-solid); color: var(--text-2); border-left: 1px solid var(--line-2); box-shadow: var(--shadow-lg); animation: helpIn .2s ease-out; }
@keyframes helpIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
#help-drawer .help-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px; color: var(--text); }
#help-drawer .help-head i { color: var(--accent); }
#help-drawer .help-head button { width: 36px; height: 36px; border-radius: 10px; color: var(--text-3); }
#help-drawer .help-head button:hover { background: var(--hover); color: var(--text); }
#help-drawer .help-body { padding: 18px; overflow-y: auto; font-size: 14px; line-height: 1.55; }
#help-drawer h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
#help-drawer .help-cap { margin: 18px 0 8px; font-size: 12px; font-weight: 700; color: var(--text-3); }
#help-drawer ol { list-style: decimal; padding-left: 20px; }
#help-drawer ol li { margin: 6px 0; }
#help-drawer .help-general li { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
#help-drawer .help-general li:first-child { border-top: 0; }
#help-drawer .help-general i { width: 20px; text-align: center; color: var(--accent); margin-top: 4px; }
#help-drawer .help-general b { display: block; color: var(--text); font-weight: 600; }
#help-drawer .help-general span { font-size: 13px; color: var(--text-3); }
#help-drawer .help-foot { margin-top: 14px; font-size: 12px; color: var(--text-4); text-align: center; }

#tour-layer { position: fixed; inset: 0; z-index: 97; }
#tour-layer .tour-hole { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0.6); outline: 2px solid var(--accent); transition: all .25s ease; pointer-events: none; }
#tour-layer .tour-card { position: fixed; width: 340px; max-width: calc(100vw - 24px); padding: 16px 18px; border-radius: 16px;
  background: var(--surface-solid); color: var(--text-2); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); transition: left .25s, top .25s; font-size: 14px; line-height: 1.5; }
#tour-layer .tour-step { font-size: 12px; color: var(--text-4); font-weight: 600; }
#tour-layer h4 { font-size: 17px; font-weight: 700; color: var(--text); margin: 2px 0 6px; }
#tour-layer .tour-btns { display: flex; align-items: center; gap: 8px; margin-top: 14px; }

/* ===================================================================== v1.24 — tablet e telemóvel */
@media (max-width: 1023px) {
  /* menu lateral: ocupa no máximo 85% do ecrã e não passa por baixo da barra de cima */
  #app-sidebar { z-index: 60; width: min(290px, 85vw) !important; height: 100dvh; overflow-y: auto; }
  main { padding-left: 16px !important; padding-right: 16px !important; }
  /* tabelas largas deslizam para o lado em vez de esmagar o texto */
  main .overflow-x-auto, main .table-wrap { -webkit-overflow-scrolling: touch; }
  main section table { min-width: 560px; }
  main section .overflow-hidden:has(> table), main section div:has(> table:only-child) { overflow-x: auto; }
}
@media (max-width: 767px) {
  #app-topbar { height: 58px; gap: 6px; padding: 0 10px; }
  #app-topbar .tb-title { max-width: none; flex: 1 1 auto; }
  #topbar-title { font-size: 16px; }
  .tb-actions { gap: 5px; }
  .tb-icon { width: 38px; height: 38px; border-radius: 10px; }
  .tb-search { flex: 0 0 38px !important; height: 38px; margin-left: 0; }
  /* menos ícones no telemóvel: o tema muda-se no menu da conta; as cópias de segurança no computador */
  #app-topbar .tb-actions > button[onclick="toggleTheme()"], #app-topbar .tb-actions > .relative:has(> button[onclick="toggleBackupMenu()"]) { display: none; }
  #topbar-save span { display: none; }
  #topbar-save { padding: 0 12px; }
  /* menus suspensos não saem do ecrã */
  #notif-dropdown { position: fixed !important; top: 64px !important; left: 10px !important; right: 10px !important; width: auto !important; }
  .fx-menu { max-width: calc(100vw - 20px); }
  /* janelas (modais) a ocupar o ecrã todo, com os botões sempre à vista */
  .fixed.inset-0.flex.items-center.justify-center { padding: 0 !important; align-items: stretch !important; }
  .fixed.inset-0.flex.items-center.justify-center > div:first-child:not(.help-back) { max-width: 100% !important; width: 100% !important; max-height: 100dvh !important; height: 100dvh; border-radius: 0 !important; }
  .fixed.inset-0 .grid.grid-cols-2:not(.keep-2) { grid-template-columns: 1fr !important; }
  .fixed.inset-0 .grid.grid-cols-2 > .col-span-2 { grid-column: auto !important; }
  /* campos com letra de 16px: o telemóvel não faz zoom ao escrever */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px !important; }
  /* botões fáceis de tocar */
  .btn-soft, .btn-primary { min-height: 40px; }
  /* quadro de oportunidades: colunas deslizam para o lado */
  .opp-col { min-width: 78vw !important; scroll-snap-align: start; }
  *:has(> .opp-col) { overflow-x: auto; scroll-snap-type: x mandatory; }
  /* cartões de resumo em 2 colunas em vez de 4 */
  main .grid.grid-cols-4, main .grid.lg\:grid-cols-4, main .grid.md\:grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #hub-tabs { overflow-x: auto; flex-wrap: nowrap !important; white-space: nowrap; }
}

/* ===================================================================== v1.27 — guia de utilização (onboarding) */
#guide-modal { position: fixed; inset: 0; z-index: 94; display: flex; align-items: center; justify-content: center; padding: 16px; }
#guide-modal .gd-back { position: absolute; inset: 0; background: rgba(2, 6, 23, .55); }
#guide-modal .gd-win { position: relative; width: min(1080px, 100%); height: min(760px, 100%); display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface-solid); color: var(--text-2); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow-lg); }
#guide-modal .gd-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 16px; color: var(--text); }
#guide-modal .gd-top i.fa-book-open { color: var(--accent); margin-right: 6px; }
#guide-modal .gd-top span { font-weight: 500; font-size: 13px; color: var(--text-3); }
#guide-modal .gd-top button { width: 36px; height: 36px; border-radius: 10px; color: var(--text-3); }
#guide-modal .gd-top button:hover { background: var(--hover); color: var(--text); }
#guide-modal .gd-main { flex: 1; display: grid; grid-template-columns: 260px 1fr; min-height: 0; }
#guide-modal .gd-nav { border-right: 1px solid var(--line); padding: 12px; overflow-y: auto; background: var(--surface-2); }
#guide-modal .gd-nav button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px; text-align: left; font-size: 13.5px; color: var(--text-2); }
#guide-modal .gd-nav button i:first-child { width: 18px; text-align: center; color: var(--text-3); }
#guide-modal .gd-nav button:hover { background: var(--hover); }
#guide-modal .gd-nav button.active { background: rgba(242, 101, 34, .12); color: var(--text); font-weight: 600; }
#guide-modal .gd-nav button.active i:first-child { color: var(--accent); }
#guide-modal .gd-nav .gd-ok { margin-left: auto; color: #10b981; font-size: 12px; }
#guide-modal .gd-progress { padding: 4px 6px 12px; }
#guide-modal .gd-progress-txt { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
#guide-modal .gd-bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
#guide-modal .gd-bar > div { height: 100%; background: linear-gradient(90deg, #F26522, #10b981); border-radius: inherit; transition: width .3s; }
#guide-modal .gd-body { overflow-y: auto; padding: 22px 26px; font-size: 14.5px; line-height: 1.55; }
.gd-head { display: flex; gap: 14px; align-items: flex-start; }
.gd-head > i { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border-radius: 12px; background: rgba(242, 101, 34, .12); color: var(--accent); font-size: 18px; }
.gd-head h2 { font-size: 20px; font-weight: 700; color: var(--text); margin: 0; }
.gd-head p { color: var(--text-3); margin-top: 2px; }
.gd-theme h3 { font-size: 13px; font-weight: 700; color: var(--text-3); margin: 20px 0 8px; }
.gd-steps { list-style: decimal; padding-left: 22px; }
.gd-steps li { margin: 6px 0; padding-left: 4px; }
.gd-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 6px; }
.gd-do, .gd-dont { border-radius: 14px; padding: 4px 16px 12px; }
.gd-do { background: #ecfdf5; border: 1px solid #a7f3d0; } .gd-do h3 { color: #047857 !important; }
.gd-dont { background: #fff1f2; border: 1px solid #fecdd3; } .gd-dont h3 { color: #be123c !important; }
html[data-theme="dark"] .gd-do { background: rgba(16, 185, 129, .08); border-color: rgba(16, 185, 129, .3); }
html[data-theme="dark"] .gd-dont { background: rgba(244, 63, 94, .08); border-color: rgba(244, 63, 94, .3); }
.gd-do ul, .gd-dont ul { padding-left: 18px; list-style: disc; } .gd-do li, .gd-dont li { margin: 6px 0; }
.gd-foot { display: flex; align-items: center; gap: 10px; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.gd-read { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.gd-read input { width: 18px; height: 18px; accent-color: #10b981; }
/* cartão no Início */
.gd-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; cursor: pointer; background: linear-gradient(135deg, rgba(242, 101, 34, .10), rgba(34, 211, 238, .08)); border: 1px solid rgba(242, 101, 34, .3); }
.gd-card > i { font-size: 22px; color: var(--accent); }
.gd-card > div { flex: 1; } .gd-card b { display: block; color: var(--text); font-weight: 700; } .gd-card span { font-size: 13px; color: var(--text-3); }
@media (max-width: 767px) {
  #guide-modal { padding: 0; } #guide-modal .gd-win { border-radius: 0; height: 100dvh; }
  #guide-modal .gd-main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #guide-modal .gd-nav { display: flex; gap: 6px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  #guide-modal .gd-nav button { width: auto; flex-shrink: 0; white-space: nowrap; }
  #guide-modal .gd-progress { display: none; }
  #guide-modal .gd-body { padding: 16px; } .gd-cols { grid-template-columns: 1fr; }
  #guide-modal .gd-top span { display: none; }
}
/* impressão do guia: só a folha do guia */
#guide-print { display: none; }
@media print {
  html.printing-guide body > *:not(#guide-print) { display: none !important; }
  html.printing-guide #guide-print, html.printing-guide #guide-print * { visibility: visible !important; }
  html.printing-guide #guide-print { display: block !important; font: 12.5px/1.5 Inter, "Segoe UI", Arial, sans-serif; color: #0b1730; padding: 0 6mm; }
  #guide-print .gp-logo { height: 46px; } #guide-print h1 { font-size: 20px; margin: 8px 0 2px; } #guide-print h2 { font-size: 16px; margin: 0; }
  #guide-print h3 { font-size: 12px; margin: 10px 0 4px; color: #475569; } #guide-print .gp-why { color: #64748b; margin: 0; }
  #guide-print .gp-t { break-inside: avoid; border-top: 2px solid #F26522; padding-top: 10px; margin-top: 16px; }
  #guide-print ol, #guide-print ul { padding-left: 18px; margin: 0; } #guide-print ol { list-style: decimal; } #guide-print ul { list-style: disc; } #guide-print li { margin: 2px 0; }
  #guide-print .gp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  #guide-print .gp-do { background: #ecfdf5 !important; border: 1px solid #a7f3d0; border-radius: 8px; padding: 4px 10px 8px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #guide-print .gp-dont { background: #fff1f2 !important; border: 1px solid #fecdd3; border-radius: 8px; padding: 4px 10px 8px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #guide-print .gp-do h3 { color: #047857; } #guide-print .gp-dont h3 { color: #be123c; }
}

/* ===================================================================== v1.28 — filtros e características dos materiais */
.mat-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
#catalog-filters .mat-filters { background: var(--surface-solid); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
#picker-spec-filters .mat-filters { padding-top: 2px; }
.mat-f { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--text-3); font-weight: 600; }
.mat-f select { font-size: 12px; font-weight: 500; padding: 5px 8px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: var(--text); min-width: 110px; max-width: 200px; }
.mat-f.on select { border-color: #F26522; box-shadow: 0 0 0 2px rgba(242, 101, 34, .15); background: #fff7ed; }
html[data-theme="dark"] .mat-f select { background: var(--field); border-color: var(--field-line); }
html[data-theme="dark"] .mat-f.on select { background: rgba(242, 101, 34, .12); }
.mat-clear { align-self: flex-end; font-size: 12px; font-weight: 600; color: #be123c; padding: 5px 10px; border-radius: 8px; }
.mat-clear:hover { background: #fff1f2; }
.spec-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.spec-chips span { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: #eef2ff; color: #3730a3; white-space: nowrap; }
html[data-theme="dark"] .spec-chips span { background: rgba(99, 102, 241, .18); color: #c7d2fe; }
.mat-specs { border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 10px; }
.mat-specs > summary { cursor: pointer; font-weight: 700; color: #334155; }
.mat-specs > summary span { font-weight: 400; color: #94a3b8; }
@media (max-width: 767px) { .mat-f { flex: 1 1 45%; } .mat-f select { max-width: none; width: 100%; } }

/* ===================================================================== v1.30 — proposta de serviço (laudo técnico) */
.cpq-kind { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin-bottom: 10px; }
.cpq-kind-label { align-self: center; font-size: 12px; font-weight: 700; color: var(--text-3); margin-right: 4px; }
.cpq-kind button { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 12px; border: 1.5px solid #e2e8f0; background: #fff; text-align: left; color: #334155; transition: all .15s; }
.cpq-kind button i { font-size: 18px; color: #94a3b8; }
.cpq-kind button b { display: block; font-size: 13px; } .cpq-kind button small { display: block; font-size: 11px; color: #64748b; }
.cpq-kind button:hover { border-color: #fdba74; }
.cpq-kind button.on { border-color: #F26522; background: #fff7ed; box-shadow: 0 0 0 3px rgba(242, 101, 34, .12); }
.cpq-kind button.on i { color: #F26522; }
html[data-theme="dark"] .cpq-kind button { background: var(--surface-solid); border-color: var(--line-2); color: var(--text-2); }
html[data-theme="dark"] .cpq-kind button.on { background: rgba(242, 101, 34, .12); }
#module-cpq:not(.cpq-servico) #laudo-block, #module-cpq:not(.cpq-servico) #doc-laudo-scope { display: none; }
#module-cpq.cpq-servico #btn-cpq-tab-bom, #module-cpq.cpq-servico #btn-cpq-tab-memorial,
#module-cpq.cpq-servico .labor-eng-block, #module-cpq.cpq-servico .doc-product-memo, #module-cpq.cpq-servico .doc-items-editor-card,
#module-cpq.cpq-servico #doc-generic-materials-summary { display: none !important; }
#laudo-block { margin-bottom: 12px; }
.laudo-table th { font-size: 10px; text-transform: none; font-weight: 600; color: #64748b; text-align: left; padding: 4px 4px; }
.laudo-table td { padding: 3px 4px; vertical-align: middle; }
.laudo-doc-list { list-style: decimal; padding-left: 18px; margin-top: 2px; columns: 2; column-gap: 24px; }
.laudo-doc-list li { break-inside: avoid; margin: 1px 0; }
@media (max-width: 767px) { .cpq-kind button { flex: 1 1 100%; } .laudo-doc-list { columns: 1; } }

/* v1.30.1 — condições finais: as do laudo só nos laudos, as dos quadros só nos produtos */
#module-cpq:not(.cpq-servico) #doc-laudo-terms { display: none; }
#module-cpq.cpq-servico .doc-product-terms { display: none !important; }
