/* ============================================================
   Maintenance — shares Prop Spot brand
   ============================================================ */
:root {
  --brand:        #61B746;
  --brand-dark:   #52a03a;
  --brand-light:  #edf7e9;
  --surface:      #ffffff;
  --bg:           #f4f5f7;
  --text:         #111827;
  --text-muted:   #6b7280;
  --border:       #e5e7eb;
  --danger:       #ef4444;
  --amber:        #f59e0b;
  --success:      #22c55e;
  --radius:       12px;
  --shadow:       0 2px 12px rgba(0,0,0,.08);
  --nav-height:   64px;
  --header-height:56px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100dvh; padding-bottom: var(--nav-height);
}
a { color: var(--brand-dark); }

.app-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--brand); color: #fff;
  height: var(--header-height);
  display: flex; align-items: center; padding: 0 16px; gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.app-header .logo {
  font-size: 1.25rem; font-weight: 800; letter-spacing: -.5px;
  color: #fff; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.app-header .back-btn {
  background: none; border: none; color: #fff; font-size: 1.5rem;
  cursor: pointer; padding: 4px 8px 4px 0; line-height: 1;
}
.app-header .header-title {
  font-size: 1rem; font-weight: 600; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-header .header-actions { display: flex; gap: 8px; margin-left: auto; }
.icon-btn {
  background: rgba(255,255,255,.2); border: none; border-radius: 8px;
  color: #fff; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem;
}
.icon-btn:hover { background: rgba(255,255,255,.3); }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 99;
  height: var(--nav-height); background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: stretch; justify-content: space-around;
}
.nav-link {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; text-decoration: none;
  color: var(--text-muted); font-size: .72rem;
}
.nav-link .nav-icon { font-size: 1.4rem; line-height: 1; }
.nav-link.active { color: var(--brand); }
.nav-link:hover  { color: var(--brand); }
.nav-brand        { display: none; }
.nav-spacer       { display: none; }
.nav-signout      { display: none; }
.nav-collapse-btn { display: none; }

.page { padding: 16px; max-width: 720px; margin: 0 auto; }
.page-wide { max-width: 1400px; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; }
.card-body { padding: 16px; }

.section-header { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 8px; }
.section-title  { font-size: 1rem; font-weight: 700; }

/* Work order row */
.row-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  display: flex; gap: 12px; align-items: flex-start;
  text-decoration: none; color: var(--text);
  margin-bottom: 10px;
  transition: transform .15s;
  border-left: 4px solid var(--border);
}
.row-card:active { transform: scale(.98); }
.row-card.priority-urgent { border-left-color: var(--danger); }
.row-card.priority-high   { border-left-color: var(--amber); }
.row-card.priority-normal { border-left-color: var(--brand); }
.row-card.priority-low    { border-left-color: var(--text-muted); }
.row-card.status-completed,
.row-card.status-cancelled { opacity: .55; }

.row-card-icon  { font-size: 1.4rem; flex-shrink: 0; }
.row-card-body  { flex: 1; min-width: 0; }
.row-card-title { font-weight: 700; font-size: .98rem; }
.row-card-sub   { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.row-card-meta  { display: flex; gap: 10px; margin-top: 6px; font-size: .76rem; color: var(--text-muted); flex-wrap: wrap; }

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 12px; font-size: 1rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--brand); }
.form-textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; font-size: .95rem; font-weight: 600;
  border-radius: 8px; border: none; cursor: pointer;
  transition: transform .12s, background .12s; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: #eee; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-full      { width: 100%; }
.btn-sm        { padding: 6px 10px; font-size: .82rem; }
.btn-xs        { padding: 4px 8px;  font-size: .72rem; font-weight: 600; }

/* ── Lawn maintenance table ─────────────────────────── */
.lawn-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.lawn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  min-width: 880px;
}
.lawn-table th,
.lawn-table td {
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.lawn-table thead th {
  background: var(--bg);
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 1;
}
.lawn-table tbody tr {
  transition: background .12s ease, opacity .08s ease;
}
.lawn-table tbody tr:hover { background: var(--bg); }
.lawn-table tbody tr.dragging { opacity: .35; }
.lawn-table .drag-handle {
  cursor: grab;
  color: var(--text-muted);
  text-align: center;
  font-weight: 700;
  user-select: none;
  letter-spacing: -1px;
}
.lawn-table .drag-handle:active { cursor: grabbing; }
.lawn-table .addr-link {
  font-weight: 700;
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.lawn-table .addr-link:hover { color: var(--brand); text-decoration-color: var(--brand); }
.lawn-table .cell-sub {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.lawn-table .lockbox {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8rem;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 6px;
}
.lawn-table .assignee-select {
  padding: 4px 6px;
  font-size: .8rem;
  min-width: 130px;
}
.sign-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
  font-size: .76rem;
  white-space: nowrap;
}
.sign-toggle input { margin: 0; }
.mow-event-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}
.mow-event-row:last-child { border-bottom: none; }

.overdue-text { color: #b91c1c; font-weight: 600; }
.overdue-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 100px;
  background: #ef4444;
  vertical-align: middle;
  margin-left: 4px;
}

.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--brand-light); color: var(--brand-dark); }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red   { background: #fee2e2; color: #b91c1c; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-grey  { background: #f3f4f6; color: #4b5563; }
.badge-blue  { background: #dbeafe; color: #1e40af; }
.badge-purple{ background: #ede9fe; color: #6b21a8; }

.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pill {
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text-muted);
  padding: 6px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600;
  cursor: pointer;
}
.pill.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pill:hover  { border-color: var(--brand); }

.empty-state { padding: 32px 16px; text-align: center; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 8px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; align-items: flex-end; justify-content: center; z-index: 200;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); width: 100%; max-width: 640px;
  border-radius: 16px 16px 0 0; max-height: 92vh; overflow-y: auto;
  padding: 20px; box-shadow: 0 -2px 18px rgba(0,0,0,.18);
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-height) + 16px);
  transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-size: .88rem; box-shadow: 0 4px 16px rgba(0,0,0,.25);
  opacity: 0; transition: opacity .25s, transform .25s; z-index: 250; max-width: 90%;
}
.toast.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-error { background: var(--danger); }

.login-wrap { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-sm  { font-size: .85rem; }
.text-xs  { font-size: .75rem; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.text-center { text-align: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.stat-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; text-align: center; }
.stat-num   { font-size: 1.5rem; font-weight: 800; color: var(--brand); }
.stat-num.is-warn { color: var(--amber); }
.stat-num.is-bad  { color: var(--danger); }
.stat-label { font-size: .7rem; color: var(--text-muted); margin-top: 2px; }

.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Status workflow buttons */
.status-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.status-btn {
  padding: 6px 10px; border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-muted); border-radius: 6px; cursor: pointer; font-size: .82rem; font-weight: 600;
}
.status-btn.active { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-light); }
.status-btn:hover  { border-color: var(--brand); }

/* Updates thread */
.update-row {
  border-left: 3px solid var(--brand-light);
  padding: 8px 12px; margin: 8px 0;
  background: var(--bg);
  border-radius: 0 8px 8px 0;
}
.update-author { font-weight: 600; font-size: .82rem; }
.update-time   { font-size: .72rem; color: var(--text-muted); margin-left: 6px; }
.update-body   { font-size: .92rem; margin-top: 4px; white-space: pre-wrap; }

@media (min-width: 720px) {
  body { padding-bottom: 0; padding-left: 220px; }
  body.sidebar-collapsed,
  html.sidebar-collapsed body { padding-left: 64px; }
  .app-header { display: none; }
  .bottom-nav {
    top: 0; right: auto; bottom: 0; width: 220px; height: 100dvh;
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    border-top: none; border-right: 1px solid var(--border);
    padding: 16px 8px;
  }
  .nav-brand {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.15rem; font-weight: 800; color: var(--brand);
    padding: 6px 12px; text-decoration: none; margin-bottom: 8px;
  }
  .nav-collapse-btn {
    display: block; background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1.1rem;
    align-self: flex-end; padding: 4px 10px; margin-bottom: 8px;
  }
  .nav-link {
    flex: 0 0 auto; flex-direction: row; justify-content: flex-start;
    gap: 10px; padding: 10px 14px; border-radius: 10px; font-size: .92rem;
  }
  .nav-link.active { background: var(--brand-light); color: var(--brand-dark); }
  .nav-spacer { display: block; flex: 1; }
  .nav-signout {
    display: flex; align-items: center; gap: 10px;
    background: none; border: none; cursor: pointer; color: var(--text-muted);
    padding: 10px 14px; border-radius: 10px; font-size: .92rem; text-align: left;
  }
  .nav-signout:hover { color: var(--danger); }
  html.sidebar-collapsed .nav-brand .nav-label,
  html.sidebar-collapsed .nav-link span:not(.nav-icon),
  html.sidebar-collapsed .nav-signout span:not(.nav-icon) { display: none; }
  html.sidebar-collapsed .bottom-nav { width: 64px; align-items: center; }
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 16px; max-width: 640px; }
}
