:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --line: #d9e4df;
  --text: #10231f;
  --muted: #63746e;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --soft: #edf7f4;
  --soft-2: #f7fbf9;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok: #166534;
  --shadow: 0 14px 34px rgba(15, 35, 31, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    linear-gradient(180deg, #fbfcfb 0, var(--bg) 260px),
    var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}
button, input, select, textarea { font: inherit; }
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--bg);
}
.login-screen.hidden {
  display: none;
}
.login-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(12, 35, 30, .14);
  padding: 20px;
}
.login-card h1 {
  margin-bottom: 18px;
}
.register-agent {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.register-agent summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--primary-dark);
}
.session-box {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sync-pill {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sync-ok {
  color: var(--primary-dark);
  background: #dcfce7;
}
body.server-mode .register-agent {
  display: none;
}
.shell.locked {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}
.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-weight: 800;
  font-size: .78rem;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 1.75rem; }
h2 { font-size: 1.08rem; margin-bottom: 14px; }
h3 { font-size: 1rem; margin: 8px 0 12px; }
.pill {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
}
.nav-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.app-back-button {
  min-width: 128px;
  padding: 0 16px;
}
.app-back-button[hidden] {
  display: none;
}
.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 0;
  padding: 5px;
  background: #eaf1ee;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.leader-only {
  display: none;
}
body.role-leader .leader-only {
  display: block;
}

body.role-patient-loader .tabs,
body.role-patient-loader .app-back-button,
body.role-patient-loader #pacientes .panel-head button,
body.role-patient-loader #pacientes .filters {
  display: none !important;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.settings-actions {
  grid-column: 1 / -1;
}

body.role-patient-loader main {
  margin-top: 18px;
}

body.role-patient-loader #pacientes .panel {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}
.tab, button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
}
.tab {
  background: transparent;
  border: 0;
  color: var(--muted);
}
.tab.active, .primary {
  background: var(--primary);
  color: #fff;
}
.secondary {
  background: #edf5f1;
  color: var(--primary-dark);
  border: 1px solid var(--line);
}
.danger {
  background: var(--danger);
  color: #fff;
}
.wide { width: 100%; }
.view { display: none; }
.view.active { display: block; }
.agent-card, .panel, .metrics article, .home-hero, .quick-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.home-hero {
  display: grid;
  grid-template-columns: 1.25fr 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 22px;
  margin-bottom: 14px;
}
.home-greeting {
  display: flex;
  align-items: center;
  gap: 13px;
}
.agent-avatar {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dff3ed;
  color: var(--primary-dark);
  font-weight: 900;
  font-size: 1.25rem;
  border: 1px solid #c7e6dd;
}
.home-greeting span,
.home-stat span,
.section-title span {
  color: var(--muted);
  font-size: .88rem;
  font-weight: 700;
}
.home-greeting strong {
  display: block;
  margin-top: 4px;
  font-size: 1.45rem;
}
.home-stat {
  display: grid;
  justify-items: start;
  gap: 2px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}
.home-stat strong {
  font-size: 3.1rem;
  line-height: .95;
  color: var(--primary-dark);
}
.home-stat small {
  color: var(--muted);
  font-weight: 800;
}
.home-hero-actions {
  display: grid;
  gap: 8px;
  min-width: 160px;
}
.agent-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.agent-card span, .metrics span, .muted {
  color: var(--muted);
  font-size: .9rem;
}
.agent-card strong { display: block; margin-top: 4px; font-size: 1.15rem; }
.agent-card strong {
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.metrics article {
  padding: 14px;
  box-shadow: none;
  border-radius: 14px;
}
.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 1.55rem;
  color: var(--primary-dark);
}
.panel {
  padding: 16px;
  margin-bottom: 14px;
}
.quick-panel {
  padding: 16px;
  margin-bottom: 14px;
}
.nested-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.report-clean-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfefd;
  padding: 14px;
  margin-bottom: 12px;
}
.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.report-summary-grid article {
  min-height: 102px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 13px;
  box-shadow: 0 8px 18px rgba(15, 35, 31, .05);
}
.report-summary-grid span,
.report-summary-grid small {
  display: block;
  color: var(--muted);
  font-weight: 800;
  overflow-wrap: anywhere;
}
.report-summary-grid strong {
  display: block;
  margin: 6px 0;
  color: var(--primary-dark);
  font-size: 1.55rem;
  overflow-wrap: anywhere;
}
.service-report-sheet {
  background: #fff;
  color: #111;
  padding: 14px;
  border: 1px solid #222;
}
.service-report-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 2px solid #222;
}
.service-report-header h2 {
  margin: 3px 0 0;
  font-size: 1.25rem;
}
.service-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .75rem;
}
.service-report-table th,
.service-report-table td {
  border: 1px solid #555;
  padding: 6px;
  text-align: left;
  vertical-align: top;
}
.service-report-table th {
  background: #e5e7eb;
}
.report-preview-folder {
  margin-top: 14px;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.section-title h2 {
  margin-bottom: 0;
}
.quick-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.quick-action {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 94px;
  padding: 12px 8px;
  background: var(--soft-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: .9rem;
}
.quick-action span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .82rem;
  font-weight: 900;
}
.quick-action:hover {
  background: var(--soft);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-head h2 { margin-bottom: 0; }
label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-weight: 800;
}
input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 400;
}
textarea { resize: vertical; }
.grid-2, .grid-3 {
  display: grid;
  gap: 12px;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.filters {
  display: flex;
  gap: 8px;
}
.filters input {
  min-width: 170px;
}
.list {
  display: grid;
  gap: 10px;
}
.button-row.slim {
  margin-top: 0;
  min-width: 280px;
}
.compact { margin-bottom: 12px; }
.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.item header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.item.alert { border-left: 6px solid var(--warn); background: #fffbeb; }
.item.danger { border-left: 6px solid var(--danger); background: #fff7f7; }
.task-card {
  border-left: 6px solid var(--primary);
  cursor: pointer;
}
.task-card.priority-urgente {
  background: #fff1f2;
  border-color: #dc2626;
}
.task-card.priority-alta {
  background: #fff7ed;
  border-color: #ea580c;
}
.task-card.priority-media {
  background: #fefce8;
  border-color: #ca8a04;
}
.task-card.priority-baixa {
  background: #ecfdf5;
  border-color: #059669;
}
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .8rem;
  font-weight: 800;
  background: #edf5f1;
  color: var(--primary-dark);
  white-space: nowrap;
}
.badge.warn { background: #fef3c7; color: var(--warn); }
.badge.danger { background: #fee2e2; color: var(--danger); }
.badge.ok { background: #dcfce7; color: var(--ok); }
.danger-text {
  color: var(--danger) !important;
}
.danger-alert {
  border-left-color: var(--danger) !important;
  background: #fff7f7 !important;
}
.priority-card {
  cursor: pointer;
}
.priority-card:hover,
.priority-card:focus {
  outline: 3px solid #fecaca;
  outline-offset: 2px;
}
.property-card.danger-alert {
  border-color: #fecaca;
}
.territory-tree {
  display: grid;
  gap: 16px;
}
.breadcrumb {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 800;
}
.cascade-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.cascade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.block-picker {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(15, 35, 31, .05);
}
.block-picker-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}
.block-row {
  display: grid;
  grid-template-columns: 120px 120px 1fr auto auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  text-align: left;
}
.block-row:hover {
  background: #f5fbf8;
}
.block-row-code {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0;
  background: transparent;
  border-radius: 0;
  text-align: left;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--primary-dark);
}
.block-row-code::before {
  content: "[+]";
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 28px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: #e8f5f1;
  font-size: .76rem;
}
.block-row span {
  color: var(--muted);
  font-weight: 800;
}
.block-row strong {
  color: var(--primary-dark);
  white-space: nowrap;
}
.cascade-card {
  display: grid;
  gap: 6px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
  align-content: start;
}
.cascade-card strong {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cascade-card span,
.cascade-card small {
  color: var(--muted);
  font-weight: 700;
}
.cascade-card b {
  color: var(--primary-dark);
}
.cascade-card:hover {
  background: #f8fbfa;
}
.folder-main {
  min-height: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.folder-actions,
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.folder-actions button,
.header-actions button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: .82rem;
}
.inline-actions {
  justify-content: flex-end;
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.module-card {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 9px;
  min-height: 166px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  text-align: left;
  align-content: start;
  box-shadow: 0 10px 24px rgba(15, 35, 31, .06);
}
.module-card.featured {
  border-color: #bfe3d8;
  background: linear-gradient(180deg, #fbfffd, #f3faf7);
}
.module-card strong {
  font-size: 1.25rem;
}
.module-card small {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}
.module-card:hover {
  background: #f1f8f5;
}
.module-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dff3ed;
  color: var(--primary-dark);
  font-weight: 900;
  border: 1px solid #c7e6dd;
}
.rg-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.rg-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.active-rg {
  background: #dff3ed !important;
  color: var(--primary-dark) !important;
}
.rg-summary {
  margin-bottom: 12px;
}
.rg-summary-card,
.rg-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}
.rg-summary-card {
  display: grid;
  gap: 4px;
  border-left: 6px solid var(--primary);
}
.rg-summary-card span {
  color: var(--muted);
  font-weight: 700;
}
.rg-list {
  display: grid;
  gap: 12px;
}
.service-master-detail {
  display: grid;
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
  min-height: 560px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .07);
}
.service-master {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #f5f9f8;
}
.service-master-head {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.service-master-head strong {
  display: block;
  margin-bottom: 9px;
}
.service-master-head input {
  width: 100%;
}
.service-master-scroll {
  max-height: 720px;
  overflow-y: auto;
}
.service-master-item {
  width: 100%;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 72px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.service-master-item:hover {
  background: #edf7f4;
}
.service-master-item.active {
  background: #fff;
  box-shadow: inset 4px 0 var(--primary);
}
.service-master-item.has-alert {
  background-image: linear-gradient(90deg, #fff0f1, transparent 58%);
}
.service-master-copy {
  min-width: 0;
}
.service-master-copy strong,
.service-master-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.service-master-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: .73rem;
}
.service-detail {
  min-width: 0;
  padding: 16px;
}
.service-detail > .rg-card {
  border: 0;
  padding: 0;
}
.service-history-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.service-timeline {
  display: grid;
}
.service-timeline-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  position: relative;
  padding-bottom: 14px;
}
.service-timeline-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 32px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.service-timeline-marker {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  z-index: 1;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .76rem;
  font-weight: 900;
}
.service-timeline-content {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.service-timeline-content header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.service-timeline-content p {
  margin: 0 0 5px;
  color: var(--text);
  line-height: 1.45;
}
.service-timeline-content .view-history {
  margin-top: 8px;
}
.visit-timeline-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfa;
}
.visit-timeline-header h3 {
  margin: 4px 0;
}
.history-media-title {
  margin-top: 16px;
}
.history-visit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}
.rg-card {
  border-left: 6px solid #d9e4df;
}
.rg-card > header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.service-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.service-facts div {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 9px 10px;
}
.service-facts b {
  font-size: .78rem;
  color: var(--muted);
}
.service-facts span {
  font-weight: 800;
  color: var(--primary-dark);
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  font-weight: 800;
}
.check-row input {
  width: auto;
}
.folder-icon {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 26px;
  border: 2px solid var(--primary);
  border-radius: 4px;
  color: var(--primary-dark);
  background: #e8f5f1;
  font-size: .82rem;
}
.inline-form-card {
  border: 1px dashed var(--primary);
  border-radius: 14px;
  background: #f8fbfa;
  padding: 14px;
}
.compact-folder-form {
  margin-bottom: 12px;
}
.inline-form-card h3 {
  margin-bottom: 12px;
}
.complaint-intake-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}
.form-workflow-head,
.complaint-intake-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-workflow-head > div {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  column-gap: 8px;
  align-items: start;
}
.form-workflow-head span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  grid-row: span 2;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
}
.form-workflow-head h3 {
  margin: 3px 0 2px;
  font-size: 1rem;
}
.form-workflow-head p {
  margin: 0;
  font-size: .84rem;
  line-height: 1.35;
}
.complaint-step {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.complaint-structured-fields {
  border-color: #b8d7ce;
  background: #fcfffe;
}
.complaint-agent-select {
  grid-column: 1 / -1;
}
.agent-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.agent-check-grid .check-row {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.property-active-tasks {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}
.property-active-tasks .item { margin: 0; }
.field-optional {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
}
.complaint-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 2px;
}
.complaint-form-footer .primary {
  min-width: 250px;
}
.intake-folder {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.intake-folder > summary {
  padding: 14px 16px;
  color: var(--primary);
  font-weight: 800;
  cursor: pointer;
  list-style-position: inside;
}
.intake-folder[open] > summary {
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}
.intake-folder > .inline-form-card {
  margin: 0;
  border: 0;
  border-radius: 0;
}
.property-mobile-toggle { display: none; }
.gps-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  margin: 8px 0 12px;
}
.qr-dialog {
  width: min(460px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.history-dialog {
  width: min(760px, calc(100% - 24px));
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.qr-dialog::backdrop {
  background: rgba(0, 0, 0, .45);
}
.history-dialog::backdrop {
  background: rgba(0, 0, 0, .45);
}
.qr-decision {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--primary-dark);
  font-weight: 800;
  padding: 10px;
  margin-bottom: 12px;
}
#qrVideo {
  display: block;
  width: 100%;
  min-height: 220px;
  background: #10231f;
  border-radius: 8px;
  margin-bottom: 12px;
}
.highlight {
  outline: 4px solid var(--primary);
  outline-offset: 3px;
}
.neighborhood-card,
.block-card,
.property-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}
.neighborhood-card {
  border-left: 6px solid var(--primary);
  background: #fbfefd;
}
.block-card {
  margin-top: 12px;
  border-left: 6px solid #64748b;
}
.property-card {
  margin-top: 10px;
  border-left: 6px solid #d9e4df;
}
.property-list {
  display: grid;
  gap: 10px;
}
.property-master-detail {
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .07);
}
.property-master {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #f5f9f8;
}
.property-master-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #f5f9f8;
}
.property-master-head strong {
  display: block;
  margin-bottom: 9px;
}
.property-master-head input {
  width: 100%;
}
.property-master-scroll {
  max-height: 710px;
  overflow-y: auto;
}
.property-master-item {
  width: 100%;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 70px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.property-master-item:hover {
  background: #edf7f4;
}
.property-master-item.active {
  background: #fff;
  box-shadow: inset 4px 0 var(--primary);
}
.property-master-item.has-alert {
  background-image: linear-gradient(90deg, #fff0f1, transparent 55%);
}
.property-position {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e3f3ef;
  color: var(--primary-dark);
  font-size: .78rem;
  font-weight: 900;
}
.property-master-copy {
  min-width: 0;
}
.property-master-copy strong,
.property-master-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.property-master-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: .72rem;
}
.property-detail {
  min-width: 0;
  padding: 16px;
}
.property-detail .property-card {
  margin: 0;
  border: 0;
  border-left: 0;
  padding: 0;
  box-shadow: none;
}
.property-detail .property-card.danger-alert {
  border-left: 0;
  background: transparent;
}
.property-workspace-tabs {
  display: flex;
  gap: 4px;
  margin-top: 14px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}
.property-workspace-tabs button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}
.property-workspace-tabs button.active {
  border-bottom-color: var(--primary);
  color: var(--primary-dark);
}
.property-workspace-panel {
  margin-top: 14px;
}
.property-workspace-panel[hidden] {
  display: none;
}
.property-summary-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.property-summary-facts > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7faf9;
}
.property-summary-facts span,
.property-summary-facts strong {
  display: block;
}
.property-summary-facts span {
  color: var(--muted);
  font-size: .72rem;
}
.property-summary-facts strong {
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.property-latest-visit {
  margin-top: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.property-latest-visit h3 {
  margin: 0 0 8px;
}
.inspection-workspace {
  padding: 0;
  border: 0;
  background: transparent;
}
.inspection-workspace > summary {
  display: none;
}
.property-media-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.property-media-grid figure {
  margin: 0;
}
.property-media-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.property-edit-form {
  display: grid;
  gap: 10px;
}
.order-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.property-empty {
  padding: 18px;
}
.property-card {
  padding: 12px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .05);
}
.property-card > header {
  align-items: center;
}
.property-card [data-field="meta"],
.property-card [data-field="qr"] {
  font-size: .78rem;
}
.property-order-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.property-order-line span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef8f5;
  color: var(--primary-dark);
  font-size: .76rem;
  font-weight: 900;
}
.property-card .totals {
  margin-top: 8px;
  font-size: .86rem;
}
.property-card .property-actions.compact-actions {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}
.property-card .property-actions.compact-actions button {
  min-height: 34px;
  padding: 7px 9px;
}
.property-history-folder {
  margin-top: 8px;
}
.property-history-folder .history-item {
  padding: 8px;
  font-size: .84rem;
}
.neighborhood-card > header,
.block-card > header,
.property-card > header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.neighborhood-card h2,
.block-card h3 {
  margin-bottom: 4px;
}
.category-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.category-summary div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fbfa;
}
.totals {
  margin-top: 10px;
  color: var(--primary-dark);
  font-weight: 800;
  line-height: 1.5;
}
.property-list {
  display: grid;
  gap: 10px;
}
details {
  margin-top: 12px;
}
summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--primary-dark);
}
.subfolder {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 10px 12px;
  margin: 10px 0;
}
.subfolder summary {
  min-height: 34px;
  display: flex;
  align-items: center;
}
.subfolder[open] {
  background: #fff;
  border-color: #b8d7ce;
}
.media-inline {
  margin-top: 10px;
}
.inspection-basic-row {
  margin-top: 10px;
}
[hidden] {
  display: none !important;
}
.deposit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.deposit-grid label {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}
.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfefd;
}
.validation-item {
  border-left: 6px solid var(--primary);
}
.view-history {
  margin-top: 8px;
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.media-grid figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.media-grid img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #10231f;
}
.media-grid figcaption {
  padding: 8px;
  color: var(--muted);
  font-weight: 700;
}
.field-bulletin {
  margin-top: 16px;
}
.bulletin-page {
  background: #fff;
  color: #111;
  border: 1px solid #111;
  padding: 12px;
  overflow-x: auto;
}
.bulletin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #111;
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.bulletin-header strong,
.bulletin-header span {
  display: block;
}
.bulletin-header h2 {
  margin: 0;
  text-transform: uppercase;
}
.bulletin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid #111;
  border-left: 1px solid #111;
  margin-bottom: 10px;
}
.bulletin-grid div {
  min-height: 42px;
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
  padding: 4px;
}
.bulletin-grid b,
.bulletin-grid span {
  display: block;
}
.bulletin-grid b {
  font-size: .72rem;
  text-transform: uppercase;
}
.bulletin-grid.small {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.bulletin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .58rem;
  table-layout: fixed;
}
.bulletin-table th,
.bulletin-table td {
  border: 1px solid #111;
  height: 22px;
  padding: 2px 3px;
  line-height: 1.05;
  vertical-align: middle;
  overflow: hidden;
  word-break: normal;
  overflow-wrap: normal;
}
.bulletin-table th {
  background: #f1f5f9;
  height: 28px;
  text-align: center;
  font-weight: 700;
}
.bulletin-table th:nth-child(1),
.bulletin-table td:nth-child(1) { width: 5.8%; }
.bulletin-table th:nth-child(2),
.bulletin-table td:nth-child(2) { width: 9.5%; }
.bulletin-table th:nth-child(3),
.bulletin-table td:nth-child(3),
.bulletin-table th:nth-child(4),
.bulletin-table td:nth-child(4),
.bulletin-table th:nth-child(5),
.bulletin-table td:nth-child(5) { width: 5.2%; }
.bulletin-table th:nth-child(6),
.bulletin-table td:nth-child(6) { width: 4.2%; }
.bulletin-table th:nth-child(7),
.bulletin-table td:nth-child(7) { width: 5%; }
.bulletin-table th:nth-child(8),
.bulletin-table td:nth-child(8),
.bulletin-table th:nth-child(9),
.bulletin-table td:nth-child(9) { width: 3.6%; }
.bulletin-table th:nth-child(n+10):nth-child(-n+16),
.bulletin-table td:nth-child(n+10):nth-child(-n+16) {
  width: 2.1%;
  text-align: center;
  padding-left: 1px;
  padding-right: 1px;
}
.bulletin-table th:nth-child(n+17),
.bulletin-table td:nth-child(n+17) {
  width: 5.2%;
  text-align: center;
}
.bulletin-table th:nth-child(28),
.bulletin-table td:nth-child(28) {
  width: 3%;
}
.field-page .bulletin-table tbody tr {
  height: 22px;
}
.bulletin-summary h3 {
  margin: 12px 0 6px;
  text-transform: uppercase;
  font-size: .9rem;
}
.bulletin-lab h3 {
  margin: 12px 0 6px;
  text-transform: uppercase;
  font-size: .9rem;
}
.lab-table {
  margin-top: 4px;
}
.lab-table th {
  background: #e5e7eb;
}
.field-page,
.lab-page {
  margin-bottom: 18px;
  page-break-after: always;
}
.rg-page {
  margin-bottom: 18px;
  page-break-after: always;
}
.rg-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 34px;
}
.rg-header h2 {
  margin: 0 0 8px;
  font-size: 2.1rem;
  line-height: .95;
}
.rg-header h2 span {
  font-weight: 400;
}
.rg-header p {
  margin: 0;
  font-size: .88rem;
}
.rg-logos {
  min-width: 260px;
  text-align: right;
  color: #0f766e;
  font-weight: 900;
  letter-spacing: .04em;
}
.rg-top-grid {
  display: grid;
  grid-template-columns: 160px 1fr 160px 160px;
  border-top: 1px solid #111;
  border-left: 1px solid #111;
  margin-bottom: 8px;
}
.rg-top-grid div {
  min-height: 58px;
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
}
.rg-top-grid .wide {
  grid-column: span 3;
}
.rg-top-grid .wide-2 {
  grid-column: span 2;
}
.rg-top-grid b {
  display: block;
  background: #c9c9c9;
  border-bottom: 1px solid #111;
  padding: 4px;
  text-align: center;
  font-size: .75rem;
}
.rg-top-grid span {
  display: block;
  padding: 8px;
  text-align: center;
  min-height: 30px;
}
.rg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .74rem;
}
.rg-table th,
.rg-table td {
  border: 1px solid #333;
  padding: 3px 5px;
  height: 24px;
}
.rg-table th {
  background: #5e5e5e;
  color: #fff;
  text-transform: uppercase;
}
.rg-table th:nth-child(1),
.rg-table td:nth-child(1) {
  width: 48%;
}
.rg-table th:nth-child(2),
.rg-table td:nth-child(2),
.rg-table th:nth-child(3),
.rg-table td:nth-child(3),
.rg-table th:nth-child(5),
.rg-table td:nth-child(5) {
  width: 13%;
  text-align: center;
}
.rg-closing {
  margin-top: 8px;
  border: 1px solid #111;
}
.rg-closing h3 {
  margin: 0;
  padding: 5px;
  background: #5e5e5e;
  color: #fff;
  text-align: center;
  text-transform: uppercase;
}
.rg-close-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.rg-close-grid div {
  display: flex;
  gap: 5px;
  min-height: 26px;
  border-top: 1px solid #111;
  border-right: 1px solid #111;
  padding: 5px;
}
.rg-close-grid div:last-child {
  border-right: 0;
}
.rg-close-grid.totals-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.rg-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 100px;
  margin-top: 54px;
}
.rg-signatures div {
  display: flex;
  gap: 5px;
  align-items: flex-end;
}
.rg-signatures span {
  flex: 1;
  min-height: 20px;
  border-bottom: 1px solid #111;
}
.bulletin-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 28px;
}
.bulletin-signatures div {
  border-top: 1px solid #111;
  text-align: center;
  padding-top: 6px;
}
.qr {
  width: 92px;
  height: 92px;
  border: 8px solid #111;
  background:
    linear-gradient(90deg, #111 12px, transparent 12px 22px, #111 22px 34px, transparent 34px),
    linear-gradient(#111 12px, transparent 12px 22px, #111 22px 34px, transparent 34px),
    #fff;
  background-size: 34px 34px;
  flex: 0 0 auto;
}
.deposits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.deposits label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  background: #edf5f1;
  padding: 10px;
  border-radius: 8px;
}
.deposits input { width: auto; }
.button-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.period-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.active-priority {
  background: var(--primary) !important;
  color: #fff !important;
}
.property-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.compact-actions {
  margin: 10px 0 4px;
}
.address-line {
  margin-top: 6px;
  color: var(--text);
  font-weight: 800;
  overflow-wrap: anywhere;
}
.chief-presentation-panel {
  margin-top: 14px;
  background: #071225;
  border: 1px solid #18314f;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 20px 48px rgba(6, 18, 37, .18);
}
.chief-presentation-panel .section-title {
  padding: 12px 14px;
  color: #ecf7ff;
  background: #0b1b34;
  border-bottom: 1px solid #18314f;
}
.chief-presentation-panel .section-title span {
  color: #8da8c3;
}
.chief-presentation-panel iframe {
  display: block;
  width: 100%;
  height: min(82vh, 860px);
  min-height: 640px;
  border: 0;
  background: #071225;
}
@media (max-width: 760px) {
  .form-workflow-head,
  .complaint-intake-grid {
    grid-template-columns: 1fr;
  }
  .complaint-form-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .complaint-form-footer .primary {
    width: 100%;
    min-width: 0;
  }
  .service-master-detail {
    grid-template-columns: 1fr;
  }
  .property-mobile-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
  }
  .property-mobile-toggle span {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 600;
  }
  .property-master:not(.mobile-open) .property-master-head,
  .property-master:not(.mobile-open) .property-master-scroll {
    display: none;
  }
  .property-master.mobile-open .property-mobile-toggle {
    margin-bottom: 8px;
  }
  .service-master {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .service-master-scroll {
    display: flex;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .service-master-item {
    flex: 0 0 255px;
    border-right: 1px solid var(--line);
  }
  .service-detail {
    padding: 12px;
  }
  .service-timeline-content header,
  .visit-timeline-header {
    flex-direction: column;
  }
  .property-master-detail {
    grid-template-columns: 1fr;
  }
  .property-master {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .property-master-scroll {
    display: flex;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .property-master-item {
    flex: 0 0 250px;
    border-right: 1px solid var(--line);
  }
  .property-detail {
    padding: 12px;
  }
  .property-summary-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .order-action-grid {
    grid-template-columns: 1fr;
  }
  .topbar, .agent-card, .panel-head, .item header, .neighborhood-card > header, .block-card > header, .property-card > header { align-items: stretch; flex-direction: column; }
  .home-hero { grid-template-columns: 1fr; }
  .home-stat { border-left: 0; border-top: 1px solid var(--line); padding: 14px 0 0; }
  .home-hero-actions { grid-template-columns: 1fr 1fr; }
  .nav-strip { grid-template-columns: 1fr; }
  .app-back-button { width: 100%; }
  .tabs { display: flex; overflow-x: auto; padding-bottom: 4px; }
  .tab { min-width: 108px; }
  .metrics, .grid-2, .grid-3, .deposits, .button-row, .property-actions, .category-summary, .deposit-grid, .cascade-grid, .media-grid, .module-grid, .service-facts, .block-row, .rg-admin-grid, .report-summary-grid, .settings-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters, .cascade-actions, .period-tabs, .rg-tabs { flex-direction: column; }
  .filters input, .filters select { min-width: 0; }
  .rg-card > header { flex-direction: column; }
  .gps-row { grid-template-columns: 1fr; }
}
@media (min-width: 761px) and (max-width: 1040px) {
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .home-hero { grid-template-columns: 1fr 1fr; }
  .home-hero-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .block-row { grid-template-columns: 110px 110px 1fr; }
  .block-row strong, .block-row .folder-actions { grid-column: 1 / -1; }
  .report-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  .tabs, .topbar, button, #territorio, #dashboard, #servicos, #rg, #pes, .report-config, .report-clean-card, #reportSummary, .nested-panel, .report-preview-folder > summary { display: none !important; }
  .view, #relatorios, .field-bulletin { display: block !important; }
  .report-preview-folder { display: block !important; }
  body { background: #fff; }
  .panel { box-shadow: none; border: 0; padding: 0; }
  .shell { width: 100%; padding: 0; }
  .bulletin-page { border: 0; padding: 0; overflow: visible; }
  .bulletin-table {
    table-layout: fixed;
    page-break-inside: avoid;
  }
  .bulletin-table th,
  .bulletin-table td {
    height: 22px;
    line-height: 1.05;
  }
  .rg-page:last-child, .field-page:last-child, .lab-page:last-child { page-break-after: auto; }
}
