:root {
  --green: #13311F; --green-2: #1d4630; --gold: #F2B705; --cream: #F7F5EF; --ink: #1D2A22; --muted: #5f6b63;
  --line: #e2e6e3; --red: #b3261e; --ok: #1e7a45; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cream); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--green); }
.top { position: sticky; top: 0; z-index: 10; background: var(--green); display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; gap: 12px; }
.brand img { height: 44px; display: block; }
.top nav { display: flex; gap: 4px; }
.top nav a { color: #d8e3dc; text-decoration: none; font-weight: 600; font-size: 14px; padding: 8px 10px; border-radius: 8px; }
.top nav a.on { background: var(--green-2); color: var(--gold); }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 14px; color: var(--green); }
h2 { font-size: 16px; margin: 22px 0 10px; color: var(--green); text-transform: uppercase; letter-spacing: .06em; }
.muted { color: var(--muted); } .center { text-align: center; } .small { font-size: 13px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: center; } .row > * { flex: 1; } .wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 12px; border: 1px solid #cfd6d1; border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
textarea { min-height: 70px; resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; border: 0; border-radius: 10px;
  padding: 13px 16px; cursor: pointer; text-decoration: none; background: var(--green); color: #fff; min-height: 48px; }
.btn.gold { background: var(--gold); color: var(--green); } .btn.ghost { background: #fff; color: var(--green); border: 1px solid #cfd6d1; }
.btn.danger { background: #fff; color: var(--red); border: 1px solid #efc9c6; } .btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.new3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.new3 .btn { flex-direction: column; gap: 2px; padding: 14px 6px; font-size: 14px; }
.new3 .btn b { font-size: 22px; line-height: 1; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { background: var(--green); color: #fff; border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-size: 22px; color: var(--gold); } .stat span { font-size: 13px; color: #d8e3dc; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.chip { flex: none; border: 1px solid #cfd6d1; background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--ink); }
.chip.on { background: var(--green); color: #fff; border-color: var(--green); }
.doc { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.doc .l { min-width: 0; } .doc .l b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc .r { text-align: right; flex: none; } .doc .r b { display: block; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #eef1ef; color: var(--muted); text-transform: uppercase; }
.badge.paid, .badge.signed, .badge.accepted { background: #dff3e6; color: var(--ok); } .badge.sent { background: #fff4d1; color: #8a6400; }
.badge.overdue { background: #fbe2e0; color: var(--red); } .badge.void { background: #eee; color: #888; text-decoration: line-through; }
.line { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: #fcfcfb; }
.line .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink); margin: 8px 0 0; }
.check input { width: 22px; height: 22px; }
.totals { background: var(--green); color: #fff; border-radius: var(--radius); padding: 14px 16px; }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; } .totals .t { font-size: 20px; font-weight: 800; color: var(--gold); }
.x { background: none; border: 0; color: var(--red); font-weight: 700; cursor: pointer; padding: 6px; }
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; z-index: 20; }
#toast.show { opacity: 1; }
.login { max-width: 380px; margin: 10vh auto; }
.search { margin-bottom: 12px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } .top nav a { padding: 8px 6px; font-size: 13px; } .brand img { height: 36px; } }
