:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2533;
  --muted: #667085;
  --line: #d7dee8;
  --primary: #284028;
  --primary-dark: #1d301d;
  --blue: #284028;
  --gold: #c79a35;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --success: #067647;
  --success-bg: #ecfdf3;
  --warning: #b54708;
  --warning-bg: #fffaeb;
  --radius: 18px;
  --shadow: 0 8px 25px rgba(31, 37, 51, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-size: 17px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 90px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 74px;
  padding: 10px 16px;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  border-bottom: 4px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 128px; height: 48px; object-fit: contain; }
.brand strong { display: block; color: var(--primary); line-height: 1.1; }
.brand small { display: block; color: var(--muted); margin-top: 2px; }
.menu-btn {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-size: 25px;
  color: var(--primary);
}
.nav {
  position: fixed;
  left: 12px;
  right: 12px;
  top: 82px;
  z-index: 25;
  max-height: calc(100vh - 105px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 8px;
  transform: translateY(-12px);
  opacity: 0;
  pointer-events: none;
  transition: .18s ease;
}
.menu-open .nav { transform: translateY(0); opacity: 1; pointer-events: auto; }
.nav span {
  display: block;
  padding: 14px 14px 6px;
  color: var(--primary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 900;
}
.nav a {
  display: block;
  padding: 13px 16px;
  border-radius: 12px;
  color: var(--text);
  font-weight: 700;
}
.nav a:hover { background: var(--bg); }
.container { width: min(1180px, 100%); margin: 0 auto; padding: 18px 14px 24px; }
.login-wrap { min-height: 88vh; display: grid; place-items: center; padding: 22px 0; }
.login-card {
  width: min(430px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.login-logo { width: min(310px, 90%); margin: 0 auto 18px; }
.login-card h1 { margin: 0 0 6px; font-size: 29px; line-height: 1.05; text-align: center; color: var(--primary); }
.login-card p { color: var(--muted); margin: 0 0 22px; text-align: center; }
.hint { margin-top: 16px; padding: 12px; background: var(--bg); border-radius: 14px; color: var(--muted); font-size: 15px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.page-head h1 { margin: 0 0 4px; font-size: 29px; color: var(--primary); }
.page-head p { margin: 0; color: var(--muted); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.center-card { text-align: center; }
.card h2 { margin: 0 0 12px; font-size: 21px; color: var(--blue); }
.card h3 { margin: 18px 0 6px; font-size: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.module-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
.module-card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.module-card strong { font-size: 21px; color: var(--primary); }
.module-card p { margin: 7px 0 0; color: var(--muted); }
.cards-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.stat-card span { color: var(--muted); font-size: 15px; display: block; }
.stat-card strong { font-size: 31px; margin-top: 6px; display: block; color: var(--blue); }
.stat-card.danger strong { color: var(--danger); }
.stat-card.warning strong { color: var(--warning); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-title h2 { margin: 0; }
.section-title a, .section-title span { color: var(--muted); font-weight: 700; font-size: 15px; }
.form-section label, .form-stack label, .filters label, .check-row label {
  display: block;
  font-weight: 700;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 12px;
}
input, select, textarea {
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  border: 1px solid #d0d5dd;
  border-radius: 13px;
  padding: 12px 13px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(40,64,40,.12); }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: 1fr; }
.grid.three { grid-template-columns: 1fr; }
.form-stack { display: grid; gap: 10px; }
.field-help { color: var(--muted); margin-top: -4px; }
.file-box {
  display: grid !important;
  place-items: center;
  min-height: 112px;
  border: 2px dashed #cbd5e1;
  border-radius: 18px;
  background: #f7faf7;
  cursor: pointer;
  text-align: center;
}
.file-box input { display: none; }
.file-box span { color: var(--primary); font-weight: 900; }
.preview-grid, .photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.preview-img, .photo-item img, .photo-link img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
.photo-grid.detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.file-preview, .anexo-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; color: var(--text); font-weight: 700; }
.sticky-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 10px;
}
.btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 13px;
  min-height: 44px;
  padding: 11px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  white-space: nowrap;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.ghost { background: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { min-height: 34px; padding: 7px 10px; border-radius: 10px; font-size: 14px; }
.btn.full { width: 100%; }
.alerts { margin-bottom: 12px; }
.alert { padding: 12px 14px; border-radius: 14px; margin-bottom: 8px; font-weight: 700; border: 1px solid var(--line); }
.alert.sucesso { background: var(--success-bg); color: var(--success); border-color: #abefc6; }
.alert.erro { background: var(--danger-bg); color: var(--danger); border-color: #fecdca; }
.alert.aviso { background: var(--warning-bg); color: var(--warning); border-color: #fedf89; }
.mobile-list { display: grid; gap: 10px; }
.record-card { display: block; border: 1px solid var(--line); border-radius: 16px; padding: 13px; background: #fff; }
.record-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.record-card p { margin: 8px 0 4px; color: var(--text); }
.record-card small { color: var(--muted); }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: #edf4ed; color: var(--blue); font-weight: 900; font-size: 13px; }
.badge.red { background: var(--danger-bg); color: var(--danger); }
.badge.gold { background: var(--warning-bg); color: var(--warning); }
.desktop-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; display: none; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 15px; }
.data-table th, .data-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { background: #f4f8f4; color: var(--primary); font-weight: 900; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.only-mobile { display: grid; }
.filters { display: grid; gap: 10px; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-grid { display: grid; gap: 10px; }
.detail-item { padding: 12px; background: #fafafa; border: 1px solid var(--line); border-radius: 14px; }
.detail-item span { display: block; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; font-weight: 800; margin-bottom: 4px; }
.detail-item strong { display: block; font-size: 17px; }
.empty { color: var(--muted); }
.user-row, .cadastro-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.user-row:last-child, .cadastro-row:last-child { border-bottom: 0; }
.user-row small, .cadastro-row small { display: block; color: var(--muted); margin-top: 3px; }
.inactive { opacity: .55; }
.check-row { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; background: #fff; }
.check-row h3 { margin: 0 0 10px; color: var(--primary); font-size: 18px; text-transform: none; letter-spacing: 0; }
.radio-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 12px; }
.radio-pill { display: flex !important; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 0 !important; background: #fff; }
.radio-pill input { width: auto; min-height: 0; margin: 0; }
@media (min-width: 760px) {
  body { padding-bottom: 30px; }
  .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .module-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cards-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .desktop-table-wrap { display: block; }
  .only-mobile { display: none; }
  .sticky-actions { position: static; border: 0; background: transparent; padding: 0; grid-template-columns: 1fr 1fr; max-width: 520px; margin-left: auto; }
  .detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .photo-grid.detail, .preview-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Ajustes v4: atalho de cadastro rápido e sugestões */
.field-with-action {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 8px;
  align-items: end;
}
.field-with-action label { margin-bottom: 0; }
.icon-add-btn {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border: 0;
  border-radius: 13px;
  background: var(--primary);
  color: #fff;
  font-size: 27px;
  line-height: 1;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.icon-add-btn:hover { background: var(--primary-dark); }
.quick-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(16, 24, 40, .48);
  z-index: 80;
  padding: 18px;
}
.quick-modal.open { display: flex; }
.quick-modal-box {
  width: min(430px, 100%);
  background: #fff;
  border-radius: 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
}
.quick-modal-box h2 { margin: 0 0 6px; color: var(--primary); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.modal-msg { min-height: 22px; margin-top: 4px; font-weight: 700; }
.modal-msg.sucesso { color: var(--success); }
.modal-msg.erro { color: var(--danger); }

/* Ajustes v5: módulos, tarefas, devoluções e impressão */
.home-modules { grid-template-columns: 1fr; }
.module-head { align-items: center; }
.quick-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.quick-action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #f7faf7;
  color: var(--primary);
  font-weight: 900;
  padding: 12px;
  text-align: center;
}
.inline-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inline-actions form { margin: 0; }
.checkbox-line {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding-top: 20px;
}
.checkbox-line input { width: auto; min-height: 0; margin: 0; }
@media (min-width: 760px) {
  .home-modules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Ajustes v6: quebra de texto e tarefas */
.data-table th,
.data-table td,
.detail-item strong,
.record-card,
.text-block {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
.text-block {
  margin: 0;
  line-height: 1.55;
  color: var(--text);
}
.form-page.compact {
  gap: 12px;
}
.form-page.compact .btn {
  width: fit-content;
}
@media (max-width: 760px) {
  .form-page.compact .btn {
    width: 100%;
  }
}

/* Ajustes v7: badges de tarefas e cadastros rápidos */
.badge.priority-baixa { background: #edf4ed; color: var(--blue); }
.badge.priority-media { background: var(--warning-bg); color: var(--warning); }
.badge.priority-alta { background: #fff1f0; color: var(--danger); }
.badge.priority-urgente { background: var(--danger); color: #fff; }
.badge.status-pendente { background: var(--warning-bg); color: var(--warning); }
.badge.status-em-andamento { background: #edf4ed; color: var(--blue); }
.badge.status-concluida { background: var(--success-bg); color: var(--success); }
.badge.status-cancelada { background: #f2f4f7; color: var(--muted); }
.record-top .badge + .badge { margin-left: 6px; }
.field-with-action .icon-add-btn { align-self: end; }

/* Ajustes v9: permissões, usuários e módulo TI */
.permissions-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #f7faf7;
}
.permission-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}
.checkbox-card {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px !important;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-weight: 800;
}
.checkbox-card input { width: auto; min-height: 0; margin: 0; }
.user-row { gap: 12px; }
.status-disponivel { background: var(--success-bg); color: var(--success); }
.status-entregue { background: #edf4ed; color: var(--blue); }
.status-manutencao { background: var(--warning-bg); color: var(--warning); }
.status-devolvido { background: #f2f4f7; color: var(--muted); }
.status-perdido, .status-baixado { background: #fff1f0; color: var(--danger); }
@media (min-width: 760px) {
  .permission-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Ajustes v10: devoluções com múltiplos itens */
.devolucao-itens-list {
  display: grid;
  gap: 12px;
}
.devolucao-item-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fffafa;
}
.item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.item-head strong { color: var(--blue); }
.icon-add-btn.text {
  width: auto;
  min-width: 118px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 13px;
}
.product-field { align-items: stretch; }
@media (max-width: 760px) {
  .icon-add-btn.text {
    min-width: 100%;
    height: 42px;
  }
}

/* Ajustes v11: estoque e entregas de TI */
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
input[readonly] { background: #f8fafc; color: var(--muted); }
.button-reset { width: 100%; font-family: inherit; cursor: pointer; }
.quick-grid form { margin: 0; }

.login-links { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; text-align: center; font-weight: 700; color: var(--primary); }
.login-links a { text-decoration: none; }
.tenant-chip { display: inline-block; margin-top: 8px; padding: 8px 12px; border-radius: 999px; background: #eef4ff; color: var(--primary); font-weight: 800; }
.checkbox-line { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
.compact-grid label { margin: 0; }


.result-row {
  display: grid;
  grid-template-columns: 1.4fr .7fr 1fr 1fr;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.result-row small { display: block; color: var(--muted); margin-top: 4px; }
.subcard {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  background: #eef2ff;
  color: var(--primary);
}
.status-pill.success { background: var(--success-bg); color: var(--success); }
.status-pill.warning { background: var(--warning-bg); color: var(--warning); }
.status-pill.danger { background: var(--danger-bg); color: var(--danger); }
.danger-soft { background: var(--danger-bg) !important; }
.table-wrap { width: 100%; overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; min-width: 780px; }
.table-wrap th, .table-wrap td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}
.table-wrap th {
  color: var(--primary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.info-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.info-grid span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.info-grid strong { color: var(--text); }
.mini-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mini-list span {
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}
@media (max-width: 760px) {
  .result-row { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr 1fr; }
}


.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
@media (max-width: 980px) {
  .grid.four, .grid.five, .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid.four, .grid.five, .stats-grid { grid-template-columns: 1fr; }
}


.chart-card h2 { margin-bottom: 14px; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: conic-gradient(
    var(--success) 0 calc(var(--ok) * 1%),
    var(--warning) calc(var(--ok) * 1%) calc((var(--ok) + var(--warn)) * 1%),
    var(--danger) calc((var(--ok) + var(--warn)) * 1%) 100%
  );
  position: relative;
  box-shadow: inset 0 0 0 1px var(--line);
}
.donut::after {
  content: '';
  position: absolute;
  inset: 34px;
  background: var(--card);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--line);
}
.legend { display: grid; gap: 8px; font-weight: 800; color: var(--text); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.dot.success { background: var(--success); }
.dot.warning { background: var(--warning); }
.dot.danger { background: var(--danger); }
.bar-list { display: grid; gap: 14px; }
.bar-row { display: grid; gap: 8px; }
.bar-row strong { display: block; }
.bar-row small { color: var(--muted); }
.bar-track {
  height: 12px;
  background: #eef4ff;
  border-radius: 999px;
  overflow: hidden;
}
.bar-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}
.danger-bars .bar-track span { background: var(--danger); }
.trend-grid {
  min-height: 190px;
  display: flex;
  align-items: end;
  gap: 10px;
  overflow-x: auto;
  padding-top: 12px;
}
.trend-item {
  min-width: 46px;
  display: grid;
  justify-items: center;
  gap: 8px;
}
.trend-bar {
  width: 30px;
  background: linear-gradient(180deg, var(--gold), var(--primary));
  border-radius: 10px 10px 4px 4px;
  position: relative;
  min-height: 24px;
}
.trend-bar span {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 900;
  color: var(--primary);
}
.trend-item small { color: var(--muted); font-size: 12px; }

.login-card .btn.full { margin-top: 12px; }
.module-card-simple { min-height: 110px; display:flex; align-items:center; }
.module-card-simple strong { margin:0; }
.module-card-simple p { display:none; }
.icon-add-btn.icon-only { min-width: 44px; width: 44px; padding: 0; font-size: 23px; justify-content: center; }
.field-with-action.product-field { align-items: end; }
.login-logo { width: min(360px, 96%); margin: 0 auto 22px; }
.brand-logo { width: 46px; height: 46px; object-fit: contain; border-radius: 12px; }

.local-shortcuts { display: grid; grid-template-columns: 1fr; gap: 10px; }
.local-shortcut {
  display: block;
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 16px;
  background: #fff;
  padding: 14px;
  box-shadow: var(--shadow);
  transition: .16s ease;
}
.local-shortcut:hover, .period-card:hover { transform: translateY(-1px); border-color: var(--primary); box-shadow: 0 12px 28px rgba(31, 37, 51, .10); }
.local-shortcut.active { background: #f4f8f4; border-color: var(--primary); }
.local-shortcut strong { display:block; color: var(--primary); font-size: 18px; }
.local-shortcut span, .local-shortcut small { display:block; color: var(--muted); margin-top: 4px; }
.period-cards { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 6px; }
.period-card {
  display: block;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 16px;
  box-shadow: var(--shadow);
  transition: .16s ease;
  cursor: pointer;
}
.period-card span { display:block; color: var(--muted); font-weight: 800; }
.period-card strong { display:block; color: var(--primary); font-size: 37px; line-height: 1; margin: 10px 0 7px; }
.period-card small { color: var(--muted); font-weight: 700; }
.period-card.danger-soft { background: var(--danger-bg); border-color: #fecdca; }
.period-card.warning-soft { background: var(--warning-bg); border-color: #fedf89; }
.local-latest { margin-top: 18px; }
.local-latest h3 { margin: 0 0 10px; font-size: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
@media (min-width: 760px) {
  .local-shortcuts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .period-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.system-version { text-align:center; color: var(--muted); font-size: 13px; padding: 8px 12px 22px; }

.compact-stats { margin-bottom: 14px; }
.report-note { color: var(--muted); font-size: 14px; margin-top: 8px; }
.media-badge { display:inline-flex; align-items:center; gap:6px; padding:4px 9px; border-radius:999px; background:#f4f8f4; color:var(--primary); font-weight:800; font-size:13px; }

.below-summary-cards { margin-top: 16px; }


.company-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.company-row:last-child { border-bottom: 0; }
.company-logo-preview {
  width: 82px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 6px;
}
.company-logo-preview img { width: 100%; height: 54px; object-fit: contain; }
.mini-check { display: inline-flex !important; gap: 6px; align-items: center; font-size: 13px !important; margin-top: 8px !important; color: var(--muted) !important; }
.mini-check input { width: auto; min-height: 0; margin: 0; }
input[type="color"] { padding: 5px; height: 48px; }
@media (max-width: 760px) {
  .company-row { grid-template-columns: 1fr; }
  .company-logo-preview { width: 100%; }
}

.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin: 8px 0 14px; }
.check-row-inline { display:flex !important; align-items:center; gap:8px; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:#fff; margin:0 !important; }
.check-row-inline input { width:auto; min-height:0; margin:0; }

.table-input {
  min-width: 82px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.muted { color: var(--muted); }

.global-back-row {
  display: flex;
  align-items: center;
  margin: 0 0 10px;
}
.global-back-action {
  width: auto;
  min-height: 0;
  padding: 8px 13px;
  line-height: 1;
  box-shadow: none;
}

.span-3 { grid-column: span 3; }
@media (max-width: 900px) { .span-3 { grid-column: span 1; } }

.notice.soft {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fffdf0;
  color: var(--text);
  margin-top: 10px;
}

.quick-action small {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  opacity: .75;
}

.user-row .form-stack {
  width: 100%;
}
.user-row label {
  margin-bottom: 0;
}

.alert + .alert {
  margin-top: 8px;
}


/* Telas de Consulta/Relatório do Plano de Controle: ocupam melhor telas grandes e continuam responsivas */
body:has(.wide-report-page) .container {
  width: min(96vw, 1680px);
}

.wide-report-page .card,
.wide-report-page .page-head {
  width: 100%;
}

.quick-filter-card {
  padding-bottom: 18px;
}

.quick-filter-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quick-filter-groups {
  display: grid;
  gap: 12px;
}

.quick-filter-group strong {
  display: block;
  margin-bottom: 7px;
  color: var(--primary);
  font-size: 14px;
}

.filter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16,24,40,.05);
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.report-table-wrap {
  overflow-x: auto;
}

.wide-report-page .report-table {
  min-width: 980px;
  font-size: 14px;
}

.wide-report-page .report-table th,
.wide-report-page .report-table td {
  white-space: nowrap;
  padding: 12px 10px;
}

.report-results-table th,
.report-results-table td {
  vertical-align: top;
}

.compact-stats {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

@media (max-width: 900px) {
  body:has(.wide-report-page) .container {
    width: 100%;
  }
  .filter-chip-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .filter-chip {
    flex: 0 0 auto;
  }
  .wide-report-page .report-table {
    min-width: 920px;
    font-size: 13px;
  }
}


.analysis-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.analysis-hub-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.analysis-hub-card .quick-grid {
  margin-top: auto;
}

.primary-soft {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, #fff);
}

@media (max-width: 900px) {
  .analysis-section-grid {
    grid-template-columns: 1fr;
  }
}


.product-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 16px;
}

.product-analysis-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 16px;
  background: #fff;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 10px 22px rgba(16, 24, 40, .06);
}

.product-analysis-card h3 {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 21px;
}

.product-analysis-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.mini-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.mini-metrics span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 13px;
  font-weight: 700;
  background: #f8fafc;
}

.danger-text {
  color: #b42318 !important;
  background: #fef3f2 !important;
  border-color: #fecdca !important;
}

.card-actions-grid {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.button-like {
  width: 100%;
  text-align: center;
  cursor: pointer;
  font: inherit;
}

.quick-grid form {
  margin: 0;
}

@media (max-width: 680px) {
  .product-analysis-grid,
  .card-actions-grid {
    grid-template-columns: 1fr;
  }
}


/* Tela inicial limpa da Análise de Produto */
.clean-analysis-head {
  margin-bottom: 18px;
}

.clean-analysis-menu {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
}

.clean-analysis-button {
  min-height: 132px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 14px 32px rgba(16, 24, 40, .08);
  color: var(--text);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.clean-analysis-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(16, 24, 40, .12);
  border-color: var(--primary);
}

.clean-analysis-button span {
  font-size: 21px;
  font-weight: 800;
  color: var(--primary);
}

.clean-analysis-button small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.clean-analysis-button.entrada,
.clean-analysis-button.config,
.clean-analysis-button.monitor {
  background: color-mix(in srgb, var(--primary) 7%, #fff);
}

.clean-analysis-button.muted-action {
  opacity: .76;
  border-style: dashed;
}

.clean-extra-types-card {
  margin-top: 18px;
}

.clean-extra-types {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.clean-extra-chip {
  text-decoration: none;
}

@media (max-width: 1100px) {
  .clean-analysis-menu {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 720px) {
  .clean-analysis-menu {
    grid-template-columns: 1fr;
  }

  .clean-analysis-button {
    min-height: 104px;
    padding: 20px;
  }

  .clean-analysis-button span {
    font-size: 19px;
  }
}

/* Transporte / Frota */
.frota-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(16,24,40,.05);
}
.frota-nav a {
  text-decoration: none;
  color: var(--primary);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
  background: color-mix(in srgb, var(--primary) 4%, #fff);
}
.frota-nav a:hover { border-color: var(--primary); }
.inline-form { display: inline-flex; margin-left: 4px; }
.inline-payment { display:flex; gap:6px; align-items:center; min-width:360px; }
.inline-payment input { width:90px; }
.inline-payment select { min-width:120px; }
.span-2 { grid-column: span 2; }
.select-row {
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding:10px 4px;
  border-bottom:1px solid var(--line);
}
.select-row input { width:auto; margin-top:3px; }
.chip-list { display:flex; flex-wrap:wrap; gap:8px; }
.success-soft { background:#edf8ef; }
.warning-soft { background:#fff8df; }
.danger-soft { background:#fff0f0; }
@media (max-width: 760px) {
  .frota-nav { flex-wrap:nowrap; overflow-x:auto; }
  .frota-nav a { flex:0 0 auto; }
  .span-2 { grid-column: span 1; }
  .inline-payment { min-width:520px; }
}


/* Lançamentos feitos diretamente na tela de acerto da frota */
.inline-entry-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.inline-entry-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: color-mix(in srgb, var(--primary) 3%, #fff);
}

.inline-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.inline-entry-head strong {
  color: var(--primary);
}

.settlement-summary {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.settlement-summary .detail-item strong {
  font-size: 18px;
}

@media (max-width: 720px) {
  .inline-entry-card {
    padding: 13px;
  }

  .inline-entry-head {
    align-items: flex-start;
  }
}

/* ========================================================================== */
/* Classique Control 3.0 — interface moderna, clean e responsiva              */
/* ========================================================================== */
:root {
  --sidebar-width: 268px;
  --sidebar-collapsed-width: 82px;
  --topbar-height: 68px;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-hover: #f1f5f9;
  --sidebar-bg: #172033;
  --sidebar-bg-soft: #202b40;
  --sidebar-text: #d8e0ec;
  --sidebar-muted: #8f9bb0;
  --sidebar-line: rgba(255,255,255,.08);
  --accent: var(--gold);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-soft: 0 1px 3px rgba(15, 23, 42, .05), 0 10px 30px rgba(15, 23, 42, .045);
  --shadow-hover: 0 14px 34px rgba(15, 23, 42, .11);
}

html { min-height: 100%; background: var(--bg); }
body.app-shell {
  min-height: 100vh;
  padding: 0;
  background: #f3f6fa;
  font-family: "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}
body.auth-shell { padding: 0; min-height: 100vh; background: #eef2f7; }

.ui-icon { display: block; flex: 0 0 auto; }

/* Sidebar */
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 55;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, #141c2d 100%);
  color: var(--sidebar-text);
  border-right: 1px solid rgba(15,23,42,.12);
  transition: width .22s ease, transform .22s ease;
  overflow: hidden;
}
.sidebar-brand-row {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 12px 0 14px;
  border-bottom: 1px solid var(--sidebar-line);
  gap: 8px;
}
.sidebar-brand {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
}
.sidebar-logo-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fff;
  box-shadow: 0 5px 18px rgba(0,0,0,.18);
  padding: 5px;
  flex: 0 0 auto;
}
.sidebar-logo-wrap img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-brand-copy { min-width: 0; display: block; }
.sidebar-brand-copy strong {
  display: block;
  font-size: 15px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-brand-copy small { display: block; color: var(--sidebar-muted); margin-top: 3px; font-size: 12px; }
.sidebar-collapse-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.07);
  color: var(--sidebar-text);
  cursor: pointer;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 10px 18px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.sidebar-section-label {
  padding: 13px 11px 7px;
  color: var(--sidebar-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .105em;
  text-transform: uppercase;
  white-space: nowrap;
}
.sidebar-link {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 3px 0;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 600;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.sidebar-link:hover { background: rgba(255,255,255,.075); color: #fff; }
.sidebar-link.active {
  background: color-mix(in srgb, var(--primary) 88%, #fff 12%);
  color: #fff;
  box-shadow: inset 3px 0 0 rgba(255,255,255,.38), 0 7px 20px rgba(0,0,0,.12);
}
.sidebar-link-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.sidebar-link-text { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-link-arrow { color: var(--sidebar-muted); }

.sidebar-accordion { margin: 3px 0; }
.sidebar-accordion > summary { list-style: none; cursor: pointer; margin: 0; }
.sidebar-accordion > summary::-webkit-details-marker { display: none; }
.sidebar-accordion[open] > summary .sidebar-link-arrow { transform: rotate(90deg); }
.sidebar-link-arrow { transition: transform .16s ease; }
.sidebar-submenu { margin: 2px 0 8px 35px; padding: 3px 0 3px 10px; border-left: 1px solid rgba(255,255,255,.16); }
.sidebar-sublink { display: block; padding: 7px 9px; margin: 2px 0; border-radius: 8px; color: var(--sidebar-muted); font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.sidebar-sublink:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidebar-sublink.active { color: #fff; background: rgba(255,255,255,.11); font-weight: 750; }
.sidebar-subgroup { display: block; margin: 9px 8px 3px; color: rgba(255,255,255,.48); font-size: 9.5px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
body.sidebar-collapsed .sidebar-submenu { display: none; }
.freight-items { display: grid; gap: 8px; margin-top: 10px; }
.freight-item-row { display: grid; grid-template-columns: minmax(120px,1fr) 72px minmax(150px,1fr) minmax(150px,1fr) 44px; gap: 9px; align-items: end; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
.freight-item-row label { margin: 0; }
.freight-item-total { min-height: 43px; display: flex; align-items: center; padding: 10px 12px; border: 1px solid #cfd8e5; border-radius: 10px; background: #fff; font-weight: 750; color: #1e293b; }
.freight-item-remove { min-width: 40px; width: 40px; padding-inline: 0; }
@media (max-width: 860px) { .freight-item-row { grid-template-columns: 1fr 72px 1fr; } .freight-item-row .item-total-wrap { grid-column: 1 / 3; } }
.sidebar-count {
  min-width: 23px;
  height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.sidebar-footer { padding: 12px; border-top: 1px solid var(--sidebar-line); }
.sidebar-user-card { display: flex; align-items: center; gap: 10px; padding: 7px 5px 11px; min-width: 0; }
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--primary) 72%, #fff 28%);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
}
.user-avatar.small { width: 34px; height: 34px; font-size: 13px; }
.sidebar-user-copy { min-width: 0; }
.sidebar-user-copy strong, .sidebar-user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy strong { color: #fff; font-size: 13px; }
.sidebar-user-copy small { color: var(--sidebar-muted); font-size: 11px; margin-top: 3px; }
.sidebar-logout {
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  color: #fca5a5;
  font-weight: 650;
  font-size: 13px;
}
.sidebar-logout:hover { background: rgba(239,68,68,.12); color: #fecaca; }

/* Sidebar recolhida */
body.sidebar-collapsed .app-sidebar { width: var(--sidebar-collapsed-width); }
body.sidebar-collapsed .sidebar-brand-copy,
body.sidebar-collapsed .sidebar-section-label,
body.sidebar-collapsed .sidebar-link-text,
body.sidebar-collapsed .sidebar-link-arrow,
body.sidebar-collapsed .sidebar-count,
body.sidebar-collapsed .sidebar-user-copy,
body.sidebar-collapsed .sidebar-logout span { display: none; }
body.sidebar-collapsed .sidebar-brand-row { padding: 0 13px; flex-direction: column; justify-content: center; gap: 2px; height: 80px; }
body.sidebar-collapsed .sidebar-logo-wrap { width: 38px; height: 38px; }
body.sidebar-collapsed .sidebar-collapse-btn { position: absolute; left: 55px; top: 54px; width: 22px; height: 22px; transform: rotate(180deg); border: 1px solid rgba(255,255,255,.12); }
body.sidebar-collapsed .sidebar-nav { padding-inline: 11px; }
body.sidebar-collapsed .sidebar-link { justify-content: center; padding-inline: 0; }
body.sidebar-collapsed .sidebar-user-card { justify-content: center; padding-inline: 0; }
body.sidebar-collapsed .sidebar-logout { justify-content: center; padding-inline: 0; }

/* Topbar */
.app-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  z-index: 48;
  height: var(--topbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid #e5eaf1;
  transition: left .22s ease;
}
body.sidebar-collapsed .app-topbar { left: var(--sidebar-collapsed-width); }
.topbar-left-modern, .topbar-actions-modern { display: flex; align-items: center; gap: 12px; }
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  place-items: center;
  cursor: pointer;
}
.topbar-page-context small { display: block; color: var(--muted); font-size: 11px; line-height: 1; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.topbar-page-context strong { display: block; color: #192235; margin-top: 4px; font-size: 16px; }
.topbar-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #637083;
  border: 1px solid transparent;
}
.topbar-icon-btn:hover { background: var(--surface-hover); color: var(--primary); border-color: #e7ebf0; }
.topbar-notification-badge {
  position: absolute;
  right: 1px;
  top: 0;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
}
.topbar-user-btn {
  border: 0;
  background: transparent;
  padding: 3px 4px 3px 6px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  color: var(--text);
}
.topbar-user-btn:hover { background: var(--surface-hover); }
.topbar-user-copy { text-align: left; min-width: 0; max-width: 170px; }
.topbar-user-copy strong, .topbar-user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user-copy strong { font-size: 13px; }
.topbar-user-copy small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.user-menu-caret { color: var(--muted); font-size: 17px; }
.topbar-user-menu {
  position: absolute;
  right: 22px;
  top: 58px;
  width: 230px;
  display: none;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 20px 45px rgba(15,23,42,.16);
}
.topbar-user-menu.open { display: block; }
.user-menu-header { padding: 10px 11px 12px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.user-menu-header strong, .user-menu-header small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-header strong { font-size: 14px; }
.user-menu-header small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.topbar-user-menu a { min-height: 38px; padding: 8px 10px; display: flex; align-items: center; gap: 9px; border-radius: 9px; font-size: 13px; font-weight: 650; }
.topbar-user-menu a:hover { background: var(--surface-hover); }
.topbar-user-menu .danger-link { color: var(--danger); }

/* Área de conteúdo */
.container.app-content,
body:has(.wide-report-page) .container.app-content {
  width: auto;
  max-width: none;
  min-height: 100vh;
  margin: 0 0 0 var(--sidebar-width);
  padding: calc(var(--topbar-height) + 24px) 24px 38px;
  transition: margin-left .22s ease;
}
body.sidebar-collapsed .container.app-content { margin-left: var(--sidebar-collapsed-width); }
.content-inner { width: min(1520px, 100%); margin: 0 auto; }
.modern-version { margin-left: var(--sidebar-width); transition: margin-left .22s ease; color: #8994a6; }
body.sidebar-collapsed .modern-version { margin-left: var(--sidebar-collapsed-width); }
.global-back-row { margin: 0 0 13px; }
.global-back-action { min-height: 36px; padding: 7px 12px; border-radius: 10px; font-size: 13px; box-shadow: none; }

/* Cabeçalhos e superfícies gerais */
.page-head {
  align-items: center;
  margin: 0 0 18px;
  min-height: 54px;
}
.page-head h1 { color: #172033; font-size: clamp(23px, 2.2vw, 30px); letter-spacing: -.025em; font-weight: 750; }
.page-head p { font-size: 14px; color: #6b778b; margin-top: 5px; }
.card, .modern-panel {
  background: var(--surface);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  padding: 18px;
  margin-bottom: 16px;
}
.card:hover { border-color: #d8e0e9; }
.card h2, .modern-panel h2 { color: #1c2738; font-size: 18px; font-weight: 750; letter-spacing: -.01em; }
.card h3 { color: #46536a; }

.btn {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 10px;
  border-color: #dbe2ea;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(15,23,42,.09); }
.btn.primary { background: var(--primary); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; color: #344054; }
.btn.danger { background: #dc2626; border-color: #dc2626; }

input, select, textarea {
  min-height: 43px;
  margin-top: 5px;
  border-radius: 10px;
  border-color: #cfd8e5;
  padding: 10px 12px;
  font-size: 14px;
  box-shadow: inset 0 1px 2px rgba(15,23,42,.025);
}
input:hover, select:hover, textarea:hover { border-color: #aeb9c8; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}
.form-section label, .form-stack label, .filters label, .check-row label { font-size: 13px; color: #344054; font-weight: 650; }
.file-box { background: #f8fafc; border-radius: 13px; }

.data-table { font-size: 13px; }
.desktop-table-wrap, .table-wrap { border-radius: 12px; border-color: #e1e7ee; }
.data-table th, .data-table td { padding: 10px 11px; }
.data-table th {
  background: #f7f9fc;
  color: #526078;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .045em;
}
.data-table tbody tr:hover td { background: #fbfcfe; }
.badge, .status-pill { font-size: 11px; }

.alert { border-radius: 11px; font-size: 13px; box-shadow: 0 4px 15px rgba(15,23,42,.04); }
.stat-card { border-radius: 14px; box-shadow: var(--shadow-soft); }
.stat-card strong { color: #172033; font-size: 28px; }
.quick-action { border-radius: 11px; box-shadow: none; }
.record-card { border-radius: 13px; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.record-card:hover { border-color: #cbd5e1; box-shadow: 0 9px 22px rgba(15,23,42,.07); transform: translateY(-1px); }
.detail-item { border-radius: 11px; background: #f8fafc; }

/* Dashboard 3.0 */
.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 18px;
}
.dashboard-hero h1 { margin: 3px 0 4px; font-size: clamp(27px, 3vw, 36px); letter-spacing: -.04em; color: #172033; }
.dashboard-hero p { margin: 0; color: var(--muted); font-size: 14px; }
.eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.dashboard-company-chip {
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border: 1px solid #dfe6ee;
  border-radius: 13px;
  background: #fff;
  color: var(--primary);
  box-shadow: 0 5px 16px rgba(15,23,42,.04);
}
.dashboard-company-chip small, .dashboard-company-chip strong { display: block; }
.dashboard-company-chip small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.dashboard-company-chip strong { color: #243047; font-size: 13px; margin-top: 2px; }
.modern-panel { padding: 16px; }
.modern-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modern-panel-head h2 { margin: 3px 0 0; }
.quick-navigation-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
}
.quick-navigation-item {
  min-height: 104px;
  padding: 15px 10px;
  border-radius: 13px;
  background: #f5f7fa;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  color: #243047;
  transition: .17s ease;
}
.quick-navigation-item:hover {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 25%, #fff);
  color: var(--primary);
  transform: translateY(-2px);
}
.quick-navigation-icon {
  width: 45px;
  height: 45px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--primary);
  box-shadow: 0 4px 14px rgba(15,23,42,.07);
}
.quick-navigation-item strong { font-size: 12px; line-height: 1.25; }
.dashboard-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin: 0 0 16px; }
.summary-card-modern {
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  border: 1px solid #e1e7ee;
  border-left: 3px solid var(--primary);
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  position: relative;
}
.summary-card-modern.attention { border-left-color: #f59e0b; }
.summary-icon { width: 38px; height: 38px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: 0 0 auto; }
.summary-card-modern small, .summary-card-modern strong { display: block; }
.summary-card-modern small { color: var(--muted); font-size: 11px; }
.summary-card-modern strong { color: #172033; font-size: 26px; margin-top: 3px; }
.summary-card-modern .summary-text-value { font-size: 14px; line-height: 1.25; }
.summary-card-modern > a { position: absolute; right: 12px; bottom: 10px; color: var(--primary); font-size: 10px; font-weight: 800; }
.modern-module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.modern-module-card {
  min-height: 112px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  background: #fff;
  transition: border-color .17s ease, box-shadow .17s ease, transform .17s ease;
}
.modern-module-card:hover { border-color: color-mix(in srgb, var(--primary) 28%, #dfe5ec); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.modern-module-card.administration { background: #fbfcfe; }
.modern-module-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: 0 0 auto; }
.modern-module-copy { min-width: 0; flex: 1; }
.modern-module-copy strong { display: block; color: #202b3d; font-size: 14px; }
.modern-module-copy p { color: #758196; font-size: 11px; line-height: 1.45; margin: 5px 0 0; }
.modern-module-arrow { color: #a3adbc; transition: transform .17s ease; }
.modern-module-card:hover .modern-module-arrow { transform: translateX(3px); color: var(--primary); }

/* Login 3.0 */
.auth-container { width: 100%; max-width: none; padding: 0; }
.auth-container .content-inner { width: 100%; max-width: none; }
.login-modern-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(430px, .95fr); }
.login-brand-panel {
  position: relative;
  overflow: hidden;
  padding: 64px clamp(40px, 7vw, 110px);
  display: flex;
  align-items: center;
  color: #fff;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.15), transparent 28%),
    radial-gradient(circle at 88% 83%, rgba(255,255,255,.09), transparent 31%),
    linear-gradient(145deg, var(--primary-dark), var(--primary));
}
.login-brand-panel::after {
  content: '';
  position: absolute;
  inset: auto -120px -160px auto;
  width: 420px;
  height: 420px;
  border: 80px solid rgba(255,255,255,.05);
  border-radius: 50%;
}
.login-brand-content { position: relative; z-index: 1; max-width: 590px; }
.login-brand-logo-card { width: fit-content; max-width: min(350px, 88%); margin-bottom: 38px; padding: 16px 22px; border-radius: 18px; background: rgba(255,255,255,.97); border: 1px solid rgba(255,255,255,.72); box-shadow: 0 18px 40px rgba(10,24,17,.18); }
.login-brand-logo { display: block; width: min(290px, 100%); max-height: 96px; object-fit: contain; object-position: left center; filter: none; }
.login-eyebrow { display: inline-block; margin-bottom: 13px; font-size: 11px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.75); }
.login-brand-content h1 { max-width: 540px; margin: 0 0 17px; font-size: clamp(35px, 4vw, 54px); line-height: 1.04; letter-spacing: -.045em; }
.login-brand-content > p { max-width: 520px; margin: 0; font-size: 16px; line-height: 1.65; color: rgba(255,255,255,.78); }
.login-feature-list { display: flex; flex-wrap: wrap; gap: 9px 20px; margin-top: 32px; font-size: 12px; font-weight: 650; color: rgba(255,255,255,.82); }
.login-form-panel { padding: 40px; display: grid; place-items: center; background: #f7f9fc; }
.modern-login-card {
  width: min(430px, 100%);
  border: 0;
  border-radius: 18px;
  padding: 38px;
  box-shadow: 0 25px 60px rgba(15,23,42,.10);
}
.modern-login-card h2 { color: #172033; font-size: 28px; margin: 6px 0 7px; letter-spacing: -.03em; }
.modern-login-card > p { text-align: left; font-size: 13px; margin-bottom: 25px; }
.modern-login-card label { font-size: 13px; font-weight: 650; color: #344054; }
.modern-login-card input { height: 47px; }
.login-submit { margin-top: 8px; min-height: 47px; }
.login-mobile-brand { display: none; }
.login-links { margin-top: 18px; font-size: 12px; }
.login-version { display: block; margin-top: 22px; color: #98a2b3; text-align: center; font-size: 10px; }

/* Responsividade */
.sidebar-backdrop { display: none; }
@media (max-width: 1280px) {
  .quick-navigation-grid { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .modern-module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .app-sidebar { transform: translateX(-102%); width: min(292px, 86vw); box-shadow: 20px 0 55px rgba(15,23,42,.25); }
  body.menu-open .app-sidebar { transform: translateX(0); }
  body.sidebar-collapsed .app-sidebar { width: min(292px, 86vw); }
  body.sidebar-collapsed .sidebar-brand-copy,
  body.sidebar-collapsed .sidebar-section-label,
  body.sidebar-collapsed .sidebar-link-text,
  body.sidebar-collapsed .sidebar-link-arrow,
  body.sidebar-collapsed .sidebar-count,
  body.sidebar-collapsed .sidebar-user-copy,
  body.sidebar-collapsed .sidebar-logout span { display: block; }
  body.sidebar-collapsed .sidebar-brand-row { height: var(--topbar-height); padding: 0 12px 0 14px; flex-direction: row; justify-content: initial; gap: 8px; }
  body.sidebar-collapsed .sidebar-collapse-btn { display: none; }
  body.sidebar-collapsed .sidebar-nav { padding: 14px 10px 18px; }
  body.sidebar-collapsed .sidebar-link, body.sidebar-collapsed .sidebar-user-card, body.sidebar-collapsed .sidebar-logout { justify-content: initial; padding-inline: 10px; }
  body.sidebar-collapsed .sidebar-submenu { display: block; }
  .sidebar-collapse-btn { display: none; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 52; background: rgba(15,23,42,.44); backdrop-filter: blur(2px); }
  body.menu-open .sidebar-backdrop { display: block; }
  .app-topbar, body.sidebar-collapsed .app-topbar { left: 0; padding: 0 14px; }
  .mobile-menu-btn { display: grid; }
  .topbar-user-copy { display: none; }
  .container.app-content,
  body.sidebar-collapsed .container.app-content,
  body:has(.wide-report-page) .container.app-content {
    margin-left: 0;
    padding: calc(var(--topbar-height) + 17px) 14px 28px;
  }
  .modern-version, body.sidebar-collapsed .modern-version { margin-left: 0; }
  .dashboard-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-modern-shell { grid-template-columns: 1fr; }
  .login-brand-panel { display: none; }
  .login-form-panel { min-height: 100vh; padding: 25px 18px; }
  .login-mobile-brand { display: block; }
  .login-mobile-brand img { width: min(260px, 80%); margin: 0 auto 30px; }
}
@media (max-width: 700px) {
  .topbar-page-context small { display: none; }
  .topbar-page-context strong { margin: 0; font-size: 14px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-user-btn { padding: 3px; }
  .user-menu-caret { display: none; }
  .topbar-user-menu { right: 10px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head .head-actions, .page-head .inline-actions { width: 100%; justify-content: flex-start; }
  .dashboard-hero { align-items: flex-start; flex-direction: column; }
  .dashboard-company-chip { width: 100%; min-width: 0; }
  .quick-navigation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-summary-grid { grid-template-columns: 1fr; }
  .modern-module-grid { grid-template-columns: 1fr; }
  .modern-module-card { min-height: 100px; }
  .modern-module-copy p { display: none; }
  .modern-login-card { padding: 27px 22px; }
  .login-mobile-brand img { width: min(220px, 78%); }
  .card, .modern-panel { padding: 14px; border-radius: 14px; }
}
@media (max-width: 430px) {
  .quick-navigation-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .quick-navigation-item { min-height: 88px; padding: 11px 6px; }
  .quick-navigation-icon { width: 39px; height: 39px; }
}

/* ===== Controle de Água v3.5 ===== */
.agua-nav { margin-bottom: 16px; }
.agua-cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.agua-chart-wrap { width: 100%; min-height: 290px; overflow: hidden; }
.agua-chart-wrap canvas { display: block; max-width: 100%; }
.agua-param-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.agua-param-card { display: flex; flex-direction: column; gap: 7px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe; }
.agua-param-card > span { font-size: 16px; font-weight: 900; color: #172033; }
.agua-param-card > strong { min-height: 34px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.agua-results-list { display: grid; gap: 10px; }
.agua-result-row { display: grid; grid-template-columns: minmax(190px, 1fr) auto minmax(130px, auto); gap: 14px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.agua-result-row:last-child { border-bottom: 0; }
.agua-result-row small { display: block; color: var(--muted); margin-top: 4px; }
.agua-result-value { font-size: 17px; font-weight: 900; white-space: nowrap; }
.agua-origin-results { display: flex; flex-wrap: wrap; gap: 8px; }
.agua-origin-results span { padding: 7px 10px; border-radius: 999px; background: #f3f6f9; font-size: 13px; }
.agua-stock-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.agua-stock-card { border: 1px solid var(--line); border-radius: 14px; padding: 15px; background: #fff; }
.agua-stock-card.low { border-color: #e6a4a1; background: #fff8f7; }
.agua-stock-card > div:first-child { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.agua-stock-card small { color: var(--muted); display: block; text-align: right; }
.agua-stock-balance { display: flex; gap: 6px; align-items: baseline; margin: 15px 0 6px; }
.agua-stock-balance strong { font-size: 29px; color: #172033; }
.agua-stock-balance span { color: var(--muted); font-weight: 800; }
.agua-stock-card p { margin: 0; color: var(--muted); font-size: 13px; }
.agua-admin-grid { align-items: start; }
.agua-param-edit { display: block; padding: 14px 0; border-bottom: 1px solid var(--line); }
.agua-param-edit:last-child { border-bottom: 0; }
.agua-param-edit.inactive { opacity: .62; }
.param-edit-footer { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 8px; }
.param-edit-footer small { color: var(--muted); }
.compact-filter { padding-top: 12px; padding-bottom: 12px; }
.inline-filter { max-width: 440px; }
.inline-filter label { margin: 0; }
.grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .agua-cards-grid, .agua-stock-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agua-param-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .agua-cards-grid, .agua-stock-grid, .agua-param-grid { grid-template-columns: 1fr; }
  .agua-result-row { grid-template-columns: 1fr; gap: 7px; }
  .grid.six { grid-template-columns: 1fr 1fr; }
  .agua-chart-wrap { min-height: 250px; }
}

/* ===== Controle de Água v3.5: navegação e submódulos visíveis ===== */
.submodule-nav.agua-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(17, 24, 39, .04);
}
.submodule-nav.agua-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.submodule-nav.agua-nav a:hover { background: #f3f6f9; color: #172033; transform: translateY(-1px); }
.submodule-nav.agua-nav a.active { background: var(--primary); color: #fff; }
.agua-hub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.agua-hub-card {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  min-height: 118px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: #172033;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(17, 24, 39, .045);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.agua-hub-card:hover { transform: translateY(-2px); border-color: rgba(187, 17, 22, .35); box-shadow: 0 12px 28px rgba(17, 24, 39, .08); }
.agua-hub-card.stock { background: linear-gradient(135deg, #fff, #f8fbff); }
.agua-hub-card strong { display: block; margin-bottom: 5px; font-size: 17px; }
.agua-hub-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.agua-hub-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: rgba(187, 17, 22, .09); color: var(--primary); font-size: 22px; font-weight: 900; }
.agua-hub-arrow { color: var(--muted); font-size: 28px; line-height: 1; }
.stat-card.stat-link { display: block; color: inherit; text-decoration: none; }
.stat-card.stat-link small { display: block; margin-top: 7px; color: var(--muted); font-weight: 700; }
.stat-card.stat-link:hover { border-color: rgba(187, 17, 22, .3); transform: translateY(-1px); }
.agua-dashboard-stock { margin-top: 16px; }
.agua-empty-action { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 16px; border: 1px dashed var(--line); border-radius: 13px; background: #fafbfd; }
.agua-empty-action p { margin: 0; color: var(--muted); }
.optional-label { margin-left: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
@media (max-width: 1180px) { .agua-hub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .submodule-nav.agua-nav { flex-wrap: nowrap; overflow-x: auto; padding: 6px; }
  .submodule-nav.agua-nav a { flex: 0 0 auto; }
  .agua-hub-grid { grid-template-columns: 1fr; }
  .agua-hub-card { min-height: 104px; }
}

/* ===== Administração / armazenamento v3.6 ===== */
.storage-hero { display: grid; gap: 18px; }
.storage-hero-copy { display: flex; align-items: center; gap: 14px; }
.storage-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.storage-hero-copy small, .storage-breakdown-grid span { display: block; color: var(--muted); font-size: 12px; }
.storage-hero-copy strong { display: block; font-size: 34px; line-height: 1.05; color: #172033; margin: 2px 0; }
.storage-hero-copy p { margin: 0; color: var(--muted); }
.storage-bar { height: 14px; overflow: hidden; border-radius: 999px; background: #e9eef4; }
.storage-bar span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .25s ease; }
.storage-hero.attention .storage-bar span { background: #c58a22; }
.storage-hero.high .storage-bar span { background: #d06b24; }
.storage-hero.critical .storage-bar span { background: #c63d3d; }
.storage-capacity-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.storage-capacity-grid > div { padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.storage-capacity-grid small { display: block; color: var(--muted); margin-bottom: 4px; }
.storage-capacity-grid strong { font-size: 18px; }
.storage-breakdown-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin: 14px 0; }
.storage-breakdown-grid .card { min-height: 126px; }
.storage-breakdown-grid strong { display: block; margin: 7px 0; font-size: 25px; color: #172033; }
.storage-breakdown-grid small { color: var(--muted); overflow-wrap: anywhere; }
.storage-alert { padding: 11px 13px; border-radius: 10px; font-weight: 700; }
.storage-alert.warning { background: #fff4d8; color: #805b10; }
.storage-alert.danger { background: #fde7e7; color: #9b2929; }
.storage-legend { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.storage-legend span { display: grid; grid-template-columns: 10px 1fr; gap: 2px 8px; align-items: center; font-size: 12px; color: var(--muted); }
.storage-legend strong { color: #344054; }
.storage-legend i { width: 9px; height: 32px; grid-row: 1 / span 2; border-radius: 999px; background: #4d8b59; }
.storage-legend i.attention { background: #c58a22; }.storage-legend i.high { background: #d06b24; }.storage-legend i.critical { background: #c63d3d; }
@media (max-width: 900px) { .storage-breakdown-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .storage-legend { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 620px) { .storage-capacity-grid, .storage-breakdown-grid, .storage-legend { grid-template-columns: 1fr; } }

/* ===== Relatórios e impressão v3.6 ===== */
.report-page .page-head { align-items: flex-end; }
.report-page .card { break-inside: avoid; }
.report-page .data-table th,
.report-page .table-wrap th { white-space: nowrap; }
.report-page .data-table td,
.report-page .table-wrap td { vertical-align: top; }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  html, body { background: #fff !important; color: #111827 !important; }
  body.app-shell { display: block !important; }
  .app-sidebar, .app-topbar, .sidebar-backdrop, .global-back-row, .toast-container,
  .submodule-nav, .filter-card, .filters-card, .quick-filter-card, .print-only-control,
  .page-head .btn, .page-head .inline-actions, .no-print { display: none !important; }
  .container.app-content, body.sidebar-collapsed .container.app-content,
  body:has(.wide-report-page) .container.app-content {
    margin: 0 !important; width: 100% !important; max-width: none !important; padding: 0 !important;
  }
  .content-inner, .report-page, .wide-report-page { width: 100% !important; max-width: none !important; margin: 0 !important; }
  .page-head { margin: 0 0 8mm !important; padding: 0 0 4mm !important; border-bottom: 1px solid #d1d5db; }
  .page-head h1 { font-size: 18pt !important; color: #111827 !important; }
  .page-head p { color: #4b5563 !important; }
  .card, .stat-card { box-shadow: none !important; border: 1px solid #d7dee8 !important; background: #fff !important; }
  .stats-grid, .cards-grid { gap: 4mm !important; }
  .stat-card { padding: 4mm !important; min-height: auto !important; }
  .stat-card strong { font-size: 16pt !important; }
  .table-wrap, .desktop-table-wrap { overflow: visible !important; }
  table { width: 100% !important; border-collapse: collapse !important; font-size: 8pt !important; }
  th { background: #eef2f6 !important; color: #111827 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  th, td { padding: 2.1mm 2.4mm !important; border: 1px solid #d7dee8 !important; }
  tr { break-inside: avoid; }
  .status-pill, .badge { border: 1px solid #cbd5e1 !important; color: #111827 !important; background: #fff !important; }
  .agua-chart-wrap { min-height: 82mm !important; break-inside: avoid; }
  .agua-chart-wrap canvas { max-height: 82mm !important; }
}

/* ===== Padrão neutro oficial de relatórios v3.10 ===== */
.report-page,
.wide-report-page {
  --report-primary: #475569;
  --report-text: #1e293b;
  --report-muted: #64748b;
  --report-border: #cbd5e1;
  --report-soft: #e2e8f0;
  --report-row: #f8fafc;
  --report-danger: #dc2626;
  --report-danger-bg: #fee2e2;
}
.report-page .page-head h1,
.wide-report-page .page-head h1,
.report-page h2,
.wide-report-page h2 { color: var(--report-text); }
.report-page .page-head p,
.wide-report-page .page-head p,
.report-page .report-note,
.wide-report-page .report-note { color: var(--report-muted); }
.report-page .card,
.report-page .stat-card,
.wide-report-page .card,
.wide-report-page .stat-card {
  background: #fff;
  border-color: var(--report-border);
}
.report-page table,
.wide-report-page table { color: var(--report-text); }
.report-page table th,
.wide-report-page table th {
  background: var(--report-soft);
  color: var(--report-text);
  border-color: var(--report-border);
}
.report-page table tbody tr:nth-child(even) td,
.wide-report-page table tbody tr:nth-child(even) td { background: var(--report-row); }
.report-page table td,
.wide-report-page table td { border-color: var(--report-border); }
.report-danger-cell,
.danger-cell {
  background: var(--report-danger-bg, #fee2e2) !important;
  color: var(--report-danger, #dc2626) !important;
  font-weight: 700;
}
.report-values-table th,
.report-values-table td { text-align: center; }
.report-values-table th:first-child,
.report-values-table td:first-child { text-align: left; }

@media print {
  .report-page,
  .wide-report-page { background: #fff !important; color: #1e293b !important; }
  .report-page table th,
  .wide-report-page table th {
    background: #e2e8f0 !important;
    color: #1e293b !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .report-page table tbody tr:nth-child(even) td,
  .wide-report-page table tbody tr:nth-child(even) td {
    background: #f8fafc !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .report-danger-cell,
  .danger-cell {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ===== Refinos v3.10: leitura gerencial e decisões ===== */
.report-page .stat-card, .wide-report-page .stat-card { border-radius: 12px; }
.report-page table th, .wide-report-page table th { font-weight: 700; letter-spacing: .01em; }
.report-page .badge.red, .wide-report-page .badge.red, .report-problem { background:#fee2e2!important; color:#b91c1c!important; border-color:#fecaca!important; font-weight:700; }
.report-ok { background:#f0fdf4!important; color:#166534!important; border-color:#bbf7d0!important; }
.decision-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-top:12px; }
.decision-option { display:flex; gap:10px; align-items:flex-start; padding:14px; border:1px solid #cbd5e1; border-radius:12px; background:#fff; cursor:pointer; }
.decision-option input { margin-top:3px; }
.decision-option span { display:grid; gap:4px; }
.decision-option small { color:#64748b; }
.decision-option.success:has(input:checked) { background:#f0fdf4; border-color:#86efac; }
.decision-option.danger:has(input:checked) { background:#fef2f2; border-color:#fca5a5; }
.text-danger { color:#b91c1c!important; }
@media(max-width:720px){ .decision-options{grid-template-columns:1fr;} }

/* ===== v3.12 - Recibos de Frete / Monitor CT-e ===== */
.detail-grid > div { padding: 11px 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; }
.detail-grid > div > span { display:block; color:#64748b; font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.03em; margin-bottom:4px; }
.detail-grid > div > strong { display:block; color:#1e293b; font-size:15px; }
.notice { border:1px solid #cbd5e1; border-radius:12px; padding:11px 13px; margin:12px 0; background:#f8fafc; color:#334155; }
.notice.success { background:#f0fdf4; border-color:#bbf7d0; color:#166534; }
.notice.warning { background:#fffbeb; border-color:#fde68a; color:#92400e; }
.danger-zone { border-color:#fecaca !important; background:#fffafa; }
.row-muted { opacity:.7; background:#f8fafc; }
.page-head.compact { margin-bottom:10px; }
.page-head.compact h2 { margin-bottom:2px; }

/* ===== Gestão de Fretes / Recebimento - responsividade v3.25 ===== */
.freight-form .card,
.freight-detail-page .card,
.freight-list-page .card { min-width: 0; }
.freight-form .grid > *,
.freight-detail-page .grid > *,
.freight-list-page .grid > *,
.entry-config-grid > *,
.entry-parameter-grid > * { min-width: 0; }
.freight-main-table table,
.freight-history-table table { white-space: nowrap; }
.freight-history-table td:nth-child(9) { white-space: normal; min-width: 150px; }

@media (max-width: 1380px) {
  .freight-form .grid.four.freight-grid,
  .freight-detail-page .grid.four.freight-grid,
  .freight-list-page .grid.four.freight-filter-grid,
  .grid.four.entry-parameter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .freight-detail-page .detail-grid.freight-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .freight-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid.three.entry-config-grid,
  .grid.three.entry-config-lists {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .freight-item-row {
    grid-template-columns: minmax(150px, 1fr) 72px minmax(150px, 1fr);
  }
  .freight-item-row .item-total-wrap { grid-column: 1 / 3; }
  .freight-payment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 760px) {
  .freight-form .grid.four.freight-grid,
  .freight-detail-page .grid.four.freight-grid,
  .freight-list-page .grid.four.freight-filter-grid,
  .freight-payment-grid,
  .freight-detail-page .detail-grid.freight-detail-grid,
  .freight-stats,
  .grid.three.entry-config-grid,
  .grid.three.entry-config-lists,
  .grid.four.entry-parameter-grid {
    grid-template-columns: 1fr !important;
  }
  .freight-form .span-2,
  .freight-detail-page .span-2,
  .entry-parameter-grid .span-2 { grid-column: span 1; }
  .freight-item-row {
    grid-template-columns: 1fr 72px;
  }
  .freight-item-row .rf-item-unit,
  .freight-item-row label:has(.rf-item-unit),
  .freight-item-row .item-total-wrap { grid-column: 1 / -1; }
  .freight-item-remove { justify-self: end; }
  .freight-list-page .filter-actions,
  .freight-detail-page .filter-actions { flex-wrap: wrap; }
}

/* ===== Checklists de carregamento - fluxo inicial/final v3.27 ===== */
.checklist-actions-grid { align-items: stretch; }
.checklist-part { min-width: 0; }
.dynamic-row { position: relative; }
.dynamic-row > .btn.danger { margin-top: 10px; }
@media (max-width: 1100px) {
  .responsive-form-grid.grid.three,
  .responsive-form-grid.grid.four { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 700px) {
  .responsive-form-grid.grid.three,
  .responsive-form-grid.grid.four { grid-template-columns: 1fr !important; }
  .responsive-form-grid .span-2 { grid-column: span 1; }
  .checklist-actions-grid { grid-template-columns: 1fr !important; }
}
