:root {
  color-scheme: light;
  --bg: #edf4f2;
  --bg-deep: #dbe7e3;
  --surface: #ffffff;
  --surface-warm: #f7fbf8;
  --surface-2: #e3ece8;
  --ink: #172124;
  --muted: #5f6f70;
  --line: #d5e2dd;
  --line-strong: #b8cbc4;
  --brand: #176452;
  --brand-dark: #0f463b;
  --brand-soft: #dceee6;
  --accent: #a95e35;
  --gold: #d9aa4e;
  --ok: #1f7a4f;
  --warn: #8a6417;
  --danger: #982f2a;
  --shadow: 0 20px 44px rgba(31, 39, 35, 0.14);
  --shadow-soft: 0 10px 28px rgba(31, 39, 35, 0.09);
  --ring: 0 0 0 4px rgba(23, 100, 82, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 76px;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% -6%, rgba(217, 170, 78, 0.24), transparent 230px),
    radial-gradient(circle at 92% 4%, rgba(23, 100, 82, 0.2), transparent 260px),
    linear-gradient(180deg, #f8fbf9 0, var(--bg) 390px, var(--bg-deep) 100%),
    var(--bg);
}

button, input, textarea, select { font: inherit; }

button, .button-link, .upload-button {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  padding: 12px 15px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

button:active, .button-link:active, .upload-button:active {
  transform: translateY(1px);
}

.app-shell {
  width: min(100%, 500px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 30px;
}

.topbar, .section-heading, .job-hero, .actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  margin: -18px -16px 18px;
  padding: 16px 16px 13px;
  background: linear-gradient(180deg, rgba(248, 251, 249, 0.96), rgba(248, 251, 249, 0.78));
  backdrop-filter: blur(18px);
}

.top-action {
  color: white;
  border-color: transparent;
  background: var(--brand);
  font-size: 1.45rem;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(23, 100, 82, 0.22);
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 1.78rem; line-height: 1.04; letter-spacing: 0; }
h2 { margin-bottom: 12px; font-size: 1.28rem; line-height: 1.15; }
h3 { margin-bottom: 6px; font-size: 1rem; }
p { line-height: 1.42; }

.brand-lockup,
.client-header {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  box-shadow: 0 10px 22px rgba(23, 100, 82, 0.2);
}

.brand-lockup > div,
.client-header > div {
  min-width: 0;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.view, .panel { display: none; }
.view.is-active, .panel.is-active { display: block; }

.overview-panel, .job-card, .approval-record, .plain-card, .report-panel, .included-list, .client-card, .customer-teaser, .report-card, .settings-hero {
  width: 100%;
  border: 1px solid rgba(213, 226, 221, 0.9);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

.overview-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  padding: 9px;
  margin-bottom: 20px;
  border-color: rgba(23, 100, 82, 0.2);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 250, 242, 0.86));
}

.overview-panel div {
  border-radius: 10px;
  padding: 14px;
  border: 1px solid rgba(213, 226, 221, 0.82);
  background: var(--surface-warm);
}

.overview-panel div:first-child {
  grid-column: 1 / -1;
  color: white;
  border-color: transparent;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 36%),
    linear-gradient(135deg, var(--brand-dark), var(--brand) 62%, #2b806d);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.overview-panel span, .metrics span, .field span, .search-field span, dt {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.overview-panel div:first-child span { color: rgba(255, 255, 255, 0.75); }
.overview-panel strong { display: block; font-size: 1.18rem; letter-spacing: 0; }

.search-field, .field { display: grid; gap: 7px; margin-bottom: 14px; }

.search-field input, .field input, .field textarea, .field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.search-field input:focus, .field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: rgba(23, 100, 82, 0.62);
  box-shadow: var(--ring);
}

.field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 19px,
    calc(100% - 13px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.field textarea { resize: vertical; }
.form-stack { display: grid; gap: 2px; }
.split-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.list-stack { display: grid; gap: 12px; }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 0 0 20px;
}

.quick-actions button {
  min-height: 108px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 5px;
  border: 1px solid rgba(213, 226, 221, 0.9);
  border-radius: 14px;
  padding: 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  text-align: left;
}

.quick-actions strong,
.quick-actions small {
  display: block;
}

.quick-actions strong {
  font-size: 0.94rem;
  line-height: 1.1;
}

.quick-actions small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.quick-icon {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: var(--brand-soft);
}

.plus-icon::before,
.plus-icon::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 13px;
  height: 2px;
  background: var(--brand);
}

.plus-icon::after {
  transform: rotate(90deg);
}

.approve-icon::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 7px;
  width: 11px;
  height: 15px;
  border-right: 3px solid var(--brand);
  border-bottom: 3px solid var(--brand);
  transform: rotate(38deg);
}

.folder-icon::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 9px;
  width: 16px;
  height: 11px;
  border: 2px solid var(--brand);
  border-radius: 3px;
}

.folder-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 7px;
  width: 8px;
  height: 4px;
  border-radius: 3px 3px 0 0;
  background: var(--brand);
}

.job-board-section {
  margin-top: 20px;
}

.compact-heading {
  align-items: flex-end;
  margin-bottom: 10px;
}

.compact-heading h2 {
  margin-bottom: 0;
}

.count-pill {
  min-width: 34px;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--brand);
  background: var(--brand-soft);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 900;
}

.section-help {
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.big-filters {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  gap: 8px;
  margin-bottom: 10px;
  overflow-x: auto;
}

.big-filters button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.big-filters button.is-selected {
  color: white;
  border-color: var(--brand);
  background: var(--brand);
}

.job-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 16px 46px 16px 16px;
  color: inherit;
  text-align: left;
}

.job-card::after {
  content: "›";
  position: absolute;
  right: 17px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.7rem;
  line-height: 1;
}

.job-card:hover {
  border-color: rgba(23, 100, 82, 0.34);
  box-shadow: var(--shadow);
}

.job-card-title {
  font-size: 1.12rem;
  font-weight: 900;
}

.job-card-client {
  color: var(--muted);
  font-size: 0.92rem;
}

.job-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.job-card-meta strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.job-card-meta small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.approval-record p, .plain-card p, .customer-teaser p { color: var(--muted); margin-bottom: 0; }

.status-pill {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px 6px;
  font-size: 0.72rem;
  font-weight: 900;
}

.active, .approved { color: #0d5132; background: #d8f1e4; }
.waiting { color: #72500d; background: #f8e9b8; }
.pending { color: #842e28; background: #f4d9d6; }
.done { color: #4c5659; background: #e6eaeb; }

.primary, .button-link.primary {
  color: white;
  background: linear-gradient(135deg, var(--brand), #21806a);
  box-shadow: 0 10px 24px rgba(23, 100, 82, 0.24);
}
.primary:hover, .button-link.primary:hover { background: var(--brand-dark); }
.secondary, .button-link.secondary, .upload-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line-strong);
}
.secondary.danger { color: var(--danger); }
.ghost, .back-link { color: var(--brand); background: transparent; }
.small { min-height: 38px; padding: 9px 11px; font-size: 0.86rem; }

.icon-button {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid rgba(213, 226, 221, 0.94);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  text-decoration: none;
}

.back-link {
  min-height: 36px;
  padding: 0;
  margin-bottom: 14px;
}

.job-hero { align-items: flex-start; margin-bottom: 14px; }
.job-hero p { margin-bottom: 0; color: var(--muted); }

.status-select-wrap {
  position: relative;
  display: grid;
  justify-items: end;
  gap: 7px;
}

.status-select-wrap select {
  width: 148px;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 28px 7px 11px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-select-wrap::after {
  content: "⌄";
  position: absolute;
  right: 10px;
  bottom: 7px;
  color: var(--muted);
  pointer-events: none;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.metrics div {
  min-width: 0;
  border: 1px solid rgba(213, 226, 221, 0.94);
  border-radius: 12px;
  padding: 13px 11px;
  background: rgba(255, 255, 255, 0.72);
}

.metrics strong { display: block; font-size: 1.06rem; }

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 16px;
}

.mini-metrics div {
  border: 1px solid rgba(213, 226, 221, 0.9);
  border-radius: 12px;
  padding: 12px 10px;
  background: rgba(255, 255, 255, 0.72);
}

.mini-metrics span,
.report-card-total span,
.report-card-total small {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.mini-metrics strong {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem;
}

.subnav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 18px -16px 16px;
  padding: 0 16px 2px;
}

.subnav button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(213, 226, 221, 0.9);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
}

.subnav button.is-selected {
  color: white;
  border-color: var(--brand);
  background: var(--brand);
}

.approval-record {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 13px;
  align-items: center;
  padding: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 250, 242, 0.9));
}

.approval-record.no-thumb { grid-template-columns: 1fr auto; }
.approval-record h2 { font-size: 1rem; margin-bottom: 6px; }
.approval-record h3 { line-height: 1.25; }
.approval-record p strong { color: var(--ink); }
.record-actions { display: grid; gap: 7px; }

.thumb {
  width: 66px;
  height: 66px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.plain-card { padding: 16px; }
.report-panel { padding: 16px; margin-bottom: 16px; }
.report-panel.compact { box-shadow: none; }

.report-status-card {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.report-status-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.report-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 15px;
}

.report-card h3 {
  margin-top: 8px;
  line-height: 1.18;
}

.report-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.report-card-total {
  min-width: 92px;
  text-align: right;
}

.report-card-total strong {
  display: block;
  margin: 4px 0;
  font-size: 1.08rem;
}

.report-card .button-link {
  grid-column: 1 / -1;
}

.settings-hero {
  padding: 17px;
  margin-bottom: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent 40%),
    linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: white;
}

.settings-hero h3 {
  margin-top: 12px;
  font-size: 1.18rem;
}

.settings-hero p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.78);
}

.settings-list {
  display: grid;
  gap: 12px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.check-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
  list-style: none;
}

.check-list li {
  position: relative;
  padding-left: 25px;
  color: var(--muted);
}

.check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: -1px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: white;
  background: var(--brand);
  font-size: 0.72rem;
  font-weight: 900;
}

.report-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.report-row:last-child { border-bottom: 0; }
.report-row.total, .report-row.due { font-size: 1.08rem; }
.report-row.due strong { color: var(--accent); }

.capture-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 14px;
}

.upload-button {
  position: relative;
  overflow: hidden;
  min-height: 52px;
  background: rgba(255, 255, 255, 0.74);
}
.upload-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.photo-grid figure { margin: 0; }
.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.photo-grid figcaption { margin-top: 5px; color: var(--muted); font-size: 0.78rem; }

.evidence-photo, .report-photo {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  background: var(--surface-2);
}

.note-box {
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 13px 14px;
  margin-bottom: 14px;
  color: var(--ink);
  background: linear-gradient(135deg, #fff0e2, #fff8ed);
  color: #473222;
}

.success-block { text-align: center; margin: 18px 0; }
.success-mark {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, var(--ok), #2d9365);
  font-size: 1.6rem;
  font-weight: 900;
}

.actions-stack { display: grid; gap: 10px; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 9;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: min(100%, 500px);
  transform: translateX(-50%);
  border: 1px solid rgba(213, 226, 221, 0.95);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  padding: 9px 10px 10px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 -10px 34px rgba(31, 39, 35, 0.1);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  min-height: 54px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-size: 0.72rem;
}
.bottom-nav button.is-active {
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 900;
}

.nav-icon {
  position: relative;
  display: block;
  width: 22px;
  height: 22px;
}

.nav-home::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  width: 14px;
  height: 10px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 2px;
}

.nav-home::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 3px;
  width: 12px;
  height: 12px;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
}

.nav-approve::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 3px;
  width: 12px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.nav-approve::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 9px;
  width: 8px;
  height: 4px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.nav-report::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.nav-report::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 9px;
  width: 7px;
  height: 2px;
  box-shadow: 0 4px 0 currentColor;
  background: currentColor;
}

.nav-settings::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.nav-settings::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 9px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  z-index: 12;
  transform: translate(-50%, 120%);
  width: min(92vw, 430px);
  padding: 13px 15px;
  border-radius: 12px;
  color: white;
  background: rgba(30, 37, 40, 0.94);
  opacity: 0;
  transition: 160ms ease;
  text-align: center;
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  padding: 16px;
  background: rgba(30, 37, 40, 0.42);
}
.sheet.hidden, .hidden { display: none; }
.sheet-panel {
  position: relative;
  width: min(100%, 500px);
  margin: 0 auto;
  border-radius: 16px;
  padding: 20px;
  background: white;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}
.sheet-panel p:not(.eyebrow) { color: var(--muted); }
.sheet-close { position: absolute; top: 12px; right: 12px; font-size: 1.4rem; }

.client-shell { display: grid; align-items: center; }
.client-card {
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 250, 242, 0.92));
}
.client-header { align-items: flex-start; margin-bottom: 14px; }
.client-summary dl, .receipt-list { display: grid; gap: 9px; margin: 14px 0; }
.client-summary dl div, .receipt-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
}
dd { margin: 0; font-weight: 850; }
.customer-teaser { box-shadow: none; margin-top: 16px; padding: 14px; background: rgba(255, 255, 255, 0.64); }
.customer-teaser h2 { font-size: 1rem; }

.included-list { padding: 16px; margin-bottom: 16px; }
.included-list ul { margin: 0; padding-left: 19px; color: var(--muted); }
.included-list li { margin: 8px 0; }

@media (max-width: 390px) {
  .app-shell { padding-inline: 12px; }
  h1 { font-size: 1.5rem; }
  .quick-actions { grid-template-columns: 1fr; }
  .quick-actions button { min-height: 72px; grid-template-columns: auto 1fr; align-items: center; }
  .quick-actions small { grid-column: 2; }
  .metrics, .split-fields, .mini-metrics { grid-template-columns: 1fr; }
  .actions-row { align-items: stretch; flex-direction: column; }
  .approval-record, .approval-record.no-thumb { grid-template-columns: 1fr; }
  .record-actions { grid-template-columns: 1fr 1fr; }
  .report-card { grid-template-columns: 1fr; }
  .report-card-total { text-align: left; }
}
