:root {
  color-scheme: light;
  --bg: #f3f7fb;
  --surface: #ffffff;
  --surface-soft: #eaf2f8;
  --text: #08243b;
  --muted: #587188;
  --line: rgba(8, 49, 79, .13);
  --blue: #1769e0;
  --navy: #102a56;
  --orange: #ff8a3d;
  --green: #dff5e5;
  --green-text: #17633c;
  --shadow: 0 14px 40px rgba(18, 58, 89, .12);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #061523;
  --surface: #0c2135;
  --surface-soft: #142d45;
  --text: #f4f9fd;
  --muted: #9ab0c1;
  --line: rgba(185, 219, 240, .14);
  --blue: #69b9ff;
  --navy: #184b78;
  --orange: #ffad70;
  --green: #174c38;
  --green-text: #d9ffe7;
  --shadow: 0 18px 45px rgba(0, 4, 10, .35);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); }
body { min-width: 320px; min-height: 100dvh; margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif; letter-spacing: 0; }
button, input, textarea { color: var(--text); font: inherit; letter-spacing: 0; }
button { color: inherit; }
.capture-app { width: 100%; max-width: 560px; min-height: 100dvh; margin: 0 auto; background: var(--bg); }
.profile-screen { min-height: 100dvh; padding: max(24px, env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.profile-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.profile-brand img { width: 126px; height: auto; }
.profile-brand span { padding-left: 10px; border-left: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.profile-copy { margin-top: clamp(70px, 13vh, 130px); }
.eyebrow { margin: 0 0 6px; color: var(--blue); font-size: 11px; font-weight: 800; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
.profile-copy h1 { max-width: 330px; margin-bottom: 12px; font-size: 34px; line-height: 1.14; }
.profile-copy > p:last-child { max-width: 350px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.profile-list { margin-top: 34px; display: grid; gap: 10px; }
.profile-option { min-height: 82px; padding: 14px; display: grid; grid-template-columns: 48px 1fr 24px; align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 5px 18px rgba(18, 58, 89, .06); text-align: left; cursor: pointer; }
.profile-option:active { transform: scale(.99); }
.profile-option .avatar { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; font-size: 18px; font-weight: 850; }
.profile-option .avatar.orange { background: var(--orange); color: #17283b; }
.profile-option strong, .profile-option small { display: block; }
.profile-option strong { font-size: 16px; }
.profile-option small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.profile-option svg { width: 22px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.device-note { margin-top: auto; padding-top: 35px; color: var(--muted); text-align: center; font-size: 11px; line-height: 1.45; }

.capture-screen { min-height: 100dvh; }
.capture-header { height: calc(66px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 18px 0; display: flex; align-items: center; justify-content: space-between; background: color-mix(in srgb, var(--bg) 90%, transparent); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(20px) saturate(160%); }
.profile-chip { min-width: 118px; height: 42px; padding: 0 10px 0 4px; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; cursor: pointer; }
.profile-chip > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 850; }
.profile-chip strong { font-size: 17px; }
.profile-chip svg { width: 16px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.header-actions { display: flex; gap: 5px; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.icon-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.gps-banner { margin: 12px 20px 0; min-height: 76px; padding: 12px; display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 11px; border: 1px solid rgba(255,138,61,.35); border-radius: 8px; background: rgba(255,138,61,.09); }
.gps-banner.active { border-color: rgba(42,177,107,.35); background: var(--green); }
.gps-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,138,61,.15); color: var(--orange); }
.gps-banner.active .gps-icon { background: var(--green-text); color: #fff; }
.gps-icon svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.gps-banner strong, .gps-banner small { display: block; }
.gps-banner strong { font-size: 14px; }
.gps-banner small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.gps-banner.active small { color: var(--green-text); }
.gps-banner button { min-width: 70px; height: 38px; border: 0; border-radius: 7px; background: var(--orange); color: #13283b; font-size: 12px; font-weight: 850; cursor: pointer; }
.gps-banner.active button { background: var(--green-text); color: #fff; }

.progress-band { padding: 22px 20px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.progress-band h1 { margin-bottom: 5px; font-size: 24px; line-height: 1.2; }
.progress-band p:last-child { margin-bottom: 0; color: var(--muted); font-size: 14px; }
.progress-circle { width: 70px; height: 70px; flex: 0 0 auto; display: grid; place-content: center; border-radius: 50%; background: conic-gradient(var(--orange) var(--progress, 0%), var(--surface-soft) 0); position: relative; text-align: center; }
.progress-circle::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.progress-circle strong, .progress-circle span { z-index: 1; }
.progress-circle strong { font-size: 19px; line-height: 1; }
.progress-circle span { margin-top: 3px; color: var(--muted); font-size: 9px; }

.view-tabs { margin: 14px 20px 0; padding: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.view-tab { min-height: 44px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 800; cursor: pointer; }
.view-tab span { margin-left: 4px; padding: 2px 6px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 12%, transparent); font-size: 11px; }
.view-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 3px 12px rgba(18,58,89,.08); }
.view-tab.active span { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); }
.capture-toolbar { padding: 12px 20px 14px; display: flex; gap: 8px; }
.search-field { height: 46px; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.search-field svg { width: 19px; flex: 0 0 auto; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; }
.voice-button { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--blue); cursor: pointer; }
.voice-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.voice-button.listening { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); animation: pulse 1.1s ease-in-out infinite; }
.add-client-button { height: 46px; padding: 0 14px; display: flex; align-items: center; gap: 7px; border: 0; border-radius: 8px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.add-client-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.list-heading { padding: 8px 20px 11px; color: var(--muted); font-size: 13px; font-weight: 750; }

.client-list { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.client-row { min-height: 76px; padding: 11px 18px 11px 20px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 11px; border-bottom: 1px solid var(--line); transition: background .2s; }
.client-row:last-child { border-bottom: 0; }
.client-row.captured { background: var(--green); }
.client-index, .client-thumb { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-soft); color: var(--muted); font-size: 12px; font-weight: 800; overflow: hidden; }
.client-index svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.client-thumb img { width: 100%; height: 100%; object-fit: cover; }
.client-copy { min-width: 0; }
.client-copy strong { display: block; overflow: hidden; color: var(--text); font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.client-copy span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.client-row.captured .client-copy span { color: var(--green-text); }
.client-row.loading-point { background: color-mix(in srgb, var(--orange) 12%, var(--surface)); }
.row-action { min-height: 40px; padding: 0 12px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent); border-radius: 8px; background: color-mix(in srgb, var(--blue) 9%, transparent); color: var(--blue); font-size: 12px; font-weight: 800; cursor: pointer; }
.client-row.captured .row-action { border-color: color-mix(in srgb, var(--green-text) 20%, transparent); background: var(--surface); color: var(--green-text); }
.row-action svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.method-badge { color: var(--green-text); font-weight: 800; }
.subsection-heading { padding: 14px 20px 9px; border-top: 1px solid var(--line); background: var(--bg); color: var(--orange); font-size: 12px; font-weight: 850; text-transform: uppercase; }
.empty-state { padding: 28px 24px 50px; text-align: center; }
.empty-state h2 { margin-bottom: 8px; font-size: 20px; }
.empty-state p { max-width: 330px; margin: 0 auto 22px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.primary-action, .secondary-action { min-height: 46px; padding: 0 16px; border-radius: 8px; font-weight: 800; cursor: pointer; }
.primary-action { border: 0; background: var(--blue); color: #fff; }
.secondary-action { border: 1px solid var(--line); background: var(--surface-soft); color: var(--text); }

.capture-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-content: center; justify-items: center; padding: 30px; background: rgba(4, 18, 31, .84); color: #fff; text-align: center; backdrop-filter: blur(8px); }
.capture-overlay[hidden] { display: none; }
.spinner { width: 46px; height: 46px; margin-bottom: 18px; border: 4px solid rgba(255,255,255,.22); border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; }
.capture-overlay strong { font-size: 17px; }
.capture-overlay span { margin-top: 6px; color: #b9c9d6; font-size: 12px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(3,14,25,.68); backdrop-filter: blur(6px); }
.modal-backdrop[hidden] { display: none; }
.center-modal { position: fixed; left: 50%; top: 50%; z-index: 35; width: min(calc(100% - 32px), 440px); max-height: min(86dvh, 680px); overflow: auto; padding: 24px; transform: translate(-50%, -50%); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 24px 80px rgba(0,0,0,.32); }
.center-modal h2 { margin-bottom: 18px; font-size: 23px; line-height: 1.2; }
.name-field-wrap > label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 800; }
.name-input-row { display: grid; grid-template-columns: 1fr 48px; gap: 8px; }
.name-input-row input { min-width: 0; height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: var(--surface-soft); font-size: 15px; }
.name-input-row input:focus { border-color: var(--blue); }
.voice-button.large { width: 48px; height: 48px; border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent); border-radius: 8px; background: color-mix(in srgb, var(--blue) 9%, transparent); }
.selected-client-name { margin: -4px 0 16px; padding: 12px; border-radius: 8px; background: var(--surface-soft); font-size: 16px; font-weight: 850; }
.capture-methods { margin-top: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.method-option { min-height: 142px; padding: 14px 10px; display: grid; grid-template-columns: 1fr; place-items: center; align-content: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: center; cursor: pointer; }
.method-option:active { transform: scale(.99); }
.method-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue); }
.location-option .method-icon { background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); }
.method-icon svg, .confirm-location-icon svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.method-option strong, .method-option small { display: block; }
.method-option strong { font-size: 16px; }
.method-option small { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.modal-cancel { width: 100%; margin-top: 16px; }
.chosen-method { width: fit-content; margin: -7px 0 18px; padding: 6px 10px; border-radius: 999px; background: color-mix(in srgb, var(--blue) 11%, transparent); color: var(--blue); font-size: 12px; font-weight: 850; }
.keyboard-voice-hint { display: block; margin-top: 9px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.name-actions { margin-top: 22px; }
.confirm-modal { text-align: center; }
.confirm-location-icon { width: 60px; height: 60px; margin: 0 auto 15px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); }
.confirm-modal h2 { margin-bottom: 8px; }
.confirm-modal > p { color: var(--muted); font-size: 14px; line-height: 1.45; }
.location-summary { margin: 18px 0; padding: 13px; border-radius: 8px; background: var(--surface-soft); color: var(--text); font-size: 13px; font-weight: 750; line-height: 1.5; }
.modal-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60; max-width: calc(100% - 38px); padding: 12px 16px; transform: translate(-50%, 18px); visibility: hidden; opacity: 0; border-radius: 8px; background: var(--navy); color: #fff; box-shadow: var(--shadow); font-size: 12px; font-weight: 750; transition: .22s; }
.toast.show { visibility: visible; opacity: 1; transform: translate(-50%, 0); }
[data-theme="dark"] .profile-option,
[data-theme="dark"] .capture-header,
[data-theme="dark"] .progress-band,
[data-theme="dark"] .client-list,
[data-theme="dark"] .client-row,
[data-theme="dark"] .center-modal,
[data-theme="dark"] .view-tab.active { color: var(--text); }
[data-theme="dark"] .icon-button,
[data-theme="dark"] .profile-chip,
[data-theme="dark"] .row-action { color: #dceeff; }
[data-theme="dark"] .primary-action,
[data-theme="dark"] .add-client-button { color: #06213a; }
[data-theme="dark"] .secondary-action { color: var(--text); }
[data-theme="dark"] .client-row.captured { background: #174635; }
[data-theme="dark"] .gps-banner.active { border-color: rgba(109, 239, 160, .65); background: #174c38; }
[data-theme="dark"] .gps-banner.active .gps-icon,
[data-theme="dark"] .gps-banner.active button,
[data-theme="dark"] .client-row.captured .row-action { background: #d9ffe7; color: #062719; }
[data-theme="dark"] .gps-banner.active strong,
[data-theme="dark"] .gps-banner.active small { color: #e3ffed; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.08); } }

@media (min-width: 700px) {
  body { padding: 24px 0; }
  .capture-app { min-height: calc(100dvh - 48px); overflow: hidden; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 28px 80px rgba(7, 33, 53, .2); }
  .profile-screen, .capture-screen { min-height: calc(100dvh - 48px); }
  .capture-header { padding-top: 0; height: 66px; }
}
@media (max-width: 390px) {
  .capture-toolbar { padding-left: 14px; padding-right: 14px; }
  .add-client-button span { display: none; }
  .add-client-button { width: 46px; justify-content: center; padding: 0; }
  .client-row { padding-left: 14px; padding-right: 14px; }
  .progress-band { padding-left: 16px; padding-right: 16px; }
  .gps-banner { margin-left: 14px; margin-right: 14px; }
  .view-tabs { margin-left: 14px; margin-right: 14px; }
  .center-modal { width: calc(100% - 24px); padding: 20px; }
  .row-action { padding: 0 9px; }
  .method-option { min-height: 132px; padding-left: 7px; padding-right: 7px; }
  .method-option strong { font-size: 14px; }
  .method-option small { font-size: 11px; }
}
