/* ============================================================
   GRASS — restyled style.css  (rail treatment / "1a")
   Field-service PWA · mobile-first · light + dark
   Design deliverable (Claude Design, 2026-07-04) + preserved
   app/photo classes appended at the bottom. Reference copy of
   the pristine deliverable lives in design/style.reference.css.
   Fonts: Hanken Grotesk + IBM Plex Mono (loaded in index.html <head>)
   ============================================================ */

/* ---------- TOKENS ---------- */
:root {
  /* The ONE swappable brand token. Change this per trade (pool = #0E9BAA). */
  --accent:        #23A24B;
  --accent-ink:    #ffffff;
  --accent-soft:   #EAF6EC;   /* accent @ tint, light */
  --accent-line:   #CDE8D3;
  --accent-strong: #23742f;   /* accent text on light bg */

  /* Semantic status — FIXED, independent of --accent. Never remap these. */
  --ok:      #2FA24E;
  --due:     #E5900B;
  --overdue: #E23B3B;
  --never:   #7C8676;

  /* Neutrals — light */
  --bg:       #EAEDE8;
  --card:     #FFFFFF;
  --ink:      #10150F;
  --sub:      #5C665A;
  --faint:    #98A08D;
  --line:     #E4E7DF;
  --chip:     #F1F3EC;
  --chip-ink: #3C443A;
  --input:    #F5F7F1;
  --header-bg:#EAEDE8E6;                 /* 90% for blur bar */
  --shadow:   0 1px 2px rgba(16,21,15,.05), 0 14px 30px -18px rgba(16,21,15,.28);

  /* status tint backgrounds (full-card feel not used in rail, kept for pills) */
  --ok-soft:      #EAF6EC;
  --due-soft:     #FCF1DB;
  --overdue-soft: #FCE7E5;
  --never-soft:   #EEF0EB;

  --radius:   16px;
  --radius-lg:20px;
  --tap: 44px;                            /* min tap target */
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent-soft:   #122419;
    --accent-line:   #204029;
    --accent-strong: #5fd07f;

    --bg:       #0B0E0B;
    --card:     #161B15;
    --ink:      #EAEEE6;
    --sub:      #98A28F;
    --faint:    #69725F;
    --line:     #282F26;
    --chip:     #20261E;
    --chip-ink: #BAC4B0;
    --input:    #10140F;
    --header-bg:#0B0E0BE6;
    --shadow:   0 1px 2px rgba(0,0,0,.5), 0 16px 34px -20px rgba(0,0,0,.8);

    --ok-soft:      #122419;
    --due-soft:     #2A2110;
    --overdue-soft: #2C1614;
    --never-soft:   #181D16;
  }
}

/* ---------- BASE ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* PWA: paint safe-area sides with the app bg */
  padding: 0 env(safe-area-inset-left) 0 env(safe-area-inset-right);
}

/* ---------- HEADER (sticky, safe-area aware) ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top) + 10px) 20px 12px;
}
.app-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink);
}

/* ---------- LAYOUT ---------- */
main {
  padding: 20px 16px calc(env(safe-area-inset-bottom) + 32px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 560px;
  margin: 0 auto;
}
.section-header h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0;
}
.section-header p {
  font-size: 14px;
  font-weight: 500;
  color: var(--sub);
  margin: 4px 0 0;
}

/* ---------- CARD (generic panel: quick-update, add-form) ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}

/* ---------- FORMS ---------- */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group + .form-group,
.card > .form-group + * { margin-top: 12px; }
.form-group label {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sub);
}
input, textarea, select {
  width: 100%;
  font-family: inherit;
  font-size: 16px;                 /* 16px+ prevents iOS zoom-on-focus */
  color: var(--ink);
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: var(--tap);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
textarea {
  min-height: 84px;
  line-height: 1.55;
  resize: vertical;
}
select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--faint) 50%),
    linear-gradient(135deg, var(--faint) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--ink);
  background: var(--chip);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .06s ease, filter .12s ease, background .12s ease;
}
.btn:active { transform: scale(.97); }              /* tap feedback */
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 15px; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent);
}
.btn-primary:active { filter: brightness(.95); }

.btn-outline {
  background: transparent;
  color: var(--accent-strong);
  border: 1.5px solid var(--accent);
}

/* icon button (📷 / archive / overflow) */
.icon-btn {
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--ink);
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .06s ease;
}
.icon-btn:active { transform: scale(.94); }

/* ---------- TOOLBAR ---------- */
.section-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.section-actions .btn { flex: 0 0 auto; white-space: nowrap; }
.section-actions select { flex: 1; }

/* ============================================================
   PROPERTY CARD — the hero (rail treatment)
   Status class (.s-ok/.s-due/.s-overdue/.s-never) lives on
   .grass-status; :has() lifts it to a --status var on the card,
   so the rail colors itself with ZERO markup change.
   (If you can't use :has(), add the same modifier class to
   .grass-card — e.g. class="grass-card s-overdue" — and swap
   the :has() rules for .grass-card.s-overdue etc.)
   ============================================================ */
.grass-card {
  --status: var(--never);
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 18px 18px 24px;   /* extra left for the rail */
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.grass-card:has(.s-ok)      { --status: var(--ok); }
.grass-card:has(.s-due)     { --status: var(--due); }
.grass-card:has(.s-overdue) { --status: var(--overdue); }
.grass-card:has(.s-never)   { --status: var(--never); }

/* the rail */
.grass-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 7px;
  background: var(--status);
}

.grass-info { display: flex; flex-direction: column; }
.grass-address {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.15;
  color: var(--ink);
}

/* status label — reads from --status, sits as a soft pill */
.grass-status {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--status);
  background: color-mix(in srgb, var(--status) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--status) 22%, transparent);
  padding: 6px 10px;
  border-radius: 8px;
}
.grass-status::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--status);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status) 18%, transparent);
}
/* plain-language schedule line — put "8 days overdue" in a <b> to color it */
.grass-schedule {
  font-size: 14px;
  font-weight: 600;
  color: var(--sub);
  margin-top: 5px;
}
.grass-schedule b { color: var(--status); font-weight: 800; }

/* ---------- CUT HISTORY CHIPS ---------- */
.cut-history {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 14px;
}
.cut-history span {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--chip-ink);
  background: var(--chip);
  border: 1px solid var(--line);
  padding: 4px 9px;
  border-radius: 7px;
}

/* ---------- ACTION ROW ---------- */
.grass-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.grass-actions select {
  flex: 0 0 auto;
  width: auto;
  min-height: 40px;
  padding: 0 30px 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sub);
  background-color: var(--chip);
}
.grass-actions .spacer { flex: 1; }
/* the primary "Cut today" — give it class="btn btn-primary" and a full-width wrapper,
   or add .grass-cut for a full-bleed primary under the action row: */
.grass-cut {
  width: 100%;
  height: 48px;
  margin-top: 10px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent);
}
.grass-cut:active { transform: scale(.985); filter: brightness(.96); }

/* ---------- PROOF-OF-SERVICE PHOTOS (optional markup, see HANDOFF) ---------- */
.proof-strip { display: flex; gap: 8px; margin-top: 14px; }
.proof-thumb {
  position: relative;
  flex: 1;
  height: 58px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--chip);
  border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
}
.proof-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.proof-thumb .stamp {
  position: absolute; left: 5px; bottom: 4px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 8.5px; font-weight: 500; color: #fff;
  background: rgba(0,0,0,.5); padding: 1.5px 4px; border-radius: 3px;
}
.proof-more {
  flex: 0 0 42px; height: 58px; border-radius: 10px;
  border: 1px dashed var(--line); background: var(--chip);
  display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600; color: var(--sub);
}
/* before / after pair */
.before-after { display: flex; gap: 12px; }
.before-after figure { flex: 1; position: relative; margin: 0; }
.before-after img { width: 100%; height: 250px; object-fit: cover; border-radius: 14px; display: block; }
.before-after .tag {
  position: absolute; top: 10px; left: 10px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600;
  letter-spacing: .08em; padding: 3px 8px; border-radius: 6px;
  color: #fff; background: rgba(0,0,0,.6);
}
.before-after .tag.after { color: #052; background: #5fd07f; }

/* ---------- QUICK-UPDATE match feedback (optional) ---------- */
.qu-badge {
  font-size: 11px; font-weight: 700;
  color: var(--accent-strong); background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  padding: 2px 8px; border-radius: 999px;
}
.qu-matched {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; font-weight: 600; color: var(--accent-strong);
}

/* ---------- ARCHIVE ---------- */
#grass-archive {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
#grass-archive .archive-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
#grass-archive .archive-row:first-child { border-top: none; }
#grass-archive .archive-row .addr { font-size: 15px; font-weight: 700; color: var(--sub); }
#grass-archive .archive-row .meta {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--faint); margin-top: 2px;
}

/* ---------- EMPTY STATE (optional markup) ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 48px 24px;
}
.empty-state .glyph {
  width: 96px; height: 96px; border-radius: 28px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  display: flex; align-items: center; justify-content: center; font-size: 44px;
}
.empty-state h3 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 24px 0 0; }
.empty-state p  { font-size: 15px; font-weight: 500; color: var(--sub); line-height: 1.5; margin: 8px 0 0; }

/* ============================================================
   CARRIED FORWARD FROM THE APP — utilities + photo feature.
   These classes are emitted by app.js / photos.js and are NOT
   part of the design deliverable, so they live here re-tokenized
   to the new design variables. Do not drop them on a redesign.
   ============================================================ */

/* utility */
.hidden { display: none !important; }
.text-muted { color: var(--sub); }
.text-sm { font-size: 13px; }

/* generic flex row (add-form buttons, bulk-interval group) */
.row { display: flex; gap: 8px; align-items: center; }
.row > input, .row > select { flex: 1; }

/* ============================================================
   GRASS PRO — upcoming-features teaser (upsell mockup, not built).
   Accent-tinted card so it reads as promo, not a property.
   ============================================================ */
.pro-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 20px;
  background:
    radial-gradient(130% 100% at 100% 0%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 62%),
    var(--card);
  border: 1px solid var(--accent-line);
  box-shadow: var(--shadow);
}
.pro-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pro-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px; font-weight: 600; letter-spacing: .1em;
  color: var(--accent-ink);
  background: var(--accent);
  padding: 5px 11px; border-radius: 999px;
}
.pro-soon {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  padding: 4px 9px; border-radius: 999px;
}
.pro-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 15px 0 0; }
.pro-sub { font-size: 14px; font-weight: 500; color: var(--sub); line-height: 1.5; margin: 5px 0 0; }
.pro-features { list-style: none; margin: 16px 0 0; padding: 0; }
.pro-features li {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.pro-features li:first-child { border-top: none; }
.pro-ico {
  flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}
.pro-features li > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pro-features b { font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.pro-features span { font-size: 13px; font-weight: 500; color: var(--sub); line-height: 1.4; }
.pro-card .btn { width: 100%; margin-top: 18px; }
.pro-note { font-size: 12px; font-weight: 500; color: var(--faint); text-align: center; margin: 10px 0 0; }

/* per-property notes chip (gate code, dog, mower prefs) */
.grass-notes {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--chip-ink);
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}

/* cut-history expand/collapse toggle */
.link-btn {
  align-self: flex-start;
  background: none; border: none; padding: 0;
  margin-top: 10px;
  color: var(--accent-strong);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
}

/* ---------- PHOTO THUMBNAILS ON CARDS ---------- */
.photo-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.photo-thumb {
  width: 56px; height: 56px; padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--chip);
  cursor: pointer;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- PHOTO PREVIEW / VIEWER OVERLAY ----------
   Used by photos.js (capture preview: Discard/Keep) and app.js
   (full-size viewer: Close). The overlay is always dark. */
.photo-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.photo-preview { display: flex; flex-direction: column; gap: 14px; max-width: 640px; width: 100%; }
.photo-preview img {
  width: 100%; max-height: 72vh; object-fit: contain;
  border-radius: var(--radius); background: #000;
}
.photo-preview-actions { display: flex; gap: 10px; justify-content: flex-end; }
.photo-preview-actions .btn { flex: 1; max-width: 200px; }
/* Overlay is always dark → force legible light text on the outline
   (Discard) button regardless of light/dark theme. */
.photo-preview-actions .btn-outline {
  color: #fff;
  border-color: rgba(255,255,255,0.55);
}

/* archive list collapses fully when empty (element is always in the DOM) */
#grass-archive:empty { display: none; }

/* ---------- FEEDBACK: floating button + bottom sheet ---------- */
.fab {
  position: fixed;
  right: calc(env(safe-area-inset-right) + 16px);
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  z-index: 200;
  display: inline-flex; align-items: center; gap: 7px;
  height: 46px; padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-family: inherit; font-size: 14px; font-weight: 800;
  box-shadow: 0 8px 22px -8px color-mix(in srgb, var(--accent) 75%, transparent);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fab:active { transform: scale(.96); }

.sheet-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,.5);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 560px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px 18px calc(env(safe-area-inset-bottom) + 20px);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
}
.sheet h3 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.sheet p { font-size: 13px; font-weight: 500; color: var(--sub); margin: -6px 0 0; }
.sheet-actions { display: flex; gap: 10px; margin-top: 4px; }
.sheet-actions .btn { flex: 1; }

/* ---------- AUTH (magic-link login screen + header sign-out) ---------- */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 560px;
  margin: 0 auto;
}
.signout-btn {
  background: none;
  border: none;
  padding: 6px 0 6px 12px;      /* generous tap area, flush right */
  color: var(--sub);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#auth-screen {
  max-width: 420px;
  margin: 0 auto;
  padding: calc(8vh + 12px) 16px calc(env(safe-area-inset-bottom) + 32px);
}
.auth-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.auth-wrap .glyph {
  width: 96px; height: 96px; border-radius: 28px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  display: flex; align-items: center; justify-content: center; font-size: 44px;
}
.auth-title { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 20px 0 0; }
.auth-sub { font-size: 15px; font-weight: 500; color: var(--sub); line-height: 1.5; margin: 8px 0 0; }
.auth-card { width: 100%; margin-top: 24px; text-align: left; }
.auth-card h3 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.auth-submit { width: 100%; margin-top: 14px; }
.auth-error {
  font-size: 13px; font-weight: 600; color: var(--overdue);
  background: var(--overdue-soft);
  border: 1px solid color-mix(in srgb, var(--overdue) 25%, transparent);
  border-radius: 10px; padding: 9px 12px; margin: 12px 0 0;
}
.auth-hint { font-size: 12px; font-weight: 500; color: var(--faint); margin: 12px 0 0; }
.auth-sent-copy { font-size: 14px; font-weight: 500; color: var(--sub); line-height: 1.55; margin: 10px 0 0; }
.auth-sent-copy b { color: var(--ink); }
