:root {
  --osm-navy: #072a4a;
  --osm-navy-2: #0b3d6e;
  --osm-blue: #1e88c8;
  --osm-blue-soft: #d7ebf7;
  --osm-gold: #e8a317;
  --osm-paper: #eef2f6;
  --osm-sheet: #ffffff;
  --osm-ink: #1c2a38;
  --osm-muted: #5b6b7c;
  --osm-line: #cfd8e3;
  --osm-ok: #1b7a4e;
  --osm-ok-bg: #e5f6ec;
  --osm-warn: #b7791f;
  --osm-warn-bg: #fdf3d8;
  --osm-critical: #c0392b;
  --osm-critical-bg: #fdecea;
  --osm-fail: #7b1113;
  --osm-fail-bg: #f8d7da;
  --osm-climate: #1a5f8a;
  --osm-climate-bg: #e3f2fd;
  --toolbar-h: 64px;
  --font-ui: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-head: "Oswald", "Arial Narrow", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--osm-ink);
  background: var(--osm-paper);
  min-height: 100vh;
}

img { max-width: 100%; }

/* ========== Toolbar ========== */
.app-toolbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--toolbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: linear-gradient(90deg, var(--osm-navy) 0%, var(--osm-navy-2) 70%, #125a8c 100%);
  color: #fff;
  box-shadow: 0 4px 18px rgba(7, 42, 74, 0.28);
}

.toolbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--osm-gold);
  color: var(--osm-navy);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.toolbar-brand strong {
  display: block;
  font-family: var(--font-head);
  letter-spacing: 0.06em;
  font-size: 1.05rem;
  line-height: 1;
}

.toolbar-brand small {
  display: block;
  opacity: 0.8;
  font-size: 0.7rem;
}

.toolbar-modes {
  display: flex;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 4px;
}

.mode-btn {
  border: 0;
  background: transparent;
  color: #d7e6f5;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.mode-btn.is-active {
  background: #fff;
  color: var(--osm-navy);
}

.toolbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-tool {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-tool:hover { background: rgba(255, 255, 255, 0.18); }
.btn-tool-primary { background: var(--osm-gold); color: var(--osm-navy); border-color: var(--osm-gold); font-weight: 700; }
.btn-tool-photo { background: #0e5a8a; border-color: #1e88c8; }
.btn-tool-import { background: #0a4d3c; border-color: #1b7a4e; }
.btn-tool-save { background: var(--osm-gold); color: var(--osm-navy); border-color: var(--osm-gold); font-weight: 700; }
.btn-tool-reports { background: #123c63; border-color: #2a6aa0; }

.save-cluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.save-cluster-form {
  margin-right: 6px;
}

.form-actions > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.28);
}

.status-dot.is-clean { background: #3db8ff; }
.status-dot.is-dirty { background: #e53935; animation: statusPulse 1.2s ease-in-out infinite; }
.status-dot.is-local { background: #f5c542; }
.status-dot.is-server { background: #2ecc71; }

.save-cluster-form .status-dot {
  box-shadow: 0 0 0 2px rgba(7, 42, 74, 0.14);
}

.server-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px 4px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}

button.server-chip {
  appearance: none;
  -webkit-appearance: none;
}

.server-chip:focus-visible {
  outline: 2px solid #f5c542;
  outline-offset: 2px;
}

.server-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9aa8b5;
}

.server-chip.is-checking .server-chip-dot {
  background: #f5c542;
  animation: statusPulse 1s ease-in-out infinite;
}

.server-chip.is-online {
  border-color: rgba(46, 204, 113, 0.55);
  background: rgba(46, 204, 113, 0.16);
}

.server-chip.is-online .server-chip-dot {
  background: #2ecc71;
  box-shadow: 0 0 6px #2ecc71;
}

.server-chip.is-offline {
  border-color: rgba(229, 57, 53, 0.5);
  background: rgba(229, 57, 53, 0.16);
}

.server-chip.is-offline .server-chip-dot {
  background: #e53935;
}

.sync-flags {
  display: inline-flex;
  align-items: stretch;
  gap: 6px;
}

.sync-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 7px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.15;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
}

.sync-flag-copy {
  display: flex;
  flex-direction: column;
}

.sync-flag-meta {
  font-size: 0.58rem;
  font-weight: 500;
  opacity: 0.88;
  letter-spacing: 0;
}

.sync-flag-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9aa8b5;
  flex-shrink: 0;
}

.sync-flag.is-checking .sync-flag-dot {
  background: #f5c542;
  animation: statusPulse 1s ease-in-out infinite;
}

.sync-flag.is-ok {
  border-color: rgba(46, 204, 113, 0.55);
  background: rgba(46, 204, 113, 0.16);
}
.sync-flag.is-ok .sync-flag-dot {
  background: #2ecc71;
  box-shadow: 0 0 6px #2ecc71;
}

.sync-flag.is-pending {
  border-color: rgba(245, 197, 66, 0.55);
  background: rgba(245, 197, 66, 0.16);
}
.sync-flag.is-pending .sync-flag-dot {
  background: #f5c542;
}

.sync-flag.is-off,
.sync-flag.is-blocked {
  border-color: rgba(229, 57, 53, 0.5);
  background: rgba(229, 57, 53, 0.16);
}
.sync-flag.is-off .sync-flag-dot,
.sync-flag.is-blocked .sync-flag-dot {
  background: #e53935;
}

.sync-flag.is-none {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.save-cluster-form .sync-flag {
  color: var(--osm-navy);
  border-color: var(--osm-line);
  background: #fff;
  cursor: default;
}

.save-cluster-form .sync-flag-meta { display: none; }

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.import-queue { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.import-file {
  border: 1px solid var(--osm-line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
.import-file-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.import-file-head strong { font-size: 0.9rem; }
.import-file .meta { font-size: 0.8rem; color: var(--osm-muted); margin: 4px 0 0; }
.import-file.is-ok { border-color: #8fd0a8; background: #f3fbf6; }
.import-file.is-err { border-color: #e7a0a4; background: #fff6f6; }
.import-file.is-busy { border-color: var(--osm-blue); }

.import-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 120px;
  border: 2px dashed var(--osm-blue);
  border-radius: 12px;
  background: var(--osm-blue-soft);
  color: var(--osm-navy);
  cursor: pointer;
  text-align: center;
  padding: 16px;
}
.import-drop i { font-size: 1.8rem; color: var(--osm-blue); }
.import-drop.is-drag { background: #cfe8f6; border-style: solid; }

.import-text {
  font-size: 0.88rem;
  line-height: 1.45;
  min-height: 160px;
}

.sync-status-box {
  font-size: 0.9rem;
  line-height: 1.45;
}

.import-preview-wrap {
  margin-top: 16px;
  text-align: center;
}
.import-preview-wrap img {
  max-height: 220px;
  border-radius: 8px;
  border: 1px solid var(--osm-line);
}

.import-result {
  margin-top: 16px;
  border: 1px solid var(--osm-line);
  border-radius: 10px;
  padding: 12px;
  background: #f8fbfe;
}
.import-result table { font-size: 0.82rem; margin-bottom: 0; }

.qtd-inversores-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--osm-navy);
  white-space: nowrap;
}
.qtd-inversores-label .form-select { width: auto; min-width: 4.5rem; }

.photo-cat-head-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.report-switcher {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
  position: sticky;
  top: 0;
  z-index: 4;
  background: linear-gradient(#f4f7fb 70%, transparent);
  padding: 8px 0 12px;
}
.report-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  border: 1px solid var(--osm-line);
  background: #fff;
  color: var(--osm-navy);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}
.report-tab-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5b6b7c;
}
.report-tab small { color: #5b6b7c; font-size: 0.78rem; }
.report-tab.is-active {
  border-color: var(--osm-navy);
  box-shadow: 0 0 0 2px rgba(7, 42, 74, 0.18);
  background: #fff;
}
.report-tab.is-done.is-active { background: #eef8f0; }
.report-tab.is-pending.is-active { background: #fff6e8; }
.report-page-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--osm-line);
}
.report-page-banner.is-done { background: #eef8f0; border-color: #9cc9a8; }
.report-page-banner.is-pending { background: #fff6e8; border-color: #e8a317; }
.report-page-banner p { font-size: 0.86rem; color: #3d4d5c; margin-top: 4px; }
.report-status-pill {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  background: #072a4a;
  color: #fff;
}
.report-page-banner.is-pending .report-status-pill { background: #b86a00; }
.inverter-card.is-active-report {
  outline: 2px solid var(--osm-navy);
}
.report-card-tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #1b6b3a;
  vertical-align: middle;
}
.mppt-delta { font-variant-numeric: tabular-nums; white-space: nowrap; }
.preview-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 auto 16px;
  max-width: 920px;
  padding: 0 12px;
}
.preview-jump .report-tab { text-decoration: none; }
.report-chapter-head {
  border-radius: 10px;
  padding: 12px 14px;
  margin: 8px 0 12px;
}
.report-chapter-head.is-done { background: #eef8f0; border: 1px solid #9cc9a8; }
.report-chapter-head.is-pending { background: #fff6e8; border: 1px solid #e8a317; }
.report-chapter-head h2 {
  font-family: Oswald, sans-serif;
  margin: 0;
  color: #072a4a;
}

.inv-photo-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}
.inv-photo-tab {
  border: 1px solid var(--osm-line);
  background: #fff;
  color: var(--osm-navy);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.inv-photo-tab.is-active {
  background: var(--osm-navy);
  color: #fff;
  border-color: var(--osm-navy);
}
.inv-photo-panel {
  border: 1px dashed var(--osm-blue);
  border-radius: 10px;
  padding: 12px;
  background: #f8fbfe;
}
.inv-photo-panel[hidden] { display: none !important; }

.photo-cat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.photo-print-inv {
  margin: 8px 0 14px;
  border: 1px solid #c5d0dc;
  padding: 8px;
}
.photo-print-inv h5 {
  margin: 0 0 8px;
  color: #072a4a;
  font-size: 11pt;
}

.inv-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--osm-line);
}

.report-kicker {
  font-family: var(--font-head);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--osm-blue);
  margin: 0 0 2px;
}

.report-tagline {
  margin: 0;
  font-size: 10px;
  color: var(--osm-muted);
  letter-spacing: 0.04em;
}

.mppt-nota {
  width: 110px;
  font-size: 0.75rem;
}

.app-status {
  padding: 8px 16px;
  background: #12385c;
  color: #e8f4ff;
  font-size: 0.85rem;
}

/* ========== Edit layout ========== */
.edit-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  max-width: 1440px;
  margin: 0 auto;
}

.edit-nav {
  position: sticky;
  top: var(--toolbar-h);
  align-self: start;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.edit-nav a {
  color: var(--osm-navy-2);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 500;
}

.edit-nav a:hover,
.edit-nav a:focus { background: #fff; }

.edit-form {
  padding: 20px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-card {
  background: var(--osm-sheet);
  border: 1px solid var(--osm-line);
  border-radius: 14px;
  padding: 20px 22px 24px;
  box-shadow: 0 8px 24px rgba(7, 42, 74, 0.06);
}

.form-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--osm-navy);
}

.form-card-head h2 {
  font-family: var(--font-head);
  font-size: 1.25rem;
  letter-spacing: 0.03em;
  margin: 0;
  color: var(--osm-navy);
  text-transform: uppercase;
}

.form-card-head p {
  margin: 4px 0 0;
  color: var(--osm-muted);
  font-size: 0.85rem;
}

.form-card-head .btn,
.head-actions { margin-left: auto; white-space: nowrap; }

.head-actions { display: flex; gap: 8px; }

.sec-index {
  background: var(--osm-navy);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 6px 8px;
  border-radius: 6px;
  min-width: 42px;
  text-align: center;
}

.form-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--osm-navy);
}

.form-control,
.form-select {
  border-color: #c5d0dc;
  font-size: 0.92rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--osm-blue);
  box-shadow: 0 0 0 0.2rem rgba(30, 136, 200, 0.18);
}

.form-divider {
  margin: 20px 0;
  border-color: var(--osm-line);
}

.btn-osm {
  background: var(--osm-navy);
  color: #fff;
  border: 0;
  font-weight: 600;
}

.btn-osm:hover { background: var(--osm-navy-2); color: #fff; }

.logo-upload {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.logo-drop {
  width: 100%;
  min-height: 92px;
  border: 1px dashed var(--osm-blue);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--osm-navy-2);
  cursor: pointer;
  background: var(--osm-blue-soft);
  font-size: 0.8rem;
}

#logoPreview {
  max-height: 72px;
  max-width: 160px;
  object-fit: contain;
}

/* AI buttons */
.ai-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.btn-ai {
  border: 0;
  background: linear-gradient(90deg, #5b2d91, #1e88c8);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-ai:hover { filter: brightness(1.08); color: #fff; }
.btn-ai-alt { background: linear-gradient(90deg, #0b3d6e, #1e88c8); }

/* Inverters */
.inverter-card {
  border: 1px solid var(--osm-line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: #f8fbfe;
}

.inverter-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.inverter-card-head h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--osm-navy);
  font-family: var(--font-head);
  letter-spacing: 0.04em;
}

/* Chronology */
.etapa-card {
  border-left: 4px solid var(--osm-blue);
  background: #f7fafc;
  padding: 14px;
  border-radius: 0 10px 10px 0;
  margin-bottom: 12px;
}

.etapa-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.etapa-num {
  background: var(--osm-navy);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
}

/* MPPT table */
.mppt-wrap {
  border: 1px solid var(--osm-line);
  border-radius: 10px;
}

.mppt-table {
  margin: 0;
  font-size: 0.82rem;
}

.mppt-table thead th {
  background: var(--osm-navy);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}

.mppt-table td { vertical-align: middle; }

.mppt-table input,
.mppt-table select {
  min-width: 72px;
  font-size: 0.8rem;
}

.cell-fail { background: var(--osm-fail-bg) !important; color: var(--osm-fail); font-weight: 700; }
.cell-critical { background: var(--osm-critical-bg) !important; }
.cell-warn { background: var(--osm-warn-bg) !important; }
.cell-ok { background: var(--osm-ok-bg) !important; }
.row-fail { outline: 2px solid var(--osm-fail); }
.row-critical td:not(.cell-fail) { background: var(--osm-critical-bg); }

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.badge-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-status.ok { background: var(--osm-ok-bg); color: var(--osm-ok); }
.badge-status.warn { background: var(--osm-warn-bg); color: var(--osm-warn); }
.badge-status.critical { background: var(--osm-critical-bg); color: var(--osm-critical); }
.badge-status.fail { background: var(--osm-fail-bg); color: var(--osm-fail); }
.badge-status.climate { background: var(--osm-climate-bg); color: var(--osm-climate); }

/* Photos */
.photo-categories { display: flex; flex-direction: column; gap: 18px; }

.photo-cat {
  border: 1px solid var(--osm-line);
  border-radius: 10px;
  padding: 14px;
}

.photo-cat h3 {
  font-size: 1rem;
  color: var(--osm-navy);
  margin-bottom: 4px;
}

.photo-cat p { font-size: 0.82rem; color: var(--osm-muted); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.photo-item {
  border: 1px solid var(--osm-line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  break-inside: avoid;
}

.photo-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.photo-item textarea {
  border: 0;
  border-top: 1px solid var(--osm-line);
  width: 100%;
  font-size: 0.75rem;
  padding: 6px 8px;
  resize: vertical;
  min-height: 48px;
}

.photo-name-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--osm-navy);
  padding: 6px 8px 0;
}

.photo-name-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--osm-line);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 8px 6px;
  color: var(--osm-navy);
}

.photo-name-input.is-custom {
  color: #5b2d91;
}

.photo-item .photo-actions {
  display: flex;
  justify-content: flex-end;
  padding: 4px 6px;
}

/* Signatures */
.sign-title {
  font-family: var(--font-head);
  font-size: 1rem;
  color: var(--osm-navy);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sign-pad-wrap { position: relative; }

.sign-pad {
  width: 100%;
  height: 160px;
  border: 1px dashed var(--osm-blue);
  border-radius: 8px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(0deg, transparent, transparent 31px, #e6eef5 32px);
  cursor: crosshair;
  touch-action: none;
}

/* ========== Preview / report sheet ========== */
.preview-shell {
  padding: 24px 16px 64px;
  background: #c5d0dc;
}

.report-sheet {
  width: 210mm;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  color: #111;
  padding: 14mm 14mm 16mm;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  font-size: 10.5pt;
  line-height: 1.35;
}

.report-header {
  display: grid;
  grid-template-columns: 36mm minmax(0, 1fr);
  gap: 8px 12px;
  align-items: center;
  border-bottom: 5px solid var(--osm-navy);
  padding-bottom: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}

.report-header-copy { min-width: 0; }

.report-logo {
  width: 36mm;
  height: 20mm;
  max-width: 100%;
  max-height: 20mm;
  object-fit: contain;
  object-position: left center;
  display: block;
  background: #fff;
}

.brand-lockup {
  width: 36mm;
  min-height: 20mm;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2px 8px 2px 0;
  border-right: 3px solid var(--osm-gold);
}
.brand-lockup-name {
  font-family: var(--font-head);
  font-size: 20px;
  letter-spacing: 0.12em;
  color: var(--osm-navy);
  line-height: 1;
}
.brand-lockup-sub {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--osm-gold);
  margin-top: 4px;
}

.report-header h1 {
  font-family: var(--font-head);
  font-size: 18px;
  margin: 0;
  color: var(--osm-navy);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.15;
}

.report-header .sub {
  margin: 2px 0 0;
  color: var(--osm-navy-2);
  font-weight: 600;
  font-size: 11px;
}

.report-meta-box {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  text-align: left;
  font-size: 9px;
  color: var(--osm-navy);
  min-width: 0;
  line-height: 1.35;
  border-top: 1px solid #c5d0dc;
  padding-top: 8px;
}

.report-meta-box strong {
  display: block;
  font-size: 13px;
}

.report-band {
  background: var(--osm-navy);
  color: #fff;
  font-family: var(--font-head);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  padding: 6px 10px;
  margin: 16px 0 8px;
  break-after: avoid;
}

.report-kv {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}

.report-kv th,
.report-kv td {
  border: 1px solid #c5d0dc;
  padding: 5px 8px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.report-kv th {
  width: 28%;
  background: #eef4fa;
  color: var(--osm-navy);
  font-weight: 600;
}

.parecer-prose {
  margin: 0 0 14px;
  break-inside: auto;
}

.parecer-prose h4 {
  margin: 12px 0 6px;
  font-size: 0.92rem;
  color: var(--osm-navy);
}

.parecer-prose div {
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: justify;
}
}

.inv-block { margin-bottom: 8px; }

.note-box {
  border: 1px solid var(--osm-blue);
  background: #f3f9fd;
  padding: 8px 10px;
  font-size: 10pt;
  overflow-wrap: anywhere;
}

.etapa-print {
  margin-bottom: 8px;
  border: 1px solid #d5dee8;
  padding: 8px 10px;
}

.etapa-print h4 {
  margin: 0 0 4px;
  color: var(--osm-navy);
  font-size: 11pt;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 8pt;
  margin: 6px 0 10px;
}

.report-table-wrap {
  width: 100%;
  overflow: hidden;
}

.report-table th,
.report-table td {
  border: 1px solid #9eb1c4;
  padding: 3px 4px;
  text-align: center;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.report-table th {
  background: var(--osm-navy);
  color: #fff;
  font-weight: 600;
}

.report-table td.left { text-align: left; }

.photo-print-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
}

.photo-print-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
  break-inside: avoid;
  page-break-inside: avoid;
}

.photo-print-item {
  margin: 0;
  border: 1px solid #c5d0dc;
  padding: 4px;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.photo-print-item.is-empty {
  border: none;
  background: transparent;
  padding: 0;
}

.photo-frame {
  height: 42mm;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef2f6;
  overflow: hidden;
}

.photo-print-item img {
  width: 100%;
  height: 42mm;
  max-height: 42mm;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #eef2f6;
}

.photo-print-item figcaption {
  font-size: 8pt;
  color: #334;
  padding: 5px 4px 3px;
  line-height: 1.25;
  min-height: 8mm;
  word-break: break-word;
}

.photo-section-title {
  color: #072a4a;
  font-size: 11pt;
  margin: 10px 0 6px;
}

.report-note {
  font-size: 8.5pt;
  color: #456;
  margin: 0 0 10px;
}

.report-sheet.is-pdf-export {
  width: 794px;
  max-width: 794px;
  padding: 28px 30px 40px;
  margin: 0;
  box-shadow: none;
  overflow: hidden;
}
.report-sheet.is-pdf-export .report-header {
  grid-template-columns: 118px minmax(0, 1fr);
}
.report-sheet.is-pdf-export .photo-print-row,
.report-sheet.is-pdf-export .sign-print {
  grid-template-columns: 1fr 1fr;
}
.report-sheet.is-pdf-export .badge-status {
  white-space: normal;
  font-size: 7.5pt;
  line-height: 1.15;
  padding: 2px 5px;
  border-radius: 6px;
}

.sign-print {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
  break-inside: avoid;
}

.sign-print-box {
  border-top: 1px solid #333;
  padding-top: 6px;
  min-height: 28mm;
}

.sign-print-box img {
  max-height: 22mm;
  display: block;
  margin-bottom: 4px;
}

.report-footer {
  margin-top: 16px;
  font-size: 8pt;
  color: #667;
  border-top: 2px solid var(--osm-navy);
  padding-top: 6px;
  display: flex;
  justify-content: space-between;
}

/* Modals */
.settings-modal .modal-header,
.osm-modal-head {
  background: var(--osm-navy);
  color: #fff;
}

.settings-modal .modal-title,
.osm-modal-head .modal-title {
  font-size: 1.1rem;
  font-family: var(--font-head);
  letter-spacing: 0.04em;
}

.settings-lead { color: var(--osm-muted); font-size: 0.9rem; }

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
}

.test-status { font-size: 0.85rem; font-weight: 600; }
.test-status.ok { color: var(--osm-ok); }
.test-status.err { color: var(--osm-critical); }

.gemini-loading {
  text-align: center;
  padding: 28px;
  color: var(--osm-navy);
}

.suggest-box {
  background: #f4f6f8;
  border: 1px solid var(--osm-line);
  border-radius: 8px;
  padding: 10px;
  min-height: 220px;
  white-space: pre-wrap;
  font-size: 0.88rem;
}

.suggest-edit { min-height: 220px; }

.form-actions {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 8px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--osm-line);
  border-radius: 12px;
  box-shadow: 0 -8px 24px rgba(7, 42, 74, 0.08);
}

.form-actions .btn { margin-right: 6px; margin-bottom: 4px; }

.save-hint {
  font-size: 0.82rem;
  color: var(--osm-muted);
  font-weight: 600;
}

.empty-hint {
  margin: 0;
  padding: 12px 14px;
  border: 1px dashed var(--osm-line);
  border-radius: 10px;
  color: var(--osm-muted);
  font-size: 0.9rem;
  background: #f7fafc;
}

.pending-note {
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #8a96a3;
  font-size: 0.75rem;
  line-height: 1.35;
  font-weight: 400;
}

.pending-note label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 0 8px;
  cursor: pointer;
  font-weight: 500;
  color: #7b8794;
}

.pending-note input {
  margin: 0;
  accent-color: #7b8794;
}

.pending-note.is-omitted {
  color: #9aa6b2;
}

.reports-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.reports-toolbar .form-control { max-width: 420px; }

.reports-count {
  font-size: 0.85rem;
  color: var(--osm-muted);
  white-space: nowrap;
}

.reports-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--osm-navy);
  background: #f4f7fb;
}

.reports-table td { font-size: 0.9rem; }

.reports-table tr.is-current {
  background: #eef6ff;
}

.reports-local {
  font-size: 0.75rem;
  color: var(--osm-muted);
}

.reports-actions {
  white-space: nowrap;
}

.reports-actions .btn { margin-right: 4px; }

.reports-empty {
  color: var(--osm-muted);
  margin: 8px 0 0;
}

.reports-footer {
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
}

.reports-footer .btn-osm { margin-left: auto; }

/* Responsive */
@media (max-width: 992px) {
  .edit-shell { grid-template-columns: 1fr; }
  .edit-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
    background: #fff;
    border-bottom: 1px solid var(--osm-line);
  }
  .edit-nav a { white-space: nowrap; }
  .toolbar-brand small { display: none; }
}

@media (max-width: 768px) {
  .app-toolbar { height: auto; flex-wrap: wrap; padding: 8px; }
  :root { --toolbar-h: auto; }
  .form-card-head { flex-wrap: wrap; }
  .report-header { grid-template-columns: 1fr; }
  .photo-print-grid,
  .sign-print { grid-template-columns: 1fr; }
}

/* ========== Print / PDF ========== */
@page {
  size: A4;
  margin: 10mm 10mm 12mm 10mm;
}

@media print {
  html, body {
    background: #fff !important;
    margin: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .no-print,
  .app-toolbar,
  .app-status,
  .edit-nav,
  .modal,
  #editMode {
    display: none !important;
  }

  #previewMode {
    display: block !important;
    padding: 0;
    background: #fff;
  }

  .preview-shell { padding: 0; background: #fff; }

  .report-sheet {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }

  .report-band,
  .etapa-print,
  .photo-print-item,
  .sign-print-box,
  .report-header,
  .report-chapter-head {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-table { page-break-inside: auto; }
  .report-table tr { break-inside: avoid; page-break-inside: avoid; }
  .report-table thead { display: table-header-group; }

  .report-header {
    grid-template-columns: 36mm minmax(0, 1fr) !important;
  }
  .photo-print-row,
  .sign-print { grid-template-columns: 1fr 1fr !important; }
}
