:root {
  color-scheme: dark;
  --bg: #0f131a;
  --panel: #141a24;
  --card: #161d28;
  --primary: #16a34a;
  --primary-strong: #0f8a3f;
  --accent: #f97316;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: #1f2733;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: url("fundo.png") center center / cover no-repeat fixed;
  color: var(--text);
}

.page {
  max-width: 1200px;
  margin: 0 auto 48px;
  padding: 18px 18px 32px;
  background: rgba(15, 19, 26, 0.92);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

a { color: var(--primary); }

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, #111827, #0b111c);
  color: #fff;
  padding: 20px;
  border: 1px solid #1f2733;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.hero__text { text-align: right; }
.hero__text h1 { margin: 6px 0 6px; font-size: 28px; letter-spacing: -0.01em; }
.hero__text .muted { color: rgba(229,231,235,0.82); margin: 0; }
.eyebrow { letter-spacing: 0.22em; text-transform: uppercase; font-size: 11px; opacity: 0.85; margin: 0; }
.badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.badges .pill {
  background: rgba(22,163,74,0.12);
  border: 1px solid rgba(22,163,74,0.4);
  color: #bbf7d0;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
}
.badges .pill a { color: inherit; text-decoration: none; }
.hero__card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px,1fr));
  gap: 10px;
}
.hero__card .stat {
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}
.hero__card .label { font-size: 12px; opacity: 0.85; }
.hero__card strong { display: block; margin-top: 2px; }
.hero__logo {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex: 0 0 auto;
}
.hero__logo img {
  max-height: 96px;
  width: auto;
  filter: drop-shadow(0 10px 25px rgba(0,0,0,0.35));
}
.hero__text { flex: 1; }

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.glass {
  background: rgba(22, 28, 38, 0.92);
  backdrop-filter: blur(8px);
}
.card__title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 10px;
  color: #e5e7eb;
}
.card__title.center { text-align: center; }

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}
.fields-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}
.fields-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 10px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label { font-weight: 600; font-size: 13px; color: #e5e7eb; }
.field input, .field select, .field textarea {
  padding: 11px 12px;
  border: 1px solid #1f2733;
  border-radius: 10px;
  font-size: 14px;
  background: #0f131a;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(12, 90, 219, 0.12);
}
.field.small { max-width: 110px; }
.field.full { grid-column: 1 / -1; }
.field textarea { resize: vertical; min-height: 64px; }
.area-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.area-tags label {
  background: #1b2330;
  border: 1px solid #2a3342;
  color: #e5e7eb;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.area-tags input { margin-right: 6px; }

.actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 10px 20px rgba(0,0,0,0.05);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
button:hover { filter: brightness(0.98); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button.primary { background: var(--primary); border-color: var(--primary); color: #e5f9ee; }
button.accent { background: var(--accent); border-color: var(--accent); color: #fff7ed; }
button.ghost { background: #1b2330; border-color: #2a3342; color: #e5e7eb; }

.muted { color: var(--muted); }
.muted.small { font-size: 13px; }
.helper { margin: 8px 0 0; font-size: 13px; color: #9ca3af; }

.table-card { margin-top: 16px; }
.table-wrapper {
  overflow-x: auto;
  border: 1px solid #1f2733;
  border-radius: 12px;
}
.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table-wrapper th, .table-wrapper td {
  padding: 10px 8px;
  border-bottom: 1px solid #1f2733;
  text-align: right;
  white-space: nowrap;
  color: #e5e7eb;
}
.table-wrapper th:first-child,
.table-wrapper td:first-child,
.table-wrapper th:nth-child(2),
.table-wrapper td:nth-child(2) { text-align: left; }
.table-wrapper thead { background: #1b2330; }
.table-wrapper tbody tr:nth-child(odd) { background: #141a24; }
.total-row td { font-weight: 700; background: #1b2330; }
.table-wrapper input.inline {
  width: 90px;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #2a3342;
  background: #0f131a;
  color: #e5e7eb;
}
.table-wrapper button.remove {
  background: #e5e7eb;
  color: #0f131a !important;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.table-wrapper button.remove:hover {
  background: #cbd5e1;
}
.hidden { display: none !important; }

.admin { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
code { font-family: var(--mono); padding: 2px 4px; background: #1f2733; border-radius: 4px; color: #c7d2fe; }
.cfg-actions { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.cfg-actions button {
  background: #e5e7eb;
  color: #0f131a;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.cfg-actions button.edit { background: #bfdbfe; border-color: #93c5fd; }
.cfg-actions button:hover { filter: brightness(0.95); }
#cfgList li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid #1f2733;
  border-radius: 10px;
  background: #141a24;
  flex-wrap: wrap;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}
.modal {
  background: #0f131a;
  color: #e5e7eb;
  border: 1px solid #1f2733;
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  padding: 18px;
  box-shadow: var(--shadow);
}
.modal h3 { margin-top: 0; margin-bottom: 10px; }
.modal h3 { text-align: center; }
.modal p { margin: 6px 0; color: #cbd5e1; }
.modal-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.page-footer {
  text-align: center;
  margin: 18px 0 24px;
  color: #e5e7eb;
}
.page-footer a {
  color: #e5e7eb;
  text-decoration: none;
}
.page-footer a:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .hero { flex-direction: column; align-items: flex-start; }
  .hero__text { text-align: left; }
  .fields-4 { grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); }
  .fields-3 { grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); }
  .page { padding: 12px; }
}
