*, *::before, *::after { box-sizing: border-box; }
:root {
  --navy: #12235b;
  --navy-2: #1b3178;
  --navy-deep: #0d1a45;
  --navy-soft: #24387d;
  --orange: #e2551e;
  --orange-soft: #fbe9df;
  --bg: #f5f6fa;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e6e8ef;
  --green: #15803d;
  --red: #c02626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,64,.06), 0 10px 30px rgba(16,24,64,.06);
  --maxw: 1000px;
}

html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.loading { padding: 4rem; text-align: center; color: var(--muted); }
button { font: inherit; cursor: pointer; }
a { color: var(--navy-2); }
h1, h2, h3 { line-height: 1.25; }

input, select, textarea {
  font: inherit; width: 100%; padding: 9px 11px;
  border: 1px solid #ccd0dd; border-radius: 9px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy-2); outline-offset: 1px; border-color: var(--navy-2); }
textarea { min-height: 74px; resize: vertical; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border: 1px solid var(--navy); border-radius: 9px; background: var(--navy); color: #fff; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--navy-2); }
.btn.orange { background: var(--orange); border-color: var(--orange); }
.btn.orange:hover { filter: brightness(1.06); }
.btn.secondary { background: #fff; color: var(--navy); }
.btn.secondary:hover { background: #f1f3fa; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: #f1f3fa; }
.btn.danger { background: #fff; border-color: #f3c9c9; color: var(--red); }
.btn.danger:hover { background: #fdf0f0; }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- site header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 20;
  background: #fff; border-bottom: 1px solid var(--line);
}
.site-head .inner {
  max-width: var(--maxw); margin: 0 auto; padding: 10px 18px;
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand img { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.brand .txt { min-width: 0; }
.brand .name { font-weight: 800; color: var(--navy); letter-spacing: .01em; font-size: 15px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .sub { color: var(--orange); font-weight: 700; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.site-head .spacer { flex: 1; }

/* ---------- hero ---------- */
.hero {
  background:
    radial-gradient(1200px 300px at 15% -40%, rgba(226,85,30,.35), transparent 60%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #fff;
}
.hero .inner { max-width: var(--maxw); margin: 0 auto; padding: 20px 18px 22px; }
.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; }
.hero .campaign { font-size: 1.4rem; font-weight: 800; margin: 0 0 8px; }
.hero .raised-label { color: #b9c3e6; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.hero .raised { font-size: 2.1rem; font-weight: 800; margin: 1px 0 0; }
.hero .goal-row { color: #cfd6ef; font-size: 12.5px; margin-top: 5px; }
.bar { height: 9px; background: rgba(255,255,255,.16); border-radius: 999px; overflow: hidden; margin: 11px 0 3px; max-width: 460px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), #f6a02a); }
.hero-right { display: grid; gap: 10px; }
.hero-right .s { display: flex; justify-content: space-between; gap: 22px; align-items: baseline; border-left: 3px solid rgba(255,255,255,.18); padding-left: 12px; }
.hero-right .s .k { color: #b9c3e6; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.hero-right .s .v { font-size: 1.05rem; font-weight: 700; white-space: nowrap; }

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 18px 40px; width: 100%; flex: 1; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 18px 0 18px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 12px 15px; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; }
.tabs button.active { color: var(--navy); border-bottom-color: var(--orange); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; font-size: 1.12rem; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 130px; }
.filters .search { min-width: 200px; flex: 1; max-width: 320px; }

.msg-slot:empty { display: none; }
.msg { padding: 10px 12px; border-radius: 9px; margin-bottom: 12px; }
.msg.err { background: #fdecec; color: var(--red); }
.msg.ok { background: #eaf7ef; color: var(--green); }

/* ---------- rows (compact) ---------- */
.rows { display: grid; gap: 6px; }
.row { background: var(--card); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 11px; display: flex; gap: 10px; align-items: center; }
.row .thumb { width: 38px; height: 38px; border-radius: 7px; object-fit: cover; background: var(--line); flex: none; cursor: zoom-in; }
.row .thumb.ph { cursor: default; display: grid; place-items: center; color: #aeb4c6; font-size: 14px; }
.row .main { flex: 1; min-width: 0; }
.row .line1 { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.row .title { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { color: var(--muted); font-size: 12px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .amt { font-weight: 800; white-space: nowrap; font-size: .96rem; }
.row .amt.red { color: var(--red); }
.row .acts { display: flex; gap: 5px; flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); }
.icon-btn svg { width: 15px; height: 15px; pointer-events: none; }
.icon-btn:hover { background: #f1f3fa; color: var(--navy); border-color: #cdd3e6; }
.icon-btn.danger:hover { background: #fdf0f0; color: var(--red); border-color: #f3c9c9; }
.tag { display: inline-block; background: var(--orange-soft); color: #a23c11; border-radius: 999px; padding: 0 8px; font-size: 11px; font-weight: 700; }
.empty { color: var(--muted); background: var(--card); border-radius: var(--radius); padding: 30px; text-align: center; box-shadow: var(--shadow); }

/* ---------- summary tables ---------- */
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 1.03rem; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tfoot td { font-weight: 800; border-top: 2px solid var(--line); }
.minibar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 5px; }
.minibar > span { display: block; height: 100%; background: var(--orange); }
.recap { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-bottom: 16px; }
.recap .stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.recap .stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.recap .stat .v { font-size: 1.3rem; font-weight: 800; margin-top: 3px; }
.recap .stat .v.green { color: var(--green); } .recap .stat .v.red { color: var(--red); }

/* ---------- forms / settings ---------- */
.form-narrow { max-width: 400px; }
.field { margin-bottom: 13px; }
.field label { display: block; font-weight: 700; margin-bottom: 5px; font-size: 14px; }
.field .req { color: var(--red); }
.preview { margin-top: 8px; }
.preview img { max-width: 130px; max-height: 130px; border-radius: 9px; display: block; }
.stack { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

/* ---------- chips (categories) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--orange-soft); color: #a23c11; border-radius: 999px; padding: 4px 6px 4px 13px; font-weight: 700; font-size: 13px; }
.chip button { border: 0; background: rgba(162,60,17,.16); color: #a23c11; border-radius: 999px; width: 20px; height: 20px; line-height: 1; }

/* ---------- login ---------- */
.login-wrap { max-width: 380px; margin: 9vh auto; padding: 0 20px; }
.login-card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 30px 28px; text-align: center; }
.login-card img.logo { width: 82px; height: 82px; border-radius: 50%; }
.login-card h1 { margin: 12px 0 0; font-size: 1.18rem; color: var(--navy); }
.login-card .tagline { color: var(--orange); font-weight: 700; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 18px; }
.login-card label { display: block; font-weight: 700; margin: 4px 0 6px; text-align: left; }
.login-card .btn { width: 100%; margin-top: 16px; justify-content: center; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(13,20,50,.5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; z-index: 60; }
.modal { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 470px; padding: 22px; }
.modal h3 { margin: 0 0 15px; }
.modal-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(8,12,30,.85); display: flex; align-items: center; justify-content: center; z-index: 80; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 12.5px; }
.site-foot .inner { max-width: var(--maxw); margin: 0 auto; padding: 16px 18px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

@media (max-width: 680px) {
  .hero-grid { grid-template-columns: 1fr; gap: 16px; }
  .hero-right { grid-template-columns: 1fr 1fr; gap: 10px 18px; }
  .hero-right .s { flex-direction: column; gap: 1px; justify-content: flex-start; }
}
@media (max-width: 560px) {
  .brand .name { font-size: 13.5px; white-space: normal; }
  .hero .raised { font-size: 1.9rem; }
}

/* ---------- printable report ---------- */
#report { display: none; }
body.report-mode { background: #e9ebf1; }
body.report-mode #app { display: none; }
body.report-mode #report {
  display: block; background: #fff; color: #1f2430;
  max-width: 210mm; margin: 0 auto; padding: 14mm 15mm 16mm;
  font: 11px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 10px 40px rgba(0,0,0,.15);
}
#report .r-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fff7f2; border: 1px solid var(--orange-soft); border-radius: 8px;
  padding: 8px 12px; margin-bottom: 16px; font-size: 12px; color: #7a3410;
}
#report .r-head { display: flex; align-items: center; gap: 12px; border-bottom: 3px solid var(--navy); padding-bottom: 9px; }
#report .r-head img { width: 48px; height: 48px; border-radius: 50%; }
#report .r-org { font-weight: 800; color: var(--navy); font-size: 15px; line-height: 1.15; }
#report .r-sub { color: var(--orange); font-weight: 700; font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }
#report .r-when { margin-left: auto; text-align: right; color: #666; font-size: 9px; line-height: 1.35; }
#report .r-title { font-size: 16px; margin: 13px 0 11px; color: var(--navy); }
#report .r-summary { display: flex; gap: 8px; margin-bottom: 15px; }
#report .r-summary .c { flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; }
#report .r-summary .c.navy { background: var(--navy); color: #fff; border-color: var(--navy); }
#report .r-summary .k { font-size: 7.5px; text-transform: uppercase; letter-spacing: .06em; opacity: .8; }
#report .r-summary .v { font-size: 13px; font-weight: 800; margin-top: 2px; }
#report h2 { font-size: 12px; color: var(--navy); border-bottom: 1px solid var(--line); padding-bottom: 3px; margin: 17px 0 6px; }
#report table { width: 100%; border-collapse: collapse; }
#report th, #report td { text-align: left; padding: 4px 6px; border-bottom: 1px solid #e6e8ef; font-size: 10px; vertical-align: top; }
#report thead th { background: #eef1f8; color: var(--navy); }
#report td.num, #report th.num { text-align: right; white-space: nowrap; }
#report tfoot td { font-weight: 800; border-top: 1.5px solid var(--navy); border-bottom: 0; }
#report .r-none { color: #777; font-style: italic; margin: 4px 0; }
#report .r-foot { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 5px; color: #888; font-size: 8.5px; }

@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  @page { size: A4; margin: 13mm; }
  html, body { background: #fff !important; }
  .site-head, .tabs, .toolbar .btn, .filters, .site-foot { display: none !important; }
  .panel, .row { box-shadow: none; }
  body.report-mode #report { max-width: none; margin: 0; padding: 0; box-shadow: none; }
  #report .r-bar { display: none !important; }
  #report thead { display: table-header-group; }
  #report tr { break-inside: avoid; }
}
