:root {
  color-scheme: light;
  --ios-blue: #007aff;
  --ios-green: #34c759;
  --ios-red: #ff3b30;
  --label: #000;
  --secondary: #6c6c70;
  --tertiary: #8e8e93;
  --system-bg: #f2f2f7;
  --surface: #fff;
  --field: #f2f2f7;
  --separator: rgba(60, 60, 67, .18);
  --brand: #005f4b;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body, button, a, input, select, textarea, label { touch-action: manipulation; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--label);
  background: var(--system-bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(100%, 580px);
  min-height: 100dvh;
  margin-inline: auto;
  background: var(--surface);
  box-shadow: 0 0 40px rgba(0, 0, 0, .06);
}

.nav-bar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: calc(45px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  border-bottom: 0;
  background: rgba(255,255,255,.96);
}

.nav-leading { display: flex; min-width: 0; align-items: center; gap: 4px; }
.nav-bar h1 { position: absolute; left: 50%; min-width: 0; margin: 0; transform: translateX(-50%); font-size: 17px; font-weight: 600; text-align: center; white-space: nowrap; }
.nav-icon { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border: 0; border-radius: 50%; color: #0b336f; background: #fff; box-shadow: 0 9px 26px rgba(0,0,0,.08); font-size: 17px; line-height: 1; }
.nav-icon img { display: block; width: 20px; height: 20px; object-fit: contain; }
.nav-icon:active { background: rgba(0,122,255,.12); }
.nav-action-slot { display: flex; min-width: 0; flex: 0 0 auto; justify-content: flex-end; }
.nav-action { min-height: 32px; padding: 5px 10px; border: 0; border-radius: 8px; color: #fff; background: var(--ios-green); font-size: 13px; font-weight: 600; line-height: 1.1; white-space: nowrap; }

@media (max-width: 380px) {
  .nav-bar { gap: 5px; padding-right: 8px; padding-left: 8px; }
  .nav-bar h1 { font-size: 15px; }
  .nav-icon { font-size: 17px; }
  .nav-action { padding: 5px 7px; font-size: 11px; }
}

.welcome-screen { padding: 20px 16px calc(36px + env(safe-area-inset-bottom)); }
.brand-logo { display: block; width: auto; max-width: 82%; height: 145px; margin: 0 auto 20px; object-fit: contain; }

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  margin: 0 16px 22px;
  padding: 2px;
  border-radius: 9px;
  background: #e9e9eb;
}

.segment { min-height: 32px; border: 0; border-radius: 7px; color: var(--ios-blue); background: transparent; font-size: 13px; font-weight: 500; }
.segment.is-active { color: #fff; background: var(--ios-blue); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.auth-form { display: grid; gap: 18px; }

.input-box {
  display: flex;
  align-items: center;
  min-height: 50px;
  padding: 0 12px;
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: 12px;
  background: var(--field);
}

.input-box:focus-within { border-color: rgba(0, 122, 255, .38); box-shadow: 0 0 0 1px rgba(0, 122, 255, .12); }
.input-box input, .input-box select { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--label); background: transparent; font-size: 17px; }
.input-box input::placeholder { color: var(--tertiary); opacity: 1; }
.input-box select { appearance: none; color: var(--tertiary); }
.input-box select.has-value { color: var(--label); }
.select-box::after { content: "⌄"; color: var(--ios-blue); font-size: 18px; font-weight: 600; }
.clear-input, .show-password { flex: 0 0 auto; padding: 2px 4px; border: 0; color: var(--tertiary); background: transparent; font-size: 20px; }

.secondary-button, .primary-button, .continue-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 10px;
  font-weight: 600;
}

.secondary-button { justify-self: center; padding: 8px 14px; border: 1px solid var(--separator); color: var(--ios-blue); background: var(--surface); }
.secondary-button:disabled { color: var(--tertiary); opacity: .55; cursor: default; }
.primary-button { width: 100%; padding: 10px 18px; border: 0; color: #fff; background: var(--ios-blue); }

.toast {
  position: fixed;
  z-index: 50;
  top: calc(8px + env(safe-area-inset-top));
  left: 50%;
  width: min(calc(100% - 32px), 360px);
  padding: 11px 16px;
  transform: translateX(-50%);
  border: 1px solid rgba(60, 60, 67, .25);
  border-radius: 14px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

dialog { padding: 0; border: 0; background: var(--surface); }
dialog::backdrop { background: rgba(0, 0, 0, .34); backdrop-filter: blur(2px); }
.dialog-fallback { position: fixed; z-index: 100; inset: 0; display: flex; max-width: none; max-height: none; margin: auto; }
.dialog-fallback::before { content: ""; position: fixed; z-index: -1; inset: 0; background: rgba(0, 0, 0, .34); backdrop-filter: blur(2px); }
.sheet { display: flex; flex-direction: column; width: min(100%, 580px); height: min(92dvh, 900px); margin: auto auto 0; overflow: hidden; border-radius: 16px 16px 0 0; }
.sheet:not([open]), .compact-sheet:not([open]), .alert-dialog:not([open]) { display: none; }
.sheet > .sheet-header, .compact-sheet > .sheet-header { flex-shrink: 0; position: sticky; top: 0; z-index: 2; }
.registration-document-sheet[open] { display: grid; grid-template-rows: auto minmax(0,1fr) auto; inset: 0; margin: auto; max-height: calc(100dvh - 24px); animation: none; }
.registration-document-sheet > * { min-width: 0; }
.registration-document-body { min-height: 0; overflow: auto; }
.registration-document-body img { display: block; width: 100%; height: auto; }
.registration-document-body iframe { display: block; width: 100%; height: 100%; border: 0; }
.document-viewer-footer { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: #fff; }
.client-profile-toolbar, .client-history-toolbar, .client-chat-toolbar { flex-shrink: 0; }
.video-recorder-dialog { width: min(100%, 560px); height: 100dvh; max-height: none; margin: 0 auto; padding: 0; border: 0; color: #fff; background: #000; }
.video-recorder-dialog::backdrop { background: #000; }
.video-recorder-shell { display: flex; height: 100%; min-height: 0; flex-direction: column; gap: 14px; padding: 18px 20px calc(22px + env(safe-area-inset-bottom)); }
.video-recorder-frame { position: relative; min-height: 0; flex: 1 1 auto; overflow: hidden; border: 2px solid rgba(255,255,255,.5); border-radius: 28px; background: #111; }
.video-recorder-frame.is-recording { border-color: var(--ios-red); }
.video-recorder-frame > video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.video-recorder-overlay { position: absolute; right: 16px; bottom: 16px; left: 16px; display: grid; gap: 8px; padding: 15px; border-radius: 18px; color: #fff; background: rgba(0,0,0,.64); pointer-events: none; }
.video-recorder-overlay strong { font-size: 18px; }
.video-recorder-overlay span { color: rgba(255,255,255,.85); font-size: 13px; }
.video-recorder-overlay hr { width: 100%; margin: 0; border: 0; border-top: 1px solid rgba(255,255,255,.2); }
.video-recorder-overlay p { margin: 0; font-size: 15px; line-height: 1.4; }
.video-recorder-dialog progress { width: 100%; height: 6px; accent-color: var(--ios-green); }
.video-recorder-timer { display: flex; justify-content: space-between; color: rgba(255,255,255,.88); font-size: 14px; }
.video-recorder-controls { display: flex; align-items: center; justify-content: space-between; padding: 0 28px; }
.video-recorder-controls button { display: grid; width: 60px; height: 60px; place-items: center; border: 0; border-radius: 50%; color: #fff; background: rgba(255,255,255,.16); box-shadow: 0 3px 15px rgba(0,0,0,.3); font-size: 28px; }
.video-recorder-controls #video-recorder-main { width: 80px; height: 80px; color: #fff; background: rgba(255,255,255,.2); font-size: 38px; }
.video-recorder-glyph { position: relative; display: block; width: 30px; height: 22px; border: 3px solid currentColor; border-radius: 6px; }
.video-recorder-glyph::before { content: ""; position: absolute; top: 3px; left: 5px; width: 9px; height: 9px; border: 2px solid currentColor; border-radius: 50%; }
.video-recorder-glyph::after { content: ""; position: absolute; top: 4px; right: -9px; width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 7px solid currentColor; }
.video-recorder-controls #video-recorder-main.is-recording { color: var(--ios-red); }
.video-recorder-controls #video-recorder-main.is-recording .video-recorder-glyph { width: 26px; height: 26px; border-radius: 5px; }
.video-recorder-controls #video-recorder-main.is-recording .video-recorder-glyph::before, .video-recorder-controls #video-recorder-main.is-recording .video-recorder-glyph::after { display: none; }
.video-recorder-controls #video-recorder-main.has-recording .video-recorder-glyph { width: auto; height: auto; border: 0; border-radius: 0; }
.video-recorder-controls #video-recorder-main.has-recording .video-recorder-glyph::before { content: "↻"; position: static; display: block; width: auto; height: auto; border: 0; border-radius: 0; font-size: 38px; line-height: 1; }
.video-recorder-controls #video-recorder-main.has-recording .video-recorder-glyph::after { display: none; }
.video-recorder-controls #video-recorder-accept { color: var(--ios-green); }
.video-recorder-controls button:disabled { color: rgba(255,255,255,.4); opacity: .7; }
.compact-sheet { width: min(calc(100% - 24px), 540px); margin: auto auto 0; border-radius: 18px 18px 0 0; }
.sheet[open], .compact-sheet[open] { animation: sheet-in .25s ease-out; }

@keyframes sheet-in { from { opacity: 0; transform: translateY(24px); } }

.sheet-header {
  display: grid;
  grid-template-columns: 70px 1fr 70px;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  border-bottom: 0;
  background: #fff;
}

.sheet-header h2 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; white-space: nowrap; }
.sheet-close, .sheet-save { justify-self: start; border: 0; color: var(--ios-blue); background: transparent; font-size: 24px; }
.sheet-close { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; color: #0b336f; background: #fff; box-shadow: 0 9px 26px rgba(0,0,0,.08); font-size: 17px; line-height: 1; }
.sheet-close img { display: block; width: 16px; height: 16px; object-fit: contain; }
.sheet-close:active { background: rgba(0,122,255,.12); }
.sheet-save { justify-self: end; font-size: 16px; font-weight: 600; }
.sheet-save:disabled { color: var(--tertiary); }
.sheet-body { min-height: 0; flex: 1 1 auto; padding: 22px 18px calc(28px + env(safe-area-inset-bottom)); overflow: auto; }

.info-content > img { display: block; width: 210px; max-height: 120px; margin: 0 auto 20px; object-fit: contain; }
.info-content > p { color: var(--secondary); font-size: 15px; line-height: 1.55; }
.info-card { display: flex; align-items: center; gap: 14px; margin: 12px 0; padding: 14px; border-radius: 16px; background: var(--system-bg); }
.info-card-icon { display: grid; width: 52px; height: 52px; flex: 0 0 52px; place-items: center; border-radius: 14px; color: var(--brand); background: rgba(0, 95, 75, .1); font-size: 24px; font-weight: 700; }
.info-card strong, .info-card small { display: block; }
.info-card small { margin-top: 4px; color: var(--secondary); line-height: 1.35; }
.support-card { margin-top: 22px; padding: 18px; border-radius: 18px; background: var(--system-bg); }
.support-card p { color: var(--secondary); font-size: 14px; line-height: 1.45; }
.support-card a { display: inline-flex; min-height: 42px; align-items: center; gap: 8px; padding: 0 16px; border: 1px solid #25d366; border-radius: 10px; color: #147c36; text-decoration: none; font-weight: 600; }
.support-card a img { width: 18px; height: 18px; object-fit: contain; }
.legal-note { padding-top: 12px; font-size: 12px !important; text-align: center; }

.registration-screen { min-height: 100dvh; padding-bottom: calc(132px + env(safe-area-inset-bottom)); }
.registration-heading { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; padding: 14px 12px 10px; border-bottom: 0; background: #fff; }
.registration-heading h2 { margin: 0; font-size: 20px; font-weight: 700; text-align: center; }
.registration-heading p { margin: 4px 0 0; color: var(--secondary); font-size: 13px; text-align: center; }
.back-button { display: grid; width: 42px; height: 42px; place-items: center; border: 0; border-radius: 50%; color: #0b336f; background: #fff; box-shadow: 0 9px 26px rgba(0,0,0,.08); font-size: 28px; line-height: 1; }
.back-button img { display: block; width: 12px; height: 18px; object-fit: contain; }
.back-button:active { background: rgba(0,122,255,.12); }
.stepper { position: fixed; z-index: 30; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: flex-end; justify-content: space-around; width: min(calc(100% - 24px), 560px); gap: 4px; padding: 10px 8px 9px; transform: translateX(-50%); border: 1px solid rgba(60, 60, 67, .16); border-radius: 20px; background: rgba(249, 249, 249, .92); box-shadow: 0 8px 30px rgba(0, 0, 0, .16); backdrop-filter: saturate(180%) blur(18px); }
.step { display: grid; flex: 1 1 0; justify-items: center; gap: 4px; min-width: 0; padding: 0 2px; border: 0; color: var(--tertiary); background: transparent; font-size: 10px; line-height: 1.2; text-align: center; transition: transform .2s ease, color .2s ease; }
.step-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: #fff; background: #c7c7cc; box-shadow: 0 2px 5px rgba(0, 0, 0, .12); transition: transform .2s ease, color .2s ease, background .2s ease, box-shadow .2s ease; }
.step-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.step.is-enabled { color: var(--ios-blue); }
.step.is-enabled .step-icon { color: #fff; background: var(--ios-blue); }
.step.is-enabled:not(.is-complete) .step-icon { animation: step-attention 1.4s cubic-bezier(.22, .61, .36, 1) infinite; }
.step.is-current:not(.is-complete) .step-icon { animation-duration: 1.1s; }
.step.is-current:not(.is-complete) { transform: translateY(-2px); }
.step.is-complete { color: var(--ios-green); }
.step.is-complete .step-icon { color: #fff; background: var(--ios-green); animation: none; }

@keyframes step-attention {
  0%, 58%, 100% { transform: translateY(0) scale(1); box-shadow: 0 2px 5px rgba(0, 0, 0, .12), 0 0 0 0 rgba(0, 122, 255, 0); }
  66% { transform: translateY(-4px) scale(1.06); box-shadow: 0 5px 12px rgba(0, 122, 255, .22), 0 0 0 5px rgba(0, 122, 255, .12); }
  74% { transform: translateY(0) scale(1); box-shadow: 0 2px 5px rgba(0, 0, 0, .12), 0 0 0 9px rgba(0, 122, 255, 0); }
}
.registration-form { padding: 12px 16px 0; }
.registration-step { display: grid; gap: 14px; padding: 0; border: 0; }
.registration-step legend { width: 100%; margin: 0 0 2px; padding: 0; font-size: 21px; font-weight: 700; }
.registration-step .input-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; min-height: 48px; padding: 10px 12px; }
.registration-step .field-label { grid-column: 1 / -1; color: var(--secondary); font-size: 13px; font-weight: 600; line-height: 1.3; }
.registration-step .input-box input, .registration-step .input-box select { grid-column: 1; grid-row: 2; min-height: 28px; }
.registration-step .select-box::after { grid-column: 2; grid-row: 2; }
.registration-step .input-box input, .registration-step .input-box select { font-size: 16px; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.section-caption { margin-top: 5px; font-size: 16px; font-weight: 700; }
.form-hint { margin: -5px 0 2px; color: var(--secondary); font-size: 13px; line-height: 1.45; }
.postal-status.is-success { color: #147c36; }
.sample-autofill-button { width: 100%; }
.form-hint.center { margin-top: 0; text-align: center; }
.document-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.document-card { position: relative; display: grid; gap: 8px; min-height: 112px; padding: 14px; border: 1px dashed rgba(0, 122, 255, .55); border-radius: 15px; color: var(--ios-blue); background: rgba(0, 122, 255, .05); font-size: 14px; font-weight: 600; }
.document-title { padding-right: 28px; }
.document-ready { position: absolute; top: 11px; right: 13px; color: var(--ios-green); font-size: 23px; font-weight: 800; line-height: 1; }
.document-card small { color: var(--secondary); font-size: 12px; font-weight: 400; line-height: 1.35; }
.document-card .video-ine-help { color: var(--secondary); font-size: 12px; font-weight: 500; }
.document-card input { width: 100%; max-width: 100%; color: var(--secondary); font-size: 12px; }
.document-card #ine-front, .document-card #ine-back { display: none; }
.document-card #bank-statement { display: none; }
.document-card #identification-video { display: none; }
.document-preview { display: block; width: 100%; height: 128px; border-radius: 10px; object-fit: cover; background: var(--system-bg); }
.video-preview { height: 170px; }
.document-file-preview { display: grid; place-items: center; color: var(--ios-blue); font-size: 14px; font-weight: 700; }
.document-camera { justify-self: start; min-height: 40px; padding: 8px 13px; border: 0; border-radius: 10px; color: #fff; background: var(--ios-blue); font-size: 13px; font-weight: 600; }
.document-camera:disabled { opacity: .45; cursor: default; }
.document-card-wide { min-height: 90px; }
.bank-statement-actions { display: flex; align-items: center; justify-content: flex-start; gap: 8px; }
.bank-statement-actions #bank-take-photo, .bank-statement-actions #bank-search-photo { display: none; }
.bank-statement-actions button { width: auto; min-height: 42px; padding: 8px 12px; border: 0; border-radius: 10px; color: #fff; background: var(--ios-blue); font-size: 13px; font-weight: 600; }
.ocr-status { margin-top: -5px; padding: 9px 11px; border-radius: 10px; color: var(--secondary); background: var(--system-bg); font-size: 13px; line-height: 1.35; }
.ocr-status.is-success { color: #147c36; background: rgba(52, 199, 89, .1); }
.ocr-status.is-error { color: #b42318; background: rgba(255, 59, 48, .1); }
.ocr-status.is-loading { color: var(--secondary); }
.promissory-card { display: grid; gap: 9px; padding: 15px; border-radius: 16px; background: var(--system-bg); }
.promissory-card p { margin: 0; color: var(--secondary); font-size: 13px; }
.agreement-note { margin: -2px 0 0; color: var(--secondary); font-size: 13px; }
.pagare-preview-card { display: grid; gap: 12px; padding: 16px; border: 1px solid rgba(0, 0, 0, .12); border-radius: 18px; background: #fff; }
.pagare-heading { display: flex; align-items: flex-start; justify-content: space-between; font-size: 20px; }
.pagare-heading span { font-size: 15px; }
.pagare-multiline { display: grid; gap: 6px; }
.pagare-multiline p, .pagare-copy { margin: 0; color: var(--label); font-size: 12px; line-height: 1.45; }
.pagare-multiline strong { padding: 8px 10px; border-radius: 8px; background: var(--system-bg); font-size: 12px; }
.pagare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pagare-row, .pagare-grid > div { display: grid; gap: 4px; }
.pagare-row small, .pagare-grid small { color: var(--secondary); font-size: 10px; font-weight: 700; }
.pagare-row strong, .pagare-grid strong { min-height: 34px; padding: 8px 10px; border-radius: 8px; background: var(--system-bg); font-size: 13px; font-weight: 600; }
.pagare-preview-card hr { width: 100%; margin: 2px 0; border: 0; border-top: 1px solid var(--separator); }
#signature-canvas { width: 100%; height: 190px; border: 1px solid var(--separator); border-radius: 12px; background: #fff; touch-action: none; }
.signature-actions { display: flex; justify-content: space-between; gap: 10px; }
.signature-actions .secondary-button, .signature-actions .signature-done { width: auto; min-width: 100px; }
.signature-done { min-height: 40px; padding: 8px 14px; }
.signature-done:disabled { color: #fff; background: var(--tertiary); opacity: .55; cursor: default; }
.signature-status, .file-status { font-size: 12px !important; }
.signature-status.is-ready, .file-status.is-ready { color: #147c36 !important; font-weight: 600; }
.password-state { margin: -5px 0 0; color: var(--ios-green); font-size: 13px; font-weight: 600; }
.wizard-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 10px; margin-top: 22px; }
.wizard-actions:has(#previous-step[hidden]) { grid-template-columns: 1fr; }
.wizard-actions .primary-button { min-height: 48px; }
.wizard-actions .secondary-button { min-height: 48px; }
.registration-step[data-step-panel="3"] ~ .wizard-actions { display: none; }
.validation-message { margin: 14px 16px 0; padding: 11px 12px; border-radius: 10px; color: #b42318; background: rgba(255, 59, 48, .1); font-size: 13px; line-height: 1.4; }

.client-screen { position: relative; min-height: 100dvh; padding-bottom: calc(92px + env(safe-area-inset-bottom)); background: var(--surface); }
.client-toolbar { position: sticky; z-index: 20; top: 0; display: grid; grid-template-columns: 52px 1fr 130px; align-items: center; gap: 8px; min-height: 92px; padding: calc(24px + env(safe-area-inset-top)) 18px 15px; background: rgba(255,255,255,.96); }
.client-toolbar-center { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.2; text-align: center; }
.client-toolbar-actions { display: flex; width: 108px; height: 44px; align-items: center; justify-content: flex-end; justify-self: end; gap: 4px; padding: 1px 10px; border-radius: 999px; background: #fff; box-shadow: 0 9px 26px rgba(0,0,0,.08); }
.client-toolbar-button { position: relative; display: grid; width: 42px; height: 42px; place-items: center; border: 0; border-radius: 50%; color: #0b336f; background: #fff; font-size: 21px; }
.client-toolbar > .client-toolbar-button { box-shadow: 0 9px 26px rgba(0,0,0,.08); }
.client-toolbar-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.client-toolbar-button img { display: block; width: 25px; height: 20px; object-fit: contain; }
.client-notification-button .client-notification-icon { width: 22px; height: 22px; }
.client-notification-button .client-notification-icon.is-active { display: none; }
.client-notification-button.is-enabled .client-notification-icon.is-active { display: block; }
.client-notification-button.is-enabled .client-notification-icon.is-inactive { display: none; }
.client-toolbar-button:first-child svg circle { fill: currentColor; stroke: currentColor; }
.client-ellipsis { font-size: 17px; letter-spacing: 1.5px; transform: translateY(-2px); }
.client-toolbar-button:active { background: rgba(0,122,255,.12); }
.client-notification-button.is-enabled { color: var(--ios-green); }
.client-notification-button.is-unavailable { color: var(--secondary); opacity: .65; }
.client-menu { position: absolute; z-index: 25; top: 62px; right: 12px; display: grid; min-width: 218px; padding: 7px; border: 1px solid rgba(60,60,67,.16); border-radius: 14px; background: rgba(255,255,255,.96); box-shadow: 0 12px 30px rgba(0,0,0,.18); }
.client-menu-heading { padding: 7px 12px 3px; color: var(--secondary); font-size: 11px; font-weight: 600; }
.client-menu button, .client-menu a { display: flex; min-height: 40px; align-items: center; gap: 8px; padding: 0 12px; border: 0; border-radius: 9px; color: var(--label); background: transparent; font-size: 14px; text-align: left; text-decoration: none; }
.client-menu button img { width: 18px; height: 18px; flex: 0 0 18px; object-fit: contain; }
.client-menu a img { width: 14px; height: 14px; object-fit: contain; filter: grayscale(1) brightness(0); }
.client-menu button:hover, .client-menu button:focus-visible, .client-menu a:hover, .client-menu a:focus-visible { background: var(--system-bg); outline: 0; }
.client-content { display: grid; max-width: 580px; margin: 0 auto; padding: 18px 16px 12px; }
.client-view { display: grid; gap: 14px; animation: client-view-in .24s ease-out; }
@keyframes client-view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.client-greeting h2, .client-section-heading h2 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.client-profile-header { display: grid; gap: 16px; padding: 16px; border: 1px solid rgba(0,0,0,.05); border-radius: 22px; background: linear-gradient(135deg, #f1f1f6, #fff); }
.client-profile-main { display: flex; align-items: center; gap: 14px; }
.client-profile-main > div:last-child { min-width: 0; }
.client-profile-header h2 { margin: 0; overflow-wrap: anywhere; font-size: 18px; letter-spacing: normal; }
.client-profile-header p { margin: 4px 0 0; color: var(--secondary); font-size: 14px; }
.client-contact-lines { display: grid; gap: 12px; padding: 0 4px; color: var(--secondary); font-size: 15px; }
.client-contact-lines span { display: flex; align-items: center; gap: 10px; }
.client-contact-lines svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.client-contact-lines img { width: 18px; height: 18px; flex: 0 0 18px; object-fit: contain; }
.client-contact-lines strong { min-width: 0; color: var(--label); font-weight: 500; overflow-wrap: anywhere; }
.eyebrow { margin: 0 0 4px; color: var(--ios-blue); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.client-summary-card, .client-profile-card, .client-support-intro { border: 1px solid rgba(60,60,67,.1); border-radius: 18px; background: var(--surface); box-shadow: 0 5px 18px rgba(0,0,0,.05); }
.client-summary-card span { display: block; color: var(--secondary); font-size: 12px; }
.client-status-card { --status-tint: var(--ios-blue); display: grid; gap: 8px; padding: 16px; border: 0; border-radius: 18px; background: rgba(0,122,255,.08); box-shadow: none; }
.client-status-title { display: flex; align-items: flex-start; gap: 10px; }
.client-status-title strong { color: var(--status-tint); font-size: 17px; font-weight: 700; line-height: 1.3; }
.client-status-card > p { margin: 0; color: var(--secondary); font-size: 13px; line-height: 1.35; }
.client-status-icon { display: grid; width: 24px; height: 24px; flex: 0 0 24px; place-items: center; clip-path: polygon(50% 0,61% 8%,74% 5%,81% 17%,94% 21%,95% 35%,100% 50%,92% 61%,95% 74%,83% 81%,79% 94%,65% 95%,50% 100%,39% 92%,26% 95%,19% 83%,6% 79%,5% 65%,0 50%,8% 39%,5% 26%,17% 19%,21% 6%,35% 5%); color: #fff; background: var(--ios-green); font-size: 15px; font-weight: 900; line-height: 1; }
.client-status-card.is-accepted, .client-status-card.is-success { --status-tint: var(--ios-green); background: rgba(52,199,89,.08); }
.client-status-card.is-warning { --status-tint: #ffcc00; background: rgba(255,204,0,.08); }
.client-status-card.is-document { --status-tint: #d96d00; background: rgba(255,149,0,.08); }
.client-status-card.is-error { --status-tint: var(--ios-red); background: rgba(255,59,48,.08); }
.client-status-card .client-approved-row { color: var(--label); font-size: 15px; font-weight: 600; line-height: 1.35; }
.client-approved-row b { font-weight: 700; }
.client-payment-section { display: grid; gap: 26px; padding: 16px; border-radius: 18px; background: #f2f2f7; }
.client-progress-card { display: grid; width: 100%; justify-items: center; padding: 18px 0 8px; background: transparent; }
.client-progress-ring { position: relative; display: grid; width: 232px; height: 232px; place-items: center; border-radius: 50%; background: var(--ring-gradient, conic-gradient(#007aff 0deg 360deg)); }
.client-progress-ring::before { content: ""; position: absolute; z-index: 1; width: 64%; height: 64%; border-radius: 50%; background: #f2f2f7; }
.client-progress-ring::after { content: ""; position: absolute; z-index: 0; inset: 0; border-radius: 50%; background: var(--next-segment-overlay, transparent); opacity: 1; transform: scale(1); -webkit-mask: radial-gradient(circle, transparent 0 63%, #000 64%); mask: radial-gradient(circle, transparent 0 63%, #000 64%); pointer-events: none; }
.client-progress-ring > div { position: relative; z-index: 2; display: grid; gap: 4px; place-items: center; text-align: center; }
.client-progress-ring strong { display: grid; width: 58px; height: 58px; place-items: center; border: 1px solid rgba(52,199,89,.28); border-radius: 50%; color: var(--ios-green); background: rgba(52,199,89,.12); font-size: 28px; line-height: 1; }
.client-progress-ring span { color: var(--secondary); font-size: 11px; font-weight: 600; line-height: 1.2; }
.client-progress-ring.is-next-attention::after { animation: next-segment-pulse 1.1s ease-in-out infinite alternate; }
@keyframes next-segment-pulse { from { opacity: 1; transform: scale(1); } to { opacity: .72; transform: scale(1.14); } }
.client-payment-rows { display: grid; gap: 12px; }
.client-next-payment-card { display: grid; gap: 14px; padding: 14px; border: 1.2px solid rgba(255,149,0,.55); border-radius: 16px; background: rgba(255,149,0,.08); box-shadow: 0 5px 12px rgba(0,0,0,.06); }
.client-next-payment-top { display: flex; align-items: flex-start; gap: 12px; }
.client-calendar-icon { position: relative; display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border-radius: 12px; color: #ff9500; background: rgba(255,149,0,.12); }
.client-calendar-icon::before { content: ""; width: 18px; height: 17px; border: 2px solid currentColor; border-radius: 4px; background: linear-gradient(currentColor,currentColor) 0 4px/100% 2px no-repeat, radial-gradient(circle,currentColor 1.2px,transparent 1.4px) 1px 8px/6px 6px repeat; }
.client-calendar-icon::after { content: ""; position: absolute; top: 11px; width: 11px; height: 4px; border-right: 2px solid currentColor; border-left: 2px solid currentColor; }
.client-next-payment-top strong, .client-next-payment-top b { display: block; }
.client-next-payment-top strong { color: #ff9500; font-size: 14px; }
.client-next-payment-top b { margin-top: 7px; font-size: 19px; }
.client-next-payment-bottom { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.client-next-payment-bottom > span { color: var(--secondary); font-size: 12px; }
.client-next-payment-bottom > strong { font-size: 18px; }
.client-pay-button { min-height: 34px; padding: 7px 13px; border: 0; border-radius: 999px; color: #fff; background: #ff9500; font-size: 14px; font-weight: 600; }
.client-next-payment-card.is-unavailable { border: 0; background: #fff; }
.client-next-payment-card.is-unavailable .client-calendar-icon { color: var(--ios-green); background: rgba(52,199,89,.12); }
.client-next-payment-card.is-unavailable .client-next-payment-top strong { color: var(--secondary); }
.client-remaining-card { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border: 1.2px solid rgba(0,122,255,.55); border-radius: 16px; background: rgba(0,122,255,.08); box-shadow: 0 5px 16px rgba(0,0,0,.05); }
.client-remaining-icon { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border-radius: 10px; color: var(--ios-blue); background: rgba(0,122,255,.12); }
.client-remaining-icon::before { content: ""; width: 17px; height: 17px; border: 2px solid currentColor; border-radius: 50%; background: conic-gradient(currentColor 0 72%, transparent 72% 100%); }
.client-remaining-card strong { color: var(--ios-blue); font-size: 14px; }
.client-remaining-card p { margin: 4px 0 0; color: var(--secondary); font-size: 13px; line-height: 1.35; }
.client-remaining-card.is-overdue p { color: var(--ios-red); animation: overdue-message-pulse .9s ease-in-out infinite alternate; }
@keyframes overdue-message-pulse { from { opacity: 1; } to { opacity: .55; } }
.client-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.client-summary-card { padding: 15px; }
.client-summary-card strong { display: block; margin-top: 6px; font-size: 21px; }
.client-summary-card small { display: block; margin-top: 5px; color: var(--secondary); font-size: 11px; }
.client-primary-action, .client-secondary-action { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px; padding: 0 16px; border-radius: 13px; font-size: 15px; font-weight: 700; }
.client-primary-action { border: 0; color: #fff; background: var(--ios-blue); box-shadow: 0 5px 13px rgba(0,122,255,.22); }
.client-secondary-action { border: 1px solid rgba(0,122,255,.22); color: var(--ios-blue); background: var(--surface); }
.client-primary-action span, .client-secondary-action span { font-size: 23px; font-weight: 400; }
.client-last-update { margin: -2px 0 0; color: var(--secondary); font-size: 11px; text-align: center; }
.client-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; }
.client-inline-action { border: 0; color: var(--ios-blue); background: transparent; font-size: 13px; font-weight: 600; }
.client-history-sheet { position: fixed; z-index: 50; top: 0; bottom: 0; left: 50%; display: flex; width: min(100%,580px); transform: translateX(-50%); flex-direction: column; background: var(--surface); animation: history-sheet-in .24s ease-out; }
@keyframes history-sheet-in { from { opacity: 0; transform: translate(-50%,12px); } to { opacity: 1; transform: translate(-50%,0); } }
.client-history-toolbar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; min-height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0; border-bottom: 0; background: #fff; }
.client-history-toolbar h2 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; }
.client-history-toolbar button { display: grid; width: 42px; height: 42px; place-items: center; border: 0; border-radius: 50%; color: #0b336f; background: #fff; box-shadow: 0 9px 26px rgba(0,0,0,.08); font-size: 17px; line-height: 1; }
.client-history-toolbar button img, .client-profile-toolbar button img, .client-chat-toolbar > button img { display: block; width: 16px; height: 16px; object-fit: contain; }
.client-history-toolbar button.is-back { font-size: 28px; font-weight: 300; transform: translateY(-1px); }
.client-history-toolbar button.is-back img, .client-profile-toolbar button.is-back img { width: 12px; height: 18px; }
.client-history-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 16px; background: var(--surface); }
.client-history-section { padding: 16px; border-radius: 18px; background: #f2f2f7; }
.client-credit-history, .client-payments-list, .client-history-detail { display: grid; gap: 12px; }
.client-history-credit { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid rgba(60,60,67,.16); border-radius: 14px; color: var(--label); background: var(--surface); text-align: left; }
.client-history-credit-icon { position: relative; display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; border-radius: 50%; color: var(--history-tint,var(--ios-blue)); background: color-mix(in srgb,var(--history-tint,var(--ios-blue)) 12%,transparent); }
.client-history-credit-icon::before { content: ""; width: 15px; height: 10px; border: 1.8px solid currentColor; border-radius: 2px; box-shadow: inset 0 3px 0 rgba(0,0,0,.08); }
.client-history-credit-icon.is-renewal::before { content: "↻"; width: auto; height: auto; border: 0; border-radius: 0; box-shadow: none; font-size: 18px; font-weight: 700; }
.client-history-credit-copy { min-width: 0; flex: 1; }
.client-history-credit-copy strong, .client-history-credit-copy small { display: block; }
.client-history-credit-copy strong { font-size: 14px; font-weight: 600; }
.client-history-credit-copy small { margin-top: 3px; color: var(--secondary); font-size: 11px; line-height: 1.25; }
.client-history-status { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; color: var(--history-tint,var(--ios-blue)); background: color-mix(in srgb,var(--history-tint,var(--ios-blue)) 12%,transparent); font-size: 10px; font-weight: 700; }
.client-history-credit.is-paid, .client-history-status.is-paid { --history-tint: var(--ios-green); }
.client-history-credit.is-active, .client-history-status.is-active { --history-tint: var(--ios-blue); }
.client-history-credit.is-previous, .client-history-status.is-previous { --history-tint: var(--secondary); }
.client-history-empty { display: grid; justify-items: center; gap: 7px; padding: 26px 14px; color: var(--secondary); text-align: center; }
.client-history-empty > span { color: var(--secondary); font-size: 34px; }
.client-history-empty strong { color: var(--label); font-size: 18px; }
.client-history-empty p { max-width: 280px; margin: 0; font-size: 13px; line-height: 1.4; }
.client-history-summary { display: grid; gap: 9px; padding: 10px 12px; border: 1px solid rgba(52,199,89,.25); border-radius: 14px; background: rgba(52,199,89,.08); }
.client-history-summary.is-overdue { border-color: rgba(255,59,48,.25); background: rgba(255,59,48,.08); }
.client-history-summary.is-late { border-color: rgba(255,149,0,.25); background: rgba(255,149,0,.08); }
.client-history-summary-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.client-history-summary-head strong { color: var(--ios-blue); font-size: 14px; }
.client-history-summary-head span { color: var(--history-tint,var(--ios-blue)); font-size: 12px; font-weight: 600; }
.client-history-dates { display: grid; gap: 2px; color: var(--secondary); font-size: 12px; }
.client-history-detail-row { display: flex; align-items: first baseline; justify-content: space-between; gap: 12px; }
.client-history-detail-row span { color: var(--secondary); font-size: 12px; }
.client-history-detail-row strong { font-size: 14px; font-weight: 500; text-align: right; }
.client-history-payment { display: grid; gap: 12px; padding: 10px 12px; border: 1px solid rgba(0,122,255,.22); border-radius: 14px; background: var(--surface); }
.client-history-payment.is-paid { border-color: rgba(52,199,89,.22); }
.client-history-payment-head { display: flex; align-items: first baseline; justify-content: space-between; gap: 10px; }
.client-history-payment-head strong { color: var(--ios-blue); font-size: 17px; }
.client-history-payment.is-paid .client-history-payment-head strong { color: var(--ios-green); }
.client-history-payment-symbol { display: inline-grid; width: 17px; height: 17px; margin-right: 2px; place-items: center; border-radius: 50%; color: #fff; background: var(--ios-blue); font-size: 11px; line-height: 1; vertical-align: -1px; }
.client-history-payment.is-paid .client-history-payment-symbol { background: var(--ios-green); }
.client-history-payment-head b { color: var(--label); font-size: 17px; }
.client-history-payment-details { display: grid; gap: 7px; }
.client-profile-sheet { position: fixed; z-index: 50; top: 0; bottom: 0; left: 50%; display: flex; width: min(100%,580px); transform: translateX(-50%); flex-direction: column; gap: 0; background: var(--surface); animation: history-sheet-in .24s ease-out; }
.client-profile-toolbar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; min-height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0; border-bottom: 0; background: #fff; }
.client-profile-toolbar h2 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; }
.client-profile-toolbar button { display: grid; width: 42px; height: 42px; place-items: center; border: 0; border-radius: 50%; color: #0b336f; background: #fff; box-shadow: 0 9px 26px rgba(0,0,0,.08); font-size: 17px; line-height: 1; }
.client-profile-toolbar button.is-back { font-size: 28px; font-weight: 300; transform: translateY(-1px); }
.client-profile-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 16px; background: var(--surface); }
.client-profile-section { display: grid; gap: 18px; padding: 16px; border-radius: 18px; background: #f2f2f7; }
.client-profile-info-row { display: grid; gap: 4px; }
.client-profile-info-row small { color: var(--secondary); font-size: 12px; }
.client-profile-info-row strong { font-size: 15px; font-weight: 400; line-height: 1.35; white-space: pre-line; }
.client-documents-scroll { display: grid; align-content: start; gap: 20px; background: #f2f2f7; }
.client-documents-group { overflow: hidden; border-radius: 12px; background: var(--surface); }
.client-documents-group h3 { margin: 0; padding: 9px 16px 7px; color: var(--secondary); background: #f2f2f7; font-size: 12px; font-weight: 400; text-transform: uppercase; }
.client-document-row { display: flex; width: 100%; min-height: 46px; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 16px; border: 0; color: var(--label); background: var(--surface); font-size: 15px; text-align: left; }
.client-document-row + .client-document-row { border-top: 1px solid rgba(60,60,67,.16); }
.client-document-row.is-link { color: var(--ios-blue); }
.client-document-row small { color: var(--secondary); font-size: 14px; }
.client-requested-card { display: grid; gap: 12px; padding: 16px; border-radius: 12px; background: var(--surface); }
.client-requested-card h3 { margin: 0; font-size: 17px; }
.client-requested-card > p { margin: 0; color: var(--secondary); font-size: 13px; line-height: 1.4; }
.client-requested-controls { display: grid; gap: 10px; }
.client-requested-action, .client-requested-picker > summary, .client-requested-submit { display: grid; min-height: 44px; place-items: center; padding: 8px 12px; border: 1px solid rgba(0,122,255,.28); border-radius: 9px; color: var(--ios-blue); background: var(--surface); font-size: 14px; font-weight: 600; text-align: center; }
.client-requested-picker > summary { list-style: none; cursor: pointer; }
.client-requested-picker > summary::-webkit-details-marker { display: none; }
.client-requested-picker[open] > summary { border-radius: 9px 9px 0 0; }
.client-requested-picker-menu { display: grid; border: 1px solid rgba(0,122,255,.28); border-top: 0; border-radius: 0 0 9px 9px; }
.client-requested-picker-menu button { min-height: 40px; border: 0; color: var(--ios-blue); background: var(--surface); }
.client-requested-picker-menu button + button { border-top: 1px solid rgba(60,60,67,.14); }
.client-requested-pending { display: grid; gap: 8px; }
.client-requested-pending > p { margin: 0; color: var(--secondary); font-size: 13px; }
.client-requested-pending-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.client-requested-pending-row button { border: 0; color: var(--ios-red); background: transparent; font-size: 18px; }
.client-requested-submit { width: 100%; border: 0; color: #fff; background: var(--ios-blue); }
.client-requested-submit.is-ready { background: var(--ios-blue); }
.client-requested-submit:disabled { opacity: .5; }
.client-deposit-empty { display: grid; justify-items: center; gap: 7px; padding: 24px 8px; text-align: center; }
.client-deposit-empty span { color: var(--secondary); font-size: 32px; }
.client-deposit-empty strong { font-size: 18px; }
.client-deposit-empty p { margin: 0; color: var(--secondary); font-size: 13px; line-height: 1.4; }
.client-deposit-card { display: grid; gap: 8px; padding: 10px; border: 1px solid rgba(60,60,67,.16); border-radius: 14px; background: var(--surface); }
.client-deposit-title { color: var(--ios-green); font-size: 17px; }
.client-deposit-receipt { width: max-content; padding: 4px 0; border: 0; color: var(--ios-blue); background: transparent; font-size: 14px; font-weight: 600; }
.client-session-actions { gap: 12px; }
.client-session-actions > p { margin: 0; color: var(--secondary); font-size: 13px; line-height: 1.4; }
.client-session-actions > button { display: flex; width: 100%; min-height: 44px; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid rgba(60,60,67,.2); border-radius: 9px; color: var(--ios-blue); background: transparent; font-size: 15px; text-align: left; }
.client-session-actions > button span { width: 20px; text-align: center; }
.client-session-actions > button span img { display: block; width: 20px; height: 20px; object-fit: contain; }
.client-session-actions > #client-profile-logout span img { filter: invert(38%) sepia(98%) saturate(4390%) hue-rotate(201deg) brightness(101%) contrast(105%); }
.client-session-actions > button b { font-weight: 400; }
.client-session-actions > button.is-destructive { color: var(--ios-red); }
.client-session-actions > button:disabled { color: var(--secondary); opacity: .6; }
.client-document-sheet iframe { width: 100%; min-height: 0; flex: 1; border: 0; background: var(--surface); }
.client-empty-state { margin: 0; padding: 24px 14px; border: 1px dashed rgba(60,60,67,.2); border-radius: 14px; color: var(--secondary); font-size: 13px; text-align: center; }
.client-profile-card { display: flex; align-items: center; gap: 12px; padding: 16px; }
.client-profile-header .client-avatar { width: 50px; height: 50px; flex: 0 0 50px; aspect-ratio: 1; border-radius: 50%; background: linear-gradient(135deg, rgba(52,199,89,.9), rgba(0,122,255,.8)); font-size: 17px; }
.client-avatar { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 16px; color: #fff; background: var(--brand); font-size: 23px; font-weight: 700; }
.client-profile-card strong, .client-profile-card small { display: block; }
.client-profile-card strong { font-size: 17px; }
.client-profile-card small { margin-top: 3px; color: var(--secondary); font-size: 12px; }
.client-detail-list { display: grid; gap: 1px; overflow: hidden; border: 1px solid rgba(60,60,67,.1); border-radius: 14px; background: rgba(60,60,67,.1); }
.client-detail-row { display: flex; justify-content: space-between; gap: 14px; padding: 12px 14px; background: var(--surface); font-size: 13px; }
.client-detail-row span { color: var(--secondary); }
.client-detail-row strong { text-align: right; }
.client-chat-sheet { position: fixed; z-index: 50; top: 0; bottom: 0; left: 50%; display: flex; width: min(100%,580px); transform: translateX(-50%); flex-direction: column; gap: 0; background: var(--surface); animation: history-sheet-in .24s ease-out; }
.client-chat-toolbar { position: relative; display: flex; align-items: center; justify-content: space-between; min-height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0; border-bottom: 0; background: #fff; }
.client-chat-toolbar > button { display: grid; width: 42px; height: 42px; place-items: center; border: 0; border-radius: 50%; color: #0b336f; background: #fff; box-shadow: 0 9px 26px rgba(0,0,0,.08); font-size: 17px; line-height: 1; }
.client-chat-identity { position: absolute; left: 50%; display: grid; width: min(48%,260px); transform: translateX(-50%); justify-items: center; line-height: 1.1; }
.client-chat-toolbar h2 { max-width: 100%; margin: 0; overflow: hidden; font-size: 17px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.client-chat-identity span { display: block; max-width: 100%; margin-top: 3px; overflow: hidden; color: var(--secondary); font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.client-chat-toolbar-actions { position: relative; display: flex; min-height: 44px; align-items: center; justify-content: flex-end; padding: 1px; border-radius: 999px; background: #fff; box-shadow: 0 9px 26px rgba(0,0,0,.08); }
.client-chat-toolbar-actions > button { display: grid; min-width: 42px; height: 42px; place-items: center; padding: 0 7px; border: 0; border-radius: 50%; color: #0b336f; background: transparent; font-size: 15px; }
.client-history-toolbar button:active, .client-profile-toolbar button:active, .client-chat-toolbar > button:active, .client-chat-toolbar-actions > button:active { background: rgba(0,122,255,.12); }
.client-chat-select-all span, #client-chat-select-all span { width: 19px; height: 19px; border: 1.7px solid var(--secondary); border-radius: 50%; }
#client-chat-select-all.is-all span { display: grid; place-items: center; border-color: var(--ios-blue); color: #fff; background: var(--ios-blue); }
#client-chat-select-all.is-all span::before { content: "✓"; font-size: 12px; font-weight: 800; }
.client-chat-edit-icon { display: block; width: 20px; height: 20px; background: url("../images/square.and.pencil.png?v=1") center / contain no-repeat; }
.client-chat-trash-icon { display: block; width: 18px; height: 20px; background: url("../images/trash.png?v=1") center / contain no-repeat; }
.client-chat-delete-menu { position: absolute; z-index: 3; top: 44px; right: 40px; display: grid; width: 190px; padding: 6px; border: 1px solid rgba(60,60,67,.16); border-radius: 12px; background: rgba(255,255,255,.98); box-shadow: 0 10px 28px rgba(0,0,0,.18); }
.client-chat-delete-menu button { min-height: 40px; padding: 0 10px; border: 0; border-radius: 7px; color: var(--ios-red); background: transparent; font-size: 14px; text-align: left; }
.client-chat-delete-menu button:disabled { color: var(--secondary); opacity: .5; }
.client-chat { display: grid; min-height: 0; flex: 1; align-content: start; gap: 10px; overflow-y: auto; padding: 16px 16px 24px; }
.client-chat-empty { display: grid; min-height: 100%; align-content: center; justify-items: center; gap: 7px; padding: 24px; text-align: center; }
.client-chat-empty > span { width: 42px; height: 34px; background: url("../images/bubble.left.and.bubble.right.png?v=1") center / contain no-repeat; }
.client-chat-empty strong { font-size: 20px; }
.client-chat-empty p { margin: 0; color: var(--secondary); font-size: 14px; line-height: 1.4; }
.client-chat-row { display: flex; align-items: flex-end; gap: 8px; }
.client-chat-row.is-sent { justify-content: flex-end; padding-left: 48px; }
.client-chat-row:not(.is-sent) { justify-content: flex-start; padding-right: 48px; }
.client-chat-bubble { display: grid; gap: 5px; max-width: 100%; padding: 9px 12px; border-radius: 14px; background: #f2f2f7; }
.client-chat-row.is-sent .client-chat-bubble { color: #fff; background: var(--ios-blue); text-align: right; }
.client-chat-bubble.is-selected { box-shadow: 0 0 0 2px var(--brand); }
.client-chat-bubble p { margin: 0; font-size: 14px; line-height: 1.35; white-space: pre-wrap; }
.client-chat-bubble small { color: var(--secondary); font-size: 10px; }
.client-chat-row.is-sent .client-chat-bubble small { color: rgba(255,255,255,.75); }
.client-chat-selection-indicator { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border: 1.7px solid var(--secondary); border-radius: 50%; color: #fff; }
.client-chat-selection-indicator.is-selected { border-color: var(--brand); background: var(--brand); }
.client-chat-selection-indicator.is-selected::before { content: "✓"; font-size: 15px; font-weight: 800; }
.client-chat-form { display: flex; align-items: flex-end; gap: 10px; margin: 10px 18px calc(12px + env(safe-area-inset-bottom)); padding: 0 18px; border: 1.5px solid var(--brand); border-radius: 28px; background: var(--surface); box-shadow: 0 8px 18px rgba(0,0,0,.08); }
.client-chat-form textarea { width: 100%; min-height: 46px; max-height: 114px; padding: 13px 0; overflow-y: auto; resize: none; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; line-height: 20px; }
.client-chat-form button { display: grid; width: 28px; height: 44px; flex: 0 0 28px; place-items: center; border: 0; color: var(--ios-blue); background: transparent; }
.client-chat-form button:disabled { color: var(--secondary); }
.client-chat-form button span { width: 22px; height: 20px; background: url("../images/message no text in.png?v=1") center / contain no-repeat; }
.client-chat-form button:not(:disabled) span { background-image: url("../images/message send message.png?v=1"); }
.client-chat-form button.is-sending span { width: 17px; height: 17px; border: 2px solid rgba(60,60,67,.25); border-top-color: var(--ios-blue); border-radius: 50%; animation: chat-send-spin .7s linear infinite; }
.client-chat-form button.is-sending span { background: none; }
@keyframes chat-send-spin { to { transform: rotate(360deg); } }
.client-tabbar { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; display: flex; justify-content: center; gap: 2px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(60,60,67,.14); background: rgba(249,249,249,.94); box-shadow: 0 -3px 16px rgba(0,0,0,.07); backdrop-filter: saturate(180%) blur(18px); }
.client-tab { display: grid; width: min(25%, 140px); gap: 2px; place-items: center; min-height: 52px; border: 0; border-radius: 12px; color: var(--secondary); background: transparent; }
.client-tab span { font-size: 21px; line-height: 1; }
.client-tab small { font-size: 10px; }
.client-tab.is-active { color: var(--ios-blue); background: rgba(0,122,255,.1); font-weight: 700; }

.terms-scroll { min-height: 0; flex: 1 1 auto; height: auto; padding: 18px; overflow-x: hidden; overflow-y: auto; }
.terms-section { margin-bottom: 15px; }
.terms-section h3 { margin: 0 0 6px; font-size: 15px; }
.terms-section p { margin: 0; color: var(--secondary); font-size: 13px; line-height: 1.48; }
.terms-accept { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 20px; padding: 12px 0; font-size: 15px; }
.terms-accept.is-disabled { color: var(--tertiary); }
.terms-accept input { position: absolute; top: 50%; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.terms-accept input:focus-visible + .switch { outline: 2px solid var(--ios-blue); outline-offset: 3px; }
.switch { position: relative; width: 51px; height: 31px; flex: 0 0 51px; border-radius: 999px; background: #e5e5ea; transition: .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .2s; }
.terms-accept input:checked + .switch { background: var(--ios-green); }
.terms-accept input:checked + .switch::after { transform: translateX(20px); }
.terms-footer { flex: 0 0 auto; display: grid; justify-items: center; gap: 8px; min-height: 78px; padding: 10px 18px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--separator); background: var(--surface); text-align: center; }
#terms-sheet > .sheet-header { flex-shrink: 0; }
#terms-sheet > * { min-width: 0; }
#terms-sheet[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; position: fixed; inset: 0; max-height: calc(100dvh - 24px); margin: auto; animation: none; }
#terms-sheet::backdrop { backdrop-filter: none; }
#terms-continue { animation: none; }
#terms-continue:disabled { color: var(--secondary); background: var(--field); box-shadow: none; animation: none; cursor: default; }
.terms-footer p { margin: 0; color: var(--secondary); font-size: 13px; }
.continue-button { width: 150px; height: 46px; border: 0; border-radius: 999px; color: #fff; background: var(--ios-green); box-shadow: 0 3px 10px rgba(52, 199, 89, .4); animation: pulse .85s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.05); } }

.otp-content { min-height: 310px; }
.phone-preview { display: block; margin-bottom: 18px; color: var(--secondary); font-size: 28px; }
.otp-content p { color: var(--secondary); font-size: 13px; text-align: center; }
.otp-content h3 { margin: 0 0 12px; font-size: 17px; }
.code-input { width: 100%; min-height: 44px; margin-bottom: 14px; padding: 8px 12px; border: 1px solid var(--separator); border-radius: 8px; font-size: 17px; letter-spacing: .12em; outline: none; }
#otp-verify-state { display: grid; gap: 10px; }

.reset-content { display: grid; gap: 22px; background: var(--system-bg); }
.reset-content > p { margin: 0; color: var(--secondary); font-size: 13px; }
.reset-content label { display: grid; gap: 8px; color: var(--secondary); font-size: 13px; }
.reset-content input { min-height: 46px; padding: 10px 12px; border: 1px solid var(--separator); border-radius: 10px; background: var(--surface); font-size: 17px; outline: 0; }
#new-password-fields { display: grid; gap: 18px; }

.alert-dialog { width: min(calc(100% - 50px), 320px); border-radius: 14px; background: rgba(248, 248, 248, .96); }
.alert-content h2 { margin: 20px 18px 7px; font-size: 17px; text-align: center; }
.alert-content p { margin: 0 18px 20px; color: var(--secondary); font-size: 13px; line-height: 1.4; text-align: center; }
.alert-actions { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--separator); }
.alert-actions button { min-height: 44px; border: 0; color: var(--ios-blue); background: transparent; }
.alert-actions button + button { border-left: 1px solid var(--separator); font-weight: 600; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

@media (min-width: 700px) {
  body { padding: 24px; }
  .app-shell { min-height: calc(100dvh - 48px); border-radius: 22px; overflow: hidden; }
  .sheet, .compact-sheet { margin: auto; border-radius: 18px; }
  .registration-screen { max-width: 580px; margin: auto; }
}

@media (max-width: 699px) {
  .registration-screen { overflow-x: hidden; }
  .registration-form { padding-bottom: calc(42px + env(safe-area-inset-bottom)); }
  .pagare-preview-card { gap: 10px; padding: 14px; }
  .pagare-row strong, .pagare-grid strong, .pagare-multiline strong { overflow-wrap: anywhere; word-break: break-word; }
  .pagare-multiline p, .pagare-copy { font-size: 11.5px; }
  #signature-canvas { height: 220px; }
  .signature-actions { align-items: stretch; }
  .signature-actions .secondary-button, .signature-actions .signature-done { min-width: 0; flex: 1 1 0; }
  .video-recorder-shell { padding-right: 12px; padding-left: 12px; }
  .client-progress-card { padding: 18px 0 8px; }
  .client-progress-ring { width: min(232px, 70vw); height: auto; aspect-ratio: 1; }
  .client-progress-ring strong { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.ocr-status.is-loading::before, button.is-sending::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: middle; animation: chat-send-spin .8s linear infinite; }
.client-requested-submit.is-sending { background: #ffcc00; color: #493800; opacity: 1; }
.documents-success { padding: 16px; border-radius: 12px; background: #e5f7ea; color: #166534; }
@media (prefers-reduced-motion: reduce) { .ocr-status.is-loading::before, button.is-sending::before { animation: none; } }

#client-document-video { width: 100%; flex: 1; min-height: 0; background: #000; }

.card-camera-sheet { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; background: #111; color: white; overflow: hidden; }
.card-camera-sheet[open] { display: flex; flex-direction: column; }
.card-camera-sheet:not([open]) { display: none; }
.card-camera-header { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; flex-shrink: 0; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
.card-camera-header h2 { margin: 0; text-align: center; font-size: 17px; }
.card-camera-header button { display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: white; }
.card-camera-header img { width: 16px; height: 16px; object-fit: contain; }
.card-camera-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; isolation: isolate; }
.card-camera-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-camera-guide { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); border: 2px solid white; border-radius: 12px; box-shadow: 0 0 0 200vmax rgba(0,0,0,.8); pointer-events: none; }
.card-camera-stage > img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card-camera-footer { flex-shrink: 0; display: grid; justify-items: center; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.card-camera-footer p { margin: 0; max-width: 520px; text-align: center; font-size: 14px; }
.card-camera-footer button { min-height: 44px; padding: 10px 22px; border: 0; border-radius: 22px; color: #fff; background: #007aff; font: inherit; }
.card-camera-footer button:disabled { opacity: .45; }
#card-camera-retake { background: #333; }
#card-camera-review { display: flex; gap: 12px; }
@media (orientation: landscape) and (max-height: 500px) { .card-camera-header { padding-top: 4px; padding-bottom: 4px; } .card-camera-footer { grid-template-columns: 1fr auto auto; align-items: center; padding-top: 6px; padding-bottom: 6px; } .card-camera-footer p { text-align: left; font-size: 12px; } }

#ine-front-preview, #ine-back-preview { width: 100%; height: auto; aspect-ratio: 1.586; object-fit: contain; border-radius: 10px; }

.ocr-status.is-manual { background: #fff4dc; color: #7b5100; }

.client-chat-unread { position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: 50%; background: #ff3b30; box-shadow: 0 0 0 2px #fff; }
