:root {
  --ink: #102019;
  --muted: #5e6d65;
  --green: #226b49;
  --green-dark: #174d35;
  --green-soft: #e5f1ea;
  --cream: #fbfcf9;
  --card: #ffffff;
  --line: #dce5df;
  --gold: #fff0be;
  --gold-ink: #765100;
  --warning: #fff5df;
  --warning-ink: #795200;
  --danger: #a9322b;
  --shadow: 0 10px 28px rgba(25, 62, 43, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--cream);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; background: var(--cream); }
body { min-width: 320px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px 20px; }
.login-card { width: min(100%, 560px); text-align: center; }
.login-card h1 { margin: 18px 0 12px; font-size: clamp(2.15rem, 9vw, 4.2rem); line-height: .98; letter-spacing: -.045em; }
.login-card p { color: var(--muted); font-size: 1.08rem; }
.environment-badge { display: inline-flex; align-items: center; min-height: 32px; padding: 6px 13px; border-radius: 999px; background: var(--gold); color: var(--gold-ink); font-size: .76rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }

.primary-button, .secondary-button, .back-button { min-height: 48px; border: 0; border-radius: 16px; padding: 12px 18px; font-weight: 750; cursor: pointer; }
.primary-button { width: 100%; background: var(--green); color: white; }
.primary-button:hover, .primary-button:focus-visible { background: var(--green-dark); }
.secondary-button { color: var(--green-dark); background: var(--green-soft); white-space: nowrap; }
.compact { width: auto; min-width: 92px; }
.back-button { margin: 0 0 16px; padding-left: 0; color: var(--green); background: transparent; }
.error-message { color: var(--danger) !important; font-weight: 700; }

.app-shell { min-height: 100vh; padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
.app-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 18px 12px; border-bottom: 1px solid var(--line); background: rgba(251,252,249,.95); }
.brand-name { margin: 10px 0 3px; font-size: 1.12rem; font-weight: 850; }
.user-identity { margin: 0; color: var(--muted); font-size: .9rem; }
.content-shell { width: min(100%, 820px); margin: 0 auto; padding: 24px 16px 34px; }
.page-heading { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 18px; }
.page-heading h1 { margin: 0; font-size: clamp(2.35rem, 12vw, 4rem); line-height: 1; letter-spacing: -.04em; }
.eyebrow { margin: 0 0 7px; color: var(--green); font-size: .78rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.page-date, .page-intro { color: var(--muted); }
.page-date { margin: 0; text-align: right; font-size: .88rem; }
.page-intro { margin: -5px 0 20px; line-height: 1.5; }
.card-list { display: grid; gap: 14px; }

.job-card, .attention-card, .customer-card, .section-card { width: 100%; border: 1px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: var(--shadow); }
button.job-card, button.customer-card, button.attention-card { min-height: 48px; padding: 18px; color: inherit; text-align: left; cursor: pointer; }
.job-card:hover, .job-card:focus-visible, .customer-card:hover, .customer-card:focus-visible, .attention-card:hover, .attention-card:focus-visible { border-color: var(--green); outline: 3px solid rgba(34,107,73,.12); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-time { margin: 0; font-size: 1.45rem; font-weight: 850; letter-spacing: -.025em; }
.card-date { margin: 0 0 4px; color: var(--green); font-size: .82rem; font-weight: 800; }
.status-badge { display: inline-flex; align-items: center; min-height: 30px; padding: 5px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); font-size: .76rem; font-weight: 800; }
.customer-name { margin: 15px 0 5px; font-size: 1.14rem; font-weight: 850; }
.address { margin: 0; color: var(--muted); line-height: 1.35; }
.card-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.metric-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.metric-value { font-weight: 800; }
.empty-state { padding: 26px 20px; border: 1px dashed #c9d5ce; border-radius: 20px; color: var(--muted); background: #f3f6f3; line-height: 1.45; }

.attention-card { border-left: 6px solid #d99a20; }
.attention-card h2, .customer-card h2 { margin: 0 0 6px; font-size: 1.08rem; }
.attention-card p, .customer-card p { margin: 4px 0 0; color: var(--muted); line-height: 1.4; }
.attention-reason { color: var(--warning-ink) !important; font-weight: 700; }

.search-form { margin-bottom: 20px; }
.search-form label { display: block; margin: 0 0 8px; font-weight: 800; }
.search-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.search-row input { min-width: 0; min-height: 50px; border: 1px solid #bfcfc5; border-radius: 15px; padding: 11px 13px; background: white; }
.search-row input:focus { border-color: var(--green); outline: 3px solid rgba(34,107,73,.12); }

.workflow-form { display: grid; gap: 16px; }
.form-section { margin-bottom: 0; }
.field-grid { display: grid; gap: 14px; }
.field-grid label, .service-picker { display: grid; gap: 7px; }
.field-grid label > span, .service-picker legend { font-size: .82rem; font-weight: 800; }
.field-grid input, .field-grid select { width: 100%; min-width: 0; min-height: 50px; border: 1px solid #bfcfc5; border-radius: 15px; padding: 11px 13px; color: var(--ink); background: white; }
.field-grid input:focus, .field-grid select:focus { border-color: var(--green); outline: 3px solid rgba(34,107,73,.12); }
.field-help { margin: 12px 0 0; color: var(--muted); font-size: .85rem; line-height: 1.45; }
.service-picker { margin: 18px 0 0; padding: 0; border: 0; }
.service-picker legend { margin-bottom: 10px; }
.service-options { display: grid; gap: 8px; }
.service-category { margin: 12px 0 2px; color: var(--green); font-size: .76rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.service-option { display: grid; grid-template-columns: auto minmax(0,1fr) 82px; align-items: center; gap: 10px; min-height: 50px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 14px; background: #f7f9f7; }
.service-option input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--green); }
.service-option input[type="number"] { width: 82px; min-height: 40px; border: 1px solid #bfcfc5; border-radius: 11px; padding: 7px; text-align: center; }
.quote-result { margin-top: 18px; border-color: #afd0bb; background: var(--green-soft); }
.quote-total { margin: 4px 0; font-size: 2rem; font-weight: 900; letter-spacing: -.035em; }
.quote-summary { margin: 5px 0 0; color: var(--muted); }
.match-options { display: grid; gap: 9px; margin: 12px 0; }
.match-option, .check-row { display: flex; align-items: flex-start; gap: 11px; min-height: 48px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #f7f9f7; }
.match-option input, .check-row input { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--green); }
.authorization-card { margin-top: 16px; border-color: #d6bd73; background: #fffaf0; }
.authorization-card > p { color: var(--muted); line-height: 1.45; }
.authorization-card .primary-button { margin-top: 12px; }
.status-message { margin: 12px 0 0; color: var(--green-dark); font-weight: 750; }
.service-start-card { border-color: #afd0bb; background: #f7fbf8; }
.service-start-card .primary-button { margin-top: 16px; }
.start-override { display: grid; gap: 7px; margin-top: 16px; font-size: .82rem; font-weight: 800; }
.start-override textarea { width: 100%; min-height: 92px; resize: vertical; border: 1px solid #bfcfc5; border-radius: 15px; padding: 11px 13px; color: var(--ink); background: white; font: inherit; }
.start-override textarea:focus { border-color: var(--green); outline: 3px solid rgba(34,107,73,.12); }
.override-note { margin: 12px 0 0; padding: 12px; border-radius: 14px; color: var(--warning-ink); background: var(--warning); line-height: 1.45; }
.next-action-card { border: 2px solid #afd0bb; background: #f7fbf8; box-shadow: var(--shadow); }
.next-action-card > h2 { font-size: 1.55rem; }
.next-action-intro { margin: -2px 0 16px; color: var(--muted); font-size: 1.02rem; line-height: 1.5; }
.action-safety-note { margin: 10px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.action-hero h1 { font-size: clamp(1.8rem, 9vw, 3rem); }
.optional-information { display: grid; gap: 10px; margin-top: 22px; }
.optional-heading { margin: 0 0 2px; color: var(--muted); font-size: .76rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.optional-details { border: 1px solid var(--line); border-radius: 15px; background: white; }
.optional-details summary { min-height: 48px; padding: 14px 16px; color: var(--green-dark); font-weight: 800; cursor: pointer; list-style-position: inside; }
.optional-details-body { padding: 4px 16px 16px; border-top: 1px solid var(--line); }
.optional-details-body h2 { margin: 14px 0; font-size: 1.1rem; }
.optional-details-body h3 { margin: 18px 0 10px; font-size: .95rem; }
.scope-card { border-color: #afd0bb; background: #f7fbf8; }
.scope-current { margin-top: 16px; }
.complete-service-action { margin-top: 22px; }
.scope-review-button { width: 100%; margin-top: 16px; }
.scope-editor { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.scope-editor > .primary-button, .scope-preview > .primary-button, .approval-present > .primary-button { margin-top: 16px; }
.scope-preview, .approval-present { margin-top: 16px; padding: 16px; border: 1px solid #d6bd73; border-radius: 16px; background: #fffaf0; }
.scope-preview h3, .approval-present h3 { margin: 0 0 10px; }
.scope-rule, .approval-present > p { color: var(--muted); line-height: 1.45; }
.approval-total { display: grid; gap: 3px; padding: 14px; border-radius: 14px; color: var(--ink) !important; background: var(--warning); }
.approval-total span { color: var(--warning-ink); font-size: .78rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.approval-total strong { font-size: 2rem; letter-spacing: -.03em; }
.approval-total small { color: var(--warning-ink); font-weight: 700; }
.approval-name { display: grid; gap: 7px; margin-top: 12px; font-size: .82rem; font-weight: 800; }
.approval-name input { min-height: 50px; border: 1px solid #bfcfc5; border-radius: 15px; padding: 11px 13px; background: white; }
.remote-approval { margin-top: 20px; padding-top: 18px; border-top: 1px solid #d6bd73; }
.remote-approval > p { color: var(--muted); line-height: 1.45; }
.approval-link-result { display: grid; gap: 12px; margin-top: 14px; padding: 14px; border-radius: 14px; background: white; }
.approval-link-result label { display: grid; gap: 6px; font-size: .8rem; font-weight: 800; }
.approval-link-result input { min-height: 48px; width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.approval-link-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.link-button { display: inline-flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; }
.payment-action-card { border-color: #d6bd73; background: #fffaf0; }
.payment-paid-card { border-color: #9fcdb3; background: #f4fbf7; }
.payment-paid-card p { margin: 0; }
.payment-paid-card h2 { margin: 6px 0 10px; }
.payment-action-card > .primary-button { margin-top: 16px; }
.payment-policy-summary { display: grid; gap: 7px; margin: 14px 0; padding: 14px; border-radius: 14px; background: white; color: var(--muted); line-height: 1.45; }
.payment-policy-summary p, .payment-confirmed p { margin: 0; }
.payment-policy-summary > strong, .payment-confirmed > strong { color: var(--ink); }
.payment-confirmed { display: grid; gap: 6px; margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--green-soft); color: var(--green-dark); }
.payment-final-card .settlement-summary { margin: 16px 0; padding: 14px; border-radius: 14px; background: white; }
.payment-final-card > .check-row { margin-top: 16px; }
.payment-final-card > .primary-button { margin-top: 14px; }
.payment-final-card .optional-details { margin-top: 14px; }
.payment-admin-details label:not(.check-row) { display: grid; gap: 7px; margin-top: 14px; font-size: .82rem; font-weight: 800; }
.payment-admin-details input:not([type="checkbox"]), .payment-admin-details textarea { width: 100%; min-height: 50px; border: 1px solid #bfcfc5; border-radius: 15px; padding: 11px 13px; color: var(--ink); background: white; font: inherit; }
.payment-admin-details textarea { min-height: 92px; resize: vertical; }
.payment-admin-details .check-row { margin-top: 14px; }
.payment-admin-details .secondary-button { margin-top: 14px; }
.tip-suggestions { display: flex; flex-wrap: wrap; gap: 9px; margin: 14px 0; }
.tip-suggestion { min-height: 44px; min-width: 64px; padding: 9px 14px; border: 1px solid #afd0bb; border-radius: 999px; color: var(--green-dark); background: var(--green-soft); font: inherit; font-weight: 800; cursor: pointer; }
.tip-suggestion:focus-visible { outline: 3px solid rgba(34,107,73,.18); outline-offset: 2px; }
.tip-choice-card, .tip-status-card { margin-top: 24px; padding: 20px; border: 1px solid #cfe0d6; border-radius: 20px; background: var(--green-soft); }
.tip-choice-card > * + *, .tip-status-card > * + * { margin-top: 16px; }
.tip-choice-card .primary-button, .tip-choice-card > .secondary-button { width: 100%; min-height: 56px; }
.approval-link-result p, .approval-expiry { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.approval-page { min-height: 100vh; background: #f4f7f4; }
.approval-shell { width: min(100% - 24px, 560px); margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 0 max(32px, env(safe-area-inset-bottom)); }
.approval-card { padding: 22px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: var(--shadow); }
.approval-card h1 { margin: 18px 0 10px; font-size: clamp(2rem, 10vw, 3.2rem); line-height: 1; letter-spacing: -.04em; }
.approval-card > p { color: var(--muted); line-height: 1.5; }
.approval-card form { display: grid; gap: 14px; margin-top: 20px; }
.approval-price dd { color: var(--green-dark); font-size: 2rem; }

.detail-hero { margin-bottom: 18px; }
.detail-hero h1 { margin: 8px 0 5px; font-size: clamp(2rem, 10vw, 3.5rem); line-height: 1; letter-spacing: -.035em; }
.detail-hero p { margin: 0; color: var(--muted); }
.section-card { margin-bottom: 16px; padding: 18px; box-shadow: none; }
.section-card h2 { margin: 0 0 14px; font-size: 1.15rem; }
.detail-list { display: grid; gap: 13px; margin: 0; }
.detail-row { display: grid; gap: 3px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.detail-row:last-child { padding-bottom: 0; border-bottom: 0; }
.detail-row dt { color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.detail-row dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.services-list { margin: 0; padding-left: 20px; }
.services-list li + li { margin-top: 7px; }
.history-list { display: grid; gap: 10px; }
.history-item { padding: 12px; border-radius: 14px; background: #f2f6f3; }
.history-item p { margin: 0; }
.history-meta { margin-top: 4px !important; color: var(--muted); font-size: .82rem; }
.safe-state { display: inline-flex; gap: 7px; align-items: center; font-weight: 800; }
.safe-state::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #ca8d15; }
.safe-state.confirmed::before, .safe-state.recorded::before { background: var(--green); }
.loading { padding: 28px 0; color: var(--muted); }
.customer-tip-card { max-width: 42rem; }
.customer-tip-card .tip-suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 1.5rem 0; }
.customer-tip-card .tip-suggestions button, .customer-tip-decline { min-height: 3.5rem; }
.customer-tip-card #customer-tip-custom-row { margin: 1rem 0; }
.customer-tip-card #customer-tip-custom { width: 100%; min-height: 3.5rem; font-size: 1.15rem; }
.customer-tip-decline { width: 100%; margin-top: 1rem; }
@media (max-width: 480px) { .customer-tip-card .tip-suggestions { grid-template-columns: 1fr; } }

.bottom-nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5,1fr); min-height: 72px; padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.98); box-shadow: 0 -7px 24px rgba(25,62,43,.08); }
.bottom-nav a { position: relative; display: flex; min-width: 0; min-height: 54px; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 14px; color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 750; }
.bottom-nav a[aria-current="page"] { color: var(--green-dark); background: var(--green-soft); }
.nav-icon { display: grid; width: 24px; height: 22px; place-items: center; font-size: 1rem; font-weight: 900; }
.nav-count { position: absolute; top: 3px; right: calc(50% - 25px); min-width: 19px; height: 19px; padding: 2px 5px; border-radius: 999px; color: white; background: var(--danger); text-align: center; font-size: .65rem; }

@media (min-width: 680px) {
  .app-header { padding: 22px max(24px, calc((100vw - 820px)/2)); }
  .content-shell { padding-left: 24px; padding-right: 24px; }
  .card-list.two-column { grid-template-columns: 1fr 1fr; }
  .detail-list { grid-template-columns: 1fr 1fr; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .full-field { grid-column: 1 / -1; }
  .bottom-nav { left: 50%; right: auto; width: min(100%, 820px); transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; }
}
