:root {
  --green: #2c7a4b;
  --green-dark: #1d5c38;
  --green-soft: #eaf3ec;
  --bg: #f4f6f4;
  --ink: #1c2420;
  --muted: #5a6a60;
  --line: #e1e7e2;
  --card: #ffffff;
  --red: #8c3327;
  --red-soft: #f6e0dd;
  --amber: #8a6d1a;
  --amber-soft: #f6eecf;
  --blue: #245a8c;
  --blue-soft: #e0ebf5;
}
* { box-sizing: border-box; margin: 0; }
body { font: 14px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--card); border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,.08); padding: 32px; width: 380px; }
.login-card h1 { font-size: 20px; color: var(--green-dark); margin-bottom: 4px; }
.login-card .sub { color: var(--muted); margin-bottom: 20px; font-size: 13px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; background: var(--bg); border-radius: 10px; padding: 4px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.tabs button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: var(--green-dark); color: #dfeee4; padding: 18px 12px; flex-shrink: 0; display: flex; flex-direction: column; }
.brand { font-weight: 800; font-size: 16px; color: #fff; padding: 0 10px 16px; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: #a9c9b4; }
.sidebar nav a { display: block; padding: 9px 10px; border-radius: 8px; color: #dfeee4; margin-bottom: 2px; font-weight: 600; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.sidebar nav a.on { background: var(--green); color: #fff; }
.sidebar .foot { margin-top: auto; padding: 10px; font-size: 12px; color: #a9c9b4; }
.sidebar .foot button { background: none; border: 0; color: #dfeee4; padding: 0; font-size: 12px; text-decoration: underline; }
.main { flex: 1; padding: 22px 26px; max-width: 1200px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; }
.loading { color: var(--muted); padding: 30px; }

/* ---------- components ---------- */
.card { background: var(--card); border-radius: 12px; border: 1px solid var(--line); padding: 16px; margin-bottom: 14px; }
.card h3 { font-size: 14px; margin-bottom: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: 12px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: 1fr 1fr 1fr; }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }

table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th { text-align: left; font-size: 12px; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 9px 8px; border-bottom: 1px solid #eef2ee; vertical-align: middle; }
table.tbl tr:hover td { background: #fafcfa; }
.r { text-align: right; }

.btn { background: var(--green); color: #fff; border: 0; border-radius: 9px; padding: 9px 16px; font-weight: 700; }
.btn:hover { background: var(--green-dark); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.ghost { background: transparent; color: var(--green-dark); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--green-soft); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid var(--line); }
.btn.danger:hover { background: var(--red-soft); }

.chip { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: #eef2ee; color: var(--muted); }
.chip.green { background: var(--green-soft); color: var(--green-dark); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.red { background: var(--red-soft); color: var(--red); }

.stat { font-size: 26px; font-weight: 800; color: var(--green-dark); }
.stat-label { color: var(--muted); font-size: 12.5px; }

/* forms */
.frm label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
.frm input, .frm select, .frm textarea { width: 100%; padding: 9px 10px; border: 1px solid #cfd8d0; border-radius: 8px; font: inherit; background: #fff; }
.frm textarea { min-height: 64px; resize: vertical; }
.frm .row { display: flex; gap: 10px; }
.frm .row > div { flex: 1; }
.frm .actions { margin-top: 16px; display: flex; gap: 8px; justify-content: flex-end; }
.frm .check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.frm .check input { width: auto; }

/* kanban */
.kanban { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: #edf1ed; border-radius: 12px; padding: 10px; flex: 1; min-width: 190px; }
.kcol h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 2px 4px 10px; }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.kcard .nm { font-weight: 700; }
.kcard .mt { color: var(--muted); font-size: 12px; margin: 2px 0 8px; }
.kcard .acts { display: flex; gap: 5px; flex-wrap: wrap; }

/* schedule */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { background: #edf1ed; border-radius: 10px; padding: 8px; min-height: 180px; }
.day.today { outline: 2px solid var(--green); }
.day h5 { font-size: 12px; color: var(--muted); margin-bottom: 8px; text-align: center; }
.jobcard { border-radius: 8px; padding: 7px 8px; margin-bottom: 6px; font-size: 12px; background: var(--card); border-left: 4px solid var(--green); cursor: pointer; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.jobcard .t { font-weight: 700; }
.jobcard .m { color: var(--muted); }
.jobcard.done { opacity: .55; }
.backlog-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; border-bottom: 1px solid #eef2ee; gap: 8px; }

/* proposal builder */
.option-block { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #fafcfa; }
.item-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-start; }
.item-row select.svc { flex: 1.7; min-width: 150px; height: 38px; }
.item-row input.desc { flex: 3; }
.item-row input.qty { width: 64px; }
.item-row input.price { width: 100px; }
.item-row select.trees { flex: 1.4; min-width: 120px; height: 38px; }
.item-row select.trees[multiple] { height: 58px; }
.item-row .del { border: 0; background: none; color: var(--red); font-size: 16px; padding: 8px 4px; }

/* modal + toast */
.overlay { position: fixed; inset: 0; background: rgba(20,30,24,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal { background: var(--card); border-radius: 14px; padding: 22px; width: 100%; max-width: 520px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal.wide { max-width: 760px; }
.modal h3 { margin-bottom: 6px; font-size: 16px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-weight: 600; z-index: 99; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.toast.err { background: var(--red); }

/* tree map */
#tree-map { height: 400px; border-radius: 10px; z-index: 1; }
#tree-map.dropping { cursor: crosshair; }
.tree-pin { width: 28px; height: 28px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.45); }
.tree-pin-wrap { background: none; border: 0; }
.leaflet-popup-content { font: 13px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif; }

/* guided demo tour */
.tour-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 16px; display: flex; gap: 10px; align-items: center; z-index: 200; width: min(680px, 94vw); box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.tour-bar button { background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 8px; padding: 8px 11px; font-size: 14px; flex-shrink: 0; }
.tour-bar button:hover { background: rgba(255,255,255,.28); }
.tour-cap { flex: 1; min-width: 0; }
.tour-step { font-size: 11px; color: #a9c9b4; text-transform: uppercase; letter-spacing: .06em; }
.tour-text { font-size: 13.5px; line-height: 1.45; }
.tour-spot { outline: 3px solid var(--green); outline-offset: 3px; border-radius: 10px; box-shadow: 0 0 0 6px rgba(44,122,75,.15); }
.tour-frame { position: fixed; inset: 4% 12% 96px; background: #fff; border-radius: 14px; overflow: hidden; z-index: 150; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.tour-frame iframe { width: 100%; height: 100%; border: 0; }
@media (max-width: 800px) { .tour-frame { inset: 2% 2% 110px; } }

.muted { color: var(--muted); }
.mb0 { margin-bottom: 0; }

/* office on a phone: sidebar collapses to a sticky top nav */
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; padding: 10px 12px 6px; position: sticky; top: 0; z-index: 30; }
  .brand { padding: 0 0 8px; }
  .brand small { display: inline; margin-left: 6px; }
  .sidebar nav { display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .sidebar nav a { white-space: nowrap; padding: 7px 11px; font-size: 13px; margin-bottom: 0; }
  .sidebar .foot { margin: 4px 0 0; padding: 0 0 4px; }
  .main { padding: 14px; }
  .page-head h2 { font-size: 17px; }
}
.mt { margin-top: 12px; }
code.k { background: var(--bg); border: 1px solid var(--line); padding: 2px 7px; border-radius: 6px; font-size: 12px; }
.copyable { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
