/* Salary Check — colours inspired by Klimt's The Kiss. Red is kept for warnings only. */
:root {
  --gold: #d4a017;
  --yellow: #e8c547;
  --red: #c0392b;
  --green: #2e8b57;
  --blue: #1f3a8a;
  --cream: #fffaf0;
  --ink: #2a2118;
  --card: #ffffff;
  --line: #eadfc6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

/* Heading: a Klimt-style mosaic — gold circles and squares scattered on starry blue,
   framed top and bottom by a band of little gold, red and green tiles. */
.masthead {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  padding: 26px 16px 24px;
  text-align: center;
  margin-bottom: 16px;
  background-color: var(--blue);
  background-image:
    radial-gradient(circle, var(--gold) 0 4px, transparent 4.5px),
    radial-gradient(circle, var(--yellow) 0 1.5px, transparent 2px),
    linear-gradient(45deg, rgba(212, 160, 23, 0.28) 25%, transparent 25%, transparent 75%, rgba(212, 160, 23, 0.28) 75%),
    linear-gradient(45deg, rgba(212, 160, 23, 0.28) 25%, transparent 25%, transparent 75%, rgba(212, 160, 23, 0.28) 75%);
  background-size: 34px 34px, 13px 13px, 22px 22px, 22px 22px;
  background-position: 0 0, 6px 6px, 0 0, 11px 11px;
}

.masthead::before,
.masthead::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(90deg,
    var(--gold) 0 10px, var(--red) 10px 13px,
    var(--yellow) 13px 23px, var(--green) 23px 26px);
}
.masthead::before { top: 0; }
.masthead::after { bottom: 0; }

/* A dark plate behind the words keeps them easy to read over the pattern. */
.masthead-plate {
  display: inline-block;
  background: rgba(20, 30, 80, 0.88);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 10px 16px 8px;
}

h1 {
  margin: 0;
  font-family: "Cinzel Decorative", Georgia, serif;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.03em;
  font-size: 1.9rem;
  line-height: 1.15;
  text-shadow: 0 1px 0 #7a5a00, 0 0 12px rgba(232, 197, 71, 0.45);
}

.tagline { margin: 4px 0 0; color: var(--cream); font-size: 0.92rem; }

h2 {
  margin: 0 0 12px;
  font-family: "Cinzel Decorative", Georgia, serif;
  font-weight: 700;
  color: var(--blue);
  font-size: 1.1rem;
}
h2::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  vertical-align: 2px;
  background: var(--gold);
  transform: rotate(45deg);
}

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

.field { display: block; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }

/* Salary: amount, date and frequency share one compact row. */
.salary-row { display: grid; grid-template-columns: 1.2fr 0.75fr 1.1fr; gap: 8px; }
.salary-row .field { margin-bottom: 0; }
.salary-row select { padding-left: 6px; padding-right: 2px; font-size: 0.95rem; }
#salary-date { text-align: center; padding-left: 4px; padding-right: 4px; }
.label { display: block; font-size: 0.85rem; color: #6b5d48; margin-bottom: 4px; }

input, select, button {
  font: inherit;
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid #cdbf9f;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  width: 100%;
}

input:focus, select:focus, button:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 1px;
}

.rand-input {
  display: flex;
  align-items: center;
  border: 1px solid #cdbf9f;
  border-radius: 8px;
  background: #fff;
  padding-left: 10px;
}
.rand-input > span { font-weight: 600; color: var(--gold); }
.rand-input input { border: none; padding-left: 6px; }
.rand-input:focus-within { outline: 3px solid var(--yellow); outline-offset: 1px; }
.rand-input input:focus { outline: none; }

/* Debit orders: name, amount, how often — one compact row each. */
.debit-head, .debit-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 6px; }
.debit-head { font-size: 0.8rem; color: #6b5d48; margin-bottom: 4px; }
.debit-row { margin-bottom: 6px; }
.debit-row input, .debit-row select { min-height: 42px; font-size: 0.95rem; }
.debit-row select { padding-left: 6px; padding-right: 2px; }
.debit-total { margin: 8px 0 0; font-size: 0.95rem; }

.storage-note {
  background: #fdf3d0;
  border: 1px solid var(--yellow);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 0 12px;
  font-size: 0.9rem;
}

.add-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.add-row .other-name { grid-column: 1 / -1; }
[hidden] { display: none !important; }

button {
  background: var(--blue);
  color: var(--cream);
  border: none;
  font-weight: 600;
  padding: 8px 18px;
  cursor: pointer;
  width: auto;
}

.note { color: var(--red); margin: 8px 0 0; font-size: 0.95rem; }

/* Status card */
.figures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 12px;
}
.figures div { background: var(--cream); border-radius: 8px; padding: 8px; text-align: center; }
.figures dt { font-size: 0.8rem; color: #6b5d48; }
.figures dd { margin: 2px 0 0; font-size: 1.15rem; font-weight: 700; }

.message { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--cream); }

.status[data-status="on-track"] { border-top-color: var(--green); }
.status[data-status="on-track"] .message { background: #e6f4ec; color: #1d5e3a; }

.status[data-status="running-low"] { border-top-color: var(--red); border-color: var(--red); }
.status[data-status="running-low"] .message { background: var(--red); color: #fff; font-weight: 600; }
.status[data-status="running-low"] #status-left { color: var(--red); }

.status[data-status="salary-day"] .message { background: #fdf3d0; }

/* Purchases list */
/* Purchases sit side by side as small tags, so a busy month still fits on a phone screen. */
.purchases {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.purchases li {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.9rem;
  white-space: nowrap;
}
.purchases .amount { font-weight: 700; }
.purchases li { display: inline-flex; align-items: center; gap: 4px; padding-right: 4px; }
.purchases .remove {
  min-height: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: #8a7a60;
  font-size: 0.8rem;
  font-weight: 400;
}
.purchases .remove:hover { background: var(--line); color: var(--red); }

/* Category totals sit above the purchase tags. */
.totals {
  list-style: none;
  margin: 0 0 10px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.95rem;
}
.totals strong { color: var(--blue); }

/* Reset */
.reset-help { margin: 0 0 12px; font-size: 0.95rem; color: #6b5d48; }
.reset-button { width: 100%; background: var(--gold); color: var(--ink); }
.reset-confirm p { margin: 0 0 10px; font-weight: 600; }
.reset-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.secondary { width: 100%; background: #fff; color: var(--blue); border: 1px solid var(--blue); }
/* When the salary date has arrived, the Reset card glows gold. */
body:has(.status[data-status="salary-day"]) .reset-card { border-color: var(--gold); box-shadow: 0 0 0 3px var(--yellow); }
.empty { margin: 0; color: #6b5d48; }
