:root {
	--bg: #f6f1e7;
	--paper: #fffdf8;
	--ink: #1d2433;
	--muted: #6b7280;
	--line: #e7dfcf;
	--green: #1f6f5c;
	--green-dark: #17594a;
	--green-soft: #e3f0ea;
	--gold: #e8b23e;
	--gold-soft: #fbf0d6;
	--red: #c2410c;
	--red-soft: #fdebe1;
	--blue: #2f5f9e;
	--blue-soft: #e5eef9;
	--shadow: 0 1px 2px rgba(29, 36, 51, .06), 0 6px 20px rgba(29, 36, 51, .06);
	--radius: 18px;
	--safe-top: env(safe-area-inset-top, 0px);
	--safe-bottom: env(safe-area-inset-bottom, 0px);
	--serif: "Fraunces", Georgia, serif;
	--sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
	background: var(--bg);
	color: var(--ink);
	font-family: var(--sans);
	font-size: 16px;
	line-height: 1.4;
	-webkit-font-smoothing: antialiased;
	overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--green); }

.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); font-family: var(--serif); font-size: 20px; }

/* ---------- layout ---------- */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding: calc(var(--safe-top) + 8px) 16px calc(var(--safe-bottom) + 96px); }

.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 0 14px; }
.topbar .logo { width: 38px; height: 38px; border-radius: 11px; }
.topbar .hello { flex: 1; min-width: 0; }
.topbar .hello small { display: block; color: var(--muted); font-size: 13px; }
.topbar .hello strong { font-family: var(--serif); font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.icon-btn { position: relative; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); display: grid; place-items: center; cursor: pointer; font-size: 19px; }
.icon-btn .dot { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }

/* ---------- hero ---------- */
.hero { background: var(--green); color: #fff; border-radius: 24px; padding: 22px 20px 20px; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(232,178,62,.45), rgba(232,178,62,0) 70%); }
.hero .label { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; opacity: .8; font-weight: 600; }
.hero .big { font-family: var(--serif); font-size: 46px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 2px; line-height: 1.05; }
.hero .sub { opacity: .92; font-size: 15px; }
.hero .chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; position: relative; z-index: 1; }
.hero .pill { background: rgba(255,255,255,.14); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.hero.gold { background: linear-gradient(135deg, #1f6f5c, #2a7f69 60%, #b98a26); }
.hero .btn { position: relative; z-index: 1; margin-top: 14px; }

/* ---------- action tiles ---------- */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 6px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 14px; text-align: left; cursor: pointer; box-shadow: var(--shadow); transition: transform .08s; }
.tile:active { transform: scale(.98); }
.tile .emoji { font-size: 26px; display: block; margin-bottom: 8px; }
.tile strong { display: block; font-size: 15px; }
.tile small { color: var(--muted); font-size: 13px; }

/* ---------- sections & cards ---------- */
.section { margin-top: 22px; }
.section h2 { font-family: var(--serif); font-size: 19px; font-weight: 800; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.section h2 .count { font-family: var(--sans); font-size: 12px; background: var(--ink); color: #fff; border-radius: 999px; padding: 2px 8px; }
.empty { color: var(--muted); background: var(--paper); border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; text-align: center; font-size: 15px; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 12px; margin-bottom: 10px; box-shadow: var(--shadow); }
.card.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--gold); } 100% { box-shadow: var(--shadow); } }
.card-top { display: flex; gap: 12px; align-items: flex-start; }
.card-emoji { width: 40px; height: 40px; border-radius: 12px; background: var(--bg); display: grid; place-items: center; font-size: 20px; flex: 0 0 auto; }
.card-main { flex: 1; min-width: 0; }
.card-title { font-weight: 700; font-size: 16px; word-wrap: break-word; }
.card-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-amt { font-family: var(--serif); font-weight: 800; font-size: 20px; white-space: nowrap; }
.card-amt small { display: block; font-family: var(--sans); font-weight: 500; font-size: 11px; color: var(--muted); text-align: right; }
.card-note { margin-top: 10px; font-size: 14px; background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.card-note b { font-weight: 600; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: var(--bg); color: var(--ink); }
.badge.green { background: var(--green-soft); color: var(--green-dark); }
.badge.gold { background: var(--gold-soft); color: #7a5512; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.receipt-thumb { margin-top: 10px; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; text-decoration: none; }
.receipt-thumb img { width: 54px; height: 54px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.card-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.card-actions .btn { flex: 1 1 auto; }

/* ---------- buttons ---------- */
.btn { appearance: none; border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 700; font-size: 15px; cursor: pointer; background: var(--bg); color: var(--ink); border: 1px solid var(--line); min-height: 44px; transition: transform .08s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #3d2a05; }
.btn-danger { background: var(--paper); border-color: #efc6b2; color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-light { background: rgba(255,255,255,.95); color: var(--green-dark); border-color: transparent; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 7px 12px; font-size: 14px; }

/* ---------- ledger ---------- */
.ledger-kid { background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.ledger-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ledger-head h3 { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 800; }
.ledger-head .total { font-family: var(--serif); font-size: 28px; font-weight: 800; color: var(--green); }
.ledger-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.ledger-row:first-of-type { border-top: 0; }
.ledger-row .what { flex: 1; min-width: 0; }
.ledger-row .what small { display: block; color: var(--muted); font-size: 12px; }
.ledger-row .amt { font-weight: 700; white-space: nowrap; }
.ledger-list { margin: 10px 0 12px; }
.history-row { display: flex; justify-content: space-between; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.history-row small { color: var(--muted); }

/* ---------- banners ---------- */
.banner { display: flex; gap: 12px; align-items: center; background: var(--gold-soft); border: 1px solid #f0dca7; border-radius: var(--radius); padding: 12px 14px; margin-top: 14px; font-size: 14px; }
.banner .emoji { font-size: 22px; }
.banner .txt { flex: 1; }
.banner .txt strong { display: block; font-size: 15px; }

/* ---------- bottom nav ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(255,253,248,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 12px calc(var(--safe-bottom) + 6px); }
.nav-inner { max-width: 560px; margin: 0 auto; display: flex; }
.nav button { flex: 1; background: none; border: 0; padding: 6px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.nav button .ico { font-size: 22px; filter: grayscale(1); opacity: .7; }
.nav button.on { color: var(--green); }
.nav button.on .ico { filter: none; opacity: 1; }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 24, 33, .45); z-index: 40; opacity: 0; transition: opacity .2s; }
.scrim.show { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 560px; margin: 0 auto; background: var(--paper); border-radius: 24px 24px 0 0; padding: 10px 18px calc(var(--safe-bottom) + 18px); max-height: 92vh; overflow-y: auto; transform: translateY(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1); }
.sheet.show { transform: translateY(0); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h3 { font-family: var(--serif); font-size: 23px; font-weight: 800; margin: 0 0 4px; }
.sheet .lede { color: var(--muted); margin: 0 0 16px; font-size: 15px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input[type=text], .field input[type=number], .field input[type=search], .field select, .field textarea, .money-input {
	width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none;
}
.field textarea { min-height: 70px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.money-wrap { position: relative; }
.money-wrap::before { content: "$"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
.money-wrap input { padding-left: 28px !important; font-size: 20px !important; font-weight: 700; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg label { flex: 1; min-width: 90px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 11px 8px; border: 1px solid var(--line); border-radius: 12px; font-weight: 600; cursor: pointer; background: #fff; }
.seg input:checked + span { background: var(--green); color: #fff; border-color: var(--green); }
.check { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 14px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--green); }
.check b { display: block; }
.check small { color: var(--muted); }
.photo-pick { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px dashed #cdbf9f; border-radius: 12px; background: #fff; cursor: pointer; }
.photo-pick img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
.photo-pick .ph { width: 64px; height: 64px; border-radius: 10px; background: var(--bg); display: grid; place-items: center; font-size: 26px; }
.photo-pick input { display: none; }
.sheet-actions { display: flex; gap: 10px; margin-top: 6px; }
.sheet-actions .btn { flex: 1; }
.form-error { color: var(--red); background: var(--red-soft); border-radius: 10px; padding: 9px 12px; font-size: 14px; margin-bottom: 12px; }

/* notifications */
.note-item { padding: 12px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.note-item.unread .nt::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 7px; vertical-align: middle; }
.note-item .nt { font-weight: 700; }
.note-item .nb { font-size: 14px; margin-top: 2px; }
.note-item small { color: var(--muted); font-size: 12px; }
.menu-list button, .menu-list a { display: block; width: 100%; text-align: left; padding: 14px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; font-weight: 600; text-decoration: none; color: var(--ink); cursor: pointer; font-size: 16px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 86px); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 60; font-weight: 600; font-size: 15px; opacity: 0; transition: all .25s; max-width: calc(100% - 32px); text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- login ---------- */
.hb-login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--paper); border: 1px solid var(--line); border-radius: 26px; padding: 28px 22px; box-shadow: var(--shadow); text-align: center; }
.login-logo { border-radius: 18px; }
.login-card h1 { font-family: var(--serif); font-size: 30px; font-weight: 800; margin: 12px 0 4px; }
.login-sub { color: var(--muted); margin: 0 0 20px; }
.login-card form { text-align: left; }
.login-card label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.login-card input { display: block; width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 16px; background: #fff; }
.login-error { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 10px; font-size: 14px; }
.login-foot { margin: 16px 0 0; font-size: 14px; }

@media (min-width: 600px) {
	.app { padding-top: 24px; }
	.sheet { border-radius: 24px; bottom: 24px; }
}
