/* PourRight — mobile-first PWA stylesheet
   Rebuilt 2026-07-13 (original was lost to a OneDrive sync corruption). */

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
  --navy: #1a2744;
  --navy-700: #223052;
  --navy-100: #e8ecf4;
  --orange: #f97316;
  --orange-dark: #ea580c;
  --orange-50: #fff7ed;
  --green: #16a34a;
  --green-50: #dcfce7;
  --red: #dc2626;
  --red-50: #fee2e2;
  --amber: #d97706;
  --amber-50: #fef3c7;
  --blue: #2563eb;
  --blue-50: #dbeafe;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --header-h: 56px;
  --nav-h: 62px;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

h2 { font-size: 1.25rem; font-weight: 800; color: var(--navy); }
h3 { font-size: 0.95rem; font-weight: 700; color: var(--navy); }

a { color: var(--orange-dark); }

/* ── App header ──────────────────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.logo span { color: var(--orange); }

.header-actions { display: flex; align-items: center; gap: 8px; }

/* ── Main content ────────────────────────────────────────────────────────── */
.main-content {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--header-h) + env(safe-area-inset-top) + 16px) 16px
           calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
}

/* ── Bottom navigation ───────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid var(--gray-200);
  display: flex;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--gray-400);
  text-decoration: none;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--orange); }

/* ── Flash messages ──────────────────────────────────────────────────────── */
.flash-msg {
  position: fixed;
  top: calc(var(--header-h) + env(safe-area-inset-top) + 10px);
  left: 16px; right: 16px;
  z-index: 60;
  max-width: 608px;
  margin: 0 auto;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.87rem;
  font-weight: 600;
  color: #fff;
  background: var(--navy);
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.22);
}
.flash-success { background: var(--green); }
.flash-info    { background: var(--navy); }
.flash-error, .flash-danger { background: var(--red); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--gray-100);
}

.card-body { padding: 16px; }

.card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

.section-title {
  margin: 18px 2px 8px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--gray-500);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.12s ease, background 0.12s ease;
}
.btn:active { filter: brightness(0.92); }

.btn-primary { background: var(--orange); color: #fff; }
.btn-navy    { background: var(--navy); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger  { background: var(--red-50); color: var(--red); }

.btn-ghost {
  background: #fff;
  color: var(--gray-600);
  border: 1.5px solid var(--gray-300);
}

.btn-sm    { padding: 7px 12px; font-size: 0.8rem; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }
.btn-icon  { padding: 7px 10px; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.badge-estimate    { background: var(--amber-50);  color: var(--amber); }
.badge-scheduled   { background: var(--blue-50);   color: var(--blue); }
.badge-in-progress { background: var(--orange-50); color: var(--orange-dark); }
.badge-complete    { background: var(--green-50);  color: var(--green); }
.badge-cancelled   { background: var(--gray-100);  color: var(--gray-500); }
.badge-draft       { background: var(--gray-100);  color: var(--gray-500); }
.badge-sent        { background: var(--blue-50);   color: var(--blue); }
.badge-paid        { background: var(--green-50);  color: var(--green); }

/* ── Dashboard: stats ────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 8px;
  text-align: center;
}
.stat-num   { font-size: 1.55rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat-label { font-size: 0.66rem; font-weight: 700; text-transform: uppercase;
              letter-spacing: 0.5px; color: var(--gray-500); margin-top: 3px; }

/* ── Dashboard: quick actions ────────────────────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 6px;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 4px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gray-600);
  text-decoration: none;
  text-align: center;
}
.qb-icon { font-size: 1.35rem; line-height: 1; }

/* ── Job lists ───────────────────────────────────────────────────────────── */
.job-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--gray-100);
  text-decoration: none;
  color: inherit;
}
.job-item:last-child { border-bottom: none; }
.job-item:active { background: var(--gray-50); }

.job-info { min-width: 0; }
.job-name { font-weight: 700; color: var(--gray-900); }
.job-meta {
  font-size: 0.78rem;
  color: var(--gray-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-amount { font-weight: 800; color: var(--navy); font-size: 0.95rem; }

/* ── Filter chips ────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 14px;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1.5px solid var(--gray-300);
  background: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-600);
  text-decoration: none;
  white-space: nowrap;
}
.filter-chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* ── Empty states ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--gray-500);
}
.empty-icon { font-size: 2.6rem; margin-bottom: 8px; }
.empty-state p { margin-bottom: 14px; }

/* ── Weather strip ───────────────────────────────────────────────────────── */
.strip-container {
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -4px;
  padding: 0 4px;
}
.strip-container::-webkit-scrollbar { display: none; }

.weather-strip { display: flex; gap: 8px; padding-bottom: 8px; }

.weather-loading {
  padding: 18px 8px;
  color: var(--gray-400);
  font-size: 0.85rem;
}

.weather-day {
  flex-shrink: 0;
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px;
  border-radius: 10px;
  border: 1.5px solid var(--gray-200);
  background: var(--gray-50);
}
.weather-day.today { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.weather-day.risk-amber { border-color: var(--amber); background: var(--amber-50); }
.weather-day.risk-red   { border-color: var(--red);   background: var(--red-50); }

.wd-label  { font-size: 0.74rem; font-weight: 800; color: var(--navy); }
.wd-date   { font-size: 0.68rem; color: var(--gray-400); }
.wd-icon   { font-size: 1.45rem; line-height: 1.2; margin: 2px 0; }
.wd-temp   { font-size: 0.82rem; font-weight: 700; color: var(--gray-700); }
.wd-precip, .wd-wind { font-size: 0.68rem; color: var(--gray-500); }
.wd-risk   { font-size: 0.6rem; font-weight: 800; letter-spacing: 0.3px; margin-top: 3px;
             color: var(--green); }
.risk-amber .wd-risk { color: var(--amber); }
.risk-red   .wd-risk { color: var(--red); }

/* ── Scheduler ───────────────────────────────────────────────────────────── */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 12px;
}
.week-nav h2 { font-size: 1rem; text-align: center; }

.day-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
  border: 1.5px solid transparent;
}
.day-card.today      { border-color: var(--navy); }
.day-card.risk-amber { border-color: var(--amber); }
.day-card.risk-red   { border-color: var(--red); }

.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--gray-100);
}
.day-date { font-weight: 800; color: var(--navy); font-size: 0.95rem; }
.day-weather-mini { font-size: 0.78rem; color: var(--gray-500); white-space: nowrap; }

.pour-risk-banner {
  padding: 6px 16px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.pour-risk-banner.amber { background: var(--amber-50); color: var(--amber); }
.pour-risk-banner.red   { background: var(--red-50);   color: var(--red); }

.day-jobs { padding: 10px 16px 12px; }

.day-job-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  margin-bottom: 6px;
  border-radius: 8px;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-900);
  text-decoration: none;
}

.dot {
  flex-shrink: 0;
  width: 9px; height: 9px;
  border-radius: 50%;
}

.day-add-btn {
  display: block;
  padding: 8px;
  border: 1.5px dashed var(--gray-300);
  border-radius: 8px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-400);
  text-decoration: none;
}

/* ── Expenses ────────────────────────────────────────────────────────────── */
.total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
}
.total-bar .label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.75;
}
.total-bar .amount { font-size: 1.45rem; font-weight: 800; color: var(--orange); }

.expense-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
}
.expense-item:last-child { border-bottom: none; }

.expense-cat-icon {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.expense-info { flex: 1; min-width: 0; }
.expense-desc { font-weight: 700; }
.expense-meta {
  font-size: 0.75rem;
  color: var(--gray-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.expense-amount { font-weight: 800; color: var(--navy); white-space: nowrap; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 13px; }

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--gray-600);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--gray-900);
}
.form-group textarea { min-height: 80px; resize: vertical; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.14);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── Estimate box ────────────────────────────────────────────────────────── */
.estimate-box {
  margin-top: 4px;
  padding: 14px;
  border-radius: 10px;
  background: var(--navy);
  text-align: center;
  color: #fff;
}
.est-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  opacity: 0.75;
}
.est-amount { font-size: 1.65rem; font-weight: 800; color: var(--orange); margin: 2px 0; }
.est-breakdown { font-size: 0.78rem; opacity: 0.75; }

/* ── Invoices ────────────────────────────────────────────────────────────── */
.invoice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--gray-100);
}
.invoice-row:last-child { border-bottom: none; }
.inv-num    { font-weight: 700; font-size: 0.9rem; }
.inv-amount { font-weight: 800; color: var(--navy); white-space: nowrap; }

/* ── Ledger ──────────────────────────────────────────────────────────────── */
.sub-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  text-decoration: none;
  color: inherit;
}
.sub-list-item:last-child { border-bottom: none; }

.sub-avatar {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sub-info  { flex: 1; min-width: 0; }
.sub-name  { font-weight: 700; }
.sub-phone { font-size: 0.75rem; color: var(--gray-500); }

.sub-balance { font-weight: 800; font-size: 1.02rem; white-space: nowrap; }
.sub-balance.positive { color: var(--green); }
.sub-balance.negative { color: var(--red); }
.sub-balance.zero     { color: var(--gray-400); }

.hours-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.88rem;
}
.hours-entry:last-child { border-bottom: none; }
.hours-entry.entry-settled { opacity: 0.55; }

.entry-dir {
  flex-shrink: 0;
  width: 4px;
  height: 36px;
  border-radius: 2px;
  background: var(--gray-300);
}
.entry-dir.we-worked   { background: var(--green); }
.entry-dir.they-worked { background: var(--red); }

.entry-info  { flex: 1; min-width: 0; }
.entry-hours { font-weight: 800; color: var(--navy); white-space: nowrap; }

/* ── Modals (bottom sheet) ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 24, 40, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-sheet {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  max-width: 640px;
  margin: 0 auto;
  max-height: 88vh;
  overflow-y: auto;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 18px 18px 0 0;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }

.modal-handle {
  width: 38px; height: 4px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: var(--gray-300);
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 14px;
}

/* ── Misc ────────────────────────────────────────────────────────────────── */
.back-link {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-500);
  text-decoration: none;
}

.delete-zone {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1.5px dashed var(--gray-300);
}

.text-center { text-align: center; }
.text-gray   { color: var(--gray-500); }
.mb-3 { margin-bottom: 14px; }
.mt-2 { margin-top: 10px; }
