/* White Pines Adventures — mobile-first shop OS. */
:root {
  --bg: #141a14;
  --bg-2: #0e130e;
  --surface: #1c241c;
  --surface-2: #243028;
  --line: #314034;
  --text: #e8f0e4;
  --muted: #8aa08c;
  --accent: #3d7a54;
  --accent-ink: #e8f0e4;
  --ok: #3dba7a;
  --warn: #e6b84d;
  --err: #e85d4c;
  --info: #4aa3e8;
  --radius: 14px;
  --tap: 48px;
  --header-h: 56px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --precon: #4aa3e8;
  --rough: #f0a202;
  --trim: #2eb8a0;
  --startup: #b07cff;
  --punch: #3dba7a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; line-height: 1.4; }
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
h1,h2,h3 { margin: 0 0 .4rem; font-weight: 700; letter-spacing: -0.02em; }

.app-top {
  position: sticky; top: 0; z-index: 40;
}
.app-header {
  position: relative; top: auto; z-index: 1;
  display: flex; align-items: center; gap: .6rem;
  min-height: var(--header-h);
  padding: .4rem .9rem;
  padding-top: max(.4rem, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.app-header .brand {
  display: flex; align-items: center; gap: .55rem;
  color: var(--text); font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; font-size: .92rem;
}
.mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 900; font-size: .95rem;
}
.app-header .spacer { flex: 1; }
.who { color: var(--muted); font-size: .8rem; }

.wrap { width: min(720px, 100%); margin: 0 auto; padding: .9rem .9rem 6.5rem; }
.wrap-login { padding-bottom: 2rem; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: .75rem;
}
.card h2 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

label { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: .7rem 0 .3rem; font-weight: 600; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="search"],
input[type="email"], input[type="tel"], input[type="datetime-local"],
select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: .7rem .85rem;
  background: #eef3ea;
  border: 1px solid #9aaf9c;
  border-radius: 12px;
  outline: none;
  color: #142016;
  font-weight: 600;
  -webkit-text-fill-color: #142016;
}
input::placeholder, textarea::placeholder {
  color: #4a5c4e;
  opacity: 1;
  -webkit-text-fill-color: #4a5c4e;
  font-weight: 500;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
select { color: #142016; }
select option { color: #142016; background: #eef3ea; }
input[type="file"] {
  width: 100%;
  padding: .6rem;
  background: var(--bg-2);
  border: 1px dashed var(--line);
  border-radius: 12px;
  min-height: var(--tap);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap);
  padding: 0 1rem;
  border: 0; border-radius: 12px;
  background: var(--surface-2); color: var(--text);
  font-weight: 700; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ok { background: var(--ok); color: #0b1a12; }
.btn-danger { background: transparent; color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 50%, var(--line)); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 .75rem; font-size: .85rem; }

.flash { padding: .75rem 1rem; border-radius: 12px; margin: .6rem 0; font-weight: 600; }
.flash.ok { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); color: #b6f0cf; }
.flash.err { background: color-mix(in srgb, var(--err) 18%, var(--surface)); color: #ffc7c0; }

.chip-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 .75rem;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: .82rem;
  cursor: pointer;
}
.chip.on { border-color: transparent; }
.chip.precon.on, .chip[data-phase="precon"].on { background: var(--precon); color: #071018; }
.chip.rough.on, .chip[data-phase="rough"].on { background: var(--rough); color: var(--accent-ink); }
.chip.trim.on, .chip[data-phase="trim"].on { background: var(--trim); color: #062018; }
.chip.startup.on, .chip[data-phase="startup"].on { background: var(--startup); color: #160a24; }
.chip.punch.on, .chip[data-phase="punch"].on { background: var(--punch); color: #062014; }
.chip.filter.on { background: var(--text); color: var(--bg); }

.badge {
  display: inline-flex; align-items: center;
  min-height: 26px; padding: 0 .5rem;
  border-radius: 999px; font-size: .72rem; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase;
  background: var(--surface-2); color: var(--muted);
}
.badge.need, .badge.not_started { background: #3a2a1a; color: #f0c27a; }
.badge.ordered, .badge.submitted, .badge.corrections { background: #3a3314; color: #ead06a; }
.badge.on_truck, .badge.issued { background: #1a3344; color: #8ecfff; }
.badge.inspected { background: #1e2a44; color: #b7c9ff; }
.badge.installed, .badge.final, .badge.done { background: #163424; color: #8eebba; }
.badge.active { background: #163424; color: #8eebba; }
.badge.hold { background: #3a2a1a; color: #f0c27a; }
.badge.future { background: #1e2a44; color: #b7c9ff; }
.badge.new { background: #1a3344; color: #8ecfff; }
.badge.priced { background: #3a3314; color: #ead06a; }
.badge.won { background: #163424; color: #8eebba; }
.badge.lost { background: #3a1e1e; color: #ffc7c0; }
.badge.phase-precon { background: color-mix(in srgb, var(--precon) 22%, #111); color: #b7dcff; }
.badge.phase-rough { background: color-mix(in srgb, var(--rough) 22%, #111); color: #ffd37a; }
.badge.phase-trim { background: color-mix(in srgb, var(--trim) 22%, #111); color: #8af0dc; }
.badge.phase-startup { background: color-mix(in srgb, var(--startup) 22%, #111); color: #ddc2ff; }
.badge.phase-punch { background: color-mix(in srgb, var(--punch) 22%, #111); color: #8eebba; }

.job-head { padding-bottom: .2rem; }
.job-head .addr { font-size: 1.35rem; }
.job-head .meta { color: var(--muted); font-size: .9rem; margin-bottom: .55rem; }
.counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .7rem 0; }
.count {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: .7rem .5rem; text-align: center;
}
.count b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.count span { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }

.list { display: flex; flex-direction: column; gap: .55rem; }
.job-card, .line {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .9rem 1rem; color: inherit;
}
.job-card:active { background: var(--surface-2); }
.job-card-link { color: inherit; display: block; }
.job-card-actions { margin-top: .7rem; }
.job-card .top { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; }
.job-card h3 { font-size: 1.08rem; }
.searchbar { display: flex; gap: .4rem; margin-bottom: .7rem; }
.searchbar input { flex: 1; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .15rem; min-height: var(--tab-h); color: var(--muted);
  font-size: .65rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
}
.tabbar a.on { color: var(--accent); }
.tabbar svg { width: 22px; height: 22px; }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.gallery a {
  aspect-ratio: 1; overflow: hidden; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--line);
}
.gallery img { width: 100%; height: 100%; object-fit: cover; }

.phase-block { margin: 1rem 0 1.4rem; }
.phase-block h3 { display: flex; align-items: center; gap: .5rem; font-size: .95rem; }

.line { display: flex; flex-direction: column; gap: .45rem; }
.line .item { font-weight: 700; }
.line.installed .item { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.qty { color: var(--muted); font-variant-numeric: tabular-nums; }

.toolbar { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0 .8rem; }
.danger-zone { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.login-hero { text-align: center; margin-bottom: 1.4rem; }
.login-hero .mark { width: 64px; height: 64px; border-radius: 18px; font-size: 2rem; margin: 0 auto 1rem; }
.login-hero h1 { font-size: 2rem; letter-spacing: .08em; text-transform: uppercase; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 1rem; text-align: center; }

.empty { text-align: center; color: var(--muted); padding: 1.6rem .5rem; }

.form-actions { margin-top: 1rem; display: flex; gap: .5rem; flex-direction: column; }

dl.kv { display: grid; grid-template-columns: 110px 1fr; gap: .35rem 0.6rem; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .78rem; }
dl.kv dd { margin: 0; }

@media (min-width: 720px) {
  .gallery { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3efe6;
    --bg-2: #fffdf8;
    --surface: #ffffff;
    --surface-2: #efe8d8;
    --line: #d9d0bf;
    --text: #1c1914;
    --muted: #6d6456;
  }
  .app-header { background: color-mix(in srgb, var(--bg-2) 90%, transparent); }
}

.board-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: .3rem;
  padding: .4rem .7rem .5rem;
  padding-bottom: max(.5rem, env(safe-area-inset-bottom, 0px) * 0);
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.board-nav a {
  display: flex; align-items: center; justify-content: center;
  min-height: 42px;
  padding: 0 .35rem;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 800; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .03em;
  -webkit-tap-highlight-color: transparent;
}
.board-nav a.on {
  background: var(--accent);
  color: var(--accent-ink);
}


.wrap-wide { width: min(1100px, 100%); }
.bell {
  min-width: 36px; height: 36px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted);
  font-weight: 800; font-size: .75rem;
}
.bell.hot { background: var(--accent); color: var(--accent-ink); }
.house-tabs {
  display: flex; gap: .35rem; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: .4rem 0 .8rem; margin-bottom: .4rem;
}
.house-tabs a {
  flex: 0 0 auto; min-height: 42px; padding: 0 .85rem;
  border-radius: 999px; border: 1px solid var(--line);
  color: var(--text); font-weight: 700; font-size: .78rem;
  display: inline-flex; align-items: center;
}
.house-tabs a.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.progress {
  height: 10px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; margin: .55rem 0 .25rem;
}
.progress i { display: block; height: 100%; background: var(--accent); }
.plot-img { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #111; }
.lot-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .55rem; margin-bottom: 1.2rem;
}
.lot-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: .75rem .8rem; color: inherit; min-height: 96px;
}
.lot-card.need { border-color: #c9a227; }
.lot-card.live { border-color: var(--accent); }
.lot-num { font-weight: 800; font-size: 1.1rem; }
.lot-addr { color: var(--muted); font-size: .82rem; margin: .2rem 0 .4rem; }
.section-head { margin: 1.2rem 0 .5rem; font-size: 1.05rem; }
.modal-bg {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.62);
  display: flex; align-items: flex-end; justify-content: center;
  padding: .6rem;
}
.modal { width: min(560px, 100%); max-height: 92dvh; overflow: auto; margin: 0; }
.badge.submitted, .badge.accepted, .badge.needed, .badge.received { }
.badge.accepted { background: #163424; color: #8eebba; }
.badge.submitted { background: #3a3314; color: #ead06a; }
.badge.needed { background: #3a2a1a; color: #f0c27a; }
.badge.received { background: #163424; color: #8eebba; }
.badge.rejected { background: #3a1e1e; color: #ffc7c0; }
@media (min-width: 720px) {
  .modal-bg { align-items: center; }
  .app-header .brand span:last-child { font-size: .85rem; }
}

.badge.open { background: #3a2a1a; color: #f0c27a; }
.badge.answered { background: #1a3344; color: #8ecfff; }
.badge.closed { background: #222; color: #aaa; }
.badge.draft { background: #1e2a44; color: #b7c9ff; }
.badge.approved { background: #163424; color: #8eebba; }
.budget-strip b { color: var(--text, #eee); }


/* Month calendar grid */
.month-cal { margin: .6rem 0 1.2rem; }
.month-cal-nav {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  margin-bottom: .65rem;
}
.month-cal-title {
  margin: 0; font-size: 1.15rem; text-align: center; flex: 1;
  letter-spacing: -0.02em;
}
.month-cal-grid {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.month-cal-head, .month-cal-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.month-cal-dow {
  text-align: center;
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  padding: .45rem .15rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.month-cal-day {
  min-height: 72px;
  padding: .28rem .22rem .35rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.month-cal-week .month-cal-day:nth-child(7n) { border-right: none; }
.month-cal-week:last-child .month-cal-day { border-bottom: none; }
.month-cal-day.out { background: color-mix(in srgb, var(--bg) 55%, var(--surface)); }
.month-cal-day.out .month-cal-num { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.month-cal-day.today {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent);
}
.month-cal-num {
  font-weight: 800; font-size: .78rem; line-height: 1.1;
  color: var(--text);
}
.month-cal-day.today .month-cal-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.45rem; height: 1.45rem; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
}
.month-cal-events {
  display: flex; flex-direction: column; gap: .15rem;
  min-width: 0;
}
.month-cal-chip {
  display: block;
  min-width: 0;
  padding: .12rem .28rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 28%, var(--surface-2));
  color: var(--text);
  font-size: .62rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.month-cal-chip:active { filter: brightness(1.08); }
.month-cal-chip-time { color: #b7e0c4; font-weight: 800; }
.month-cal-list { margin-top: 1rem; }
.month-cal-list .section-head { margin-top: .4rem; }

@media (min-width: 720px) {
  .month-cal-day { min-height: 96px; padding: .35rem .3rem .45rem; }
  .month-cal-chip { font-size: .72rem; padding: .18rem .35rem; }
  .month-cal-num { font-size: .85rem; }
}
@media (max-width: 420px) {
  .month-cal-day { min-height: 58px; padding: .2rem .12rem .25rem; }
  .month-cal-chip { font-size: .55rem; padding: .08rem .18rem; }
  .month-cal-dow { font-size: .6rem; padding: .35rem .05rem; }
}
