:root {
  --green: #1f4d3a;
  --green-2: #2c6a50;
  --green-soft: #e3ece5;
  --on-green: #fbf8f1;
  --paper: #faf6ee;
  --page: #efe9dc;
  --card: #ffffff;
  --ink: #1d211f;
  --ink-2: #55595a;
  --line: #ddd7ca;
  --line-2: #ebe6db;
  --avail: #3f9a6b;
  --sold: #c9c6bd;
  --occ: #26302b;
  --warn: #9a5b12;
  --warn-soft: #fbefdc;
  --bad: #a3322a;
  --bad-soft: #f8e3e0;
  --r: 14px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 18px/1.4 var(--sans);
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--green); }
[hidden] { display: none !important; }

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px var(--line);
}
.loading-screen { flex: 1; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--ink-2); }
.brand-mark { width: 56px; height: 56px; border-radius: 14px; background: var(--green) url(icon.svg) center/cover; }

/* Banners and header */
.trial { background: var(--green-soft); color: var(--green); text-align: center; font-size: 14px; font-weight: 600; padding: 6px 12px; }
.top { padding: 14px 18px 12px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 12px; background: var(--paper); position: sticky; top: 0; z-index: 5; }
.top .grow { flex: 1; min-width: 0; }
.top .org { font-size: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top h1 { margin: 2px 0 0; font-size: 24px; line-height: 1.2; color: var(--green); }
.icon-btn { flex: none; min-width: 48px; min-height: 48px; border-radius: 12px; border: 2px solid var(--green); background: transparent; color: var(--green); font-weight: 700; font-size: 15px; padding: 0 12px; cursor: pointer; }
.main { flex: 1; padding: 18px 18px 110px; display: grid; gap: 18px; align-content: start; }

/* Bottom nav */
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: center; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav-inner { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; max-width: 560px; }
.nav a { display: grid; justify-items: center; gap: 2px; padding: 10px 2px 12px; text-decoration: none; color: var(--ink-2); font-size: 14px; font-weight: 600; min-height: 64px; }
.nav a .ico { font-size: 22px; line-height: 1; }
.nav a[aria-current="page"] { color: var(--green); box-shadow: inset 0 3px 0 var(--green); }

/* Text */
.greet { font-size: 26px; font-weight: 600; line-height: 1.2; margin: 0; }
h2 { font-size: 21px; margin: 0; line-height: 1.25; }
h3 { font-size: 18px; margin: 0; }
.muted { color: var(--ink-2); font-size: 16px; }
.small { font-size: 14px; }
p { margin: 0; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 12px; }
.card.status { background: var(--green); color: var(--on-green); border: 0; }
.card.status .big { font-size: 22px; font-weight: 700; line-height: 1.25; }
.card.status .muted { color: color-mix(in srgb, var(--on-green) 80%, transparent); }
.card.warn { background: var(--warn-soft); border-color: #ecd3ad; }
.card.bad { background: var(--bad-soft); border-color: #eec1bb; }
.bar { height: 14px; border-radius: 99px; background: color-mix(in srgb, var(--on-green) 25%, transparent); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--on-green); border-radius: inherit; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 10px; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 8px; display: grid; gap: 4px; text-align: center; text-decoration: none; color: inherit; }
.tile b { font-size: 26px; line-height: 1.1; color: var(--green); }
.tile span { font-size: 14px; color: var(--ink-2); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; padding: 12px 20px; border-radius: 12px; border: 0; background: var(--green); color: var(--on-green); font-weight: 700; font-size: 18px; cursor: pointer; width: 100%; text-decoration: none; text-align: center; }
.btn:hover { background: var(--green-2); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.light { background: var(--on-green); color: var(--green); }
.btn.ghost { background: transparent; color: var(--green); border: 2px solid var(--green); }
.btn.ghost:hover { background: var(--green-soft); }
.btn.danger { background: transparent; color: var(--bad); border: 2px solid var(--bad); }
.btn.small { min-height: 44px; font-size: 16px; padding: 8px 14px; width: auto; }
.linkbtn { background: none; border: 0; color: var(--green); text-decoration: underline; font-weight: 600; cursor: pointer; padding: 6px 0; font-size: 16px; }

/* Forms */
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 16px; }
label .hint { font-weight: 400; color: var(--ink-2); font-size: 14px; }
input, select, textarea { width: 100%; min-height: 52px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 10px; background: var(--card); font-size: 18px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
input[type="checkbox"], input[type="radio"] { width: 26px; height: 26px; min-height: 0; accent-color: var(--green); flex: none; }
.check { display: flex; gap: 12px; align-items: center; font-weight: 500; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 2px solid var(--green); border-radius: 12px; overflow: hidden; }
.seg button { min-height: 52px; border: 0; background: transparent; color: var(--green); font-weight: 700; cursor: pointer; font-size: 16px; padding: 4px; }
.seg button + button { border-left: 2px solid var(--green); }
.seg button[aria-pressed="true"] { background: var(--green); color: var(--on-green); }
.err { color: var(--bad); font-weight: 600; font-size: 16px; }
.ok { color: var(--green); font-weight: 600; font-size: 16px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list > li { border-bottom: 1px solid var(--line-2); }
.list > li:last-child { border-bottom: 0; }
.list .item { display: flex; gap: 14px; align-items: center; padding: 14px 2px; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; color: inherit; text-decoration: none; }
.list .grow { flex: 1; min-width: 0; }
.list .name { font-weight: 700; }
.list .sub { font-size: 15px; color: var(--ink-2); }
.amt { font-weight: 700; white-space: nowrap; }
.amt.in { color: var(--green); }
.amt.out { color: var(--bad); }
.pill { display: inline-block; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--green-soft); color: var(--green); white-space: nowrap; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.empty { text-align: center; color: var(--ink-2); padding: 18px 6px; }

/* Checklist */
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.checks li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.checks li:last-child { border-bottom: 0; }
.checks .dot { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 16px; }
.checks .done .dot { background: var(--green); color: var(--on-green); }
.checks .todo .dot { border: 2px solid var(--warn); color: var(--warn); }
.checks .todo .t { font-weight: 600; }
.checks .done .t { color: var(--ink-2); }

/* Lot map */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 15px; color: var(--ink-2); }
.legend i { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: -3px; margin-right: 6px; }
.lotgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; }
.lot { aspect-ratio: 1; border-radius: 10px; border: 0; font-weight: 700; font-size: 15px; cursor: pointer; display: grid; place-items: center; padding: 2px; overflow: hidden; word-break: break-all; }
.lot.available { background: var(--avail); color: #fff; }
.lot.sold { background: var(--sold); color: var(--ink); }
.lot.occupied { background: var(--occ); color: #fff; }
.lot.pc { box-shadow: inset 0 0 0 3px #d9b45a; }
.lot.sel { outline: 4px solid #d9b45a; outline-offset: 2px; }

/* Sheet (modal) */
.sheet-bg { position: fixed; inset: 0; background: rgba(15, 20, 17, .45); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--paper); width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 20px 18px calc(28px + env(safe-area-inset-bottom)); display: grid; gap: 16px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--occ); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 50; max-width: 90vw; text-align: center; }

/* Auth */
.auth { flex: 1; padding: 28px 22px 40px; display: grid; gap: 22px; align-content: start; }
.auth .hero { display: grid; gap: 10px; justify-items: start; }
.auth h1 { font-size: 30px; margin: 0; color: var(--green); }

/* Report table */
.rtable { width: 100%; border-collapse: collapse; font-size: 16px; }
.rtable td, .rtable th { padding: 8px 4px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.rtable td.num, .rtable th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rtable tr.sub td { font-weight: 700; border-top: 2px solid var(--ink); }
.rtable .ln { width: 2.2em; color: var(--ink-2); font-weight: 700; }
.disclaimer { font-size: 14px; color: var(--ink-2); border-left: 4px solid var(--warn); padding: 6px 10px; background: var(--warn-soft); border-radius: 4px; }

/* Printable form */
.printform { display: none; }
@media print {
  @page { size: letter; margin: 0.5in; }
  body { background: #fff; font-size: 10.5pt; }
  .app { box-shadow: none; max-width: none; background: #fff; }
  .app > *:not(.printform) { display: none !important; }
  .nav, .toast, .trial, .top, .no-print { display: none !important; }
  .printform { display: block !important; color: #000; font: 10.5pt/1.3 Arial, Helvetica, sans-serif; }
}
.printform h1 { font-size: 14pt; text-align: center; margin: 0 0 2pt; }
.printform h2 { font-size: 11.5pt; background: #000; color: #fff; padding: 3pt 6pt; margin: 12pt 0 4pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.printform .formno { display: flex; justify-content: space-between; font-size: 8.5pt; }
.printform .hdr { display: flex; justify-content: space-between; border: 1px solid #000; padding: 4pt 6pt; margin: 6pt 0; font-size: 9.5pt; }
.printform table { width: 100%; border-collapse: collapse; margin: 2pt 0 6pt; page-break-inside: avoid; }
.printform td, .printform th { border: 1px solid #000; padding: 3pt 5pt; vertical-align: top; text-align: left; }
.printform th { background: #eee; font-size: 9pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.printform td.num { text-align: right; width: 1.3in; font-variant-numeric: tabular-nums; }
.printform td.l { width: 0.3in; font-weight: 700; text-align: center; }
.printform tr.b td { font-weight: 700; }
.printform .lbl { font-size: 8.5pt; color: #333; display: block; }
.printform .note { font-size: 8.5pt; margin: 2pt 0 6pt; }
.printform .sig td { height: 34pt; }
.printform .pb { page-break-before: always; }
.printform .disc { border: 1.5px solid #000; padding: 5pt; font-weight: 700; font-size: 9.5pt; margin: 6pt 0; }
.printform .flag { font-weight: 700; }

@media (min-width: 700px) {
  body { padding: 0; }
  .main { padding-left: 24px; padding-right: 24px; }
}
