@font-face { font-family: Unbounded; src: url(/fonts/Unbounded.ttf) format("truetype"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: Manrope; src: url(/fonts/Manrope.ttf) format("truetype"); font-weight: 200 800; font-display: swap; }

:root {
  --bg: #F7F1E1; --bg2: #EFE4C8; --card: #FFFBF0; --ink: #101434; --muted: #5B6082;
  --cyan: #4ED6F0; --yellow: #FFC94D; --red: #FF5A5A; --green: #3DDC84; --grey: #E4DCC6;
  --line: 2px solid var(--ink); --shadow: 3px 3px 0 var(--ink); --r: 12px;
  --tabs-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: Manrope, system-ui, sans-serif; font-size: 15px; line-height: 1.4; font-weight: 500;
  -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
b, strong { font-weight: 800; }

#app { max-width: 760px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12px) 16px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 90px); }
#app.wide { max-width: 1100px; }
.top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
h1, h2, h3, .disp { font-family: Unbounded, system-ui, sans-serif; text-transform: uppercase; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(16px, 5.2vw, 22px); font-weight: 900; white-space: nowrap; }
#updated { font-size: 11px; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 900; }
h3 { font-size: 12px; font-weight: 700; }
#updated { margin-left: auto; text-align: right; }

.sticker, .card { background: var(--card); border: var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card { padding: 10px 12px; margin: 8px 0; cursor: pointer; display: block; width: 100%; text-align: left; }
.card:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.card .t { font-weight: 800; }
.card .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card.pay { background: #FFF1CC; }
.card.done { opacity: .75; }

.money { display: flex; gap: 10px; width: 100%; border: 0; background: none; padding: 0; margin: 0 0 12px; cursor: pointer; text-align: left; }
.money .sticker { flex: 1; padding: 8px 10px; }
.money .big { font-size: 18px; font-weight: 800; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.chip { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 1px 7px; border: 1.5px solid var(--ink); border-radius: 7px; background: var(--card); white-space: nowrap; }
button.chip { cursor: pointer; }
.c-cyan { background: var(--cyan); } .c-yellow { background: var(--yellow); } .c-red { background: var(--red); color: #fff; }
.c-green { background: var(--green); } .c-grey { background: var(--grey); } .c-ink { background: var(--ink); color: var(--card); }
.tilt { transform: rotate(-3deg); display: inline-block; }

.seg { display: flex; border: var(--line); border-radius: 10px; overflow: hidden; background: var(--card); margin: 0 0 10px; }
.seg button { flex: 1; border: 0; background: none; padding: 7px 4px; font-weight: 800; font-size: 13px; cursor: pointer; }
.seg button + button { border-left: var(--line); }
.seg button.on { background: var(--cyan); }
.nav { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; }
.nav .lbl { flex: 1; text-align: center; font-family: Unbounded, sans-serif; font-weight: 700; font-size: 14px; }
.iconbtn { border: var(--line); background: var(--card); border-radius: 10px; width: 38px; height: 38px; font-size: 18px; font-weight: 800; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); }
.range { display: flex; gap: 8px; margin-bottom: 8px; }
.range label { flex: 1; }

.day { margin: 16px 0 4px; display: flex; align-items: center; gap: 8px; }
.day h3 { font-size: 11px; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }

.calgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calgrid .wd { text-align: center; font-size: 11px; color: var(--muted); font-weight: 800; padding-bottom: 2px; }
.cell { min-height: 54px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--card); padding: 3px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cell.out { opacity: .4; }
.cell.win { background: #FFD6D6; }
.cell.today { box-shadow: 0 0 0 3px var(--cyan); }
.cell .n { font-size: 12px; font-weight: 800; }
.cell .dots { display: flex; gap: 2px; flex-wrap: wrap; }
.cell .dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink); }
.cell .lab { display: none; font-size: 10px; line-height: 1.2; padding: 1px 3px; border-radius: 4px; border: 1px solid var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; font-size: 12px; }
@media (min-width: 700px) {
  .cell { min-height: 92px; }
  .cell .lab { display: block; }
  .cell .dots { display: none; }
}

.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card); border-top: var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabs button { flex: 1; border: 0; background: none; height: var(--tabs-h); font-weight: 800; font-size: 12px; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.tabs button .ic { font-size: 20px; line-height: 1; }
.tabs button.on { color: var(--ink); }
.tabs button.on .ic { background: var(--cyan); border: 1.5px solid var(--ink); border-radius: 8px; padding: 0 8px; }
.fab { position: fixed; right: max(16px, calc(50% - 364px)); bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px); width: 58px; height: 58px; border-radius: 16px; border: var(--line); background: var(--yellow); box-shadow: var(--shadow); font-size: 32px; font-weight: 800; cursor: pointer; z-index: 11; line-height: 1; }
.fab:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.sheet-wrap { position: fixed; inset: 0; background: rgba(16, 20, 52, .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); border: var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; padding: 16px 16px calc(env(safe-area-inset-bottom) + 20px); }
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-bottom: var(--line); border-radius: 18px; box-shadow: 5px 5px 0 var(--ink); } }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.sheet-head h2 { flex: 1; font-size: 17px; line-height: 1.2; }
.sec { margin: 14px 0 4px; display: flex; align-items: center; gap: 8px; }
.sec h3 { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--card); border: 1.5px solid var(--ink); border-radius: 10px; margin: 6px 0; }
.row .grow { flex: 1; min-width: 0; }
.para { white-space: pre-wrap; margin: 6px 0; }
.warn { background: #FFE3E3; border: 1.5px solid var(--ink); border-radius: 10px; padding: 6px 10px; margin: 8px 0; font-weight: 700; }

form.f label, .login label { display: block; font-size: 13px; font-weight: 800; margin: 10px 0 0; }
form.f input, form.f select, form.f textarea, .login input { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border: var(--line); border-radius: 10px; background: var(--card); font-weight: 600; }
form.f textarea { min-height: 70px; resize: vertical; }
form.f .two { display: flex; gap: 8px; } form.f .two > * { flex: 1; min-width: 0; }
form.f .check { display: flex; align-items: center; gap: 8px; } form.f .check input { width: auto; margin: 0; }
.adrow { display: flex; gap: 6px; align-items: center; margin-top: 6px; } .adrow select { margin-top: 0 !important; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.btn { border: var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px; font-weight: 800; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); }
.btn.primary { background: var(--cyan); }
.btn.danger { background: var(--red); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.err { color: #C62828; font-weight: 700; font-size: 13px; min-height: 18px; margin-top: 6px; }

.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg); z-index: 30; }
.login form { width: 100%; max-width: 360px; padding: 20px; }
.login h1 { margin-bottom: 6px; }
.login .btn { width: 100%; margin-top: 10px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 90px); background: var(--ink); color: var(--card); padding: 10px 14px; border-radius: 10px; font-weight: 700; z-index: 40; max-width: calc(100% - 32px); }
