:root {
  color-scheme: light;
  --ink: #382b42;
  --muted: #6e5c70;
  --plum: #573859;
  --rose: #a63769;
  --line: #efdfeb;
  --paper: #fffdfd;
  --shadow: 0 8px 30px #703b6510;
  font-family: "Leelawadee UI", "Noto Sans Thai", system-ui, sans-serif;
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background-color: #fff8f5;
  background-image: radial-gradient(#f0cfe080 1px, transparent 1px);
  background-size: 20px 20px;
}
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 3px solid #895bbb; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h2 { font-size: 1.18rem; line-height: 1.4; }
.wrap { width: min(100% - 36px, 1000px); margin-inline: auto; }
.top { background: #fffdfdf0; border-bottom: 1px solid #f2e5ee; }
.bar { min-height: 75px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--plum); font: 900 1.42rem/1 system-ui, sans-serif; letter-spacing: .055em; }
.brand-icon { background: #ffdfed; color: #93315e; width: 42px; height: 42px; border-radius: 15px; font-size: 1.4rem; display: grid; place-items: center; border: 1px solid #f7c6de; }
.brand small { display: block; font: 600 .74rem/1.3 "Leelawadee UI", system-ui, sans-serif; letter-spacing: 0; margin-top: 3px; color: var(--muted); }
nav { display: flex; gap: 4px; background: #faf1f7; padding: 5px; border-radius: 15px; }
nav a { display: flex; align-items: center; gap: 5px; border-radius: 11px; padding: 8px 13px; white-space: nowrap; font-weight: 700; font-size: .89rem; color: var(--muted); }
nav a[aria-current] { background: white; color: #902e60; box-shadow: 0 2px 8px #7f47751c; }
main { padding-top: 26px; min-height: 75vh; }
.hero {
  display: grid; grid-template-columns: 1fr .7fr; align-items: center; min-height: 234px;
  padding: 24px 40px; overflow: hidden; isolation: isolate; position: relative;
  background: linear-gradient(108deg,#ffdae9 0%,#fbe3f4 56%,#efe2ff 100%);
  border: 1px solid #f0cada; border-radius: 29px; margin-bottom: 21px;
}
.hero::after { content: ""; position: absolute; z-index: -1; inset: 0 0 0 49%; background: radial-gradient(#ffffffa0 1px, transparent 2px); background-size: 19px 19px; mask-image: linear-gradient(to left,black,transparent); }
.hero-kicker { display: inline-block; color: #7e3a62; font-size: .88rem; font-weight: 750; background: #fff8; border: 1px solid #fff9; border-radius: 100px; padding: 4px 12px; }
.hero h1 { margin: 8px 0; font-size: clamp(2.1rem, 5vw, 3.4rem); letter-spacing: -.045em; line-height: 1.13; color: #553452; }
.hero h1 span { color: #a63769; }
.hero p:last-child { color: #634762; }
.art { height: 185px; position: relative; width: min(100%, 275px); justify-self: center; }
.coin {
  position: absolute; top: 10px; left: 50%; width: 140px; height: 140px; transform: translateX(-50%) rotate(-13deg);
  border-radius: 50%; border: 4px solid #d58953; background: #ffd578;
  box-shadow: 8px 9px 0 #c87555, 8px 11px 0 #a95c4c, inset 0 0 0 6px #ffe29a;
}
.coin::before { content: ""; position: absolute; inset: 11px; border: 2px dashed #d78958; border-radius: 50%; background-color: #ffe7a5; }
.coin-shadow { position: absolute; bottom: 17px; left: 50%; transform: translateX(-44%); width: 167px; height: 21px; border-radius: 50%; background: #9c659335; filter: blur(3px); }
.face { position: absolute; inset: 0; transform: rotate(13deg); }
.face i, .face em, .face b { position: absolute; }
.face i { width: 7px; height: 10px; background: #643c4d; border-radius: 50%; left: 40px; top: 59px; }
.face i:nth-child(2) { left: auto; right: 40px; }
.face b { left: 58px; top: 65px; width: 16px; height: 12px; border: 3px solid #643c4d; border-top: 0; border-radius: 0 0 11px 11px; }
.face em { top: 72px; left: 30px; width: 16px; height: 8px; background: #ef9c9e; border-radius: 50%; }
.face em:last-child { left: auto; right: 30px; }
.spark { position: absolute; font-size: 1.6rem; color: #9c4b86; }
.s1 { left: 8%; top: 13%; color: #a85d99; }.s2 { right: 7%; top: 8%; }.s3 { right: 3%; top: 53%; color: #a75483; font-size: 1.2rem; }.s4 { left: 0; bottom: 20%; color: #a75483; }
.mini-coin { position: absolute; bottom: 30px; right: 13%; display: grid; place-items: center; border-radius: 50%; width: 36px; height: 36px; background: #ffe7a5; border: 2px solid #da8f60; color: #8c4e39; font-weight: 850; transform: rotate(14deg); }
.entry-layout { display: grid; grid-template-columns: minmax(0, 1.77fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 23px; padding: 21px; box-shadow: var(--shadow); min-width: 0; }
.section-head { display: flex; gap: 11px; align-items: center; margin-bottom: 18px; }
.section-head p { color: var(--muted); font-size: .88rem; }
.tile { display: inline-grid; place-items: center; width: 39px; height: 39px; flex: none; border-radius: 12px; font: 800 1.15rem/1 system-ui, sans-serif; font-style: normal; }
.pink { background: #ffe1ec; color: #933963; }.lilac { background: #f0e4ff; color: #694397; }.mint { background: #e3f5eb; color: #275d4f; }.gold { background: #fff0ce; color: #875923; }
form { display: grid; gap: 14px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.segmented { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; padding: 5px; border-radius: 14px; background: #f8f0f6; }
.segmented label, .methods label { position: relative; min-width: 0; cursor: pointer; }
.segmented input, .methods input, .sr-only { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); margin: 0; }
.segmented label span { display: block; text-align: center; padding: 8px 5px; border-radius: 10px; color: var(--muted); font-weight: 720; }
.segmented input:checked + span { background: white; color: #983263; box-shadow: 0 2px 6px #60375819; }
.segmented input[value="income"]:checked + span { color: #216550; }
.segmented input:focus-visible + span, .methods input:focus-visible + span { outline: 3px solid #895bbb; outline-offset: 2px; }
.field { display: block; position: relative; min-width: 0; }
.field, legend { color: var(--ink); font-size: .91rem; font-weight: 720; }
.unit { float: right; color: var(--muted); font-size: .82rem; font-weight: 550; }
.field input, .field select, #pin-form input {
  min-width: 0; width: 100%; min-height: 43px; padding: 8px 11px; margin-top: 5px;
  border: 1px solid #e9dbe6; border-radius: 11px; color: var(--ink); background-color: #fffbfe; font-size: 1rem; font-weight: 500;
}
.field select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg,transparent 49%,#694c70 50%),linear-gradient(135deg,#694c70 49%,transparent 50%); background-position: right 16px center,right 11px center; background-size: 5px 5px; background-repeat: no-repeat; }
.amount-box { display: flex; align-items: center; gap: 10px; padding: 0 13px; margin-top: 5px; border: 1px solid #ecd3e3; border-radius: 13px; background: #fff6fb; color: #9b3466; }
.amount-box:focus-within { outline: 3px solid #895bbb; outline-offset: 2px; }
.amount-box b { font-size: 1.5rem; }.amount-box input { margin: 0; font: 800 1.7rem/1.1 system-ui,sans-serif; min-height: 55px; padding: 5px 0; border: 0; background: transparent; outline: 0; }
.amount-box input::placeholder { color: #856a81; }
.methods legend { margin-bottom: 6px; }
.methods > div { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
.methods label > span { min-height: 64px; display: grid; justify-items: center; align-content: center; gap: 3px; border: 1px solid #eddfea; border-radius: 12px; color: #5b4960; background: #fffbfd; font-size: .86rem; font-weight: 700; }
.methods .tile { width: 28px; height: 25px; border-radius: 8px; font-size: .94rem; }
.methods input:checked + span { border-color: #bd5d8f; background: #fff0f8; color: #8b2e5d; box-shadow: inset 0 0 0 1px #bd5d8f; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; min-height: 43px; padding: 8px 14px; border-radius: 12px; font-weight: 750; line-height: 1.3; text-align: center; }
.primary { background: #a63769; color: white; border: 1px solid #a63769; box-shadow: 0 4px 0 #78254b; }
.primary:hover { background: #8f2d5b; }.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #78254b; }
.secondary { background: #faf0f8; border: 1px solid #ecd6e7; color: #73315b; }.secondary:hover { background: #f6e4f1; }
.full { width: 100%; }.actions { display: flex; gap: 8px; }.actions .primary { flex: 1; }
.feedback { color: #873554; font-weight: 650; font-size: .89rem; }.feedback:empty { display: none; }.feedback.ok { color: #23644d; }
.side { display: grid; gap: 17px; }.channels ul { list-style: none; padding: 0; margin: 11px 0 0; }
.channels li { display: flex; gap: 11px; align-items: center; padding: 9px 0; }
.channels li + li { border-top: 1px solid #f3e9f0; }
.channels small { display: block; color: var(--muted); font-size: .82rem; }
footer { color: var(--muted); display: flex; justify-content: space-between; gap: 10px; padding: 22px 0; font-size: .85rem; }
footer span span { color: #a63769; }.global { margin-top: 12px; }
.summary-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.summary-head h1 { font-size: clamp(1.75rem,4vw,2.45rem); color: var(--plum); }
.gate { max-width: 404px; margin: 0 auto; background: #5a3d64; padding: 14px; border-color: #7d5486; border-radius: 29px; box-shadow: 0 5px 0 #3b2944, var(--shadow); }
.gate-screen { background: linear-gradient(165deg,#fff7df,#ffe7f3 53%,#f2eaff); border-radius: 19px; text-align: center; padding: 17px; }
.gate-screen h2 { margin-top: 7px; }.gate-screen > p { color: #654e66; font-size: .9rem; margin: 4px 0 10px; }
#pin-form { gap: 9px; } #pin-form input { margin: 0; text-align: center; min-height: 42px; }
.keypad { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.keypad button { min-height: 40px; border: 1px solid #e2c4df; border-radius: 12px; background: #fffcf6; box-shadow: 0 2px 0 #dab8d4; color: #59355e; font-weight: 850; font-size: 1.12rem; }
.keypad button:hover { background: #fbe3ef; }.keypad button[data-key="next"] { background: #f8dcf0; }.keypad button:disabled { cursor: default; }
.keypad button[data-key="0"] { grid-column: 2; }.keypad button[data-key="back"] { grid-column: 3; }
.filters { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.totals { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 14px 0; }
.total { background: #f4ebfc; }.total.expense { background: #ffeaf2; }.total.income { background: #e9f7ef; }
.total p { color: #5b4b63; font-weight: 700; }.total strong { display: block; font-size: clamp(1.05rem,3vw,1.65rem); overflow-wrap: anywhere; margin-top: 5px; }
.income { color: #23644d; }.expense { color: #963258; }
.report + .report { margin-top: 14px; }.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .91rem; }
th, td { padding: 9px 5px; border-bottom: 1px solid #f0e4ed; text-align: right; }
th:first-child, td:first-child { text-align: left; }.history-head { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; }.history-head span { color: var(--muted); font-size: .86rem; }
.history { padding: 0; margin: 0; list-style: none; }.history li { padding: 10px 0; border-bottom: 1px solid #f0e4ed; }.history li:last-child { border: 0; }
.record { display: grid; grid-template-columns: minmax(0,1fr) auto; column-gap: 12px; align-items: start; }.record b, .record small { overflow-wrap: anywhere; }.record small { grid-column: 1/-1; color: var(--muted); margin-top: 3px; }.record .record-actions { grid-column: 1/-1; display: flex; gap: 6px; margin-top: 7px; }
.record-actions button { min-height: 38px; font-size: .86rem; }
.report .feedback:not(:empty) { margin-top: 10px; }
dialog { color: var(--ink); border: 1px solid var(--line); border-radius: 19px; padding: 22px; background: var(--paper); width: min(100% - 34px,400px); }.dialog p, dialog p { color: var(--muted); }dialog::backdrop { background: #36203977; }
@media (max-width: 680px) {
  .entry-layout { grid-template-columns: 1fr; }.side { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hero { padding: 20px; grid-template-columns: 1fr .61fr; }.hero h1 { font-size: clamp(2rem,7.5vw,3rem); }
  .art { transform: scale(.78); transform-origin: center; }
  .art .s1 { left: -4%; }.art .s3 { right: -11%; }.art .s4 { left: -14%; }.mini-coin { right: -3%; }
}
@media (max-width: 460px) {
  .wrap { width: calc(100% - 24px); }.bar { min-height: 65px; }.brand-icon { width: 35px; height: 35px; }.brand { gap: 6px; }
  nav a { padding: 7px 8px; font-size: .84rem; }main { padding-top: 15px; }
  .hero { min-height: 188px; padding: 16px; margin-bottom: 14px; border-radius: 22px; }.hero p:last-child { font-size: .88rem; }.hero .art { transform: scale(.63); height: 165px; }.coin-shadow { bottom: 4px; }
  .hero .s1 { left: -18%; }.hero .s2 { right: -12%; }.hero .s3 { right: -20%; }.hero .s4 { display: none; }.mini-coin { right: -11%; bottom: 13px; }
  .card { padding: 15px; }.side { grid-template-columns: 1fr; }.filters { grid-template-columns: repeat(2,minmax(0,1fr)); }.totals { gap: 6px; }.total { padding: 9px; border-radius: 13px; }.total p { font-size: .85rem; }.total strong { font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
