/* ============================================================
   INTRANET ALVOPETRO — Design System
   Identidade Alvopetro Energy: verde #8cbf3f, grafite, lima
   Estilo: enterprise clean — sidebar clara, bordas sutis,
   tipografia Open Sans, ícones SVG stroke
   ============================================================ */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('/vendor/opensans-latin.woff2') format('woff2');
}
:root {
  /* Marca */
  --brand: #8cbf3f;
  --brand-600: #79a933;
  --brand-700: #5f8a24;
  --brand-800: #4a6d1c;
  --brand-050: #f4f8ec;
  --brand-100: #e8f1d8;
  --lime: #d7df23;
  /* Grafite / neutros */
  --ink-900: #1e2023;
  --ink-800: #2e3033;
  --ink-700: #45484d;
  --gray-050: #f8f9f7;
  --gray-100: #f1f3ee;
  --gray-150: #e9ebe5;
  --gray-200: #dfe2da;
  --gray-300: #c9cdc3;
  --gray-400: #9ba095;
  --gray-500: #7c817a;
  --gray-600: #62665f;
  --gray-800: #33352f;
  --white: #ffffff;
  /* Estados */
  --red: #cb4335;
  --red-700: #a93226;
  --red-050: #fbeeec;
  --amber: #d68910;
  --amber-050: #fdf3e3;
  --green: #229954;
  --green-050: #e9f7ef;
  --blue: #2874a6;
  --blue-050: #eaf2f8;
  --purple: #7d3c98;
  --purple-050: #f4ecf7;
  /* Compat: nomes antigos usados pelas paginas */
  --navy-900: var(--ink-800);
  --navy-800: var(--ink-700);
  --navy-700: var(--gray-600);
  --navy-100: var(--brand-100);
  --orange: var(--brand);
  --orange-dark: var(--brand-600);
  --red-dark: var(--red-700);
  --gray-50: var(--gray-050);
  --gray-150b: var(--gray-150);
  /* Métricas */
  --sidebar-w: 252px;
  --radius: 10px;
  --radius-sm: 8px;
  --border: 1px solid var(--gray-150);
  --shadow: 0 1px 2px rgba(30, 32, 35, .05);
  --shadow-md: 0 2px 8px rgba(30, 32, 35, .07);
  --shadow-lg: 0 16px 48px rgba(30, 32, 35, .18);
  --focus-ring: 0 0 0 3px rgba(140, 191, 63, .28);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'Open Sans', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--gray-050);
  color: var(--ink-800);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand-700); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--brand-100); }
.ic-svg { vertical-align: -3px; flex-shrink: 0; }

/* ---------- Loading / Spinner ---------- */
.loading-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; gap: 14px; color: var(--gray-500); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--gray-150); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Login (split screen) ---------- */
.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.login-brand {
  background:
    radial-gradient(ellipse 90% 60% at 10% 110%, rgba(140,191,63,.28), transparent 60%),
    radial-gradient(ellipse 70% 45% at 95% -10%, rgba(215,223,35,.14), transparent 60%),
    linear-gradient(160deg, var(--ink-900) 0%, var(--ink-800) 100%);
  color: var(--white);
  display: flex; flex-direction: column; justify-content: center; padding: 8vh 7vw;
  position: relative; overflow: hidden;
}
.login-brand::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 44px 44px;
}
.login-brand .arc { width: 88px; height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--brand), var(--lime)); margin-bottom: 34px; }
.login-brand h2 { font-size: clamp(26px, 3.2vw, 40px); font-weight: 700; line-height: 1.18; letter-spacing: -.5px; max-width: 480px; }
.login-brand h2 em { font-style: normal; color: var(--brand); }
.login-brand p.sub { margin-top: 14px; color: rgba(255,255,255,.62); font-size: 15px; max-width: 420px; }
.login-brand ul { list-style: none; margin-top: 42px; display: grid; gap: 14px; }
.login-brand li { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.82); font-size: 13.5px; }
.login-brand li .dot { width: 34px; height: 34px; border-radius: 9px; background: rgba(140,191,63,.16); border: 1px solid rgba(140,191,63,.35); display: flex; align-items: center; justify-content: center; color: var(--brand); flex-shrink: 0; }
.login-form-side { background: var(--white); display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.login-card { width: 100%; max-width: 372px; }
.login-head { text-align: left; padding: 0 0 26px; }
.login-head img.logo { max-width: 188px; height: auto; margin-bottom: 26px; }
.login-head h1 { font-size: 21px; font-weight: 700; color: var(--ink-900); letter-spacing: -.3px; }
.login-head p { color: var(--gray-500); font-size: 13.5px; margin-top: 4px; }
.login-body .btn { width: 100%; justify-content: center; margin-top: 10px; height: 42px; font-size: 14px; }
.login-foot { padding-top: 26px; font-size: 12px; color: var(--gray-400); }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--white); border-right: var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--gray-200) transparent;
}
.sidebar .brand { padding: 22px 22px 18px; border-bottom: var(--border); }
.sidebar .brand .logo-chip img { max-width: 158px; height: auto; display: block; }
.sidebar .brand small { display: block; margin-top: 8px; font-size: 10px; font-weight: 700; color: var(--gray-400); letter-spacing: 1.6px; text-transform: uppercase; }
.nav { flex: 1; padding: 14px 12px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin-bottom: 2px;
  color: var(--gray-600); font-size: 13.5px; font-weight: 600; border-radius: var(--radius-sm);
  text-decoration: none; transition: background .12s, color .12s; position: relative;
}
.nav a .ic { display: flex; align-items: center; color: var(--gray-400); transition: color .12s; }
.nav a:hover { background: var(--gray-100); color: var(--ink-800); text-decoration: none; }
.nav a:hover .ic { color: var(--gray-600); }
.nav a.active { background: var(--brand-050); color: var(--brand-800); }
.nav a.active .ic { color: var(--brand-700); }
.nav a.active::before { content: ''; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav a .nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 10px; font-weight: 800; border-radius: 10px; padding: 1px 7px; min-width: 18px; text-align: center; line-height: 1.5; }
.nav a.emergency { color: var(--red); }
.nav a.emergency .ic { color: var(--red); }
.nav a.emergency:hover { background: var(--red-050); }
.nav a.emergency.active { background: var(--red-050); color: var(--red-700); }
.nav a.emergency.active::before { background: var(--red); }
.nav .nav-sep { margin: 12px 12px; border-top: var(--border); }

/* ---- Menu agrupado por secoes, com busca e modo recolhido (estilo GEC) ---- */
.sidebar .brand { position: relative; }
.sidebar .brand .recolher {
  position: absolute; top: 20px; right: 14px; width: 24px; height: 24px; border-radius: 6px;
  border: var(--border); background: var(--white); color: var(--gray-600); cursor: pointer;
  font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center; transition: .12s;
}
.sidebar .brand .recolher:hover { background: var(--gray-100); color: var(--ink-800); }
.nav-busca { position: relative; margin: 12px 12px 4px; display: flex; align-items: center; }
.nav-busca .ic { position: absolute; left: 9px; display: flex; color: var(--gray-400); pointer-events: none; }
.nav-busca input {
  width: 100%; padding: 7px 10px 7px 30px; font-size: 12.5px; border: var(--border);
  border-radius: var(--radius-sm); background: var(--gray-050); color: var(--ink-800);
}
.nav-busca input:focus { outline: none; border-color: var(--brand); background: var(--white); }
.nav-grupo { margin-bottom: 10px; }
.nav-titulo {
  padding: 6px 12px 4px; font-size: 9.5px; font-weight: 800; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--gray-400);
}
.nav-vazio { padding: 10px 12px; font-size: 12px; color: var(--gray-400); }

/* Modo recolhido: so icones (rotulos, busca e textos somem) */
.layout.menu-recolhido { grid-template-columns: 68px 1fr; }
.menu-recolhido .sidebar .brand { padding: 18px 10px; text-align: center; }
.menu-recolhido .sidebar .brand .logo-chip img { max-width: 40px; margin: 0 auto; }
.menu-recolhido .sidebar .brand small,
.menu-recolhido .nav-busca,
.menu-recolhido .nav-titulo,
.menu-recolhido .nav a .rotulo,
.menu-recolhido .userbox .umeta { display: none; }
.menu-recolhido .sidebar .brand .recolher { position: static; margin: 10px auto 0; transform: rotate(180deg); }
.menu-recolhido .nav a { justify-content: center; padding: 10px 0; }
.menu-recolhido .nav a.active::before { left: 0; }
.menu-recolhido .userbox { justify-content: center; padding: 14px 8px; }
.sidebar .userbox { padding: 14px 16px; border-top: var(--border); display: flex; align-items: center; gap: 11px; }
.sidebar .userbox .uavatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--ink-800); color: var(--white);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.sidebar .userbox .umeta { min-width: 0; flex: 1; }
.sidebar .userbox b { color: var(--ink-800); display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .userbox span { color: var(--gray-500); font-size: 11.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .userbox .linkbtn { color: var(--gray-500); cursor: pointer; background: none; border: none; font-size: 11.5px; padding: 0; font-weight: 600; }
.sidebar .userbox .linkbtn:hover { color: var(--brand-700); }

/* ---------- Topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 0 28px; height: 60px;
  background: var(--white); border-bottom: var(--border); position: sticky; top: 0; z-index: 40;
}
.topbar .menu-btn { display: none; }
.topbar h2 { font-size: 15px; font-weight: 700; color: var(--ink-900); flex-shrink: 0; letter-spacing: -.2px; }
.searchbox { position: relative; margin-left: auto; width: min(360px, 42vw); }
.searchbox input {
  width: 100%; height: 36px; padding: 0 14px 0 36px; border: var(--border); border-radius: var(--radius-sm);
  background: var(--gray-050); font-size: 13px; outline: none; font-family: inherit; color: var(--ink-800);
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.searchbox input::placeholder { color: var(--gray-400); }
.searchbox input:focus { border-color: var(--brand); background: var(--white); box-shadow: var(--focus-ring); }
.searchbox .ic { position: absolute; left: 11px; top: 9px; color: var(--gray-400); pointer-events: none; }
.search-results {
  position: absolute; top: 44px; left: 0; right: 0; background: var(--white); border-radius: var(--radius);
  border: var(--border); box-shadow: var(--shadow-lg); max-height: 420px; overflow-y: auto; z-index: 60; padding: 6px;
}
.search-results .sr-item { display: block; padding: 8px 10px; border-radius: 7px; cursor: pointer; color: var(--ink-800); }
.search-results .sr-item:hover { background: var(--gray-100); text-decoration: none; }
.search-results .sr-item small { color: var(--gray-500); display: block; font-size: 12px; }
.search-results .sr-tipo { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--brand-700); font-weight: 700; display: block; }
.btn-sos {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 16px;
  background: var(--red); color: var(--white); border: none; border-radius: var(--radius-sm);
  font-weight: 700; cursor: pointer; font-size: 12.5px; letter-spacing: .4px; flex-shrink: 0; font-family: inherit;
  transition: background .12s;
}
.btn-sos:hover { background: var(--red-700); }

/* ---------- Conteúdo ---------- */
.content { padding: 26px 28px 70px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-size: 20px; font-weight: 700; color: var(--ink-900); letter-spacing: -.4px; }
.page-head .sub { color: var(--gray-500); font-size: 13px; width: 100%; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- KPI ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: var(--white); border-radius: var(--radius); border: var(--border); box-shadow: var(--shadow);
  padding: 18px 18px 16px; position: relative; overflow: hidden;
}
.kpi::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gray-300); }
.kpi, .kpi.blue { --kpi: var(--blue); }
.kpi.orange { --kpi: var(--amber); }
.kpi.red { --kpi: var(--red); }
.kpi.green { --kpi: var(--green); }
.kpi.gray { --kpi: var(--gray-400); }
.kpi::before { background: var(--kpi); }
.kpi .num { font-size: 26px; font-weight: 700; color: var(--ink-900); line-height: 1.1; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi .lbl { font-size: 10.5px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .9px; margin-top: 5px; }

/* ---------- Cards ---------- */
.card {
  background: var(--white); border-radius: var(--radius); border: var(--border); box-shadow: var(--shadow);
  padding: 20px 22px; margin-bottom: 18px;
}
.card h3 {
  font-size: 13px; font-weight: 700; color: var(--ink-900); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px; letter-spacing: -.1px;
}
.card h3 .ic { color: var(--brand-700); display: inline-flex; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }
.chart-box { position: relative; height: 240px; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 8px 10px; color: var(--gray-500); font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px; white-space: nowrap; border-bottom: 1px solid var(--gray-200);
}
.tbl td { padding: 10px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; color: var(--ink-800); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--gray-050); }
.tbl tr.clickable { cursor: pointer; }
/* Anel de foco por teclado nos elementos clicáveis não-nativos */
.tbl tr.clickable:focus-visible, .noc-tile:focus-visible, .cal-ev[role]:focus-visible,
.news-item:focus-visible, .dir-card:focus-visible, .pin:focus-visible, .noc-alert:focus-visible {
  outline: 2px solid var(--brand); outline-offset: -2px; box-shadow: var(--focus-ring);
}
/* Calendário de reservas: rolagem horizontal no mobile (células legíveis em vez de espremidas) */
.cal-scroll { overflow-x: auto; }
@media (max-width: 640px) { .cal-grid { min-width: 600px; } }
.tbl .right { text-align: right; }
.empty { padding: 30px; text-align: center; color: var(--gray-500); font-size: 13px; }

/* ---------- Badges (dot + label) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; white-space: nowrap; letter-spacing: .2px;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.b-blue { background: var(--blue-050); color: var(--blue); }
.b-green { background: var(--green-050); color: var(--green); }
.b-orange { background: var(--amber-050); color: #8a5e0a; }
.b-red { background: var(--red-050); color: var(--red); }
.b-gray { background: var(--gray-100); color: #52564f; }
.b-purple { background: var(--purple-050); color: var(--purple); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--ink-800); color: var(--white); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .12s, border-color .12s, box-shadow .12s; text-decoration: none; font-family: inherit;
  white-space: nowrap;
}
.btn:hover { background: var(--ink-700); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn.orange { background: var(--brand); color: #17240a; }
.btn.orange:hover { background: var(--brand-600); }
.btn.red { background: var(--red); }
.btn.red:hover { background: var(--red-700); }
.btn.green { background: var(--green); }
.btn.green:hover { background: #1d7c46; }
.btn.ghost { background: var(--white); color: var(--ink-800); border-color: var(--gray-200); }
.btn.ghost:hover { background: var(--gray-050); border-color: var(--gray-300); }
.btn.sm { height: 29px; padding: 0 11px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Formulários ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-700); margin-bottom: 5px; }
.field label .req { color: var(--red); }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit; background: var(--white); outline: none; color: var(--ink-800);
  transition: border-color .12s, box-shadow .12s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--gray-500); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: var(--focus-ring); }
.field textarea { resize: vertical; min-height: 72px; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.checks label {
  display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: var(--ink-700);
  background: var(--gray-050); border: 1px solid var(--gray-150); padding: 9px 11px; border-radius: var(--radius-sm); cursor: pointer;
  transition: border-color .12s, background .12s;
}
.checks label:hover { border-color: var(--gray-300); }
.checks label:has(input:checked) { border-color: var(--brand); background: var(--brand-050); }
.checks input { accent-color: var(--brand-600); width: 15px; height: 15px; }

/* ---------- Filtros ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px;
  background: var(--white); border: var(--border); border-radius: var(--radius); padding: 14px 16px;
}
.filters .field { min-width: 140px; }
.filters .field input, .filters .field select { padding: 6px 10px; font-size: 12.5px; }
.filters .field label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--gray-500); }
.filters .btn { height: 32px; }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(30, 32, 35, .5); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 100; overflow-y: auto;
  animation: fadein .15s ease;
}
@keyframes fadein { from { opacity: 0; } }
.modal { background: var(--white); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 760px; margin-bottom: 5vh; animation: pop .18s ease; }
@keyframes pop { from { transform: translateY(10px) scale(.99); opacity: 0; } }
.modal.sm { max-width: 460px; }
.modal.lg { max-width: 980px; }
.modal-head { display: flex; align-items: center; padding: 18px 24px 14px; }
.modal-head h3 { font-size: 15.5px; font-weight: 700; color: var(--ink-900); letter-spacing: -.2px; }
.modal-head .x {
  margin-left: auto; background: none; border: none; width: 30px; height: 30px; border-radius: 7px;
  font-size: 20px; color: var(--gray-400); cursor: pointer; line-height: 1;
}
.modal-head .x:hover { background: var(--gray-100); color: var(--ink-800); }
.modal-body { padding: 8px 24px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: var(--border); background: var(--gray-050); border-radius: 0 0 14px 14px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink-900); color: var(--white); padding: 12px 18px; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 600; max-width: 380px; animation: slideup .22s ease;
  border-left: 3px solid var(--brand);
}
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--brand); }
@keyframes slideup { from { transform: translateY(10px); opacity: 0; } }

/* ---------- Notícias ---------- */
.news-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.news-item { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--gray-100); cursor: pointer; }
.news-item:first-child { padding-top: 4px; }
.news-item:last-child { border-bottom: none; padding-bottom: 4px; }
.news-item img { width: 118px; height: 80px; object-fit: cover; border-radius: var(--radius-sm); flex-shrink: 0; }
.news-item .thumb {
  width: 118px; height: 80px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: linear-gradient(140deg, var(--ink-800), var(--ink-700));
  color: var(--brand); display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; letter-spacing: 1px;
}
.news-item h4 { font-size: 14.5px; font-weight: 700; color: var(--ink-900); margin: 5px 0 3px; letter-spacing: -.2px; }
.news-item:hover h4 { color: var(--brand-700); }
.news-item p { font-size: 12.5px; color: var(--gray-500); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-item .meta { font-size: 11px; color: var(--gray-400); margin-top: 5px; }
.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.quick-links a {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 13px 14px;
  background: var(--white); border: var(--border); border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 700; color: var(--ink-800); transition: border-color .12s, background .12s;
}
.quick-links a .ic { color: var(--brand-700); display: inline-flex; background: var(--brand-050); border-radius: 8px; padding: 7px; }
.quick-links a:hover { border-color: var(--brand); background: var(--brand-050); text-decoration: none; }
.quick-links a.ql-red .ic { color: var(--red); background: var(--red-050); }
.quick-links a.ql-red:hover { border-color: var(--red); background: var(--red-050); }
.bday { display: flex; align-items: center; gap: 11px; padding: 8px 0; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
.bday:last-child { border: none; }
.bday .day {
  background: var(--brand-050); color: var(--brand-800); border: 1px solid var(--brand-100);
  font-weight: 700; font-size: 13px; border-radius: var(--radius-sm); width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-variant-numeric: tabular-nums;
}

/* ---------- Diretório ---------- */
.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.dir-card {
  background: var(--white); border-radius: var(--radius); border: var(--border); box-shadow: var(--shadow);
  padding: 16px; display: flex; gap: 13px; align-items: flex-start;
}
.dir-card .avatar {
  width: 46px; height: 46px; border-radius: 50%; background: var(--ink-800); color: var(--white);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0; overflow: hidden;
}
.dir-card .avatar img { width: 100%; height: 100%; object-fit: cover; }
.dir-card b { display: block; font-size: 13.5px; color: var(--ink-900); letter-spacing: -.1px; }
.dir-card small { display: block; color: var(--gray-500); font-size: 12px; line-height: 1.55; }

/* ---------- Calendário ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-head h3 { margin: 0 8px; min-width: 168px; text-align: center; font-size: 14.5px; font-weight: 700; color: var(--ink-900); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-grid .dow { text-align: center; font-size: 10px; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: .8px; padding: 4px 0; }
.cal-cell { min-height: 92px; background: var(--white); border: 1px solid var(--gray-150); border-radius: var(--radius-sm); padding: 5px 6px; font-size: 11px; overflow: hidden; }
.cal-cell.out { background: var(--gray-050); opacity: .5; }
.cal-cell.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-cell .dnum { font-weight: 700; color: var(--gray-500); font-size: 11px; }
.cal-cell.today .dnum { color: var(--brand-700); }
.cal-ev {
  display: block; background: var(--brand-050); color: var(--brand-800); border-left: 2px solid var(--brand);
  border-radius: 4px; padding: 2px 6px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; font-weight: 600;
}
.cal-ev.veiculo { background: var(--amber-050); color: var(--amber); border-left-color: var(--amber); }
.cal-ev.equipamento { background: var(--purple-050); color: var(--purple); border-left-color: var(--purple); }

/* ---------- Emergência ---------- */
.emg-hero {
  background: linear-gradient(140deg, var(--red) 0%, var(--red-700) 100%);
  color: var(--white); border-radius: var(--radius); padding: 26px 28px; margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.emg-hero::after { content: ''; position: absolute; right: -40px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.06); }
.emg-hero h1 { font-size: 23px; font-weight: 700; margin-bottom: 4px; letter-spacing: -.3px; }
.emg-hero p { color: rgba(255,255,255,.85); font-size: 13.5px; max-width: 640px; }
.emg-contacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 12px; }
.emg-contact { background: var(--white); border-radius: var(--radius-sm); border: var(--border); padding: 14px 16px; border-left: 4px solid var(--red); }
.emg-contact.externo { border-left-color: var(--ink-700); }
.emg-contact b { font-size: 13px; color: var(--ink-900); }
.emg-contact .tel { font-size: 17px; font-weight: 800; color: var(--red); letter-spacing: -.3px; }
.emg-contact.externo .tel { color: var(--ink-800); }
.emg-contact a.tel { text-decoration: none; }
.proc { background: var(--white); border-radius: var(--radius-sm); border: var(--border); margin-bottom: 10px; overflow: hidden; }
.proc summary { padding: 14px 18px; font-weight: 700; font-size: 13.5px; color: var(--ink-900); cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; }
.proc summary::-webkit-details-marker { display: none; }
.proc summary::before { content: '›'; color: var(--brand-700); font-size: 17px; font-weight: 700; transition: transform .15s; width: 12px; }
.proc[open] summary::before { transform: rotate(90deg); }
.proc .proc-body { padding: 0 18px 16px 40px; white-space: pre-line; color: var(--ink-700); font-size: 13px; }
.proc .proc-meta { padding: 0 18px 12px 40px; font-size: 11px; color: var(--gray-400); }

/* ---------- Timeline ---------- */
.timeline { border-left: 2px solid var(--gray-150); margin-left: 6px; padding-left: 20px; }
.tl-item { position: relative; padding-bottom: 15px; font-size: 12.5px; color: var(--ink-700); }
.tl-item:last-child { padding-bottom: 2px; }
.tl-item::before {
  content: ''; position: absolute; left: -26px; top: 4px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--brand); border: 2px solid var(--white); box-shadow: 0 0 0 1.5px var(--gray-200);
}
.tl-item b { color: var(--ink-900); text-transform: capitalize; }
.tl-item small { color: var(--gray-400); display: block; font-size: 11px; margin-top: 1px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tabs button {
  background: none; border: none; padding: 9px 14px; font-size: 13px; font-weight: 700; color: var(--gray-500);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: inherit; transition: color .12s;
}
.tabs button:hover { color: var(--ink-800); }
.tabs button.active { color: var(--brand-800); border-bottom-color: var(--brand); }

/* ---------- Detalhes ---------- */
.pt-det .sec { margin-bottom: 14px; }
.pt-det .sec h4, .card .sec h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .9px; color: var(--gray-500); border-bottom: 1px solid var(--gray-150); padding-bottom: 6px; margin-bottom: 10px; }
.det-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 18px; font-size: 13px; color: var(--ink-800); }
.det-grid .lbl, .lbl { font-size: 10px; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: .7px; display: block; margin-bottom: 1px; }

/* ---------- Impressão ---------- */
@media print {
  .sidebar, .topbar, .page-head .actions, .btn, .no-print, #toast-root { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #bbb; page-break-inside: avoid; }
  body { background: #fff; font-size: 12px; }
}

/* ---------- Responsivo ---------- */
@media (max-width: 1080px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}
@media (max-width: 980px) {
  .grid-2, .grid-3, .news-grid, .form-grid { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); z-index: 90; transform: translateX(-100%); transition: transform .2s ease; height: 100vh; box-shadow: none; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .topbar { padding: 0 16px; }
  .topbar .menu-btn { display: inline-flex; align-items: center; background: none; border: none; cursor: pointer; color: var(--ink-800); padding: 6px; }
  .topbar h2 { font-size: 13.5px; }
  .searchbox { width: auto; flex: 1; }
  .content { padding: 18px 14px 60px; }
  .cal-cell { min-height: 62px; }
  .backdrop { position: fixed; inset: 0; background: rgba(30,32,35,.45); z-index: 80; }
}

/* ===== Permissão de Trabalho (FORM-027-QHSE) ===== */
.pt-form .pt-sec { margin: 18px 0 8px; font-size: 13px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; color: var(--brand-800); border-bottom: 2px solid var(--brand-100); padding-bottom: 5px; }
.pt-form .pt-sec:first-of-type { margin-top: 4px; }
.pt-natureza { display: flex; gap: 10px; margin-bottom: 6px; }
.pt-natureza label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  padding: 11px 12px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); font-weight: 700;
  font-size: 14px; color: var(--gray-600); transition: .12s; }
.pt-natureza input { accent-color: var(--brand); }
.pt-natureza label:has(input:checked) { border-color: var(--brand); background: var(--brand-050); color: var(--brand-800); }
.pt-tipos { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.pt-ctrl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pt-ctrl-group { border: var(--border); border-radius: var(--radius-sm); padding: 9px 11px; background: var(--gray-100); }
.pt-ctrl-group h5 { margin: 0 0 6px; font-size: 12px; font-weight: 800; color: var(--brand-800); line-height: 1.25; }
.pt-chk { display: flex; align-items: flex-start; gap: 8px; padding: 3px 0; font-size: 12.5px; line-height: 1.3; cursor: pointer; }
.pt-chk input { margin-top: 2px; accent-color: var(--brand); flex-shrink: 0; }
.pt-epi-extra { margin-top: 8px; display: grid; gap: 4px; }
.pt-epi-extra label { font-size: 11px; font-weight: 700; color: var(--gray-600); }
.pt-epi-extra input { width: 100%; padding: 5px 7px; font-size: 12.5px; border: var(--border); border-radius: 6px; }
.pt-aviso { margin-top: 12px; padding: 9px 12px; background: var(--brand-050); border-left: 4px solid var(--brand);
  border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--brand-800); }
/* Detalhe da PT: checklists */
.pt-check-line { display: flex; align-items: flex-start; gap: 9px; padding: 3px 0; font-size: 13px; line-height: 1.3; }
.pt-check-line.off { color: var(--gray-400); }
.pt-check-line .pt-box { width: 17px; height: 17px; border-radius: 5px; display: inline-flex; align-items: center;
  justify-content: center; flex-shrink: 0; font-size: 11px; font-weight: 800; border: 1.5px solid var(--gray-200); }
.pt-check-line.on .pt-box { background: var(--brand); color: #fff; border-color: var(--brand); }
.pt-ctrl-det { margin-bottom: 12px; }
.pt-ctrl-det b { display: block; font-size: 12.5px; color: var(--brand-800); margin-bottom: 3px; }
@media (max-width: 900px) { .pt-ctrl-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .pt-ctrl-grid, .pt-tipos { grid-template-columns: 1fr; } }

/* ---- Assinatura digital: tela de assinar ---- */
.pt-assinar-lbl { display: block; margin: 16px 0 6px; font-size: 13px; font-weight: 800; color: var(--brand-800); }
.pt-assinar-lbl .req { color: #c0392b; }
.pt-cam { position: relative; background: #10161c; border-radius: var(--radius-sm); overflow: hidden;
  aspect-ratio: 4 / 3; max-width: 420px; display: flex; align-items: center; justify-content: center; }
.pt-cam video, .pt-cam img { width: 100%; height: 100%; object-fit: cover; }
.pt-cam-msg { color: #cbd3da; font-size: 13px; text-align: center; padding: 18px; }
.pt-cam-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pt-pad-wrap { border: 1.5px dashed var(--gray-300, #cfd3cb); border-radius: var(--radius-sm); background:
  repeating-linear-gradient(0deg, #fff, #fff 34px, #eef1ea 35px); max-width: 600px; }
#pad { width: 100%; height: 180px; touch-action: none; cursor: crosshair; display: block; }
.pt-geo { margin-top: 14px; font-size: 13px; color: var(--gray-600); background: var(--gray-100);
  border-radius: 6px; padding: 8px 11px; }
.pt-geo.ok { color: var(--brand-800); background: var(--brand-050); }
.pt-consent { display: flex; gap: 10px; margin-top: 14px; padding: 12px; border: 1.5px solid var(--brand-100);
  border-radius: var(--radius-sm); background: var(--brand-050); font-size: 12px; line-height: 1.45; cursor: pointer; color: #35431f; }
.pt-consent input { margin-top: 2px; width: 18px; height: 18px; accent-color: var(--brand); flex-shrink: 0; }
/* ---- Assinatura digital: cartão no detalhe ---- */
.pt-assin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pt-assin { display: flex; gap: 12px; border: var(--border); border-radius: var(--radius-sm); padding: 11px; background: var(--gray-050); }
.pt-assin.alterada { border-color: #e6a6a0; background: #fdf3f2; }
.pt-assin-selfie { width: 84px; height: 84px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--gray-200);
  display: flex; align-items: center; justify-content: center; }
.pt-assin-selfie img { width: 100%; height: 100%; object-fit: cover; }
.pt-assin-selfie span { font-size: 11px; color: var(--gray-500); }
.pt-assin-info { min-width: 0; flex: 1; }
.pt-assin-top { display: flex; gap: 6px; margin-bottom: 4px; }
.pt-assin-firma { margin: 5px 0; }
.pt-assin-firma img { max-height: 46px; background: #fff; border: var(--border); border-radius: 5px; padding: 2px; }
.pt-assin-ev { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--gray-600); margin: 5px 0; }
.pt-hash { font-family: ui-monospace, monospace; }
.pt-assin-aceite { font-size: 10.5px; color: var(--gray-500); line-height: 1.35; margin-top: 4px;
  max-height: 48px; overflow: auto; }
@media (max-width: 720px) { .pt-assin-grid { grid-template-columns: 1fr; } }
/* ---- Assinatura externa (ZapSign) ---- */
.pt-ext-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pt-ext { border: var(--border); border-radius: var(--radius-sm); padding: 11px; background: var(--gray-050); }
.pt-ext-top { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.pt-ext-ev { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--gray-600); margin: 5px 0; }
.pt-ext-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.pt-zap-ok { text-align: center; padding: 6px; }
.pt-zap-qr { width: 220px; height: 220px; margin: 10px auto; display: block; border: var(--border); border-radius: 8px; padding: 6px; background: #fff; }
.pt-zap-link { font-family: ui-monospace, monospace; font-size: 11px; color: var(--gray-600); word-break: break-all; }
@media (max-width: 720px) { .pt-ext-grid { grid-template-columns: 1fr; } }
/* ---- Melhorias GAP: bloqueios, sugestoes, revalidacao e avisos ---- */
.pt-func-irregular { opacity: .62; cursor: not-allowed; }
.pt-func-irregular .badge { margin-left: 6px; }
.pt-ctrl-group.pt-sugerido { border-color: var(--brand); box-shadow: 0 0 0 1.5px var(--brand-100); background: var(--brand-050); }
.pt-sug-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: var(--brand);
  color: #fff; font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; vertical-align: middle; }
.pt-rev { padding: 7px 0; border-bottom: 1px dashed var(--gray-150); font-size: 13px; }
.pt-rev:last-child { border-bottom: 0; }
.pt-rev small { color: var(--gray-600); }
.pt-alerta { padding: 5px 0; font-size: 13px; border-bottom: 1px dashed var(--gray-150); }
.pt-alerta:last-child { border-bottom: 0; }
/* ---- Documentos e treinamentos (cadastro de empresas/colaboradores) ---- */
.doc-sub { font-size: 12px; color: var(--gray-600); margin: -4px 0 10px; }
.doc-cat { margin: 12px 0 4px; font-size: 10px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand-800); }
.doc-cat:first-child { margin-top: 0; }
.doc-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px dashed var(--gray-150); }
.doc-item:last-child { border-bottom: 0; }
.doc-nome { min-width: 0; flex: 1; font-size: 13px; line-height: 1.3; }
.doc-nome small { display: block; font-size: 11.5px; color: var(--gray-600); margin-top: 1px; }
.doc-acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.doc-data { padding: 4px 7px; font-size: 12px; border: var(--border); border-radius: 6px; color: var(--ink-800); }
.doc-anexar { cursor: pointer; }
.doc-recusa { color: var(--red) !important; }
.doc-espera { font-size: 11.5px; color: var(--gray-600); font-style: italic; }
.cad-det .det-grid a { font-weight: 600; }

/* ---- Listagem: chips de filtros ativos, celulas de 2 linhas e rodape ---- */
.lista-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 0 0 12px; }
.lista-chips .chips-contador { display: inline-flex; align-items: center; justify-content: center; min-width: 20px;
  height: 20px; padding: 0 6px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 800; }
.lista-chips .chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 11px;
  border-radius: 99px; background: var(--gray-100); border: var(--border); font-size: 12px; color: var(--ink-800); }
.lista-chips .chip button { width: 17px; height: 17px; border: 0; border-radius: 50%; background: var(--gray-200);
  color: var(--gray-600); font-size: 12px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lista-chips .chip button:hover { background: var(--red); color: #fff; }
.lista-chips .chip-limpar { border: 0; background: none; color: var(--gray-600); font-size: 12px;
  text-decoration: underline; cursor: pointer; padding: 4px 6px; }
.lista-chips .chip-limpar:hover { color: var(--ink-800); }
.cel-sec { display: block; margin-top: 1px; font-size: 11.5px; color: var(--gray-600); font-weight: 400; }
.lista-rodape { margin-top: 10px; font-size: 12.5px; color: var(--gray-600); }

/* ---- Cabecalho de entidade + menu Acoes (padrao de pagina de modulo) ---- */
.ent-head { background: var(--white); border: var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.ent-head > .btn.sm { margin-bottom: 10px; }
.ent-ident { display: flex; align-items: flex-start; gap: 14px; }
.ent-avatar { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; font-size: 20px; border: 2px solid var(--brand-100); background: var(--brand-050); }
.ent-avatar.frio { border-color: #cfe4f5; background: #eef6fd; }
.ent-titulo { min-width: 0; flex: 1; }
.ent-titulo h1 { font-size: 21px; line-height: 1.25; margin: 0 0 7px; }
.ent-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.ent-acoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.menu-acoes { position: relative; }
.menu-lista { position: absolute; right: 0; top: calc(100% + 5px); min-width: 210px; z-index: 50;
  background: var(--white); border: var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 5px; }
.menu-lista button { display: block; width: 100%; text-align: left; padding: 8px 11px; border: 0; background: none;
  border-radius: 6px; font: inherit; font-size: 13px; color: var(--ink-800); cursor: pointer; }
.menu-lista button:hover { background: var(--gray-100); }
.menu-lista button.perigo { color: var(--red); }
.menu-lista button.perigo:hover { background: var(--red-050); }
.menu-lista .menu-sep { margin: 5px 8px; border-top: var(--border); }
.aba-painel[hidden] { display: none; }
@media (min-width: 720px) {
  .ent-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px 18px; }
  .ent-head > .btn.sm { grid-column: 1 / -1; margin-bottom: 2px; justify-self: start; }
  .ent-acoes { margin-top: 0; }
}

/* ---- Formulario da PT em pagina cheia ---- */
.pt-pagina { padding-bottom: 76px; }                 /* espaco para a barra de acoes fixa */
.pt-pagina .pt-form-tag { padding: 3px 10px; border-radius: 99px; background: var(--brand-050);
  color: var(--brand-800); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.pt-pagina #pt-form-card { padding: 18px 20px; }
.pt-barra-acoes { position: sticky; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
  margin: 14px 0 0; padding: 12px 16px; background: var(--white); border: var(--border);
  border-radius: var(--radius); box-shadow: 0 -2px 12px rgba(20,24,28,.07); }
.pt-barra-acoes .pt-rasc-status { margin-right: auto; }
@media (max-width: 640px) { .pt-pagina #pt-form-card { padding: 14px 12px; } }

/* ---- Rascunho automatico do formulario de PT ---- */
.pt-rascunho { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between;
  margin-bottom: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: #fff8e6; border: 1px solid #e8d59a; color: #6b4e11; font-size: 13px; }
.pt-rasc-acts { display: flex; gap: 8px; }
.pt-rasc-status { margin-right: auto; font-size: 11.5px; color: var(--gray-600); align-self: center; }

/* ============================================================
   RESPONSIVO — camada final (mobile / tablet)
   Regras aditivas: nao mudam cores, fontes nem a identidade.
   Objetivo: o CORPO da pagina nunca rola na horizontal;
   o que for largo (tabelas, calendario, chips) rola dentro do
   proprio container. Alvos de toque >= 40px no celular.
   Fica no fim do arquivo de proposito: precisa vencer o CSS
   injetado por JS (#mon-css / #mural-css) em specificity/ordem.
   ============================================================ */

/* ---- 1. Trava global de rolagem horizontal do corpo ---- */
html, body { max-width: 100%; }
.layout, .main, .content { min-width: 0; }
img, video, canvas, iframe { max-width: 100%; }
.tbl td, .tbl th, .det-grid, .doc-nome, .cel-sec { overflow-wrap: anywhere; }

/* Itens de grid nao podem impor o proprio min-content ao track (causa
   principal do estouro: `1fr` = minmax(min-content, 1fr)). */
.grid-2 > *, .grid-3 > *, .news-grid > *, .form-grid > *, .kpi-row > *,
.dir-grid > *, .det-grid > *, .checks > *, .emg-contacts > *, .quick-links > *,
.pt-ctrl-grid > *, .pt-tipos > *, .pt-assin-grid > *, .pt-ext-grid > *,
.mon-grid > *, .gf-panels > *, .noc-body > *, .noc-overview > *,
.noc-counts > *, .noc-mosaic > *, .noc-typerow > * { min-width: 0; }

/* Tabela sempre rola dentro do container, nunca empurra a pagina */
.table-wrap { -webkit-overflow-scrolling: touch; max-width: 100%; }
.cal-scroll { -webkit-overflow-scrolling: touch; }
.card:has(> table.tbl) { overflow-x: auto; }          /* rede de seguranca */

/* ---- 2. Tablet (<= 980px): topbar e sidebar sobreposta ---- */
@media (max-width: 980px) {
  .topbar { gap: 10px; }
  .topbar .menu-btn { min-width: 40px; min-height: 40px; justify-content: center; }
  .topbar h2 { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .searchbox { flex: 1 1 120px; min-width: 0; }
  .searchbox input { min-width: 0; }
  .sidebar { overscroll-behavior: contain; }
  body:has(.sidebar.open) { overflow: hidden; }        /* trava o fundo com o menu aberto */
  .grid-2, .grid-3, .news-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .noc-body { grid-template-columns: minmax(0, 1fr); }
}

/* ---- 3. Celular (<= 640px) ---- */
@media (max-width: 640px) {
  /* obs.: o padding lateral de .content permanece 14px (bloco <=980px) porque o
     tema NOC (.mon-noc, CSS injetado) usa margin -14px para sangrar ate a borda */

  /* Topbar: menu + titulo + busca + SOS so com icone (o rotulo cabe no menu lateral) */
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar h2 { max-width: 38vw; }
  .btn-sos { width: 40px; height: 40px; padding: 0; gap: 0; font-size: 0; justify-content: center; }
  .btn-sos .ic-svg { vertical-align: 0; }

  /* Cabecalho de pagina: acoes em linha propria, ocupando a largura */
  .page-head { gap: 10px; margin-bottom: 16px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions > .btn, .page-head .actions > a.btn { flex: 1 1 auto; justify-content: center; }

  /* Alvos de toque */
  .btn { height: 40px; padding: 0 14px; }
  .btn.sm { height: 34px; padding: 0 12px; }
  .filters .btn { height: 40px; }
  .tabs button { padding: 12px 13px; }
  .nav a { padding: 11px 12px; }
  .menu-lista button { padding: 11px 12px; }
  .tbl td { padding: 12px 10px; }
  .sidebar .userbox { padding: 14px 16px 18px; }

  /* Cards e tabelas: menos respiro lateral, tabela rolando por dentro */
  .card { padding: 16px 14px; }
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
  .kpi { padding: 14px 14px 12px; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }

  /* Formularios: 1 coluna e campos confortaveis.
     16px no input evita o auto-zoom do iOS (que gera rolagem lateral). */
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .checks { grid-template-columns: minmax(0, 1fr); }
  .field input, .field select, .field textarea { font-size: 16px; padding: 10px 11px; }
  .filters { padding: 12px; gap: 10px; }
  /* !important porque algumas paginas trazem min-width inline (admin/relatorios)
     e o valor fixo (300/320px) estoura a tela em celulares estreitos */
  .filters .field { min-width: 0 !important; flex: 1 1 150px; }
  .filters .field input, .filters .field select { font-size: 16px; padding: 8px 10px; }
  .searchbox input { font-size: 16px; }

  /* Filtros ativos / chips: rolam dentro do proprio bloco */
  .lista-chips { flex-wrap: wrap; }

  /* Modal ocupa bem a tela pequena */
  .modal-back { padding: 10px 10px 24px; }
  .modal { border-radius: 12px; margin-bottom: 10px; }
  .modal-head { padding: 14px 16px 10px; }
  .modal-head .x { width: 40px; height: 40px; font-size: 24px; }
  .modal-body { padding: 6px 16px 16px; }
  .modal-foot { padding: 12px 16px; flex-wrap: wrap; border-radius: 0 0 12px 12px; }
  .modal-foot .btn { flex: 1 1 auto; justify-content: center; }

  /* Toast nao cola nas bordas */
  #toast-root { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }

  /* Diversos */
  .emg-hero { padding: 20px 16px; }
  .news-item img, .news-item .thumb { width: 92px; height: 66px; }
  .cal-head h3 { min-width: 0; flex: 1 1 100%; order: -1; }
}

/* ---- 4. Cabecalho de entidade / documentos (<= 560px) ---- */
@media (max-width: 560px) {
  .ent-head { padding: 14px; }
  .ent-ident { gap: 11px; }
  .ent-avatar { width: 40px; height: 40px; font-size: 17px; }
  .ent-titulo h1 { font-size: 18px; }
  .ent-acoes { width: 100%; }
  .ent-acoes > .btn, .ent-acoes > .menu-acoes { flex: 1 1 140px; }
  .ent-acoes > .btn { justify-content: center; }
  .menu-acoes > .btn { width: 100%; justify-content: center; }
  .menu-lista { left: 0; right: 0; min-width: 0; }

  /* Documento: nome em cima, acoes numa faixa propria */
  .doc-item { align-items: flex-start; gap: 8px; }
  .doc-nome { flex: 1 1 100%; }
  .doc-acoes { width: 100%; }
  .doc-acoes .doc-data { flex: 1 1 130px; min-width: 0; height: 34px; }
  .doc-acoes .btn.sm { flex: 0 0 auto; }
}

/* ---- 5. Formulario da PT (<= 560px) ---- */
@media (max-width: 560px) {
  .pt-natureza { flex-wrap: wrap; gap: 8px; }
  .pt-natureza label { flex: 1 1 100%; }
  .pt-ctrl-group { padding: 10px 12px; }
  .pt-chk { padding: 5px 0; }
  .pt-chk input { width: 17px; height: 17px; }
  .pt-epi-extra input { font-size: 16px; padding: 8px 9px; }
  .pt-barra-acoes { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .pt-barra-acoes .pt-rasc-status { flex: 1 1 100%; margin-right: 0; }
  .pt-barra-acoes .btn { flex: 1 1 130px; justify-content: center; }
  .pt-pagina { padding-bottom: 96px; }
  .pt-rascunho { gap: 8px; }
  .pt-rasc-acts { width: 100%; }
  .pt-rasc-acts .btn { flex: 1 1 auto; justify-content: center; }
  .pt-cam-acts .btn { flex: 1 1 130px; justify-content: center; }
  .pt-assin { flex-wrap: wrap; }
  .pt-zap-qr { width: 180px; height: 180px; }
}

/* ---- 6. Monitoramento / NOC (tema escuro preservado) ---- */
@media (max-width: 1080px) {
  .mon-noc .noc-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .mon-noc .noc { padding: 16px 14px 18px; border-radius: 12px; }
  .mon-noc .noc-panel { padding: 14px 14px; margin-bottom: 14px; }
  .mon-noc .noc-head { flex-wrap: wrap; gap: 10px; padding-bottom: 12px; margin-bottom: 14px; }
  .mon-noc .noc-title { flex: 1 1 100%; flex-wrap: wrap; gap: 8px 10px; letter-spacing: 1.4px; min-width: 0; }
  .mon-noc .noc-title small { flex: 1 1 100%; }
  .mon-noc .noc-headright { width: 100%; justify-content: space-between; gap: 10px; }
  .mon-noc .noc-fs-btn { min-width: 40px; min-height: 40px; justify-content: center; }
  .mon-noc .noc-overview { grid-template-columns: minmax(0, 1fr); gap: 16px; justify-items: center; }
  .mon-noc .noc-counts { width: 100%; grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); gap: 8px; }
  .mon-noc .noc-typerow { grid-template-columns: 78px minmax(0, 1fr) auto; gap: 10px; }
  .mon-noc .noc-typeval { min-width: 0; }
  .mon-noc .noc-mosaic { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
  .mon-noc .noc-legend { flex-wrap: wrap; gap: 8px 16px; }
  .mon-noc .noc-feed { max-height: none; padding-right: 0; }
  .mon-noc .mon-grid, .content .mon-grid { grid-template-columns: minmax(0, 1fr); }
  .mon-noc .gf-panels, .content .gf-panels { grid-template-columns: minmax(0, 1fr); }
  .mon-noc .g-toolbar, .content .g-toolbar { gap: 8px; }
  .mon-noc .fg-head, .content .fg-head { gap: 10px; }
}
@media (max-width: 480px) {
  .mon-noc .noc-gauge { width: 148px; height: 148px; }
  .mon-noc .noc-gauge-center b { font-size: 30px; }
}
