:root {
  --g: #2E7D32; --g-dark: #1B5E20; --g-light: #66BB6A; --g-bg: #F1F8F1; --card: #fff;
  --ink: #1b2a1d; --muted: #5b6b5d; --line: #dde8dd; --warn: #b26a00; --err: #b3261e; --blue: #0288D1;
  --r: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--g-bg); color: var(--ink); font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px; }
body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); min-height: 100vh; }
h1, h2, h3 { font-family: Manrope, Inter, system-ui, sans-serif; margin: 0; }
.wrap { max-width: 520px; margin: 0 auto; padding: 0 16px 16px; }
header.top { display: flex; align-items: center; gap: 10px; padding: calc(14px + env(safe-area-inset-top)) 16px 12px; max-width: 520px; margin: 0 auto; }
header.top .logo { width: 38px; height: 38px; border-radius: 12px; background: var(--g); display: grid; place-items: center; }
header.top h1 { font-size: 20px; flex: 1; }
header.top .back { background: none; border: 0; font-size: 22px; padding: 6px 10px; color: var(--g-dark); cursor: pointer; }
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin: 12px 0; box-shadow: 0 1px 3px rgba(27,94,32,.08); border: 1px solid var(--line); }
.hero { background: linear-gradient(135deg, var(--g), var(--g-dark)); color: #fff; border: 0; }
.hero .badge { background: rgba(255,255,255,.2); color: #fff; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #e3f2e3; color: var(--g-dark); }
.badge.warn { background: #fff1d6; color: var(--warn); }
.hero h2 { font-size: 18px; margin: 8px 0 12px; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric { background: rgba(255,255,255,.14); border-radius: 12px; padding: 10px 12px; }
.metric small { display: block; opacity: .85; font-size: 12px; }
.metric b { font-size: 22px; font-family: Manrope, Inter, sans-serif; }
.metric.wide { grid-column: 1 / -1; }
button, .btn { font: inherit; border: 0; border-radius: 14px; cursor: pointer; }
.btn-primary { width: 100%; min-height: 56px; background: var(--g); color: #fff; font-weight: 700; font-size: 17px; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 4px 12px rgba(46,125,50,.35); text-decoration: none; padding: 0 16px; }
.btn-primary:active { background: var(--g-dark); }
.btn-primary[disabled] { opacity: .5; box-shadow: none; }
.btn-sec { min-height: 48px; background: #fff; color: var(--g-dark); border: 2px solid var(--g) !important; font-weight: 600; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn-sec.full { width: 100%; }
.btn-danger { color: var(--err); border-color: var(--err) !important; }
.btn-sm { min-height: 40px; font-size: 14px; padding: 0 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: 10px; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 4px 4px; }
.section-title h3 { font-size: 17px; }
.link { background: none; color: var(--g-dark); font-weight: 600; padding: 6px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.item .t { flex: 1; min-width: 0; }
.item .t b { display: block; text-transform: capitalize; }
.item .t span { color: var(--muted); font-size: 14px; }
.item .amt { font-weight: 700; font-family: Manrope, Inter, sans-serif; }
.icon-btn { width: 44px; height: 44px; background: var(--g-bg); color: var(--g-dark); font-size: 18px; display: grid; place-items: center; text-decoration: none; border-radius: 12px; }
label.f { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin: 12px 0 4px; }
input, select { width: 100%; font: inherit; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); min-height: 48px; }
input:focus { outline: 2px solid var(--g-light); border-color: var(--g); }
.bignum { font-family: Manrope, Inter, sans-serif; font-size: 34px; font-weight: 800; }
.ai { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: #e8f4fd; color: #01579b; }
.ai.warn { background: #fff1d6; color: var(--warn); }
.tip { background: #e8f4fd; color: #01579b; border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.sum { width: 100%; border-collapse: collapse; }
.sum td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.sum td:last-child { text-align: right; font-weight: 700; }
.sum tr.total td { border: 0; font-size: 19px; color: var(--g-dark); padding-top: 12px; }
.words { color: var(--muted); font-size: 13px; text-align: right; }
.photo { width: 100%; border-radius: 14px; display: block; max-height: 260px; object-fit: cover; }
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
nav.tabs button { flex: 1; background: none; padding: 10px 0 8px; color: var(--muted); font-size: 12px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 2px; }
nav.tabs button span { font-size: 22px; }
nav.tabs button.on { color: var(--g-dark); }
.seg { display: flex; background: var(--g-bg); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; min-height: 42px; background: none; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--g); color: #fff; }
.paper { position: relative; width: 100%; max-width: 280px; aspect-ratio: 595 / 842; background: #fff; margin: 10px auto; border: 1px solid #ccd; box-shadow: 0 3px 10px rgba(0,0,0,.15); touch-action: none; overflow: hidden; }
.paper .ln { position: absolute; left: 8%; right: 8%; height: 5px; border-radius: 3px; background: #e5ebe5; }
.paper img.sig { position: absolute; border: 2px dashed var(--g); cursor: grab; touch-action: none; background: rgba(46,125,50,.06); }
.paper .lab { position: absolute; right: 8%; bottom: 3.4%; font-size: 8px; color: #888; }
.pad { width: 100%; height: 220px; border: 2px dashed var(--g); border-radius: 14px; background: #fff; touch-action: none; display: block; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; z-index: 20; }
.modal .sheet { background: #fff; width: 100%; max-width: 520px; margin: 0 auto; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #263; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 30; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; }
#toast.err { background: var(--err); }
.center { text-align: center; }
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 420px; margin: 0 auto; }
.login .logo { width: 84px; height: 84px; border-radius: 24px; background: var(--g); display: grid; place-items: center; margin: 0 auto 16px; }
.muted { color: var(--muted); font-size: 14px; }
.err { color: var(--err); font-size: 14px; min-height: 20px; }
.spin { width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: sp .8s linear infinite; }
.spin.dark { border-color: rgba(46,125,50,.25); border-top-color: var(--g); }
@keyframes sp { to { transform: rotate(360deg); } }
