/* Gestão 360 — estilos
   Paleta: navy da marca para a navegação, superfície fria e clara para o trabalho,
   verde como cor de ação. Âmbar = prazo próximo, vermelho = atrasado. */

:root {
  --navy-900: #0E0827;
  --navy-800: #151638;
  --navy-700: #1B2141;
  --navy-600: #27364D;
  --green-600: #3F7F74;
  --green-500: #599B90;
  --green-300: #A7C7BE;
  --green-100: #E6F0ED;
  --amber: #A36F12;
  --amber-bg: #FBF1DC;
  --red: #B5483B;
  --red-bg: #FBE9E6;

  --bg: #F3F5F7;
  --surface: #FFFFFF;
  --surface-2: #F8FAFB;
  --line: #DDE3E8;
  --line-strong: #C5CED6;
  --ink: #1A1A1A;
  --ink-2: #47515E;
  --ink-3: #6A7482;
  --accent: var(--green-600);
  --accent-ink: #FFFFFF;
  --focus: #2F6FDB;

  --radius-s: 6px;
  --radius-m: 10px;
  --shadow-pop: 0 12px 32px rgba(14, 8, 39, .18);
  --font: "Montserrat", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 232px;
  --nav-active: rgba(89,155,144,.22);
  --nav-bar: var(--green-500);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #10122A; --surface: #171A36; --surface-2: #1C2040; --line: #2B3157; --line-strong: #3B4270;
    --ink: #EEF1F6; --ink-2: #C3C9D6; --ink-3: #97A0B3; --accent: #6BA396; --accent-ink: #0E0827;
    --green-100: #1F3A3A; --amber: #E3B25B; --amber-bg: #3A2F17; --red: #EF8C80; --red-bg: #43211F;
    --focus: #8AB4FF;
  }
}
:root[data-theme="dark"] {
  --bg: #10122A; --surface: #171A36; --surface-2: #1C2040; --line: #2B3157; --line-strong: #3B4270;
  --ink: #EEF1F6; --ink-2: #C3C9D6; --ink-3: #97A0B3; --accent: #6BA396; --accent-ink: #0E0827;
  --green-100: #1F3A3A; --amber: #E3B25B; --amber-bg: #3A2F17; --red: #EF8C80; --red-bg: #43211F;
  --focus: #8AB4FF;
}


/* ---------- Temas de cor (escolhidos no menu do utilizador) ----------
   Três pastel (fundo suave, navegação escura da mesma família) e três fortes (contraste alto).
   Cada tema redefine só os tokens: navegação, cor de ação, fundo e faixas de grupo. */
:root[data-theme="lavanda"] {
  --navy-800: #3B2F5C; --navy-700: #463A6B; --navy-600: #5A4C82; --green-600: #6E52AE; --green-500: #8C74C6; --green-300: #C9BCE6; --green-100: #EFE9F8;
  --bg: #F6F3FB; --surface-2: #FAF8FD; --line: #E3DCF0; --line-strong: #CFC4E3; --accent: #6E52AE; --nav-active: rgba(140,116,198,.28); --nav-bar: #C9BCE6;
}
:root[data-theme="menta"] {
  --navy-800: #1F4A42; --navy-700: #275A50; --navy-600: #33695E; --green-600: #2E806D; --green-500: #4FA48E; --green-300: #A9DACB; --green-100: #E3F4EE;
  --bg: #F1F8F5; --surface-2: #F7FBF9; --line: #D6E9E1; --line-strong: #BCD8CC; --accent: #2E806D; --nav-active: rgba(169,218,203,.22); --nav-bar: #A9DACB;
}
:root[data-theme="pessego"] {
  --navy-800: #5A3A2E; --navy-700: #6A4637; --navy-600: #7D5644; --green-600: #B25E3B; --green-500: #D08A68; --green-300: #F0C9B4; --green-100: #FCEDE4;
  --bg: #FDF6F1; --surface-2: #FFFAF7; --line: #F0E0D5; --line-strong: #E3CBBB; --accent: #B25E3B; --nav-active: rgba(240,201,180,.22); --nav-bar: #F0C9B4;
}
:root[data-theme="oceano"] {
  --navy-800: #0B2545; --navy-700: #13315C; --navy-600: #1D4170; --green-600: #1366D6; --green-500: #3D86EA; --green-300: #9CC3F5; --green-100: #DFEBFB;
  --bg: #EDF3FA; --surface-2: #F6F9FD; --line: #D3E0EF; --line-strong: #B5C9E2; --accent: #1366D6; --nav-active: rgba(61,134,234,.3); --nav-bar: #3D86EA;
}
:root[data-theme="coral"] {
  --navy-800: #2B1B2E; --navy-700: #3A2440; --navy-600: #4E3156; --green-600: #D1373D; --green-500: #EC5A5F; --green-300: #F7AFB1; --green-100: #FFE4E3;
  --bg: #FFF5F4; --surface-2: #FFFAFA; --line: #F2DEDD; --line-strong: #E6C4C3; --accent: #D1373D; --nav-active: rgba(236,90,95,.3); --nav-bar: #EC5A5F;
}
:root[data-theme="tangerina"] {
  --navy-800: #1E1E24; --navy-700: #2A2A33; --navy-600: #3A3A46; --green-600: #C2570C; --green-500: #F2711C; --green-300: #F9BE8F; --green-100: #FEEBDC;
  --bg: #FBF7F3; --surface-2: #FDFBF8; --line: #EDE3DA; --line-strong: #DDCDBF; --accent: #C2570C; --nav-active: rgba(242,113,28,.28); --nav-bar: #F2711C;
}
.theme-pick { max-width: 190px; min-height: 32px; padding: 4px 8px; font-size: 13px; border-radius: 8px; }
.theme-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); vertical-align: middle; margin-right: 6px; box-shadow: 0 0 0 2px var(--surface); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 600; }
a { color: var(--accent); }
p { margin: 0 0 8px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: 8px; top: -40px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { top: 8px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Estrutura ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--navy-800); color: #D9DEEA; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 12px 12px; z-index: 30; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: #fff; font-weight: 700; font-size: 16px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--navy-600), var(--green-500)); display: grid; place-items: center; }
/* O menu ocupa o espaço disponível e rola se o ecrã for baixo; o rodapé (utilizador, versão) fica sempre visível. */
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px;
  color: #C9CFDD; text-decoration: none; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a[aria-current="page"] { background: var(--nav-active); color: #fff; box-shadow: inset 3px 0 0 var(--nav-bar); }
.nav .sub { padding-left: 42px; font-size: 13px; }
.nav-sep { height: 1px; background: rgba(255,255,255,.08); margin: 12px 6px; }
.sidebar-foot { flex: 0 0 auto; font-size: 12px; color: #8F97AE; padding: 10px 10px 2px; border-top: 1px solid rgba(255,255,255,.08); margin-top: 8px; }
@media (max-height: 820px) {
  .brand { padding-bottom: 12px; }
  .nav a { padding: 7px 10px; }
  .demo-flag { padding: 4px 8px; margin-bottom: 6px; }
}
.demo-flag { background: var(--amber-bg); color: var(--amber); border-radius: 6px; padding: 6px 8px; margin-bottom: 8px; font-weight: 600; }

.nav-scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; padding-left: 36px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow-pop); padding: 6px; max-height: 420px; overflow: auto;
}
.search-results a { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.search-results a[aria-selected="true"], .search-results a:hover { background: var(--green-100); }
.search-results .type { font-size: 11px; color: var(--ink-3); min-width: 84px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.bell { position: relative; }
.bell .count { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.popover {
  position: absolute; right: 0; top: calc(100% + 6px); width: 340px; max-width: calc(100vw - 24px); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow-pop); padding: 8px; z-index: 40;
}
.popover h3 { padding: 6px 8px; }
.popover a.item { display: block; padding: 8px; border-radius: 6px; text-decoration: none; color: var(--ink); }
.popover a.item:hover { background: var(--surface-2); }

.content { padding: 24px; max-width: 1400px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.page-head .grow { flex: 1; min-width: 200px; }
.page-head p { margin: 2px 0 0; color: var(--ink-3); }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); }

/* ---------- Controlos ---------- */
button, .btn {
  font: inherit; font-weight: 600; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; line-height: 1.2; white-space: nowrap;
}
button:hover, .btn:hover { border-color: var(--ink-3); }
button:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.07); border-color: var(--accent); }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.btn-danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.icon-btn { padding: 7px; border-color: transparent; background: transparent; }
.icon-btn:hover { background: var(--surface-2); }
.sidebar .icon-btn { color: inherit; }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 8px 10px; width: 100%; min-height: 38px;
}
textarea { min-height: 90px; resize: vertical; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
input[type="color"] { padding: 2px; width: 48px; }
select[multiple] { min-height: 120px; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--red); background: var(--red-bg); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label, .field .label { font-weight: 600; font-size: 13px; color: var(--ink-2); }
.field .req { color: var(--red); }
.field .help { font-size: 12px; color: var(--ink-3); }
.field .error { font-size: 12px; color: var(--red); font-weight: 600; }
.field.check { flex-direction: row; align-items: center; gap: 10px; }
.form-alert { background: var(--red-bg); color: var(--red); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-weight: 600; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar > * { width: auto; }
.toolbar input[type="search"] { min-width: 220px; flex: 1; max-width: 320px; }
.toolbar select { max-width: 200px; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.segmented button { border: 0; border-radius: 0; padding: 7px 12px; background: var(--surface); }
.segmented button + button { border-left: 1px solid var(--line-strong); }
.segmented button[aria-pressed="true"] { background: var(--navy-800); color: #fff; }

/* ---------- Superfícies ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { flex: 1; font-size: 15px; }
.panel-body { padding: 16px; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; } /* conteúdo largo (tabelas) não alarga a coluna nem a página */
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: 2fr 1fr; }
.grid-3.grid-side-wide { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); } /* ficha da empresa: coluna da direita mais larga */
.stack { display: flex; flex-direction: column; gap: 16px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; margin-bottom: 16px; }
.kpi { background: var(--surface); padding: 14px 16px; text-decoration: none; color: var(--ink); display: block; }
a.kpi:hover { background: var(--surface-2); }
.kpi .value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .label { font-size: 13px; color: var(--ink-3); }
.kpi.alert .value { color: var(--red); }

.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; margin: 0; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; overflow-wrap: anywhere; }

/* Etiquetas de estado: ponto de cor + texto (nunca só cor) */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--ink-3)); }
.chip.warn { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.chip.danger { background: var(--red-bg); color: var(--red); border-color: transparent; }
.chip.ok { background: var(--green-100); color: var(--green-600); border-color: transparent; }
:root[data-theme="dark"] .chip.ok { color: var(--green-300); }
.prio { font-size: 12px; font-weight: 600; }
.prio-urgente { color: var(--red); }
.prio-alta { color: var(--amber); }
.prio-media { color: var(--ink-2); }
.prio-baixa { color: var(--ink-3); }

.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--navy-600); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; flex: none; }
.who { display: inline-flex; align-items: center; gap: 8px; }

.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--surface-2); white-space: nowrap; }
table.data th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
table.data th button:focus-visible { outline: 3px solid var(--focus); }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-m); display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.kcol-head { padding: 10px 12px; border-top: 4px solid var(--c, var(--line-strong)); border-radius: var(--radius-m) var(--radius-m) 0 0; display: flex; gap: 8px; align-items: baseline; }
.kcol-head h3 { flex: 1; }
.kcol-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 80px; }
.kcol.drop .kcol-body { background: var(--green-100); border-radius: 0 0 var(--radius-m) var(--radius-m); }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: grab; }
.kcard:hover { border-color: var(--line-strong); }
.kcard.dragging { opacity: .5; }
.kcard .t { font-weight: 600; display: block; color: var(--ink); text-decoration: none; margin-bottom: 4px; }
.kcard .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px; color: var(--ink-3); }
.kcard .move { margin-top: 8px; font-size: 12px; min-height: 30px; padding: 4px 6px; }

/* ---------- Calendário ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head h2 { min-width: 170px; }
.cal-head h2::first-letter, .agenda-day h3::first-letter { text-transform: uppercase; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; background: var(--line); gap: 1px; }
.cal-dow { background: var(--surface-2); padding: 6px 8px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.cal-day { background: var(--surface); min-height: 108px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.out { background: var(--surface-2); }
.cal-day.out .d { color: var(--ink-3); }
.cal-day .d { font-size: 12px; font-weight: 600; }
.cal-day.today .d { background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 0 7px; align-self: flex-start; }
.cal-ev { display: block; font-size: 12px; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); border-left: 3px solid var(--c, var(--accent)); color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.done { text-decoration: line-through; color: var(--ink-3); }
.cal-ev.overdue { background: var(--red-bg); }
.cal-more { font-size: 11px; color: var(--ink-3); }
.agenda { display: none; }
.agenda-day { padding: 10px 0; border-bottom: 1px solid var(--line); }
.agenda-day h3 { margin-bottom: 6px; }
.agenda .cal-ev { white-space: normal; padding: 6px 8px; margin-bottom: 4px; }

/* ---------- Listas, timeline, feed ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list a.title { color: var(--ink); font-weight: 600; text-decoration: none; }
.list a.title:hover { text-decoration: underline; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 28px; }
.timeline li::before { content: ""; position: absolute; left: 9px; top: 22px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .ico { position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--green-100); color: var(--green-600); display: grid; place-items: center; }
.timeline .body { white-space: pre-wrap; color: var(--ink-2); margin-top: 2px; }
.changes { font-size: 12px; color: var(--ink-3); margin: 2px 0 0; padding: 0; list-style: none; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment .body { white-space: pre-wrap; margin-top: 4px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; border-radius: 0; background: transparent; padding: 10px 14px; color: var(--ink-3); border-bottom: 2px solid transparent; font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.stepper { display: flex; gap: 4px; flex-wrap: wrap; }
.stepper button { flex: 1; min-width: 110px; justify-content: center; border-radius: 6px; font-size: 12px; padding: 7px 8px; background: var(--surface-2); }
.stepper button[aria-current="step"] { background: var(--c, var(--accent)); color: #fff; border-color: transparent; }
.stepper button.passed { background: var(--green-100); border-color: transparent; }

.bars .bar-row { display: grid; grid-template-columns: 190px 1fr 110px; gap: 10px; align-items: center; padding: 6px 0; }
.bars .track { height: 12px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bars .track span { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 3px; }

.checklist-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.checklist-item.done span { text-decoration: line-through; color: var(--ink-3); }
.inline-add { display: flex; gap: 8px; margin-top: 8px; }

/* ---------- Estados ---------- */
.state { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.state h2 { margin-bottom: 6px; }
.state p { max-width: 460px; margin: 0 auto 16px; color: var(--ink-3); }
.state .ico { width: 48px; height: 48px; border-radius: 12px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--green-100); color: var(--green-600); }
.state.error .ico { background: var(--red-bg); color: var(--red); }
.skeleton { height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--line) 25%, var(--surface-2) 50%, var(--line) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; margin: 10px 0; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Modais e avisos ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(14, 8, 39, .45); display: grid; place-items: center; padding: 16px; z-index: 60; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-pop); }
.modal.sm { max-width: 440px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { flex: 1; font-size: 17px; }
.modal-body { padding: 20px; }
.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--navy-800); color: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: var(--shadow-pop); max-width: 360px; border-left: 4px solid var(--green-500); }
.toast.error { border-left-color: #EF8C80; }

/* ---------- Autenticação ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(150deg, var(--navy-900), var(--navy-700) 55%, var(--green-600)); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: flex-end; }
.auth-side h1 { font-size: 34px; max-width: 420px; }
.auth-side p { color: #C9CFDD; max-width: 420px; margin-top: 12px; }
.auth-main { display: grid; place-items: center; padding: 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 22px; margin-bottom: 4px; }
.auth-card .stack { gap: 14px; margin-top: 20px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3, .grid-3.grid-side-wide { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-pop); }
  .nav-scrim { display: none; }
  .app.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(14,8,39,.4); z-index: 25; }
  .menu-btn { display: inline-flex; }
  .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 10px 12px; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .cal-grid { display: none; }
  .agenda { display: block; }
  .bars .bar-row { grid-template-columns: 100px 1fr 80px; }
  .toolbar input[type="search"], .toolbar select { max-width: none; flex: 1 1 140px; }
  table.data .hide-sm { display: none; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { border-radius: 12px 12px 0 0; max-height: 92vh; }
  .user-name { display: none; }
}
.btn[aria-pressed="true"] { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
[hidden] { display: none !important; }
@media (min-width: 861px) {
  .app { background: linear-gradient(to right, var(--navy-800) var(--sidebar-w), var(--bg) var(--sidebar-w)); }
}
@media (max-width: 640px) {
  .search { min-width: 0; }
  .theme-btn { display: none; }
  .topbar { gap: 6px; }
}
.stepper button[aria-current="step"]:disabled { opacity: 1; }
.view-row { display: flex; align-items: center; gap: 2px; }
.view-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.kcard:focus-visible { outline: 3px solid var(--focus); }
/* Lista de tarefas estilo Asana */
.tlist { overflow: hidden; }
.trow { display: grid; grid-template-columns: 36px minmax(0, 1fr) 90px 56px 160px 180px; gap: 10px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.trow.thead { font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--surface-2); }
.trow:not(.thead):hover { background: var(--surface-2); }
.trow .tmain { display: flex; flex-direction: column; min-width: 0; }
.trow .tmain .title { color: var(--ink); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .tmain .title:hover { text-decoration: underline; }
.trow.done .tmain .title { text-decoration: line-through; color: var(--ink-3); }
.tgroup-head { display: flex; gap: 12px; align-items: baseline; padding: 12px 14px 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.quick-add { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 22px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.quick-add input { border-color: transparent; background: transparent; min-height: 32px; flex: 1; width: 100%; min-width: 0; }
.quick-add input:focus { border-color: var(--line-strong); background: var(--surface); }
.quick-add select { width: auto; max-width: 260px; min-height: 32px; }
.hours-cell { display: flex; flex-direction: column; gap: 3px; }
.mini-bar { display: block; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; width: 110px; }
.mini-bar span { display: block; height: 100%; }
.hours-summary { display: flex; flex-wrap: wrap; gap: 24px; }
.hours-summary .big { font-size: 22px; font-weight: 700; }
@media (max-width: 640px) {
  .trow { grid-template-columns: 30px minmax(0, 1fr) 110px; }
  .trow .hide-sm { display: none; }

}
/* Financeiro */
.fam-list { list-style: none; margin: 0; padding: 0; }
.fam { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.fam.sub { padding-left: 16px; }
.fam.active { background: var(--green-100); }
.fam .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
table.qlines td { vertical-align: top; }
table.qlines.edit tbody tr { cursor: default; }
table.qlines.edit tbody tr:hover { background: transparent; }
table.qlines .desc-cell { min-width: 260px; display: flex; flex-direction: column; gap: 6px; }
table.qlines .qty { display: flex; gap: 4px; min-width: 170px; }
table.qlines .qty select { width: 92px; }
table.qlines .num-in { width: 90px; text-align: right; }
table.qlines .row-ctrl { white-space: nowrap; width: 1%; }
table.qlines tr.qsec td { background: var(--surface-2); font-weight: 700; }
table.qlines tr.qnote td { font-style: italic; color: var(--ink-2); }
table.qlines tr.qsec input, table.qlines tr.qnote input { font-weight: inherit; font-style: inherit; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 0; }
.totals dd { margin: 0; text-align: right; }
.totals .grand { font-size: 18px; font-weight: 700; padding-top: 8px; border-top: 1px solid var(--line); }
.ts-day { border-bottom: 1px solid var(--line); }
.ts-day-head { display: flex; justify-content: space-between; padding: 10px 16px 4px; text-transform: none; }
.ts-day-head strong::first-letter { text-transform: uppercase; }

/* --- v3: navegação por secções, separadores de módulo, cartões e datas --- */
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 0; }
.nav-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.45); padding: 6px 12px 4px; }
.module-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 16px; overflow-x: auto; }
.module-tabs a { padding: 10px 14px; color: var(--ink-3); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.module-tabs a:hover { color: var(--ink); }
.module-tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.stat-cards .kpi .value { font-size: 24px; }
.kpi-btn { border: 0; text-align: left; font: inherit; cursor: pointer; width: 100%; border-radius: 0; }
.kpi-btn:hover { background: var(--surface-2); }
.stats-slot { min-height: 0; }
input[type="date"], input[type="datetime-local"], input[type="month"], input[type="time"] { cursor: pointer; }
.list-toolbar { display: flex; gap: 6px; margin: 4px 0 6px; flex-wrap: wrap; }
textarea.meeting { min-height: 220px; line-height: 1.5; }
.pre-wrap { white-space: pre-wrap; }
.chk-col { width: 36px; }
.chk-col input { width: 18px; height: 18px; cursor: pointer; }
.bulkbar { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.svc-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 100px 120px 230px; gap: 10px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); }
.svc-row:first-child { border-top: 0; }
.svc-row.closed { opacity: .65; }
.svc-head { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.team-card { padding: 16px; }
.team-card h3 { margin: 0 0 2px; font-size: 16px; }
.team-card dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 12px 0 0; font-size: 14px; }
.team-card dt { color: var(--ink-3); }
.team-card dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.team-card dd.alert { color: var(--red); }
@media (max-width: 700px) { .svc-row { grid-template-columns: minmax(0, 1fr) auto; } .svc-row .hide-sm { display: none; } }
.modal.lg { max-width: 820px; }
.svc-row .num { text-align: right; }
.svc-row > div:last-child { justify-content: flex-end; }

/* --- Pesquisa ao estilo Odoo e alternador de vista só com ícones --- */
.searchrow { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; }
.searchrow-right { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.sbox-wrap { flex: 1 1 420px; min-width: 260px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sbox { position: relative; flex: 1; min-width: 240px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px 4px 3px 10px; min-height: 40px; color: var(--ink-3); }
.sbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(89,155,144,.18); }
.sbox > input { border: 0 !important; box-shadow: none !important; outline: none; flex: 1; min-width: 140px; background: transparent; padding: 6px 4px; color: var(--ink); width: auto; }
.sbox > input::-webkit-search-cancel-button { display: none; }
.facets { display: contents; }
.facet { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 4px 2px 0; font-size: 13px; color: var(--ink); white-space: nowrap; max-width: 100%; }
.facet-k { background: var(--accent); color: #fff; border-radius: 5px 0 0 5px; padding: 2px 6px; font-weight: 600; font-size: 12px; margin-right: 2px; }
.facet.group .facet-k { background: #7a6bb0; }
.facet button { border: 0; background: transparent; padding: 2px; cursor: pointer; color: var(--ink-3); display: inline-flex; border-radius: 4px; }
.facet button:hover { background: var(--line); color: var(--ink); }
.sbox-toggle { border: 0; border-left: 1px solid var(--line); background: transparent; padding: 6px 8px; cursor: pointer; color: var(--ink-2); margin-left: auto; align-self: stretch; display: inline-flex; align-items: center; border-radius: 0 6px 6px 0; }
.sbox-toggle:hover, .sbox-toggle[aria-expanded="true"] { background: var(--surface-2); color: var(--ink); }
.sdrop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 32px rgba(14,8,39,.16), 0 2px 6px rgba(14,8,39,.06); color: var(--ink); animation: sdrop-in .12s ease-out; }
@keyframes sdrop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.suggest { right: 0; padding: 6px; max-height: 340px; overflow: auto; }
.sugg { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 7px; cursor: pointer; font: inherit; font-size: 14px; color: inherit; }
.sugg:hover, .sugg.active { background: var(--surface-2); }
.spanel { right: 0; max-width: 860px; max-height: min(72vh, 620px); overflow: auto; }
.scols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.scol { padding: 14px 10px 10px; }
.scol + .scol { border-left: 1px solid var(--line); }
.scol-h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; padding: 0 8px 8px; color: var(--ink); }
.scol-i { width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.scol-h.f .scol-i { background: rgba(122,107,176,.14); color: #7a6bb0; }
.scol-h.g .scol-i { background: rgba(89,155,144,.16); color: var(--accent); }
.scol-h.o .scol-i { background: rgba(89,155,144,.10); color: var(--accent); }
.scol-h.v .scol-i { background: rgba(192,138,43,.16); color: #c08a2b; }
.scol-h.o { margin-top: 10px; }
.sgroup { padding: 4px 0; }
.sgroup + .sgroup { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; }
.slabel { font-size: 12px; color: var(--ink-3); margin: 0 8px 2px; font-weight: 600; }
.sopt { display: flex; gap: 4px; align-items: center; width: 100%; text-align: left; border: 0; background: transparent; padding: 5px 8px; border-radius: 7px;
  cursor: pointer; font: inherit; color: var(--ink-2); font-size: 14px; line-height: 1.3; }
.sopt:hover { background: var(--surface-2); color: var(--ink); }
.sopt.on { color: var(--accent); font-weight: 600; }
.sopt .tick { width: 16px; flex: none; color: var(--accent); font-weight: 700; display: inline-flex; }
.sopt-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smore { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; padding: 4px 8px 4px 28px; }
.smore:hover { text-decoration: underline; }
.sempty { margin: 2px 8px 6px; font-size: 13px; color: var(--ink-3); }
.fav { display: flex; align-items: center; gap: 2px; border-radius: 7px; }
.fav:hover { background: var(--surface-2); }
.fav .sopt:hover { background: transparent; }
.fav-act { border: 0; background: transparent; cursor: pointer; color: var(--ink-3); padding: 4px 6px; border-radius: 6px; font-size: 15px; line-height: 1; display: inline-flex; opacity: .55; }
.fav:hover .fav-act, .fav-act.on { opacity: 1; }
.fav-act.on { color: #c08a2b; }
.fav-act.del:hover { color: var(--red); }
.ssave { color: var(--ink-2); }
.ssave .tick { color: var(--ink-3); }
.fav-save { display: flex; flex-direction: column; gap: 8px; padding: 6px 8px 4px 28px; }
.fav-save input[type="text"] { width: 100%; }
.fav-def { display: flex !important; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); font-weight: 400; cursor: pointer; }
.fav-def input { width: auto !important; margin: 0; }
.fav-save .btn { align-self: flex-start; }
.spanel-foot { border-top: 1px solid var(--line); padding: 8px 16px; display: flex; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 12px 12px; }
.slink { border: 0; background: transparent; color: var(--ink-3); font: inherit; font-size: 13px; cursor: pointer; padding: 2px 4px; }
.slink:hover { color: var(--ink); text-decoration: underline; }
.vswitch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.vswitch button { border: 0; background: transparent; padding: 8px 10px; cursor: pointer; color: var(--ink-3); display: inline-flex; border-radius: 0; }
.vswitch button + button { border-left: 1px solid var(--line); }
.vswitch button:hover { color: var(--ink); background: var(--surface-2); }
.vswitch button[aria-pressed="true"] { background: var(--accent); color: #fff; }
@media (max-width: 700px) { .searchrow-right { margin-left: 0; } .scols { grid-template-columns: 1fr; } .scol { border-right: 0; border-bottom: 1px solid var(--line); } }

/* --- Grelha de horas --- */
.tsg-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.tsg-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tsg-label { font-size: 15px; margin-left: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 14px; color: var(--ink-2); display: inline-flex; align-items: center; border-radius: 0; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: var(--surface-2); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.tsg-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 12px; background: var(--surface); border: 1px dashed var(--accent); border-radius: 10px; }
.tsg-add select { max-width: 280px; }
.tsg-scroll { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); max-height: calc(100vh - 260px); }
table.tsg { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: max-content; min-width: 100%; font-size: 14px; }
table.tsg col.c-label { width: 320px; }
table.tsg.month col.c-label { width: 280px; }
table.tsg col.c-day { width: 74px; }
table.tsg.month col.c-day { width: 58px; }
table.tsg col.c-total { width: 86px; }
.tsg th, .tsg td { border-bottom: 1px solid var(--line); padding: 0; text-align: center; white-space: nowrap; }
.tsg thead th { position: sticky; top: 0; z-index: 3; background: var(--surface); padding: 8px 4px; font-weight: 600; border-bottom: 2px solid var(--line); }
.tsg thead th .dow { display: block; font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.tsg thead th .dn { display: block; font-size: 16px; }
.tsg .lbl { position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; padding: 8px 12px; border-right: 1px solid var(--line); font-weight: 400; white-space: normal; }
.tsg thead th.lbl { z-index: 4; vertical-align: bottom; font-size: 13px; color: var(--ink-3); }
.tsg .rl { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; line-height: 1.3; }
.tsg .rl .pj { font-weight: 600; color: var(--ink); text-decoration: none; }
.tsg .rl .pj:hover { text-decoration: underline; }
.tsg .rl .sep { color: var(--ink-3); }
.tsg .rl .sv { color: var(--ink-2); }
.tsg .bal { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tsg .bal.pos { color: var(--green-600, #2f7d6d); }
.tsg .bal.neg { color: var(--red); }
.tsg td.cell input { width: 100%; border: 0 !important; background: transparent; text-align: center; padding: 10px 2px; font: inherit; font-variant-numeric: tabular-nums;
  color: var(--ink); border-radius: 0; box-shadow: none !important; min-width: 0; }
.tsg td.cell input::placeholder { color: var(--ink-3); opacity: .45; }
.tsg td.cell input:hover { background: var(--surface-2); }
.tsg td.cell input:focus { background: rgba(89,155,144,.12); outline: 2px solid var(--accent); outline-offset: -2px; }
.tsg td.cell .ro { display: block; padding: 10px 2px; color: var(--ink-3); }
.tsg td.cell.val { box-shadow: inset 0 -2px 0 var(--accent); }
.tsg td.cell.saving input { opacity: .5; }
.tsg td.cell.ok input { background: rgba(89,155,144,.22); transition: background .6s; }
.tsg .we { background: var(--surface-2); }
.tsg .today { background: rgba(89,155,144,.08); }
.tsg thead th.today { color: var(--accent); }
.tsg .num { font-variant-numeric: tabular-nums; padding: 8px 4px; }
.tsg td.tot, .tsg th.tot { font-weight: 700; background: var(--surface-2); border-left: 1px solid var(--line); position: sticky; right: 0; z-index: 1; }
.tsg thead th.tot { z-index: 3; }
.tsg tr.grp th, .tsg tr.grp td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--line); }
.tsg tr.grp th.lbl { display: flex; align-items: center; gap: 8px; }
.tsg tfoot td, .tsg tfoot th { position: sticky; bottom: 0; background: var(--surface); font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; z-index: 2; }
.tsg tfoot th.lbl { z-index: 3; }
.tsg tfoot td.tot { z-index: 3; background: var(--ink); color: var(--surface); }
.tsg tr:hover td.cell:not(.we):not(.today) { background: rgba(89,155,144,.03); }
@media (max-width: 700px) { table.tsg col.c-label { width: 200px; } }
.sfind { margin: 2px 8px 6px; width: calc(100% - 16px) !important; padding: 5px 8px !important; font-size: 13px; min-height: 0; }
.slist { max-height: 240px; overflow: auto; }

/* --- Caixas de seleção agrupadas por equipa --- */
.checkgroup { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.cg-group { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 10px; margin: 0; min-width: 0; background: var(--surface); }
.cg-group legend { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; padding: 0 4px; color: var(--ink); width: auto; }
.cg-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cg-all { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; padding: 0 2px; margin-left: 4px; }
.cg-item { display: flex !important; align-items: center; gap: 8px; padding: 4px 2px; font-weight: 400 !important; font-size: 14px !important; color: var(--ink) !important; cursor: pointer; }
.cg-item input { flex: none; }

/* --- Projetos: cartões-filtro, execução, saldo, quadro --- */
.fcards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)) minmax(240px, 1.6fr); gap: 10px; margin-bottom: 16px; }
.fcard { --t: var(--accent); position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; font: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; color: var(--ink);
  transition: border-color .15s, box-shadow .15s, transform .15s; overflow: hidden; }
.fcard::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--t); opacity: .8; }
.fcard:hover { border-color: var(--t); box-shadow: 0 4px 14px rgba(14,8,39,.08); transform: translateY(-1px); }
.fcard.on { border-color: var(--t); box-shadow: 0 0 0 2px var(--t) inset; background: color-mix(in srgb, var(--t) 7%, var(--surface)); }
.fcard-i { color: var(--t); display: inline-flex; width: 28px; height: 28px; border-radius: 8px; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--t) 13%, transparent); margin-bottom: 4px; }
.fcard-v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.fcard-l { font-size: 13px; color: var(--ink-3); line-height: 1.25; }
.fcard.tone-accent { --t: var(--accent); } .fcard.tone-warn { --t: #C08A2B; } .fcard.tone-danger { --t: var(--red); }
.fcard.tone-ok { --t: #2E8B57; } .fcard.tone-muted { --t: #7d8597; }
.fcard.wide { cursor: default; justify-content: space-between; }
.fcard.wide:hover { transform: none; box-shadow: none; border-color: var(--line); }
.fcard-exec { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 6px; }
.fcard.wide .exec { width: 100%; }
@media (max-width: 1280px) { .fcards { grid-template-columns: repeat(3, minmax(0, 1fr)); } .fcard.wide { grid-column: 1 / -1; } }
@media (max-width: 560px) { .fcards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.exec { display: flex; align-items: center; gap: 8px; min-width: 0; }
.exec-track { flex: 1; height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; min-width: 50px; }
.exec-track span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.exec-track span.warn { background: #C08A2B; } .exec-track span.over { background: var(--red); }
.exec-v { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; color: var(--ink-2); }
.kpi .exec { margin-top: 6px; }
.bal-pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bal-pill.pos { background: rgba(46,139,87,.13); color: #23774a; }
.bal-pill.neg { background: var(--red-bg); color: var(--red); }
.bal-pill.none { background: var(--surface-2); color: var(--ink-3); font-weight: 500; }
:root[data-theme="dark"] .bal-pill.pos { color: #6fd19c; }
.kpi .value .bal-pill { font-size: 20px; padding: 2px 10px; }
.pboard .kcard { padding: 0; border: 0; background: transparent; box-shadow: none; }
.pcard { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 10px 16px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 1px 2px rgba(14,8,39,.04); }
.pcard::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c, var(--accent)); }
.pcard:hover { box-shadow: 0 6px 18px rgba(14,8,39,.1); }
.pcard-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.pcard-t { font-weight: 700; font-size: 15px; color: var(--ink); text-decoration: none; line-height: 1.3; }
.pcard-t:hover { text-decoration: underline; }
.pcard-c { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-3); margin-top: -4px; }
.pcard-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.pcard-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.pcard-status .dot, .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.pcard-hours { background: var(--surface-2); border-radius: 9px; padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; }
.pcard-hl { display: flex; justify-content: space-between; align-items: center; }
.pcard-foot { display: flex; align-items: center; gap: 10px; color: var(--ink-3); }
.pcard-foot .avatar { margin-left: auto; }
.pcard-foot svg { vertical-align: -2px; }
.pcard-flag { font-size: 11.5px; font-weight: 700; color: var(--red); background: var(--red-bg); padding: 1px 6px; border-radius: 99px; }

/* --- Projeto: horas por serviço --- */
.hgroup { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); margin-bottom: 10px; overflow: hidden; }
.hgroup > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto 180px 130px; gap: 14px; align-items: center; padding: 12px 16px; cursor: pointer; list-style: none; }
.hgroup > summary::-webkit-details-marker { display: none; }
.hgroup > summary::before { content: '▸'; position: absolute; margin-left: -12px; color: var(--ink-3); font-size: 11px; transition: transform .15s; }
.hgroup[open] > summary { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.hg-name { font-weight: 700; }
.hg-meta { font-size: 13px; color: var(--ink-3); }
.hg-sum { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
table.data.compact td, table.data.compact th { padding-top: 7px; padding-bottom: 7px; }
@media (max-width: 760px) { .hgroup > summary { grid-template-columns: 1fr auto; } .hg-bar, .hg-meta { display: none; } }

/* --- Raio-X do projeto --- */
.xgrid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .xgrid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .xgrid4 { grid-template-columns: 1fr; } }
.xcard { --t: var(--accent); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.xcard::after { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--t); }
.xcard.tone-ok { --t: #2E8B57; } .xcard.tone-warn { --t: #C08A2B; } .xcard.tone-danger { --t: var(--red); } .xcard.tone-muted { --t: #7d8597; }
.xcard-h { font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.xcard-l { font-size: 13px; color: var(--ink-2); display: flex; flex-direction: column; gap: 2px; }
.ring-wrap { position: relative; width: 112px; height: 112px; align-self: center; }
.ring { width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 9; }
.ring-fg { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.ring-fg.tone-ok { stroke: #2E8B57; } .ring-fg.tone-warn { stroke: #C08A2B; } .ring-fg.tone-danger { stroke: var(--red); } .ring-fg.tone-muted { stroke: #b6bcc8; }
.ring-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring-c strong { font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ring-c span { font-size: 11.5px; color: var(--ink-3); }
.tone-t { font-weight: 700; } .tone-t.ok { color: #23774a; } .tone-t.warn { color: #a26f12; } .tone-t.danger { color: var(--red); } .tone-t.muted { color: var(--ink-3); }
:root[data-theme="dark"] .tone-t.ok { color: #6fd19c; } :root[data-theme="dark"] .tone-t.warn { color: #e2b25a; }
.pace { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 4px; flex: 1; justify-content: center; }
.pace-row { display: grid; grid-template-columns: 112px 1fr 42px; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.pace-row b { text-align: right; font-variant-numeric: tabular-nums; }
.pace-track { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.pace-track span { display: block; height: 100%; border-radius: 99px; }
.pace-track .time { background: #7d8597; } .pace-track .tasks { background: #7A6BB0; }
.pace-track .hours.tone-ok, .bullet-real.tone-ok { background: #2E8B57; } .pace-track .hours.tone-warn, .bullet-real.tone-warn { background: #C08A2B; }
.pace-track .hours.tone-danger, .bullet-real.tone-danger { background: var(--red); } .pace-track .hours.tone-muted, .bullet-real.tone-muted { background: var(--accent); }
.bullets { display: flex; flex-direction: column; gap: 12px; }
.bullet-h { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; margin-bottom: 4px; }
.bullet-n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bullet-v { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.bullet-track { position: relative; height: 14px; }
.bullet-plan { position: absolute; left: 0; top: 0; bottom: 0; background: var(--line); border-radius: 4px; }
.bullet-real { position: absolute; left: 0; top: 4px; bottom: 4px; border-radius: 4px; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.legend i { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-left: 6px; }
.lg-plan { background: var(--line); } .lg-real { background: #2E8B57; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding-top: 18px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; gap: 4px; }
.col-bar { width: 100%; max-width: 34px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 3px; }
.col:hover .col-bar { background: var(--ink); }
.col-v { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.col-l { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; max-width: 100%; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 70px; gap: 10px; align-items: center; font-size: 13.5px; }
.hbar-t { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.hbar-t span { display: block; height: 100%; background: #7A6BB0; border-radius: 99px; }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; }
.stack-bar { display: flex; height: 16px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--surface); }
.stack-bar span { display: block; height: 100%; }
.stack-legend { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; }
.stack-legend li { display: flex; align-items: center; gap: 6px; }
.stack-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.stack-legend b { margin-left: 2px; }
.types { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.xfin { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface)); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.xfin-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.xtile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.xtile > span:first-child { font-size: 12.5px; color: var(--ink-3); }
.xtile strong { font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.xtile.pos strong { color: #23774a; } .xtile.neg strong { color: var(--red); }
:root[data-theme="dark"] .xtile.pos strong { color: #6fd19c; }

/* --- Painel inicial --- */
.home { display: flex; flex-direction: column; gap: 28px; }
.hsec { display: flex; flex-direction: column; gap: 14px; }
.hsec-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.hsec-h h2 { margin: 0; font-size: 19px; }
.htiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1000px) { .htiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.htile { --t: var(--accent); display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; color: var(--ink); position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.htile:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(14,8,39,.08); border-color: var(--t); }
.htile strong { font-size: 26px; letter-spacing: -.02em; line-height: 1.1; }
.htile span:last-child { font-size: 13px; color: var(--ink-3); }
.htile-i { color: var(--t); width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: color-mix(in srgb, var(--t) 13%, transparent); margin-bottom: 4px; }
.htile.tone-danger { --t: var(--red); } .htile.tone-danger strong { color: var(--red); }
.htile.tone-ok { --t: #2E8B57; } .htile.tone-muted { --t: #7d8597; } .htile.tone-warn { --t: #C08A2B; }
.tgroup-h { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.tgroup-h span { background: var(--surface-2); border-radius: 99px; padding: 0 8px; font-size: 12px; }
.tgroup-h.tone-danger { color: var(--red); } .tgroup-h.tone-warn { color: #a26f12; } .tgroup-h.tone-accent { color: var(--accent); }
.mytasks .list li.done-row .title { text-decoration: line-through; color: var(--ink-3); }
.hours-card .hc-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.hours-card .hc-top strong { font-size: 28px; letter-spacing: -.02em; }
.hc-delta { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.hc-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 14px; height: 120px; }
.hc-day { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.hc-bar { flex: 1; width: 100%; max-width: 30px; background: var(--surface-2); border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.hc-bar span { display: block; width: 100%; background: var(--accent); border-radius: 6px 6px 0 0; }
.hc-day.we .hc-bar span { background: #7d8597; }
.hc-day.today .hc-l { color: var(--accent); font-weight: 700; }
.hc-v { font-size: 11px; color: var(--ink-2); min-height: 14px; font-variant-numeric: tabular-nums; }
.hc-l { font-size: 11.5px; color: var(--ink-3); }
.hc-foot { margin-top: 12px; }
.myprojects { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; padding: 4px 0; }
.mp { display: flex; flex-direction: column; gap: 6px; padding: 12px 12px 12px 15px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); position: relative; background: var(--surface); }
.mp::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c, var(--accent)); }
.mp:hover { box-shadow: 0 6px 16px rgba(14,8,39,.08); }
.mp-h { display: flex; justify-content: space-between; gap: 6px; align-items: flex-start; }
.mp-badge { font-size: 11px; font-weight: 700; background: var(--surface-2); padding: 1px 6px; border-radius: 99px; color: var(--ink-2); }
.mp-f { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.teamrows { display: flex; flex-direction: column; }
.trow2 { display: grid; grid-template-columns: 32px minmax(110px, 1.2fr) minmax(110px, 1.4fr) 70px 96px; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.trow2:last-child { border-bottom: 0; }
.trow2 .avatar { color: #fff; }
.tr-n { display: flex; flex-direction: column; min-width: 0; }
.tr-n strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-h { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 700px) { .trow2 { grid-template-columns: 32px 1fr auto; } .tr-h, .tr-t { display: none; } }
.attention .reasons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ftiles { display: grid; grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .ftiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ftile.hero { grid-column: 1 / -1; } }
.ftile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.ftile strong { font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ftile.hero { background: linear-gradient(135deg, #1F2A44, #2c4a5e); color: #fff; border: 0; }
.ftile.hero strong { font-size: 30px; }
.ftile.hero .ftile-l, .ftile.hero .ftile-s { color: rgba(255,255,255,.75); }
.ftile-l { font-size: 12.5px; color: var(--ink-3); }
.ftile-s { font-size: 12.5px; color: var(--ink-3); display: flex; flex-direction: column; gap: 2px; }
.delta { font-weight: 700; } .delta.up { color: #7ee2a8; } .delta.down { color: #ffb3a8; }
.gcols { display: flex; align-items: stretch; gap: 14px; height: 220px; padding-top: 10px; }
.gcol { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.gbars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 4px; border-bottom: 1px solid var(--line); }
.gb { width: 40%; max-width: 26px; border-radius: 4px 4px 0 0; min-height: 2px; }
.gb.prod, .glegend i.prod { background: var(--accent); }
.gb.sold, .glegend i.sold { background: #7A6BB0; }
.gl { text-align: center; font-size: 12px; color: var(--ink-3); text-transform: capitalize; }
.glegend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 10px; }
.glegend span { display: inline-flex; align-items: center; gap: 6px; }
.glegend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.port { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.port > div { display: flex; flex-direction: column; }
.port strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.port strong.pos { color: #23774a; } .port strong.neg { color: var(--red); }
.ftile-s .delta { display: block; }
.fcard-l { overflow-wrap: anywhere; }
.ring-c strong { font-size: 20px; }

/* --- Formulário de registo de horas --- */
.ts-form { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px 12px; align-items: end; }
.tsf { display: flex; flex-direction: column; gap: 4px; grid-column: span 1; min-width: 0; }
.tsf > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.tsf.w2 { grid-column: span 2; }
.tsf.full { grid-column: 1 / -1; }
.tsf select, .tsf input { width: 100%; }
.ts-desc { width: 100%; min-height: 64px; resize: vertical; line-height: 1.45; }
.tsf-act { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.hours-sel { font-variant-numeric: tabular-nums; min-width: 96px; }
@media (max-width: 900px) { .ts-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tsf.w2 { grid-column: 1 / -1; } }
.fcards.n7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
@media (max-width: 1280px) { .fcards.n7 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 560px) { .fcards.n7 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* --- Edição rápida nas listas de tarefas --- */
.trow { grid-template-columns: 36px minmax(0, 1fr) 104px 150px 130px 160px; }
.inl { position: relative; display: inline-flex; align-items: center; gap: 4px; max-width: 100%; border-radius: 8px; padding: 3px 4px; margin: -3px -4px; cursor: pointer; }
.inl:hover, .inl:focus-within { background: var(--surface); box-shadow: 0 0 0 1px var(--line-strong, var(--line)); }
.inl-ctl { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; cursor: pointer; min-height: 0 !important; padding: 0 !important; border: 0 !important; }
.inl-ro { display: inline-flex; align-items: center; gap: 4px; }
.inl-user { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.inl-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inl-empty { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); font-size: 13px; opacity: .55; }
.trow:hover .inl-empty, .inl:focus-within .inl-empty { opacity: 1; }
.inl-clear { position: relative; z-index: 2; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; padding: 2px; border-radius: 4px; display: none; }
.inl:hover .inl-clear { display: inline-flex; }
.inl-clear:hover { color: var(--red); background: var(--red-bg); }
@media (max-width: 700px) { .trow { grid-template-columns: 30px minmax(0, 1fr) 130px; } }

/* --- Tarefa: edição direta com gravação automática --- */
.title-input { font-size: 26px; font-weight: 700; letter-spacing: -.01em; border: 1px solid transparent !important; background: transparent; padding: 4px 8px; margin-left: -9px;
  width: 100%; border-radius: 8px; color: var(--ink); box-shadow: none !important; min-height: 0; }
.title-input:hover { border-color: var(--line) !important; }
.title-input:focus { border-color: var(--accent) !important; background: var(--surface); }
.desc-input { width: 100%; min-height: 90px; resize: none; border: 1px solid transparent !important; background: transparent; line-height: 1.55; padding: 6px 8px; margin: -6px -8px;
  border-radius: 8px; box-shadow: none !important; overflow: hidden; }
.desc-input:hover { border-color: var(--line) !important; }
.desc-input:focus { border-color: var(--accent) !important; background: var(--surface); }
.autosave { font-size: 12.5px; font-weight: 600; margin-left: auto; transition: opacity .3s; }
.autosave.saving { color: var(--ink-3); } .autosave.ok { color: #23774a; } .autosave.err { color: var(--red); }
.dl select, .dl input[type="date"], .dl input[type="text"] { border-color: transparent; background: transparent; }
.dl select:hover, .dl input:hover { border-color: var(--line); background: var(--surface); }
.dl select:focus, .dl input:focus { border-color: var(--accent); background: var(--surface); }
.ts-form.compact { grid-template-columns: minmax(150px, 180px) minmax(110px, 130px) 1fr; }
.fcard { white-space: normal; }
/* Cotações: adicionar produto num clique */
select.quick-add { min-width: 250px; max-width: 360px; font-weight: 600; }
.chip.muted { opacity: .65; }
/* Pipelines (CRM) */
.pipebar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.pipebar .pipe { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 14px; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.pipebar .pipe .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--ink-3)); }
.pipebar .pipe .n { font-weight: 500; color: var(--ink-3); font-size: 12.5px; }
.pipebar .pipe[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.pipebar .pipe[aria-pressed="true"] .n { color: rgba(255,255,255,.75); }
.pipegoal { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px; color: var(--ink-2); margin: -4px 0 12px; }
.pipegoal .bar { flex: 0 0 180px; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.pipegoal .bar span { display: block; height: 100%; background: var(--c, #2E8B57); }
/* Ambiente de teste e feedback */
.env-banner { background: #FFF3D6; color: #6B4A00; border-bottom: 1px solid #F0D79A; padding: 7px 24px; font-size: 13px; }
:root[data-theme="dark"] .env-banner { background: #3A2E12; color: #F3D99A; border-color: #5A4618; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .env-banner { background: #3A2E12; color: #F3D99A; border-color: #5A4618; } }
.feedback-btn { white-space: nowrap; }
@media (max-width: 720px) { .feedback-btn .fb-label { display: none; } }
/* Versão e novidades */
.version-link { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 6px; font-size: 12px; white-space: nowrap; color: inherit; opacity: .75; text-decoration: underline; text-underline-offset: 2px; }
.version-link:hover { opacity: 1; }
.version-new { background: #F0B429; color: #3A2A00; border-radius: 99px; padding: 1px 7px; font-size: 11px; font-weight: 700; text-decoration: none; }
.changelog { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-width: 860px; }
.cl-version { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; }
.cl-version.current { border-color: var(--accent, #3E7C8C); box-shadow: 0 0 0 1px var(--accent, #3E7C8C) inset; }
.cl-version header { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cl-version h2 { font-size: 17px; margin: 0; }
.cl-title { margin: 6px 0 8px; font-weight: 600; color: var(--ink-2); }
.cl-version ul { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 7px; }
.cl-version ul li { line-height: 1.45; }
.pipebar-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-right: 2px; }
.restart-flag { margin-top: 8px; background: #F0B429; color: #3A2A00; border-radius: 6px; padding: 5px 8px; font-weight: 600; font-size: 11.5px; line-height: 1.35; }
.cl-version.pending { border-style: dashed; }
/* Filtro de período (todas as listas) */
.spanel { max-width: 1040px; }
.scol-h.p .scol-i { background: rgba(62,124,140,.14); color: #3E7C8C; }
.facet.period .facet-k { background: #3E7C8C; }
.scol-period { min-width: 250px; }
.pfields { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 8px 4px; }
.pgrid { display: grid; gap: 6px; padding: 6px 8px 2px; }
.prow { display: grid; grid-template-columns: 64px 1fr; gap: 6px; align-items: start; }
.pyear { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 13px; padding-top: 3px; cursor: pointer; }
.pmonths { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.pm { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 3px 0; min-width: 34px; font: inherit; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.pfields .pm { padding: 3px 9px; }
.pm:hover:not(:disabled) { border-color: var(--accent); color: var(--ink); }
.pm.on { background: #3E7C8C; border-color: #3E7C8C; color: #fff; }
.pm:disabled.on { opacity: .75; cursor: default; }
/* Listas agrupadas */
/* Cabeçalho de grupo bem distinto das linhas: faixa colorida, barra lateral e texto maior */
table.data tr.grp-row td { background: var(--green-100); color: var(--ink); cursor: pointer; padding-top: 11px; padding-bottom: 11px;
  font-size: 14px; border-top: 2px solid var(--line-strong); box-shadow: inset 4px 0 0 var(--green-500); }
table.data tr.grp-row strong { font-weight: 700; letter-spacing: .01em; }
table.data tr.grp-row:hover td { filter: brightness(0.97); }
table.data tr.grp-item td:first-child { padding-left: 30px; position: relative; }
table.data tr.grp-item td:first-child::before { content: ''; position: absolute; left: 14px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.grp-caret { display: inline-block; width: 16px; color: var(--ink-3); }
.grp-n { margin-left: 8px; font-size: 12px; color: var(--ink-3); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; }
.grp-extra { float: right; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.kcol-add { margin-left: 2px; width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.kcol-add:hover { border-color: var(--accent); color: var(--ink); }
/* Auto-completar */
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 28px rgba(14,8,39,.16); padding: 4px; max-height: 280px; overflow: auto; }
.combo-opt { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 9px; border-radius: 7px; font: inherit; font-size: 14px; color: inherit; cursor: pointer; }
.combo-opt:hover, .combo-opt.active { background: var(--surface-2); }
.combo-new { padding: 6px 9px; border-top: 1px solid var(--line); margin-top: 2px; }
.combo-hint { min-height: 16px; margin-top: 3px; color: var(--ink-3); }
.combo-hint .ok { color: #23774a; } .combo-hint .warn { color: var(--amber, #a86b00); }
.scols { display: flex; flex-wrap: wrap; }
.scols > .scol { flex: 1 1 200px; min-width: 0; }
.scols > .scol-period { flex: 1.6 1 340px; }
.pmonths { grid-template-columns: repeat(6, minmax(34px, 1fr)); }
@media (max-width: 700px) { .scols > .scol { flex-basis: 100%; } }

/* NIF: validação e dados públicos */
.nif-status { font-size: 12px; min-height: 0; color: var(--ink-3); }
.nif-status.good { color: var(--green-600); font-weight: 600; }
.nif-status.bad { color: var(--red); font-weight: 600; }
.nif-status.warn { color: var(--amber); }
.nif-status.busy { color: var(--ink-3); font-style: italic; }
.nif-box { margin: 4px 0 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.nif-found { display: flex; flex-direction: column; gap: 3px; }
.nif-dup { display: flex; gap: 8px; align-items: center; color: var(--red); font-size: 13px; flex-wrap: wrap; }
.nif-dup a { font-weight: 600; }
.nif-ok { color: var(--green-600); font-weight: 600; }
.nif-warn { color: var(--amber); font-weight: 600; }
.nif-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.nif-dup svg { flex: 0 0 auto; }
.nif-box[hidden] { display: none; }

/* Subtarefas agrupadas na lista */
.trow .tline { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tcaret { border: 0; background: var(--surface-2); color: var(--ink-2); width: 22px; height: 22px; border-radius: 6px; cursor: pointer; flex: 0 0 auto; font-size: 12px; line-height: 1; }
.tcaret:hover { background: var(--line); }
.tsub-n { font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 99px; padding: 0 6px; }
.tsubs { background: var(--surface-2); }
.trow.tsub { padding-left: 40px; }
.tsub-mark { color: var(--ink-3); }

/* Horas: total diário por cor (vermelho < 5h, laranja 5–7h, verde > 7h) */
.tsg td.h-low { background: #FBE3E0 !important; color: #8E2C21; font-weight: 700; }
.tsg td.h-mid { background: #FCEBD3 !important; color: #8A5300; font-weight: 700; }
.tsg td.h-ok { background: #DFF1E5 !important; color: #1E6B3E; font-weight: 700; }
:root[data-theme="dark"] .tsg td.h-low { background: #4A2420 !important; color: #F5B8AF; }
:root[data-theme="dark"] .tsg td.h-mid { background: #4A3818 !important; color: #F2CE8F; }
:root[data-theme="dark"] .tsg td.h-ok { background: #1F3D2C !important; color: #A9DDBB; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .tsg td.h-low { background: #4A2420 !important; color: #F5B8AF; }
  :root:not([data-theme]) .tsg td.h-mid { background: #4A3818 !important; color: #F2CE8F; }
  :root:not([data-theme]) .tsg td.h-ok { background: #1F3D2C !important; color: #A9DDBB; }
}
.who-link { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.who-link:hover .user-name { text-decoration: underline; }

/* Frase do dia no Painel */
.daily-quote { margin: -6px 0 18px; padding: 12px 16px; border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius-m) var(--radius-m) 0; max-width: 860px; }
.daily-quote blockquote { margin: 0; font-size: 15.5px; font-style: italic; color: var(--ink); line-height: 1.45; }
.daily-quote figcaption { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); }

/* ---------- Relatórios: painéis e gráficos ---------- */
:root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; }
:root[data-theme="dark"] { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; } }
.bignums { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 14px 0 16px; }
.bignum { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px; position: relative; overflow: hidden; }
.bignum::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.bignum.good::before { background: var(--series-3); } .bignum.alert::before { background: var(--red); } .bignum.warn::before { background: var(--series-4); }
.bignum-v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); line-height: 1.15; }
.bignum.alert .bignum-v { color: var(--red); }
.bignum-l { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 4px; }
.bignum-s { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.viz-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
@media (max-width: 1000px) { .viz-grid { grid-template-columns: 1fr; } }
.viz-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px 16px; min-width: 0; }
.viz-card.wide { grid-column: 1 / -1; }
.viz-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.viz-head h3 { font-size: 15px; }
.viz-head p { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); }
.viz-actions { display: flex; gap: 6px; flex: none; }
.viz-svg { width: 100%; height: auto; display: block; overflow: visible; }
.viz-svg .viz-gl { stroke: var(--line); stroke-width: 1; }
.viz-axis { fill: var(--ink-3); font-size: 13px; font-family: var(--font); }
.viz-cross { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.viz-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.viz-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.viz-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.viz-tip { position: fixed; z-index: 1000; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 8px; box-shadow: var(--shadow-pop); padding: 8px 10px; font-size: 12.5px; min-width: 140px; }
.viz-tip-h { font-weight: 700; margin-bottom: 4px; }
.viz-tip-row { display: flex; align-items: center; gap: 6px; } .viz-tip-row strong { margin-left: auto; padding-left: 12px; }
.viz-empty { padding: 18px 0; }
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; cursor: default; }
.hbar-l { display: flex; flex-direction: column; min-width: 0; }
.hbar-name { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-sub { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.hbar-track > span { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.hbar-v { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }
.hbar.alert .hbar-v { color: var(--red); }
.hbar:hover .hbar-name { text-decoration: underline; }

/* Menu do utilizador */
.who-btn { display: inline-flex; align-items: center; gap: 8px; background: none; border: 1px solid transparent; border-radius: 10px; padding: 4px 8px; cursor: pointer; color: var(--ink); font: inherit; }
.who-btn:hover, .who-btn[aria-expanded="true"] { border-color: var(--line); background: var(--surface); }
.user-pop { right: 0; left: auto; min-width: 260px; padding: 6px; }
.user-pop-h { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-pop a, .user-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.user-pop a:hover, .user-pop button:hover { background: var(--surface-2); }
/* Escolha de tema (pré-visualização com as cores de cada tema) */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-card { border: 2px solid var(--line); border-radius: 12px; background: var(--surface); padding: 8px; cursor: pointer; text-align: left; font: inherit; color: var(--ink); display: flex; flex-direction: column; gap: 8px; }
.theme-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.theme-prev { display: flex; width: 100%; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.tp-nav { display: block; width: 28%; background: var(--p-nav); }
.tp-body { flex: 1; background: var(--p-bg); padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.tp-btn { display: block; width: 44%; height: 10px; border-radius: 4px; background: var(--p-accent); }
.tp-line { display: block; height: 6px; border-radius: 3px; background: var(--p-line); width: 85%; } .tp-line.s { width: 60%; }
.theme-name { font-weight: 600; font-size: 13px; }
[data-theme-preview="auto"] { --p-nav: linear-gradient(180deg, #151638 50%, #10122A 50%); --p-bg: linear-gradient(180deg, #F3F5F7 50%, #171A36 50%); --p-accent: #3F7F74; --p-line: #C5CED6; }
[data-theme-preview="light"] { --p-nav: #151638; --p-bg: #F3F5F7; --p-accent: #3F7F74; --p-line: #DDE3E8; }
[data-theme-preview="dark"] { --p-nav: #0E0827; --p-bg: #171A36; --p-accent: #6BA396; --p-line: #2B3157; }
[data-theme-preview="lavanda"] { --p-nav: #3B2F5C; --p-bg: #F6F3FB; --p-accent: #6E52AE; --p-line: #E3DCF0; }
[data-theme-preview="menta"] { --p-nav: #1F4A42; --p-bg: #F1F8F5; --p-accent: #2E806D; --p-line: #D6E9E1; }
[data-theme-preview="pessego"] { --p-nav: #5A3A2E; --p-bg: #FDF6F1; --p-accent: #B25E3B; --p-line: #F0E0D5; }
[data-theme-preview="oceano"] { --p-nav: #0B2545; --p-bg: #EDF3FA; --p-accent: #1366D6; --p-line: #D3E0EF; }
[data-theme-preview="coral"] { --p-nav: #2B1B2E; --p-bg: #FFF5F4; --p-accent: #D1373D; --p-line: #F2DEDD; }
[data-theme-preview="tangerina"] { --p-nav: #1E1E24; --p-bg: #FBF7F3; --p-accent: #C2570C; --p-line: #EDE3DA; }

/* Projetos: favoritos e vista em cartões */
.star-btn .star { font-size: 16px; line-height: 1; }
.star-btn.on { border-color: #E0A800; color: #8A6400; background: #FFF6D6; }
:root[data-theme="dark"] .star-btn.on { background: #3A3015; color: #F2CE6B; }
.star-mini { color: #E0A800; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.pgrid-item .pcard { height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); border-top: 4px solid var(--c, var(--accent)); }
.cost-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 12px; margin: 6px 0 14px; }
.cost-box legend { font-weight: 700; font-size: 13px; padding: 0 6px; }
.cost-box .inline-add { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.cost-box .inline-add input { max-width: 170px; }

/* Reuniões: estado do convite Outlook/Teams na timeline */
.meet-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 2px; }
.meet-info .btn { text-decoration: none; }
.meet-info > .meet-note { flex-basis: 100%; }
.error-text { color: var(--red); }
.field.check { flex-wrap: wrap; } .field.check > .help { flex-basis: 100%; margin-left: 0; }

/* r19: Unidades de Negócio */
.unit-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--ink-2); }
.unit-tag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--ink-3)); }
.pcard-c .unit-tag { margin-left: auto; }
.pcard-c { display: flex; align-items: center; gap: 6px; }
select.unit-select { height: 28px; padding: 0 8px; font-size: 12.5px; border-radius: 999px; width: auto; }

/* r19: filtros e cartões dos relatórios */
.rep-filters { flex-wrap: wrap; gap: 8px; }
.rep-filters select { width: auto; min-width: 150px; }
.rep-filter { min-width: 200px; max-width: 260px; }
.rep-filter .combo-hint { display: none; }
.cellbar { display: grid; grid-template-columns: minmax(60px, 1fr) auto; gap: 8px; align-items: center; min-width: 150px; }
.hbar-track.mini { height: 7px; }
.mpill { display: inline-block; min-width: 46px; text-align: center; padding: 1px 8px; border-radius: 999px; font-weight: 700; font-size: 12px; background: var(--surface-2); color: var(--ink-2); }
.mpill.pos { background: color-mix(in srgb, var(--series-3) 16%, transparent); color: var(--series-3); }
.mpill.mid { background: var(--amber-bg); color: var(--amber); }
.mpill.neg { background: var(--red-bg); color: var(--red); }
.hbar-track { position: relative; }
.bullets .hbar-track { overflow: visible; }
.bullet-mark { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); }
.bullet-100 { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--ink-3); opacity: .6; }
.hbar-track.stack { display: flex; }
.hbar-track.stack span { border-radius: 0; }
.hbar-track.stack span:first-child { border-radius: 99px 0 0 99px; }
.hbar-track.stack span:last-child { border-radius: 0 99px 99px 0; }
.hbar-track.stack span:only-child { border-radius: 99px; }
.spark { display: block; overflow: visible; }
.spark-ref { stroke: var(--ink-3); stroke-dasharray: 2 3; stroke-width: 1; opacity: .7; }
.unit-table td { vertical-align: middle; }

/* r19: anexos no feedback */
.fb-attach { margin: 4px 0 12px; display: grid; gap: 8px; }
.fb-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-thumbs:empty { display: none; }
.fb-thumb { position: relative; width: 96px; height: 72px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.fb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fb-file { display: flex; align-items: center; gap: 4px; font-size: 11px; padding: 4px; word-break: break-all; }
.fb-x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; line-height: 18px; font-size: 14px; }
.fb-nfiles { display: inline-flex; align-items: center; margin-left: 8px; }

/* r19: Definições agrupadas por módulo */
.settings-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; align-items: start; }
.settings-nav { position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m, 12px); padding: 10px; display: grid; gap: 12px; }
.settings-group { display: grid; gap: 2px; }
.settings-group-l { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 4px 10px; }
.settings-link { display: grid; text-align: left; gap: 1px; background: none; border: 0; border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.settings-link:hover { background: var(--surface-2); color: var(--ink); }
.settings-link[aria-current="page"] { background: var(--green-100); color: var(--accent); font-weight: 600; }
.settings-link .small { font-weight: 400; font-size: 11.5px; }
.settings-body { min-width: 0; }
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 16px; padding: 8px; }
  .settings-group { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
  .settings-group-l { padding: 0 4px; }
  .settings-link { white-space: nowrap; }
  .settings-link .small { display: none; }
}

/* r20: dias não úteis */
.cal-day.off { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, transparent 6px 12px); }
.cal-off { display: block; font-size: 11px; font-weight: 600; color: var(--ink-3); margin: 2px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tsg th.off .dow { color: var(--red); }

/* r21: lupa da grelha de horas e detalhe da célula */
.tsg td.cell { position: relative; }
.cell-zoom { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 4px;
  background: transparent; color: var(--ink-3); cursor: pointer; opacity: 0; transition: opacity .12s; }
.tsg td.cell:hover .cell-zoom, .tsg td.cell:focus-within .cell-zoom, .tsg td.cell.has-detail .cell-zoom { opacity: 1; }
.cell-zoom:hover { background: var(--surface-2); color: var(--accent); }
.tsg td.cell.has-detail::after { content: ''; position: absolute; left: 3px; top: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.cell-multi { width: 100%; border: 1px dashed var(--line-strong); background: var(--surface-2); border-radius: 6px; padding: 4px 2px; font: inherit;
  font-variant-numeric: tabular-nums; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 4px; color: var(--ink); }
.cell-multi:hover { border-color: var(--accent); }
.cell-n { font-size: 10px; font-weight: 700; background: var(--accent); color: #fff; border-radius: 999px; padding: 0 5px; line-height: 15px; }
.cellp-head, .cellp-row { display: grid; grid-template-columns: 96px minmax(140px, 1fr) minmax(160px, 1.4fr) 36px; gap: 8px; align-items: center; }
.cellp-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 0 0 6px; border-bottom: 1px solid var(--line); }
.cellp-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.cellp-row.ro { grid-template-columns: 96px minmax(140px, 1fr) minmax(160px, 1.4fr) auto; font-size: 13.5px; }
.cellp-row.new { grid-template-columns: 96px minmax(140px, 1fr) minmax(160px, 1.4fr) auto; background: var(--surface-2); border-radius: 8px; padding: 8px; margin-top: 8px; border: 0; }
.cellp-row select, .cellp-row input { width: 100%; min-width: 0; }
.cellp-total { margin-top: 12px; text-align: right; font-size: 13.5px; }
@media (max-width: 700px) { .cellp-head { display: none; } .cellp-row, .cellp-row.ro, .cellp-row.new { grid-template-columns: 1fr 1fr; } }
.proj-combo { min-width: 220px; }
.proj-combo .combo-hint { display: none; }
.tsg-add .proj-combo { min-width: 260px; }
.ftile-warn { display: inline-block; margin-top: 4px; font-weight: 700; font-size: 12px; color: #FFD58A; text-decoration: underline; text-underline-offset: 2px; }
.ftile:not(.hero) .ftile-warn { color: var(--amber); }
.proj-combo .combo-list { min-width: 320px; }

/* r22: Definições compactas e destaque dos grupos na cor do tema */
.settings-layout { grid-template-columns: 210px minmax(0, 1fr); }
.settings-nav { gap: 10px; padding: 10px 8px; }
.settings-group-l { color: var(--accent); font-size: 11.5px; letter-spacing: .07em; padding: 2px 8px 5px; margin-bottom: 2px; border-bottom: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.settings-link { display: block; font-size: 13px; padding: 5px 10px; line-height: 1.35; }
.settings-link[aria-current="page"] { background: var(--accent); color: #fff; font-weight: 600; }
.settings-link[aria-current="page"]:hover { background: var(--accent); color: #fff; }
/* Separadores: o ativo fica com a cor do tema em toda a aplicação */
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--accent); }
.mtabs a[aria-current="page"], .module-tabs a[aria-current="page"] { color: var(--accent); }
/* Pipelines: cartões e etapas em tabela */
.pl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.pl-card { position: relative; text-align: left; border: 1px solid var(--line); border-left: 4px solid var(--c, var(--accent)); border-radius: 10px; padding: 10px 12px; background: var(--surface); cursor: pointer; display: grid; gap: 4px; font: inherit; color: var(--ink); }
.pl-card:hover { border-color: var(--line-strong); border-left-color: var(--c, var(--accent)); }
.pl-card.on { box-shadow: 0 0 0 2px var(--accent); }
.pl-card.arch { opacity: .65; }
.pl-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--accent)); }
.pl-name { font-size: 14px; }
.pl-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.pl-actions .btn { padding: 2px 8px; }
.pl-new { border-style: dashed; border-left-width: 1px; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--accent); font-weight: 600; min-height: 84px; background: transparent; }
.settings-table td, .settings-table th { vertical-align: middle; }
.settings-table .row-actions { text-align: right; white-space: nowrap; width: 1%; }
.settings-body .panel + .panel { margin-top: 16px; }
.settings-layout { grid-template-columns: 224px minmax(0, 1fr); }

/* r22: fotografia de perfil */
.avatar.has-photo { background: var(--surface-2, #e8ecf2); overflow: hidden; padding: 0; }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar-lg { width: 88px; height: 88px; font-size: 28px; }
.avatar-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.avatar-edit .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* r22: edição na linha (lista de horas) */
.inl-edit { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 3px 6px; font: inherit; color: inherit; max-width: 100%; transition: border-color .15s, background .15s; }
.inl-edit:hover { border-color: var(--line-strong); background: var(--surface); }
.inl-edit:focus { border-color: var(--accent); background: var(--surface); outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
select.inl-edit { cursor: pointer; }
.inl-desc { width: 100%; min-width: 160px; }
.inl-task { width: 100%; min-width: 140px; max-width: 240px; text-overflow: ellipsis; }
td.num .inl-edit { text-align: right; font-weight: 700; }
.inl-edit.saving { opacity: .55; }
.inl-edit.saved { border-color: var(--green-500); }

/* r22: cartão de projeto clicável */
.pcard.clickable { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.pcard.clickable:hover { box-shadow: var(--shadow-pop); }

/* r22: lista do que falta para encerrar um projeto */
.close-check { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 8px; }
.close-check li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-m); }
.close-check li.todo { border-left: 4px solid var(--amber); }
.close-check li.ok { border-left: 4px solid var(--green-500); color: var(--ink-2); }
.close-check .cc-i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.close-check .todo .cc-i { background: var(--amber-bg); color: var(--amber); }
.close-check .ok .cc-i { background: var(--green-100); color: var(--green-600); }
.close-check .cc-a { display: flex; gap: 6px; flex-wrap: wrap; }
.close-check .grow { flex: 1; }
.toast.warn { border-left-color: var(--amber); }

/* r22: cartão de indicador único (KPI), modelo dos Relatórios, em toda a aplicação */
.bignum { display: block; text-decoration: none; color: inherit; font: inherit; text-align: left; width: 100%; }
.bignum.muted::before { background: var(--line-strong); }
.bignum.clickable { cursor: pointer; transition: box-shadow .15s, transform .15s, border-color .15s; }
.bignum.clickable:hover { box-shadow: 0 6px 16px rgba(14,8,39,.08); transform: translateY(-1px); border-color: var(--line-strong); }
.bignum.clickable:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.bignum-v .bal-pill { font-size: 20px; padding: 2px 10px; }
.bignum .exec { margin-top: 8px; }
button.bignum { border: 1px solid var(--line); background: var(--surface); }
.bignums.tight { margin: 0; }
.bignums.stat-cards { margin: 0 0 16px; }
.bignums.five { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0 0 16px; }
@media (max-width: 1000px) { .bignums.five { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bignums.ftiles { grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr)); margin: 0 0 16px; }
@media (max-width: 1100px) { .bignums.ftiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .bignums.ftiles .hero { grid-column: 1 / -1; } }
.bignum.hero .bignum-v { font-size: 30px; }
.bignum .ftile-warn { color: var(--amber); }
.bignum .delta.up { color: var(--green-600); } .bignum .delta.down { color: var(--red); }
.bignum-s .delta { display: block; }
/* Raio-X: mesma moldura (banda à esquerda pelo tom) */
.xcard { border-radius: var(--radius-m); padding-left: 18px; }
.xcard::after { inset: 0 auto 0 0; width: 4px; height: auto; }

/* r22: escolha da oportunidade (nova cotação) */
form.form, div.form { display: flex; flex-direction: column; gap: 14px; }
.opp-picker .combo { position: relative; }
.opp-picker input[type=text], .opp-picker select { width: 100%; }
.opp-list { max-height: 320px; overflow: auto; }
.opp-list .combo-opt { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; text-align: left; }
.opp-list .combo-opt .opp-t { font-weight: 600; }
.opp-list .combo-opt .small { grid-column: 1; }
.opp-list .combo-opt .chip { grid-column: 2; grid-row: 1 / span 2; }
.opp-list .opp-create { display: flex; gap: 8px; align-items: center; color: var(--accent); font-weight: 600; border-top: 1px solid var(--line); }
.opp-won { display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; color: var(--ink-3); cursor: pointer; }
.opp-info { margin-top: 4px; color: var(--ink-2); }
.opp-info .ok { color: var(--green-600); font-weight: 700; } .opp-info .warn { color: var(--amber); }
.opp-new { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-m); padding: 12px 14px; display: grid; gap: 10px; }
.opp-new-h { display: flex; justify-content: space-between; align-items: center; }
.q-noopp { color: var(--amber); font-weight: 600; }
button.chip { cursor: pointer; font: inherit; font-size: 12px; }
/* filtros em cartão: mesma linguagem do cartão de indicador */
.fcard { border-radius: var(--radius-m); }
.fcard::before { width: 4px; opacity: 1; }
.fcard-l { font-weight: 600; color: var(--ink-2); }
.bignums.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bignums.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .bignums.cols-4, .bignums.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.opp-picker .opp-list { position: static; margin-top: 4px; max-height: 260px; box-shadow: none; }
form.form .field input, form.form .field select, form.form .field textarea, .opp-new .field input, .opp-new .field select { font-weight: 400; color: var(--ink); }

/* v16: Equipamentos */
.eq-filters { flex-wrap: wrap; gap: 8px; }
.eq-filters .grow { min-width: 240px; }
.eq-filters .grow input { width: 100%; }
.eq-filters select { max-width: 170px; }
.eq-filters .seg { display: inline-flex; gap: 4px; }
.eq-table tr.grp th { background: var(--surface-2); text-align: left; font-weight: 700; color: var(--accent); padding: 8px 12px; border-top: 1px solid var(--line); }
.eq-fam-h { margin: 18px 0 8px; color: var(--accent); font-size: 15px; }
.eq-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.eq-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong);
  border-radius: var(--radius-m); text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
.eq-card:hover { box-shadow: 0 6px 16px rgba(14,8,39,.08); transform: translateY(-1px); }
.eq-card.st-ativo { border-left-color: var(--green-500); } .eq-card.st-validacao, .eq-card.st-manutencao { border-left-color: var(--amber); }
.eq-card.st-indisponivel { border-left-color: var(--red); } .eq-card.st-venda { border-left-color: var(--accent); }
.eq-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.eq-qty { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.eq-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; }
.eq-acts { white-space: nowrap; text-align: right; }
.eq-acts .btn { padding: 3px 7px; }
.danger-t { color: var(--red); }
tr.muted-row td { color: var(--ink-3); }
.chip.accent { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); border-color: transparent; }
.eq-kpis { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); margin: 0 0 16px; }
.act-menu { padding: 4px 8px; font-size: 13px; max-width: 150px; margin-left: 4px; }

/* r24: cotação ganha → projeto novo ou existente */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 14px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-m); cursor: pointer; }
.choice span { display: flex; flex-direction: column; gap: 2px; }
.choice.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
.choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow: auto; margin: 8px 0; }
.pick-item { display: flex; align-items: center; gap: 8px; text-align: left; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: inherit; color: inherit; cursor: pointer; }
.pick-item:hover { background: var(--surface-2); }
.pick-item.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); color: var(--ink); }
.pick-item .grow { flex: 1; }
@media (max-width: 700px) { .choices { grid-template-columns: 1fr; } }
.choice input[type=radio] { width: 18px; height: 18px; flex: none; margin: 2px 0 0; padding: 0; }
.choice > span { flex: 1; text-align: left; }

/* v18: grupos recolhíveis, tickets */
tr.grp-toggle { cursor: pointer; user-select: none; }
tr.grp-toggle:hover th { background: color-mix(in srgb, var(--accent) 8%, var(--surface-2)); }
.grp-caret { display: inline-block; width: 14px; color: var(--ink-3); }
.ticket-desc { max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-steps { list-style: none; padding: 0; margin: 10px 0; display: flex; gap: 18px; flex-wrap: wrap; }
.ticket-steps li { padding-left: 14px; position: relative; }
.ticket-steps li::before { content: ''; position: absolute; left: 0; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.subfam-group + .subfam-group { margin-top: 10px; }

/* Agrupar em vários níveis (r26) */
.sopt .tick.lvl:not(:empty) { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 10px; align-items: center; justify-content: center; }
.shint { margin: 0 0 6px; font-size: 12px; color: var(--ink-3); }
table.data tr.grp-row.lvl-1 td, .eq-table tr.grp.lvl-1 th { padding-left: 30px; background: color-mix(in srgb, var(--green-100) 45%, var(--surface)); }
table.data tr.grp-row.lvl-2 td, .eq-table tr.grp.lvl-2 th { padding-left: 50px; background: var(--surface); }
table.data tr.grp-row.lvl-1 strong, table.data tr.grp-row.lvl-2 strong { font-weight: 600; }
.eq-table tr.grp.lvl-1 th { color: var(--ink); font-weight: 600; }
.eq-table tr.grp.lvl-2 th { color: var(--ink-2); font-weight: 600; }
.tgroup .tgroup { margin-left: 18px; border-left: 2px solid var(--line); }
.tgroup-head.tg-toggle { cursor: pointer; }
.tgroup-head .grp-caret { color: var(--ink-3); }
h4.eq-fam-h.lvl-1, h4.eq-fam-h.lvl-2 { font-size: 13px; margin: 10px 0 6px 12px; color: var(--ink-2); }
/* Preços de referência (r26) */
.pref { display: grid; gap: 10px; }
.pref-terms { display: grid; gap: 4px; }
.pref-terms input { width: 100%; }
.pref-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.pref-k { width: 64px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.pref-row .btn svg { opacity: .6; }
.pref-warn { color: var(--amber, #a15c00); margin: 0; }
.pref-box { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; grid-column: 1 / -1; }
.pref-box summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.pref-box[open] summary { margin-bottom: 8px; }
.url-cell { word-break: break-all; max-width: 520px; }
/* Eliminar com confirmação escrita (r27) */
.del-confirm label { display: grid; gap: 6px; margin-top: 8px; }
.del-confirm input { text-transform: uppercase; }
/* Marca Lumen (r28) */
.brand { font-size: 18px; letter-spacing: -0.01em; }
.brand-mark { background: none; width: 30px; height: 30px; color: #fff; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; color: var(--navy-800); font-weight: 700; font-size: 26px; letter-spacing: -0.01em; }
/* Mapa de horas pessoa × dia (r31) */
.hm-controls { margin: 0 0 12px; gap: 10px; flex-wrap: wrap; align-items: center; }
.hm-legend { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); flex-wrap: wrap; }
.hm-key { width: 14px; height: 14px; border-radius: 4px; display: inline-block; margin-left: 8px; }
.hmap { border-collapse: separate; border-spacing: 2px; font-size: 12.5px; width: 100%; table-layout: auto; }
.hmap th, .hmap td { text-align: center; padding: 6px 1px; border-radius: 5px; white-space: nowrap; }
.hmap .hm-name { text-align: left; padding: 6px 10px 6px 4px; font-weight: 600; position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 120px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.hmap thead th { font-weight: 700; color: var(--ink-2); font-size: 12px; }
.hmap .hm-wd { font-size: 10.5px; color: var(--ink-3); font-weight: 600; }
.hmap .hm-day { min-width: 26px; }
.hmap .hm-cell { min-width: 26px; font-variant-numeric: tabular-nums; font-weight: 600; }
.hmap .hm-offcol { background: var(--surface-2); color: var(--ink-3); }
.hmap thead .hm-offcol { opacity: .65; }
.hmap .hm-good, .hm-key.hm-good { background: #DCEFE6; color: #22614F; }
.hmap .hm-mid, .hm-key.hm-mid { background: var(--amber-bg); color: #8A5A08; }
.hmap .hm-low, .hm-key.hm-low { background: var(--red-bg); color: var(--red); }
.hm-key.hm-off { background: var(--surface-2); border: 1px solid var(--line); }
.hmap .hm-tot { font-weight: 700; padding: 6px 6px; min-width: 56px; }
.hmap tfoot th, .hmap tfoot td { font-weight: 700; border-radius: 0; box-shadow: 0 -2px 0 var(--green-500); }
.hmap tfoot .hm-grand { color: var(--green-600); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .hmap .hm-good, :root:not([data-theme]) .hm-key.hm-good { background: #1F3D35; color: #8FD3B8; }
  :root:not([data-theme]) .hmap .hm-mid, :root:not([data-theme]) .hm-key.hm-mid { background: #3D3220; color: #F0C474; }
  :root:not([data-theme]) .hmap .hm-low, :root:not([data-theme]) .hm-key.hm-low { background: #43272A; color: #F29A90; }
}
:root[data-theme="dark"] .hmap .hm-good, :root[data-theme="dark"] .hm-key.hm-good { background: #1F3D35; color: #8FD3B8; }
:root[data-theme="dark"] .hmap .hm-mid, :root[data-theme="dark"] .hm-key.hm-mid { background: #3D3220; color: #F0C474; }
:root[data-theme="dark"] .hmap .hm-low, :root[data-theme="dark"] .hm-key.hm-low { background: #43272A; color: #F29A90; }

/* --- r40: CRM, cartões por unidade de negócio --- */
.uncards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 0 0 16px; }
.uncard { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: 10px; padding: 10px 6px 6px; }
.uncard .uc-h { display: flex; align-items: center; gap: 8px; font-weight: 700; padding: 0 8px 6px; }
.uncard .uc-h .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.uncard .uc-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: baseline; width: 100%; border: 0; background: none;
  font: inherit; color: var(--ink); text-align: left; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.uncard .uc-row:hover { background: var(--surface-2); }
.uncard .uc-l { color: var(--ink-2); font-size: 13px; }
.uncard .uc-n { color: var(--ink-3); font-size: 12px; min-width: 2ch; text-align: right; }
.uncard .uc-row.won strong { color: var(--green-600); }
.uncard .uc-row.lost strong { color: var(--red); }

/* --- r43: cartões de indicadores mais compactos (CRM, tarefas, projeto) --- */
.bignums { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.bignums.stat-cards, .bignums.five, .bignums.ftiles { margin: 0 0 12px; }
.bignum { padding: 8px 12px 8px 14px; }
.bignum::before { width: 3px; }
.bignum-v { font-size: 20px; line-height: 1.2; }
.stat-cards .bignum-v { font-size: 20px; }
.bignum-l { font-size: 12px; margin-top: 2px; line-height: 1.3; }
.bignum-s { font-size: 11px; margin-top: 1px; }
.bignum-v .bal-pill { font-size: 15px; padding: 1px 8px; }
.bignum .exec { margin-top: 4px; }
.bignum.hero .bignum-v { font-size: 24px; }
.uncards { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin: 0 0 12px; }
.uncard { padding: 6px 4px 4px; border-top-width: 2px; }
.uncard .uc-h { font-size: 13px; padding: 0 8px 2px; }
.uncard .uc-row { padding: 2px 8px; gap: 8px; font-size: 12px; }
.uncard .uc-l { font-size: 12px; }
.uncard .uc-n { font-size: 11px; }
.uncard .uc-row strong { font-size: 13px; }
/* cartões-filtro (Tarefas e outras listas): ícone à esquerda, valor e nome à direita */
.fcard { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 0; align-items: center; padding: 8px 12px; }
.fcard-i { grid-row: 1 / span 2; width: 26px; height: 26px; }
.fcard-v { font-size: 18px; line-height: 1.15; }
.fcard-l { font-size: 12px; line-height: 1.2; }
.fcards { gap: 8px; margin-bottom: 12px; }
/* Raio-X do projeto */
.xfin { padding: 10px 12px; }
.xfin-h { margin-bottom: 6px; }
.xtile { padding: 8px 12px; gap: 2px; border-radius: 10px; }
.xtile > span:first-child { font-size: 12px; }
.xtile strong { font-size: 17px; }
.xgrid4 { gap: 8px; }
.xcard { padding: 10px 12px; gap: 6px; border-radius: 10px; }
.xcard-h { font-size: 13px; }
.xcard-l { font-size: 12px; }
.ring-wrap { width: 84px; height: 84px; }
.ring-c strong { font-size: 17px; }
.ring-c span { font-size: 10.5px; }
.bignum-l, .bignum-s { white-space: normal; }

/* --- r46: barra lateral recolhível (só ícones), escolha guardada por pessoa --- */
.nav-toggle { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 6px; padding: 8px 10px; border: 0; border-radius: 8px;
  background: transparent; color: #8F97AE; font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.nav-toggle:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-toggle svg { flex: none; transition: transform .2s; }
.nav a svg { flex: none; }
.foot-mini { display: none; }
@media (min-width: 861px) {
  .app { transition: grid-template-columns .18s ease; }
  .app.nav-mini { --sidebar-w: 68px; }
  .nav-mini .sidebar { padding: 18px 10px 12px; }
  .nav-mini .brand { justify-content: center; padding: 4px 0 18px; }
  .nav-mini .brand-name, .nav-mini .nav-l, .nav-mini .nav-title, .nav-mini .foot-full { display: none; }
  .nav-mini .nav a, .nav-mini .nav-toggle { justify-content: center; gap: 0; padding: 10px 0; }
  .nav-mini .nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.08); }
  .nav-mini .nav-group:first-child { border-top: 0; padding-top: 0; }
  .nav-mini .nav-toggle svg { transform: scaleX(-1); }
  .nav-mini .sidebar-foot { padding: 10px 0 2px; display: flex; justify-content: center; }
  .nav-mini .foot-mini { display: inline-flex; }
}
@media (max-width: 860px) { .nav-toggle { display: none; } }

/* --- r46: cartões-filtro (Projetos, Tarefas): ícone e número na mesma linha, texto por baixo sem partir palavras --- */
.fcard { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "i v" "l l"; align-items: center; column-gap: 8px; row-gap: 4px; padding: 10px 12px; }
.fcard-i { grid-area: i; grid-row: auto; width: 26px; height: 26px; }
.fcard-v { grid-area: v; font-size: 20px; line-height: 1; }
.fcard-l { grid-area: l; font-size: 12px; line-height: 1.25; overflow-wrap: normal; word-break: normal; hyphens: none; }
.fcard.wide { display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 6px; }
.fcard.wide .fcard-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard.wide .fcard-exec { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0; white-space: nowrap; }
.fcard.wide .fcard-exec .small { font-size: 12px; }

/* --- r46: cartões de projeto (vista Cartões) --- */
.pgrid-item .pcard::before { display: none; }
.pgrid-item .pcard { padding: 12px 14px 10px; gap: 8px; }
.pcard-top { align-items: center; }
.pcard-c { align-items: flex-start; gap: 6px; margin-top: -2px; line-height: 1.35; }
.pcard-c > svg { flex: none; margin-top: 2px; color: var(--ink-3); }
.pcard-c .pcard-cn { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pcard-c .unit-tag { margin-left: 0; flex: none; }
.pcard-row { min-height: 26px; }
.pcard-hours { gap: 6px; }
.pcard-foot { gap: 12px; min-height: 26px; font-size: 12.5px; }
.pcard-foot > span:not(.avatar) { display: inline-flex; align-items: center; gap: 4px; }
.pcard-foot svg { vertical-align: 0; flex: none; }

/* --- r46: nota de valor (oportunidade) e contrato mensal (cotação) --- */
.form-note { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 14px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); font-size: 13px; line-height: 1.4; }
.form-note svg { flex: none; margin-top: 2px; color: var(--accent); }
.totals .contract { font-weight: 600; color: var(--ink-2); padding-top: 4px; }

/* --- r47: linhas da cotação compactas e artigo com pesquisa --- */
table.qlines.edit { table-layout: auto; }
table.qlines.edit th { white-space: nowrap; font-size: 12px; }
table.qlines.edit td { padding: 8px 4px; }
table.qlines.edit td:first-child { padding-left: 14px; }
table.qlines.edit input, table.qlines.edit select, table.qlines.edit textarea { min-height: 32px; font-size: 13px; padding: 5px 7px; }
table.qlines .desc-cell { min-width: 0; width: 100%; display: flex; flex-direction: column; gap: 4px; }
table.qlines .q-desc { width: 100%; resize: none; overflow: hidden; line-height: 1.35; min-height: 32px; font-weight: 600; }
table.qlines .num-in { width: 68px; text-align: right; -moz-appearance: textfield; }
table.qlines .num-in::-webkit-outer-spin-button, table.qlines .num-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
table.qlines .q-uom { width: 92px; }
table.qlines .q-sub { white-space: nowrap; padding-top: 14px !important; font-weight: 600; }
table.qlines .row-ctrl { padding-top: 10px !important; }
table.qlines .row-ctrl .icon-btn { width: 26px; height: 26px; }
/* seletor de artigos */
.pp { position: relative; display: flex; align-items: center; gap: 6px; }
.pp > svg { position: absolute; left: 8px; color: var(--ink-3); pointer-events: none; }
.pp .pp-input { width: 100%; padding-left: 26px !important; }
.pp-row .pp-input { min-height: 28px !important; font-size: 12px !important; color: var(--ink-3); border-color: transparent; background: var(--surface-2); }
.pp-row .pp-input:focus { color: var(--ink); border-color: var(--line-strong); background: var(--surface); }
.pp-add { flex: 1 1 320px; max-width: 460px; }
.pp-add .pp-input { min-height: 34px; font-weight: 600; }
.pp-list { position: absolute; left: 0; top: calc(100% + 4px); z-index: 70; width: max(100%, 440px); max-height: 340px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 4px; }
.pp-fam { position: sticky; top: -4px; background: var(--surface); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 8px 8px 4px; }
.pp-opt { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: 100%; border: 0; background: transparent; text-align: left;
  font: inherit; font-size: 13px; color: inherit; padding: 6px 8px 6px 16px; border-radius: 7px; cursor: pointer; }
.pp-opt:hover, .pp-opt.active { background: var(--surface-2); }
.pp-code { color: var(--ink-3); font-size: 11px; }
.pp-price { flex: none; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.pp-empty { padding: 10px; color: var(--ink-3); font-size: 13px; }
table.qlines.edit td.desc-cell { display: table-cell; width: 100%; min-width: 220px; }
table.qlines .desc-wrap { display: flex; flex-direction: column; gap: 4px; }
table.qlines .num-in { width: 72px; }
table.qlines .num-in.n-qty { width: 58px; }
table.qlines .num-in.n-pct { width: 50px; }
table.qlines .q-uom { width: 84px; }
table.qlines.edit th:not(:first-child), table.qlines.edit td:not(.desc-cell):not([colspan]) { width: 1%; white-space: nowrap; }
table.qlines.edit th:first-child { width: auto; }
table.qlines.edit th { padding: 10px 6px; }
table.qlines.edit th:first-child { padding-left: 14px; }
.pp-row { max-width: 340px; }
/* r48: linha da cotação numa só linha (o artigo é a pesquisa) */
.pp-row { max-width: none; }
.pp-row .pp-input { min-height: 32px !important; font-size: 13px !important; font-weight: 600; color: var(--ink); background: var(--surface); border-color: var(--line); }
.q-art { display: flex; align-items: center; gap: 4px; }
.q-art .pp { flex: 1 1 auto; }
.q-note-btn { flex: none; width: 30px; height: 30px; color: var(--ink-3); }
.q-note-btn.on { color: var(--accent); background: var(--surface-2); }
table.qlines .q-desc { font-weight: 400; }
/* r49: botão de recolher o menu só com ícone, no topo, alinhado com o logótipo */
.brand .nav-toggle { width: 30px; height: 30px; margin: 0 0 0 auto; padding: 0; justify-content: center; flex: none; color: #8F97AE; }
@media (min-width: 861px) {
  .nav-mini .brand { flex-direction: column; gap: 12px; }
  .nav-mini .brand .nav-toggle { margin: 0; padding: 0; }
}
/* r50: rodapé do menu só com a versão (nome e perfil estão no topo) */
.sidebar-foot .version-link { margin-top: 0; }
@media (min-width: 861px) { .nav-mini .sidebar-foot { display: none; } }
/* r55: secções das tarefas do projeto */
.seg-by { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg-by button { border: 0; background: transparent; padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-3); cursor: pointer; }
.seg-by button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.tgroup-head .sec-tools { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; opacity: .55; }
.tgroup-head:hover .sec-tools, .tgroup-head:focus-within .sec-tools { opacity: 1; }
.sec-handle { cursor: grab; color: var(--ink-3); padding: 0 6px; letter-spacing: -2px; font-weight: 700; user-select: none; }
.sec-tools .icon-btn { width: 26px; height: 26px; }
.trow.tdrag { cursor: grab; }
.trow.dragging { opacity: .45; }
.tgroup.drop-on { outline: 2px dashed var(--accent); outline-offset: -2px; background: color-mix(in srgb, var(--accent) 5%, transparent); }
.quick-add .qa-svc { width: auto; max-width: 220px; min-height: 30px; font-size: 12px; }
.quick-add.new-section input { font-weight: 600; }
.trow.tdrag { position: relative; }
.trow.tdrag::before { content: '⋮⋮'; position: absolute; left: 3px; top: 50%; transform: translateY(-50%); color: var(--ink-3); opacity: 0; letter-spacing: -2px; font-weight: 700; font-size: 12px; pointer-events: none; }
.trow.tdrag:hover::before { opacity: .8; }
/* r56: faturação (TOConline) */
.bill-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.panel-body:has(> .bill-tiles) { container-type: inline-size; }
@container (min-width: 620px) { .bill-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } } /* 4 lado a lado ou 2+2, nunca 3+1 */
.bill-tiles > div { background: var(--surface-2); border-radius: 9px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.bill-tiles span { font-size: 12px; color: var(--ink-3); }
.bill-tiles strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.bill-tiles em { font-style: normal; font-size: 12px; color: var(--ink-3); }
.bill-tiles .neg, td.neg { color: var(--red); }
tr.muted td { color: var(--ink-3); text-decoration: line-through; }
/* r59: faturas recolhidas e agrupadas por ano */
.bill-docs { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; }
.bill-docs > summary { cursor: pointer; padding: 10px 12px; font-weight: 600; list-style: none; }
.bill-docs > summary::before, .bill-year > summary::before { content: '▸'; display: inline-block; width: 16px; color: var(--ink-3); transition: transform .15s; }
.bill-docs[open] > summary::before, .bill-year[open] > summary::before { transform: rotate(90deg); }
.bill-docs > summary::-webkit-details-marker, .bill-year > summary::-webkit-details-marker { display: none; }
.bill-year { border-top: 1px solid var(--line); }
.bill-year > summary { cursor: pointer; padding: 8px 12px; display: flex; gap: 10px; align-items: baseline; list-style: none; background: var(--surface-2); }
.bill-year .table-wrap { padding: 0 4px 6px; }
.bill-docs td:first-child, .bill-docs td:nth-child(2), .bill-docs td:nth-child(3) { white-space: nowrap; }

/* Faturação na ficha da empresa: documentos em lista de duas linhas (cabe na coluna lateral). */
.bill-doc-list { list-style: none; margin: 0; padding: 0; }
.bill-doc { padding: 8px 2px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.bill-doc:last-child { border-bottom: 0; }
.bill-doc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bill-doc-top .grow { flex: 1; }
.bill-year .bill-doc-list { padding: 0 12px 4px; }
.bill-year > summary { flex-wrap: wrap; }
