/* Copiado (só leitura) de Dashboard-Dropshipping/web/src/styles/layout.css para manter o visual igual ao fdjm. */
/* ------------------------------------------------------------- shell -- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}

.brand { display: flex; align-items: center; gap: 9px; padding: 0 6px 20px 6px; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.brand-sub { font-size: 10.5px; color: var(--text-faint); line-height: 1.1; }
.brand-badge {
  font-size: 8.5px; font-weight: 600; letter-spacing: 0.08em;
  background: var(--brand-soft); color: var(--brand);
  padding: 1px 5px; border-radius: 5px; margin-left: 6px;
}

.nav-section {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-faint);
  padding: 0 10px; margin: 22px 0 6px 0; line-height: 1.2;
}
.nav-section:first-of-type { margin-top: 2px; }

a.nav-item { text-decoration: none; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  position: relative; padding: 8px 10px; margin-bottom: 2px;
  background: transparent; border: 0; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, var(--brand-soft), transparent); color: var(--text); font-weight: 600; }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand-grad);
}
.nav-item .nav-icon { width: 16px; height: 16px; flex: 0 0 16px; opacity: 0.85; }
.nav-item.active .nav-icon { opacity: 1; color: var(--brand); }
.nav-item.pending { opacity: 0.55; cursor: default; }
.nav-item.pending:hover { background: transparent; color: var(--text-muted); }

.sidebar-foot { margin-top: auto; padding: 12px 6px 0 6px; border-top: 1px solid var(--border); }
.sidebar-user { font-size: 12px; color: var(--text-muted); }
.link-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: 0; padding: 0; margin-top: 4px;
  color: var(--text-faint); font-size: 11.5px; cursor: pointer;
}
.link-btn:hover { color: var(--text); }
.link-icon { width: 14px; height: 14px; flex: 0 0 14px; }

/* Coluna encolhida: fica so a tira de icones. As etiquetas saem do fluxo em vez
 * de ficarem escondidas com overflow, senao o icone deixava de estar centrado.
 *
 * Tudo isto vive dentro de min-width:861px de proposito. Abaixo disso a
 * navegacao ja e uma gaveta que abre por cima do conteudo, e uma gaveta de
 * 60px so com icones seria pior do que a coluna inteira - alem de que a
 * preferencia foi tomada noutro ecra e nao deve seguir para o telemovel. */
@media (min-width: 861px) {
  .shell.collapsed .sidebar { width: 60px; min-width: 60px; padding: 20px 8px; }
  .shell.collapsed .sidebar .brand { justify-content: center; padding: 0 0 20px 0; }
  .shell.collapsed .sidebar .brand > div,
  .shell.collapsed .sidebar-user,
  .shell.collapsed .link-label { display: none; }
  .shell.collapsed .nav-item { justify-content: center; padding: 9px 0; gap: 0; font-size: 0; }
  .shell.collapsed .nav-item .nav-icon { font-size: 0; }
  .shell.collapsed .sidebar-foot { padding: 12px 0 0 0; }
  .shell.collapsed .link-btn { justify-content: center; width: 100%; }
  /* Sem etiquetas, a unica coisa que separa OPERACAO de FINANCEIRO e um traco:
     colapsar os grupos num bloco unico de icones tornava a coluna ilegivel. */
  .shell.collapsed .nav-section {
    font-size: 0; padding: 0; margin: 10px 8px;
    border-top: 1px solid var(--border); line-height: 0;
  }
  .shell.collapsed .nav-section:first-of-type { display: none; }
}

.main { flex: 1; min-width: 0; }
.content { padding: 28px 32px 56px 32px; max-width: 1480px; }

/* ------------------------------------------------------------ topbar -- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 52px; padding: 0 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
  background: var(--glass); backdrop-filter: blur(16px) saturate(1.4);
}
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.live-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 999px;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--positive); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}
.live-dot.stale { background: var(--warning); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15); }
.topbar-user { font-size: 12px; color: var(--text-muted); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-faint); cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.icon-btn svg { width: 16px; height: 16px; display: block; }
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--brand-line); outline-offset: 1px; }

/* Identidade de quem esta ligado: iniciais + utilizador + papel. O papel vive
 * numa segunda linha para o nome nao competir com ele. */
.user-chip { display: inline-flex; align-items: center; gap: 8px; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--brand-soft); border: 1px solid var(--brand-line);
  color: var(--brand); font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em;
}
.user-chip-text { display: flex; flex-direction: column; line-height: 1.15; }
.user-chip-text b { font-size: 12px; font-weight: 600; color: var(--text); }
.user-chip-text i { font-size: 10.5px; font-style: normal; color: var(--text-faint); }

/* ------------------------------------------------- cabeçalho da página -- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 24px;
}
.page-title { margin: 0; font-size: 26px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.2; }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.page-sub b { color: var(--text); font-weight: 600; }
.page-controls { display: flex; align-items: center; gap: 8px; }

/* Semáforo de confiança (components/HealthLight.tsx).
 *
 * `.page-head` é um space-between, por isso a luz sozinha ficava a meio caminho
 * entre o título e os controlos; o `margin-right: auto` encosta-a ao título, que
 * é onde ela pertence — lê-se logo a seguir ao nome da página.
 *
 * O pulso é só para o amarelo e o vermelho. Verde a piscar permanentemente no
 * canto do olho cansa e, ao fim de dois dias, deixa de ser visto — que é
 * exactamente quando deixaria de servir. */
.health-light {
  display: inline-flex; align-items: center; gap: 10px; margin-right: auto;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 12px; font: inherit; text-align: left; cursor: pointer;
}
.health-light:hover { border-color: var(--border-strong); }
.health-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--tone); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 22%, transparent);
}
.health-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.health-title { font-size: 13px; font-weight: 600; }
.health-sub {
  font-size: 12px; color: var(--text-muted);
  max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.health-ok   { --tone: var(--positive); }
.health-warn { --tone: var(--warning); }
.health-crit { --tone: var(--negative); }
.health-warn, .health-crit { border-color: color-mix(in srgb, var(--tone) 45%, var(--border)); }
.health-warn .health-dot, .health-crit .health-dot { animation: health-pulse 1.6s ease-in-out infinite; }
.health-crit .health-title { color: var(--negative); }

@keyframes health-pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 30%, transparent); }
  50%      { box-shadow: 0 0 0 7px color-mix(in srgb, var(--tone) 0%, transparent); }
}

/* O Chrome do João corre com reduced motion, por isso o pulso nunca chega a
 * animar para ele. Sem este bloco o alarme ficaria invisível exactamente para
 * quem tem as animações desligadas: o estado passa a ler-se por um anel fixo
 * mais largo e um bordo mais grosso. */
@media (prefers-reduced-motion: reduce) {
  .health-warn .health-dot, .health-crit .health-dot {
    animation: none;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone) 38%, transparent);
  }
  .health-warn, .health-crit { border-width: 2px; padding: 6px 11px; }
}

.select, .btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  height: 36px; padding: 0 12px; font-size: 14px; cursor: pointer;
}
.btn { height: 32px; font-size: 13px; font-weight: 500; }
.select:hover, .btn:hover { border-color: var(--border-strong); }
.select:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--brand-line); outline-offset: 1px;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary {
  background: var(--brand); border-color: var(--brand);
  color: var(--on-brand); font-weight: 600;
}
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }

/* O icone dentro do controlo e decorativo e nao apanha o rato: o clique tem de
 * continuar a abrir o <select> nativo por baixo. */
.control { position: relative; display: inline-flex; align-items: center; }
.control > svg {
  position: absolute; left: 10px; width: 15px; height: 15px;
  color: var(--text-faint); pointer-events: none;
}
.control .select { padding-left: 31px; }
.btn .btn-icon { width: 15px; height: 15px; }

