/* Hope Market Web — Identidade visual */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --verde:    #2d6a4f;
  --verde2:   #52b788;
  --verde3:   #1b4332;
  --dourado:  #f4a261;
  --vermelho: #c1440e;
  --bg:       #111916;
  --bg2:      #1a2620;
  --bg3:      #223020;
  --bg4:      #2a3d28;
  --branco:   #eaf4ee;
  --cinza:    #6b8f71;
  --cinza2:   #2d3b2d;
  --azul:     #74b9ff;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--branco);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── NAV ─────────────────────────────────────────────────── */
.nav {
  background: var(--verde3);
  border-bottom: 2px solid var(--dourado);
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--branco);
  font-weight: 500;
  font-size: 15px;
  margin-right: 8px;
}

.nav-logo img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
}

.nav-logo .logo-fallback {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--verde);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--branco);
  border: 1.5px solid var(--verde2);
  flex-shrink: 0;
}

.nav-unit {
  font-size: 11px;
  color: var(--cinza);
  font-weight: 400;
}

.nav-divider {
  width: 1px;
  height: 28px;
  background: var(--cinza2);
  margin: 0 8px;
}

.nav-links {
  display: flex;
  gap: 2px;
  flex: 1;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--cinza);
  text-decoration: none;
  transition: all .15s;
  font-weight: 500;
}

.nav-link:hover { background: var(--verde); color: var(--branco); }
.nav-link.active { background: var(--verde); color: var(--branco); }

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-admin {
  background: var(--dourado);
  color: #411800;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--verde);
  border: 1.5px solid var(--verde2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--branco);
  cursor: pointer;
  position: relative;
}

.avatar-menu {
  position: absolute;
  top: 38px;
  right: 0;
  background: var(--bg2);
  border: .5px solid var(--cinza2);
  border-radius: 8px;
  min-width: 160px;
  display: none;
  z-index: 200;
  overflow: hidden;
}

.avatar-menu.open { display: block; }
.avatar-menu a {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--branco);
  text-decoration: none;
  transition: background .1s;
}
.avatar-menu a:hover { background: var(--bg3); }
.avatar-menu .sep { height: 1px; background: var(--cinza2); }

/* ── CONTENT ─────────────────────────────────────────────── */
.content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--branco);
}

.page-sub {
  font-size: 13px;
  color: var(--cinza);
  margin-top: 2px;
}

/* ── CARDS ───────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg2);
  border: .5px solid var(--cinza2);
  border-radius: 10px;
  padding: 16px 18px;
}

.card-label {
  font-size: 11px;
  color: var(--cinza);
  margin-bottom: 8px;
}

.card-val {
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
}

.card-val.green  { color: var(--verde2); }
.card-val.amber  { color: var(--dourado); }
.card-val.blue   { color: var(--azul); }
.card-val.red    { color: var(--vermelho); }

/* ── TABELA ──────────────────────────────────────────────── */
.table-box {
  background: var(--bg2);
  border: .5px solid var(--cinza2);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: .5px solid var(--cinza2);
  gap: 12px;
}

.table-toolbar-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--branco);
}

.search-input {
  background: var(--bg);
  border: .5px solid var(--cinza2);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--branco);
  width: 220px;
  outline: none;
  transition: border-color .15s;
}

.search-input:focus { border-color: var(--verde2); }
.search-input::placeholder { color: var(--cinza); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--verde3);
  color: var(--verde2);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 14px;
  text-align: left;
}

tbody tr {
  border-bottom: .5px solid var(--cinza2);
  transition: background .1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg3); }

tbody td {
  padding: 11px 14px;
  color: var(--branco);
  vertical-align: middle;
}

.td-muted { color: var(--cinza); }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}

.badge-green  { background: #0f3020; color: var(--verde2); }
.badge-amber  { background: #3a2000; color: var(--dourado); }
.badge-red    { background: #3a0a0a; color: #ff8080; }
.badge-blue   { background: #0a1a3a; color: var(--azul); }
.badge-admin  { background: var(--dourado); color: #411800; }
.badge-lider  { background: var(--verde3); color: var(--verde2); }

/* ── BOTÕES ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
}

.btn-primary { background: var(--verde); color: var(--branco); }
.btn-primary:hover { background: #3a8060; }
.btn-secondary { background: var(--bg3); color: var(--cinza); border: .5px solid var(--cinza2); }
.btn-secondary:hover { background: var(--bg4); color: var(--branco); }
.btn-danger { background: var(--vermelho); color: var(--branco); }
.btn-danger:hover { background: #a03000; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ghost { background: transparent; color: var(--cinza); }
.btn-ghost:hover { color: var(--branco); }

/* ── FORMULÁRIOS ─────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  color: var(--cinza);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  background: var(--bg3);
  border: .5px solid var(--cinza2);
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--branco);
  outline: none;
  transition: border-color .15s;
}

.form-control:focus { border-color: var(--verde2); }
.form-control::placeholder { color: var(--cinza); }
.form-control select { background: var(--bg3); }

select.form-control option { background: var(--bg2); }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg2);
  border: .5px solid var(--cinza2);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}

.modal-header {
  background: var(--verde3);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--branco);
}

.modal-close {
  background: none;
  border: none;
  color: var(--cinza);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .15s;
}

.modal-close:hover { color: var(--branco); }

.modal-body { padding: 20px; }

.modal-footer {
  padding: 14px 20px;
  background: var(--bg3);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── ALERTAS ─────────────────────────────────────────────── */
.alert {
  padding: 12px 14px;
  border-radius: 7px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}

.alert.show { display: block; }
.alert-error   { background: #3a0a0a; color: #ff8080; border: .5px solid #7a1a1a; }
.alert-success { background: #0f3020; color: var(--verde2); border: .5px solid var(--verde); }
.alert-warn    { background: #3a2000; color: var(--dourado); border: .5px solid #6a3800; }

/* ── SPINNER ─────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--cinza2);
  border-top-color: var(--verde2);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── FOOTER ──────────────────────────────────────────────── */
footer {
  background: var(--bg2);
  border-top: .5px solid var(--cinza2);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--cinza);
}

.footer-brand .logo-r {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--verde3);
  border: 1px solid var(--verde);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--verde2);
}

.footer-brand img {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: contain;
}

.footer-brand strong { color: var(--verde2); }
.footer-ver { font-size: 11px; color: var(--cinza); }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--cinza);
}

.empty-icon { font-size: 36px; margin-bottom: 12px; }
.empty-text { font-size: 14px; }

/* ── LOADING ─────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  flex-direction: column;
  gap: 14px;
}

.loading-overlay p { color: var(--cinza); font-size: 13px; }

/* ── RESPONSIVO ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .content { padding: 16px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  table { font-size: 12px; }
}
