/* Painel do Guia de Trilhas — identidade SPVS (verde-floresta), claro e escuro. */
:root {
  --bg: #f4f5f0; --surface: #ffffff; --surface-2: #f8f9f5; --text: #18211c; --muted: #5f6b64; --line: #e3e7df;
  --brand: #06441f; --brand-2: #0b5c2c; --brand-text: #ffffff;
  --primary: #1f7a43; --primary-hover: #17663a; --primary-text: #ffffff; --primary-soft: #e4f2e8;
  --accent: #b0a016;
  --warn-bg: #fff6e0; --warn: #7a5200; --warn-line: #f0c45a;
  --error-bg: #fdecea; --error: #a3241a; --error-line: #f1a39b;
  --ok-bg: #e4f2e8; --ok: #1d5a31; --ok-line: #8cc9a0;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 32, 22, .05), 0 4px 14px rgba(16, 32, 22, .06);
  --shadow-hover: 0 2px 4px rgba(16, 32, 22, .08), 0 10px 28px rgba(16, 32, 22, .12);
  --ring: 0 0 0 3px rgba(31, 122, 67, .28);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1411; --surface: #171d19; --surface-2: #1c241f; --text: #e6ece8; --muted: #9aa8a0; --line: #28322c;
    --brand: #0a3a1d; --brand-2: #0f4d27;
    --primary: #4fb874; --primary-hover: #63c886; --primary-text: #08160d; --primary-soft: #1b3324;
    --warn-bg: #33290f; --warn: #f2c96d; --warn-line: #6b5420;
    --error-bg: #3a1916; --error: #ff9d92; --error-line: #6e2a24;
    --ok-bg: #1b3324; --ok: #9ad8aa; --ok-line: #2f5f3e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 14px rgba(0, 0, 0, .25);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);
    --ring: 0 0 0 3px rgba(79, 184, 116, .35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; }

/* ---------------------------------------------------------------- cabeçalho */
header.top {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: var(--brand-text); box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
}
header.top .wrap { display: flex; gap: 16px; align-items: center; min-height: 62px; flex-wrap: wrap; }
header.top .brand {
  display: flex; align-items: center; gap: 10px; margin-right: auto;
  color: #fff; text-decoration: none; font-weight: 800; letter-spacing: -.01em; font-size: 1.02rem; line-height: 1.2;
}
header.top .brand .logo {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .14); font-size: 19px;
}
header.top .brand small { display: block; font-weight: 500; opacity: .72; font-size: .74rem; letter-spacing: .02em; }
header.top nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
header.top nav a, header.top nav button.link {
  color: rgba(255, 255, 255, .86); text-decoration: none; padding: 7px 12px; border-radius: 99px; font-weight: 500;
}
header.top nav a:hover, header.top nav button.link:hover { background: rgba(255, 255, 255, .12); color: #fff; }
header.top nav a.active { background: rgba(255, 255, 255, .18); color: #fff; }
header.top nav button.publish-btn { background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 99px; padding: 6px 14px; font-weight: 700; margin: 0 4px; }
header.top nav button.publish-btn:hover { background: rgba(255, 255, 255, .24); color: #fff; }
header.top nav button.publish-btn.pending { background: var(--accent); color: #06441f; border-color: var(--accent); }
header.top nav button.publish-btn .count { background: #06441f; color: #fff; border-radius: 99px; padding: 0 7px; font-size: .78rem; }
header.top nav .user { display: inline-flex; align-items: center; gap: 8px; }
header.top nav .avatar {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #06441f; font-weight: 800; font-size: .8rem;
}

/* ---------------------------------------------------------------- estrutura */
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 26px; padding-bottom: 64px; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.02em; font-weight: 800; }
h2 { font-size: 1.15rem; margin: 34px 0 12px; letter-spacing: -.01em; font-weight: 700; }
.row > h2 { margin-bottom: 12px; }
.card h2:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.crumbs { font-size: .86rem; margin-bottom: 10px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--primary); text-decoration: underline; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.page-intro { color: var(--muted); margin: 2px 0 22px; max-width: 72ch; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before {
  content: "+"; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--primary-soft); color: var(--primary); font-weight: 800; transition: transform .15s;
}
details.card[open] > summary::before { transform: rotate(45deg); }
details.card[open] > summary { margin-bottom: 12px; }

/* ---------------------------------------------------------------- unidades (início) */
.area-card {
  display: flex; flex-direction: column; overflow: hidden; padding: 0; text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.area-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); color: inherit; }
.area-card .cover { aspect-ratio: 16 / 9; background: var(--brand) center 22% / cover no-repeat; position: relative; }
.area-card .cover.empty { display: grid; place-items: center; color: rgba(255, 255, 255, .55); font-size: 44px;
  background: linear-gradient(135deg, var(--brand), var(--primary)); }
.area-card .cover .badge { position: absolute; top: 12px; right: 12px; box-shadow: 0 1px 8px rgba(0, 0, 0, .3); }
.area-card .body { padding: 16px 18px 18px; }
.area-card h2 { margin: 0 0 10px; font-size: 1.08rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.tile { display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
.tile:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); color: inherit; }
.tile .icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 22px;
  background: var(--primary-soft); flex: none; }
.tile strong { display: block; }

/* ---------------------------------------------------------------- avisos */
.flash {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 12px; border: 1px solid transparent; border-left-width: 4px;
}
.row + .flash, .row + .card { margin-top: 14px; }
.flash::before { font-weight: 800; }
.flash.error { background: var(--error-bg); color: var(--error); border-color: var(--error-line); }
.flash.error::before { content: "✕"; }
.flash.warning { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.flash.ok::before { content: "✓"; }

/* ---------------------------------------------------------------- botões */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s, transform .05s;
}
.btn:hover, button:hover { border-color: var(--primary); color: var(--text); background: var(--surface-2); }
.btn:active, button:active { transform: translateY(1px); }
.btn:focus-visible, button:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary, button.primary {
  background: var(--primary); color: var(--primary-text); border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.btn.primary:hover, button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-text); }
.btn.danger, button.danger { color: var(--error); }
.btn.danger:hover, button.danger:hover { border-color: var(--error); background: var(--error-bg); }
.btn.small, button.small { padding: 5px 11px; font-size: .84rem; border-radius: 8px; }
button:disabled { opacity: .45; cursor: default; transform: none; }
button.link { border: 0; background: none; padding: 0; color: var(--primary); text-decoration: underline; font-weight: 500; }
form.inline { display: inline; }

/* ---------------------------------------------------------------- formulários */
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .92rem; }
label .hint, .hint { font-weight: 400; color: var(--muted); font-size: .84rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url],
select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--text); font: inherit; transition: border-color .12s, box-shadow .12s, background .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); background: var(--surface); }
textarea { min-height: 100px; resize: vertical; }
input[type=file] {
  width: 100%; padding: 14px; border: 1.5px dashed var(--line); border-radius: 10px; background: var(--surface-2);
  color: var(--muted); font: inherit; cursor: pointer;
}
input[type=file]:hover { border-color: var(--primary); }
input[type=file]::file-selector-button {
  margin-right: 12px; padding: 7px 14px; border-radius: 8px; border: 0; background: var(--primary-soft);
  color: var(--primary); font: inherit; font-weight: 600; cursor: pointer;
}
input[type=color] { width: 56px; height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); vertical-align: -2px; }
.duration { display: flex; align-items: center; gap: 6px; }
.duration input { width: 5.5em; flex: none; }
.duration span { color: var(--muted); margin-right: 6px; }
.cols { display: grid; gap: 0 18px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

/* ---------------------------------------------------------------- tabelas */
.table-scroll { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--surface-2); }
tr:hover td { background: var(--surface-2); }
td.row { display: table-cell; white-space: nowrap; }
td.row > form, td.row > .btn { margin-right: 4px; }
td a { font-weight: 600; text-decoration: none; }
[id] { scroll-margin-top: 84px; } /* âncoras (#camadas, #secoes) não ficam sob o cabeçalho fixo */
td a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- etiquetas */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: .76rem;
  font-weight: 600; background: var(--ok-bg); color: var(--ok); white-space: nowrap; }
.badge.draft { background: var(--warn-bg); color: var(--warn); }
.badge.off { background: var(--error-bg); color: var(--error); }

/* ---------------------------------------------------------------- unidade */
.map { height: 440px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.map.tall { height: 540px; }
.publish { border-left: 5px solid var(--primary); }
.publish.pending { border-left-color: var(--warn-line); background: linear-gradient(90deg, var(--warn-bg), var(--surface) 50%); }
.photos { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius-sm); }
.code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; letter-spacing: .08em; font-weight: 700; }
.poi-marker { width: 26px; height: 26px; border-radius: 50%; background: #1f7a43; color: #fff; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center; font: 700 12px system-ui; text-decoration: none; box-shadow: 0 1px 4px #0006; }
.poi-marker.draft { background: #b7791f; }
.poi-marker.sensitive { outline: 2px dashed #9b1c13; outline-offset: 1px; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 1.2rem; padding: 6px 10px; background: var(--surface-2); border-radius: var(--radius-sm); user-select: all; }
.basemap-toggle button { width: auto; padding: 0 10px; font: 600 12px system-ui, sans-serif; color: #1d2420; border-radius: 4px; }

/* ---------------------------------------------------------------- folder e experiências */
.guide-preview { margin-top: 16px; border-radius: var(--radius); overflow: hidden; max-width: 360px; padding-bottom: 14px; box-shadow: var(--shadow); }
.guide-preview img { display: block; width: 100%; height: auto; }
.guide-preview span { display: block; margin: 10px 14px 0; padding: 6px 10px; font-weight: 800; text-align: center; text-transform: uppercase; }
img.thumb { width: 96px; height: 64px; object-fit: cover; border-radius: 6px; display: block; }
img.thumb.big { width: 300px; height: auto; border-radius: var(--radius-sm); }

/* ---------------------------------------------------------------- entrar */
body.login-page { min-height: 100vh; background:
  radial-gradient(1200px 600px at 10% -10%, rgba(176, 160, 22, .22), transparent 60%),
  linear-gradient(160deg, #06441f 0%, #0b5c2c 55%, #13703a 100%); }
body.login-page header.top { background: transparent; box-shadow: none; position: static; }
.login { max-width: 400px; margin: 8vh auto; padding: 32px; border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.login h1 { margin-bottom: 6px; }
.login button.primary { width: 100%; padding: 12px; margin-top: 8px; }

@media (max-width: 640px) {
  .map { height: 320px; } .map.tall { height: 380px; }
  h1 { font-size: 1.45rem; }
  .card { padding: 16px; }
  header.top .brand small { display: none; }
}
