/* =========================================================================
   Alpino — Portal do Fornecedor
   Mesma linguagem do mrit (alpino-ui.css / alpino-patterns.css): fundo claro
   liso #f7f8fb, cards brancos com sombra suave, hero compacto, kpi-strip
   horizontal, pills e botões Alpino. Enxuto, sem excessos. Light + dark.
   ========================================================================= */

/* ---- Fonte Inter (auto-hospedada, offline; dentro da CSP font-src 'self') */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/inter-700.woff2") format("woff2");
}

/* ---- Tokens (espelham o mrit) ------------------------------------------ */
:root {
  color-scheme: light;

  --ti-primary: #095cf4;
  --ti-primary-2: #0046bd;

  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f2f5fb;
  --surface-inset: #f5f7fc;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);

  --text: #1f2937;
  --text-2: #46536e;
  --text-muted: #6c7a90;

  --ti-shadow: 0 0.75rem 1.25rem rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 4px 12px rgba(2, 8, 23, 0.06);
  --shadow-hover: 0 12px 24px rgba(9, 92, 244, 0.10);
  --ring: 0 0 0 0.25rem rgba(9, 92, 244, 0.35);

  /* Farol de vencimento (paleta consistente com as pills do mrit) */
  --farol-vencido-fg: #b91c1c; --farol-vencido-bg: rgba(239, 68, 68, 0.14);
  --farol-alerta-fg: #b45309;  --farol-alerta-bg: rgba(245, 158, 11, 0.16);
  --farol-ok-fg: #15803d;      --farol-ok-bg: rgba(34, 197, 94, 0.14);
  --farol-none-fg: #334155;    --farol-none-bg: rgba(148, 163, 184, 0.18);

  --r-btn: 10px;
  --r-card: 16px;
  --r-panel: 16px;
  --r-kpi: 14px;
  --r-input: 10px;

  --header-h: 64px;
  --maxw: 1140px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #121212;
  --surface: #1f2430;
  --surface-2: #262c3a;
  --surface-inset: #232a38;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #e9eef9;
  --text-2: #c2cbe0;
  --text-muted: rgba(238, 243, 255, 0.6);

  --ti-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.4);

  --farol-vencido-fg: #fecaca; --farol-vencido-bg: rgba(239, 68, 68, 0.18);
  --farol-alerta-fg: #fde68a;  --farol-alerta-bg: rgba(245, 158, 11, 0.18);
  --farol-ok-fg: #d1fae5;      --farol-ok-bg: rgba(34, 197, 94, 0.22);
  --farol-none-fg: #e2e8f0;    --farol-none-bg: rgba(148, 163, 184, 0.20);
}

/* ---- Base -------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--ti-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
strong, b { font-weight: 600; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }
/* Wrapper fluido: ocupa toda a largura disponível ao lado do sidebar. */
.page { width: 100%; margin: 0; padding: 0 clamp(16px, 2vw, 28px); }

/* ---- Ícones (Bootstrap Icons, auto-hospedado) -------------------------- */
.bi { line-height: 1; display: inline-block; }
.nav-ico i { font-size: 1.08rem; }
.sb-company-ico i { font-size: 1rem; }
.sb-user-caret i { font-size: 1rem; }
#btnMinimizeSidebar i { font-size: 1.05rem; }
#mobileMenuBtn i { font-size: 1.2rem; }
.kpi-tile .ico i { font-size: 1.1rem; }
.panel-title .ico i { font-size: 0.95rem; }
.hero-ico i { font-size: 1.3rem; }
.entity-card .ec-ico i { font-size: 1.02rem; }
.toast-ico i { font-size: 1.25rem; }
.di-ico i { font-size: 1rem; }
.af-conf i { font-size: 0.92rem; }
.evi-chip .evi-ic i { font-size: 0.95rem; }
.file-btn i { font-size: 0.9rem; }
.theme-toggle i { font-size: 1.05rem; }
.toast-close i { font-size: 0.95rem; }
.back-link i { font-size: 0.9rem; }
.u-label {
  text-transform: uppercase; letter-spacing: 0.02em;
  font-size: 0.72rem; font-weight: 600; color: var(--text-muted); line-height: 1.1;
}
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.section-gap { margin-top: 14px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* (logo usado nas telas de login) */
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand-logo { height: 40px; width: auto; display: block; }

/* ==========================================================================
   SIDEBAR flutuante (padrão do mrit: vidro, minimiza/expande, off-canvas mobile)
   ========================================================================== */
:root { --sb-width: 258px; --sb-min: 72px; --sb-gap: 10px; }

.app-shell { min-height: 100vh; }

.main-content { min-height: 100vh; display: flex; flex-direction: column; }
.main-content > .main { flex: 1 0 auto; }

@media (min-width: 900px) {
  /* Conteúdo sempre deslocado apenas pela largura do trilho minimizado; ao
     expandir, o sidebar SOBREPÕE o conteúdo (não empurra a tela). */
  .main-content { margin-left: calc(var(--sb-min) + (var(--sb-gap) * 2)); }
}

/* Botão mobile + backdrop */
#mobileMenuBtn {
  position: fixed; top: 10px; left: 10px; z-index: 1042;
  width: 42px; height: 42px; border-radius: 999px; border: 1px solid var(--border);
  display: grid; place-items: center; cursor: pointer; color: var(--ti-primary);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(140%); backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 10px 26px rgba(2, 8, 23, 0.12);
}
@media (min-width: 900px) { #mobileMenuBtn { display: none; } }
#sidebarBackdrop { position: fixed; inset: 0; z-index: 1039; display: none; background: rgba(4, 10, 24, 0.4); }
#sidebarBackdrop.visible { display: block; }
@media (min-width: 900px) { #sidebarBackdrop { display: none !important; } }

.sidebar {
  position: fixed; top: var(--sb-gap); left: var(--sb-gap); bottom: var(--sb-gap);
  width: var(--sb-width); z-index: 1040;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--border); box-shadow: 0 18px 44px rgba(2, 8, 23, 0.12);
  border-radius: 18px; display: flex; flex-direction: column; overflow: visible;
  transition: width 0.26s cubic-bezier(0.22, 1, 0.36, 1), transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
:root[data-theme="dark"] .sidebar { box-shadow: 0 22px 54px rgba(0, 0, 0, 0.55); }
.sb-inner { position: relative; height: 100%; border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.sidebar.minimized { width: var(--sb-min); }
@media (max-width: 899.98px) {
  .sidebar { transform: translateX(-115%); box-shadow: 0 22px 54px rgba(0, 0, 0, 0.3); }
  .sidebar.show { transform: translateX(0); }
  .sidebar.minimized { width: var(--sb-width); }
  .sidebar.minimized .nav-label, .sidebar.minimized .sb-brand-text,
  .sidebar.minimized .sb-company select, .sidebar.minimized .sb-user .txt { display: initial; }
}

/* Cabeçalho do sidebar */
.sb-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 6px; }
#btnMinimizeSidebar {
  width: 36px; height: 36px; border-radius: 999px; border: 0; flex: 0 0 auto;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(9, 92, 244, 0.10); color: var(--ti-primary);
}
:root[data-theme="dark"] #btnMinimizeSidebar { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar.minimized #btnMinimizeSidebar { display: none; }
.sb-brand {
  display: flex; align-items: center; gap: 8px; min-width: 0; width: 100%;
  cursor: pointer; padding: 6px 6px; border-radius: 12px; text-decoration: none; color: inherit;
}
.sb-brand:hover { background: rgba(9, 92, 244, 0.06); text-decoration: none; }
:root[data-theme="dark"] .sb-brand:hover { background: rgba(255, 255, 255, 0.06); }
.sb-logo-full { height: 22px; width: auto; flex: 0 0 auto; }
.sb-logo-mark { display: none; width: 38px; height: 38px; border-radius: 999px; object-fit: contain; flex: 0 0 auto; }
.sb-brand-text { min-width: 0; }
.sb-brand-text .sb-sub {
  font-size: 0.74rem; color: var(--text-muted); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
.sidebar.minimized .sb-logo-full, .sidebar.minimized .sb-brand-text { display: none; }
.sidebar.minimized .sb-logo-mark { display: block; }
.sidebar.minimized .sb-brand { justify-content: center; padding: 4px; }

/* Seletor de empresa no sidebar */
.sb-company {
  margin: 2px 10px 6px; display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border);
}
.sb-company-ico { color: var(--ti-primary); flex: 0 0 auto; display: grid; place-items: center; }
.sb-company select {
  appearance: none; border: 0; background: transparent; color: var(--text);
  font: inherit; font-weight: 600; font-size: 0.82rem; width: 100%; min-width: 0; cursor: pointer;
}
.sb-company select:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
.sb-company-name { font-weight: 600; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar.minimized .sb-company { justify-content: center; padding: 8px; }
.sidebar.minimized .sb-company select, .sidebar.minimized .sb-company-name { display: none; }

/* Navegação */
.sidebar-scroll { overflow: auto; padding: 4px 10px 10px; flex: 1 1 auto; scrollbar-width: none; }
.sidebar-scroll::-webkit-scrollbar { width: 0; height: 0; }
.nav-list { display: flex; flex-direction: column; gap: 3px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 11px;
  font-weight: 600; font-size: 0.9rem; color: var(--text-2); text-decoration: none; position: relative;
  transition: background 0.14s ease, color 0.14s ease;
}
.nav-link:hover { background: rgba(9, 92, 244, 0.10); color: var(--text); text-decoration: none; }
:root[data-theme="dark"] .nav-link:hover { background: rgba(255, 255, 255, 0.07); }
.nav-link.active { background: linear-gradient(135deg, var(--ti-primary), var(--ti-primary-2)); color: #fff; }
.nav-ico { width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; }
.nav-ico svg { width: 19px; height: 19px; }
.sidebar.minimized .nav-link { justify-content: center; padding: 10px 8px; }
.sidebar.minimized .nav-label { display: none; }

/* Rodapé do sidebar (usuário) */
.sb-footer { padding: 8px 10px 10px; margin-top: auto; position: relative; }
.sb-user {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 9px; border-radius: 14px; cursor: pointer; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border); color: inherit; font: inherit;
}
.sb-user:hover { background: var(--surface-inset); }
.sb-avatar {
  width: 34px; height: 34px; border-radius: 999px; flex: 0 0 auto; display: grid; place-items: center;
  font-weight: 800; font-size: 0.9rem; color: #fff; background: linear-gradient(135deg, var(--ti-primary), var(--ti-primary-2));
}
.sb-user .txt { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.sb-user .nm, .sb-user .em { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user .nm { font-weight: 700; font-size: 0.85rem; line-height: 1.2; }
.sb-user .em { font-size: 0.74rem; color: var(--text-muted); }
.sb-user-caret { color: var(--text-muted); flex: 0 0 auto; display: grid; place-items: center; }
.sidebar.minimized .sb-user { justify-content: center; padding: 8px; }
.sidebar.minimized .sb-user .txt, .sidebar.minimized .sb-user-caret { display: none; }

.sb-user-flyout {
  position: absolute; left: 10px; right: 10px; bottom: calc(100% + 6px); z-index: 60;
  padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 18px 44px rgba(2, 8, 23, 0.18); display: none;
}
.sb-user-flyout.open { display: block; }
.sb-user-flyout .dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px;
  background: transparent; border: 0; width: 100%; color: var(--text); font: inherit;
  font-weight: 600; font-size: 0.88rem; cursor: pointer; text-decoration: none; text-align: left;
}
.sb-user-flyout .dropdown-item:hover { background: var(--surface-2); text-decoration: none; }
.di-ico { width: 18px; height: 18px; display: grid; place-items: center; color: var(--text-muted); flex: 0 0 auto; }
.di-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* ---- Botões (mrit) ----------------------------------------------------- */
.btn-alpino-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  color: #fff; border: 0; border-radius: var(--r-btn); font-weight: 700; font-size: 0.9rem;
  padding: 9px 18px; cursor: pointer; text-decoration: none; line-height: 1.2; min-height: 40px;
  background-image: linear-gradient(135deg, var(--ti-primary), var(--ti-primary-2));
  box-shadow: 0 6px 14px rgba(9, 92, 244, 0.28);
  transition: filter 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-alpino-cta:hover { filter: brightness(1.06); transform: translateY(-1px); color: #fff; text-decoration: none; }
.btn-alpino-cta:active { transform: translateY(0); }
.btn-alpino-cta:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-alpino-cta.sm { padding: 6px 12px; font-size: 0.82rem; border-radius: 9px; min-height: 34px; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--r-btn); padding: 9px 16px; font-weight: 600; font-size: 0.9rem;
  min-height: 40px; cursor: pointer; text-decoration: none;
}
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; }

.btn-ic {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 7px 12px; border-radius: 9px;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border);
  font-size: 0.85rem; font-weight: 600; text-decoration: none; box-shadow: var(--shadow-sm);
}
.btn-ic:hover { color: var(--text); text-decoration: none; }

.theme-toggle {
  width: 36px; height: 36px; border-radius: 999px; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  box-shadow: var(--shadow-sm);
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
.theme-toggle .ic-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .ic-moon { display: none; }

/* ---- Hero de status (compacto — assinatura) ---------------------------- */
.hero-card {
  position: relative; border-radius: 14px; color: #fff; overflow: hidden;
  /* Foto da fábrica Alpino — sem escurecer; enquadrada na faixa da fachada
     (letreiro ALPINO). Sem véu; a legibilidade vem do text-shadow do conteúdo. */
  background: url("../img/fundo_Alpino.png") center center / cover no-repeat;
  background-color: #0b3e9e; /* fallback enquanto a imagem carrega */
  box-shadow: var(--ti-shadow);
  min-height: 158px;
}
.hero-card::before { /* malha blueprint sutil no lado escuro (direita) */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.22; border-radius: inherit;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 30px 30px;
  -webkit-mask-image: linear-gradient(90deg, transparent 38%, #000);
  mask-image: linear-gradient(90deg, transparent 38%, #000);
}
.hero-inner { position: relative; z-index: 1; padding: 16px 18px; }
/* Legibilidade sobre a foto sem escurecê-la: sombra no texto do hero. */
.hero-eyebrow, .hero-title { text-shadow: 0 1px 8px rgba(3, 10, 30, 0.55), 0 1px 2px rgba(3, 10, 30, 0.6); }

.hero-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-ico {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(120, 170, 255, 0.34);
  box-shadow: 0 6px 16px rgba(3, 10, 40, 0.42);
}
.hero-ico svg { width: 22px; height: 22px; }
.hero-heading { min-width: 0; }
.hero-eyebrow { color: rgba(255, 255, 255, 0.92); font-weight: 500; font-size: 0.82rem; }
.hero-title { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; margin-top: 1px; }
.hero-title .accent { color: #9cc0ff; font-weight: 600; }
.hero-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.hero-card .pill { background: rgba(255, 255, 255, 0.14); color: #fff; border-color: rgba(255, 255, 255, 0.28); }

/* Veredito "pior sinal manda" — faixa fina */
.verdict {
  margin-top: 12px; display: inline-flex; align-items: center; gap: 11px;
  padding: 9px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.16);
}
.verdict .dot { width: 10px; height: 10px; border-radius: 999px; flex: none; }
.dot-red { background: #ff6b78; box-shadow: 0 0 0 4px rgba(255, 107, 120, 0.18); }
.dot-amber { background: #ffce54; box-shadow: 0 0 0 4px rgba(255, 206, 84, 0.18); }
.dot-green { background: #4fd6a0; box-shadow: 0 0 0 4px rgba(79, 214, 160, 0.18); }
.verdict .v-title { font-weight: 700; font-size: 0.95rem; }
.verdict .v-sub { color: rgba(233, 238, 249, 0.8); font-size: 0.82rem; }
.verdict-vencido { border-color: rgba(255, 107, 120, 0.4); }
.verdict-alerta { border-color: rgba(255, 206, 84, 0.4); }
.verdict-ok { border-color: rgba(79, 214, 160, 0.4); }

/* ---- KPI strip (horizontal, ícone à esquerda) -------------------------- */
.kpi-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.kpi-tile {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--r-kpi); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--ti-shadow); text-decoration: none; color: inherit;
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.kpi-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); color: inherit; text-decoration: none; }
.kpi-tile:focus-visible { outline: none; box-shadow: var(--ring); }
.kpi-tile .ico {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 36px;
  display: grid; place-items: center; font-size: 1rem;
  background: linear-gradient(135deg, rgba(9, 92, 244, 0.16), rgba(9, 92, 244, 0.06)); color: var(--ti-primary);
}
.kpi-tile.tone-red .ico { background: linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(239, 68, 68, 0.08)); color: #b91c1c; }
.kpi-tile.tone-amber .ico { background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(245, 158, 11, 0.08)); color: #b45309; }
.kpi-tile.tone-green .ico { background: linear-gradient(135deg, rgba(34, 197, 94, 0.22), rgba(34, 197, 94, 0.08)); color: #15803d; }
.kpi-tile .kpi-body { min-width: 0; }
.kpi-tile .lab { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.02em; font-weight: 600; color: var(--text-muted); line-height: 1.1; }
.kpi-tile .val { font-weight: 800; font-size: 1.4rem; line-height: 1.05; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---- Panels ------------------------------------------------------------ */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-panel); box-shadow: var(--ti-shadow);
  padding: 14px; margin-bottom: 14px;
}
.panel-flush { padding: 0; overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px; flex-wrap: wrap;
}
.panel-flush .panel-head { margin: 0; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.panel-title { display: flex; align-items: center; gap: 0.55rem; min-width: 0; font-size: 0.98rem; font-weight: 600; }
.panel-title .ico {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: #fff; font-size: 0.9rem;
  background: linear-gradient(135deg, var(--ti-primary), var(--ti-primary-2));
}
.panel-title .ico svg { width: 16px; height: 16px; }
.panel-body { padding: 14px 16px; }
.panel-foot {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ---- Cabeçalho de página ----------------------------------------------- */
.page-head { margin: 16px 0 12px; }
.page-head h1 { font-size: 1.3rem; font-weight: 700; }
.page-head .page-sub { color: var(--text-muted); font-size: 0.9rem; margin-top: 2px; }
.back-link { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--text-2); font-size: 0.85rem; }
.back-link:hover { color: var(--ti-primary); text-decoration: none; }

/* ---- Cards de área ----------------------------------------------------- */
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 12px; }
.entity-card {
  display: flex; flex-direction: column; gap: 6px; padding: 14px;
  border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--ti-shadow); text-decoration: none; color: inherit;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.entity-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); text-decoration: none; }
.entity-card .ec-top { display: flex; align-items: center; gap: 10px; }
.entity-card .ec-ico {
  width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(9, 92, 244, 0.14), rgba(9, 92, 244, 0.05)); color: var(--ti-primary);
}
.entity-card .ec-ico svg { width: 17px; height: 17px; }
.entity-card .ec-title { font-weight: 600; font-size: 0.98rem; color: var(--text); }
.entity-card .ec-mark { width: 9px; height: 9px; border-radius: 999px; margin-left: auto; flex: none; }
.entity-card .ec-summary { color: var(--text-2); font-size: 0.88rem; min-height: 20px; }
.entity-card .ec-cta { margin-top: 4px; font-weight: 600; font-size: 0.85rem; color: var(--ti-primary); }
.ec-mark.is-vencido { background: #ef4444; }
.ec-mark.is-alerta { background: #f59e0b; }
.ec-mark.is-ok { background: #22c55e; }

/* ---- Pills (mrit) ------------------------------------------------------ */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 0.28rem 0.55rem; border-radius: 999px; font-weight: 700; font-size: 0.78rem;
  line-height: 1; white-space: nowrap; border: 1px solid var(--border);
}
.pill-green { background: rgba(16, 185, 129, 0.14); color: #065f46; }
.pill-slate, .pill-soft { background: rgba(148, 163, 184, 0.18); color: #334155; }
.pill-blue { background: rgba(9, 92, 244, 0.12); color: #0b2a6e; }
.pill-indigo { background: rgba(99, 102, 241, 0.14); color: #312e81; }
.pill-amber { background: rgba(245, 158, 11, 0.16); color: #92400e; }
.pill-red { background: rgba(239, 68, 68, 0.14); color: #7f1d1d; }
:root[data-theme="dark"] .pill { border-color: rgba(255, 255, 255, 0.14); }
:root[data-theme="dark"] .pill-green { background: rgba(16, 185, 129, 0.22); color: #d1fae5; }
:root[data-theme="dark"] .pill-slate, :root[data-theme="dark"] .pill-soft { background: rgba(148, 163, 184, 0.20); color: #e2e8f0; }
:root[data-theme="dark"] .pill-blue { background: rgba(9, 92, 244, 0.22); color: #e7efff; }
:root[data-theme="dark"] .pill-indigo { background: rgba(99, 102, 241, 0.22); color: #e0e7ff; }
:root[data-theme="dark"] .pill-amber { background: rgba(245, 158, 11, 0.18); color: #fde68a; }
:root[data-theme="dark"] .pill-red { background: rgba(239, 68, 68, 0.18); color: #fecaca; }

/* ---- Farol de vencimento (datas) --------------------------------------- */
.farol-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 0.22rem 0.55rem; border-radius: 999px; font-size: 0.74rem; font-weight: 700; line-height: 1;
}
.farol-badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.farol-vencido { color: var(--farol-vencido-fg); background: var(--farol-vencido-bg); }
.farol-alerta { color: var(--farol-alerta-fg); background: var(--farol-alerta-bg); }
.farol-ok { color: var(--farol-ok-fg); background: var(--farol-ok-bg); }
.farol-none { color: var(--farol-none-fg); background: var(--farol-none-bg); }

.date-cell { display: inline-flex; align-items: baseline; gap: 3px; font-weight: 600; font-variant-numeric: tabular-nums; }
.date-cell.is-vencido { color: var(--farol-vencido-fg); }
.date-cell.is-alerta { color: var(--farol-alerta-fg); }

/* ---- Linhas (viram cards no mobile) ------------------------------------ */
.rows { display: flex; flex-direction: column; }
.row-item {
  display: grid; grid-template-columns: 1fr; gap: 6px;
  padding: 18px 2px; border-bottom: 1px solid var(--border);
}
.row-item:last-child { border-bottom: 0; }
.row-main { min-width: 0; }
.row-label { font-weight: 600; font-size: 0.96rem; }
.cert-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 6px; }

/* Colunas lado a lado dentro da linha: Vencimento à esquerda, Evidências à
   direita — aproveitando a largura em telas maiores; empilha no mobile. */
.row-cols {
  display: grid; grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px 44px; margin-top: 12px; align-items: start;
}
/* Campo organizado: legenda em cima, controle + farol embaixo. */
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* Bloco de evidências, com rótulo próprio. */
.evi-block { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 760px) {
  .row-cols { grid-template-columns: 1fr; gap: 16px; }
}
/* Legenda curta que identifica um grupo (ex.: Vencimento, Evidências) */
.field-cap {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 700; color: var(--text-muted); line-height: 1;
}

.field-date {
  font: inherit; font-size: 0.88rem; color: var(--text); background: var(--surface-inset);
  border: 1px solid var(--border-strong); border-radius: var(--r-input);
  padding: 8px 11px; min-height: 40px; min-width: 158px;
}
.field-date:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--ti-primary); }
.field-text {
  width: 100%; font: inherit; font-size: 0.9rem; color: var(--text); background: var(--surface-inset);
  border: 1px solid var(--border-strong); border-radius: var(--r-input); padding: 10px 12px;
  resize: vertical; min-height: 84px;
}
.field-text:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--ti-primary); }
label.field-label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; }

/* ---- Tabela (auditorias) ----------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; }
table.data th {
  text-align: left; padding: 10px 12px; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.03em; color: #fff; background: var(--ti-primary); white-space: nowrap;
}
table.data th:first-child { border-top-left-radius: 10px; }
table.data th:last-child { border-top-right-radius: 10px; }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 0.9rem; }
table.data tbody tr:hover { background: var(--surface-2); }

/* ---- Chips de evidência ------------------------------------------------ */
.evi-list { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.evi-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
  background: rgba(9, 92, 244, 0.08); border: 1px solid rgba(9, 92, 244, 0.12); color: #0b3f99;
  max-width: 100%; cursor: pointer; text-decoration: none;
}
.evi-chip:hover { background: rgba(9, 92, 244, 0.14); text-decoration: none; }
.evi-chip .evi-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-theme="dark"] .evi-chip { background: rgba(9, 92, 244, 0.18); color: #dbeafe; border-color: rgba(147, 197, 253, 0.22); }
.evi-empty { color: var(--text-muted); font-size: 0.82rem; }

.file-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.8rem;
  background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--text-2);
}
.file-btn:hover { color: var(--text); border-color: var(--ti-primary); }
.file-btn input { display: none; }

/* ---- Logo da empresa (cadastro) ---------------------------------------- */
.logo-block { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.cad-logo {
  max-height: 84px; max-width: 240px; border-radius: 12px; padding: 10px;
  background: var(--surface-2); border: 1px solid var(--border); object-fit: contain;
}
.cad-logo-empty {
  width: 132px; height: 84px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  color: var(--text-muted); font-size: 1.7rem;
}
.logo-actions { min-width: 0; }

/* Logo do fornecedor no hero/sidebar: por padrão mostra o fallback; quando a
   imagem carrega (via JS: parent ganha .has-logo), troca para o logo. */
[data-logo] { display: none; }
.has-logo [data-logo] { display: block; }
.has-logo .logo-fallback { display: none; }
.hero-ico .hero-forn-logo {
  width: 100%; height: 100%; object-fit: contain; border-radius: 9px;
  background: #fff; padding: 3px;
}
.sb-company-ico { position: relative; width: 20px; height: 20px; }
.sb-company-ico .sb-forn-logo {
  width: 20px; height: 20px; object-fit: contain; border-radius: 4px; background: #fff;
}

/* ---- Mensagens --------------------------------------------------------- */
.flash-wrap { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 0; }
.flash {
  display: flex; align-items: center; gap: 9px; padding: 11px 14px;
  border-radius: 12px; font-weight: 600; font-size: 0.9rem; border: 1px solid var(--border);
}
.flash.success { background: rgba(34, 197, 94, 0.12); color: var(--farol-ok-fg); border-color: rgba(34, 197, 94, 0.30); }
.flash.error { background: rgba(239, 68, 68, 0.12); color: var(--farol-vencido-fg); border-color: rgba(239, 68, 68, 0.30); }
.flash.info { background: rgba(9, 92, 244, 0.10); color: #0b3f99; border-color: rgba(9, 92, 244, 0.22); }
:root[data-theme="dark"] .flash.info { color: #dbeafe; }

/* ---- Toasts (mensagens que somem sozinhas) ----------------------------- */
.toast-wrap {
  position: fixed; top: calc(var(--header-h) + 12px); right: 16px; z-index: 100;
  display: flex; flex-direction: column; gap: 10px;
  width: min(360px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 12px 14px; border-radius: 14px;
  color: var(--text);
  /* Vidro (liquid glass): fundo translúcido + desfoque/saturação do que está atrás */
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.30));
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.55); border-left: 4px solid var(--ti-primary);
  box-shadow: 0 14px 34px rgba(2, 8, 23, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  animation: toast-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* Reflexo diagonal sutil que reforça o aspecto "liquid" */
.toast::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; z-index: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.28) 0%, transparent 32%, transparent 70%, rgba(255, 255, 255, 0.12) 100%);
}
.toast > * { position: relative; z-index: 1; }
.toast.hide { animation: toast-out 0.24s ease forwards; }
.toast-ico { flex: none; width: 22px; height: 22px; color: var(--ti-primary); }
.toast-ico svg { width: 22px; height: 22px; }
.toast-msg { flex: 1 1 auto; min-width: 0; font-size: 0.9rem; font-weight: 600; line-height: 1.3; }
.toast-close {
  flex: none; width: 26px; height: 26px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 7px; cursor: pointer; color: var(--text-muted);
}
.toast-close:hover { background: var(--surface-2); color: var(--text); }
.toast-close:focus-visible { outline: none; box-shadow: var(--ring); }
.toast-bar {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: currentColor; opacity: 0.5; transform-origin: left;
  animation: toast-bar var(--toast-life, 5000ms) linear forwards;
}
.toast.paused .toast-bar { animation-play-state: paused; }
.toast.success { border-left-color: #15803d; }
.toast.success .toast-ico, .toast.success .toast-bar { color: #15803d; }
.toast.error { border-left-color: #b91c1c; }
.toast.error .toast-ico, .toast.error .toast-bar { color: #b91c1c; }
.toast.info { border-left-color: var(--ti-primary); }
.toast.info .toast-ico, .toast.info .toast-bar { color: var(--ti-primary); }
:root[data-theme="dark"] .toast.success { border-left-color: #6ee7a8; }
:root[data-theme="dark"] .toast.success .toast-ico, :root[data-theme="dark"] .toast.success .toast-bar { color: #6ee7a8; }
:root[data-theme="dark"] .toast.error { border-left-color: #ff9aa4; }
:root[data-theme="dark"] .toast.error .toast-ico, :root[data-theme="dark"] .toast.error .toast-bar { color: #ff9aa4; }
:root[data-theme="dark"] .toast {
  background: linear-gradient(160deg, rgba(46, 55, 74, 0.62), rgba(24, 30, 44, 0.40));
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.10);
}
:root[data-theme="dark"] .toast::after {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.12) 0%, transparent 34%, transparent 72%, rgba(255, 255, 255, 0.05) 100%);
}
@keyframes toast-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(14px); } }
@keyframes toast-bar { from { width: 100%; } to { width: 0; } }
@media (max-width: 620px) {
  .toast-wrap { left: 16px; right: 16px; width: auto; top: calc(var(--header-h) + 8px); }
}
@media (prefers-reduced-motion: reduce) {
  .toast-bar { display: none; }
}

/* ---- Estados vazio / erro ---------------------------------------------- */
.empty, .error-state {
  text-align: center; padding: 36px 22px; border-radius: var(--r-card);
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2); box-shadow: var(--ti-shadow);
}
.empty .emoji { font-size: 26px; }
.empty h3 { margin: 8px 0 3px; font-size: 1rem; }
.empty p { margin: 0; font-size: 0.9rem; }
.error-state { border-color: rgba(239, 68, 68, 0.30); }

/* ---- Modal (preview de evidência) -------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; display: none;
  background: rgba(4, 10, 24, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(920px, 96vw); height: min(80vh, 900px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: 0 24px 60px rgba(2, 8, 23, 0.3); display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { display: flex; align-items: center; gap: 12px; padding: 11px 14px; color: #fff;
  background: linear-gradient(135deg, var(--ti-primary), var(--ti-primary-2)); }
.modal-head .modal-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-head .modal-close { margin-left: auto; background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.24); color: #fff; box-shadow: none; }
.modal-body { flex: 1; background: var(--surface-inset); }
.modal-body iframe, .modal-body img { width: 100%; height: 100%; border: 0; object-fit: contain; }

/* ---- Login ------------------------------------------------------------- */
.auth-shell { min-height: 100vh; display: flex; flex-direction: column; }
.auth-hero {
  position: relative; overflow: hidden; flex: 1;
  display: flex; align-items: center; justify-content: center; padding: 40px 20px;
  /* Mesma foto da fábrica Alpino, sem escurecer. O cartão de login é opaco,
     então a legibilidade fica preservada. */
  background: url("../img/fundo_Alpino.png") center center / cover no-repeat;
  background-color: #0b3e9e;
}
.auth-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.25;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(120% 120% at 50% 0%, #000, transparent 78%);
  mask-image: radial-gradient(120% 120% at 50% 0%, #000, transparent 78%);
}
.auth-hero::after {
  content: ""; position: absolute; top: -20%; left: 50%; transform: translateX(-50%);
  width: 640px; height: 420px; pointer-events: none;
  background: radial-gradient(circle, rgba(88, 158, 255, 0.34), transparent 60%);
}
.auth-topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; }
.auth-topbar .brand-logo { height: 40px; }

.auth-card {
  position: relative; z-index: 2; width: min(420px, 100%);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: 0 24px 60px rgba(2, 8, 23, 0.28); padding: 26px;
  text-align: center;
}
.auth-logo { display: block; height: 52px; width: auto; margin: 0 auto 16px; }
.auth-title { font-size: 1.5rem; font-weight: 700; }
.auth-sub { color: var(--text-2); margin-top: 5px; font-size: 0.92rem; }
.auth-form { margin-top: 18px; }
.field-email {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-inset);
  border: 1px solid var(--border-strong); border-radius: var(--r-input);
  padding: 12px 14px; min-height: 46px; margin-top: 6px; text-align: left;
}
.field-email:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--ti-primary); }
.auth-help { color: var(--text-muted); font-size: 0.82rem; margin-top: 11px; }
.auth-form .btn-alpino-cta { width: 100%; margin-top: 13px; }
.form-error { color: var(--farol-vencido-fg); font-size: 0.82rem; margin-top: 7px; font-weight: 600; }

.auth-success {
  margin-top: 16px; padding: 14px; border-radius: var(--r-input);
  background: rgba(34, 197, 94, 0.12); color: var(--farol-ok-fg);
  border: 1px solid rgba(34, 197, 94, 0.30); font-size: 0.9rem;
}
.demo-note {
  margin-top: 12px; padding: 11px 13px; border-radius: var(--r-input); font-size: 0.82rem;
  background: rgba(9, 92, 244, 0.08); color: #0b3f99; border: 1px dashed rgba(9, 92, 244, 0.35);
}
:root[data-theme="dark"] .demo-note { color: #dbeafe; }
.link-inline { background: none; border: 0; color: var(--ti-primary); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.auth-foot { text-align: center; color: var(--text-muted); font-size: 0.78rem; padding: 14px; }

.main { padding: 6px 0 36px; flex: 1 0 auto; }

/* ---- Footer -------------------------------------------------------------- */
.app-footer { border-top: 1px solid var(--border); background: var(--surface); }
.app-footer-inner {
  padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; text-align: center;
}
.af-conf {
  margin: 0; font-size: 0.8rem; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
}
.af-conf svg { color: var(--text-muted); flex: none; }
.af-org { margin: 0; font-size: 0.76rem; color: var(--text-muted); }
.af-org strong { color: var(--text-2); font-weight: 700; }

/* ---- Motion (contida) -------------------------------------------------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.anim-hero { animation: fadeUp 0.35s ease both; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---- Responsivo -------------------------------------------------------- */
@media (max-width: 899.98px) {
  /* botão de menu (mobile) sobrepõe o conteúdo — sem empurrar a página */
  .page-head { padding-left: 50px; }
}
@media (max-width: 860px) {
  .hero-actions { display: none; }
}
@media (max-width: 620px) {
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-strip .kpi-tile:last-child { grid-column: span 2; }
  .area-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.08rem; }

  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { margin-bottom: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 4px 12px; background: var(--surface); }
  table.data td { border: 0; padding: 7px 2px; display: flex; justify-content: space-between; gap: 12px; }
  table.data td::before { content: attr(data-label); font-weight: 700; color: var(--text-muted); text-transform: uppercase; font-size: 0.66rem; letter-spacing: 0.04em; }
}
