/* Painel de gestão */

body.admin-page { overflow: auto; }

.admin-page .topbar { padding-left: 16px; }

.topbar-link-strong { color: var(--mev-teal); }

.admin { padding-top: var(--topbar-h); min-height: 100%; }

.admin-hero { background: var(--mev-yellow); padding: 28px 32px 26px; }

.admin-hero h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }

.admin-hero p { margin: 4px 0 0; opacity: .8; font-size: 15px; }

.admin-body { max-width: 1100px; padding: 0 32px 48px; }

/* ---------- Abas ---------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 20px 0 18px; }

.tab {
  position: relative;
  padding: 10px 16px;
  border: 0;
  background: none;
  font-family: var(--font-condensed);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
}

.tab:hover { color: var(--text); }

.tab[aria-selected="true"] { color: var(--mev-teal-dark); }

.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--mev-yellow);
}

.tab-count {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--mev-teal-soft);
  color: var(--mev-teal-dark);
  font-size: 12px;
  text-align: center;
}

/* ---------- Barra de ferramentas ---------- */

.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }

.search {
  flex: 1 1 240px;
  max-width: 360px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
}

.search:focus { outline: none; border-color: var(--mev-teal); box-shadow: 0 0 0 3px rgba(1, 130, 142, .15); }

.toolbar .btn { margin-left: auto; }

/* ---------- Listas ---------- */

.group-title {
  font-family: var(--font-condensed);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--mev-teal);
  margin: 22px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-title::before { content: ""; width: 4px; height: 14px; background: var(--mev-yellow); border-radius: 2px; }

.rows { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }

.row { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-top: 1px solid var(--border); }

.row:first-child { border-top: 0; }

.row:hover { background: var(--surface-alt); }

.row-main { flex: 1 1 auto; min-width: 0; }

.row-title { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.row-sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }

.row-meta { font-size: 13px; color: var(--text); margin-top: 6px; }

.row-meta strong { font-weight: 600; }

.row-actions { display: flex; gap: 4px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }

.row-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.row-btn:hover { border-color: var(--mev-teal); color: var(--mev-teal-dark); }

.row-btn.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }

.badge {
  font-family: var(--font-condensed);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--mev-teal-soft);
  color: var(--mev-teal-dark);
}

.badge-admin { background: var(--mev-yellow); color: var(--text); }

.badge-warn { background: #FFF1D6; color: #8A5A00; }

.badge-muted { background: var(--hover); color: var(--text-muted); }

.empty-list { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 12px; padding: 28px; color: var(--text-muted); text-align: center; }

/* ---------- Modais ---------- */

.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  color: var(--text);
}

.modal-sm { width: min(440px, calc(100vw - 32px)); }

.modal::backdrop { background: rgba(21, 21, 21, .45); }

.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); margin: 0; }

.modal-header { display: flex; align-items: center; padding: 20px 24px 8px; }

.modal-header h2 { margin: 0; font-size: 20px; font-weight: 700; }

.modal-close { margin-left: auto; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-muted); }

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

.modal-body { padding: 8px 24px 8px; overflow-y: auto; }

.modal-body > p { margin: 0 0 16px; }

.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; border-top: 1px solid var(--border); margin-top: 8px; }

.field textarea,
.field select {
  padding: 9px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  resize: vertical;
}

.field select { height: 42px; padding: 0 10px; }

.field textarea:focus,
.field select:focus { outline: none; border-color: var(--mev-teal); box-shadow: 0 0 0 3px rgba(1, 130, 142, .15); }

.field input[readonly] { background: var(--hover); color: var(--text-muted); }

.field-status { font-size: 12px; min-height: 16px; }

.field-status.ok { color: var(--mev-green-dark); }

.field-status.bad { color: var(--danger); }

.checklist-box { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 10px; margin: 0 0 12px; }

.checklist-box legend { font-weight: 600; padding: 0 6px; }

.checklist-actions { display: flex; gap: 14px; margin-bottom: 6px; }

.link-btn { border: 0; background: none; padding: 0; color: var(--mev-teal); font-weight: 600; font-size: 13px; cursor: pointer; }

.link-btn:hover { text-decoration: underline; }

.checklist { display: flex; flex-direction: column; max-height: 240px; overflow-y: auto; }

.checklist-group { font-family: var(--font-condensed); font-weight: 700; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--mev-teal); margin: 8px 0 2px; }

.check,
.radio { display: flex; align-items: flex-start; gap: 10px; padding: 6px 2px; cursor: pointer; font-size: 14px; }

.check input,
.radio input { margin-top: 3px; accent-color: var(--mev-green); width: 16px; height: 16px; flex: 0 0 16px; }

.check small { color: var(--text-subtle); }

.check.disabled { cursor: default; color: var(--text-muted); }

.checklist.disabled { opacity: .5; pointer-events: none; }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

.btn-danger:hover { background: #8F1F18; border-color: #8F1F18; }

.secret { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }

.secret code {
  flex: 1 1 auto;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--mev-yellow-soft);
  border: 1px solid var(--mev-yellow);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .04em;
  user-select: all;
}

/* ---------- Aviso rápido ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--mev-black);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  font-size: 14px;
  z-index: 50;
}

@media (max-width: 768px) {
  .admin-hero { padding: 22px 16px; }
  .admin-hero h1 { font-size: 22px; }
  .admin-body { padding: 0 16px 40px; }
  .row { flex-direction: column; align-items: stretch; gap: 10px; }
  .row-actions { justify-content: flex-start; }
  .toolbar .btn { margin-left: 0; width: 100%; }
  .search { max-width: none; }
  .admin-page .topbar .brand-divider,
  .admin-page .topbar .brand-sub { display: none; }
  .admin-page .topbar-link { display: inline; }
}
