/* Scalehouse powered by AvlingAI — Avling brand tokens (Crop Gauge set) */
:root {
  --forest: #2e5e1e; --forest-hover: #234a16; --sage: #87a05c; --green-l: #cfe8c4;
  --deep-1: #1c3a12; --deep-2: #12240b;
  --gold: #c89a14; --amber: #a86e10; --amber-bg: #faf1dd; --taupe: #6b5749; --taupe-bg: #efe7de;
  --red: #8b1a1a; --red-bg: #f2dcd6;
  --cream: #f2f0ea; --surf: #faf9f5; --ink: #22301a; --brown2: #52503d; --line: #e4e0d2; --muted: #6f6a5e;
  --radius: 14px;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--cream);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--cream); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--forest); }
h1 { font-size: 24px; letter-spacing: -0.015em; margin: 0; }
h2 { font-size: 16px; margin: 0; }

.topbar { background: linear-gradient(180deg, var(--deep-1), var(--deep-2)); color: #e9efdd; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; flex-direction: column; line-height: 1.1; text-decoration: none; }
.brand b { color: var(--gold); letter-spacing: 0.1em; font-size: 17px; font-weight: 800; }
.brand span { color: var(--green-l); font-size: 11px; }
.topbar nav { display: flex; gap: 4px; margin-left: 12px; flex-wrap: wrap; }
.topbar nav a { color: #e9efdd; text-decoration: none; padding: 8px 12px; border-radius: 9px; font-size: 14px; }
.topbar nav a[aria-current="page"] { background: rgba(207, 232, 196, 0.16); color: #fff; font-weight: 600; }
.topbar .who { margin-left: auto; font-size: 13px; color: var(--green-l); display: flex; gap: 10px; align-items: center; }

main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 80px; display: flex; flex-direction: column; gap: 16px; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.head .sub { color: var(--muted); font-size: 14px; }
.head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 11px;
  font-size: 15px; font-weight: 600; border: 1px solid transparent; cursor: pointer; text-decoration: none; background: var(--forest); color: #fff; }
.btn:hover { background: var(--forest-hover); }
.btn.secondary { background: #fff; color: var(--forest); border-color: #c9c4b2; }
.btn.secondary:hover { background: var(--surf); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.icon-btn { width: 40px; height: 40px; padding: 0; }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: #3a2f26; }
.field.wide { grid-column: 1 / -1; }
input, select, textarea { font: inherit; font-size: 15px; min-height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surf); color: var(--ink); width: 100%; }
textarea { padding: 8px 10px; min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(46, 94, 30, 0.35); border-color: var(--forest); }
.req > .t::after { content: " •"; color: var(--amber); font-weight: 800; }

details.section { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
details.section > summary { cursor: pointer; padding: 16px 18px; font-weight: 700; display: flex; gap: 10px; align-items: baseline; list-style: none; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary .sub { font-weight: 400; color: var(--muted); font-size: 13px; }
details.section > .body { padding: 0 18px 18px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
  background: var(--surf); padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td input { min-height: 36px; font-size: 14px; }
td input.num { text-align: right; width: 88px; }
tr.check td:first-child { box-shadow: inset 3px 0 0 var(--sage); }

.pill { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--forest); color: #fff; }
.pill.warn { background: var(--amber-bg); color: var(--amber); }
.pill.muted { background: #efece2; color: var(--muted); }
.pill.bad { background: var(--red-bg); color: var(--red); }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px;
  border-radius: 12px; font-size: 14px; z-index: 50; max-width: 92vw; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2); }
.toast.error { background: var(--red); }
.saving { font-size: 12px; color: var(--muted); }

.center-card { max-width: 440px; margin: 8vh auto 0; }
.tabs { display: flex; gap: 4px; padding: 4px; background: #e9e6dc; border-radius: 12px; width: fit-content; }
.tabs button { border: none; background: transparent; min-height: 38px; padding: 0 16px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--forest); color: #fff; }

/* capture */
.photo-slot { border: 1px dashed #c9c4b2; border-radius: 12px; background: #efece2; min-height: 150px; display: flex; align-items: center;
  justify-content: center; overflow: hidden; color: var(--muted); font-size: 13px; }
.photo-slot img { width: 100%; height: 100%; object-fit: contain; max-height: 360px; }
.checklist { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px; background: var(--amber-bg); }
.checklist div { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.dot { width: 22px; height: 22px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.dot.ok { background: var(--forest); } .dot.warn { background: var(--amber); }
.steps { display: flex; gap: 14px; font-size: 13px; font-weight: 700; color: var(--muted); flex-wrap: wrap; }
.steps .on { color: var(--forest); }
.lowconf input { border-color: var(--amber); background: var(--amber-bg); }
.big-camera { min-height: 64px; font-size: 17px; width: 100%; }

@media (max-width: 720px) {
  .topbar nav, .topbar .who .email { display: none; }
  td a { white-space: nowrap; }
  h1 { font-size: 20px; }
}
