/* Elecctro Hub — Shell styles. Tokens partilhados com legacy (deveriam vir
   de @elecctro/ui-tokens no futuro). */

:root {
  --brand-indigo: #1D1131;
  --brand-indigo-soft: #615E84;
  --brand-yellow: #FACC4F;
  --brand-yellow-soft: #FFDF88;
  --brand-yellow-pressed: #E8B73A;

  --surface: #FFFFFF;
  --surface-subtle: #F6F6F6;
  --surface-dark: #1D1131;

  --accent-coral: #FF4E3E;

  --neutral-100: #F6F6F6;
  --neutral-200: #EFEFEF;
  --neutral-300: #C5C5C5;
  --neutral-400: #D9D9DE;
  --neutral-500: #A9ADB4;
  --neutral-700: #615E84;
  --neutral-900: #1D1131;

  --success: #2BB673;
  --warning: #F59E0B;
  --danger: #E53935;
  --info: #4A6CF7;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(29, 17, 49, 0.06);
  --shadow-md: 0 4px 12px rgba(29, 17, 49, 0.08);
  --shadow-lg: 0 12px 32px rgba(29, 17, 49, 0.12);

  --topbar-h: 64px;

  --color-bg:    var(--surface-subtle);
  --color-card:  var(--surface);
  --color-surface: var(--surface);     /* alias de --color-card para componentes Round 2+ */
  --color-text:  var(--neutral-900);
  --color-muted: var(--neutral-700);
  --color-border: var(--neutral-200);
  /* Cor primária (accione/seleccionado). Antes era usada como var(--color-primary)
     em vários componentes mas NUNCA fora definida → fundo transparente + texto
     branco = elemento "branco" ilegível. Alinhado com .btn-primary (#0d6efd). */
  --color-primary:       #0d6efd;
  --color-primary-hover: #0a58ca;
  --color-primary-fg:    #ffffff;   /* texto/ícone sobre fundo primário */

  /* Module color tokens (subtle backgrounds for cards) */
  --module-purple: #F4F0FB;
  --module-purple-fg: #6D4FC9;
  --module-green:  #E6F7EE;
  --module-green-fg: #2BB673;
  --module-orange: #FFF1E5;
  --module-orange-fg: #E07B1F;
  --module-yellow: #FFF8DF;
  --module-yellow-fg: #B58502;
  --module-pink:   #FCE7F1;
  --module-pink-fg: #C2387D;
  --module-gray:   #EEEEF1;
  --module-gray-fg: #615E84;
}

[data-theme="dark"] {
  --color-bg:     #15101E;
  --color-card:   #1D1131;
  --color-surface: #1D1131;     /* alias de --color-card */
  --color-text:   #F6F6F6;
  --color-muted:  #A9ADB4;
  --color-border: #2A1E40;
  /* Primária: um azul ligeiramente mais claro lê melhor sobre o fundo escuro,
     mantendo texto branco legível por cima. */
  --color-primary:       #3b82f6;
  --color-primary-hover: #2563eb;
  --color-primary-fg:    #ffffff;

  --module-purple: rgba(109, 79, 201, 0.15);
  --module-green:  rgba(43, 182, 115, 0.15);
  --module-orange: rgba(224, 123, 31, 0.15);
  --module-yellow: rgba(181, 133, 2, 0.18);
  --module-pink:   rgba(194, 56, 125, 0.15);
  --module-gray:   rgba(97, 94, 132, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--info);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

button {
  font: inherit;
  cursor: pointer;
}

/* ── Bootstrap loading state ─────────────────────────────── */
.shell-bootstrap {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--color-muted);
}

.shell-bootstrap__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--brand-yellow);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Topbar (shared layout) ─────────────────────────────── */
.shell-topbar {
  height: var(--topbar-h);
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.shell-topbar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  color: var(--color-text);
  background: none;
  border: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-left: -10px;
}
.shell-topbar__logo:hover {
  background: var(--color-border);
}
.shell-topbar__logo-mark {
  font-size: 22px;
}

.shell-topbar__tabs {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.shell-topbar__tabs::-webkit-scrollbar { height: 4px; }

.shell-topbar__tab {
  background: none;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.shell-topbar__tab:hover {
  background: var(--color-border);
  color: var(--color-text);
}
.shell-topbar__tab.is-active {
  background: var(--brand-indigo);
  color: white;
}
.shell-topbar__tab[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.shell-topbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.shell-topbar__user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: none;
  border: 1px solid transparent;
  color: var(--color-muted);
}
.shell-topbar__user:hover { border-color: var(--color-border); color: var(--color-text); }
.shell-topbar__logout {
  background: none;
  border: 1px solid var(--color-border);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
}
.shell-topbar__logout:hover { color: var(--danger); border-color: var(--danger); }

.shell-topbar__icon-btn {
  background: none;
  border: 1px solid transparent;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  line-height: 1;
}
.shell-topbar__icon-btn:hover {
  border-color: var(--color-border);
  background: var(--color-border);
}

/* ── Home screen ─────────────────────────────────────────── */
.shell-home {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.shell-home__greeting {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 8px;
}
.shell-home__subgreeting {
  color: var(--color-muted);
  margin: 0 0 32px;
}

.shell-home__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.module-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  font: inherit;
  color: var(--color-text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.module-card:hover {
  border-color: var(--brand-indigo);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.module-card[disabled] {
  cursor: not-allowed;
}
.module-card[disabled]:hover {
  transform: none;
  border-color: var(--color-border);
  box-shadow: none;
}

.module-card__icon-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.module-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.module-card__icon--purple { background: var(--module-purple); color: var(--module-purple-fg); }
.module-card__icon--green  { background: var(--module-green);  color: var(--module-green-fg); }
.module-card__icon--orange { background: var(--module-orange); color: var(--module-orange-fg); }
.module-card__icon--yellow { background: var(--module-yellow); color: var(--module-yellow-fg); }
.module-card__icon--pink   { background: var(--module-pink);   color: var(--module-pink-fg); }
.module-card__icon--gray   { background: var(--module-gray);   color: var(--module-gray-fg); }

.module-card__title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.module-card__badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--color-border);
  color: var(--color-muted);
  margin-left: auto;
}
.module-card__badge--coming {
  background: var(--module-yellow);
  color: var(--module-yellow-fg);
}
.module-card__badge--admin {
  background: var(--module-gray);
  color: var(--module-gray-fg);
}

.module-card__tagline {
  color: var(--color-muted);
  margin: 0;
  font-size: 13px;
}

.module-card__screens {
  color: var(--color-muted);
  font-size: 12px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--color-border);
}

/* ── Module frame (after entering a module) ──────────────── */
.module-frame {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px 0;
  --module-frame-padding: 24px;
}

/* Variante "wide" para ecrãs com tabela (Clientes, Faturas, Recibos, etc.).
   Remove o max-width:1400px e mantém um padding lateral discreto (32px)
   para a tabela respirar mas usar quase toda a largura disponível. Header,
   filtros, chips e tabela ficam alinhados ao mesmo eixo — sem partições. */
.module-frame--wide {
  max-width: none;
  padding-left: 32px;
  padding-right: 32px;
  --module-frame-padding: 32px;
}
@media (max-width: 800px) {
  .module-frame--wide {
    padding-left: 16px;
    padding-right: 16px;
    --module-frame-padding: 16px;
  }
}

.module-frame__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.module-frame__title {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
}

.module-subtabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.module-subtab {
  background: none;
  border: none;
  padding: 10px 16px;
  color: var(--color-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.module-subtab.is-active {
  color: var(--color-text);
  border-bottom-color: var(--brand-yellow);
  font-weight: 600;
}
.module-subtab:hover:not(.is-active) {
  color: var(--color-text);
}

.module-screens {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.module-screen-chip {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--color-text);
}
.module-screen-chip:hover {
  border-color: var(--brand-indigo);
}
.module-screen-chip[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.module-placeholder {
  text-align: center;
  padding: 64px 24px;
  color: var(--color-muted);
}
.module-placeholder h3 {
  margin: 0 0 8px;
  color: var(--color-text);
}

/* ── Section com sidebar (para sub-tabs com >1 screen) ──────
   Layout 2 colunas: sidebar fixa à esquerda + conteúdo à direita.
   Substitui os chips (.module-screens) quando há vários documentos
   dentro de uma section (Faturação, Operações, Fornecedores). */
.module-section-with-sidebar {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  align-items: start;
  min-height: 60vh;
}
@media (max-width: 800px) {
  .module-section-with-sidebar { grid-template-columns: 1fr; }
}

.module-section-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  position: sticky;
  top: calc(var(--topbar-h, 64px) + 12px);
  min-width: 0;
}
.module-section-sidebar__title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  font-weight: 600;
  padding: 8px 12px 4px;
}
.module-section-sidebar__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  text-align: left;
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s;
  width: 100%;
}
.module-section-sidebar__item:hover:not(.is-active):not(.is-disabled) {
  background: var(--color-bg);
}
.module-section-sidebar__item.is-active {
  background: var(--color-bg);
  font-weight: 600;
  border-left: 3px solid var(--brand-yellow);
  padding-left: 9px;
}
.module-section-sidebar__item.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.module-section-sidebar__badge {
  font-size: 11px;
  flex-shrink: 0;
}

.module-section-content {
  min-width: 0;     /* permite que .shell-table-wrap dentro encolha — sem isto o grid expande */
}

/* ── Native table (used by Customers, Faturas, etc.) ─────── */
.shell-table-wrap {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}
.shell-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.shell-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 1;
}
.shell-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}
.shell-table tbody tr:last-child td { border-bottom: none; }
.shell-table tbody tr:hover { background: var(--color-bg); }
/* Coluna numérica (alinhada à direita) + linha clicável — genéricas */
.shell-table th.t-num, .shell-table td.t-num { text-align: right; font-variant-numeric: tabular-nums; }
.shell-table tr.t-row--clickable { cursor: pointer; }

.shell-mono { font-family: 'JetBrains Mono', SF Mono, Menlo, monospace; }

.shell-search {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  min-width: 280px;
}
.shell-search:focus {
  outline: none;
  border-color: var(--brand-indigo);
}

/* Filtros lado-a-lado (Auditoria, etc.) */
.shell-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}
.shell-filters .shell-search {
  min-width: 160px;
}

/* Maquinas: 2 colunas (marcas + modelos) */
.maquinas-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 800px) {
  .maquinas-grid { grid-template-columns: 1fr; }
}

.maquinas-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.maquinas-list__item {
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font: inherit;
  color: var(--color-text);
  cursor: pointer;
}
.maquinas-list__item:hover:not(.maquinas-list__item--readonly) {
  background: var(--color-bg);
}
.maquinas-list__item.is-active {
  background: var(--module-purple);
  color: var(--module-purple-fg);
}
.maquinas-list__item--readonly {
  cursor: default;
}
.maquinas-list li:last-child .maquinas-list__item {
  border-bottom: none;
}

/* ── Finance Dashboard (nativo) ───────────────────────────── */
.finance-dashboard {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 8px 0 24px;
}
.finance-dashboard__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.finance-dashboard__greeting {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 600;
}
.finance-dashboard__subtitle {
  margin: 0;
  color: var(--color-muted);
  font-size: 13px;
}

.finance-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.kpi-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-card--ok    { border-left: 3px solid var(--success); }
.kpi-card--err   { border-left: 3px solid var(--danger); }
.kpi-card--warn  { border-left: 3px solid var(--warning); }
.kpi-card--info  { border-left: 3px solid var(--info); }

.kpi-card__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-muted);
}
.kpi-card__value {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
}
.kpi-card__sub {
  font-size: 12px;
  color: var(--color-muted);
}

.finance-automation-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.finance-automation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ── Cross-module view (banner "este conteúdo vive noutro módulo") ── */
.cross-module-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cross-module-view__banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--module-yellow);
  color: var(--module-yellow-fg);
  border: 1px solid var(--module-yellow-fg);
  border-opacity: 0.3;
}
.cross-module-view__banner-icon {
  font-size: 18px;
}
.cross-module-view__banner-text {
  flex: 1;
  font-size: 13px;
}
.cross-module-view__banner-link {
  background: var(--brand-indigo);
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.cross-module-view__banner-link:hover {
  background: var(--neutral-700);
  text-decoration: none;
}

/* ── Module iframe (embeds legacy) ────────────────────────── */
/* Iframe deve ser visualmente "invisível" — utilizador vê o ecrã do legacy
   como se fosse nativo do shell. Sem bordas, sem padding, full-width. */
.module-iframe-wrap {
  height: calc(100vh - var(--topbar-h) - 140px);
  min-height: 400px;
  overflow: hidden;
  background: var(--color-bg);
  position: relative;
  /* Estica para os lados além do max-width do module-frame */
  margin-left: calc(-1 * var(--module-frame-padding, 24px));
  margin-right: calc(-1 * var(--module-frame-padding, 24px));
}
.module-iframe-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.module-iframe-loading {
  position: absolute;
  inset: 0;
  background: var(--color-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--color-muted);
  pointer-events: none;
}

/* ── Login ──────────────────────────────────────────────── */
.shell-login {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.shell-login__card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}

.shell-login__title {
  margin: 0 0 4px;
  font-size: 22px;
}
.shell-login__subtitle {
  color: var(--color-muted);
  margin: 0 0 24px;
}

.shell-login__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}
.shell-login__field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.shell-login__field input {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
}
.shell-login__field input:focus {
  outline: none;
  border-color: var(--brand-indigo);
}

.shell-login__submit {
  width: 100%;
  padding: 12px;
  background: var(--brand-yellow);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--brand-indigo);
}
.shell-login__submit:hover:not(:disabled) {
  background: var(--brand-yellow-pressed);
}
.shell-login__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.shell-login__error {
  background: rgba(229, 57, 53, 0.1);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ── Native screen primitives (used by all native module screens) ───── */
.shell-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 8px 0 24px;
}

.shell-section__header h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
}
.shell-section__sub {
  color: var(--color-muted);
  margin: 0;
  font-size: 13px;
}

.shell-section__block {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.shell-section__block h3 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-muted);
}
.shell-section__block--muted {
  background: var(--color-bg);
  border-style: dashed;
}
.shell-section__block--muted p {
  margin: 0 0 8px;
  color: var(--color-muted);
  font-size: 13px;
}

.shell-muted { color: var(--color-muted); margin: 4px 0 0; font-size: 13px; }
.shell-error { color: var(--danger); font-weight: 500; }
.shell-link  { color: var(--info); font-weight: 500; }
.shell-link:hover { text-decoration: underline; }

/* Pill (status badge) */
.shell-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.shell-pill--ok      { background: rgba(43,182,115,0.15); color: var(--success); }
.shell-pill--err     { background: rgba(229,57,53,0.12); color: var(--danger); }
.shell-pill--warn    { background: rgba(245,158,11,0.18); color: var(--warning); }
.shell-pill--neutral { background: var(--color-border); color: var(--color-muted); }

.shell-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-radius: 4px;
  background: var(--module-yellow);
  color: var(--module-yellow-fg);
}
.shell-badge--primary { background: var(--module-yellow); color: var(--module-yellow-fg); }

/* Tabs simples (usadas em listas de connections, etc.) */
.shell-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.shell-tab {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
}
.shell-tab.is-active {
  background: var(--brand-indigo);
  color: white;
  border-color: var(--brand-indigo);
}

.shell-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--color-text);
}
.shell-list li {
  margin: 4px 0;
}

.shell-schemas summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--color-muted);
  padding: 4px 0;
}
.shell-schemas ul {
  margin: 8px 0 0;
  padding: 0 0 0 16px;
  font-size: 13px;
}

/* Status card (used inside Settings to show DB info) */
.shell-status-card { display: flex; flex-direction: column; gap: 12px; }
.shell-status-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shell-keyvals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 0;
}
.shell-kv { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.shell-kv dt {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-muted);
}
.shell-kv dd {
  margin: 0;
  font-size: 13px;
  color: var(--color-text);
  word-break: break-word;
}

/* Grid + cards (used by Integrations + Settings integrations summary) */
.shell-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.shell-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shell-card--integration.is-planned {
  opacity: 0.65;
  background: var(--color-bg);
}

.shell-card__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.shell-card__icon {
  font-size: 20px;
  flex-shrink: 0;
}
.shell-card__icon--lg { font-size: 26px; }

.shell-card__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.shell-card__sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--color-muted);
}

/* ───────────────────────── Round 2: modais, drawer, bulk ─────────────────────────
   Tudo via tokens semânticos (--color-*). Evita cores hard-coded.
*/

/* Modal genérico */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
/* Modal empilhado por cima de outro modal/drawer (ex.: "Adicionar VMUs" aberto a
   partir do drawer da ordem de kitting). Fica acima do z-index base 1000. */
.modal-backdrop--top { z-index: 1100; }
.modal {
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 8px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-width: 720px; width: 100%;
  max-height: 90vh; display: flex; flex-direction: column;
  overflow: hidden;
}
.email-preview-modal { max-width: 900px; }
/* Modal "página completa" — para formulários que não cabem bem no drawer estreito
   (ex.: preencher o Relatório interno do Suporte Field). Ocupa quase todo o ecrã. */
.modal--fullpage { max-width: 1040px; width: 96%; max-height: 94vh; }
/* Modal expandido a quase-ecrã-inteiro (toggle no header do detalhe dos Tickets
   Técnicos). Ainda é modal (fecha e volta à tabela), mas ocupa ~96% do ecrã. */
.modal--fullscreen { max-width: none; width: 96vw; height: 94vh; max-height: 94vh; }
.modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { margin: 0; font-size: 16px; }
.modal-close {
  background: transparent; border: none;
  font-size: 18px; cursor: pointer;
  color: var(--color-muted);
}
.modal-close:hover { color: var(--color-text); }
.modal-body { padding: 16px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  display: flex; gap: 8px; justify-content: flex-end;
}
.modal-error {
  margin: 8px 16px;
  padding: 8px 12px;
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
  border-radius: 4px;
  font-size: 13px;
}
.modal-success {
  margin: 8px 16px;
  padding: 8px 12px;
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
  border-radius: 4px;
  font-size: 13px;
}

/* Form rows dentro de modais */
.form-row {
  margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.form-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
}
.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="number"],
.form-row input[type="date"],
.form-row select,
.form-row textarea {
  padding: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 4px;
  font-size: 14px;
}
.form-row textarea { resize: vertical; }
.form-row .req { color: #dc3545; }

/* Preview de email (iframe) */
.email-preview-frame {
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 8px;
  margin-top: 8px;
}
.email-preview-frame legend {
  font-size: 12px;
  padding: 0 4px;
  color: var(--color-muted);
}

/* Bulk groups table dentro do modal */
.email-bulk-groups {
  margin-top: 12px;
  max-height: 280px; overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: 4px;
}
.email-bulk-groups table { width: 100%; border-collapse: collapse; font-size: 13px; }
.email-bulk-groups th {
  position: sticky; top: 0;
  background: var(--color-bg);
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-size: 12px;
}
.email-bulk-groups td { padding: 6px 8px; border-bottom: 1px solid var(--color-border); }
.email-bulk-groups input { width: 100%; padding: 4px; font-size: 13px; }

/* Drawer lateral (right) */
.drawer-backdrop {
  position: fixed;
  top: var(--topbar-h, 64px);    /* não cobre a topbar — utilizador continua a poder mudar de módulo */
  left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 990;
}
.drawer {
  position: fixed;
  top: var(--topbar-h, 64px);    /* idem — drawer começa abaixo da topbar */
  right: 0; bottom: 0;
  width: min(560px, 100%);
  background: var(--color-surface);          /* sem isto o drawer fica transparente e a lista por baixo vaza */
  color: var(--color-text);
  box-shadow: -8px 0 20px rgba(0, 0, 0, 0.2);
  z-index: 991;                              /* acima do .drawer-backdrop (990) */
  overflow-y: auto;                          /* conteúdo comprido faz scroll dentro do painel */
}
/* Variante larga — ecrãs com formulários densos (ex.: Relatório interno do
   Suporte Field, com N máquinas + descrições). Não afeta os drawers normais. */
.drawer.drawer--wide {
  width: min(860px, 96%);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: -8px 0 20px rgba(0, 0, 0, 0.2);
  z-index: 995;
  display: flex; flex-direction: column;
  animation: drawer-slide-in 0.2s ease-out;
  /* garantir que NÃO é translúcido — alguns temas dark colocavam alpha em --color-surface */
  background-clip: padding-box;
}
@keyframes drawer-slide-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.drawer-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex; justify-content: space-between; align-items: center;
}
.drawer-header h2 { margin: 0; font-size: 16px; }
.drawer-header .muted { color: var(--color-muted); font-weight: normal; margin-left: 8px; }
.drawer-close {
  background: transparent; border: none;
  font-size: 18px; cursor: pointer;
  color: var(--color-muted);
}
.drawer-body { padding: 16px; overflow-y: auto; flex: 1; }
.drawer-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
}

/* Drawer tabs (sub-navegação dentro do drawer, ex: cliente) */
.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}
.drawer-tabs button {
  background: transparent; border: none;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--color-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.drawer-tabs button:hover { color: var(--color-text); }
.drawer-tabs button.is-active {
  color: var(--color-text);
  border-bottom-color: #0d6efd;
  font-weight: 600;
}

/* Drawer: kv grid para metadata */
.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.kv-grid > div {
  display: flex; flex-direction: column; gap: 2px;
}
.kv-grid label {
  font-size: 11px; text-transform: uppercase;
  color: var(--color-muted); letter-spacing: 0.5px;
}

.doc-lines { margin-top: 16px; }
.doc-lines h3 { font-size: 13px; margin-bottom: 8px; }
.doc-lines table.t {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.doc-lines table.t th, .doc-lines table.t td {
  padding: 6px 8px; border-bottom: 1px solid var(--color-border);
}
.doc-lines table.t th { text-align: left; font-weight: 600; color: var(--color-muted); }

.doc-notes { margin-top: 16px; }
.doc-notes h3 { font-size: 13px; margin-bottom: 8px; }

/* Bulk actions bar (acima da tabela) */
.bulk-actions-bar {
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  display: flex; gap: 8px; align-items: center;
}

/* Row selecionada na tabela */
.shell-table tr.row-selected td { background: rgba(13, 110, 253, 0.08); }

/* Cell clicável (toda a row excepto checkbox) */
.row-clickable { cursor: pointer; }

/* Filtros por coluna (input pequeno em row própria) */
.filter-row th { padding: 4px 6px; background: var(--color-bg); }
.filter-input {
  width: 100%; padding: 3px 6px; font-size: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 3px;
}

/* Botões */
.btn {
  padding: 8px 14px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text);
  border-radius: 4px; cursor: pointer;
  transition: background 0.15s;
}
.btn:hover:not(:disabled) { background: var(--color-bg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: #0d6efd; color: white; border-color: #0d6efd;
}
.btn-primary:hover:not(:disabled) { background: #0a58ca; }
.btn-secondary { /* default styling */ }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Round 4d — Sales Clientes (Onboarding) */
.sys-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 10px; font-weight: 700;
  background: var(--color-bg);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}
.sys-dot.is-on {
  background: #28a745;
  color: white;
  border-color: #28a745;
}

.vat-result-header {
  display: flex; align-items: center;
  padding: 10px 12px;
  background: rgba(40, 167, 69, 0.08);
  border-radius: 6px;
  margin-bottom: 12px;
}
.vat-result-vies {
  padding: 10px 12px;
  background: var(--color-bg);
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

.vat-systems-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.vat-systems-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--color-bg);
  border-radius: 6px;
}
.vat-system-icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.vat-system-icon.is-found {
  background: rgba(40, 167, 69, 0.15);
  color: #28a745;
}
.vat-system-icon.is-error {
  background: rgba(255, 193, 7, 0.15);
  color: #ff9800;
}
.vat-system-icon.is-none {
  background: var(--color-border);
  color: var(--color-muted);
}

/* Round 4c — Faturação Automática */
.automacao-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .automacao-layout { grid-template-columns: 1fr; }
}

.automacao-list__header {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--color-muted); font-weight: 600;
  padding: 0 4px 8px;
}

.automacao-card {
  display: flex; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  cursor: pointer;
  transition: all 0.15s;
}
.automacao-card:hover { background: var(--color-bg); }
.automacao-card.is-selected {
  border-color: var(--color-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.automacao-card__avatar {
  width: 38px; height: 38px; border-radius: 9px;
  background: rgba(250, 204, 79, 0.2); color: #1D1131;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
[data-theme="dark"] .automacao-card__avatar { color: #FACC4F; background: rgba(250, 204, 79, 0.15); }

.automacao-detail {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
}
.automacao-detail__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.automacao-detail__schedule-info {
  margin-top: 12px; padding: 8px 12px;
  background: var(--color-bg);
  border-radius: 6px; font-size: 12px;
}
.automacao-detail__section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.automacao-detail__section:last-child { border-bottom: none; }
.automacao-detail__section h3 { margin: 0; font-size: 14px; font-weight: 600; }
.automacao-detail__section-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 8px;
}

/* Add customer modal rows */
.add-customer-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.add-customer-row:hover { background: var(--color-bg); }
.add-customer-row.is-selected {
  background: rgba(250, 204, 79, 0.1);
  border-left-color: #FACC4F;
}
.add-customer-avatar {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(250, 204, 79, 0.18); color: #1D1131;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
  flex-shrink: 0;
}
[data-theme="dark"] .add-customer-avatar { color: #FACC4F; background: rgba(250, 204, 79, 0.15); }

/* Switch atom */
.switch {
  width: 36px; height: 20px;
  background: var(--color-border);
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.switch::after {
  content: ''; position: absolute;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.switch.switch--on {
  background: #28a745;
}
.switch.switch--on::after { left: 18px; }

/* SQL editor (inline-styled como o legacy) */
.sql-editor {
  background: #1D1131;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 12px;
  font-family: 'JetBrains Mono', 'Menlo', 'Monaco', monospace;
  font-size: 12px;
  line-height: 20px;
  color: #E8E2F1;
}
.sql-editor__header {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  color: #B8AFCE;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sql-dot { width: 10px; height: 10px; border-radius: 50%; }
.sql-editor__body {
  display: flex;
  min-height: 200px;
  max-height: 50vh;
  overflow: auto;
}
.sql-editor__gutter {
  padding: 12px 8px 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  color: #6E5E8D;
  text-align: right;
  user-select: none;
  flex-shrink: 0;
  min-width: 30px;
}
.sql-editor__code {
  position: relative;
  flex: 1;
  padding: 12px 16px;
}
.sql-editor__textarea {
  position: absolute; inset: 12px 16px;
  width: calc(100% - 32px); height: calc(100% - 24px);
  background: transparent;
  border: none; outline: none; resize: none;
  color: transparent;
  caret-color: #FACC4F;
  font: inherit;
  padding: 0;
  z-index: 2;
}
.sql-editor__highlight {
  white-space: pre-wrap;
  word-wrap: break-word;
}
.sql-kw  { color: #FACC4F; font-weight: 600; }
.sql-fn  { color: #4FC3F7; }
.sql-num { color: #C5E1A5; }
.sql-str { color: #FFB74D; }
.sql-cmt { color: #6E5E8D; font-style: italic; }
.sql-op  { color: #B39DDB; }

/* Toast (notificações) */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 2000;
  font-size: 13px; font-weight: 500;
  animation: toast-in 0.2s ease-out;
}
.toast--success { border-left: 3px solid #28a745; }
.toast--error   { border-left: 3px solid #dc3545; }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* Round 4b — Guias screen: chips, pagination, banners */
.chip-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin: 12px 0;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  font-size: 13px; cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { background: var(--color-bg); }
.chip--active {
  background: var(--color-text);
  color: var(--color-surface);
  border-color: var(--color-text);
  font-weight: 600;
}
.chip__count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.08);
  font-size: 11px; font-weight: 600;
}
.chip--active .chip__count { background: rgba(255, 255, 255, 0.25); }

.shell-pill--info { background: rgba(13, 110, 253, 0.1); color: #0d6efd; }

.shell-select {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 4px;
  font-size: 13px;
}

.guias-pagination {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 4px; margin-top: 4px;
  border-top: 1px solid var(--color-border);
}

.bulk-result-banner {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(40, 167, 69, 0.1);
  border: 1px solid rgba(40, 167, 69, 0.3);
  position: relative;
}
.bulk-result-banner.partial {
  background: rgba(255, 193, 7, 0.1);
  border-color: rgba(255, 193, 7, 0.3);
}
.bulk-result-banner__close {
  position: absolute; top: 8px; right: 8px;
  background: transparent; border: none; cursor: pointer;
  color: var(--color-muted);
  font-size: 14px;
}
.bulk-result-banner details ul {
  margin-top: 4px; padding-left: 16px;
  font-size: 12px;
}

/* Round 4a — Dashboard Finance v2 */
.dashboard-screen { padding-bottom: 32px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0 20px;
}
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 96px;
  position: relative;
  overflow: hidden;
}
.kpi-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--color-muted); font-weight: 600;
}
.kpi-value {
  font-size: 28px; font-weight: 700; line-height: 1.1;
  color: var(--color-text);
}
.kpi-meta {
  font-size: 11px; color: var(--color-muted);
}
.kpi-hero { background: linear-gradient(135deg, rgba(250,204,79,0.18), rgba(250,204,79,0.04)); border-color: rgba(250,204,79,0.4); }
.kpi-indigo { background: linear-gradient(135deg, rgba(13,110,253,0.10), rgba(13,110,253,0.02)); }
.kpi-error  { border-color: rgba(220, 53, 69, 0.4); }
.kpi-error .kpi-value { color: #dc3545; }

.dash-grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 800px) { .dash-grid-2-1 { grid-template-columns: 1fr; } }

.dash-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 16px;
}
.dash-card__title {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px;
}
.dash-card__title h3 { margin: 0; font-size: 14px; font-weight: 600; }
.dash-link {
  font-size: 12px; color: #0d6efd; text-decoration: none;
}
.dash-link:hover { text-decoration: underline; }

.dash-chart { display: block; }

.dash-legend {
  display: flex; gap: 16px; margin-top: 8px;
  font-size: 11px; color: var(--color-muted);
}
.dash-legend .dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 3px; margin-right: 4px;
}

.dash-integ {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.dash-integ li {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px;
}
.integ-logo {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.integ-logo--vendiot { background: #1D1131; color: #FACC4F; }
.integ-logo--moloni  { background: #00a651; color: white; }
.integ-logo--hubspot { background: #ff7a59; color: white; }
.dash-integ strong { flex: 1; font-size: 13px; }

.dash-runs, .dash-errors, .dash-top-customers {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.dash-runs li, .dash-errors li, .dash-top-customers li {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 0;
}
.dash-errors__icon {
  width: 28px; height: 28px; border-radius: 6px;
  background: rgba(220, 53, 69, 0.1); color: #dc3545;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dash-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(250, 204, 79, 0.2); color: #1D1131;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
  flex-shrink: 0;
}
[data-theme="dark"] .dash-avatar { color: #FACC4F; background: rgba(250, 204, 79, 0.15); }

/* Round 3 — invoice editor + cancel + autocomplete */

.btn-danger {
  background: #dc3545; color: white; border-color: #dc3545;
}
.btn-danger:hover:not(:disabled) { background: #bd2130; }

/* Autocomplete (cliente + produto) */
.autocomplete-results {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 20;
  margin: 0; padding: 0;
  list-style: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.autocomplete-results li {
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
}
.autocomplete-results li:hover { background: var(--color-bg); }
.autocomplete-results li:last-child { border-bottom: none; }
.autocomplete-results small { color: var(--color-muted); font-size: 11px; }

.customer-selected {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

/* Invoice editor */
.invoice-editor-modal { max-width: 1100px; }
.invoice-editor__header { margin-bottom: 16px; }
.form-row-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
@media (max-width: 720px) {
  .form-row-grid { grid-template-columns: 1fr 1fr; }
}
.invoice-editor__lines { margin-top: 16px; }
.invoice-editor__lines h3 { font-size: 14px; margin-bottom: 8px; }
.invoice-editor__lines input[type="number"] {
  width: 100%; padding: 4px 6px; font-size: 13px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 3px;
}
.invoice-editor__totals {
  margin-top: 16px;
  padding: 12px;
  background: var(--color-bg);
  border-radius: 6px;
  display: flex; flex-direction: column; gap: 4px;
  align-items: flex-end;
}

/* Dropdown de artigos (painel Adicionar ao plano — Kitting) */
.artigo-dropdown {
  margin-top: 6px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
}
.artigo-dropdown--empty {
  padding: 12px 14px;
  color: var(--color-muted);
  font-size: 13px;
}
.artigo-dropdown__row {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.12s ease;
}
.artigo-dropdown__row:last-child { border-bottom: none; }
.artigo-dropdown__row:hover {
  background: color-mix(in srgb, var(--color-primary, #2563eb) 10%, transparent);
}
.artigo-dropdown__name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}
.artigo-dropdown__ref {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.artigo-dropdown__code {
  font-family: monospace;
  font-size: 12px;
  color: var(--color-muted);
}
.artigo-dropdown__cat {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary, #2563eb);
  background: color-mix(in srgb, var(--color-primary, #2563eb) 12%, transparent);
  padding: 1px 6px;
  border-radius: 10px;
}

/* Sugestões de artigo da encomenda (painel Adicionar ao plano) */
.sugg-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sugg-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.sugg-item:hover {
  border-color: var(--color-primary, #2563eb);
  background: color-mix(in srgb, var(--color-primary, #2563eb) 8%, transparent);
}
.sugg-item--warn { border-color: var(--color-warning, #b45309); }
.sugg-item--warn:hover { background: color-mix(in srgb, var(--color-warning, #b45309) 10%, transparent); }
.sugg-item__qty {
  font-weight: 700; font-size: 13px;
  color: var(--color-primary, #2563eb);
  min-width: 26px; text-align: right;
}
.sugg-item__body { display: flex; flex-direction: column; line-height: 1.25; }
.sugg-item__name { font-size: 12.5px; font-weight: 600; color: var(--color-text); }
.sugg-item__ref { font-family: monospace; font-size: 11px; color: var(--color-muted); }

/* Moradas da NE (origem/destino) */
.invoice-editor__addresses { margin-top: 16px; }
.invoice-editor__addresses h3 { font-size: 14px; margin-bottom: 8px; }
.invoice-editor__addresses .ne-address-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 720px) {
  .invoice-editor__addresses .ne-address-grid { grid-template-columns: 1fr; }
}
.ne-address-block {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  border-radius: 8px;
  padding: 12px 14px;
}
.ne-address-block__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.ne-address-block__head strong { font-size: 13px; }
.ne-address-block__head .req { color: #dc3545; }
.ne-address-block__pick {
  margin-left: auto;
  max-width: 220px;
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 4px;
}
.ne-address-block input[type="text"] {
  padding: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 4px;
  font-size: 14px;
}
.ne-address-block .form-row { margin-bottom: 0; }

/* Cancel invoice modal */
.cancel-invoice-modal { max-width: 600px; }
.cancel-confirm-box {
  padding: 12px;
  background: rgba(220, 53, 69, 0.06);
  border: 1px solid rgba(220, 53, 69, 0.2);
  border-radius: 4px;
}
.cancel-confirm-box label {
  font-size: 13px;
  line-height: 1.4;
}

/* Progress bar (bulk jobs) */
.progress-bar {
  width: 100%;
  height: 12px;
  background: var(--color-border);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar__fill {
  height: 100%;
  background: #0d6efd;
  transition: width 0.3s ease;
}

/* Locale toggle no header */
.locale-toggle {
  display: inline-flex; gap: 2px;
  border: 1px solid var(--color-border); border-radius: 4px;
  overflow: hidden;
}
.locale-toggle button {
  background: transparent; border: none;
  padding: 4px 8px; font-size: 11px;
  cursor: pointer;
  color: var(--color-muted);
  text-transform: uppercase;
}
.locale-toggle button.is-active {
  background: var(--color-bg); color: var(--color-text);
  font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────────────
 * Contact / Address cards (drawer tabs Contactos + Moradas)
 * Cada contacto/morada é uma "card" com fronteiras claras — substitui a
 * tabela densa que misturava emails longos com a row seguinte.
 * ───────────────────────────────────────────────────────────────────── */
.contact-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.contact-card {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  padding: 12px 14px;
  font-size: 13px;
}
.contact-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}
.contact-card__name {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  word-break: break-word;
}
.contact-card__sources {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}
.contact-card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.contact-card__row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}
.contact-card__icon {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  color: var(--color-muted);
  font-size: 13px;
}
.contact-card__roles {
  flex-wrap: wrap;
  margin-top: 4px;
}
.contact-card__role-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: 11px;
  color: var(--color-muted);
  white-space: nowrap;
}
.contact-card__address-meta {
  gap: 12px;
  font-size: 12px;
  color: var(--color-muted);
  padding-left: 26px;
}

/* ─────────────────────────────────────────────────────────────────────
 * Clientes Master — tabela
 * Tabela densa mas legível: header sticky, zebra sutil, hover, linhas
 * compactas, bordas claras, truncate em colunas que podem ser longas.
 * ───────────────────────────────────────────────────────────────────── */
.clientes-table-wrap {
  margin-top: 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-surface);
}
.clientes-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}
.clientes-table thead {
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 2;
}
.clientes-table th {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  text-align: left;
  position: relative;  /* Para o .col-resize-handle posicionar */
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.clientes-table tbody tr {
  cursor: pointer;
  transition: background 0.1s ease;
  border-bottom: 1px solid var(--color-border);
}
.clientes-table tbody tr:last-child {
  border-bottom: none;
}
.clientes-table tbody tr:hover {
  background: var(--color-bg);
}
.clientes-table td {
  padding: 8px 12px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Drag handle para redimensionar colunas (usado na coluna Nome).
   Posicionado na borda direita do <th>. Sempre visível com linha vertical
   subtil; no hover passa a ser uma barra azul espessa. */
.col-resize-handle {
  position: absolute;
  top: 6px;
  right: 0;
  bottom: 6px;
  width: 8px;
  cursor: col-resize;
  user-select: none;
  -webkit-user-select: none;
  z-index: 3;
  /* Linha vertical visível por defeito (centrada no espaço de 8px) */
  background:
    linear-gradient(to right,
      transparent 3px,
      var(--color-border) 3px,
      var(--color-border) 5px,
      transparent 5px);
  transition: background 0.15s ease;
}
.col-resize-handle:hover {
  background:
    linear-gradient(to right,
      transparent 2px,
      var(--color-primary) 2px,
      var(--color-primary) 6px,
      transparent 6px);
}
.col-resize-handle:active {
  background:
    linear-gradient(to right,
      transparent 1px,
      var(--color-primary) 1px,
      var(--color-primary) 7px,
      transparent 7px);
}

/* Larguras das colunas */
.clientes-table__col-name    { width: auto; }       /* flex — ocupa espaço restante */
.clientes-table__col-nif     { width: 100px; }
.clientes-table__col-email   { width: 220px; }
.clientes-table__col-city    { width: 150px; }
.clientes-table__col-sources { width: 90px; text-align: center; }
.clientes-table__col-locs    { width: 60px; text-align: right; }
.clientes-table__sources     { text-align: center; }
.clientes-table__locs        { text-align: right; }
/* Cell content */
.clientes-table__name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.clientes-table__name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.clientes-table__match-badge {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(234, 88, 12, 0.15);
  color: #ea580c;
  border: 1px solid rgba(234, 88, 12, 0.3);
}
.clientes-table__nif {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--color-text);
}
.clientes-table__email,
.clientes-table__city {
  color: var(--color-text);
}
.clientes-table__empty {
  color: var(--color-muted);
  opacity: 0.5;
}
.clientes-table__loc-count {
  display: inline-block;
  min-width: 24px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
  font-weight: 600;
  font-size: 12px;
}
.clientes-table__empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--color-muted);
}

/* Source chips (M/V/H) — só mostra fontes presentes */
.src-chips {
  display: inline-flex;
  gap: 3px;
  justify-content: center;
}
.src-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0;
}
.src-chip--moloni  { background: #16a34a; }
.src-chip--vendiot { background: #2563eb; }
.src-chip--hubspot { background: #ea580c; }

/* ─────────────────────────────────────────────────────────────────────
 * Clientes Merge/Deduplicar
 * ───────────────────────────────────────────────────────────────────── */
.merge-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.merge-stat-pill {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px 14px;
  min-width: 120px;
}
.merge-stat-pill--highlight {
  background: rgba(99, 102, 241, 0.1);
  border-color: #6366f1;
}
.merge-stat-pill__value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.merge-stat-pill__label {
  font-size: 11px;
  color: var(--color-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.merge-empty {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
  color: #16a34a;
  font-size: 16px;
}
.merge-clusters {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.merge-cluster {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}
.merge-cluster__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
.merge-cluster__reason {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
}
.merge-cluster__reason--email {
  background: rgba(234, 88, 12, 0.15);
  color: #ea580c;
}
.merge-cluster__reason--email-name {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}
.merge-cluster__actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.merge-cluster__entries {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1px;
  background: var(--color-border);
}
.merge-entry {
  background: var(--color-surface);
  padding: 12px;
  position: relative;
}
.merge-entry--master {
  background: rgba(99, 102, 241, 0.06);
}
.merge-entry__master-badge {
  font-size: 10px;
  font-weight: 700;
  color: #6366f1;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.merge-entry__name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}
.merge-field {
  display: flex;
  gap: 8px;
  font-size: 12px;
  padding: 2px 0;
}
.merge-field__label {
  width: 60px;
  flex-shrink: 0;
  color: var(--color-muted);
  font-weight: 500;
}
.merge-field__value {
  flex: 1;
  word-break: break-all;
  color: var(--color-text);
}
.merge-field__value--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}
.merge-field--conflict {
  background: rgba(234, 179, 8, 0.1);
  margin: 0 -4px;
  padding: 2px 4px;
  border-radius: 3px;
}
.merge-cluster__proposal {
  padding: 12px 16px;
  background: rgba(34, 197, 94, 0.06);
  border-top: 1px solid var(--color-border);
}
.merge-cluster__proposal-title {
  font-size: 11px;
  font-weight: 700;
  color: #16a34a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.merge-proposal-row {
  display: flex;
  gap: 8px;
  font-size: 12px;
  padding: 1px 0;
}
.merge-proposal-row__label {
  width: 70px;
  color: var(--color-muted);
}
.merge-proposal-row__val {
  flex: 1;
  font-weight: 500;
  word-break: break-word;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
}
.btn-sm:hover { background: var(--color-bg); }
.btn-sm.btn-primary {
  /* --color-primary não existe → o botão ficava com fundo neutro claro e texto
     branco (invisível no tema claro). Alinhado com .btn-primary base (#0d6efd). */
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
}
.btn-sm.btn-primary:hover:not(:disabled) { background: #0a58ca; }
.btn-sm:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── CRM Deals — vista kanban ─────────────────────────────────────── */
.btn-xs {
  font-size: 11px;
  padding: 2px 6px;
  line-height: 1.4;
}
.btn-xs:disabled { opacity: 0.35; cursor: not-allowed; }

.crm-kanban {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 12px 0 16px;
  align-items: flex-start;
}
.crm-kanban__col {
  flex: 0 0 260px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}
.crm-kanban__col-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.crm-kanban__col-title { font-weight: 600; font-size: 13px; flex: 1; }
.crm-kanban__col-meta  { font-size: 11px; color: var(--color-muted); white-space: nowrap; }
.crm-kanban__col-prob  {
  font-size: 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1px 6px;
  color: var(--color-muted);
}
.crm-kanban__col-body {
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.crm-kanban__empty {
  text-align: center;
  color: var(--color-muted);
  font-size: 12px;
  padding: 8px 0;
}
.crm-deal-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px 10px;
}
.crm-deal-card__name   { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.crm-deal-card__client { font-size: 11px; color: var(--color-muted); margin-bottom: 4px; }
.crm-deal-card__amount { font-size: 13px; color: var(--color-primary); font-weight: 600; margin-bottom: 6px; }
.crm-deal-card__actions { display: flex; gap: 4px; }

.crm-client-results {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
}
.crm-client-result {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border: none;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  font-size: 13px;
}
.crm-client-result:last-child { border-bottom: none; }
.crm-client-result:hover { background: var(--color-bg); }

/* Card clicável + autor + arrastável */
.crm-deal-card--clickable { cursor: grab; }
.crm-deal-card--clickable:active { cursor: grabbing; }
.crm-deal-card--clickable:hover { border-color: var(--color-primary); }
.crm-deal-card--dragging { opacity: 0.4; }
.crm-deal-card__author { font-size: 10px; color: var(--color-muted); margin-top: 4px; font-style: italic; }

/* Card enriquecido: linha valor+data, rodapé com owner */
.crm-deal-card__row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.crm-deal-card__date { font-size: 11px; color: var(--color-muted); white-space: nowrap; }
.crm-deal-card__date--overdue { color: var(--color-danger, #d33); font-weight: 600; }
.crm-deal-card__foot { display: flex; align-items: center; gap: 6px; }
.crm-deal-card__owner { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--color-muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-deal-card__avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  font-size: 9px; font-weight: 700; flex-shrink: 0;
}

/* Barra de filtros do board de deals */
.crm-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.crm-filters__search { flex: 1; min-width: 220px; max-width: 420px; }

/* ── Dashboard de Sales ── */
.dash-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 900px) { .dash-cols { grid-template-columns: 1fr; } }
.dash-panel {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--color-surface, transparent);
}
.dash-panel__title { margin: 0 0 12px; font-size: 14px; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-table th { text-align: left; font-size: 11px; color: var(--color-muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--color-border); }
.dash-table td { padding: 5px 6px; border-bottom: 1px solid var(--color-border); }
.dash-table tr:last-child td { border-bottom: none; }

/* Funil por etapa (barras horizontais) */
.sales-funnel { display: flex; flex-direction: column; gap: 10px; }
.sales-funnel__row { display: flex; flex-direction: column; gap: 3px; }
.sales-funnel__head { display: flex; justify-content: space-between; font-size: 12px; gap: 8px; }
.sales-funnel__name { font-weight: 600; }
.sales-funnel__meta { color: var(--color-muted); white-space: nowrap; }
.sales-funnel__track { height: 10px; background: var(--color-bg); border-radius: 6px; overflow: hidden; }
.sales-funnel__bar { height: 100%; background: var(--color-primary); border-radius: 6px; transition: width .3s ease; }
.sales-funnel__bar--won  { background: var(--color-success, #2e7d32); }
.sales-funnel__bar--lost { background: var(--color-danger, #d33); }

/* Barra de temperatura no topo da coluna (cor inline via probColor) */
.crm-kanban__col-bar { height: 3px; border-radius: 8px 8px 0 0; }
/* Colunas terminais: leve tonalidade de fundo */
.crm-kanban__col--won  .crm-kanban__col-head { background: color-mix(in srgb, var(--color-success, #2e7d32) 8%, var(--color-surface)); }
.crm-kanban__col--lost .crm-kanban__col-head { background: color-mix(in srgb, var(--color-danger, #d33) 8%, var(--color-surface)); }

/* Coluna realçada durante drag-over (drop zone) */
.crm-kanban__col--over {
  outline: 2px dashed var(--color-primary);
  outline-offset: -2px;
}
.crm-kanban__col--over .crm-kanban__col-body { background: var(--color-bg); }

/* Toggle de vista (Kanban / Por pessoa, Criador / Responsável) */
.crm-viewtoggle {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
}
.crm-viewtoggle button {
  border: none;
  background: var(--color-surface);
  color: var(--color-text);
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}
.crm-viewtoggle button.active { background: var(--color-primary); color: #fff; }
.crm-viewtoggle button:not(:last-child) { border-right: 1px solid var(--color-border); }

/* Vista por pessoa (estilo Jira) */
.crm-byperson { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }
.crm-person-group {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  overflow: hidden;
}
.crm-person-group__head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
}
.crm-person-group__head:hover { background: var(--color-bg); }
.crm-person-group__caret { font-size: 12px; color: var(--color-muted); width: 12px; }
.crm-person-group__avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.crm-person-group__name { font-weight: 600; }
.crm-person-group__meta { color: var(--color-muted); font-size: 12px; }
.crm-person-group__body { border-top: 1px solid var(--color-border); }
.crm-person-row {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px 14px 8px 36px;
  border-top: 1px solid var(--color-border);
  cursor: pointer;
  font-size: 13px;
}
.crm-person-row:first-child { border-top: none; }
.crm-person-row:hover { background: var(--color-bg); }
.crm-person-row__name   { font-weight: 600; }
.crm-person-row__client { color: var(--color-muted); }
.crm-person-row__amount { text-align: right; color: var(--color-primary); font-weight: 600; }

/* Timeline / comentários no drawer do deal */
.crm-comment-box { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; margin-bottom: 12px; }
.crm-timeline { display: flex; flex-direction: column; gap: 8px; }
.crm-timeline__item {
  border-left: 2px solid var(--color-border);
  padding: 4px 0 4px 10px;
}
.crm-timeline__item--comment { border-left-color: var(--color-primary); }
.crm-timeline__item--stage_change { border-left-color: var(--color-muted); }
.crm-timeline__body { font-size: 13px; }
.crm-timeline__date { font-size: 11px; color: var(--color-muted); margin-top: 2px; }

/* ── DealDrawer: form de edição inline ── */
.crm-edit-form { display: flex; flex-direction: column; gap: 4px; }
.crm-edit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.crm-edit-row > div { display: flex; flex-direction: column; gap: 4px; }

/* ── DealDrawer: line items (artigos) ── */
.crm-lineitems { border: 1px solid var(--color-border); border-radius: 6px; overflow: hidden; }
.crm-lineitems__head,
.crm-lineitems__row {
  display: grid;
  grid-template-columns: 70px 1fr 50px 70px 56px 80px 28px;
  gap: 4px;
  align-items: center;
  padding: 4px 6px;
}
.crm-lineitems__head {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-muted);
  background: var(--color-surface-alt, var(--color-bg));
  border-bottom: 1px solid var(--color-border);
}
.crm-lineitems__row { border-bottom: 1px solid var(--color-border); }
.crm-lineitems__row:last-of-type { border-bottom: none; }
.crm-lineitems__row .shell-search { padding: 4px 6px; font-size: 12px; }
.crm-lineitems__total { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.crm-lineitems__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--color-surface-alt, var(--color-bg));
  border-top: 1px solid var(--color-border);
  font-size: 13px;
}

/* ── Settings de pipelines/stages ── */
.crm-pipeline-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--color-surface, transparent);
}
.crm-pipeline-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.crm-pipeline-new {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  max-width: 480px;
}
.crm-stages-table { display: flex; flex-direction: column; border: 1px solid var(--color-border); border-radius: 6px; overflow: hidden; }
.crm-stages-table__head,
.crm-stages-table__row {
  display: grid;
  grid-template-columns: 78px 1fr 90px 70px 60px 80px;
  gap: 8px;
  align-items: center;
  padding: 5px 8px;
}
.crm-stages-table__head {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-muted);
  background: var(--color-surface-alt, var(--color-bg));
  border-bottom: 1px solid var(--color-border);
}
.crm-stages-table__row { border-bottom: 1px solid var(--color-border); }
.crm-stages-table__row:last-child { border-bottom: none; }
.crm-stages-table__row .shell-search { padding: 4px 6px; font-size: 12px; }
.crm-stages-table__order { display: flex; gap: 2px; }
.crm-stages-table__chk { display: flex; justify-content: center; }
.crm-stages-table__actions { display: flex; gap: 4px; justify-content: flex-end; }
.crm-stages-table__empty { padding: 12px; font-size: 12px; color: var(--color-muted); }

/* ════════════════════════════════════════════════════════════════════
   HARDWARE — estilos scoped (prefixo hw-). NÃO mexer no global.
   Reparações, Fornecedores, Kitting. Tokens: --success/--warning/--danger.
   ════════════════════════════════════════════════════════════════════ */

/* Form dentro do drawer: corpo com scroll + barra de ações fixa em baixo
   (resolve o corte dos botões "Criar/Cancelar"). */
.hw-form {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.hw-form__fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-bottom: 12px;
}
.hw-field { display: flex; flex-direction: column; gap: 5px; }
.hw-field > label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--color-muted); font-weight: 600;
}
.hw-field input,
.hw-field select,
.hw-field textarea {
  width: 100%;
  box-sizing: border-box;          /* impede overflow dos botões/inputs */
  padding: 9px 11px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  font-size: 13px;
}
.hw-field input:focus,
.hw-field select:focus,
.hw-field textarea:focus {
  outline: none;
  border-color: var(--color-primary, #6c5ce7);
  box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.18);
}
.hw-field textarea { min-height: 64px; resize: vertical; }
.hw-field__row { display: flex; gap: 10px; }
.hw-field__row > .hw-field { flex: 1; }
.hw-form__hint { font-size: 12px; color: var(--color-muted); margin: 0; }
.hw-form__actions {
  display: flex; gap: 8px; justify-content: flex-end;
  padding-top: 12px; margin-top: 4px;
  border-top: 1px solid var(--color-border);
}

/* Chips de estado coloridos */
.hw-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: capitalize;
  background: var(--color-border);
  color: var(--color-text);
  white-space: nowrap;
}
/* entradas de fornecedor / genéricos */
.hw-chip--aberto      { background: rgba(245,158,11,0.18); color: var(--warning); }
.hw-chip--concluido   { background: rgba(43,182,115,0.16); color: var(--success); }
.hw-chip--cancelado   { background: rgba(229,57,53,0.12);  color: var(--danger); }
/* reparações */
.hw-chip--recebido    { background: rgba(108,92,231,0.16); color: #8b7bf0; }
.hw-chip--diagnostico { background: rgba(13,110,253,0.16); color: #4d94ff; }
.hw-chip--reparacao   { background: rgba(245,158,11,0.18); color: var(--warning); }
.hw-chip--qa          { background: rgba(13,110,253,0.16); color: #4d94ff; }
.hw-chip--pronto      { background: rgba(43,182,115,0.16); color: var(--success); }
.hw-chip--devolvido   { background: rgba(43,182,115,0.12); color: var(--success); }
.hw-chip--incobravel  { background: rgba(229,57,53,0.12);  color: var(--danger); }
/* plataforma de pagamento (kitting): SIBS vs Redsys — mesmo hardware, acquirer diferente */
.hw-chip--sibs   { background: rgba(13,110,253,0.16); color: #4d94ff; text-transform: none; }
.hw-chip--redsys { background: rgba(108,92,231,0.16); color: #8b7bf0; text-transform: none; }
/* estado de integração (Jira) */
.hw-chip--ok     { background: rgba(43,182,115,0.16); color: var(--success); text-transform: none; }
.hw-chip--err    { background: rgba(229,57,53,0.14);  color: var(--danger);  text-transform: none; }
.hw-chip--muted  { background: var(--color-border);    color: var(--color-text-muted, #888); text-transform: none; }
/* encomendas (kitting) */
.hw-chip--to-do       { background: var(--color-border); color: var(--color-muted); }
.hw-chip--in-progress { background: rgba(245,158,11,0.18); color: var(--warning); }
.hw-chip--blocked     { background: rgba(229,57,53,0.12);  color: var(--danger); }
.hw-chip--done        { background: rgba(43,182,115,0.16); color: var(--success); }

/* ── Detalhe de reparação como PÁGINA ── */
.hw-rep-page { }
.hw-rep-page__bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-bottom: 12px; margin-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}
.hw-rep-page__title { margin: 0; font-size: 18px; }
.hw-rep-page__body { }
/* menu ⚙ dropdown */
.hw-rep-menu {
  position: absolute; top: 100%; right: 0; z-index: 20; margin-top: 4px;
  min-width: 230px; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28); padding: 4px; overflow: hidden;
}
.hw-rep-menu__item {
  display: block; width: 100%; text-align: left; border: none; background: none;
  padding: 9px 12px; font-size: 13px; color: var(--color-text); cursor: pointer;
  border-radius: 6px;
}
.hw-rep-menu__item:hover { background: var(--color-bg); }
.hw-rep-menu__item--danger { color: var(--danger); }

/* ── Detalhe de reparação: cabeçalho compacto ── */
.hw-rep-head { margin-bottom: 14px; }
.hw-rep-head__top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.hw-rep-head__nome { font-size: 16px; font-weight: 700; color: var(--color-text); }
.hw-meta-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hw-meta-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 7px;
  background: var(--color-bg); border: 1px solid var(--color-border);
  font-size: 12px; white-space: nowrap;
}
.hw-meta-chip__k { color: var(--color-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; }
.hw-meta-chip__v { color: var(--color-text); font-weight: 600; }

/* ── Detalhe de reparação: tabela de equipamentos com blocos in/out ── */
.hw-rep-lines th, .hw-rep-lines td { font-size: 12.5px; }
.hw-rep-lines__groups th {
  text-align: center; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding-bottom: 2px; border-bottom: 2px solid var(--color-border);
}
.hw-rep-lines__groups .grp--in   { color: var(--color-text); }
.hw-rep-lines__groups .grp--diag { color: var(--warning); }
.hw-rep-lines__groups .grp--out  { color: var(--success); }
/* separador subtil no início de cada bloco (coluna marcada com .b-in) */
.hw-rep-lines th.b-in, .hw-rep-lines td.b-in { border-left: 1px solid var(--color-border); }
.hw-rep-lines__groups .grp { border-left: 1px solid var(--color-border); }
.hw-rep-lines__groups .grp--in { border-left: none; }
/* ── Modal Adicionar/Editar equipamento: fluxo guiado ── */
/* dois campos lado a lado (ex: Nº série + Versão SW) */
.hw-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hw-field-row > .hw-field { margin: 0; }
@media (max-width: 520px) { .hw-field-row { grid-template-columns: 1fr; } }
/* toggle "Mais opções" */
.hw-more-toggle {
  border: none; background: transparent; cursor: pointer;
  color: var(--color-muted); font-size: 12.5px; padding: 6px 0; margin-top: 2px;
  text-align: left;
}
.hw-more-toggle:hover { color: var(--color-text); }
.hw-more { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
/* opção do multi-select de acessórios (checkbox + texto bem alinhados) */
.hw-ac-opt {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 12px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--color-border);
}
.hw-ac-opt:last-child { border-bottom: none; }
.hw-ac-opt:hover { background: var(--color-bg); }
.hw-ac-opt.is-checked { background: color-mix(in srgb, var(--module-purple-fg) 12%, transparent); }
.hw-ac-opt > input[type="checkbox"] { margin: 2px 0 0; flex: 0 0 auto; cursor: pointer; }
.hw-ac-opt__txt { flex: 1 1 auto; line-height: 1.35; }

/* chips dos acessórios selecionados (multi-select) */
.hw-ac-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.hw-ac-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 10px; border-radius: 999px; font-size: 12px;
  background: color-mix(in srgb, var(--module-purple-fg) 12%, transparent);
  border: 1px solid var(--color-border);
}
.hw-ac-chip__x { border: none; background: transparent; cursor: pointer; color: var(--color-muted); font-size: 11px; padding: 0 2px; }
.hw-ac-chip__x:hover { color: var(--danger); }
/* wizard: indicador de passos + chip do kit escolhido */
.hw-steps { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 12px; }
.hw-steps__item { color: var(--color-muted); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--color-border); }
.hw-steps__item.is-active { color: var(--color-text); font-weight: 600; background: color-mix(in srgb, var(--module-purple-fg) 14%, transparent); border-color: var(--module-purple-fg); }
.hw-steps__sep { color: var(--color-muted); }
.hw-kit-chip {
  display: inline-block; padding: 6px 12px; margin: 0 0 12px;
  border-radius: 8px; font-size: 13px;
  background: color-mix(in srgb, var(--module-purple-fg) 10%, transparent);
  border: 1px solid var(--color-border);
}
/* linha de VMU em edição inline (Kitting → Encomendas) */
.shell-table tr.is-editing > td { background: color-mix(in srgb, var(--module-purple-fg) 8%, transparent); }
/* info do kitting (TPA/HUB auto-preenchidos): chips read-only de contexto */
.hw-kit-info {
  display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 6px;
}
.hw-kit-info > span {
  font-size: 11.5px; padding: 3px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--module-purple-fg) 8%, transparent);
  border: 1px solid var(--color-border); color: var(--color-text-secondary, var(--color-text));
}
/* segmented control (geração do kit / tipo de componente) */
.hw-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.hw-seg__btn {
  border: 1px solid var(--color-border); background: var(--color-surface);
  color: var(--color-text); cursor: pointer; border-radius: 6px;
  padding: 6px 12px; font-size: 12.5px;
}
.hw-seg__btn:hover { background: var(--color-bg); }
.hw-seg__btn.is-active {
  background: color-mix(in srgb, var(--module-purple-fg) 16%, transparent);
  border-color: var(--module-purple-fg); color: var(--color-text); font-weight: 600;
}

/* ── Cabeçalho de coluna com funil + popover de filtro (estilo VendIoT/AntD) ── */
.hw-th-filter { position: relative; }
/* inner ocupa a largura do <th> e alinha conforme a coluna (esq por defeito,
   dir nas numéricas), para o cabeçalho ficar em linha com a célula por baixo. */
.hw-th-filter__inner { display: flex; align-items: center; gap: 4px; position: relative; }
.t-num .hw-th-filter__inner { justify-content: flex-end; }
.hw-th-filter__label { white-space: nowrap; }
/* título clicável p/ ordenar — SEM padding horizontal (alinhar com o <td>) */
.hw-th-filter__label--sortable {
  border: none; background: transparent; cursor: pointer;
  font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit;
  padding: 0; border-radius: 4px;
  display: inline-flex; align-items: center; gap: 4px;
}
.hw-th-filter__label--sortable:hover { background: var(--color-bg); color: var(--color-text); }
.hw-th-filter__label--sortable.is-sorted { color: var(--color-text); }
.hw-th-filter__arrow { font-size: 10px; opacity: .5; }
.hw-th-filter__label--sortable.is-sorted .hw-th-filter__arrow { opacity: 1; color: var(--success); }
.hw-th-filter__btn {
  border: none; background: transparent; cursor: pointer;
  color: var(--color-muted); font-size: 12px; line-height: 1;
  padding: 2px 4px; border-radius: 4px;
}
.hw-th-filter__btn:hover { background: var(--color-bg); color: var(--color-text); }
.hw-th-filter__btn.is-active { color: var(--success); background: color-mix(in srgb, var(--success) 16%, transparent); }
/* popover em position:fixed (posicionado via JS) — escapa ao overflow da tabela */
.hw-th-filter__pop {
  position: fixed; z-index: 1000;
  padding: 12px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.28);
  font-weight: 400; text-align: left;
}
.hw-th-filter__field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--color-muted); text-transform: uppercase; letter-spacing: .03em; }
.hw-th-filter__field .filter-input { text-transform: none; letter-spacing: normal; color: var(--color-text); font-size: 13px; }
.hw-th-filter__pop-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }

/* linha clicável (abre edição) + estado selecionado */
.hw-rep-lines__row.is-clickable { cursor: pointer; }
.hw-rep-lines__row.is-clickable:hover td { background: var(--color-bg); }
.hw-rep-lines__row.is-sel td { background: color-mix(in srgb, var(--module-purple-fg) 14%, transparent); }
.hw-rep-lines__row.is-sel.is-clickable:hover td { background: color-mix(in srgb, var(--module-purple-fg) 20%, transparent); }
.hw-rep-lines input[type="checkbox"] { cursor: pointer; }

/* Empty state cuidado */
.hw-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 40px 16px; color: var(--color-muted); text-align: center;
}
.hw-empty__icon { font-size: 32px; opacity: 0.5; }
.hw-empty__title { font-weight: 600; color: var(--color-text); }
.hw-empty__hint { font-size: 13px; }

/* Drawer: secção de detalhe com título e pílulas de transição de estado */
.hw-detail-section { margin-top: 18px; }
.hw-detail-section__title {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--color-muted); font-weight: 700; margin: 0 0 8px;
}
.hw-state-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.hw-state-btn {
  padding: 5px 11px; border-radius: 999px; font-size: 12px; cursor: pointer;
  background: var(--color-bg); border: 1px solid var(--color-border);
  color: var(--color-text);
}
.hw-state-btn:hover:not(:disabled) { border-color: var(--color-primary, #6c5ce7); }
.hw-state-btn:disabled { opacity: 0.45; cursor: default; }

/* Linha de adicionar item (fornecedor) */
.hw-additem { display: flex; gap: 6px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.hw-additem input {
  box-sizing: border-box; padding: 7px 9px; border-radius: 7px;
  background: var(--color-bg); border: 1px solid var(--color-border); color: var(--color-text); font-size: 13px;
}

/* Hardware: opções do dropdown de pesquisa de cliente (Reparações Fase 2A) */
.hw-cli-opt:hover { background: var(--color-bg); }

/* Input numérico sem as setas de incremento (spinner) — usado nos campos
   Qtd/Preço/Desconto das linhas da Guia de Transporte (kitting). */
.no-spin::-webkit-outer-spin-button,
.no-spin::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.no-spin { -moz-appearance: textfield; appearance: textfield; }

/* ── Sino de notificações (topbar) ──────────────────────────────────────── */
.notif { position: relative; display: inline-flex; }
.notif__btn { position: relative; }
.notif__badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--color-card);
}
.notif__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  z-index: 950;
  overflow: hidden;
}
.notif__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
}
.notif__head strong { font-size: 14px; color: var(--color-text); }
.notif__markall {
  background: none; border: none; cursor: pointer;
  color: var(--color-primary); font-size: 12px; padding: 2px 4px;
}
.notif__markall:hover { text-decoration: underline; }
.notif__list { max-height: 420px; overflow-y: auto; }
.notif__empty { padding: 24px 14px; text-align: center; color: var(--color-muted); font-size: 13px; }
.notif__item {
  display: block; width: 100%; text-align: left;
  padding: 12px 14px;
  background: none; border: none; border-bottom: 1px solid var(--color-border);
  cursor: pointer;
}
.notif__item:last-child { border-bottom: none; }
.notif__item:hover { background: var(--color-bg); }
.notif__item.is-unread { background: var(--brand-indigo-soft); }
.notif__item.is-unread:hover { background: var(--color-bg); }
.notif__item-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--color-text);
}
.notif__dot {
  flex: 0 0 auto;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--color-primary);
}
.notif__item-body {
  margin-top: 4px;
  font-size: 12px; color: var(--color-muted);
  white-space: pre-line;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif__item-time { margin-top: 6px; font-size: 11px; color: var(--color-muted); }

/* ── Selects uniformes (loul 2026-07-22) ────────────────────────────────────
   Um aspeto consistente e polido para TODOS os <select> dos módulos, igual ao
   look que ficou bom nos Tickets (borda arredondada, seta própria, foco, dark).
   Aplica-se como BASE via `.module-frame select` (herda a todos os screens, sem
   editar cada ficheiro) e via a classe `.shell-select`/`.hub-select` para uso
   explícito. Sem !important → quem tiver estilo inline deliberado continua a
   mandar. A seta é um SVG inline (data-uri) — self-contained, sem pedido externo. */
.module-frame select,
.shell-select,
.hub-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding: 8px 32px 8px 10px;          /* espaço à direita para a seta */
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background-color: var(--color-card, var(--color-surface, #fff));
  color: var(--color-text);
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  /* seta ▾ desenhada (cinza neutro, lê-se bem em claro e escuro) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5l3.5 3.5 3.5-3.5' fill='none' stroke='%238a8f98' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.module-frame select:hover,
.shell-select:hover,
.hub-select:hover { border-color: var(--color-muted); }
.module-frame select:focus,
.shell-select:focus,
.hub-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent);
}
.module-frame select:disabled,
.shell-select:disabled { opacity: .55; cursor: not-allowed; }
/* selects pequenos (toolbars/filtros) — cabem no mesmo look mas mais compactos */
.module-frame select.select-sm { padding: 6px 28px 6px 8px; font-size: 12px; }
