:root {
  --aso-green: #2f7a3a;
  --aso-green-dark: #1b4d22;
  --aso-green-light: #66b04b;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --line: #d0d0d0;
  --bg: #f3f5f2;
  --paper: #ffffff;
  --danger: #b42318;
  --ok: #027a48;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse at top left, rgba(102,176,75,.18), transparent 45%),
    linear-gradient(180deg, #eef2ea 0%, var(--bg) 40%, #e8ece5 100%);
  min-height: 100vh;
}

a { color: var(--aso-green-dark); }
img { max-width: 100%; height: auto; }

.wrap {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.brand { display: flex; align-items: center; gap: .85rem; }
.brand img { width: 72px; height: auto; background: #000; border-radius: 8px; padding: 4px; }
.brand h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  line-height: 1.2;
  color: var(--aso-green-dark);
}
.brand p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 10px 30px rgba(27,77,34,.06);
}

.section-title {
  margin: 0 0 .9rem;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--aso-green);
  font-weight: 700;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem 1rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .85rem 1rem;
}
.full { grid-column: 1 / -1; }

label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: .35rem;
}
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  border: 1px solid #c9cfc7;
  border-radius: 8px;
  padding: .65rem .75rem;
  font: inherit;
  background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(47,122,58,.28);
  border-color: var(--aso-green);
}

.exames {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem .75rem;
}
.exame {
  display: flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .55rem .7rem;
  background: #fafbf9;
}
.exame:has(input:checked) {
  border-color: var(--aso-green);
  background: rgba(102,176,75,.12);
}
.exame input { width: auto; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: 1.1rem;
}
.btn {
  appearance: none;
  border: 0;
  border-radius: 9px;
  padding: .7rem 1.1rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
}
.btn-primary { background: var(--aso-green); color: #fff; }
.btn-primary:hover { background: var(--aso-green-dark); }
.btn-secondary { background: #ecefe9; color: var(--ink); }
.btn-danger { background: #f8e5e3; color: var(--danger); }
.btn-sm { padding: .4rem .7rem; font-size: .85rem; }

.alert {
  border-radius: 10px;
  padding: .8rem 1rem;
  margin-bottom: 1rem;
  font-size: .95rem;
}
.alert-error { background: #fef3f2; color: var(--danger); border: 1px solid #fecdca; }
.alert-ok { background: #ecfdf3; color: var(--ok); border: 1px solid #abe2c2; }
.alert-info { background: #f4f7f2; color: #344; border: 1px solid #d7e0d1; }

.howto { margin-bottom: 0; }
.page-banner {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(27,77,34,.08);
  background: #111;
}
.page-banner img {
  display: block;
  width: 100%;
  height: clamp(140px, 28vw, 220px);
  object-fit: cover;
  object-position: center 35%;
}
.page-banner__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: .85rem 1.1rem;
  background: linear-gradient(transparent, rgba(15, 28, 18, .82));
  color: #fff;
}
.page-banner__caption strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: .2rem;
}
.page-banner__caption span {
  font-size: .9rem;
  opacity: .92;
  line-height: 1.4;
}
.export-box textarea {
  width: 100%;
  min-height: 220px;
  font-family: Consolas, "Courier New", monospace;
  font-size: .9rem;
  line-height: 1.45;
  border: 1px solid #c9cfc7;
  border-radius: 8px;
  padding: .75rem;
  background: #fafbf9;
}
.howto-note {
  margin: .85rem 0 0;
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.45;
}
.steps {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink);
  line-height: 1.55;
}
.steps li { margin-bottom: .4rem; }
.field-hint {
  margin: -.35rem 0 .85rem;
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.4;
}
.opt { font-weight: 500; color: var(--muted); font-size: .85em; }
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem 1rem;
}
.summary-grid .k {
  display: block;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: .2rem;
}
.summary-grid strong { font-size: .98rem; }
.callout {
  background: #eef6ea;
  border-left: 4px solid var(--aso-green);
  border-radius: 0 10px 10px 0;
  padding: .85rem 1rem;
  margin-bottom: 1rem;
  font-size: .92rem;
  color: #2a3a2c;
  line-height: 1.45;
}
.callout strong { color: var(--aso-green-dark); }
.empty-state {
  padding: 1.5rem 1.1rem;
  text-align: center;
  color: var(--muted);
}
.empty-state strong { display: block; color: var(--ink); margin-bottom: .35rem; }

@media (max-width: 820px) {
  .summary-grid { grid-template-columns: 1fr; }
}

.mapa-preview {
  margin-top: 1rem;
  text-align: center;
}
.mapa-preview img {
  border: 1px solid var(--line);
  border-radius: 10px;
  max-width: 520px;
}

.admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  background: #111;
  color: #eee;
  padding: 1.25rem 1rem;
}
.sidebar .logo-side {
  background: #000;
  border-radius: 8px;
  padding: .5rem;
  margin-bottom: 1.25rem;
}
.sidebar nav a {
  display: block;
  color: #ddd;
  text-decoration: none;
  padding: .55rem .7rem;
  border-radius: 8px;
  margin-bottom: .25rem;
}
.sidebar nav a:hover,
.sidebar nav a.active { background: rgba(102,176,75,.22); color: #fff; }
.admin-main { padding: 1.25rem 1.5rem 2rem; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .85rem;
  margin-bottom: 1.2rem;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .9rem 1rem;
}
.stat strong { display: block; font-size: 1.45rem; color: var(--aso-green-dark); }
.stat span { color: var(--muted); font-size: .85rem; }

table.data {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
table.data th, table.data td {
  text-align: left;
  padding: .7rem .8rem;
  border-bottom: 1px solid #ecefec;
  font-size: .92rem;
}
table.data th {
  background: #f5f7f3;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #456;
}
.badge {
  display: inline-block;
  padding: .15rem .45rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  background: #ecefe9;
}
.badge-ok { background: #d1fadf; color: #027a48; }
.badge-warn { background: #fef0c7; color: #93370d; }
.badge-new { background: #e0f2fe; color: #075985; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .9rem;
}
.toolbar form { display: flex; gap: .5rem; flex-wrap: wrap; }

@media (max-width: 820px) {
  .grid-2, .grid-3, .exames, .stats { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { padding-bottom: .5rem; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: .25rem; }
}
