/* ===== Fernhill Landscape Co. — Field & Office ===== */
:root {
  --accent: #2f6b3a;
  --accent-2: #8a6d3b;           /* soil / bark */
  --link: var(--accent);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --bg: #f4f1e8;                 /* linen */
  --surface: #fffdf8;
  --surface-2: #f0ece0;
  --ink: #1f2a22;
  --ink-2: #3d4a40;
  --muted: #6e776d;
  --line: #e1dccd;
  --head: #1f3d2b;               /* deep forest header */
  --head-ink: #e7efe4;
  --shadow: 0 1px 0 rgba(31, 42, 34, .04), 0 6px 20px -8px rgba(31, 42, 34, .12);
  --radius: 14px;
  --green: #2f7a3e; --green-bg: #e2f0de;
  --blue: #2b5f86;  --blue-bg: #dfeaf2;
  --orange: #b4531a; --orange-bg: #f8e6d6;
  --amber: #8a6410; --amber-bg: #f6ecd0;
  --red: #a8322c;   --red-bg: #f6dfdc;
  --violet: #6a4f8f; --violet-bg: #ebe4f3;
  --gray: #5a6159;  --gray-bg: #e6e3d9;
  --font: "Work Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Fraunces", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121814; --surface: #19211b; --surface-2: #212a23; --ink: #e5ebe3; --ink-2: #c3ccc1; --muted: #8f9a8d;
    --line: #2b352d; --head: #0e1510; --head-ink: #dfe8dc; --shadow: 0 1px 2px rgba(0,0,0,.4);
    --green-bg: #183020; --green: #7fd08e; --blue-bg: #172a3a; --blue: #9cc4e4; --orange-bg: #3a2414; --orange: #f2a46e;
    --amber-bg: #352a10; --amber: #e8c565; --red-bg: #3a1a18; --red: #f0a19a; --violet-bg: #2a2238; --violet: #c8b5e6;
    --gray-bg: #2b352d; --gray: #c3ccc1; --accent-2: #c4a06a; --link: #8fca7f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121814; --surface: #19211b; --surface-2: #212a23; --ink: #e5ebe3; --ink-2: #c3ccc1; --muted: #8f9a8d;
  --line: #2b352d; --head: #0e1510; --head-ink: #dfe8dc; --shadow: 0 1px 2px rgba(0,0,0,.4);
  --green-bg: #183020; --green: #7fd08e; --blue-bg: #172a3a; --blue: #9cc4e4; --orange-bg: #3a2414; --orange: #f2a46e;
  --amber-bg: #352a10; --amber: #e8c565; --red-bg: #3a1a18; --red: #f0a19a; --violet-bg: #2a2238; --violet: #c8b5e6;
  --gray-bg: #2b352d; --gray: #c3ccc1; --accent-2: #c4a06a; --link: #8fca7f; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; margin: 0 0 .5em; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: 2.1rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.12rem; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: .88em; }
.ico { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pos { color: var(--green); } .neg { color: var(--red); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 99; background: var(--surface); padding: 8px; }
hr { border: 0; border-top: 1px dashed var(--line); margin: 1.1rem 0; }

/* ----- Masthead (top navigation) ----- */
.masthead { background: var(--head); color: var(--head-ink); position: sticky; top: 0; z-index: 40; box-shadow: 0 2px 0 var(--accent-2); }
.masthead-row { display: flex; align-items: center; gap: 16px; max-width: 1440px; margin: 0 auto; padding: 12px 24px 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; flex: none; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; height: 56px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.15); }
.brand-text small { color: #a9c49f; font-size: .72rem; text-transform: uppercase; letter-spacing: .16em; }
.topsearch { flex: 1; max-width: 520px; margin-left: auto; position: relative; display: flex; align-items: center; }
.topsearch .ico { position: absolute; left: 12px; color: #9fb39a; }
.topsearch input { width: 100%; padding: 9px 14px 9px 38px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.08); color: #fff; }
.topsearch input::placeholder { color: #9fb39a; }
.topsearch input:focus { background: rgba(255,255,255,.14); outline: 2px solid #7fb069; border-color: transparent; }
.masthead-actions { display: flex; align-items: center; gap: 8px; }
.masthead .icon-btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); color: var(--head-ink); }
.masthead .icon-btn:hover { border-color: #7fb069; }
.user-menu { display: flex; align-items: center; gap: 8px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.15); }
.user-menu a { color: #b8cdb1; }
.user-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-2); color: #fff; font-weight: 600; font-size: .8rem; }
.mainnav { display: flex; gap: 2px; max-width: 1440px; margin: 0 auto; padding: 0 18px; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { display: flex; align-items: center; gap: 8px; padding: 10px 14px 12px; color: #b8cdb1; font-weight: 500; white-space: nowrap; border-bottom: 3px solid transparent; }
.mainnav a .ico { width: 16px; height: 16px; opacity: .8; }
.mainnav a:hover { color: #fff; text-decoration: none; }
.mainnav a.active { color: #fff; border-bottom-color: #7fb069; }
.mainnav .nav-out { display: none; }
.menu-btn, .masthead .menu-btn { display: none; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; flex: none; }
.content { padding: 28px 24px 48px; max-width: 1440px; margin: 0 auto; }
.foot { text-align: center; padding: 8px 24px 96px; }
.tabbar { display: none; }

/* ----- Page header ----- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ----- Cards ----- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 18px 20px 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* Stat tiles: one joined strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; margin-bottom: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; position: relative; }
.stat::after { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.stat.accent::after { background: var(--accent); } .stat.good::after { background: var(--green); } .stat.warn::after { background: #c9921b; }
.stat.bad::after { background: var(--red); } .stat.info::after { background: var(--blue); }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 500; }
.stat-value { font-family: var(--font-head); font-size: clamp(1.35rem, 0.95rem + 0.8vw, 1.85rem); font-weight: 600; font-variant-numeric: tabular-nums lining-nums; line-height: 1.15; white-space: nowrap; }
.stat-sub { font-size: .8rem; color: var(--muted); }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.1); }
.btn-dark { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
:root[data-theme="dark"] .btn-green { color: #102015; }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 13px; font-size: .86rem; }
.btn-xs { padding: 3px 10px; font-size: .78rem; }
.btn-block { width: 100%; }
.btn .ico { width: 16px; height: 16px; }
.inline { display: inline; }

/* ----- Forms ----- */
.form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: .88rem; color: var(--ink-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; min-width: 0; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; padding: 0; }
input[type=color] { padding: 2px; height: 40px; width: 60px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
.hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--link); font-weight: 600; cursor: pointer; padding: 6px; }
.pw-meter { display: block; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters label { flex: 1 1 150px; font-size: .8rem; }
.filters .btn { flex: none; }
.card.filters { background: var(--surface-2); box-shadow: none; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0; min-width: 0; }
legend { font-weight: 600; padding: 0 6px; font-family: var(--font-head); font-size: 1rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* ----- Pills (segmented control) ----- */
.pills { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.pill { padding: 6px 14px; border-radius: 9px; color: var(--ink-2); font-weight: 500; font-size: .88rem; }
.pill:hover { text-decoration: none; background: var(--surface); }
.pill.active { background: var(--surface); color: var(--link); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.pill .count { opacity: .6; margin-left: 5px; font-weight: 500; }

/* ----- Badges & chips ----- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 6px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--green-bg); color: var(--green); } .badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-orange { background: var(--orange-bg); color: var(--orange); } .badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); } .badge-gray { background: var(--gray-bg); color: var(--gray); }
.badge-violet { background: var(--violet-bg); color: var(--violet); }
.tag { display: inline-block; padding: 2px 9px; margin: 2px 3px 2px 0; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .78rem; font-weight: 500; color: var(--ink-2); }
.tag.accent { background: var(--green-bg); border-color: color-mix(in srgb, var(--green) 30%, var(--line)); color: var(--green); }
.emp-chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 1rem; flex: none; }
.job-id { font-family: var(--font-head); font-weight: 600; font-size: 1.02rem; white-space: nowrap; }
.overdue { color: var(--red); font-weight: 600; }
.prio-high { color: var(--red); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; }

/* ----- Tables ----- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
.t th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.t tbody tr:hover { background: var(--accent-soft); }
.t tfoot td { font-weight: 600; background: var(--surface-2); border-bottom: 0; }
.t .svc-list { margin: 0; padding: 0; list-style: none; }
.t .svc-list li { display: flex; justify-content: space-between; gap: 12px; }
.t .svc-list li span:first-child { white-space: normal; }
.t .svc-list li span:last-child { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.row-link { cursor: pointer; }
.qa { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.qa form, .qa .btn { width: 100%; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

/* ----- Lists ----- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 12px; align-items: center; }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: .85rem; }
.kv dd { margin: 0; font-weight: 500; }
.totals { margin-left: auto; min-width: 260px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 8px; font-weight: 600; font-size: 1.12rem; font-family: var(--font-head); }

/* ----- Alerts ----- */
.alert { position: relative; padding: 12px 40px 12px 16px; border-radius: 12px; margin-bottom: 14px; border-left: 4px solid; font-weight: 500; }
.alert ul { margin: 6px 0 0 18px; padding: 0; font-weight: 400; }
.alert-success { background: var(--green-bg); color: var(--green); }
.alert-error { background: var(--red-bg); color: var(--red); }
.alert-warn { background: var(--amber-bg); color: var(--amber); }
.alert-info { background: var(--blue-bg); color: var(--blue); }
.alert-x { position: absolute; right: 8px; top: 8px; border: 0; background: none; font-size: 1.3rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }

/* ----- Bars / charts ----- */
.hbar { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr auto; gap: 10px; align-items: center; padding: 5px 0; font-size: .88rem; }
.hbar .track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--accent); border-radius: 4px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--accent); }
.chart .bar:hover { fill: var(--accent-2); }
.chart .axis { stroke: var(--line); stroke-dasharray: 3 3; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }

/* ----- Crew board ----- */
.tech-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.tech { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface-2); display: flex; gap: 10px; }
.tech .avatar { width: 38px; height: 38px; font-size: .9rem; }
.tech-status { font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* ----- Calendar ----- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-day { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-height: 180px; display: flex; flex-direction: column; }
.cal-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal-day.closed { background: var(--surface-2); }
.cal-day-head { padding: 8px 10px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
.cal-day-head strong { font-family: var(--font-head); font-size: 1.02rem; }
.cal-day-body { padding: 6px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.cal-job { display: block; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); border-left: 4px solid var(--muted); font-size: .8rem; color: var(--ink); line-height: 1.3; }
.cal-job:hover { text-decoration: none; filter: brightness(.97); }
.cal-job .t1 { font-weight: 600; }
.cal-job.st-completed { opacity: .65; }
.cal-job.st-cancelled, .cal-job.st-no_show { opacity: .45; text-decoration: line-through; }
.cal-add { margin-top: auto; text-align: center; font-size: .8rem; padding: 4px; color: var(--muted); }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month-cell { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-height: 92px; padding: 6px; font-size: .78rem; color: var(--ink); display: block; }
.month-cell:hover { text-decoration: none; border-color: var(--accent); }
.month-cell.other { opacity: .45; }
.month-cell.today { border-color: var(--accent); background: var(--accent-soft); }
.month-head { text-align: center; font-size: .75rem; color: var(--muted); font-weight: 600; padding: 4px; }

/* ----- Auth (split screen) ----- */
.auth-body { min-height: 100vh; background: var(--bg); }
.auth-split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; background: radial-gradient(900px 500px at 0% 0%, #2f6b3a, transparent 60%), var(--head); color: var(--head-ink); padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; gap: 28px; }
.auth-brand { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.auth-logo { display: block; width: 320px; max-width: 100%; height: auto; }
.auth-brand p { margin: 0; color: #a9c49f; }
.auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; color: #cfdcca; position: relative; z-index: 1; }
.auth-points li { padding-left: 26px; position: relative; }
.auth-points li::before { content: ""; position: absolute; left: 0; top: .45em; width: 12px; height: 12px; border-radius: 50% 50% 50% 3px; background: #7fb069; }
.auth-hills { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 180px; }
.auth-wrap { display: flex; flex-direction: column; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 480px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: var(--shadow); }
.auth-title { font-size: 1.6rem; }
.auth-foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 14px; }

@media print {
  .masthead, .tabbar, .foot, .no-print, .alert, .pills, .filters { display: none !important; }
  body { background: #fff; color: #000; font-size: 12px; }
  .content { padding: 0; max-width: none; }
  .card, .stats { box-shadow: none; }
  a { color: #000; }
}

/* ----- Responsive ----- */
@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .masthead-row { padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); gap: 10px; }
  .brand-text { display: none; }
  .brand-logo { height: 44px; }
  .menu-btn, .masthead .menu-btn { display: inline-grid; }
  .mainnav { display: none; flex-direction: column; padding: 4px 12px 12px; }
  body.nav-open .mainnav { display: flex; }
  .mainnav a { border-bottom: 0; border-left: 3px solid transparent; padding: 11px 12px; }
  .mainnav a.active { border-left-color: #7fb069; background: rgba(255,255,255,.06); border-radius: 0 8px 8px 0; }
  .mainnav .nav-out { display: flex; }
  .content { padding: 18px 12px 32px; }
  .cal { grid-template-columns: 1fr; }
  .cal-day { min-height: 0; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 22px 70px; gap: 16px; }
  .auth-points { display: none; }
  .auth-brand { align-items: center; text-align: center; }
  .auth-logo { width: 210px; }
  .auth-wrap { margin-top: -48px; padding-top: 0; position: relative; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px max(6px, env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: .7rem; font-weight: 500; padding: 4px 8px; }
  .tabbar a:hover { text-decoration: none; color: var(--link); }
  .tabbar .tab-new { background: var(--accent); color: #fff; border-radius: 16px; width: 50px; height: 44px; justify-content: center; padding: 0; }
  .tabbar .tab-new .ico { width: 24px; height: 24px; }
}
@media (max-width: 700px) {
  h1 { font-size: 1.65rem; }
  .topsearch { display: none; }
  .masthead-actions { margin-left: auto; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 12px 14px; }
  .hide-xs { display: none !important; }
  .card { padding: 15px; }
  .pills { display: flex; }
  table.t.stack thead { display: none; }
  table.t.stack, .t.stack tbody, .t.stack tr, .t.stack td, .t.stack tfoot { display: block; width: 100%; }
  .t.stack tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .t.stack tbody tr:nth-child(even) { background: transparent; }
  .t.stack td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .t.stack td::before { content: attr(data-label); color: var(--muted); font-size: .75rem; font-weight: 600; text-align: left; flex: none; padding-top: 2px; }
  .t.stack td[data-label=""]::before { content: none; }
  .t.stack .svc-list li { justify-content: flex-end; }
  .t.stack .qa { flex-direction: row; justify-content: flex-end; width: 100%; }
  .t.stack .qa form, .t.stack .qa .btn { width: auto; }
  .t.stack tfoot tr { padding: 10px 14px; }
  .hbar { grid-template-columns: 1fr auto; }
  .hbar .track { grid-column: 1 / -1; grid-row: 2; }
  .totals { min-width: 0; width: 100%; }
  .month-cell { min-height: 60px; font-size: .68rem; padding: 4px; }
  .page-head { align-items: flex-start; }
}
.tech .small .ico { width: 13px; height: 13px; vertical-align: -2px; }

/* ----- Live demo banner ----- */
.demo-banner { background: var(--amber-bg); color: var(--amber); border-bottom: 1px solid color-mix(in srgb, var(--amber) 25%, transparent); font-size: .88rem; }
.demo-banner-in { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 8px 24px; max-width: 1440px; margin: 0 auto; }
.demo-banner .btn { background: var(--surface); }
@media (max-width: 900px) { .demo-banner-in { padding: 8px 12px; } }
@media print { .demo-banner { display: none; } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.brand-logo, .auth-logo { color: transparent; }

/* ---- Demo login buttons ---- */
.demo-logins { display: grid; gap: 8px; }
.demo-login { width: 100%; text-align: left; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface, #fff); color: inherit; font: inherit; cursor: pointer; }
.demo-login:hover { border-color: var(--accent); }
.demo-login > .small:last-child { flex-basis: 100%; color: var(--muted, #6b7280); }

/* ---- Users ---- */
.role-key { display: grid; gap: 6px; margin: 10px 0 14px; }
.user-row { border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; }
.user-row.off { opacity: .7; }
.user-row > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
.user-row > summary::-webkit-details-marker { display: none; }
.user-row[open] > summary { border-bottom: 1px solid var(--line); }
.user-row > form, .user-tools { padding: 10px 12px; }
.user-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; justify-content: space-between; border-top: 1px dashed var(--line); }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin: 0; }
.avatar.sm { width: 32px; height: 32px; font-size: .8rem; flex: none; }
.nav-count { margin-left: auto; background: var(--red, #dc2626); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; padding: 1px 7px; line-height: 1.5; }

/* ---- Invoices ---- */
.nav-count { background: #dc2626 !important; }
.aging-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.aging-cell { display: flex; flex-direction: column; gap: 4px; }
.aging-cell strong { font-variant-numeric: tabular-nums; }
.aging-cell.late strong { color: var(--red); }
.aging-bar { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.aging-bar span { display: block; height: 100%; background: var(--accent); }
.aging-cell.late .aging-bar span { background: var(--red); }
.batch-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); }
.batch-bar label { margin: 0; font-size: .85rem; }
.batch-bar > .small { margin-right: auto; align-self: center; }
.group-row td { background: var(--surface-2); }
.inv-paper { background: #fff; color: #1d232b; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 18px; }
.inv-band { background: var(--band, #1d232b); border-bottom: 4px solid var(--accent); color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 24px; flex-wrap: wrap; }
.inv-band img { height: 64px; width: auto; display: block; }
.inv-band .biz { text-align: right; font-size: .82rem; color: #d1d5db; line-height: 1.5; }
.inv-band .biz strong { color: #fff; font-size: .95rem; }
.inv-body { padding: 22px 24px; }
.inv-top { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.inv-title { font-family: var(--font-head); font-size: 2rem; font-weight: 700; letter-spacing: .02em; margin: 0 0 10px; display: flex; align-items: center; gap: 12px; }
.inv-stamp { font-size: .8rem; letter-spacing: .08em; border: 2px solid currentColor; border-radius: 4px; padding: 2px 8px; }
.inv-stamp.paid { color: #15803d; } .inv-stamp.overdue { color: #b91c1c; } .inv-stamp.void, .inv-stamp.draft { color: #6b7280; } .inv-stamp.partial { color: #b45309; }
.inv-meta { display: grid; grid-template-columns: auto auto; gap: 3px 14px; font-size: .9rem; align-content: start; }
.inv-meta dt { color: #6b7280; text-align: right; } .inv-meta dd { margin: 0; font-weight: 600; text-align: right; }
.inv-label { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: #6b7280; font-weight: 700; margin-bottom: 4px; }
.inv-due { background: #f6f4ef; border-left: 4px solid var(--accent); padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.inv-due strong { font-size: 1.35rem; }
.inv-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.inv-table th { background: var(--band, #1d232b); color: #fff; text-align: left; font-size: .72rem; letter-spacing: .06em; padding: 7px 8px; }
.inv-table td { padding: 7px 8px; border-bottom: 1px solid #e7e4dd; vertical-align: top; }
.inv-table .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv-table tr.jobhead td { background: #f1efe9; font-weight: 700; }
.inv-table tr.disc td { color: #15803d; }
.inv-table .type { display: block; font-size: .7rem; color: #6b7280; letter-spacing: .05em; text-transform: uppercase; }
.inv-totals { margin: 12px 0 0 auto; max-width: 340px; font-size: .92rem; }
.inv-totals div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; color: #4b5563; }
.inv-totals div span:last-child { font-variant-numeric: tabular-nums; color: #1d232b; }
.inv-totals .big { border-top: 1.5px solid #1d232b; margin-top: 4px; padding-top: 6px; font-weight: 700; color: #1d232b; font-size: 1.02rem; }
.inv-notes { margin-top: 18px; font-size: .82rem; color: #374151; white-space: pre-line; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); white-space: nowrap; min-width: 92px; font-size: .8rem; }
.email-preview { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.email-preview .hdr { background: var(--surface-2); padding: 10px 14px; font-size: .85rem; display: grid; gap: 2px; }
.email-preview iframe { width: 100%; height: 520px; border: 0; background: #f3f1ec; display: block; }
.attach-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .8rem; background: var(--surface); }
.line-editor input { min-width: 0; }
.line-editor td { vertical-align: middle; }
.line-editor .amt { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .aging-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } .inv-body { padding: 16px; } .inv-band { padding: 12px 16px; } .inv-band .biz { text-align: left; } }
.line-editor select { min-width: 112px; } .line-editor input[name="desc[]"] { min-width: 200px; }
.user-name { color: #e7efe3; line-height: 1.2; }
.user-name .muted { color: #b8cdb1; font-size: .75rem; }
.mainnav .nav-count { margin-left: 2px; }

/* ---- Demo sign-in picker ---- */
.demo-pick { margin: 0 0 6px; }
.demo-pick h3 { margin: 0 0 4px; font-size: 1.15rem; }
.demo-pick > p { margin: 0 0 14px; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.demo-pick form { margin: 0 0 10px; }
.demo-go { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border: 2px solid var(--accent); border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface)); color: inherit; font: inherit; cursor: pointer; transition: transform .08s, box-shadow .15s, background .15s; }
.demo-go:hover, .demo-go:focus-visible { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 28%, transparent); transform: translateY(-1px); outline: none; }
.demo-go .av { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; flex: none; }
.demo-go .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.demo-go .txt strong { font-size: 1rem; }
.demo-go .txt span { font-size: .82rem; color: var(--muted); line-height: 1.35; }
.demo-go .go { flex: none; font-weight: 700; font-size: .9rem; color: var(--accent); white-space: nowrap; }
.demo-manual { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.demo-manual > summary { cursor: pointer; color: var(--muted); font-size: .85rem; text-align: center; list-style: none; padding: 4px; }
.demo-manual > summary::-webkit-details-marker { display: none; }
.demo-manual[open] > summary { margin-bottom: 12px; }
@media (max-width: 420px) { .demo-go .go { display: none; } }

.qb-steps { padding-left: 20px; margin: 0; display: grid; gap: 14px; }
.qb-steps li > div { margin-top: 6px; }
