:root {
  --ink: #102a43;
  --muted: #526d82;
  --line: #d9e2ec;
  --canvas: #f4f7fa;
  --card: #ffffff;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #dff7f2;
  --warm: #f59e0b;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --success: #166534;
  --success-soft: #dcfce7;
  --shadow: 0 10px 30px rgba(16, 42, 67, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; scroll-padding-block: 16px calc(124px + env(safe-area-inset-bottom)); }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Tahoma, "Segoe UI", sans-serif;
  line-height: 1.5;
}
.skip-link { position: fixed; top: 8px; right: 8px; z-index: 100; padding: 9px 12px; border-radius: 8px; background: #fff; color: var(--ink); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
button,
input,
select,
textarea { font: inherit; }
button,
a { -webkit-tap-highlight-color: transparent; scroll-margin-block: 80px calc(124px + env(safe-area-inset-bottom)); touch-action: manipulation; }
button { min-height: 44px; }
button:disabled { cursor: wait; opacity: 0.58; }
:focus-visible { outline: 3px solid rgba(15, 118, 110, 0.32); outline-offset: 2px; }
h1,
h2,
h3,
p,
dl,
dd { margin: 0; }
h1 { font-size: clamp(1.35rem, 3vw, 1.8rem); line-height: 1.3; }
h2 { font-size: 1.18rem; }
h3 { font-size: 1rem; }
small { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.eyebrow {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.empty {
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}

.app-shell {
  min-height: 100vh;
  max-width: 620px;
  margin: auto;
  padding: calc(20px + env(safe-area-inset-top)) 18px calc(104px + env(safe-area-inset-bottom));
}
.topbar,
.section-title,
.job-card-top,
.job-card-footer,
.action-row,
.withdrawal-card-head,
.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.icon-button {
  position: relative;
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  cursor: pointer;
  font-size: 1.5rem;
}
.queue-count {
  position: absolute;
  top: -5px;
  left: -5px;
  min-width: 19px;
  padding: 2px 5px;
  border-radius: 100px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
}
.sync-banner {
  display: flex;
  gap: 8px;
  margin: 20px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #e4f7ef;
  color: #17603a;
  font-size: 0.82rem;
}
.sync-banner > span:last-child { display: grid; gap: 2px; }
.sync-banner small { color: inherit; opacity: 0.82; }
.sync-banner.offline { background: #fff3d7; color: #925d00; }
.status-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: currentColor;
}

.summary-grid,
.wallet-metrics,
.admin-overview {
  display: grid;
  gap: 10px;
}
.summary-grid { grid-template-columns: repeat(3, 1fr); margin-bottom: 27px; }
.summary-grid article,
.wallet-metrics article,
.admin-overview article {
  padding: 15px 10px;
  border: 1px solid rgba(217, 226, 236, 0.7);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}
.summary-grid strong,
.wallet-metrics strong,
.admin-overview strong {
  display: block;
  color: var(--brand-dark);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}
.summary-grid span,
.wallet-metrics span,
.admin-overview span { color: var(--muted); font-size: 0.74rem; }
.section-title { margin-bottom: 14px; }

.text-button,
.back-button {
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
}
.primary-button,
.secondary-button,
.danger-button,
.open-job {
  border: 0;
  border-radius: 11px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}
.primary-button,
.open-job { background: var(--brand); color: #fff; }
.primary-button:hover,
.open-job:hover { background: var(--brand-dark); }
.secondary-button { background: #e8f0f6; color: var(--ink); }
.danger-button { background: var(--danger-soft); color: var(--danger); }
.secondary-button:hover { background: #d9e6f0; }
.danger-button:hover { background: #fecaca; }
.text-button:hover,
.back-button:hover { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 3px; }

.job-list,
.admin-list,
.timeline-list { display: grid; gap: 12px; }
.job-card,
.detail-card,
.profile-card,
.settings-card,
.withdrawal-card,
.admin-section {
  border: 1px solid rgba(217, 226, 236, 0.76);
  border-radius: 17px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.job-card { padding: 16px; }
.job-card:hover { border-color: #8bdccf; }
.job-card h3 { margin: 10px 0 6px; }
.job-meta,
.job-address,
.detail-card p,
.profile-card p { color: var(--muted); font-size: 0.84rem; }
.job-address { margin-top: 8px; line-height: 1.6; }
.job-card-footer { margin-top: 15px; }
.job-id { color: var(--muted); direction: ltr; font-size: 0.75rem; unicode-bidi: isolate; }
.tag,
.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 100px;
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.tag { background: #e0f2fe; color: #075985; }
.tag.urgent { background: var(--danger-soft); color: #991b1b; }
.status { background: #eef2f7; color: #536273; }
.status.progress,
.status.pending,
.status.deferred { background: #fef3c7; color: #92400e; }
.status.complete,
.status.paid { background: var(--success-soft); color: var(--success); }
.status.approved { background: #dbeafe; color: #1d4ed8; }
.status.rejected,
.status.cancelled { background: var(--danger-soft); color: var(--danger); }

.view { display: none; }
.view.active { display: block; padding-bottom: 24px; }
.filters { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 14px; }
.filter {
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.filter:hover { border-color: #9fb3c8; color: var(--ink); }
.filter.active { border-color: var(--ink); background: var(--ink); color: #fff; }
.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: flex;
  max-width: 620px;
  margin: auto;
  padding: 9px 8px calc(9px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}
.nav-item {
  display: grid;
  flex: 1;
  min-width: 0;
  place-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
}
.nav-item span { font-size: 1.2rem; }
.nav-item:hover { background: var(--brand-soft); }
.nav-item.active { color: var(--brand-dark); font-weight: 700; }

.back-button { margin-bottom: 18px; }
.detail-head { margin-bottom: 17px; }
.detail-head h2 { margin: 8px 0; }
.action-row { flex-wrap: wrap; margin-bottom: 15px; }
.action-row > * { flex: 1; text-align: center; }
.detail-card { margin-top: 12px; padding: 17px; }
.detail-card > h2,
.detail-card > h3 { margin-bottom: 10px; }
.detail-card > p + * { margin-top: 12px; }
.detail-card a { display: inline-block; margin-top: 10px; color: var(--brand); font-weight: 700; }
.contact-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 8px; }
.contact-actions > * { margin-top: 0 !important; }
.completion-card label { display: block; margin-bottom: 6px; font-weight: 700; }
.completion-card textarea { width: 100%; min-height: 110px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; }
.completion-card small { display: block; margin-top: 7px; }
.validation-note { margin-top: 10px; color: var(--danger) !important; }
.checklist { display: grid; gap: 12px; }
.checklist label { display: flex; min-height: 44px; align-items: center; gap: 9px; padding: 7px 4px; border-radius: 9px; font-size: 0.9rem; scroll-margin-block: 80px calc(124px + env(safe-area-inset-bottom)); }
.checklist label:hover { background: #f4f8fb; }
.checklist input { width: 20px; height: 20px; accent-color: var(--brand); }
.parts { display: flex; flex-wrap: wrap; gap: 8px; }
.parts span { padding: 7px 9px; border-radius: 8px; background: #edf6ff; font-size: 0.8rem; }
.parts + label { display: block; margin-top: 14px; font-weight: 700; }
#parts-used { width: 100%; min-height: 88px; margin: 7px 0 9px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; }
.evidence-requirements,
.evidence-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.evidence-requirement { padding: 6px 9px; border-radius: 100px; background: #eef2f7; color: var(--muted); font-size: .75rem; font-weight: 700; }
.evidence-requirement.required { background: #fff3bf; color: #8a4b08; }
.evidence-list { display: grid; gap: 9px; margin: 13px 0; }
.evidence-card { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 12px; }
.evidence-card img { width: 64px; height: 54px; border-radius: 8px; background: #eef2f7; object-fit: cover; }
.evidence-card div { min-width: 0; }
.evidence-card strong,
.evidence-card small { display: block; overflow-wrap: anywhere; }
.evidence-card small { margin-top: 3px; color: var(--muted); }
.danger-text { color: var(--danger); }
.signature-pad { margin-top: 15px; padding: 12px; border: 1px solid #bfd7e5; border-radius: 12px; background: #f8fbfd; }
.signature-pad > label { display: block; margin-bottom: 8px; font-weight: 700; }
.signature-pad canvas { display: block; width: 100%; height: 180px; border: 1px dashed #829ab1; border-radius: 9px; background: #fff; touch-action: none; }
.signature-pad > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 9px; }
.profile-card { display: flex; align-items: center; gap: 12px; margin: 15px 0; padding: 16px; }
.avatar {
  display: grid;
  width: 49px;
  height: 49px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
}
.settings-card { margin-top: 12px; padding: 16px; }
.settings-card p { margin: 8px 0 13px; color: var(--muted); font-size: 0.86rem; line-height: 1.7; }
.done-message { padding: 11px; border-radius: 10px; background: var(--success-soft); color: var(--success); font-size: 0.85rem; }
.danger-zone { border-color: #fecaca; }
.tracking-card { display: grid; gap: 18px; padding: 19px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.tracking-state { display: flex; align-items: center; gap: 12px; }
.tracking-state > div { min-width: 0; }
.tracking-state p, .privacy-note { margin-top: 4px; color: var(--muted); font-size: 0.84rem; line-height: 1.7; }
.tracking-dot { width: 13px; height: 13px; flex: 0 0 13px; border-radius: 50%; background: #94a3b8; box-shadow: 0 0 0 5px #e2e8f0; }
.tracking-dot.active { background: #16a34a; box-shadow: 0 0 0 5px #dcfce7; }
.map-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

.wallet-hero {
  display: grid;
  min-height: 178px;
  place-content: center;
  margin-bottom: 12px;
  padding: 28px;
  border-radius: 22px;
  background: linear-gradient(135deg, #102a43, #0f766e);
  color: #fff;
  text-align: center;
  box-shadow: 0 18px 40px rgba(15, 118, 110, 0.22);
}
.wallet-hero span,
.wallet-hero small { color: rgba(255, 255, 255, 0.78); }
.wallet-hero strong { margin: 5px 0; font-size: clamp(2rem, 9vw, 2.8rem); font-variant-numeric: tabular-nums; }
.wallet-metrics { grid-template-columns: repeat(2, 1fr); margin-bottom: 12px; }
.wallet-section { margin-top: 24px; }
.wallet-section h3 { margin-bottom: 11px; }
.timeline-item,
.ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.timeline-item p,
.ledger-row p { margin-top: 3px; color: var(--muted); font-size: 0.78rem; }
.timeline-item small,
.ledger-row small { display: block; margin-top: 3px; }
.money-value { direction: ltr; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money-value.positive { color: var(--success); }
.money-value.negative { color: var(--danger); }

.pairing-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(145deg, #102a43, #0f766e);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.pairing-card {
  width: min(100%, 430px);
  padding: 29px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
}
.pairing-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 16px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 1.8rem;
}
.pairing-card > p { margin: 12px 0; color: var(--muted); line-height: 1.7; }
.pairing-hint { font-size: 0.79rem; }

.form-stack { display: grid; gap: 13px; margin-top: 18px; }
.form-stack label,
.payout-box label,
.manager-reason { display: grid; gap: 6px; color: var(--ink); font-size: 0.85rem; font-weight: 700; }
.form-stack input,
.form-stack select,
.form-stack textarea,
.payout-box input,
.manager-reason textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
.form-stack textarea,
.manager-reason textarea { min-height: 78px; resize: vertical; }
.form-result { min-height: 20px; margin-top: 12px; color: var(--brand-dark); font-size: 0.86rem; }
.server-field { display: grid; gap: 7px; padding: 12px; border: 1px solid #bfdbfe; border-radius: 12px; background: #eff6ff; }
.server-field small { line-height: 1.6; }

.portal-shell { max-width: 1120px; margin: auto; padding: 42px 20px 70px; }
.portal-header { align-items: flex-start; }
.portal-header > div > p:last-child { margin-top: 6px; color: var(--muted); }
.admin-badge { padding: 8px 12px; border-radius: 100px; background: var(--brand-soft); color: var(--brand-dark); font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.admin-overview { grid-template-columns: repeat(3, 1fr); margin-top: 24px; }
.portal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.portal-grid .detail-card { margin: 0; }
.wide-card { grid-column: 1 / -1; }
.technician-toolbar { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.technician-toolbar label { font-weight: 700; }
.technician-toolbar select { min-width: 230px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.admin-actions { display: flex; align-items: center; gap: 10px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full-field { grid-column: 1 / -1; }
.requirements-box { display: flex; flex-wrap: wrap; gap: 10px 18px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.requirements-box legend { padding-inline: 6px; font-weight: 800; }
.requirements-box label { display: flex; min-height: 36px; align-items: center; gap: 7px; }
.requirements-box input { width: 20px; min-height: 20px; accent-color: var(--brand); }
.admin-section { margin-top: 22px; padding: 20px; }
.admin-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.qr-result { display: grid; justify-items: center; gap: 9px; margin-top: 20px; text-align: center; }
.qr-result svg,
.qr-result img { width: min(210px, 100%); height: auto; border: 10px solid #fff; box-shadow: var(--shadow); }
.qr-result code { padding: 7px 10px; border-radius: 7px; background: #eaf2f8; direction: ltr; }
.qr-result p { color: var(--muted); font-size: 0.8rem; }
.withdrawal-card { padding: 17px; }
.withdrawal-card-head h3 { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.withdrawal-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.withdrawal-meta div { padding: 9px; border-radius: 9px; background: #f7f9fb; }
.withdrawal-meta dt { color: var(--muted); font-size: 0.7rem; }
.withdrawal-meta dd { margin-top: 2px; font-size: 0.82rem; font-weight: 700; }
.request-note { margin-top: 8px; color: var(--muted); font-size: 0.82rem; }
.manager-reason { margin-top: 14px; }
.withdrawal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.withdrawal-actions > * { flex: 1; }
.payout-box { display: grid; gap: 11px; margin-top: 14px; padding: 13px; border: 1px solid #bfdbfe; border-radius: 12px; background: #eff6ff; }
.ledger-table { display: grid; gap: 9px; }
.location-card,
.job-admin-card { display: grid; gap: 10px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.location-card p,
.job-admin-card p { color: var(--muted); font-size: 0.82rem; overflow-wrap: anywhere; }
.job-admin-card button { margin-top: 5px; }

.toast {
  position: fixed;
  right: 50%;
  bottom: 24px;
  z-index: 20;
  width: max-content;
  max-width: min(520px, calc(100vw - 28px));
  padding: 11px 15px;
  border-radius: 11px;
  background: var(--ink);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 15px);
  transition: opacity 0.2s, transform 0.2s;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}
.app-shell + .toast { bottom: 92px; }
.toast.show { opacity: 1; transform: translate(50%, 0); }

@media (max-width: 760px) {
  .portal-shell { padding-top: 24px; }
  .portal-grid,
  .admin-list { grid-template-columns: 1fr; }
  .wide-card { grid-column: auto; }
}

@media (max-width: 520px) {
  .admin-overview { grid-template-columns: 1fr; }
  .admin-overview article { display: flex; align-items: center; justify-content: space-between; text-align: start; }
  .admin-overview strong { font-size: 1.12rem; }
  .portal-header { display: block; }
  .admin-badge { display: inline-flex; margin-top: 12px; }
  .admin-section { padding: 15px; }
  .summary-grid article { padding-inline: 5px; }
  .summary-grid strong { font-size: 1.2rem; }
  .timeline-item,
  .ledger-row { align-items: flex-start; }
  .technician-toolbar { align-items: stretch; flex-direction: column; }
  .technician-toolbar select { min-width: 0; width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .full-field { grid-column: auto; }
  .admin-actions { align-items: flex-start; flex-direction: column; margin-top: 12px; }
}

@media (max-width: 380px) {
  .nav-item { font-size: 0.66rem; }
  .app-shell { padding-inline: 12px; }
  .summary-grid { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
