/* Cores oficiais CREFITO-14 (crefito14.org.br) */
:root {
  --green: #007132;
  --green-dark: #003417;
  --green-deep: #002410;
  --orange: #fe9230;
  --orange-2: #ffb300;
  --on-orange: #1a1206;
  --danger: #c62828;

  --bg: #eef3ef;
  --card: #ffffff;
  --text: #13261b;
  --muted: #4d5f55;
  --border: #d5e2d9;
  --hover: #f1f7f3;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(0, 52, 23, .08);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07140c;
    --card: #0f2118;
    --text: #e8f2ec;
    --muted: #a6bcae;
    --border: #22402f;
    --hover: #163023;
    --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- Topo ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px clamp(16px, 3vw, 32px);
  background: var(--green-dark);
  border-bottom: 4px solid var(--orange);
}
.brand img { height: clamp(36px, 5vw, 56px); width: auto; max-width: 70vw; object-fit: contain; display: block; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px;
  font: 600 16px/1.2 var(--font);
  border-radius: 12px; border: 2px solid transparent;
  cursor: pointer; transition: background-color .2s, color .2s, border-color .2s, transform .15s, box-shadow .2s;
  text-decoration: none; user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--orange); outline-offset: 2px;
}
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #005a28; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover:not(:disabled) { border-color: var(--green); background: var(--hover); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-ghost-dark { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.25); }
.btn-ghost-dark:hover { background: rgba(255,255,255,.18); }
.btn-small { min-height: 40px; padding: 6px 12px; font-size: 14px; }
.btn-icon { min-height: 44px; min-width: 44px; padding: 0; border-radius: 10px; background: transparent; color: var(--muted); }
.btn-icon:hover { background: var(--hover); color: var(--text); }
.btn-icon.del:hover { color: var(--danger); }
@media (prefers-color-scheme: dark) { .btn-danger { color: #ff8a80; } }
.file-btn input { display: none; }

/* ---------- Layout ---------- */
.layout {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 24px;
  padding: 24px clamp(16px, 3vw, 32px); max-width: 1500px; margin: 0 auto;
}
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }

/* ---------- Palco ---------- */
.stage {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  min-height: 560px; padding: 40px 24px;
  border-radius: 24px; color: #fff; text-align: center;
  background:
    radial-gradient(circle at 85% 15%, rgba(254,146,48,.25), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(255,255,255,.08), transparent 40%),
    linear-gradient(150deg, var(--green) 0%, var(--green-dark) 70%, var(--green-deep) 100%);
  box-shadow: var(--shadow);
  align-self: start; position: sticky; top: 16px;
}
@media (max-width: 960px) { .stage { position: relative; top: 0; min-height: 460px; } }
.stage::after { /* faixa laranja como nos posts oficiais */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8px;
  background: linear-gradient(90deg, var(--orange-2), var(--orange));
}
.stage-logo { display: none; height: 72px; max-width: 80%; object-fit: contain; }
.stage-kicker { margin: 0; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; color: var(--orange); font-size: 15px; }
.display {
  font-size: clamp(32px, 6vw, 76px); font-weight: 800; line-height: 1.1;
  max-width: 100%; overflow-wrap: anywhere; min-height: 1.2em;
  text-shadow: 0 4px 24px rgba(0,0,0,.25);
}
.display.shuffling { opacity: .9; }
.display.winner {
  color: var(--orange-2);
  background: linear-gradient(90deg, var(--orange-2), var(--orange));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: pop .6s cubic-bezier(.2, 1.4, .4, 1);
  filter: drop-shadow(0 6px 24px rgba(254,146,48,.45));
  text-shadow: none;
}
.stage-sub { margin: 0; font-size: 18px; color: rgba(255,255,255,.85); min-height: 1.5em; }
/* Contagem com anel de progresso */
.countdown { position: relative; width: 140px; height: 140px; display: none; place-items: center; }
.countdown.show { display: grid; }
.countdown svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.countdown circle { fill: none; stroke-width: 8; }
.ring-bg { stroke: rgba(255,255,255,.15); }
.ring { stroke: var(--orange); stroke-linecap: round; stroke-dasharray: 339.3; stroke-dashoffset: 0; }
.ring.run { animation: ring 1s linear forwards; }
@keyframes ring { to { stroke-dashoffset: 339.3; } }
.countdown span { font-size: 72px; font-weight: 900; line-height: 1; color: var(--orange); }
.countdown span.tick { animation: tick 1s ease-out; }
@keyframes tick {
  0% { transform: scale(1.8); opacity: 0; }
  25% { transform: scale(1); opacity: 1; }
  85% { opacity: 1; }
  100% { transform: scale(.7); opacity: .2; }
}

/* Brilhos de fundo (estáticos) */
.glow { position: absolute; border-radius: 50%; filter: blur(60px); pointer-events: none; opacity: .5; }
.g1 { width: 320px; height: 320px; background: var(--orange); top: -140px; right: -100px; opacity: .25; }
.g2 { width: 380px; height: 380px; background: #2dce89; bottom: -200px; left: -140px; opacity: .15; }
.stage > *:not(.glow) { position: relative; }

/* Prêmio */
.prize {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 20px; border-radius: 999px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); font-weight: 700; font-size: 18px;
  max-width: 100%;
}
.prize .ic { color: var(--orange); }
.prize span { overflow-wrap: anywhere; }
.prize[hidden] { display: none; }

/* Nome + raios de luz */
.display-wrap { position: relative; display: grid; place-items: center; width: 100%; min-height: 1.4em; }
.rays {
  position: absolute; left: 50%; top: 50%; width: 900px; height: 900px; margin: -450px 0 0 -450px;
  background: repeating-conic-gradient(from 0deg, rgba(255,179,0,.16) 0deg 10deg, transparent 10deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 0%, transparent 60%); mask: radial-gradient(circle, #000 0%, transparent 60%);
  opacity: 0; transform: scale(.4); transition: opacity .6s, transform .8s cubic-bezier(.2, 1, .3, 1);
  pointer-events: none;
}
.rays.on { opacity: 1; transform: scale(1) rotate(30deg); animation: spin 8s linear 1 forwards; }
@keyframes spin { from { rotate: 0deg; } to { rotate: 120deg; } }
.display.flip { animation: slot .09s ease-out; }
@keyframes slot { from { transform: translateY(-40%); opacity: .3; } to { transform: none; opacity: 1; } }

/* Vencedores da rodada */
.round-winners { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 100%; }
.round-winners:empty { display: none; }
.round-winners li {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px;
  background: rgba(255,255,255,.12); font-weight: 600; animation: pop .45s cubic-bezier(.2, 1.4, .4, 1);
}
.round-winners b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--orange); color: var(--on-orange); font-size: 14px; }

.kbd-hint { display: none; margin: 0; color: rgba(255,255,255,.7); font-size: 15px; }
kbd { font: 600 13px var(--font); padding: 2px 8px; border-radius: 6px; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3); }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.btn-draw {
  margin-top: 8px; min-height: 72px; padding: 16px 48px; font-size: 26px; font-weight: 800;
  border-radius: 999px; background: linear-gradient(90deg, var(--orange-2), var(--orange)); color: var(--on-orange);
  box-shadow: 0 10px 30px rgba(254,146,48,.4);
}
.btn-draw .ic { width: 30px; height: 30px; }
.btn-draw:hover:not(:disabled) { box-shadow: 0 14px 40px rgba(254,146,48,.6); transform: translateY(-2px); }
.btn-draw:disabled { opacity: .6; }

.stage-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 24px; margin-top: 8px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; min-height: 44px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 48px; height: 28px; border-radius: 999px; background: rgba(255,255,255,.25); position: relative; transition: background-color .2s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .track { background: var(--orange); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid #fff; outline-offset: 2px; }
.switch input:disabled ~ * { opacity: .6; }

.btn-exit-full { display: none; }

/* ---------- Modo telão ---------- */
body.presenting .topbar, body.presenting .side { display: none; }
body.presenting .layout { display: block; padding: 0; max-width: none; }
body.presenting .stage { position: fixed; inset: 0; border-radius: 0; min-height: 100vh; gap: 24px; }
body.presenting .stage-logo { display: block; height: clamp(70px, 12vh, 140px); margin-bottom: 2vh; }
body.presenting .display { font-size: clamp(48px, 9vw, 160px); }
body.presenting .stage-kicker { font-size: clamp(16px, 1.6vw, 26px); }
body.presenting .stage-sub { font-size: clamp(18px, 1.8vw, 30px); }
body.presenting .countdown { width: clamp(150px, 22vh, 240px); height: clamp(150px, 22vh, 240px); }
body.presenting .countdown span { font-size: clamp(80px, 13vh, 140px); }
body.presenting .prize { font-size: clamp(18px, 2vw, 30px); padding: 10px 28px; }
body.presenting .round-winners li { font-size: clamp(16px, 1.6vw, 26px); }
body.presenting .kbd-hint { display: block; }
body.presenting .btn-draw { font-size: clamp(26px, 2.4vw, 40px); min-height: 88px; padding: 18px 64px; }
body.presenting .btn-exit-full {
  display: inline-flex; position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.25);
}

/* ---------- Cartões ---------- */
.side { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card h2 { margin: 0; font-size: 20px; color: var(--text); }
.pill { background: var(--green); color: #fff; font-weight: 700; border-radius: 999px; padding: 4px 14px; font-size: 16px; }

input[type=text], textarea, select {
  width: 100%; font: 16px/1.4 var(--font); color: var(--text); background: var(--bg);
  border: 2px solid var(--border); border-radius: 12px; padding: 12px 14px; min-height: 48px;
}
input[type=text]:focus, textarea:focus, select:focus { border-color: var(--green); }
textarea { resize: vertical; margin: 10px 0; }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; min-width: 0; }
@media (max-width: 420px) { .add-row { flex-direction: column; } }

.paste { margin: 12px 0; }
.paste summary { cursor: pointer; font-weight: 600; color: var(--green); padding: 8px 0; min-height: 44px; display: flex; align-items: center; }
@media (prefers-color-scheme: dark) { .paste summary { color: #5fd18f; } }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.hint { color: var(--muted); font-size: 14px; margin: 12px 0 6px; }
.empty { color: var(--muted); text-align: center; padding: 16px 0; margin: 0; }

.list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; border-top: 1px solid var(--border); }
.list li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--border); min-height: 56px; }
.list .num { color: var(--muted); font-size: 14px; width: 2.5em; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.list .name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.list li.drawn .name { color: var(--muted); text-decoration: line-through; }
.list .tag { font-size: 12px; font-weight: 700; color: var(--on-orange); background: var(--orange); border-radius: 999px; padding: 2px 10px; flex-shrink: 0; }
.list input { flex: 1; min-height: 44px; padding: 8px 10px; }

.history { margin: 0; padding: 0; list-style: none; counter-reset: h; max-height: 320px; overflow-y: auto; }
.history li { display: flex; gap: 12px; align-items: baseline; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.history li::before { content: attr(data-n) "º"; font-weight: 800; color: var(--orange); min-width: 2.2em; }
.history .hn { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.history .ht { color: var(--muted); font-size: 14px; white-space: nowrap; }

/* ---------- Estatísticas no topo ---------- */
.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat {
  display: flex; flex-direction: column; align-items: center; min-width: 96px; padding: 6px 14px; border-radius: 12px;
  background: rgba(255,255,255,.07); color: rgba(255,255,255,.8); font-size: 13px; line-height: 1.2;
  border: 1px solid rgba(255,255,255,.12); font-family: inherit; cursor: pointer;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.stat:hover { transform: translateY(-2px); background: rgba(255,255,255,.14); border-color: rgba(254,146,48,.7); box-shadow: 0 8px 22px rgba(0,0,0,.14); }
.stat:active { transform: translateY(0) scale(.97); }
.stat:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
.stat strong { font-size: 22px; color: #fff; font-variant-numeric: tabular-nums; }
.stat:nth-child(2) strong { color: var(--orange); }
.stat strong.bump { animation: pop .35s ease-out; }
@media (max-width: 700px) { .stats { order: 3; width: 100%; } .stat { flex: 1; min-width: 0; } }

/* ---------- Listas abertas pelos contadores ---------- */
.stats-dialog { width: min(680px, calc(100vw - 24px)); max-width: none; max-height: min(85dvh, 780px); overflow: hidden; border-radius: 24px; }
.stats-dialog::backdrop { background: rgba(0, 26, 12, .72); backdrop-filter: blur(5px); }
.stats-modal { display: flex; flex-direction: column; max-height: min(85dvh, 780px); }
.stats-modal-head {
  display: flex; justify-content: space-between; align-items: start; gap: 16px; padding: 24px 26px 22px;
  color: #fff; background: radial-gradient(circle at 92% 12%, rgba(254,146,48,.32), transparent 32%), linear-gradient(130deg, var(--green) 0%, var(--green-dark) 100%);
  border-bottom: 5px solid var(--orange); flex: none;
}
.stats-eyebrow { margin: 0 0 5px; color: #ffc078; font-size: 11px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.stats-modal-head h2 { margin: 0; font-size: clamp(24px, 4vw, 34px); line-height: 1.1; }
.stats-modal-head p:last-child { margin: 9px 0 0; color: rgba(255,255,255,.82); font-size: 14px; }
.stats-close { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.35); border-radius: 12px; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; }
.stats-close:hover { background: rgba(255,255,255,.24); }
.stats-close:focus-visible, .stats-tabs button:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.stats-modal-body { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow: hidden; padding: 20px 26px 18px; }
.stats-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 5px; border: 1px solid var(--border); border-radius: 15px; background: var(--bg); }
.stats-tabs button { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; min-height: 42px; padding: 6px 8px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font: 700 14px var(--font); cursor: pointer; transition: background-color .18s, color .18s, box-shadow .18s; }
.stats-tabs button:hover { color: var(--text); background: var(--hover); }
.stats-tabs button[aria-pressed="true"] { color: #fff; background: var(--green); box-shadow: 0 4px 12px rgba(0,113,50,.2); }
.stats-tabs button span { min-width: 22px; padding: 1px 5px; border-radius: 999px; background: rgba(0,0,0,.08); font-size: 11px; font-variant-numeric: tabular-nums; }
.stats-tabs button[aria-pressed="true"] span { background: rgba(255,255,255,.2); }
.stats-search { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 0 13px; border: 2px solid var(--border); border-radius: 13px; background: var(--card); color: var(--muted); }
.stats-search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 15%, transparent); }
.stats-search input { flex: 1; min-width: 0; min-height: 46px; padding: 8px 0; border: 0; outline: none; background: transparent; color: var(--text); font: 16px var(--font); }
.stats-result-count { margin: 14px 0 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.stats-list { flex: 1 1 auto; min-height: 0; margin: 0; padding: 0 4px 0 0; list-style: none; overflow-y: auto; scrollbar-color: var(--border) transparent; }
.stats-list li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 56px; margin-bottom: 6px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); transition: transform .16s, border-color .16s, background-color .16s; }
.stats-list li:hover { transform: translateX(2px); border-color: color-mix(in srgb, var(--green) 50%, var(--border)); background: var(--hover); }
.stats-list-number { color: var(--green); font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stats-list-name { min-width: 0; overflow-wrap: anywhere; font-weight: 650; }
.stats-list-badge { padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.stats-list-badge.is-eligible { color: var(--green-dark); background: #d9f2e3; }
.stats-list-badge.is-drawn { color: #784009; background: #fff0cf; }
.stats-empty { margin: 4px 0; padding: 28px 14px; border: 1px dashed var(--border); border-radius: 13px; color: var(--muted); text-align: center; }
.stats-footnote { margin: 13px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
@media (max-width: 480px) {
  .stat { padding: 7px 4px; font-size: 11px; }
  .stat strong { font-size: 20px; }
  .stats-dialog { max-height: 88dvh; border-radius: 19px; }
  .stats-modal { max-height: 88dvh; }
  .stats-modal-head { padding: 19px 18px 17px; }
  .stats-modal-body { padding: 15px 14px 14px; }
  .stats-tabs button { flex-direction: column; gap: 2px; font-size: 11px; line-height: 1.1; }
  .stats-list li { grid-template-columns: 27px minmax(0, 1fr); gap: 4px 7px; padding: 9px 10px; }
  .stats-list-badge { grid-column: 2; justify-self: start; }
}

/* ---------- Rodada ---------- */
.field + .field { margin-top: 14px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.btn-step { width: 48px; padding: 0; }
.stepper output { min-width: 56px; text-align: center; font-size: 26px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg); border: 2px solid var(--border); }
.segmented button {
  min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--text);
  font: 700 16px var(--font); cursor: pointer; transition: background-color .2s, color .2s;
}
.segmented button:hover:not(:disabled) { background: var(--hover); }
.segmented button[aria-checked="true"] { background: var(--green); color: #fff; }
.segmented button:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.segmented button:disabled { opacity: .5; cursor: not-allowed; }
.segmented.off { opacity: .55; }

/* ---------- Busca ---------- */
.search { position: relative; margin-top: 14px; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; font: 16px/1.4 var(--font); color: var(--text); background: var(--bg);
  border: 2px solid var(--border); border-radius: 12px; padding: 12px 14px 12px 44px; min-height: 48px;
}
.search input:focus { border-color: var(--green); }
.list li.new { animation: rise .3s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.list li.hit { background: color-mix(in srgb, var(--orange) 18%, transparent); transition: background-color 1.2s; }
mark { background: color-mix(in srgb, var(--orange) 45%, transparent); color: inherit; border-radius: 3px; }
.head-actions { display: flex; gap: 8px; }
.history .hp { display: block; color: var(--muted); font-size: 14px; font-weight: 500; }
.history .hwrap { flex: 1; min-width: 0; }

/* ---------- Diálogo ---------- */
dialog { border: none; border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(0, 36, 16, .6); }
.dlg { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.dlg h2 { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.preview { margin: 0; padding: 8px 12px 8px 32px; background: var(--bg); border-radius: 12px; max-height: 180px; overflow: auto; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- Toast e confetes ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--green-dark); color: #fff; padding: 14px 22px; border-radius: 12px; border-left: 5px solid var(--orange);
  box-shadow: 0 10px 30px rgba(0,0,0,.3); max-width: calc(100vw - 32px); transition: opacity .25s, transform .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast { display: flex; align-items: center; gap: 16px; }
.toast-btn {
  font: 700 15px var(--font); color: var(--orange); background: transparent; border: 2px solid var(--orange);
  border-radius: 10px; min-height: 40px; padding: 6px 14px; cursor: pointer; flex-shrink: 0;
}
.toast-btn:hover { background: var(--orange); color: var(--on-orange); }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
