/* ==========================================================================
   Itu Garden — Painel administrativo
   Folha única. Substitui admin.css + admin-v2..v5, que se sobrescreviam.
   ========================================================================== */

:root {
  --forest-900: #0b2c23;
  --forest-800: #123a2f;
  --forest-600: #1d5040;
  --gold: #d4aa4e;
  --gold-soft: #f0e2c2;
  --ink: #17322a;
  --muted: #6d7b75;
  --line: #e3e7e4;
  --surface: #ffffff;
  --canvas: #f4f6f4;
  --danger: #a74139;
  --danger-soft: #fbeceb;
  --success: #2b7a5c;
  --success-soft: #e6f4ee;
  --warning: #96660d;
  --warning-soft: #fdf3e0;
  --info: #2f5d8a;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 42, 34, .06);
  --shadow: 0 6px 20px rgba(15, 42, 34, .08);
  --shadow-lg: 0 18px 48px rgba(15, 42, 34, .16);
  --sidebar-width: 256px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
i.fi { font-style: normal; line-height: 1; }
img, canvas, svg, video { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

.overline {
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- Layout - */

.admin-page { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--forest-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 26px 18px;
  overflow-y: auto;
}

.admin-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-decoration: none;
  padding: 0 6px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.admin-brand { justify-content: center; }
.admin-brand img { width: 150px; max-height: 50px; object-fit: contain; }
.admin-brand > span {
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sidebar nav { display: grid; gap: 4px; margin-top: 24px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  padding: 11px 13px;
  color: rgba(255, 255, 255, .68);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: background .16s ease, color .16s ease;
}
.sidebar nav a i { color: var(--gold); font-size: 17px; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar nav a.active { background: rgba(212, 170, 78, .16); color: #fff; }

.sidebar-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  display: grid;
  gap: 10px;
}
.admin-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background .16s ease;
}
.admin-chip:hover { background: rgba(255, 255, 255, .08); }
.admin-chip > span {
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold);
  color: var(--forest-800);
  font-weight: 800;
  overflow: hidden;
}
.admin-chip > span img { width: 100%; height: 100%; object-fit: cover; }
.admin-chip div { min-width: 0; display: grid; gap: 2px; }
.admin-chip strong, .admin-chip small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-chip strong { font-size: 13px; }
.admin-chip small { font-size: 10px; color: rgba(255, 255, 255, .55); }

.logout-button {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, .16);
  background: transparent;
  color: rgba(255, 255, 255, .7);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; gap: 8px; justify-content: center;
  transition: background .16s ease, color .16s ease;
}
.logout-button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
/* Assinatura de quem desenvolveu: presente, mas sem competir com a marca. */
.vendor-signature {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 4px;
  opacity: .42;
  transition: opacity .18s ease;
}
.vendor-signature:hover { opacity: .78; }
.vendor-signature img { width: 14px; height: 14px; }
.vendor-signature span {
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .72);
  white-space: nowrap;
}

.admin-shell { width: calc(100% - var(--sidebar-width)); margin-left: var(--sidebar-width); }

.topbar {
  min-height: 92px;
  padding: 18px clamp(20px, 4vw, 46px);
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar > div { flex: 1; min-width: 0; }
.topbar p { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.topbar h1 { font-size: clamp(19px, 2.4vw, 25px); margin-top: 3px; }
.menu-button {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.admin-content {
  padding: clamp(20px, 3vw, 34px) clamp(20px, 4vw, 46px) 70px;
  display: grid;
  gap: 22px;
  align-content: start;
}

/* ---------------------------------------------------------------- Botões - */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s ease, box-shadow .16s ease, background .16s ease;
}
.button:active { transform: translateY(1px); }
.button.primary { background: var(--forest-800); color: #fff; box-shadow: var(--shadow-sm); }
.button.primary:hover { background: var(--forest-600); box-shadow: var(--shadow); }
.button.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.button.ghost:hover { border-color: var(--forest-600); color: var(--forest-800); }
.button.danger { background: var(--danger); color: #fff; }
.button.danger:hover { filter: brightness(1.07); }
.button.subtle { background: transparent; border-color: transparent; color: var(--muted); padding: 8px 10px; }
.button.subtle:hover { background: var(--canvas); color: var(--ink); }
.button.wide { width: 100%; }
.button.small { padding: 8px 13px; font-size: 13px; }
.button[disabled] { opacity: .55; cursor: not-allowed; }

.glow-button {
  background: linear-gradient(120deg, var(--forest-800), var(--forest-600));
  color: #fff;
  box-shadow: 0 10px 28px rgba(18, 58, 47, .28);
}
.glow-button:hover { box-shadow: 0 14px 34px rgba(18, 58, 47, .34); }

.action-group { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Painéis - */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 2.4vw, 26px);
  box-shadow: var(--shadow-sm);
}
.narrow-panel { max-width: 620px; }

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.panel-heading h2 { font-size: 19px; margin-top: 3px; }

.count-badge {
  background: var(--gold-soft);
  color: var(--forest-800);
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 700;
  font-size: 13px;
}

.page-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-actions h2 { font-size: clamp(20px, 2.6vw, 26px); margin-top: 4px; }
.page-actions span, .page-actions p { color: var(--muted); font-size: 14px; }
.premium-page-actions { padding-bottom: 4px; }

.section-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.section-toolbar h2 { font-size: 20px; margin-top: 3px; }
.section-toolbar > a {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; color: var(--forest-600); font-weight: 600; font-size: 14px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, .95fr);
  gap: 22px;
  align-items: start;
}
.sticky-panel { position: sticky; top: 118px; }

.result-heading {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.result-heading h2 { font-size: 20px; margin-top: 3px; }
.result-heading > span { color: var(--muted); font-size: 14px; }

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  padding: 42px 20px;
  color: var(--muted);
}
.empty-state i { font-size: 30px; color: var(--gold); }
.empty-state strong { color: var(--ink); font-size: 16px; }
.empty-state p { font-size: 14px; max-width: 380px; }

/* ------------------------------------------------------------ Formulários - */

.admin-form { display: grid; gap: 14px; }
.admin-form label,
.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.admin-form label > small,
.form-grid label > small { font-weight: 400; color: var(--muted); font-size: 12px; }

input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], input[type="tel"], input[type="date"], input[type="datetime-local"],
input[type="search"], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 400;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--forest-600);
  box-shadow: 0 0 0 3px rgba(29, 80, 64, .12);
}
input[disabled], select[disabled], textarea[disabled] { background: var(--canvas); color: var(--muted); }
textarea { resize: vertical; min-height: 88px; line-height: 1.55; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-note { color: var(--muted); font-size: 13px; margin-bottom: 12px; }

.input-icon { position: relative; display: block; }
.input-icon i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon input { padding-left: 38px; }

.toggle-label { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; }
.toggle-label input { width: 17px; height: 17px; accent-color: var(--forest-600); }

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: 1px solid transparent;
}
.flash.success { background: var(--success-soft); color: var(--success); border-color: #bfe0d1; }
.flash.error { background: var(--danger-soft); color: var(--danger); border-color: #f0cbc8; }

/* ------------------------------------------------------------------ Login - */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(212, 170, 78, .18), transparent 42%),
    linear-gradient(140deg, #0a251f, #123a2f 60%, #0f3128);
}
.login-card {
  width: min(940px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.login-brand {
  background: linear-gradient(155deg, var(--forest-900), var(--forest-600));
  color: #fff;
  padding: 42px 34px;
  display: grid;
  align-content: space-between;
  gap: 28px;
}
.login-brand > img { width: 150px; max-height: 54px; object-fit: contain; }
.login-brand-copy { display: grid; gap: 8px; }
.login-brand-copy i { font-size: 26px; color: var(--gold); }
.login-brand-copy strong { font-size: 19px; }
.login-brand-copy span { color: rgba(255, 255, 255, .7); font-size: 14px; line-height: 1.6; }
.login-brand > a { font-size: 10px; color: rgba(255, 255, 255, .4); text-decoration: none; }
.login-content { padding: 42px 38px; display: grid; gap: 14px; align-content: center; }
.login-content h1 { font-size: 25px; }
.login-content > p { color: var(--muted); font-size: 14px; }
.login-content form { display: grid; gap: 14px; margin-top: 8px; }
.login-content label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.login-content > small { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }

/* -------------------------------------------------------------- Dashboard - */

.welcome-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: clamp(20px, 2.6vw, 30px);
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--forest-900), var(--forest-600) 65%, #1c5a47);
  color: #fff;
  box-shadow: var(--shadow);
}
.welcome-strip .overline { color: var(--gold); }
.welcome-strip h2 { font-size: clamp(22px, 3vw, 29px); margin: 5px 0 6px; }
.welcome-strip p { color: rgba(255, 255, 255, .72); font-size: 14px; max-width: 52ch; }
.welcome-strip .button { background: var(--gold); color: var(--forest-900); box-shadow: none; }
.welcome-strip .button:hover { background: #e0ba63; }

.metric-deck { display: grid; grid-template-columns: repeat(auto-fit, minmax(212px, 1fr)); gap: 14px; }
.metric-deck article {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px;
  box-shadow: var(--shadow-sm);
}
.metric-orb {
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 13px;
  display: grid; place-items: center;
  font-size: 19px;
}
.metric-orb.emerald { background: #e4f2ea; color: #23795a; }
.metric-orb.amber { background: #fbf0d9; color: #9a7420; }
.metric-orb.violet { background: #ece9f8; color: #5a4bab; }
.metric-orb.coral { background: #fbe9e6; color: #b0503f; }
.metric-deck article > div { display: grid; gap: 1px; min-width: 0; }
.metric-deck small { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.metric-deck strong { font-size: 23px; line-height: 1.15; }
.metric-deck em { font-style: normal; font-size: 12px; color: var(--muted); }

.insight-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 18px; align-items: start; }

/* Gráfico de barras em CSS puro: sem biblioteca externa, sem requisição extra. */
.timeline-chart { display: flex; align-items: flex-end; gap: 5px; height: 168px; margin-top: 18px; }
.timeline-chart > div { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.timeline-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--forest-600), var(--forest-800));
  position: relative;
  transition: filter .16s ease;
}
.timeline-bar:hover { filter: brightness(1.25); }
.timeline-bar[data-empty="1"] { background: var(--line); }
.timeline-chart small { font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.timeline-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 12px; }

/* Feed de atividades: quem fez o quê, em ordem cronológica. */
.activity-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.activity-feed li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
}
.activity-feed li:last-child { border-bottom: 0; }
.activity-avatar {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  overflow: hidden;
  background: var(--canvas);
  color: var(--forest-600);
  font-size: 14px;
}
.activity-avatar img { width: 100%; height: 100%; object-fit: cover; }
.activity-feed p { font-size: 13.5px; line-height: 1.5; }
.activity-feed p strong { font-weight: 600; }
.activity-feed p em { font-style: normal; color: var(--muted); }
.activity-feed small { font-size: 11.5px; color: var(--muted); }

.rank-list { display: grid; gap: 11px; margin-top: 16px; }
.rank-list article { display: grid; gap: 6px; }
.rank-list header { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.rank-list header strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list header span { color: var(--muted); white-space: nowrap; }
.rank-bar { height: 7px; border-radius: 999px; background: var(--canvas); overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--forest-600)); }

/* ---------------------------------------------------------------- Kanban - */

.kanban-section { display: grid; gap: 16px; }
.campaign-kanban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.kanban-column { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; }
.kanban-column > header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.kanban-column > header span { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.kanban-column > header i { color: var(--gold); }
.kanban-column > header b { background: var(--canvas); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--muted); }
.kanban-column.draft > header i { color: var(--muted); }
.kanban-column.active > header i { color: var(--success); }
.kanban-stack { display: grid; gap: 12px; }
.kanban-empty {
  display: grid; justify-items: center; gap: 5px; text-align: center;
  padding: 26px 14px; border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--muted); font-size: 13px;
}
.kanban-empty i { font-size: 21px; color: var(--gold); }
.kanban-empty strong { color: var(--ink); font-size: 14px; }

.campaign-tile {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: box-shadow .18s ease, transform .18s ease;
}
.campaign-tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.campaign-thumb {
  height: 96px;
  background: linear-gradient(130deg, var(--forest-800), var(--forest-600));
  background-size: cover;
  background-position: center;
  position: relative;
}
.campaign-tile.large .campaign-thumb { height: 120px; }
.campaign-thumb > span {
  position: absolute; left: 12px; top: 12px;
  background: rgba(11, 44, 35, .82);
  color: #fff; font-size: 9px; letter-spacing: .1em;
  padding: 4px 9px; border-radius: 999px;
}
.campaign-body { padding: 14px; display: grid; gap: 7px; }
.campaign-body small { font-size: 11px; color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.campaign-body h3 { font-size: 15px; line-height: 1.35; }
.campaign-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.campaign-meta span { display: inline-flex; align-items: center; gap: 5px; }
.campaign-progress { height: 5px; border-radius: 999px; background: var(--canvas); overflow: hidden; }
.campaign-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--forest-600)); }
.tile-open {
  position: absolute; right: 12px; top: 12px;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .92); color: var(--forest-800);
  text-decoration: none;
}
.tile-quick-actions { display: flex; border-top: 1px solid var(--line); }
.tile-quick-actions a {
  flex: 1; padding: 11px; text-align: center; text-decoration: none;
  font-size: 12px; font-weight: 600; color: var(--forest-600);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.tile-quick-actions a + a { border-left: 1px solid var(--line); }
.tile-quick-actions a:hover { background: var(--canvas); }

.floating-menu { position: absolute; right: 10px; bottom: 10px; }
.floating-menu > button {
  width: 30px; height: 30px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .92); color: var(--forest-800);
}
[data-menu] {
  display: none;
  position: absolute; right: 0; bottom: 38px; z-index: 20;
  min-width: 208px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
[data-menu].open { display: block; }
[data-menu] a, [data-menu] button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 11px 14px; border: 0; background: none; cursor: pointer;
  text-align: left; text-decoration: none; font-size: 13px;
}
[data-menu] a:hover, [data-menu] button:hover { background: var(--canvas); }
[data-menu] i { color: var(--muted); font-size: 15px; }
[data-menu] form button { color: var(--danger); }
[data-menu] form button i { color: var(--danger); }

/* --------------------------------------------------------------- Filtros - */

.filter-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 12px;
}
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; align-items: end; }
.filter-grid label { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.filter-grid .search-field { grid-column: span 2; }
.filter-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.filter-summary { color: var(--muted); font-size: 13px; margin-right: auto; }
.filter-summary b { color: var(--ink); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 7px; flex-wrap: wrap; padding-top: 6px; }
.pagination a, .pagination span {
  min-width: 38px; padding: 8px 11px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); text-align: center; text-decoration: none;
  font-size: 13px; font-weight: 600;
}
.pagination .current { background: var(--forest-800); color: #fff; border-color: var(--forest-800); }
.pagination .gap { border: 0; background: none; color: var(--muted); min-width: auto; }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 15px; border-radius: var(--radius-sm);
  background: var(--warning-soft); color: var(--warning);
  font-size: 13px; line-height: 1.55;
  border: 1px solid #f0dcb4;
}
.notice i { font-size: 16px; margin-top: 1px; }

/* --------------------------------------------------- Cards de participante - */

.participant-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(316px, 1fr)); gap: 14px; }
.participant-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-content: start;
  box-shadow: var(--shadow-sm);
}
.participant-card.is-winner { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), var(--shadow-sm); }
.participant-card > header { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.participant-card > header > div:nth-child(2) { flex: 1; min-width: 0; }
.participant-card h3 { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.participant-card > header span { font-size: 11px; color: var(--muted); }
.participant-avatar {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-soft); color: var(--forest-800); font-weight: 800;
}
.registration-code {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  background: var(--canvas);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  letter-spacing: .04em;
  display: block;
  overflow-wrap: anywhere;
}
.dynamic-value-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.dynamic-value-grid > div { min-width: 0; display: grid; gap: 1px; }
.dynamic-value-grid small { font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.dynamic-value-grid strong { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.participant-card > footer {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: 10px;
  font-size: 11px; color: var(--muted);
}
.participant-card > footer span { display: inline-flex; align-items: center; gap: 5px; }

.status-pill {
  padding: 4px 11px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
  background: var(--canvas); color: var(--muted);
}
.status-pill.eligible, .status-pill.open, .status-pill.active { background: var(--success-soft); color: var(--success); }
.status-pill.winner { background: var(--gold-soft); color: var(--warning); }
.status-pill.cancelled, .status-pill.blocked { background: var(--danger-soft); color: var(--danger); }
.status-pill.draft { background: var(--canvas); color: var(--muted); }

.winner-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--gold); color: var(--forest-900);
  padding: 4px 11px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.winner-ribbon {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--gold-soft); border-radius: var(--radius-sm); padding: 9px 12px;
  font-size: 12px;
}
.winner-ribbon strong { font-family: ui-monospace, Menlo, monospace; }

/* ------------------------------------------------------------------ Links - */

.link-list { display: grid; gap: 12px; }
.link-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.link-card.inactive { opacity: .68; }
.link-card > header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
}
.link-card > header > div { flex: 1; min-width: 0; }
.link-card h3 { font-size: 15px; }
.link-card header small { font-size: 12px; color: var(--muted); }
.association-logo, .link-logo {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 11px; display: grid; place-items: center; overflow: hidden;
  background: var(--gold-soft); color: var(--forest-800); font-weight: 800; font-size: 13px;
}
.association-logo img, .link-logo img { width: 100%; height: 100%; object-fit: cover; }

.link-url {
  display: flex; align-items: center; gap: 10px;
  margin: 0 16px 14px;
  background: var(--canvas);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.link-url code {
  flex: 1; min-width: 0;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
  overflow-x: auto;
  white-space: nowrap;
}
.link-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}
.link-stats > div { padding: 11px 14px; text-align: center; }
.link-stats > div + div { border-left: 1px solid var(--line); }
.link-stats small { display: block; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.link-stats strong { font-size: 16px; }
.link-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--canvas); }
.link-actions form { display: contents; }

.slug-field { display: grid; gap: 6px; }
.slug-input { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.slug-input span {
  display: grid; place-items: center;
  padding: 0 11px; background: var(--canvas); color: var(--muted);
  font-size: 12.5px; font-family: ui-monospace, Menlo, monospace; white-space: nowrap;
  border-right: 1px solid var(--line);
}
.slug-input input { border: 0; border-radius: 0; }
.slug-input input:focus { box-shadow: none; }

.qr-holder { display: grid; justify-items: center; gap: 8px; padding: 14px; }
.qr-holder canvas, .qr-holder svg { border-radius: var(--radius-sm); background: #fff; }

/* ----------------------------------------------------------- Associações - */

.association-list { display: grid; gap: 12px; }
.association-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.association-card.inactive { opacity: .68; }
.association-card > header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.association-card > header > div:nth-child(2) { flex: 1; min-width: 0; }
.association-card strong { font-size: 15px; display: block; }
.association-card small { font-size: 12px; color: var(--muted); }
.association-meta { display: flex; gap: 16px; flex-wrap: wrap; padding: 0 16px 12px; font-size: 12px; color: var(--muted); }
.association-meta span { display: inline-flex; align-items: center; gap: 5px; }

details.inline-editor,
details.user-editor { border-top: 1px solid var(--line); }
details.inline-editor > summary,
details.user-editor > summary {
  cursor: pointer; list-style: none; padding: 11px 16px;
  font-size: 13px; font-weight: 600; color: var(--forest-600);
  display: flex; align-items: center; gap: 8px;
  background: var(--canvas);
}
details.inline-editor > summary::-webkit-details-marker,
details.user-editor > summary::-webkit-details-marker { display: none; }
details.inline-editor > summary:hover,
details.user-editor > summary:hover { background: #eef1ee; }
details.inline-editor[open] > summary,
details.user-editor[open] > summary { border-bottom: 1px solid var(--line); }
details.inline-editor .admin-form,
details.user-editor .admin-form { padding: 16px; }
details.user-editor .permission-grid { padding: 0 16px; }
details.user-editor .toggle-label { padding: 0 16px 12px; }

/* --------------------------------------------------------- Administradores - */

.admin-user-list { display: grid; gap: 12px; }
.admin-user-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.admin-user-card.inactive { opacity: .66; }
.admin-user-card > header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.user-avatar {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: var(--forest-800); color: var(--gold); font-size: 17px;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-summary { flex: 1; min-width: 0; display: grid; gap: 2px; }
.user-summary strong { font-size: 15px; }
.self-tag {
  display: inline-block; margin-left: 6px; padding: 2px 8px;
  border-radius: 999px; background: var(--gold-soft); color: var(--warning);
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.form-note i { color: var(--gold); margin-right: 5px; }
.user-summary span, .user-summary small { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

.permission-grid { border: 0; padding: 0; margin: 4px 0 0; display: grid; gap: 9px; }
.permission-grid legend { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; padding: 0 0 8px; }
.permission-grid label {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; font-weight: 400;
  transition: border-color .16s ease, background .16s ease;
}
.permission-grid label:hover { border-color: var(--forest-600); background: var(--canvas); }
.permission-grid label:has(input:checked) { border-color: var(--forest-600); background: var(--success-soft); }
.permission-grid input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--forest-600); flex: 0 0 16px; }
.permission-grid span { display: grid; gap: 2px; }
.permission-grid strong { font-size: 13px; font-weight: 600; }
.permission-grid small { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.permission-grid.compact label { padding: 8px 11px; }

.user-form-actions { display: flex; gap: 9px; justify-content: flex-end; flex-wrap: wrap; }
.delete-user-form { padding: 0 16px 16px; }
.profile-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }

.avatar-editor { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.avatar-editor > div {
  width: 74px; height: 74px; border-radius: 50%;
  background: var(--canvas); border: 1px dashed var(--line);
  display: grid; place-items: center; overflow: hidden; position: relative;
}
.avatar-editor img { width: 100%; height: 100%; object-fit: cover; }
.avatar-editor > div i { position: absolute; color: var(--muted); font-size: 19px; }
.avatar-editor img:not([hidden]) + i { display: none; }
.avatar-editor > label { font-size: 13px; font-weight: 600; }
.avatar-editor input[type="file"] { display: block; margin-top: 5px; font-size: 12px; max-width: 100%; }

/* ------------------------------------------------------------- Auditoria - */

.audit-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.audit-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.audit-table th, .audit-table td { padding: 12px 15px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
.audit-table th { background: var(--canvas); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); position: sticky; top: 0; }
.audit-table tbody tr:last-child td { border-bottom: 0; }
.audit-table tbody tr:hover { background: #fafbfa; }
.audit-when { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.audit-who { display: grid; gap: 1px; }
.audit-who small { color: var(--muted); font-size: 11px; }
.audit-action { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.audit-action i { color: var(--gold); }
.audit-meta {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px; color: var(--muted);
  max-width: 340px; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}
.audit-entity { font-size: 11px; color: var(--muted); }

/* ------------------------------------------------- Construtor de campos - */

.editor-form { display: grid; gap: 20px; }
.form-section { display: grid; gap: 18px; }
.section-heading { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.section-heading > div { flex: 1 1 180px; min-width: 0; }
.section-heading > span:first-child {
  width: 42px; height: 42px; flex: 0 0 42px;
  border-radius: 12px; display: grid; place-items: center;
  background: var(--forest-800); color: var(--gold); font-weight: 800; font-size: 15px;
}
.section-heading h2 { font-size: 18px; }
.section-heading p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.builder-feature-badge {
  margin-left: auto; background: var(--gold-soft); color: var(--warning);
  padding: 5px 12px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap;
}

.builder-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr) 236px; gap: 18px; align-items: start; }
.field-palette { display: grid; gap: 12px; }
.field-palette > p, .builder-preview > p { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.palette-grid { display: grid; gap: 7px; }
.palette-grid button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; text-align: left; font-size: 13px;
}
.palette-grid button:hover { border-color: var(--forest-600); }
.palette-grid button.active { border-color: var(--forest-600); background: var(--success-soft); }
.palette-grid button i { color: var(--muted); font-size: 15px; }
.palette-grid button span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-grid button b { color: var(--forest-600); }

.custom-field-button {
  width: 100%; padding: 10px; border: 1px dashed var(--forest-600); border-radius: var(--radius-sm);
  background: transparent; color: var(--forest-600); cursor: pointer; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.builder-tip, .builder-security {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--canvas); font-size: 12px; color: var(--muted); line-height: 1.5;
}
.builder-security { background: var(--success-soft); color: var(--success); }
.builder-security.warning { background: var(--danger-soft); color: var(--danger); }

.builder-workspace { border: 1px solid var(--line); border-radius: var(--radius); background: var(--canvas); padding: 14px; min-height: 260px; }
.builder-workspace > header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line);
}
.builder-workspace > header strong { font-size: 14px; display: block; }
.builder-workspace > header small { font-size: 12px; color: var(--muted); }
.builder-workspace > header > span { font-size: 11px; color: var(--muted); }
.field-sortable { display: grid; gap: 9px; }

.builder-field-card {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.builder-field-card > * { min-width: 0; }
.builder-field-card.dragging { opacity: .45; }
.drag-handle { border: 0; background: none; cursor: grab; color: var(--muted); padding: 4px; }
.field-type-icon { color: var(--gold); }
.builder-field-card label { display: grid; gap: 3px; min-width: 0; }
.builder-field-card label small { font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.builder-field-card input[data-field-label] { padding: 7px 10px; font-size: 13px; }
.builder-field-card .type-select select { padding: 7px 9px; font-size: 12px; }
.field-kind { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--canvas); padding: 4px 8px; border-radius: 999px; }
.required-toggle { display: flex !important; flex-direction: row; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.required-toggle input { width: 15px; height: 15px; accent-color: var(--forest-600); }
.field-remove { border: 0; background: none; color: var(--danger); cursor: pointer; padding: 5px; }

.builder-empty {
  display: grid; justify-items: center; gap: 5px; text-align: center;
  padding: 34px 16px; color: var(--muted); font-size: 13px;
}
.builder-empty i { font-size: 24px; color: var(--gold); }
.builder-empty strong { color: var(--ink); }

.builder-preview { display: grid; gap: 12px; }
.phone-preview {
  border: 1px solid var(--line); border-radius: 22px; background: var(--surface);
  padding: 24px 16px 16px; display: grid; gap: 9px; position: relative;
}
.phone-notch { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 52px; height: 4px; border-radius: 999px; background: var(--line); }
.preview-kicker { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.phone-preview > strong { font-size: 14px; line-height: 1.35; }
.phone-preview label { display: grid; gap: 4px; }
.phone-preview label span { font-size: 10px; font-weight: 700; color: var(--muted); }
.phone-preview label i { font-style: normal; font-size: 11px; color: #a8b2ad; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; }
.phone-preview > button {
  margin-top: 4px; padding: 9px; border: 0; border-radius: var(--radius-sm);
  background: var(--forest-800); color: #fff; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

.media-grid { align-items: start; }
.upload-card {
  display: flex !important; align-items: center; gap: 12px;
  padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius);
  cursor: pointer; background: var(--canvas);
}
.upload-card:hover { border-color: var(--forest-600); }
.upload-card > i { font-size: 22px; color: var(--gold); }
.upload-card span { display: grid; gap: 2px; }
.upload-card strong { font-size: 13px; }
.upload-card small { font-size: 11px; color: var(--muted); }
.upload-card input { display: none; }

.color-field > div { display: flex; align-items: center; gap: 10px; }
.color-field input[type="color"] { width: 52px; height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.color-field span { font-size: 12px; color: var(--muted); }

.save-bar {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.save-bar span { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------ Resultado - */

.audit-card {
  display: grid; gap: 16px;
  background: linear-gradient(125deg, var(--forest-900), var(--forest-600));
  color: #fff; border-radius: var(--radius-lg); padding: 24px;
}
.audit-card .overline { color: var(--gold); }
.audit-card h2 { font-size: 21px; display: flex; align-items: center; gap: 9px; margin: 5px 0 5px; }
.audit-card h2 i { color: var(--gold); }
.audit-card > div > p { color: rgba(255, 255, 255, .74); font-size: 13px; }
.audit-card dl { display: grid; gap: 12px; margin: 0; }
.audit-card dt { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.audit-card dd { margin: 4px 0 0; font-size: 13px; }
.audit-card code { font-family: ui-monospace, Menlo, monospace; font-size: 11px; word-break: break-all; color: rgba(255, 255, 255, .8); }

/* ---------------------------------------------------- Palco do resultado - */

.winner-stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: clamp(26px, 4vw, 46px);
  background: linear-gradient(140deg, #08241d 0%, var(--forest-800) 48%, #1c5a47 100%);
  color: #fff;
  box-shadow: var(--shadow-lg);
  animation: stage-in .6s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes stage-in { from { opacity: 0; transform: translateY(14px) scale(.99); } }

.stage-glow {
  position: absolute;
  width: 520px; height: 520px;
  right: -120px; top: -180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 170, 78, .34), transparent 68%);
  animation: stage-breathe 7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes stage-breathe { 50% { transform: scale(1.16); opacity: .78; } }

/* Confete puramente decorativo: 14 fitas caindo em tempos diferentes. */
.stage-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.stage-confetti span {
  position: absolute;
  top: -14px;
  left: calc(var(--i) * 7.1%);
  width: 7px; height: 13px;
  border-radius: 2px;
  opacity: 0;
  background: var(--gold);
  animation: confetti-fall 4.6s linear infinite;
  animation-delay: calc(var(--i) * 320ms);
}
.stage-confetti span:nth-child(3n) { background: #8fd0b4; width: 5px; height: 10px; }
.stage-confetti span:nth-child(4n) { background: #fff; opacity: .6; }
@keyframes confetti-fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 0; }
  12% { opacity: .95; }
  100% { transform: translateY(420px) rotate(540deg); opacity: 0; }
}

.stage-inner { position: relative; z-index: 1; display: grid; gap: 18px; }
.winner-stage .overline { color: var(--gold); }
.stage-prize { font-size: clamp(23px, 3.4vw, 34px); line-height: 1.2; }

.stage-partner {
  display: flex;
  align-items: center;
  gap: 14px;
  align-self: start;
  padding: 13px 20px 13px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(6px);
  animation: stage-in .6s .12s cubic-bezier(.2, .8, .3, 1) both;
}
.stage-partner img {
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 50%; object-fit: cover; background: #fff;
}
.stage-partner small { display: block; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .6); font-weight: 700; }
.stage-partner strong { font-size: 18px; }

.stage-winners { display: grid; grid-template-columns: repeat(auto-fit, minmax(276px, 1fr)); gap: 16px; margin-top: 4px; }

.stage-winner {
  position: relative;
  display: grid;
  gap: 9px;
  padding: 24px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(212, 170, 78, .42);
  animation: winner-reveal .62s cubic-bezier(.2, .8, .3, 1) both;
  animation-delay: var(--delay, 0ms);
}
@keyframes winner-reveal { from { opacity: 0; transform: translateY(20px) scale(.97); } }

.stage-position {
  position: absolute; right: 18px; top: 14px;
  font-size: 30px; font-weight: 800;
  color: rgba(212, 170, 78, .32);
}
.stage-winner h3 { font-size: clamp(20px, 2.6vw, 26px); line-height: 1.22; padding-right: 44px; }
.stage-detail { font-size: 13px; line-height: 1.65; color: rgba(255, 255, 255, .74); }
.stage-origin { display: inline-flex; align-items: center; gap: 6px; color: var(--gold); }

.stage-voucher {
  margin-top: 6px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, .28);
  display: grid; gap: 3px;
}
.stage-voucher small { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.stage-voucher strong { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 19px; letter-spacing: .07em; overflow-wrap: anywhere; }
.stage-voucher span { font-size: 11.5px; color: rgba(255, 255, 255, .58); }

.stage-ticket {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: rgba(255, 255, 255, .55);
  font-family: ui-monospace, Menlo, monospace;
}

/* --------------------------------------------------------------- Diálogos - */

dialog { border: 0; padding: 0; background: transparent; }
dialog::backdrop { background: rgba(11, 30, 24, .58); backdrop-filter: blur(3px); }

/* O navegador esconde um <dialog> fechado com display:none. Como as regras
   abaixo definem display:grid direto no elemento, isso era anulado e o
   diálogo continuava visível depois de fechar — e, como o body é flex, ele
   virava um item na lateral da tela. Esta regra devolve o comportamento. */
dialog:not([open]) { display: none !important; }

.premium-dialog, .custom-field-dialog > div, .avatar-crop-dialog > div {
  width: min(460px, calc(100vw - 32px));
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 26px;
  display: grid;
  gap: 13px;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.premium-dialog form { display: grid; gap: 13px; }
.premium-dialog h3, .custom-field-dialog h3, .avatar-crop-dialog h3 { font-size: 19px; }
.premium-dialog p, .custom-field-dialog p { font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.premium-dialog > div:last-child,
.premium-dialog form > div:last-child,
.custom-field-dialog > div > div:last-child,
.avatar-crop-dialog > div > div:last-child { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.dialog-icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--warning-soft); color: var(--warning); font-size: 21px;
}
.dialog-close { position: absolute; right: 14px; top: 14px; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 17px; }
.reroll-dialog label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.avatar-crop-dialog { width: min(480px, calc(100vw - 32px)); }
.avatar-crop-dialog canvas { width: 100%; max-width: 380px; aspect-ratio: 1; border-radius: 50%; background: var(--canvas); cursor: grab; justify-self: center; touch-action: none; }
.avatar-crop-dialog canvas.dragging { cursor: grabbing; }
.avatar-crop-dialog label { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }

/* ----------------------------------------------------------------- Toasts - */

.toast-tray { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: grid; gap: 9px; max-width: min(380px, calc(100vw - 36px)); }
.admin-toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px; border-radius: var(--radius);
  background: var(--forest-900); color: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px); opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
  font-size: 13.5px;
}
.admin-toast.show { transform: none; opacity: 1; }
.admin-toast.error { background: var(--danger); }
.admin-toast i:first-child { color: var(--gold); font-size: 17px; }
.admin-toast.error i:first-child { color: #fff; }
.admin-toast span { flex: 1; }
.admin-toast button { border: 0; background: none; color: rgba(255, 255, 255, .65); cursor: pointer; padding: 3px; }

.spa-loading .admin-content { opacity: .5; pointer-events: none; transition: opacity .14s ease; }
.spa-loading::after {
  content: ""; position: fixed; inset: 0 auto auto 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--gold), var(--forest-600), var(--gold));
  background-size: 200% 100%; animation: spa-progress .9s linear infinite; z-index: 99;
}
@keyframes spa-progress { to { background-position: -200% 0; } }

/* ------------------------------------------------------------ Animações - */

/* Entrada escalonada dos cards: dá ritmo à página sem atrasar a leitura. */
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } }

.metric-deck article,
.campaign-tile,
.participant-card,
.link-card,
.association-card,
.admin-user-card,
.panel { animation: rise-in .38s ease-out both; }

.metric-deck article:nth-child(2) { animation-delay: .05s; }
.metric-deck article:nth-child(3) { animation-delay: .1s; }
.metric-deck article:nth-child(4) { animation-delay: .15s; }

.participant-card-grid > *:nth-child(2), .link-list > *:nth-child(2), .association-list > *:nth-child(2) { animation-delay: .04s; }
.participant-card-grid > *:nth-child(3), .link-list > *:nth-child(3), .association-list > *:nth-child(3) { animation-delay: .08s; }
.participant-card-grid > *:nth-child(4), .link-list > *:nth-child(4), .association-list > *:nth-child(4) { animation-delay: .12s; }
.participant-card-grid > *:nth-child(n+5) { animation-delay: .16s; }

/* As barras do gráfico crescem a partir da base. */
.timeline-bar { animation: bar-grow .6s cubic-bezier(.2, .8, .3, 1) both; transform-origin: bottom; }
@keyframes bar-grow { from { transform: scaleY(0); opacity: .3; } }
.timeline-chart > div:nth-child(2) .timeline-bar { animation-delay: .03s; }
.timeline-chart > div:nth-child(3) .timeline-bar { animation-delay: .06s; }
.timeline-chart > div:nth-child(4) .timeline-bar { animation-delay: .09s; }
.timeline-chart > div:nth-child(5) .timeline-bar { animation-delay: .12s; }
.timeline-chart > div:nth-child(n+6) .timeline-bar { animation-delay: .15s; }

.rank-bar span { animation: bar-slide .7s cubic-bezier(.2, .8, .3, 1) both; transform-origin: left; }
@keyframes bar-slide { from { transform: scaleX(0); } }

.campaign-progress span { animation: bar-slide .8s .1s cubic-bezier(.2, .8, .3, 1) both; transform-origin: left; }

/* Diálogos entram junto com o fundo escurecido. */
dialog[open] { animation: dialog-in .24s cubic-bezier(.2, .8, .3, 1); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
dialog[open]::backdrop { animation: backdrop-in .24s ease; }
@keyframes backdrop-in { from { opacity: 0; } }

/* Realce sutil ao passar o mouse nos elementos acionáveis. */
.button, .palette-grid button, .permission-grid label, .kanban-column, .metric-deck article {
  transition: transform .16s ease, box-shadow .18s ease, border-color .16s ease, background .16s ease;
}
.metric-deck article:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.metric-orb { transition: transform .22s cubic-bezier(.2, .8, .3, 1); }
.metric-deck article:hover .metric-orb { transform: scale(1.08) rotate(-4deg); }

.sidebar nav a { position: relative; }
.sidebar nav a::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 3px; height: 0;
  border-radius: 0 3px 3px 0;
  background: var(--gold);
  transform: translateY(-50%);
  transition: height .2s ease;
}
.sidebar nav a.active::before { height: 60%; }

.status-pill, .winner-badge, .count-badge { transition: transform .16s ease; }
.participant-card:hover .status-pill { transform: scale(1.04); }

details.inline-editor .admin-form,
details.user-editor .admin-form { animation: rise-in .28s ease-out both; }

.flash { animation: rise-in .32s ease-out both; }

.entry-action { justify-self: start; }

/* ------------------------------------------------------------ Responsivo - */

@media (max-width: 1180px) {
  .builder-layout { grid-template-columns: 210px minmax(0, 1fr); }
  .builder-preview { display: none; }
  .insight-row { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1024px) {
  .split-layout { grid-template-columns: minmax(0, 1fr); }
  .sticky-panel { position: static; }
  .campaign-kanban { grid-template-columns: minmax(0, 1fr); }
  .login-card { grid-template-columns: minmax(0, 1fr); }
  .login-brand { padding: 30px; }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .24s ease; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .admin-shell { width: 100%; margin-left: 0; }
  .menu-button { display: grid; place-items: center; }
  .form-grid, .form-grid.three { grid-template-columns: minmax(0, 1fr); }
  .builder-layout { grid-template-columns: minmax(0, 1fr); }
  .builder-field-card { grid-template-columns: auto minmax(0, 1fr) auto; row-gap: 8px; }
  .builder-field-card .field-type-icon { display: none; }
  .filter-grid .search-field { grid-column: span 1; }
  .link-stats { grid-template-columns: minmax(0, 1fr); }
  .link-stats > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .dynamic-value-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 620px) {
  /* O título precisa de uma linha só para ele; senão o botão de ação o espreme. */
  .topbar { flex-wrap: wrap; }
  .topbar > div { flex: 1 1 100%; order: -1; }
}

@media (max-width: 560px) {
  .participant-card-grid { grid-template-columns: minmax(0, 1fr); }
  .builder-field-card { grid-template-columns: auto minmax(0, 1fr) auto; }
  .builder-field-card > label { grid-column: 1 / -1; }
  .builder-feature-badge { display: none; }
  .timeline-chart { gap: 3px; }
  .timeline-chart > div small { display: none; }
  .timeline-chart > div:nth-child(3n + 1) small { display: block; font-size: 8px; }
  .toast-tray { left: 18px; right: 18px; max-width: none; }
}

/* Quem pediu menos movimento no sistema recebe a interface estática. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .stage-confetti { display: none; }
}

@media print {
  .sidebar, .topbar, .save-bar, .toast-tray, .filter-bar, .link-actions { display: none !important; }
  .admin-shell { width: 100%; margin: 0; }
  body { background: #fff; }
}
