/* =============================================================================
   style.css — Arboris · Inventário Arbóreo
   Identidade: escudo + árvore, verde #3ddc84 sobre fundo #0d1117
   Fonte wordmark: Rajdhani (Google Fonts)
   Organização:
     1.  Design Tokens
     2.  Reset & Base
     3.  Layout
     4.  Dashboard
     5.  Survey Shell
     6.  Form Components
     7.  Tree List
     8.  Export Page
     9.  Modals
    10.  Toast & Loading
    11.  Empty States
    12.  Scrollbar
============================================================================= */

/* ── 1. DESIGN TOKENS ─────────────────────────────────────────────────────── */
:root {
  /* Verde Arboris — extraído do logotipo */
  --brand:      #3ddc84;
  --brand-dim:  #2bb36a;
  --brand-glow: rgba(61,220,132,.18);
  --brand-bg:   rgba(61,220,132,.08);

  /* Fundos — escala de escuros */
  --bg-base:    #0d1117;   /* fundo da tela */
  --bg-surface: #161b22;   /* cards, modais */
  --bg-raised:  #1c2128;   /* inputs, toolbar */
  --bg-overlay: #21262d;   /* hover de itens */

  /* Bordas */
  --border:     #30363d;
  --border-dim: #21262d;

  /* Texto */
  --text-1: #e6edf3;   /* primário */
  --text-2: #8b949e;   /* secundário */
  --text-3: #484f58;   /* desabilitado */

  /* Semânticas */
  --red:      #f85149; --red-bg:   rgba(248,81,73,.12);
  --amber:    #e3b341; --amber-bg: rgba(227,179,65,.12);
  --blue:     #58a6ff; --blue-bg:  rgba(88,166,255,.12);
  --ok:       #3ddc84; --ok-bg:    rgba(61,220,132,.12);

  /* Forma */
  --r-xs: 4px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px;

  /* Sombras */
  --sh-sm: 0 1px 3px rgba(0,0,0,.4), 0 1px 8px rgba(0,0,0,.3);
  --sh-md: 0 4px 16px rgba(0,0,0,.5);
  --sh-lg: 0 8px 32px rgba(0,0,0,.6);
  --sh-brand: 0 4px 20px rgba(61,220,132,.25);

  /* Gradientes */
  --grad-header: linear-gradient(180deg, #161b22 0%, #0d1117 100%);

  /* Tipografia */
  --font-brand: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  --font:       'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono:       'Fira Mono', 'Consolas', monospace;

  --t: 180ms ease;
}

/* ── 2. RESET & BASE ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-1);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── 3. LAYOUT ────────────────────────────────────────────────────────────── */
.screen {
  display: none; flex-direction: column;
  height: 100dvh; max-width: 430px; margin: 0 auto;
  background: var(--bg-base);
}
.screen.active { display: flex; }

.stack { display: flex; flex-direction: column; }
.stack-gap-md { gap: 12px; }
.stack-gap-lg { gap: 14px; }

.page {
  flex: 1; overflow-y: auto;
  display: none; flex-direction: column;
  background: var(--bg-base);
}
.page.active { display: flex; }

/* ── 4. DASHBOARD ─────────────────────────────────────────────────────────── */
#screen-dashboard { background: var(--bg-base); }

/* Header do dashboard: fundo superfície + borda inferior sutil */
.dash-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 52px 24px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  flex-shrink: 0; position: relative; overflow: hidden;
}

/* Halo verde atrás do ícone */
.dash-header::before {
  content: '';
  position: absolute; top: -40px; left: 50%; transform: translateX(-50%);
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(61,220,132,.12) 0%, transparent 70%);
  pointer-events: none;
}

/* Ícone: escudo com árvore */
.dash-brand-icon {
  width: 72px; height: 72px;
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
}
.dash-brand-icon img { width: 100%; height: 100%; display: block; }

.dash-brand-text { text-align: center; position: relative; z-index: 1; }
.dash-brand-text h1 {
  font-family: var(--font-brand);
  font-size: 30px; font-weight: 700; color: var(--text-1);
  letter-spacing: .22em; text-transform: uppercase; line-height: 1;
}
.dash-brand-text p {
  font-size: 12px; color: var(--text-2);
  margin-top: 5px; letter-spacing: .04em;
}
.dash-date {
  font-size: 11px; color: var(--text-3);
  background: var(--bg-raised); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 20px;
}

.dash-body {
  flex: 1; overflow-y: auto;
  padding: 20px 16px 36px;
  display: flex; flex-direction: column; gap: 14px;
}

.section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3);
  padding: 2px 0;
}

/* Botão novo levantamento */
.btn-new {
  width: 100%; padding: 15px 20px;
  background: var(--brand); border: none; border-radius: var(--r-md);
  font: inherit; font-size: 15px; font-weight: 700; color: #0d1117;
  cursor: pointer; transition: var(--t);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--sh-brand); letter-spacing: .02em;
}
.btn-new:hover  { background: #4ee896; box-shadow: 0 6px 24px rgba(61,220,132,.35); }
.btn-new:active { transform: scale(.98); }
.dash-actions { display: grid; gap: 10px; }
.btn-restore {
  width: 100%; padding: 12px 16px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--text-2);
  font: inherit; font-weight: 700; cursor: pointer; transition: var(--t);
}
.btn-restore:hover { border-color: var(--brand); color: var(--brand); }

/* Cards de levantamento */
.survey-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  cursor: pointer; transition: var(--t);
  display: flex; align-items: center; gap: 12px;
}
.survey-card:hover  {
  border-color: var(--brand);
  background: var(--bg-raised);
  box-shadow: 0 0 0 1px var(--brand-glow), var(--sh-sm);
}
.survey-card:active { transform: scale(.99); }

.survey-card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--brand-bg); border: 1px solid rgba(61,220,132,.2);
  display: flex; align-items: center; justify-content: center;
  background-image: url('icons/logo.svg'); background-repeat: no-repeat;
  background-position: center; background-size: 25px;
  flex-shrink: 0;
}
.survey-card-body { flex: 1; min-width: 0; }
.survey-card-name {
  font-size: 14px; font-weight: 700; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.survey-card-meta {
  font-size: 12px; color: var(--text-2); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.survey-card-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0;
}
.survey-card-count {
  font-size: 11px; font-weight: 700; color: var(--brand);
  background: var(--brand-bg); border: 1px solid rgba(61,220,132,.2);
  padding: 3px 10px; border-radius: 20px;
}
.survey-card-arrow { font-size: 16px; color: var(--text-3); }

/* ── 5. SURVEY SHELL ──────────────────────────────────────────────────────── */
header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px 12px; flex-shrink: 0;
}
.header-top { display: flex; align-items: center; gap: 10px; }

.btn-back {
  width: 44px; height: 44px; border-radius: var(--r-sm); flex-shrink: 0;
  background: var(--bg-raised); border: 1px solid var(--border);
  cursor: pointer; font-size: 16px; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; transition: var(--t);
}
.btn-back:hover { border-color: var(--brand); color: var(--brand); }

.survey-hdr-body { flex: 1; min-width: 0; }
.survey-hdr-body h2 {
  font-size: 14px; font-weight: 700; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.survey-hdr-body p {
  font-size: 11px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px;
}
.hdr-date { font-size: 11px; color: var(--text-3); flex-shrink: 0; }

/* Tabs */
.tabs {
  display: flex;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tab {
  flex: 1; padding: 11px 4px; text-align: center;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  color: var(--text-3); cursor: pointer;
  border: none; background: none; text-transform: uppercase;
  transition: var(--t); position: relative;
}
.tab.active { color: var(--brand); }
.tab.active::after {
  content: ''; position: absolute; bottom: 0; left: 20%; right: 20%;
  height: 2px; background: var(--brand); border-radius: 2px 2px 0 0;
}
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--bg-raised); color: var(--text-2);
  font-size: 10px; padding: 0 5px; margin-left: 4px;
  border: 1px solid var(--border);
}
.tab.active .tab-badge {
  background: var(--brand-bg); color: var(--brand);
  border-color: rgba(61,220,132,.3);
}

/* ── 6. FORM COMPONENTS ───────────────────────────────────────────────────── */
.form-scroll {
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
  padding-bottom: 40px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px;
}
.card-title {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.card-title::before {
  content: ''; width: 3px; height: 13px;
  background: var(--brand); border-radius: 2px; flex-shrink: 0;
}
.card-title-danger { color: var(--red); }
.card-title-danger::before { background: var(--red); }
.card-stack { display: flex; flex-direction: column; gap: 10px; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field-hint { font-weight: 400; color: var(--text-2); }
.field input,
.field textarea {
  font: inherit; font-size: 14px; color: var(--text-1);
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 11px 14px;
  outline: none; transition: var(--t); width: 100%;
}
.field input:focus,
.field textarea:focus {
  background: var(--bg-overlay);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--text-3); }
.field input[readonly] { opacity: .45; cursor: default; }
.field textarea { resize: vertical; min-height: 72px; }
.field .err { font-size: 11px; color: var(--red); display: none; }
.field.has-error input,
.field.has-error textarea { border-color: var(--red); background: var(--red-bg); }
.field.has-error .err { display: block; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.cap-label-row {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 0;
}

.cap-label-row label {
  margin: 0;
}

.cap-add {
    position: absolute;
    right: 0;
    top: -12px;

    width: 44px;
    height: 44px;

    border: 1px solid var(--border);
    background: var(--bg-raised);
    border-radius: 50%;

    color: var(--brand);
    font-size: 22px;
    font-weight: 700;
    line-height: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    transition: color .2s ease, transform .2s ease;
}

.cap-add:hover {
    color: #4ee896;
}

.cap-add:active {
    transform: scale(0.9);
}

.cap-remove {
    width: 44px;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);

    background: var(--bg-raised);
    color: var(--red);

    font: inherit;
    font-weight: 800;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    transition: var(--t);
    flex-shrink: 0;
}

.cap-remove:hover {
    background: var(--red-bg);
    border-color: var(--red);
}

.cap-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cap-row {
  display: flex;
  align-items: stretch;
  width: 100%;
  gap: 7px;
}

.cap-input {
  flex: 1;
  width: 100%;
}

.check-box {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; border-radius: var(--r-sm);
  background: var(--bg-raised); border: 1px solid var(--border);
  color: var(--text-2); font-size: 13px; line-height: 1.4;
  cursor: pointer; transition: var(--t);
}
.check-box:hover { background: var(--bg-overlay); border-color: var(--brand); color: var(--text-1); }
.check-box input { width: 18px; height: 18px; accent-color: var(--brand); flex-shrink: 0; margin-top: 1px; }

/* Autocomplete */
.ac-wrap { position: relative; }
.ac-drop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 100;
  background: var(--bg-surface); border: 1px solid var(--brand);
  border-radius: var(--r-md); box-shadow: var(--sh-lg), 0 0 0 1px var(--brand-glow);
  max-height: 240px; overflow-y: auto; display: none;
}
.ac-drop.open { display: block; }
.ac-item {
  padding: 11px 14px; cursor: pointer;
  transition: var(--t); border-bottom: 1px solid var(--border-dim);
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.hi { background: var(--bg-overlay); }
.ac-name { font-size: 14px; font-weight: 600; color: var(--text-1); }
.ac-sci  { font-size: 11px; color: var(--text-2); font-style: italic; margin-top: 2px; }
.ac-sel  {
  margin-top: 8px; padding: 10px 14px;
  background: var(--brand-bg); border-radius: var(--r-sm);
  border: 1px solid rgba(61,220,132,.2);
}
.ac-sel-name { font-size: 13px; font-weight: 700; color: var(--brand); }
.ac-sel-row  { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* Chips */
.chip        { font-size: 10px; padding: 3px 9px; border-radius: 20px; background: var(--bg-raised); color: var(--text-2); font-weight: 600; border: 1px solid var(--border); }
.chip.exotic { background: var(--amber-bg); color: var(--amber); border-color: rgba(227,179,65,.3); }
.chip.threat { background: var(--red-bg);   color: var(--red);   border-color: rgba(248,81,73,.3); }

/* Tags fitossanitárias */
.tags-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.tag-btn {
  min-height: 44px;
  padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--bg-raised);
  font: inherit; font-size: 11px; font-weight: 600; color: var(--text-2);
  cursor: pointer; text-align: left; transition: var(--t);
  display: flex; align-items: center; gap: 7px;
}
.tag-btn:hover { border-color: var(--border-dim); background: var(--bg-overlay); }
.tag-code {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: var(--r-xs);
  background: var(--bg-overlay); color: var(--text-3); flex-shrink: 0;
  letter-spacing: .03em;
}
.tag-btn.sel           { border-color: var(--brand); background: var(--brand-bg); color: var(--text-1); }
.tag-btn.sel .tag-code { background: var(--brand); color: #0d1117; }
.tag-btn:disabled,
.prop-btn:disabled {
  opacity: .38; cursor: not-allowed; pointer-events: none;
}

/* Proposta de manejo */
.prop-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.prop-btn {
  min-height: 44px;
  padding: 11px 6px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--bg-raised);
  font: inherit; font-size: 11px; font-weight: 700; color: var(--text-2);
  cursor: pointer; text-align: center; transition: var(--t); line-height: 1.4;
}
.prop-btn:hover { background: var(--bg-overlay); border-color: var(--text-3); color: var(--text-1); }
.prop-btn.s-poda { border-color: var(--blue); background: var(--blue-bg); color: var(--blue); }
.prop-btn.s-supr { border-color: var(--red);  background: var(--red-bg);  color: var(--red); }
.prop-btn.s-nao  { border-color: var(--brand); background: var(--brand-bg); color: var(--brand); }
.card.has-error .prop-grid { outline: 1px solid var(--red); border-radius: var(--r-sm); background: var(--red-bg); }
.card-err { margin-top: 8px; font-size: 11px; color: var(--red); display: none; }
.card.has-error .card-err { display: block; }

/* Fotografia da árvore */
.photo-field { display: flex; flex-direction: column; gap: 12px; }
.photo-empty {
  min-height: 132px;
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 20px;
  text-align: center;
}
.photo-empty-title { color: var(--text-2); font-size: 13px; font-weight: 700; }
.photo-preview {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #080b0f;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.photo-preview[hidden] { display: none; }
.photo-actions { display: flex; gap: 10px; }
.photo-actions .photo-add { flex: 1; }
.photo-meta { min-height: 16px; color: var(--text-3); font-size: 11px; }
.modal-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #080b0f;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 12px;
}

/* Localização geográfica */
.location-field { display: flex; flex-direction: column; gap: 12px; }
.location-empty {
  min-height: 104px; padding: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  text-align: center; background: var(--bg-raised); border: 1px dashed var(--border);
  border-radius: var(--r-sm);
}
.location-empty-title { color: var(--text-2); font-size: 13px; font-weight: 700; }
.location-empty[hidden] { display: none; }
.location-empty-sub { color: var(--text-3); font-size: 11px; line-height: 1.4; }
.location-result {
  padding: 14px; border-radius: var(--r-sm);
  background: var(--brand-bg); border: 1px solid rgba(61,220,132,.22);
}
.location-result[hidden] { display: none; }
.location-coordinates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.location-coordinates div { min-width: 0; }
.location-coordinates span { display: block; color: var(--text-3); font-size: 10px; margin-bottom: 3px; }
.location-coordinates strong {
  display: block; overflow: hidden; text-overflow: ellipsis;
  color: var(--text-1); font: 600 12px var(--mono);
}
.location-details { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; color: var(--text-3); font-size: 10px; }
.location-accuracy { padding: 3px 8px; border-radius: 20px; border: 1px solid var(--border); }
.location-accuracy.good { color: var(--brand); background: var(--brand-bg); border-color: rgba(61,220,132,.3); }
.location-accuracy.acceptable { color: var(--amber); background: var(--amber-bg); border-color: rgba(227,179,65,.3); }
.location-accuracy.low { color: var(--red); background: var(--red-bg); border-color: rgba(248,81,73,.3); }
.location-actions { display: flex; gap: 10px; }
.location-actions .location-capture { flex: 1; }
.location-status { min-height: 16px; color: var(--text-3); font-size: 11px; line-height: 1.4; }
.location-status.searching { color: var(--blue); }
.location-status.error { color: var(--red); }
.location-note { color: var(--text-3); font-size: 10px; line-height: 1.5; }

/* Botões primário / secundário */
.btn-primary {
  width: 100%; padding: 14px;
  border-radius: var(--r-md);
  background: var(--brand); border: none; color: #0d1117;
  font: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: var(--t);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--sh-brand);
}
.btn-primary:hover  { background: #4ee896; }
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
  padding: 11px 18px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--border);
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: var(--t);
}
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }

/* ── 7. TREE LIST ─────────────────────────────────────────────────────────── */
.list-toolbar {
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  padding: 10px 14px; flex-shrink: 0;
}
.list-toolbar input {
  width: 100%; font: inherit; font-size: 13px;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 9px 14px;
  color: var(--text-1); outline: none; transition: var(--t);
}
.list-toolbar input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.list-toolbar input::placeholder { color: var(--text-3); }

.list-scroll {
  flex: 1; overflow-y: auto;
  padding: 12px 12px 28px; display: flex; flex-direction: column; gap: 8px;
}

.tree-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 13px 15px;
  cursor: pointer; transition: var(--t);
  border-left: 3px solid var(--brand);
}
.tree-card:hover  { border-color: var(--brand); background: var(--bg-raised); }
.tree-card.m-sup  { border-left-color: var(--red); }
.tree-card.m-pod  { border-left-color: var(--blue); }
.tree-card.m-nao  { border-left-color: var(--brand); }

.tc-top  { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.tc-name { font-size: 14px; font-weight: 700; color: var(--text-1); }
.tc-sci  { font-size: 11px; font-style: italic; color: var(--text-2); margin-top: 2px; }
.tc-id   {
  font-size: 11px; font-family: var(--mono); font-weight: 700;
  color: var(--brand); background: var(--brand-bg);
  border: 1px solid rgba(61,220,132,.2);
  padding: 3px 8px; border-radius: 6px; white-space: nowrap; flex-shrink: 0;
}
.tc-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tc-chip {
  font-size: 10px; padding: 3px 8px; border-radius: 20px;
  background: var(--bg-raised); color: var(--text-2);
  font-weight: 600; border: 1px solid var(--border);
}
.tc-chip.red  { background: var(--red-bg);   color: var(--red);   border-color: rgba(248,81,73,.3); }
.tc-chip.blue { background: var(--blue-bg);  color: var(--blue);  border-color: rgba(88,166,255,.3); }
.tc-chip.grn  { background: var(--brand-bg); color: var(--brand); border-color: rgba(61,220,132,.3); }
.tc-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 7px; }
.tc-tag  {
  font-size: 9px; font-family: var(--mono); font-weight: 700;
  padding: 2px 6px; border-radius: var(--r-xs);
  background: var(--bg-overlay); color: var(--text-3);
  border: 1px solid var(--border-dim);
}

/* ── 8. EXPORT PAGE ───────────────────────────────────────────────────────── */
.export-scroll { padding: 14px; display: flex; flex-direction: column; gap: 12px; padding-bottom: 40px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box  {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px 12px; text-align: center;
}
.stat-val  { font-size: 32px; font-weight: 800; color: var(--brand); line-height: 1; }
.stat-lbl  { font-size: 11px; color: var(--text-2); margin-top: 5px; font-weight: 500; }

.ex-btn {
  width: 100%; padding: 14px 16px; border-radius: var(--r-md); border: none;
  font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: var(--t);
  display: flex; align-items: center; gap: 12px;
}
.ex-btn .ex-icon {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.ex-btn .ex-lbl  { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.ex-btn .ex-t    { font-size: 14px; font-weight: 700; }
.ex-btn .ex-s    { font-size: 11px; font-weight: 400; opacity: .7; }
.text-brand { color: var(--brand); }
.text-muted { color: var(--text-2); }
.text-danger { color: var(--red); }

.b-xlsx { background: #1a4731; color: #4ade80; border: 1px solid #166534; }
.b-xlsx .ex-icon { background: rgba(74,222,128,.1); }
.b-xlsx:hover { background: #1f5c3d; }
.b-kml { background: #253b2d; color: #86efac; border: 1px solid #3f6212; }
.b-kml:hover { background: #2f4b38; }
.b-backup { background: #18334a; color: #7dd3fc; border: 1px solid #075985; }
.b-backup:hover { background: #1d425e; }
.b-restore {
  background: var(--bg-surface); color: #7dd3fc;
  border: 1px solid #075985;
}
.b-restore:hover { background: #142b3d; }
.data-note {
  margin: 0; padding: 10px 12px; border-left: 3px solid var(--border);
  color: var(--text-3); font-size: 11px; line-height: 1.5;
}
.compatibility-card { opacity: .9; }
.compatibility-card:focus-within,
.compatibility-card:hover { opacity: 1; }

.b-import {
  background: var(--bg-surface); color: var(--text-1);
  border: 1px solid var(--border) !important;
}
.b-import .ex-icon { background: var(--bg-raised); }
.b-import:hover { border-color: var(--brand) !important; color: var(--brand); }

.b-danger {
  background: var(--bg-surface); color: var(--red);
  border: 1px solid rgba(248,81,73,.3) !important;
}
.b-danger .ex-icon { background: var(--red-bg); }
.b-danger:hover { border-color: var(--red) !important; }

.import-result {
  margin-top: 10px; padding: 11px 14px;
  border-radius: var(--r-sm); font-size: 13px; line-height: 1.5; display: none;
}
.import-result.ok  { background: var(--ok-bg);  color: var(--brand); border: 1px solid rgba(61,220,132,.3); display: block; }
.import-result.err { background: var(--red-bg); color: var(--red);   border: 1px solid rgba(248,81,73,.3);  display: block; }

/* ── 9. MODALS ────────────────────────────────────────────────────────────── */
.modal-bd {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end;
  z-index: 200; opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 200ms, visibility 0s linear 200ms;
}
.modal-bd.open {
  opacity: 1; visibility: visible; pointer-events: auto;
  transition-delay: 0s;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 20px 20px 36px;
  width: 100%; max-width: 430px; margin: 0 auto;
  max-height: 92dvh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform 320ms cubic-bezier(.32,.72,0,1);
  box-shadow: 0 -4px 40px rgba(0,0,0,.5);
}
.modal-bd.open .modal { transform: translateY(0); }

.modal-handle {
  width: 36px; height: 4px;
  background: var(--border); border-radius: 2px; margin: 0 auto 18px;
}
.modal-title {
  font-size: 17px; font-weight: 800; color: var(--text-1);
  margin-bottom: 16px; letter-spacing: -.2px;
}
.modal-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 9px 0; border-bottom: 1px solid var(--border-dim);
  font-size: 13px; gap: 12px;
}
.modal-row:last-child { border-bottom: none; }
.modal-lbl { color: var(--text-2); font-weight: 500; flex-shrink: 0; }
.modal-val { font-weight: 600; color: var(--text-1); text-align: right; }
.modal-acts { display: flex; gap: 10px; margin-top: 18px; }
.modal-acts .btn-secondary { flex: 1; }
.modal-acts-spacious { margin-top: 20px; }
.modal-primary-action { flex: 1; }
.modal-copy {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 16px;
  line-height: 1.5;
}

.btn-del {
  padding: 11px 18px; border-radius: var(--r-sm);
  background: var(--red-bg); border: 1px solid rgba(248,81,73,.35);
  font: inherit; font-size: 13px; font-weight: 700; color: var(--red);
  cursor: pointer; transition: var(--t);
}
.btn-del:hover { background: rgba(248,81,73,.2); }

.m-label { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; display: block; }
.m-input {
  font: inherit; font-size: 14px; color: var(--text-1);
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 11px 14px;
  outline: none; transition: var(--t); width: 100%;
}
.m-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.m-input::placeholder { color: var(--text-3); }
.m-group { display: flex; flex-direction: column; gap: 4px; }

/* ── 10. TOAST & LOADING ──────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-raised); color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: 100px; padding: 11px 22px;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--sh-lg); z-index: 300; white-space: nowrap;
  transition: transform 280ms cubic-bezier(.32,.72,0,1); pointer-events: none;
}
.toast.show    { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--brand-bg); color: var(--brand); border-color: rgba(61,220,132,.3); }
.toast.error   { background: var(--red-bg);   color: var(--red);   border-color: rgba(248,81,73,.3); }

.loading-ov {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; z-index: 400; display: none;
}
.loading-ov.on { display: flex; }
.spinner {
  width: 46px; height: 46px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 11. EMPTY STATES ────────────────────────────────────────────────────────*/
.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; padding: 32px; text-align: center;
}
.empty-icon  { font-size: 52px; opacity: .15; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--text-2); }
.empty-sub   { font-size: 13px; color: var(--text-3); line-height: 1.5; }

.dash-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; padding: 40px 24px; text-align: center;
}
.dash-empty-icon  { font-size: 52px; opacity: .15; }
.dash-empty-mark,
.empty-mark {
  width: 52px;
  height: 52px;
  background: url('icons/logo.svg') center / contain no-repeat;
  opacity: .18;
}
.dash-empty-title { font-size: 15px; font-weight: 700; color: var(--text-2); }
.dash-empty-sub   { font-size: 13px; color: var(--text-3); line-height: 1.6; }

/* ── 12. SCROLLBAR ────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }


/* =============================================================================
   RESPONSIVE — Tablet (≥ 768px) e Desktop (≥ 1200px)
   Estratégia: mobile-first. Tudo acima sobrescreve apenas o necessário.
   Mantém a mesma estrutura visual nas diferentes larguras.
============================================================================= */

/* ── TABLET (≥ 768px) ────────────────────────────────────────────────────── */
@media (min-width: 768px) {

  /* Centraliza e alarga o app */
  .screen {
    max-width: 760px;
    border-left:  1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  /* Dashboard: header mais espaçoso */
  .dash-header { padding: 52px 40px 32px; }

  /* Survey cards em duas colunas */
  #survey-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  #dash-empty  { grid-column: 1 / -1; }
  .dash-body   { padding: 24px 24px 40px; }

  /* Formulário: cards internos aproveitam largura */
  .form-scroll { padding: 20px 24px 48px; gap: 16px; }

  /* Stats em 4 colunas no tablet */
  .stat-grid { grid-template-columns: repeat(4, 1fr); }

  /* Tabs com texto maior */
  .tab { font-size: 12px; padding: 13px 8px; }

  /* Modais mais largos e não colados na borda */
  .modal {
    max-width: 600px;
    border-radius: var(--r-xl);
    margin-bottom: 40px;
  }
  .modal-bd { align-items: center; }

  /* List scroll com padding maior */
  .list-scroll { padding: 16px 20px 32px; gap: 10px; }

  /* Export scroll */
  .export-scroll { padding: 20px 24px 48px; gap: 16px; }

  /* Tree cards: meta em linha única */
  .tc-meta { flex-wrap: nowrap; }
}

/* ── DESKTOP (≥ 1200px) ──────────────────────────────────────────────────── */
@media (min-width: 1200px) {

  /* ── Fundo da página com cor de base ── */
  body { background: var(--bg-base); }

  /* ════════════════════════════════════
     DASHBOARD DESKTOP
  ════════════════════════════════════ */
  #screen-dashboard {
    max-width: 100%;
    flex-direction: row;
    height: 100dvh;
    border: none;
  }

  /* Sidebar esquerda fixa */
  .dash-header {
    width: 300px;
    min-width: 300px;
    height: 100dvh;
    flex-direction: column;
    align-items: flex-start;
    padding: 48px 32px 40px;
    border-right: 1px solid var(--border);
    border-bottom: none;
    border-radius: 0;
    box-shadow: none;
    position: sticky;
    top: 0;
    overflow-y: auto;
  }

  .dash-header::before {
    top: -24px;
    left: 60px;
  }

  /* Ícone e texto alinhados à esquerda na sidebar */
  .dash-brand-icon { width: 56px; height: 56px; }
  .dash-brand-text h1 { font-size: 24px; }
  .dash-brand-text p  { font-size: 12px; }
  .dash-brand-text    { text-align: left; }
  .dash-date          { align-self: flex-start; margin-top: 4px; }

  /* Área de conteúdo do dashboard (direita) */
  .dash-body {
    flex: 1;
    height: 100dvh;
    overflow-y: auto;
    padding: 24px 40px 40px;
    gap: 14px;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  /* Botão ocupa toda a largura da área de conteúdo */
  .btn-new {
    width: min(100%, 360px);
    align-self: flex-start;
  }
  .dash-actions { width: min(100%, 360px); }
  .dash-actions .btn-new { width: 100%; }

  /* Survey list — coluna única, mesma largura do botão */
  #survey-list {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
    align-content: start;
  }

  /* Empty state: centralizado no espaço disponível */
  .dash-empty {
    grid-column: 1 / -1;
    min-height: 360px;
  }

  /* ════════════════════════════════════
     SURVEY SHELL DESKTOP
     Layout: sidebar nav (esq) + conteúdo (dir)
  ════════════════════════════════════ */
  #screen-survey {
    max-width: 100%;
    flex-direction: row;
    border: none;
  }

  /* Header vira sidebar completa: topo + tabs */
  #screen-survey > header {
    width: 240px;
    min-width: 240px;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 28px 24px 32px;
    border-right: 1px solid var(--border);
    border-bottom: none;
    position: sticky;
    top: 0;
    overflow-y: auto;
  }

  #screen-survey .header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    width: 100%;
  }

  #screen-survey .btn-back { align-self: flex-start; }

  #screen-survey .survey-hdr-body { min-width: 0; width: 100%; }
  #screen-survey .survey-hdr-body h2 { font-size: 15px; white-space: normal; line-height: 1.3; }
  #screen-survey .survey-hdr-body p  { white-space: normal; margin-top: 4px; }
  #screen-survey .hdr-date { margin-top: 4px; }

  /* Tabs ficam dentro da sidebar no desktop */
  #screen-survey .tabs {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    border-bottom: none;
    background: transparent;
    gap: 6px;
  }

  #screen-survey .tab {
    flex: 0 0 auto;
    width: 100%;
    text-align: left;
    padding: 11px 14px;
    border-radius: var(--r-sm);
    font-size: 13px;
    letter-spacing: .02em;
  }

  #screen-survey .tab.active { background: var(--brand-bg); color: var(--brand); }
  #screen-survey .tab.active::after { display: none; }

  /* Area de conteudo a direita */
  #screen-survey .page {
    flex: 1;
    min-width: 0;
    height: 100dvh;
    overflow-y: auto;
    background: var(--bg-base);
    display: none;
  }

  #screen-survey .page.active {
    display: flex;
    flex-direction: column;
  }

  /* Pagina Registro */
  #page-form {
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    overflow-y: hidden; /* os painéis internos fazem o scroll */
  }

  /* Painel do formulário */
  #page-form .form-scroll {
    width: min(100%, 760px);
    min-width: 0;
    height: 100dvh;
    overflow-y: auto;
    padding: 32px 32px 56px;
  }

  /* Painel da lista de árvores ao lado do form */
  /* ════════════════════════════════════
     PÁGINA LISTA
  ════════════════════════════════════ */
  #page-list { flex-direction: column; }

  .list-toolbar { padding: 16px max(32px, calc((100% - 1120px) / 2)); }
  .list-toolbar input { max-width: 520px; }

  .list-scroll {
    width: min(100% - 64px, 1120px);
    margin: 0 auto;
    padding: 20px 0 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
    align-content: start;
  }

  /* Empty state ocupa as 2 colunas */
  #list-empty { grid-column: 1 / -1; }

  /* ════════════════════════════════════
     PÁGINA EXPORTAR
  ════════════════════════════════════ */
  .export-scroll {
    width: min(100% - 64px, 920px);
    margin: 0 auto;
    padding: 32px 0 56px;
    max-width: none;
  }

  .stat-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }

  .stat-val { font-size: 36px; }

  /* Botões de export lado a lado */
  /* ════════════════════════════════════
     MODAIS DESKTOP — centralizados
  ════════════════════════════════════ */
  .modal-bd { align-items: center; justify-content: center; }

  .modal {
    max-width: 520px;
    border-radius: var(--r-xl);
    border: 1px solid var(--border);
    margin-bottom: 0;
    max-height: 85dvh;
  }

  /* Toast mais alto para não ficar atrás da sidebar */
  .toast { bottom: 32px; }
}
