@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg: #F5F3EE;
  --surface: #FFFFFF;
  --border: #D8D3C8;
  --accent: #2D6A4F;
  --accent2: #52B788;
  --text: #1A1A18;
  --muted: #6B6860;
  --danger: #C0392B;
  --tag-bg: #E8F5EE;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { overscroll-behavior-x: none; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overscroll-behavior-x: none;
}

/* ── HEADER ── */
header {
  background: var(--accent);
  color: white;
  padding: 24px 40px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
header .header-title { min-width: 0; flex: 1 1 auto; }
header .logo { font-family: 'DM Serif Display', serif; font-size: 22px; letter-spacing: -0.5px; }
header .sub { font-size: 12px; opacity: 0.7; font-family: 'DM Mono', monospace; margin-top: 2px; }
header .badge {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  order: 2;
}
header .header-edit {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  transition: background .15s;
  order: 3;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
header .header-edit:hover { background: rgba(255,255,255,0.25); }

/* ── LAYOUT ── */
.container { max-width: 860px; margin: 0 auto; padding: 16px 24px 80px; }

/* ── STEPS (cards com icone tematico) ── */
.steps {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.step {
  flex: 1 1 0;
  min-width: 0;
  padding: 14px 6px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.step .icon {
  font-size: 22px;
  line-height: 1;
  filter: grayscale(0.6);
  opacity: 0.5;
  transition: all .2s;
}
.step .num {
  font-size: 9px;
  font-family: 'DM Mono', monospace;
  color: var(--muted);
  letter-spacing: 0.5px;
  transition: color .2s;
}
.step .lbl {
  font-size: 10.5px;
  font-family: 'DM Mono', monospace;
  color: var(--muted);
  transition: color .2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.step.done {
  background: var(--tag-bg);
  border-color: var(--accent2);
}
.step.done .icon { filter: none; opacity: 1; }
.step.done .num,
.step.done .lbl { color: var(--accent); }
.step.active {
  background: var(--accent);
  border-color: var(--accent);
}
.step.active .icon { filter: none; opacity: 1; transform: scale(1.1); }
.step.active .num,
.step.active .lbl { color: #fff; }
.step.active .lbl { font-weight: 600; }
@media (max-width: 600px) {
  .steps { gap: 4px; }
  .step { padding: 10px 4px 8px; }
  .step .icon { font-size: 18px; }
  .step .num { font-size: 8px; }
  .step .lbl { font-size: 9.5px; }
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 24px;
}
.card-title {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  margin-bottom: 24px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title .icon {
  width: 32px; height: 32px;
  background: var(--tag-bg);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}

/* ── FORM ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid.full { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span2 { grid-column: span 2; }

label {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input, select, textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--bg);
  transition: border-color .2s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent2);
  background: white;
}
textarea { resize: vertical; min-height: 90px; }

/* ── CHECKBOXES ── */
.check-group { display: grid; grid-template-columns: 1fr; gap: 7px; margin-top: 4px; }
.check-group.dois { grid-template-columns: repeat(2, 1fr); }
.check-item {
  display: flex; align-items: center; justify-content: flex-start; gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  white-space: normal;
  line-height: 1.3;
  transition: all .15s;
  user-select: none;
}
.check-item:hover { border-color: var(--accent2); }
.check-item.checked { background: var(--tag-bg); border-color: var(--accent); color: var(--accent); font-weight: 500; }
.check-item input { display: none; }

/* ── FOTOS ── */
.foto-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg);
}
.foto-zone:hover { border-color: var(--accent2); background: var(--tag-bg); }
.foto-zone .icon { font-size: 32px; margin-bottom: 10px; }
.foto-zone p { font-size: 13px; color: var(--muted); }
.foto-zone strong { color: var(--accent); }

.fotos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-top: 18px; }
.foto-card {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: white;
}
.foto-card img { width: 100%; height: 120px; object-fit: cover; display: block; }
.foto-card .foto-info { padding: 8px 10px; }
.foto-card .foto-info input {
  font-size: 11px; padding: 4px 8px;
  border-radius: 4px; margin-top: 4px;
}
.foto-card .remove-btn {
  display: block; width: 100%;
  background: #fee; color: var(--danger);
  border: none; border-top: 1px solid #fdd;
  padding: 5px; font-size: 11px;
  cursor: pointer; font-family: 'DM Mono', monospace;
}

/* ── BOTÕES ── */
.btn-row { display: flex; gap: 12px; margin-top: 32px; justify-content: flex-end; }
.btn {
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: 'DM Sans', sans-serif;
  transition: all .15s;
}
.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: var(--bg); }
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: #245c43; }
.btn-primary:disabled { background: #aaa; cursor: not-allowed; }
.btn-generate {
  background: var(--accent);
  color: white;
  padding: 16px 40px;
  font-size: 15px;
  border-radius: 10px;
  width: 100%;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.btn-generate:hover { background: #245c43; }

/* ── PREVIEW ── */
.preview-section { display: none; }
.preview-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(100%, 21cm);
  min-height: 29.7cm;
  padding: clamp(20px, 6vw, 1.5cm);
  box-sizing: border-box;
  margin: 0 auto;
  font-family: Arial, sans-serif;
  font-size: 11pt;
  line-height: 1.5;
  color: #000;
  overflow: hidden;
}
.preview-box h2 { text-align: center; font-size: 12pt; margin-bottom: 4px; }
.preview-box .subtitle { text-align: center; font-size: 9pt; margin-bottom: 4px; }
.preview-box .area-check { text-align: center; margin-bottom: 24px; font-size: 10pt; }
.preview-box h3 { font-size: 10pt; margin: 20px 0 8px; text-decoration: underline; }
.preview-box table { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 9.5pt; }
.preview-box table td, .preview-box table th {
  border: 1px solid #555;
  padding: 5px 8px;
  vertical-align: top;
  overflow-wrap: break-word;
}
.preview-box table th { background: #e0e0e0; font-weight: bold; text-align: center; }
.preview-box .foto-preview { text-align: center; margin: 18px 0; }
.preview-box .foto-original-link { display: inline-block; line-height: 0; color: inherit; text-decoration: none; }
.preview-box .foto-preview img { max-width: 100%; max-height: 11.5cm; height: auto; object-fit: contain; border: 1px solid #ccc; }
.preview-box .foto-legenda { font-size: 9pt; text-align: center; margin-top: 4px; }
.preview-box .assinatura { margin-top: 30px; text-align: center; }
.preview-box .pdf-check { white-space: nowrap; margin-right: 3px; }

/* ── MISC ── */
.section-panel { display: none; }
.section-panel.active { display: block; }
.info-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--tag-bg);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  margin-bottom: 20px;
}
.divider { height: 1px; background: var(--border); margin: 24px 0; }
.required { color: var(--danger); }

/* ── ARTIGOS ── */
.artigos-grupo { margin-bottom: 18px; }
.artigos-grupo-titulo {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 8px;
  padding-left: 2px;
}
.artigo-card {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
  background: var(--bg);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.artigo-card:hover { border-color: var(--accent2); background: white; }
.artigo-card.selected {
  border-color: var(--accent);
  background: var(--tag-bg);
}
.artigo-card.base {
  border-color: var(--accent2);
  background: #f0faf5;
  cursor: default;
  opacity: 0.9;
}
.artigo-check {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  transition: all .15s;
}
.artigo-card.selected .artigo-check,
.artigo-card.base .artigo-check {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.artigo-body { flex: 1; }
.artigo-ref {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: var(--tag-bg);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 5px;
}
.artigo-card.base .artigo-ref { background: rgba(82,183,136,0.2); }
/* Controle de camadas do Leaflet — visual mais limpo */
.leaflet-control-layers {
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
  background: #fff !important;
  font-family: 'DM Sans', sans-serif !important;
}
.leaflet-control-layers-expanded {
  padding: 10px 14px !important;
  min-width: 110px;
}
.leaflet-control-layers label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.leaflet-control-layers label:hover { color: var(--accent); }
.leaflet-control-layers input[type="radio"] {
  accent-color: var(--accent);
  width: 14px; height: 14px;
  cursor: pointer;
}
.leaflet-control-layers-separator { display: none !important; }

.norma-badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 600;
  color: #8a4a00;
  background: #fff4d6;
  border: 1px solid #e6c460;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  cursor: help;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.3px;
}
.norma-badge.warning {
  color: #9f1239;
  background: #fff1f2;
  border-color: #fda4af;
}
.artigo-titulo { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.artigo-texto {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
  max-height: 38px;
  overflow: hidden;
  transition: max-height .3s;
}
.artigo-card.expandido .artigo-texto { max-height: 300px; }
.artigo-expand {
  font-size: 10px;
  color: var(--accent2);
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  margin-top: 3px;
  display: inline-block;
}
.artigo-expand:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-group.span2 { grid-column: span 1; }
  .preview-box {
    width: 100%;
    min-height: 0;
    padding: 24px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .preview-box .tabela-caracterizacao {
    min-width: 680px;
  }
  header { padding: 14px 14px 12px; gap: 8px; }
  header .logo { font-size: 16px; line-height: 1.15; word-wrap: break-word; }
  header .sub { font-size: 10px; margin-top: 3px; }
  header .badge {
    order: 3;
    flex-basis: 100%;
    margin-left: 0;
    margin-top: 4px;
    text-align: center;
    padding: 7px 12px;
  }
  header .header-edit {
    order: 2;
    margin-left: auto;
    align-self: flex-start;
    padding: 5px 10px;
    font-size: 10.5px;
  }
  .card { padding: 20px; }
}

/* Telas bem estreitas (Galaxy S antigo, iPhone SE 1ª gen): so o icone */
@media (max-width: 380px) {
  header { padding: 12px 12px 10px; gap: 6px; }
  header .logo { font-size: 14.5px; }
  header .sub { font-size: 9.5px; }
  header .header-edit {
    padding: 6px 9px;
    font-size: 13px;
    gap: 0;
  }
  header .header-edit .edit-label { display: none; }
}

/* ── BARRA DE AÇÕES (2 linhas) ── */
.action-bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0 0 8px;
}
.action-row {
  display: flex;
  gap: 5px;
}
.action-chip {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 8px 4px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}
.action-chip:hover { background: var(--tag-bg); border-color: var(--accent2); }
.action-chip.soft  { background: var(--tag-bg); border-color: #c8e0d0; color: var(--accent); }
.action-chip.soft:hover { background: #d5eddf; }
.action-chip.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.action-chip.primary:hover { background: #245c43; }
.action-chip.install-chip {
  background: #f7fbf3;
  border-color: #b8d49d;
  color: #275c35;
}
.action-chip.install-chip:hover { background: #e8f4dd; border-color: #8fbd69; }
.action-chip[hidden] { display: none; }
.hist-badge {
  background: var(--accent);
  color: #fff;
  font-family: 'DM Mono', monospace;
  font-size: 8px;
  border-radius: 99px;
  padding: 1px 5px;
  margin-left: 2px;
}

/* ── MODAL HISTÓRICO ── */
#modal-historico .modal-box { max-width: 560px; }
.historico-lista { max-height: 60vh; overflow-y: auto; margin: 0 -8px; }
.historico-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  background: #fafaf7;
  transition: border-color .15s, background .15s;
}
.historico-item:hover { border-color: var(--accent2); background: var(--tag-bg); }
.historico-info { flex: 1; min-width: 0; }
.historico-info .h-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.historico-info .h-meta {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: var(--muted);
}
.historico-actions { display: flex; gap: 6px; flex-shrink: 0; }
.historico-actions button {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  transition: all .15s;
}
.historico-actions button.open { color: var(--accent); }
.historico-actions button.open:hover { background: var(--tag-bg); border-color: var(--accent2); }
.historico-actions button.del { color: var(--danger); }
.historico-actions button.del:hover { background: #ffeaea; border-color: var(--danger); }
.historico-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 13px;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,26,24,0.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }

/* ── EDITOR DE ANOTAÇÕES ── */
#editor-modal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.88);
  display: flex; flex-direction: column;
}
#editor-modal.hidden { display: none; }
.editor-toolbar {
  background: #fff;
  padding: 10px 14px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}
.editor-toolbar button {
  padding: 8px 14px; border-radius: 6px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 13px; font-family: 'DM Sans', sans-serif;
}
.editor-toolbar button:hover { background: #f0efeb; }
.editor-toolbar button.active { background: var(--accent); color: white; border-color: var(--accent); }
.editor-toolbar .sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.editor-toolbar input[type="color"] { width: 36px; height: 32px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; padding: 2px; }
.editor-toolbar select { padding: 7px 10px; border-radius: 6px; border: 1px solid var(--border); font-family: 'DM Sans', sans-serif; }
/* Dropdowns compactos via <details> nativo */
.editor-dropdown { position: relative; }
.editor-dropdown summary {
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.editor-dropdown summary::-webkit-details-marker { display: none; }
.editor-dropdown summary::marker { content: ''; }
.editor-trigger {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 8px 5px 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  height: 32px;
  box-sizing: border-box;
}
.editor-trigger:hover { background: #f0efeb; }
.editor-dropdown[open] .editor-trigger { background: var(--tag-bg); border-color: var(--accent2); }
.editor-trigger .trigger-swatch {
  width: 20px; height: 20px; border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.15);
  display: inline-block;
}
.editor-trigger .trigger-line {
  width: 20px; height: 4px; border-radius: 999px;
  background: #FF0000;
  display: inline-block;
  transition: height .15s;
}
.editor-trigger .trigger-arrow {
  font-size: 9px; color: #888; line-height: 1;
}
.editor-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
  z-index: 50;
  min-width: 200px;
  max-width: calc(100vw - 20px);
}
.popover-title {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.popover-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.esp-options { display: flex; flex-direction: column; gap: 4px; }
.esp-options button {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 6px;
  font-size: 12px; font-family: 'DM Sans', sans-serif;
  cursor: pointer; text-align: left;
}
.esp-options button:hover { background: #f0efeb; }
.esp-options button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.esp-options button.active .esp-line { background: #fff; }
.esp-options .esp-line { display: inline-block; width: 36px; background: #333; border-radius: 999px; flex-shrink: 0; }
.editor-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.editor-swatch {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.editor-swatch:hover { transform: scale(1.06); border-color: var(--accent2); }
.editor-swatch.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), inset 0 0 0 2px #fff;
}
.editor-swatch[data-color="#FFFFFF"] { border-color: #ccc; }
#editor-canvas-wrap {
  flex: 1; display: flex;
  overflow: auto; padding: 20px;
}
#editor-canvas-wrap .canvas-container { flex: 0 0 auto; margin: auto; }
#editor-canvas { box-shadow: 0 0 20px rgba(0,0,0,0.4); background: #fff; }
.editor-help { font-size: 12px; color: #666; padding: 0 14px 8px; background: #fff; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 460px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
  animation: modalIn .22s ease;
  overflow: hidden;
}
@keyframes modalIn {
  from { opacity:0; transform: translateY(12px) scale(.97); }
  to   { opacity:1; transform: translateY(0)   scale(1);    }
}
.modal-head {
  background: var(--accent);
  color: white;
  padding: 24px 28px 20px;
  position: relative;
  overflow: hidden;
}
.modal-head::after {
  content: "🌳";
  position: absolute;
  font-size: 120px;
  right: -20px;
  top: -30px;
  opacity: 0.12;
  pointer-events: none;
  line-height: 1;
}
.modal-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 19px;
  line-height: 1.1;
  margin-bottom: 4px;
  position: relative;
}
.modal-subtitle {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  opacity: 0.8;
  position: relative;
}
.modal-body {
  padding: 24px 28px 24px;
}
.modal-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 16px;
  font-family: 'DM Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.modal-form-group {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 16px;
}
.modal-form-group label {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.modal-form-group input,
.modal-form-group select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--bg);
  transition: border-color .2s;
  width: 100%;
}
.modal-form-group input:focus,
.modal-form-group select:focus {
  outline: none;
  border-color: var(--accent2);
  background: white;
}
.modal-btn {
  width: 100%;
  margin-top: 8px;
  padding: 13px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background .15s;
}
.modal-btn:hover { background: #245c43; }
.modal-btn:disabled { background: #aaa; cursor: not-allowed; }
.modal-error {
  font-size: 11px;
  color: var(--danger);
  font-family: 'DM Mono', monospace;
  margin-top: -10px;
  margin-bottom: 8px;
  display: none;
}
.modal-message {
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 18px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.modal-actions .modal-btn { margin-top: 0; flex: 1; }
.modal-btn.secondary {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
}
.modal-btn.secondary:hover { background: var(--tag-bg); }
.modal-btn.danger { background: var(--danger); }
.modal-btn.danger:hover { background: #b3261e; }

/* Seletor de árvores (abas) — passos 02/03/04 */
.arv-seletor { margin-bottom: 12px; }
.arv-seletor:empty { display: none; }
.arv-seletor .arv-rotulo { font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: .03em; margin-bottom: 6px; }
.arv-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.arv-chip { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 10px;
  flex: 0 0 calc(33.33% - 5px);
  border: 1px solid var(--border); background: var(--surface); border-radius: 22px;
  font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; overflow: hidden; }
.arv-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.arv-chip:hover { border-color: var(--accent); }
.arv-chip.ativo { background: var(--accent); color: #fff; border-color: var(--accent); }
.arv-chip .arv-x { font-weight: 700; opacity: .65; font-size: 15px; padding: 0 1px; }
.arv-chip .arv-x:hover { opacity: 1; }

/* ���─ ESPÉCIE: TRIGGER NO FORMULÁRIO ── */
.esp-trigger-btn {
  display: inline-flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 14px;
  background: #f0fdf4; border: 1.5px solid #d1fae5; border-radius: 10px;
  color: var(--accent); font-size: .88rem; font-weight: 600;
  cursor: pointer; text-align: left; transition: background .15s, border-color .15s;
}
.esp-trigger-btn:hover { background: #dcfce7; border-color: var(--accent); }
.esp-trigger-btn .esp-trigger-arrow { margin-left: auto; font-size: 1rem; }

.esp-confirmed-strip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: #d1fae5; border-radius: 10px;
  animation: esp-popin .25s cubic-bezier(.16,1,.3,1);
}
@keyframes esp-popin { from{opacity:0;transform:scale(.96)} to{opacity:1;transform:none} }
.esp-confirmed-nome { flex:1; }
.esp-confirmed-nome strong { display:block; font-size:.88rem; color:#065f46; }
.esp-confirmed-nome span   { font-size:.75rem; color:#047857; font-style:italic; }
.esp-btn-alterar {
  background: none; border: 1px solid #6ee7b7; color: #047857;
  font-size: .72rem; padding: 3px 9px; border-radius: 6px;
  cursor: pointer; white-space: nowrap; transition: background .15s;
}
.esp-btn-alterar:hover { background: #a7f3d0; }

/* ── MODAL POPUP ── */
.esp-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 500; display: flex; align-items: flex-end; justify-content: center;
  padding: 0; animation: esp-fade-in .2s ease;
}
@keyframes esp-fade-in { from{opacity:0} to{opacity:1} }

.esp-modal-panel {
  background: #fff; border-radius: 20px 20px 0 0;
  width: 100%; max-width: 540px; max-height: 92vh;
  overflow-y: auto; padding: 0 20px 32px;
  animation: esp-slide-up .3s cubic-bezier(.16,1,.3,1);
  padding-bottom: max(32px, env(safe-area-inset-bottom));
}
@keyframes esp-slide-up { from{transform:translateY(100%)} to{transform:none} }

.esp-modal-drag {
  width: 40px; height: 4px; background: #d1d5db;
  border-radius: 99px; margin: 12px auto 18px;
}
.esp-modal-topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 4px;
}
.esp-modal-titulo { font-size: 1.2rem; font-weight: 800; color: #111827; }
.esp-modal-fechar {
  background: #f3f4f6; border: none; width: 32px; height: 32px;
  border-radius: 50%; font-size: 1rem; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #6b7280; transition: background .15s;
}
.esp-modal-fechar:hover { background: #e5e7eb; }
.esp-modal-cientifico {
  font-style: italic; font-size: .85rem; color: #6b7280; margin-bottom: 16px;
}

/* galeria dentro do modal */
.esp-modal-galeria {
  display: grid; grid-template-columns: 1fr 2fr 1fr;
  gap: 8px; align-items: center;
}
.esp-modal-thumb {
  border-radius: 10px; overflow: hidden;
  background: #e5e7eb; position: relative;
  border: 2px solid transparent; cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.esp-modal-thumb:hover { border-color: var(--accent); transform: translateY(-2px); }
.esp-modal-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.esp-modal-thumb.main { aspect-ratio: 3/4; }
.esp-modal-thumb.side { aspect-ratio: 1; }
.esp-modal-thumb-label {
  position:absolute; bottom:5px; right:5px;
  background:rgba(0,0,0,.55); color:#fff;
  font-size:.60rem; padding:2px 5px; border-radius:4px;
  opacity:0; transition:opacity .12s; pointer-events:none;
}
.esp-modal-thumb:hover .esp-modal-thumb-label { opacity:1; }
.esp-modal-placeholder {
  display:flex; align-items:center; justify-content:center;
  font-size:2rem; background:#f3f4f6; width:100%; height:100%; min-height:60px;
}
.esp-modal-skeleton {
  border-radius:10px;
  background:linear-gradient(90deg,#e5e7eb 25%,#f3f4f6 50%,#e5e7eb 75%);
  background-size:200% 100%; animation:esp-shimmer 1.2s infinite;
}
.esp-modal-skeleton.main { aspect-ratio:3/4; }
.esp-modal-skeleton.side { aspect-ratio:1; }
@keyframes esp-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

.esp-modal-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px;
}
.esp-modal-badge {
  display:inline-block; padding:3px 10px; border-radius:99px;
  font-size:.72rem; font-weight:700;
}
.esp-modal-badge.nativa    { background:#d1fae5; color:#065f46; }
.esp-modal-badge.exotica   { background:#fee2e2; color:#991b1b; }
.esp-modal-badge.mata      { background:#dbeafe; color:#1e40af; }
.esp-modal-badge.natural   { background:#fef3c7; color:#92400e; }
.esp-modal-inat {
  display:inline-flex; align-items:center; gap:5px;
  font-size:.75rem; font-weight:600; color:var(--accent);
  text-decoration:none; padding:4px 10px;
  border:1.5px solid #d1fae5; border-radius:8px;
  transition:background .15s, border-color .15s;
}
.esp-modal-inat:hover { background:#f0fdf4; border-color:var(--accent); }

.esp-modal-confirmar {
  width:100%; margin-top:16px;
  padding:13px; background:var(--accent); color:#fff;
  border:none; border-radius:10px; font-size:.95rem; font-weight:700;
  cursor:pointer; transition:background .15s, transform .1s;
}
.esp-modal-confirmar:hover { background:#1f5c3a; }
.esp-modal-confirmar:active { transform:scale(.98); }

/* ── LIGHTBOX ── */
.esp-lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.88);
  z-index: 600; display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: esp-fade-in .15s ease;
}
.esp-lightbox-overlay img {
  max-width: 100%; max-height: 90vh;
  border-radius: 10px; object-fit: contain;
  box-shadow: 0 8px 48px rgba(0,0,0,.6);
}
.esp-lightbox-fechar {
  position:absolute; top:16px; right:16px;
  background:rgba(255,255,255,.15); border:none;
  color:#fff; width:40px; height:40px; border-radius:50%;
  font-size:1.2rem; cursor:pointer; display:flex;
  align-items:center; justify-content:center;
  transition:background .15s;
}
.esp-lightbox-fechar:hover { background:rgba(255,255,255,.28); }

/* ── FAB SUGESTÕES + POP CARD ── */
.feedback-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 899;
}
.feedback-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.feedback-wrap {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 900;
}

.fab-feedback {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  border: none;
  box-shadow: 0 4px 16px rgba(45,106,79,.35);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.fab-feedback:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(45,106,79,.45);
}
.fab-feedback:active { transform: scale(.95); }

.feedback-pop {
  position: fixed;
  top: 72px;
  left: 50%;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 48px rgba(0,0,0,.28);
  overflow: hidden;
  transform: translateX(-50%) scale(.92);
  opacity: 0;
  pointer-events: none;
  transition: transform .22s cubic-bezier(.34,1.3,.64,1), opacity .18s ease;
  z-index: 901;
}
.feedback-pop.open {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: all;
}
.feedback-pop-accent { display: none; }
.feedback-pop-head {
  padding: 14px 16px 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  background: var(--accent);
}
.feedback-pop-head strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.feedback-pop-head span {
  font-size: 11px;
  color: rgba(255,255,255,.75);
  margin-top: 2px;
  display: block;
}
.feedback-pop-close {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 5px;
  line-height: 1;
  flex-shrink: 0;
  transition: background .12s;
}
.feedback-pop-close:hover { background: rgba(255,255,255,.28); }
.feedback-pop-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feedback-pop-body textarea,
.feedback-pop-body input[type="text"] {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  box-sizing: border-box;
  transition: border-color .15s;
  outline: none;
}
.feedback-pop-body textarea {
  resize: none;
  height: 76px;
  line-height: 1.45;
}
.feedback-pop-body textarea:focus,
.feedback-pop-body input[type="text"]:focus { border-color: var(--accent); }
#feedback-status { min-height: 16px; font-size: 12px; }
.feedback-pop-footer {
  padding: 0 14px 14px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}
.feedback-pop-cancel {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 7px;
  transition: background .12s;
}
.feedback-pop-cancel:hover { background: var(--bg); }
.feedback-pop-submit {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.feedback-pop-submit:hover { background: #1f5c3a; }
.feedback-pop-submit:disabled { opacity: .6; cursor: default; }

/* botão fechar no cabeçalho dos modais */
.modal-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: background .1s, color .1s;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.arv-chip.add { border-style: dashed; color: var(--accent); font-weight: 600; }

/* ===== DASHBOARD DRAWER ===== */

.dash-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(15,28,22,.45);
}
.dash-overlay.show { display: block; }

.dash-drawer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 151;
  max-height: 96dvh;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,.72,0,1);
  overflow: hidden;
}
.dash-drawer.open { transform: translateY(0); }

.dash-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 9px;
  margin: 8px auto 0;
  flex-shrink: 0;
}

.dash-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dash-titulo { font: 15px 'DM Serif Display', serif; color: var(--accent); }
.dash-sub    { font: 10px 'DM Mono', monospace; color: var(--muted); margin-top: 2px; }

.dash-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  -webkit-overflow-scrolling: touch;
}

/* Hero */
.dash-hero { margin-bottom: 14px; }
.dash-hero-nome { font: 20px/1.1 'DM Serif Display', serif; color: var(--accent); letter-spacing: -.4px; }
.dash-hero-sub  { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* Stats */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.dash-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px 9px;
  box-shadow: 0 1px 4px rgba(30,42,35,.06);
  position: relative; overflow: hidden;
}
.dash-stat-wide { grid-column: span 2; }
.dash-stat-lbl  { font: 8px 'DM Mono',monospace; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.dash-stat-val  { font: 24px/1 'DM Serif Display',serif; color: var(--accent); margin-top: 4px; }
.dash-stat-val.warn { color: #b36d16; }
.dash-stat-sub  { font-size: 9.5px; color: var(--muted); margin-top: 3px; }

/* Draft alert */
.dash-draft-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff5df;
  border: 1px solid #edc97a;
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 11px;
  color: #6b4d10;
  line-height: 1.45;
}

/* Panel */
.dash-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(30,42,35,.06);
  margin-bottom: 12px;
  overflow: hidden;
}
.dash-panel-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.dash-panel-title { font: 16px 'DM Serif Display',serif; color: var(--accent); flex: 1; }
.dash-count-badge {
  background: var(--tag-bg); color: var(--accent);
  font: 9px 'DM Mono',monospace;
  padding: 2px 7px; border-radius: 99px;
}
.dash-panel-body { padding: 12px; display: flex; flex-direction: column; gap: 12px; }

/* Gráficos */
.dash-grafico-bloco { display: flex; flex-direction: column; gap: 5px; }
.dash-grafico-titulo { font: 8.5px 'DM Mono',monospace; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; }
.dash-grafico-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dash-g-row  { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.dash-g-row:last-child { margin-bottom: 0; }
.dash-g-lbl  { font-size: 11px; color: var(--text); width: 88px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-g-lbl-sm { width: 62px; font-size: 10.5px; }
.dash-g-bar-wrap { flex: 1; height: 6px; background: #eeeae3; border-radius: 9px; overflow: hidden; }
.dash-g-bar  { height: 100%; border-radius: 9px; transition: width .5s ease; }
.dash-g-val  { font: 10px 'DM Mono',monospace; color: var(--muted); text-align: right; min-width: 22px; flex-shrink: 0; }
.dash-g-empty { font-size: 11px; color: var(--muted); padding: 4px 0; }

/* Panorama geral — divider C */
.dash-divider { border: none; border-top: 1.5px solid var(--accent2); opacity: .25; margin: 0; }

/* Espécies — meta (N espécies · N árv.) */
.dash-g-esp-meta { font: 8px 'DM Mono',monospace; color: var(--muted); opacity: .7; text-transform: none; letter-spacing: 0; }

/* Espécies — barras proporcionais sem trilho */
.dash-esp-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.dash-esp-row:last-child { margin-bottom: 0; }
.dash-esp-lbl { font-size: 11px; color: var(--text); width: 96px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-esp-track { flex: 1; height: 5px; position: relative; }
.dash-esp-track::after { content:''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px; background: var(--border); }
.dash-esp-fill { height: 5px; border-radius: 3px; background: var(--accent); position: relative; z-index: 1; transition: width .5s ease; }
.dash-esp-pct { font: 10px 'DM Mono',monospace; color: var(--muted); text-align: right; min-width: 28px; flex-shrink: 0; }
.dash-esp-sep { border: none; border-top: 1px dashed var(--border); margin: 6px 0 5px; display: none; }
.dash-esp-sep.visible { display: block; }
.dash-esp-extra { display: none; }
.dash-esp-extra.visible { display: flex; }
.dash-esp-toggle { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; font: 11px 'DM Sans',system-ui,sans-serif; color: var(--accent); background: none; border: none; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--accent2); }
.dash-esp-toggle:hover { color: var(--accent2); }
.dash-esp-badge { font: 9px 'DM Mono',monospace; background: var(--tag-bg); color: var(--accent); border-radius: 99px; padding: 1px 6px; text-decoration: none; }

/* Mini stat — Origem / Intervenção */
.mini-stat-row { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-stat { flex: 1; min-width: calc(50% - 3px); background: #f8f6f2; border-radius: 7px; padding: 7px 8px; display: flex; flex-direction: column; gap: 2px; }
.mini-stat-val { font-family: 'DM Serif Display',Georgia,serif; font-size: 20px; line-height: 1; }
.mini-stat-lbl { font: 8px 'DM Mono',monospace; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; }
.mini-stat-bar { height: 3px; border-radius: 99px; margin-top: 4px; opacity: .5; }

/* Sparkline */
.dash-sparkline { display: flex; align-items: flex-end; gap: 4px; height: 52px; margin-top: 4px; }
.dash-spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.dash-spark-bar { width: 100%; background: var(--tag-bg); border-radius: 3px 3px 0 0; min-height: 3px; }
.dash-spark-bar.current { background: var(--accent2); }
.dash-spark-lbl { font: 7px 'DM Mono',monospace; color: var(--muted); }
.dash-spark-num { font: 8px 'DM Mono',monospace; color: var(--muted); }

/* Status badges */
.dash-sbadge { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 3px 7px; font: 8.5px 'DM Mono',monospace; white-space: nowrap; flex-shrink: 0; }
.dash-sbadge::before { content: ""; width: 4px; height: 4px; border-radius: 50%; flex-shrink: 0; }
.s-rascunho    { background: #fff5df; color: #b36d16; }
.s-rascunho::before { background: #b36d16; }
.s-concluido   { background: var(--tag-bg); color: var(--accent); }
.s-concluido::before { background: var(--accent2); }
.s-protocolado { background: #edf5f8; color: #38617a; }
.s-protocolado::before { background: #38617a; }
.s-arquivado   { background: #f0efec; color: #67665f; }
.s-arquivado::before { background: #b0afa9; }
.s-aceito      { background: #eaf5ed; color: #1a5c2a; font-weight: 600; }
.s-aceito::before { background: #1a5c2a; }

/* Toolbar busca/filtro */
.dash-toolbar { padding: 10px 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.dash-search { width: 100%; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); padding: 8px 12px; color: var(--text); font-size: 12px; outline: 0; font-family: inherit; }
.dash-search:focus { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(82,183,136,.13); }
.dash-filter-row { display: flex; gap: 6px; }
.dash-fchip { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); padding: 5px 10px; font-size: 11px; color: var(--muted); font-weight: 500; }
.dash-fchip select { border: 0; background: transparent; color: inherit; font-size: 11px; padding: 0; outline: 0; appearance: none; font-family: inherit; font-weight: 500; cursor: pointer; }

/* Lista accordion */
.dash-laudos-list { display: flex; flex-direction: column; padding: 10px 12px 6px; gap: 0; }
.laudo-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 8px; transition: box-shadow .15s; }
.laudo-card:last-child { margin-bottom: 0; }
.laudo-card.expanded { box-shadow: 0 4px 16px rgba(45,106,79,.10); border-color: var(--accent2); }
.laudo-head { display: flex; align-items: center; gap: 10px; padding: 11px 12px; cursor: pointer; background: var(--surface); user-select: none; -webkit-tap-highlight-color: transparent; }
.laudo-head:active { background: #faf9f7; }
.laudo-info { flex: 1; min-width: 0; }
.laudo-num  { font: 10.5px 'DM Mono',monospace; color: var(--accent); }
.laudo-name { font-size: 12.5px; font-weight: 500; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.laudo-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.laudo-meta span { font-size: 10.5px; color: var(--muted); }
.laudo-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.chevron { font-size: 10px; color: var(--muted); transition: transform .2s; }
.laudo-card.expanded .chevron { transform: rotate(180deg); }
.laudo-body { display: none; border-top: 1px solid var(--border); background: #fafaf8; }
.laudo-card.expanded .laudo-body { display: block; }

/* Árvores no card */
.arvores-section { padding: 10px 12px 8px; }
.arvores-label { font: 8.5px 'DM Mono',monospace; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 7px; }
.arvore-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 5px; }
.arvore-row:last-of-type { margin-bottom: 0; }
.arvore-ic { font-size: 14px; flex-shrink: 0; }
.arvore-info { flex: 1; min-width: 0; }
.arvore-nome { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arvore-especie { font-size: 10.5px; color: var(--muted); font-style: italic; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arvore-tags { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.arvore-tag  { font: 9px 'DM Mono',monospace; border-radius: 99px; padding: 2px 7px; flex-shrink: 0; white-space: nowrap; }
.tag-poda    { background: #e8f5ee; color: var(--accent); }
.tag-remocao { background: #fde8e8; color: #b3261e; }
.tag-mata    { background: #e8f5ee; color: #1a5c3a; }
.tag-nativa  { background: #d6ede0; color: #2D6A4F; }
.tag-exotica { background: #fde8e8; color: #8b2020; }
.tag-naturalizada { background: #fff3cc; color: #7a5500; }

/* Ações no card expandido */
.laudo-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 12px 10px; border-top: 1px dashed var(--border); }
.dash-btn-sm { display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 11px; font-weight: 500; cursor: pointer; font-family: inherit; }
.dash-btn-sm.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.dash-btn-sm.danger  { color: #c0392b; background: #fff8f7; border-color: #f1cbc5; }
.dash-btn-sm-proto   { background: #edf5f8 !important; color: #38617a !important; border-color: #c8dde6 !important; }
.dash-btn-sm-aceito  { background: #eaf5ed !important; color: #1a5c2a !important; border-color: #b8dfc0 !important; }

/* Status track no card */
.status-track   { padding: 11px 12px 6px; }
.track-steps    { display: flex; align-items: center; }
.track-step     { display: flex; align-items: center; flex: 1; }
.track-step:last-child { flex: 0; }
.track-dot      { width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 7px; flex-shrink: 0; transition: all .2s; color: transparent; }
.track-dot.done   { background: var(--accent2); border-color: var(--accent2); color: white; }
.track-dot.active { background: var(--accent);  border-color: var(--accent);  color: white; }
.track-line     { flex: 1; height: 2px; background: var(--border); margin: 0 1px; }
.track-line.done { background: var(--accent2); }
.track-labels   { display: flex; justify-content: space-between; margin-top: 4px; }
.track-lbl      { font-size: 8.5px; font-family: 'DM Mono', monospace; color: var(--muted); }
.track-lbl.active { color: var(--accent);  font-weight: 600; }
.track-lbl.done   { color: var(--accent2); }

/* Metadados de status no card */
.status-meta    { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 4px 12px 8px; }
.smeta-row      { font-size: 11px; color: var(--muted); }
.smeta-row strong { color: var(--text); font-weight: 500; }

/* Modais do dashboard */
.dash-modal-ov  { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1100; opacity: 0; pointer-events: none; transition: opacity .18s; }
.dash-modal-ov.show { opacity: 1; pointer-events: auto; }
.dash-modal     { background: var(--surface); border-radius: 14px; width: 100%; max-width: 340px; padding: 22px 20px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.25); transform: translateY(12px); transition: transform .2s; }
.dash-modal-ov.show .dash-modal { transform: translateY(0); }
.dash-modal-ic  { font-size: 26px; margin-bottom: 8px; }
.dash-modal-ttl { font-family: 'DM Serif Display', serif; font-size: 17px; margin-bottom: 3px; }
.dash-modal-sub { font-size: 12px; color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
.dash-modal-fld { margin-bottom: 12px; }
.dash-modal-fld label { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.dash-modal-fld input { width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 7px; font: 13px 'DM Sans',sans-serif; color: var(--text); background: var(--bg); outline: none; font-family: inherit; }
.dash-modal-fld input:focus { border-color: var(--accent); }
.dash-modal-acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.dash-modal-btn  { padding: 8px 14px; border-radius: 7px; border: 1.5px solid var(--border); font: 500 12.5px 'DM Sans',sans-serif; cursor: pointer; font-family: inherit; }
.dash-modal-btn.blue  { background: #38617a; color: white; border-color: #38617a; }
.dash-modal-btn.green { background: #1a5c2a; color: white; border-color: #1a5c2a; }
.dash-modal-btn.ghost { background: transparent; color: var(--muted); }

/* Empty state e paginação */
.dash-empty    { padding: 28px 20px; text-align: center; color: var(--muted); }
.dash-empty-ic { font-size: 24px; margin-bottom: 8px; }
.dash-empty p  { font-size: 12px; line-height: 1.5; }
.dash-pagination { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; border-top: 1px solid var(--border); font: 9px 'DM Mono',monospace; color: var(--muted); }
.dash-pag-btns { display: flex; gap: 3px; }
.dash-pag-btns button { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 10px; cursor: pointer; }
.dash-pag-btns button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.dash-pag-btns button:disabled { opacity: .35; cursor: default; }

/* Nota de privacidade */
.dash-privacy { font-size: 10px; color: var(--muted); text-align: center; padding: 8px 4px 4px; line-height: 1.5; }

/* ===== MODAL PRIVACIDADE / LGPD ===== */
#modal-privacidade .modal-box {
  max-width: 680px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 40px);
}
#modal-privacidade .modal-head { flex: 0 0 auto; }
#modal-privacidade .priv-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#modal-privacidade .modal-close {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  color: rgba(255,255,255,.85);
}
#modal-privacidade .modal-close:hover { background: rgba(255,255,255,.18); color: #fff; }

.priv-callout {
  background: #EAF1F7; border: 1px solid #cdddec; border-radius: 8px;
  padding: 12px 14px; font-size: 13px; color: #34546f; line-height: 1.55;
  margin-bottom: 20px;
}
.priv-sec { margin-bottom: 20px; }
.priv-sec h3 {
  font-size: 14px; color: var(--accent); margin: 0 0 8px;
  display: flex; align-items: center; gap: 8px;
}
.priv-sec p { font-size: 13.5px; color: var(--text); line-height: 1.6; margin: 0 0 8px; }
.priv-sec ul { margin: 0 0 8px; padding-left: 20px; }
.priv-sec li { font-size: 13.5px; color: var(--text); line-height: 1.55; margin-bottom: 5px; }
.priv-note { font-size: 12px; color: var(--muted); font-style: italic; }

.priv-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0 8px; }
.priv-table th, .priv-table td {
  border: 1px solid var(--border); padding: 6px 8px;
  text-align: left; vertical-align: top;
}
.priv-table th { background: var(--tag-bg); color: var(--accent); font-weight: 600; }

.priv-meta {
  font-size: 11px; color: var(--muted); font-family: 'DM Mono', monospace;
  border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; line-height: 1.6;
}

/* link de texto reutilizável (aviso) */
.priv-link {
  background: none; border: none; color: var(--accent);
  text-decoration: underline; cursor: pointer;
  font-size: 12px; font-family: inherit; padding: 0;
}

/* rodapé do app */
.app-foot {
  text-align: center; padding: 22px 0 10px;
  font-size: 12px; color: var(--muted); font-family: 'DM Mono', monospace;
}
.app-foot button {
  background: none; border: none; color: var(--accent); cursor: pointer;
  font-size: 12px; font-family: inherit; text-decoration: underline; padding: 2px 6px;
}
.app-foot span { opacity: .8; }

/* ===== GATE DE PRIMEIRO USO (termo + privacidade) ===== */
.gate-docs { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 18px; }
.gate-doc {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; font-family: inherit;
  transition: border-color .15s, background .15s;
}
.gate-doc:hover { border-color: var(--accent2); background: var(--tag-bg); }
.gate-doc-ic { font-size: 22px; line-height: 1; flex: 0 0 auto; }
.gate-doc-txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.gate-doc-txt strong { font-size: 14px; color: var(--text); }
.gate-doc-txt small { font-size: 12px; color: var(--muted); }
.gate-doc-state {
  flex: 0 0 auto; font-size: 12px; font-weight: 600;
  color: var(--accent); white-space: nowrap;
}
.gate-doc.lido { border-color: var(--accent); background: var(--tag-bg); }

.gate-aceite {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 14px; line-height: 1.5; color: var(--text);
  font-family: inherit; text-transform: none;
  cursor: pointer; margin: 0 0 4px;
}
.gate-aceite input { margin-top: 2px; flex: 0 0 auto; width: 17px; height: 17px; cursor: pointer; }
.gate-aceite input:disabled { cursor: not-allowed; }
.gate-hint { font-size: 12px; color: var(--muted); margin: 4px 0 0 27px; }
.gate-hint.hidden { display: none; }

/* modal com o texto completo do termo (mesmo layout do de privacidade) */
#modal-termo-texto .modal-box { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
#modal-termo-texto .modal-head { flex: 0 0 auto; position: relative; }
#modal-termo-texto .priv-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
#modal-termo-texto .modal-close { position: absolute; top: 16px; right: 16px; z-index: 2; }
