:root {
  --bg: #f6f5fa;
  --card: #ffffff;
  --text: #1d1b26;
  --muted: #615d70;
  --line: #e4e1ee;
  --accent: #7c3aed;
  --accent-dark: #6527cc;
  --accent-soft: #f1eafe;
  --ok: #157f4b;
  --ok-soft: #e5f6ec;
  --warn: #9a5b00;
  --warn-soft: #fff4dc;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14121b;
    --card: #1e1b28;
    --text: #f1eff7;
    --muted: #aba6bc;
    --line: #322e40;
    --accent: #a477ff;
    --accent-dark: #b893ff;
    --accent-soft: #2a2140;
    --ok: #58d08f;
    --ok-soft: #173225;
    --warn: #f3b74f;
    --warn-soft: #33270f;
    --bad: #ff8a80;
    --bad-soft: #3a1c1a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.page { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
.page.narrow { max-width: 560px; }

.brand {
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--accent);
  margin-bottom: 20px;
}

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.topbar .who { color: var(--muted); font-size: 14px; }

h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 0 0 4px; }
h3 { font-size: 16px; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.fact { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; }
.fact .label { font-size: 13px; color: var(--muted); }
.fact .value { font-weight: 600; overflow-wrap: anywhere; }

.steps { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps .num {
  flex: 0 0 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px;
}
.steps .done .num { background: var(--ok-soft); color: var(--ok); }
.steps .current .num { background: var(--accent); color: #fff; }
.steps .current { font-weight: 600; }

.trust { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 560px) { .trust { grid-template-columns: minmax(0, 1fr); } }
.trust ul { margin: 0; padding-left: 20px; }
.trust li { margin-bottom: 6px; }
.yes h3 { color: var(--ok); }
.no h3 { color: var(--bad); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border-radius: 10px; border: 0;
  background: var(--accent); color: #fff;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--accent-dark); }
.button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.button.secondary:hover { background: var(--accent-soft); }
.button[disabled] { opacity: .6; cursor: progress; }
.button.big { width: 100%; min-height: 52px; font-size: 17px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.notice { border-radius: 10px; padding: 12px 14px; margin: 12px 0 0; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.info { background: var(--accent-soft); color: var(--text); }

.badge {
  display: inline-block; font-size: 13px; font-weight: 600;
  padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

ol.howto { padding-left: 20px; margin: 8px 0 0; }
ol.howto li { margin-bottom: 4px; }

.hidden { display: none !important; }
footer { color: var(--muted); font-size: 13px; text-align: center; margin-top: 24px; }
footer a { color: inherit; }

/* Panel de administración */
.page.wide { max-width: 1000px; }
.narrow-card { max-width: 560px; margin-left: auto; margin-right: auto; }
.org-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.org-bar p { margin: 0 0 4px; }

select, input[type="text"], input[readonly] {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px;
  min-height: 42px; padding: 0 12px; max-width: 100%;
}
select:disabled { opacity: 1; appearance: none; border-color: transparent; padding-left: 0; font-weight: 600; }

.table-wrap { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
td:last-child { text-align: right; }

.button.small-button { min-height: 34px; padding: 0 12px; font-size: 14px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; }
h3.spaced { margin-top: 20px; }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }

ul.audit { list-style: none; padding: 0; margin: 12px 0 0; }
ul.audit li { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 560px) { ul.audit li { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* Panel completo */
.admin-header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 24px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.admin-left, .admin-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.admin-header .brand { margin: 0; text-decoration: none; }
.admin-nav { display: flex; gap: 4px; }
.admin-nav a, .tabs a {
  color: var(--muted); text-decoration: none; font-weight: 600;
  padding: 6px 12px; border-radius: 8px;
}
.admin-nav a:hover, .tabs a:hover { background: var(--accent-soft); color: var(--text); }
.admin-nav a.active, .tabs a.active { background: var(--accent-soft); color: var(--accent); }
.admin-right a { color: var(--muted); }

.page-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.page-title h1 { margin-bottom: 4px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.section-head h2, .section-head h3 { margin-bottom: 2px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 16px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.tabs a { white-space: nowrap; }
.tabs .count {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px;
  background: var(--bad); color: #fff; font-size: 12px; text-align: center;
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat .hint { font-size: 13px; color: var(--muted); }

.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist .mark {
  flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; background: var(--warn-soft); color: var(--warn);
}
.checklist .ok .mark { background: var(--ok-soft); color: var(--ok); }

a.raffle-card { display: block; color: inherit; text-decoration: none; transition: border-color .15s; }
a.raffle-card:hover { border-color: var(--accent); }
.raffle-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.raffle-card-facts { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14px; color: var(--muted); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 12px 0; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.field-label { font-weight: 600; font-size: 14px; }
.field-hint { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; min-height: 42px; padding: 8px 12px; width: 100%;
}
.field input:disabled { background: var(--bg); color: var(--muted); }
input[type="search"], input[type="number"], input[type="datetime-local"] {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; min-height: 42px; padding: 0 12px;
}

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.filters input[type="search"] { flex: 1; min-width: 180px; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 12px; }
.pager:empty { display: none; }

th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.zero { color: var(--muted); opacity: .6; }
td.strong { font-weight: 700; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--accent-soft); }
tr.dimmed td, .card.dimmed { opacity: .6; }
td.row-actions { white-space: nowrap; }
td.row-actions .button { margin-left: 6px; }

.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.muted-badge { background: var(--line); color: var(--muted); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.button.danger { background: var(--bad); }
.button.danger:hover { filter: brightness(.92); background: var(--bad); }
.button.danger-text { color: var(--bad); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline-line { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.timeline .history { margin-left: 12px; margin-top: 4px; }
.card.incident h3 { margin-bottom: 2px; }

.back-link { color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--accent); }
.badge { white-space: nowrap; }
td[colspan] { text-align: center; }
.discord-history-title { margin: 20px 0 0; font-size: 15px; }
.field input[type="time"], .field input[type="password"] { font: inherit; }
ul.audit li.empty { display: block; }
.hash-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0 8px; }
code.hash { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; overflow-wrap: anywhere; flex: 1; min-width: 0; }
code.hash-short { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
#export-list a, #final-body a { color: var(--accent); }
#final-body p code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--bg); border-radius: 4px; padding: 1px 4px; }
fieldset.rules { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 4px; margin: 12px 0; display: grid; gap: 10px; }
fieldset.rules legend { padding: 0 6px; }
.check-field { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding-bottom: 6px; }
.check-field input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.check-field > span { display: flex; flex-direction: column; gap: 2px; }
.rule-line { margin: 0 0 12px; }
