/* Layout: one phone-width column and a bottom tab bar; cool neutrals with one fresh green. */
:root {
  --bg: #f4f6f5; --surface: #ffffff; --soft: #e9eeec; --ink: #17211e; --muted: #5d6b66; --line: #dfe5e2;
  --navy: #17211e; --gold: #0b7a5e; --gold-soft: #e3f4ee;
  --btn: #0b7a5e; --btn-ink: #ffffff; --hero: #0b7a5e; --hero-ink: #ffffff; --hero-muted: #c9ecdf; --hero-line: rgba(255,255,255,.24); --hero-gold: #ffffff;
  --good: #0b7a5e; --good-soft: #e3f4ee; --warn: #8a5a00; --warn-soft: #fbeed0; --bad: #b42318; --bad-soft: #fde7e4; --info: #1d5fa8; --info-soft: #e5eefa;
  --shadow: 0 1px 2px rgba(20,35,30,.06);
  --serif: "Figtree", "Noto Sans TC", "PingFang TC", system-ui, sans-serif;
  --sans: "Figtree", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #101615; --surface: #19211f; --soft: #232d2a; --ink: #e4ebe8; --muted: #9aa8a3; --line: #2c3734;
  --navy: #e4ebe8; --gold: #4fc9a4; --gold-soft: #17332b;
  --btn: #2fa783; --btn-ink: #06140f; --hero: #17332b; --hero-ink: #f1f7f5; --hero-muted: #a5cfc1; --hero-line: rgba(255,255,255,.14); --hero-gold: #f1f7f5;
  --good: #4fc9a4; --good-soft: #17332b; --warn: #e3b866; --warn-soft: rgba(227,184,102,.14); --bad: #fca5a5; --bad-soft: rgba(248,113,113,.14); --info: #8dbbef; --info-soft: rgba(141,187,239,.14);
  --shadow: none; color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #101615; --surface: #19211f; --soft: #232d2a; --ink: #e4ebe8; --muted: #9aa8a3; --line: #2c3734;
  --navy: #e4ebe8; --gold: #4fc9a4; --gold-soft: #17332b;
  --btn: #2fa783; --btn-ink: #06140f; --hero: #17332b; --hero-ink: #f1f7f5; --hero-muted: #a5cfc1; --hero-line: rgba(255,255,255,.14); --hero-gold: #f1f7f5;
  --good: #4fc9a4; --good-soft: #17332b; --warn: #e3b866; --warn-soft: rgba(227,184,102,.14); --bad: #fca5a5; --bad-soft: rgba(248,113,113,.14); --info: #8dbbef; --info-soft: rgba(141,187,239,.14);
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--soft); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; font-variant-numeric: tabular-nums; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.app { max-width: 460px; margin: 0 auto; min-height: 100dvh; background: var(--bg); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.gut { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.hd { display: flex; align-items: center; gap: 8px; padding-block: 10px; }
.hd h1 { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; margin: 0; flex: 1; color: var(--navy); min-width: 0; }
.hd-logo { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.hd .back { border: 0; background: none; font-size: 1.3rem; line-height: 1; padding: 4px 8px 4px 0; color: var(--navy); }
.iconbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; min-width: 38px; height: 34px; padding: 0 10px; font-size: .82rem; font-weight: 600; color: var(--navy); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 5px 12px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); }
main { flex: 1; padding-block: 16px 24px; display: flex; flex-direction: column; gap: 16px; }
h2 { font-family: var(--serif); font-size: 1rem; font-weight: 700; margin: 0; color: var(--navy); }
.hero { background: var(--hero); color: var(--hero-ink); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.hero .lbl { font-size: .85rem; color: var(--hero-muted); }
.hero .big { font-family: var(--serif); font-weight: 700; letter-spacing: -.02em; font-size: 2.6rem; line-height: 1.15; color: var(--hero-ink); }
.hero .rows { margin-top: 10px; border-top: 1px solid var(--hero-line); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; font-size: .88rem; }
.hero .rows div { display: flex; justify-content: space-between; gap: 12px; }
.hero .rows span:first-child { color: var(--hero-muted); }
.hero .rows .au { color: var(--hero-gold); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 14px 12px; text-align: left; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.action b { font-weight: 700; font-size: 1.05rem; color: var(--navy); }
.action small { color: var(--muted); font-size: .78rem; }
.action.todo b { font-size: 1.6rem; line-height: 1.1; }
.sec { display: flex; flex-direction: column; gap: 8px; }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.link { border: 0; background: none; color: var(--navy); font-size: .85rem; font-weight: 600; padding: 2px 0; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.row { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 2px 10px; padding: 11px 12px; width: 100%; border: 0; background: none; text-align: left; align-items: start; }
.list > * + * { border-top: 1px solid var(--line); }
.row .d { color: var(--muted); font-weight: 500; font-size: .88rem; line-height: 1.4; }
.row .t { min-width: 0; font-size: .95rem; font-weight: 600; overflow-wrap: anywhere; }
.row .s { min-width: 0; font-size: .78rem; color: var(--muted); grid-column: 2; overflow-wrap: anywhere; }
.row .a { text-align: right; font-weight: 600; font-size: .95rem; white-space: nowrap; }
.row .b { text-align: right; font-size: .75rem; color: var(--muted); grid-column: 3; white-space: nowrap; }
.pos { color: var(--good); }
.pill { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: .7rem; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.p-good { background: var(--good-soft); color: var(--good); } .p-warn { background: var(--warn-soft); color: var(--warn); }
.p-bad { background: var(--bad-soft); color: var(--bad); } .p-info { background: var(--info-soft); color: var(--info); }
.detail { padding: 0 12px 12px 66px; font-size: .84rem; color: var(--muted); display: flex; flex-direction: column; gap: 6px; border-top: 0 !important; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .field > .lb { font-size: .85rem; font-weight: 600; }
.field small { color: var(--muted); font-size: .78rem; }
input[type=text], input[type=date], input[type=search], input[inputmode], select, textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 10px 12px; font-size: 16px; }
textarea { min-height: 64px; resize: vertical; }
.amount { font-weight: 600; font-size: 1.6rem !important; padding: 8px 12px !important; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: .86rem; }
.chip[aria-pressed="true"] { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); font-weight: 600; }
.upload { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1.5px dashed var(--line); border-radius: 14px; padding: 20px 12px; background: var(--surface); text-align: center; cursor: pointer; }
.upload b { color: var(--navy); }
.upload small { color: var(--muted); font-size: .78rem; }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.thumbs img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.thumbs span { font-size: .78rem; color: var(--muted); align-self: center; overflow-wrap: anywhere; }
.err { color: var(--bad); font-size: .85rem; font-weight: 600; }
.btn { border: 0; border-radius: 12px; background: var(--btn); color: var(--btn-ink); padding: 12px 14px; font-weight: 700; font-size: .98rem; width: 100%; }
.btn.ghost { background: var(--surface); color: var(--navy); border: 1px solid var(--line); }
.btn.danger { background: var(--surface); color: var(--bad); border: 1px solid var(--line); }
.btns { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }
.btns .btn { padding: 10px 6px; font-size: .9rem; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .88rem; }
.check input { margin-top: 4px; }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; background: var(--gold-soft); border-radius: 10px; font-weight: 600; }
.total b { font-size: 1.25rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.review-top { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 12px; }
.review-top.none { grid-template-columns: minmax(0,1fr); }
.review-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.bigamt { font-weight: 700; letter-spacing: -.01em; font-size: 1.5rem; line-height: 1.2; color: var(--navy); }
.meta { font-size: .84rem; color: var(--muted); display: flex; flex-direction: column; gap: 1px; overflow-wrap: anywhere; }
.meta b { color: var(--ink); font-weight: 600; }
.panel { background: var(--soft); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.payline { display: flex; justify-content: space-between; gap: 10px; font-size: .86rem; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: .92rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters .full { grid-column: 1 / -1; }
.tw { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; font-size: .82rem; }
th, td { padding: 8px 9px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
thead th { border-top: 0; color: var(--muted); font-weight: 600; font-size: .74rem; }
th:first-child, td:first-child { text-align: left; }
td button { border: 0; background: none; padding: 0; color: var(--navy); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--line); }
tr.mon td { background: var(--gold-soft); font-weight: 700; }
tr.tot td { font-weight: 700; background: var(--soft); }
.foot { padding-block: 8px; text-align: center; font-size: .72rem; color: var(--muted); overflow-wrap: anywhere; }
.foot .dot { opacity: .5; }
nav { position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding-bottom: env(safe-area-inset-bottom, 0px); }
nav button { border: 0; background: none; padding: 8px 2px 7px; font-size: .74rem; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
nav button[aria-current="page"] { color: var(--navy); font-weight: 700; }
nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.badge { position: absolute; top: 3px; left: calc(50% + 7px); background: var(--bad); color: #fff; border-radius: 999px; font-size: .64rem; font-weight: 700; min-width: 16px; line-height: 16px; padding: 0 4px; }
:root[data-theme="dark"] .badge { color: #2a0d0b; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(74px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-size: .88rem; font-weight: 600; z-index: 20; max-width: calc(100% - 32px); text-align: center; }
@media (prefers-reduced-motion: no-preference) { .btn, .chip, .action { transition: transform .08s ease; } .btn:active, .chip:active, .action:active { transform: scale(.98); } }

/* Real app: states the mockup did not need. */
[hidden] { display: none !important; }
.banner { padding-block: 8px; font-size: .84rem; background: var(--warn-soft); color: var(--warn); display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.banner button { border: 1px solid currentColor; background: none; color: inherit; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 600; flex: none; }
.spin { font-size: .78rem; color: var(--muted); }
.btn:disabled, .action:disabled { opacity: .55; cursor: progress; }
.hint { font-size: .78rem; color: var(--muted); }
.lock { display: flex; flex-direction: column; gap: 14px; margin-top: 8vh; }
.lock .logo { width: 56px; height: 56px; border-radius: 14px; }
.lock h2 { font-size: 1.5rem; }
input[type=password] { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 10px 12px; font-size: 16px; }
.who { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .84rem; color: var(--muted); }
.skeleton { height: 150px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.thumbs .tile { position: relative; display: flex; align-items: center; gap: 6px; }
.thumbs .x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); line-height: 1; padding: 0; font-size: .8rem; color: var(--ink); }
.thumbs .fname { max-width: 150px; padding-right: 14px; }
.rthumbs { display: flex; flex-direction: column; gap: 6px; align-self: start; }
.rthumb { width: 92px; height: 92px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); color: var(--muted); font-size: .76rem; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.rthumbs.row { flex-direction: row; flex-wrap: wrap; }
.rthumbs.row .rthumb { width: 80px; height: 80px; }
.rthumb { flex-direction: column; cursor: pointer; }
.rthumb b { font-size: 1.5rem; font-weight: 400; line-height: 1.2; }
#rpreview { position: fixed; z-index: 20; width: 320px; max-width: 45vw; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px; box-shadow: var(--shadow); }
#rpreview img { display: block; width: 100%; max-height: 70vh; object-fit: contain; }
.rthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dlinks { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.viewer { position: fixed; inset: 0; z-index: 30; background: rgba(8,14,12,.92); color: #fff; display: flex; flex-direction: column; }
.viewer .vbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: max(10px, env(safe-area-inset-top, 0px)) 16px 10px; font-size: .88rem; }
.viewer .vbar a, .viewer .vbar button { color: #fff; background: none; border: 1px solid rgba(255,255,255,.4); border-radius: 999px; padding: 5px 12px; font-size: .84rem; text-decoration: none; white-space: nowrap; }
.viewer .vbar .acts { display: flex; gap: 8px; flex: none; }
.viewer .vname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer .vbody { flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 0 8px 16px; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; touch-action: none; user-select: none; cursor: zoom-in; }
.viewer img.zoomed { cursor: grab; }
.viewer .vmsg { margin: auto; text-align: center; padding: 24px; }
/* The month table has five money columns: keep all of them on a phone, not behind a scroll. */
.tw table { font-size: .76rem; }
.tw th, .tw td { padding: 7px 5px; }
.tw th:first-child, .tw td:first-child { padding-left: 10px; white-space: normal; word-break: keep-all; }
.tw tr.mon td:first-child { white-space: nowrap; }
.tw th:last-child, .tw td:last-child { padding-right: 10px; }
/* Team Book additions. */
.btn.small { width: auto; padding: 7px 12px; font-size: .84rem; }
.detail .btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.linkrow { display: flex; gap: 8px; align-items: center; }
.linkrow input { flex: 1; min-width: 0; }
.who-acts { display: flex; gap: 14px; }
a.link { text-decoration: none; }
a.rthumb { display: flex; align-items: center; justify-content: center; text-decoration: none; font-size: .78rem; color: var(--navy); text-align: center; }
.actor { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.sec .who { padding-top: 4px; }
input[type=url], input[type=email] { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 10px 12px; font-size: 1rem; }
@media (max-width: 420px) { .tw table { font-size: .7rem; } .tw th, .tw td { padding: 7px 3px; } .tw th:first-child, .tw td:first-child { padding-left: 8px; } .tw th:last-child, .tw td:last-child { padding-right: 8px; } }
