/* ============================================================
   ADMIN — tema claro coeso com o app (papel quente + Shopee)
   Mesma paleta, tipografia e ritmo do gemini-app.css do app.
   ============================================================ */
:root {
  /* superfícies */
  --bg: #f7f6f2;
  --bg-grad:
    radial-gradient(ellipse 60% 34% at 6% -4%, rgba(234, 90, 43, 0.045), transparent 60%),
    radial-gradient(ellipse 50% 30% at 100% 0%, rgba(24, 119, 242, 0.03), transparent 60%);
  --surface-1: #ffffff;
  --surface-2: #fbfaf6;
  --surface-3: #f1efe8;
  --surface: #ffffff;
  --raise: #ffffff;

  --line: #ecebe4;
  --line2: #e2e1d8;
  --line-strong: #d6d4c8;
  --hairline: rgba(17, 20, 24, 0.06);

  --text: #111418;
  --ink: #111418;
  --muted: #6b7280;
  --dim: #9aa1ab;

  /* marca — laranja Shopee */
  --accent: #ea5a2b;
  --accent-hi: #ff8f6b;
  --accent-dim: #c73a1f;
  --accent-bg: #fff5f0;
  --accent-bd: #f0c4b4;
  --accent-glow: rgba(234, 90, 43, 0.18);
  --on-accent: #ffffff;

  /* semânticos */
  --ok: #0f8a5f;
  --ok-bg: #ecfdf5;
  --ok-bd: #a7f3d0;
  --warn: #a97a1a;
  --warn-bg: #fbf5e0;
  --warn-bd: #f0e0b6;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-bd: #fecaca;
  --info: #1877F2;
  --info-bg: #eff6ff;
  --info-bd: #cfe0fb;

  --radius: 14px;
  --r-sm: 10px;
  --r-xs: 6px;
  --ease: cubic-bezier(0.2, 0.8, 0.25, 1);

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --inset-top: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -18px rgba(15, 23, 42, 0.12);
  --shadow-raise: 0 1px 2px rgba(15, 23, 42, 0.05), 0 16px 40px -24px rgba(15, 23, 42, 0.18);
  --shadow-lift: 0 20px 60px -30px rgba(15, 23, 42, 0.15);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-optical-sizing: auto; }

:where(button, a, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #d5d9e1;
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #c0c5cf; background-clip: padding-box; }
::selection { background: var(--accent); color: #fff; }

.hidden { display: none !important; }

/* ============ LOGIN ============ */
.admin-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(ellipse 60% 42% at 22% -6%, rgba(234, 90, 43, 0.10), transparent 58%),
    radial-gradient(ellipse 50% 38% at 86% 10%, rgba(15, 138, 95, 0.06), transparent 58%),
    radial-gradient(ellipse 40% 34% at 50% 112%, rgba(24, 119, 242, 0.05), transparent 58%),
    var(--bg);
}
.auth-shell {
  position: relative;
  width: min(440px, 100%);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}
.auth-shell::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.6;
}
.auth-brand { padding: 32px 30px 6px; }
.auth-brand h1 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.15;
  color: var(--text);
}
.auth-brand p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}
.brand-kicker {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 14px;
}

.auth-form {
  padding: 20px 30px 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.auth-form input,
.search,
select {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  font: inherit;
  font-size: 14px;
  letter-spacing: -0.005em;
  text-transform: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.auth-form input:focus,
.search:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.auth-form .btn.solid { margin-top: 4px; padding: 12px 14px; }

.btn {
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 9px 14px;
  font: inherit;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition:
    background .18s var(--ease),
    border-color .18s var(--ease),
    color .18s var(--ease),
    box-shadow .18s var(--ease),
    transform .18s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn.solid {
  background: linear-gradient(180deg, var(--accent-hi) 0%, var(--accent) 55%, var(--accent-dim) 100%);
  color: var(--on-accent);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    0 1px 2px rgba(199, 58, 31, 0.25),
    0 10px 22px -14px rgba(234, 90, 43, 0.75);
}
.btn.solid:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 2px 4px rgba(199, 58, 31, 0.28),
    0 14px 26px -14px rgba(234, 90, 43, 0.85);
}
.btn.solid:active { transform: translateY(0); }
.btn.ghost {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--line);
}
.btn.ghost:hover { color: var(--text); background: var(--surface-3); border-color: var(--line-strong); }
.btn.soft {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: var(--ok-bd);
}
.btn.soft:hover { background: #d9f7ea; }
.btn.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-bd);
}
.btn.danger:hover { background: #fde5e5; }
.btn.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: var(--warn-bd);
}
.btn.warn:hover { background: #f7edc9; }
.btn.tiny { padding: 5px 10px; font-size: 11.5px; }
.btn.danger-strong {
  background: var(--danger);
  color: #fff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.status { min-height: 18px; font-size: 13px; color: var(--danger); }
.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 12.5px;
  text-align: center;
}
.back-link:hover { color: var(--accent); }

/* ============ APP SHELL ============ */
.admin-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}
.rail {
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 20;
}
.rail-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 2px 8px 16px;
  border-bottom: 1px solid var(--line);
}
.rail-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.015em;
  color: var(--text);
}
.rail-sub {
  color: var(--dim);
  font-size: 10.5px;
  margin-top: 4px;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
  font-family: var(--mono);
}
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-item {
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--muted);
  border-radius: var(--r-sm);
  padding: 9px 10px 9px 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  position: relative;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.rail-item:hover { color: var(--text); background: rgba(17, 20, 24, 0.04); }
.rail-item.active {
  color: var(--accent);
  background: var(--accent-bg);
  font-weight: 600;
}
.rail-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
  transform: scaleY(0);
  opacity: 0;
  transition: transform .22s var(--ease), opacity .22s var(--ease);
}
.rail-item.active::before { transform: scaleY(1); opacity: 1; }
.rail-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: currentColor;
  opacity: 0.7;
}
.rail-item.active .rail-icon { opacity: 1; }
.rail-item-label {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.badge {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn-bd);
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 8px;
  font-variant-numeric: tabular-nums;
}
.rail-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 8px 4px;
  border-top: 1px solid var(--line);
}
.rail-user { font-size: 11px; color: var(--dim); word-break: break-all; }
.rail-link {
  color: var(--text);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
}
.rail-link:hover { color: var(--accent); }

.workspace { padding: 32px 30px 64px; max-width: 1320px; }
.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding-bottom: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 96px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), rgba(234, 90, 43, 0));
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.topbar h2 {
  margin: 10px 0 0;
  font-family: var(--display);
  font-size: 32px;
  letter-spacing: -0.022em;
  line-height: 1.12;
  font-weight: 600;
  color: var(--text);
}
.page-desc {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  max-width: 62ch;
}
.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.filters-inline {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.search {
  min-width: 220px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line2);
  border-radius: 0;
  padding: 6px 2px;
  font-size: 13px;
}
.search::placeholder { color: var(--dim); }
.search:focus {
  outline: none;
  border-bottom-color: var(--accent);
  box-shadow: none;
  background: transparent;
}
select {
  min-width: 130px;
  color-scheme: light;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line2);
  border-radius: 0;
  padding: 6px 2px;
  font-size: 13px;
  color: var(--text);
}
select:focus {
  outline: none;
  border-bottom-color: var(--accent);
  box-shadow: none;
}

.col-filters { display: none !important; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  position: relative;
  overflow: hidden;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 17px 16px;
  box-shadow: var(--shadow-card);
  transition: border-color .22s var(--ease), transform .22s var(--ease), box-shadow .22s var(--ease);
}
.stat::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--line2);
}
.stat.pending::before { background: var(--warn); }
.stat.approved::before { background: var(--ok); }
.stat:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-raise);
}
.stat .lbl {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.stat .val {
  margin-top: 10px;
  font-size: 28px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -0.035em;
  color: var(--text);
}
.stat.pending .val { color: var(--warn); }
.stat.approved .val { color: var(--ok); }

.overview-grid {
  display: grid;
  grid-template-columns: 1.55fr 0.9fr;
  gap: 18px;
  align-items: start;
}
.side-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: border-color .22s var(--ease), box-shadow .22s var(--ease);
}
.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-raise);
}
.card.grow { flex: 1; min-width: 0; }
.card-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: transparent;
}
.card-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--text);
}
.hint { color: var(--muted); font-size: 11.5px; display: block; margin-top: 4px; }

.table-wrap { overflow: auto; }
.grid {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 13px;
}
.grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 11px 14px;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  box-shadow: inset 0 -1px 0 var(--line);
  white-space: nowrap;
  font-weight: 700;
}
.grid th.th-sort {
  cursor: pointer;
  user-select: none;
  transition: color .15s var(--ease);
}
.grid th.th-sort:hover { color: var(--text); }
.grid th.th-sort::after {
  content: "⇅";
  margin-left: 6px;
  opacity: 0.35;
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
}
.grid th.th-sort.asc,
.grid th.th-sort.desc { color: var(--accent); }
.grid th.th-sort.asc::after { content: "↑"; opacity: 1; }
.grid th.th-sort.desc::after { content: "↓"; opacity: 1; }
.grid td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--text);
  vertical-align: middle;
}
.grid td:first-child { font-family: var(--mono); letter-spacing: -0.02em; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tr { cursor: pointer; transition: background .15s var(--ease); }
.grid tbody tr:hover { background: var(--accent-bg); }
.grid tbody tr:hover > td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.grid tbody tr.active { background: var(--accent-bg); }
.grid tbody tr.active > td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.grid th.num, .grid td.num { text-align: right; }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-family: var(--font);
  border: 1px solid transparent;
}
.pill.pending { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }
.pill.approved { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-bd); }
.pill.rejected { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-bd); }
.pill.suspended { background: var(--info-bg); color: var(--info); border-color: var(--info-bd); }
.pill.admin {
  background: linear-gradient(180deg, var(--accent-hi) 0%, var(--accent) 100%);
  color: var(--on-accent);
  border-color: rgba(0, 0, 0, 0.12);
  font-weight: 700;
}

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

.queue-box { padding: 2px 0; }
.queue-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  transition: background .15s var(--ease);
}
.queue-row:hover { background: var(--accent-bg); }
.queue-row:last-child { border-bottom: 0; }
.queue-row .email {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  word-break: break-all;
}
.queue-row .meta {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}
.queue-empty {
  padding: 30px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
  background: transparent;
}
.pager strong { color: var(--text) !important; font-weight: 600; }
.pager-btns { display: flex; gap: 4px; }
.pager-btns button {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: var(--r-xs);
  padding: 5px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  transition: border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}
.pager-btns button:hover:not(:disabled):not(.active) {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface-3);
}
.pager-btns button.active {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  color: var(--on-accent);
  border-color: rgba(0, 0, 0, 0.12);
  font-weight: 700;
}
.pager-btns button:disabled { opacity: .4; cursor: default; }

.layout-split {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 18px;
  align-items: start;
}
.detail { position: sticky; top: 18px; min-height: 360px; }
.detail-empty {
  padding: 40px 22px;
  text-align: center;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}
.detail-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.detail-title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
  word-break: break-all;
  color: var(--text);
}
.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.meta-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 11px;
}
.meta-box .k {
  color: var(--dim);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.meta-box .v {
  margin-top: 5px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text);
}
.detail-actions { display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 1100px) {
  .admin-app { grid-template-columns: 1fr; }
  .layout-split, .overview-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rail {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  .rail-brand { border-bottom: 0; padding-bottom: 0; }
  .rail-nav { flex-direction: row; flex-wrap: wrap; }
  .rail-foot { margin-top: 0; width: 100%; flex-direction: row; align-items: center; border-top: 1px solid var(--line); }
  .workspace { padding: 24px 20px 56px; }
  .topbar h2 { font-size: 26px; }
}

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .workspace { padding: 20px 14px 48px; }
  .topbar h2 { font-size: 23px; }
  .card-head { padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .stat:hover, .btn.solid:hover { transform: none; }
}
