:root {
  --bg: #0b1220;
  --card: #111a2e;
  --text: #e7eefc;
  --muted: #9fb2d6;
  --border: rgba(255,255,255,0.09);
  --good: #22c55e;
  --bad: #ef4444;
  --accent: #60a5fa;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 800px at 20% 0%, rgba(96,165,250,0.14), transparent), var(--bg);
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: none;
  filter: brightness(1.06);
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px; }

.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.headerLeft { display: flex; align-items: center; gap: 12px; min-width: 0; }
.headerText { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.headerLogo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.12);
  object-fit: contain;
}
.title { margin: 0; font-size: 28px; }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent), var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0;
}

h2 { margin: 0 0 10px 0; font-size: 18px; }

.muted { color: var(--muted); }

.hidden { display: none !important; }

.row { display: flex; gap: 12px; align-items: end; }
.rowBetween { display: flex; justify-content: space-between; align-items: baseline; }

form.row .field { flex: 1; }
form.row .btn { flex: 0 0 auto; }

#campaignMeta {
  margin-top: 16px;
  text-align: center;
}

.campaignHeadline {
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 14px;
}

#campaignId {
  font-size: 18px;
  padding: 12px 14px;
}

.field .label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.inputRow {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
}

.inputRow input { flex: 1 1 420px; min-width: 220px; }

.btnSmall {
  padding: 12px 12px;
  white-space: nowrap;
}

.help { margin-top: 8px; font-size: 12px; line-height: 1.35; }
input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.22);
  color: var(--text);
  outline: none;
}

.btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(96,165,250,0.18);
  color: var(--text);
  cursor: pointer;
}

.btnSecondary {
  background: rgba(255,255,255,0.08);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn:hover { border-color: rgba(96,165,250,0.5); }

.totals { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-top: 12px; }
.totalCard {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(0,0,0,0.12);
}
.totalLabel { font-size: 12px; color: var(--muted); }
.totalValue { font-size: 20px; margin-top: 4px; }
.totalSub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.dayHeader {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 8px;
}

.dayCell {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  min-height: 74px;
  background: rgba(0,0,0,0.12);
}

.dayNum { font-size: 12px; color: var(--muted); }
.dayAmt { font-size: 16px; margin-top: 6px; }
.dayCount { font-size: 12px; color: var(--muted); margin-top: 2px; }

.dayCell.hasValue { border-color: rgba(34,197,94,0.35); }
.dayCell.hasValue .dayAmt { color: #baf3c7; }

.events { margin-top: 10px; display: grid; grid-template-columns: 1fr; gap: 8px; }
.eventRow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.12);
}

.footer { margin-top: 18px; text-align: center; }

.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.tile {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(0,0,0,0.12);
}

.tileLabel { font-size: 12px; color: var(--muted); }
.tileValue { font-size: 22px; font-weight: 650; margin-top: 4px; }
.tileSub { font-size: 12px; color: var(--muted); margin-top: 6px; }

#campaignMeta a { font-size: 22px; font-weight: 700; }
#campaignMeta .muted { font-size: 18px; }

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.legendItem { display: flex; gap: 8px; align-items: center; }
.legendSwatch {
  width: 14px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.12);
}

.graph {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,0.12);
  padding: 10px;
}

.graph svg { width: 100%; height: 200px; display: block; }

.graphDetails {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,0.12);
  overflow: hidden;
}

.graphDetailsHeader,
.graphDetailsRow {
  display: grid;
  grid-template-columns: 140px 1fr 140px;
  gap: 10px;
  padding: 10px 12px;
  align-items: baseline;
}

.graphDetailsHeader {
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.graphDetailsRow {
  border-top: 1px solid rgba(255,255,255,0.06);
}

.graphDetailsRow:first-of-type { border-top: none; }

.graphDetailsDate { color: var(--muted); font-size: 12px; }
.graphDetailsAmt { font-size: 14px; }
.graphDetailsCount { color: var(--muted); font-size: 12px; text-align: right; }

.graphDetailsRow.isHighest {
  border-color: rgba(34,197,94,0.25);
  background: rgba(34,197,94,0.08);
}

@media (max-width: 520px) {
  .graphDetailsHeader,
  .graphDetailsRow {
    grid-template-columns: 110px 1fr 110px;
  }
}

@media (max-width: 920px) {
  .row { flex-direction: column; align-items: stretch; }
  .totals { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
}
