:root {
  color-scheme: light;
  --ink: #24312d;
  --muted: #68746f;
  --line: #d8ddd4;
  --paper: #fffdf7;
  --wash: #f5f0e6;
  --green: #246b5f;
  --green-2: #d9eee6;
  --gold: #e7b847;
  --rose: #c95f56;
  --blue: #446f9f;
  --violet: #745db0;
  --shadow: 0 16px 40px rgba(36, 49, 45, 0.12);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(231, 184, 71, 0.18), transparent 30%),
    linear-gradient(135deg, #f7f3ea 0%, #eef6f0 45%, #fff9e9 100%);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

ruby {
  ruby-align: center;
}

rt {
  color: var(--muted);
  font-size: 0.62em;
  font-weight: 800;
  line-height: 1;
}

.btn rt,
.tab rt,
.menu-item rt {
  font-size: 0.58em;
}

.app-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.brand h1 {
  margin: 0;
  font-size: 22px;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.child-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.child-topbar .brand {
  flex: 1 1 auto;
}

.child-topbar .brand p {
  display: none;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.card {
  background: rgba(255, 253, 247, 0.88);
  border: 1px solid rgba(216, 221, 212, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.accordion {
  overflow: hidden;
}

.accordion > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.accordion > summary::-webkit-details-marker {
  display: none;
}

.accordion > summary::after {
  content: "＋";
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--wash);
}

.accordion[open] > summary {
  margin-bottom: 14px;
}

.accordion[open] > summary::after {
  content: "−";
}

.accordion small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-text {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.summary-text strong {
  font-size: 17px;
  font-weight: 900;
}

.card {
  padding: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h2,
.section-title h3 {
  margin: 0;
  font-size: 17px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.section-title.compact {
  margin: 10px 0 0;
}

.section-title.compact h3 {
  font-size: 14px;
}

.hero {
  min-height: 310px;
  display: grid;
  align-items: center;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
}

.hero h2 {
  margin: 0;
  max-width: 620px;
  font-size: 42px;
  line-height: 1.15;
}

.hero p {
  max-width: 560px;
  color: var(--muted);
  line-height: 1.8;
}

.money-stack {
  display: grid;
  gap: 10px;
}

.money-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 14px 16px;
  border: 2px solid #28463c;
  border-radius: 8px;
  background: linear-gradient(90deg, #fff8d8, #e4f3e8);
  color: #28463c;
  font-weight: 800;
  transform: rotate(var(--tilt));
}

.tabs,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab,
.btn {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 700;
  line-height: 1.15;
}

.tab.active,
.btn.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.btn.gold {
  background: var(--gold);
  color: #322913;
  border-color: var(--gold);
}

.btn.danger {
  background: #fae6e2;
  color: #893d36;
  border-color: #edb6ad;
}

.btn.ghost {
  background: transparent;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.menu-wrap {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.icon-btn {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.menu-panel {
  position: absolute;
  top: 52px;
  right: 0;
  z-index: 20;
  display: grid;
  min-width: 160px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.menu-item {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 800;
}

.menu-item:hover {
  background: var(--wash);
}

.danger-text {
  color: #893d36;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(36, 49, 45, 0.36);
}

.modal {
  width: min(420px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.modal h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.modal p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.8;
}

form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.child-card {
  border-left: 8px solid var(--child-color, var(--green));
}

.balance {
  margin: 4px 0 0;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0;
}

.muted {
  color: var(--muted);
}

.list {
  display: grid;
  gap: 10px;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.row strong {
  display: block;
}

.amount {
  font-weight: 900;
}

.amount.income {
  color: var(--green);
}

.amount.expense {
  color: var(--rose);
}

.stamp-panel .btn {
  width: 100%;
}

.stamp-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.stamp-dot {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
}

.stamp-dot.filled {
  border-style: solid;
  border-color: var(--gold);
  background: #fff2bd;
  color: #6e5312;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.sticker-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(231, 184, 71, 0.2), rgba(68, 111, 159, 0.12)),
    #fff;
}

.sticker-card h3 {
  margin: 10px 0 0;
  font-size: 15px;
}

.sticker-images {
  display: block;
}

.sticker-images img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 2px solid #fff;
  border-radius: 6px;
  box-shadow: 0 6px 14px rgba(36, 49, 45, 0.14);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--green-2);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.empty {
  padding: 18px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.notice {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff3cd;
  color: #6e5312;
  border: 1px solid #ecd38a;
}

.error {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fde7e3;
  color: #793a34;
  border: 1px solid #f0bab1;
}

.success {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #dff2e7;
  color: #245743;
  border: 1px solid #afd8c3;
}

.progress {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: #e8e3d8;
}

.progress > span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: linear-gradient(90deg, var(--green), var(--gold));
}

@media (max-width: 820px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .hero,
  .grid.two,
  .grid.three,
  .split {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: flex;
  }

  .child-topbar .brand h1 {
    font-size: 20px;
  }

  .hero h2 {
    font-size: 32px;
  }

  .tabs,
  .actions {
    width: 100%;
  }

  .tab,
  .btn {
    flex: 1 1 auto;
  }
}
