:root {
  --bg: #faf7f4; --card: #ffffff; --ink: #1f1a17; --muted: #6f6660; --line: #ebe4dd;
  --brand: #e2475a; --brand-ink: #ffffff; --brand-soft: #fde8ea; --ok: #1f8a5b; --ok-soft: #e3f4ec;
  --warn: #a86a00; --warn-soft: #fff3d9; --bad: #c0352b; --bad-soft: #fde5e2; --field: #ffffff;
  --shadow: 0 1px 2px rgba(31, 26, 23, .06), 0 6px 20px rgba(31, 26, 23, .06); --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161312; --card: #211c1a; --ink: #f3ece6; --muted: #a99f97; --line: #362f2b;
    --brand: #ff6274; --brand-soft: #3a2125; --ok: #4cc28d; --ok-soft: #1b3128; --warn: #f0b44c; --warn-soft: #3a2f17;
    --bad: #ff7a6e; --bad-soft: #3d1f1c; --field: #1a1614; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); letter-spacing: -.02em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 640px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.center { justify-content: center; }
.mt { margin-top: 18px; }
.stack > * + * { margin-top: 12px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; word-break: break-all; }

/* header */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo svg { width: 26px; height: 26px; fill: var(--brand); }
.nav { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.nav a { color: var(--ink); padding: 8px 10px; border-radius: 10px; font-weight: 500; }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a { white-space: nowrap; }
@media (max-width: 560px) { .nav .hide-sm { display: none; } .nav a { padding: 8px 6px; font-size: .92rem; } .top .wrap { gap: 8px; } }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 10px 16px; border-radius: 12px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.bad { color: var(--bad); }
.btn.sm { padding: 6px 10px; font-size: .875rem; border-radius: 9px; }
.btn.block { width: 100%; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
input, textarea, select { width: 100%; font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
input[type=checkbox] { width: auto; }
textarea { min-height: 120px; resize: vertical; }
.field { margin-bottom: 14px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.ccard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); color: var(--ink); display: flex; flex-direction: column; }
.ccard:hover { text-decoration: none; transform: translateY(-2px); transition: transform .15s; }
.ccard .ph { aspect-ratio: 4 / 3; background: var(--line); object-fit: cover; width: 100%; }
.ccard .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.ccard h3 { margin: 0; }
.ccard .ex { color: var(--muted); font-size: .9rem; flex: 1; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.tag.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; width: 0; }
.stat { font-size: .9rem; }
.stat b { font-size: 1.05rem; }

/* home */
.hero { padding: 48px 0 28px; display: grid; gap: 28px; grid-template-columns: 1.2fr 1fr; align-items: center; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); }
.how { display: grid; gap: 12px; }
.how .step { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.how .n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; }
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; padding-top: 28px; } }
.section { margin: 36px 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 6px 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: .9rem; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.totals { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 8px; }
.totals b { display: block; font-size: 1.4rem; }

/* campaign page */
.cgrid { display: grid; gap: 28px; grid-template-columns: 1fr 360px; margin: 28px 0; align-items: start; }
@media (max-width: 900px) { .cgrid { grid-template-columns: 1fr; } }
.hero-photo { border-radius: var(--radius); width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--line); }
.story { white-space: pre-wrap; }
.side { position: sticky; top: 76px; }
@media (max-width: 900px) { .side { position: static; } }
.big { font-size: 2rem; font-weight: 800; }
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.presets .chip { text-align: center; }
.list > div { padding: 10px 0; border-top: 1px solid var(--line); }
.list > div:first-child { border-top: 0; }
.share { display: flex; gap: 8px; flex-wrap: wrap; }

/* pay page */
.paybox { text-align: center; }
.qr { width: 200px; height: 200px; margin: 10px auto; background: #fff; padding: 8px; border-radius: 12px; }
.amount { font-size: 2.1rem; font-weight: 800; letter-spacing: -.01em; }
.copyline { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; text-align: left; }
.copyline .mono { flex: 1; font-size: .92rem; }
.notice { border-radius: 12px; padding: 12px 14px; font-size: .92rem; text-align: left; }
.notice.warn { background: var(--warn-soft); color: var(--ink); }
.notice.ok { background: var(--ok-soft); }
.notice.bad { background: var(--bad-soft); }
.notice.info { background: var(--brand-soft); }

/* dashboard & admin */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 20px 0; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brand); }
.tabs .count { background: var(--brand); color: #fff; border-radius: 99px; font-size: .72rem; padding: 1px 6px; margin-left: 4px; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.kpi span { color: var(--muted); font-size: .85rem; }
.kpi b { display: block; font-size: 1.45rem; margin-top: 2px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; }
.tablewrap { overflow-x: auto; }
.item { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item img { border-radius: 10px; aspect-ratio: 4 / 3; object-fit: cover; width: 120px; }
@media (max-width: 560px) { .item { grid-template-columns: 1fr; } .item img { width: 100%; } }
.pgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pick { border: 2px solid transparent; border-radius: 12px; overflow: hidden; background: var(--card); cursor: pointer; padding: 0; text-align: left; font: inherit; color: var(--ink); }
.pick img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.pick .cap { padding: 6px 8px; font-size: .85rem; display: flex; justify-content: space-between; gap: 6px; }
.pick.on { border-color: var(--brand); }
.reward { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; margin-bottom: 8px; }

/* toast & modal */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 50; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: #fff; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); padding: 20px; width: min(480px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.foot { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 40px; color: var(--muted); font-size: .88rem; }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }
