/* v0.17: a mobile application layout on the existing, accessible intake flow.
   This file changes presentation only. It never hides required confirmations. */
:root {
  --blue: #216ceb;
  --ink: #17212e;
  --body: #354153;
  --muted: #647184;
  --line: #e9edf3;
  --paper: #f6f8fb;
  --soft: #f4f6f9;
  --app-gutter: 24px;
}

html { scroll-padding-top: 88px; }
body { letter-spacing: -.25px; text-rendering: optimizeLegibility; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button, .kakao-link, input, textarea, select { scroll-margin-block: 96px; }
.primary, .secondary, .choice, .upload-button, .kakao-link {
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.primary { box-shadow: none; font-weight: 750; }
.primary:disabled, .upload-button:disabled { opacity: .5; }
.field { font-size: 16px; }
.field::placeholder { font-size: 16px; color: #8490a0; }
.field:focus-visible { outline: 2px solid #c5dcff; outline-offset: 2px; }
.card h2:focus { outline: none; }
.card h2:focus-visible { outline: none; }
.card, .upload-card, .dialog, .choice, .note, .data-card { min-width: 0; }
.card > *, .choice-label, .dialog-top > h2 { min-width: 0; }

/* New flow components have useful desktop fallbacks as well. */
.application-nav { align-items: center; gap: 10px; }
.app-nav-label { flex: 1; text-align: center; font-size: 13px; color: var(--muted); }
.top-back-button, .app-back-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; padding: 10px;
  color: #475469; background: transparent; border-radius: 12px;
}
.top-back-button svg, .app-back-button svg { width: 22px; height: 22px; }
.mobile-progress-summary { display: none; }
.upload-button svg, .upload-icon { flex: 0 0 auto; width: 22px; height: 22px; }
.gallery-help {
  font-size: 12px; line-height: 1.75; color: var(--muted);
  margin: 10px 0 0; overflow-wrap: break-word; word-break: keep-all;
}
.capture-guide-details { margin: 6px 0 16px; }
.capture-guide-details summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 44px; padding: 10px 0; list-style: none;
  font-size: 13px; font-weight: 650; color: #59677b; cursor: pointer;
}
.capture-guide-details summary::-webkit-details-marker { display: none; }
.capture-guide-details summary::after {
  content: '+'; color: #7b8797; font-size: 19px; font-weight: 400;
}
.capture-guide-details[open] summary::after { content: '−'; }
.capture-guide-details .guide-fallback { margin: 0 0 10px; }
.capture-guide-details .guide-preview { margin-top: 6px; }
.welcome-mark {
  display: grid; place-items: center; width: 64px; height: 64px;
  margin: 0 0 24px; background: #edf4ff; color: var(--blue); border-radius: 22px;
}
.welcome-mark svg { width: 34px; height: 34px; }

@media (min-width: 821px) {
  .site-header { padding-top: 28px; padding-bottom: 22px; }
  .page { margin-top: 30px; column-gap: 66px; }
  .story { padding-top: 34px; }
  .card { padding: 38px 34px; border-radius: 28px; box-shadow: 0 12px 44px #21395706; }
  .upload-card { background: #fff; }
  .application-nav { margin-bottom: 12px; }
  .home-button { border-color: #e3e9f1; background: #fff; }
  .app-nav-label { text-align: left; }
  .top-back-button, .app-back-button, #topBackButton { display: none; }
  .gallery-help { max-width: 440px; }
}

@media (max-width: 820px) {
  html { background: #fff; scroll-padding-top: 78px; }
  body { background: #fff; line-height: 1.65; }
  .site-header {
    position: sticky; top: 0; z-index: 20;
    width: 100%; max-width: none; min-height: 64px;
    padding: 12px max(var(--app-gutter), calc((100% - 552px) / 2));
    align-items: center; gap: 10px;
    background: #fffffff5; border-bottom: 1px solid #f1f3f6;
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  }
  .brand-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .wordmark { font-size: 19px; line-height: 1.35; letter-spacing: -.85px; white-space: nowrap; }
  .wordmark small { display: none; }
  .always-open {
    padding: 4px 8px; font-size: 10px; line-height: 1.5; gap: 5px;
    background: #edf8f2; color: #1c7958; font-weight: 650;
  }
  .always-open::before { width: 5px; height: 5px; }
  .header-tools { max-width: 42%; gap: 4px; flex-wrap: wrap; }
  .test-tag {
    padding: 4px 0; font-size: 10px; background: transparent;
    color: #6c7888; border-radius: 0; line-height: 1.5;
    white-space: normal; overflow-wrap: break-word; text-align: right;
  }
  .test-lock { min-height: 44px; padding: 9px; font-size: 11px; background: #f1f5fa; }
  .page, .page.receipt-layout {
    display: block; max-width: 600px; margin: 0 auto;
    padding: 0 var(--app-gutter);
  }
  .story { display: none; }
  .content { max-width: none; }
  .application-nav {
    min-height: 52px; margin: 4px -10px 0;
    display: grid; grid-template-columns: minmax(44px, 1fr) auto minmax(44px, 1fr);
    align-items: center; gap: 6px;
  }
  .application-nav #topBackButton { grid-column: 1; justify-self: start; }
  .app-nav-label { grid-column: 2; font-size: 13px; font-weight: 600; color: #6c7888; }
  .application-nav .home-button {
    grid-column: 3; justify-self: end; display: inline-flex;
    min-height: 44px; padding: 10px; background: transparent;
    border: 0; border-radius: 12px; font-size: 13px; color: #59677a;
  }
  .application-nav .home-button svg { width: 17px; height: 17px; }
  /* A live application has one bar: back, brand and home. The welcome screen
     keeps its wordmark; test mode retains the separate test controls. */
  .mobile-app-navigation .site-header { display: none; }
  .mobile-app-navigation .application-nav {
    position: sticky; top: 0; z-index: 20; min-height: 60px;
    margin: 0 calc(-1 * var(--app-gutter)); padding: 4px var(--app-gutter);
    border-bottom: 1px solid #f0f3f7; background: #fffffff5;
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  }
  .mobile-app-navigation .app-nav-label {
    color: #2b3c55; font-size: 14px; font-weight: 750; line-height: 1.5;
  }
  .card > .back-button { display: none; }
  .mobile-progress-summary {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px 0 11px; color: #657286; font-size: 12px; font-weight: 550;
  }
  #mobileProgressLabel { color: #3975c9; font-weight: 700; }
  #mobileProgressCount { font-variant-numeric: tabular-nums; }
  .progress, .receipt-layout .progress { gap: 5px; margin: 0; max-width: none; }
  .progress li {
    padding: 0; height: 4px; border: 0; border-radius: 4px;
    background: #edf1f6; font-size: 0; line-height: 0; color: transparent;
  }
  .progress li.active { color: transparent; background: var(--blue); }
  .progress li.done { color: transparent; background: #b5d2fd; }
  .card, .receipt-layout .card {
    display: flex; flex-direction: column;
    min-height: 440px; min-height: calc(100svh - 210px);
    padding: 28px 0 18px; margin: 0;
    border: 0; border-radius: 0; box-shadow: none; background: #fff;
  }
  .card > form { display: flex; flex-direction: column; flex: 1; }
  .card h2 {
    font-size: 29px; line-height: 1.4; letter-spacing: -1.05px;
    color: #152133; font-weight: 780; word-break: keep-all; overflow-wrap: break-word;
  }
  .step-index { margin-bottom: 10px; font-size: 12px; color: #4c709f; font-weight: 650; }
  .mobile-progress-summary:not([hidden]) ~ .card > .step-index { display: none; }
  .intro { margin-top: 12px; font-size: 15px; line-height: 1.75; color: #697487; }
  .section { margin-top: 26px; }
  .section-label { font-size: 15px; margin-bottom: 10px; }
  .small { font-size: 14px; line-height: 1.8; }
  .tiny { font-size: 12px; line-height: 1.75; }
  .primary, .secondary, .kakao-link {
    min-height: 58px; border-radius: 16px; padding: 16px 18px;
    font-size: 16px; line-height: 1.5; font-weight: 700;
  }
  .secondary { color: #425168; background: #f3f5f8; }
  .text-button { min-height: 44px; line-height: 1.5; }
  .actions { gap: 10px; margin-top: 28px; }
  /* The dock stays in document flow. Inputs and acknowledgements remain
     reachable when the keyboard opens or the customer enlarges text. */
  .actions.sticky-actions, .mobile-action-bar {
    position: sticky; bottom: 0; z-index: 8;
    padding: 18px 0 max(12px, env(safe-area-inset-bottom));
    margin-top: 24px; margin-bottom: 0;
    background: #fff; border-radius: 0;
    box-shadow: 0 -14px 20px #fffffff5;
  }
  .card > .mobile-action-bar, .card > form > .mobile-action-bar { margin-top: auto; }
  .mobile-action-bar:empty { display: none; }
  .mobile-action-bar .upload-send { margin-top: 0; }
  .upload-card > .mobile-action-bar {
    position: static; margin-top: 0; padding-top: 18px; padding-bottom: 0;
    box-shadow: none;
  }
  .card > form > .checkbox:last-of-type { margin-bottom: 14px; }
  .choices { gap: 12px; margin-top: 30px; }
  .choice {
    padding: 20px 18px; min-height: 90px; border-radius: 20px;
    background: #f7f9fc; border: 1px solid #f0f3f8;
    font-size: 17px; box-shadow: none;
  }
  .choice-label { gap: 14px; }
  .choice-icon { width: 46px; height: 46px; border-radius: 16px; font-size: 19px; }
  .choice small { font-size: 12px; line-height: 1.7; margin-top: 5px; }
  .choice .arrow { color: #9da9b9; font-size: 24px; font-weight: 400; }
  .mini-steps { gap: 20px; margin: 30px 0; }
  .mini-steps li { gap: 14px; font-size: 15px; color: #47566b; }
  .mini-steps span { width: 32px; height: 32px; border-radius: 11px; background: #edf4ff; }
  .welcome-service-note { font-size: 12px; line-height: 1.8; text-align: center; margin-top: 18px; }
  .note { padding: 16px 18px; border-radius: 16px; background: #f5f7fa; font-size: 14px; }
  .note.warning { background: #fff8e9; }
  .form-group { margin: 24px 0 0; }
  .form-group label { font-size: 14px; color: #4d5e75; font-weight: 600; margin-bottom: 9px; }
  .field {
    min-height: 60px; padding: 16px; border-radius: 15px;
    border: 1px solid #edf0f4; background: #f5f7fa; color: #1a2739;
    line-height: 1.5; font-size: 16px;
  }
  .field:focus { background: #fff; border-color: var(--blue); }
  textarea.field { min-height: 126px; line-height: 1.75; }
  .field-help { margin-top: 9px; line-height: 1.7; font-size: 13px; }
  .checkbox { font-size: 14px; gap: 12px; line-height: 1.8; padding: 12px 0; margin-top: 18px; }
  .checkbox input { width: 23px; height: 23px; margin-top: 2px; }
  .compact-check { margin-top: 10px; }
  .upload-card, .receipt-layout .upload-card {
    padding: 0; border: 0; border-radius: 0; background: transparent; margin-top: 28px;
  }
  .upload-head { margin-bottom: 12px; gap: 10px; align-items: center; }
  .upload-head h3 { font-size: 16px; line-height: 1.5; font-weight: 750; }
  .status { padding: 5px 8px; border-radius: 7px; font-size: 11px; background: #f2f5f9; }
  .status.ok { padding: 6px 9px; font-size: 12px; }
  .upload-requirements { margin-bottom: 7px; font-size: 15px; line-height: 1.7; }
  .upload-requirements strong { color: #2670d6; }
  .upload-requirements-detail { font-size: 13px; color: #62728a; line-height: 1.75; margin-bottom: 14px; }
  .single-item-note {
    margin: 20px 0 22px; padding: 1px 0 1px 14px;
    background: transparent; border: 0; border-left: 3px solid #b6d3ff; border-radius: 0;
  }
  .single-item-note .single-item-heading { font-size: 16px; font-weight: 650; line-height: 1.6; color: #324562; }
  .single-item-note .single-item-rule { margin-top: 7px; font-size: 14px; line-height: 1.65; }
  .single-item-note .single-item-detail { margin-top: 5px; font-size: 12px; line-height: 1.7; color: #62728a; }
  .upload-button {
    min-height: 62px; padding: 18px 16px; font-size: 16px; font-weight: 750;
    border: 0; border-radius: 17px; background: var(--blue); color: #fff;
  }
  .upload-button:hover:not(:disabled) { background: #1764d7; }
  .upload-has-selection .upload-button { background: #edf4ff; color: #246ac9; }
  .upload-has-selection .upload-button:hover:not(:disabled) { background: #e2eeff; }
  .gallery-help { margin-top: 10px; padding: 0 3px; font-size: 12px; color: #62728a; }
  .upload-preview {
    margin-top: 20px; padding: 15px; gap: 16px; border-radius: 18px;
    background: #f5f7fa; align-items: center;
  }
  .upload-preview img { width: 76px; height: 98px; border-radius: 11px; border: 1px solid #e8edf4; background: #fff; }
  .upload-preview .file-name { font-size: 13px; font-weight: 650; color: #42516a; }
  .upload-preview .tiny { font-size: 11px; margin-top: 5px; }
  .upload-preview .text-button { padding: 10px 0; font-size: 12px; color: #64748a; }
  .upload-send { min-height: 58px; margin-top: 18px; font-size: 16px; }
  .photo-links { margin-top: 14px; gap: 8px; }
  .photo-link { background: #f1f5fa; color: #52647d; border-radius: 12px; }
  .guide-preview {
    grid-template-columns: 70px minmax(0, 1fr); min-height: 88px;
    margin: 18px 0 2px; padding: 13px; gap: 14px;
    background: #f6f8fb; border: 1px solid #eff2f7; border-radius: 16px;
  }
  .guide-preview img { width: 70px; height: 60px; border-radius: 7px; border-color: #e9edf3; }
  .guide-preview strong { font-size: 14px; color: #43536b; font-weight: 650; }
  .guide-preview small { font-size: 12px; margin-top: 4px; color: #286bc2; }
  .guide-preview.failed { grid-template-columns: 1fr; }
  .capture-guide-details { margin: 2px 0 18px; }
  .capture-guide-details summary { font-size: 13px; }
  .capture-guide-details .guide-fallback { padding: 0 2px 8px; font-size: 13px; line-height: 1.9; }
  .guide { margin-top: 12px; }
  .guide summary { font-size: 14px; }
  .confirmation {
    padding: 13px 15px; border-radius: 15px; gap: 11px;
    background: #f0f9f5; margin-bottom: 26px;
  }
  .confirmation-check { flex-basis: 28px; height: 28px; font-size: 17px; }
  .confirmation strong { font-size: 15px; line-height: 1.6; }
  .confirmation p { font-size: 12px; line-height: 1.75; margin-top: 3px; }
  .review-product { font-size: 13px; line-height: 1.8; border-left-color: #d3e4fe; }
  .data-card, .home-summary {
    margin-top: 26px; padding: 23px 20px; border: 0; border-radius: 21px;
    background: #f5f7fa;
  }
  .product-name { font-size: 17px; line-height: 1.7; margin-bottom: 20px; }
  .data-row { font-size: 14px; gap: 18px; margin-top: 13px; }
  .data-row dt { color: #718096; }
  .data-row dd { font-weight: 650; }
  .price { padding-top: 21px; margin-top: 23px; border-color: #e1e7f0; }
  .price strong { font-size: 30px; letter-spacing: -.9px; }
  .price span { font-size: 12px; }
  .bank { margin-top: 28px; padding: 27px 20px 18px; border: 0; border-radius: 22px; background: #f2f6fd; }
  .bank .amount { font-size: 37px; margin-bottom: 22px; line-height: 1.35; }
  .account { font-size: 22px; line-height: 1.6; overflow-wrap: anywhere; letter-spacing: -.3px; }
  .bank .text-button { min-height: 44px; padding: 9px 14px; margin-top: 8px; border-radius: 10px; background: #e7effc; text-decoration: none; }
  .address-search { margin-top: 28px; min-height: 58px; background: #edf4ff; color: #246ac9; }
  .address-preview { padding: 18px; border: 0; border-radius: 17px; background: #f0f6ff; }
  .address-preview-text { font-size: 16px; line-height: 1.8; font-weight: 650; }
  .address-preview .section-label { font-size: 13px; color: #5a7da9; }
  .home-status { font-size: 12px; border-radius: 8px; margin-bottom: 12px; }
  .home-summary .reference { background: #eaf0f7; margin-top: 15px; }
  .home-note { margin-top: 18px; }
  .checkmark { width: 66px; height: 66px; margin: 6px 0 27px; border-radius: 23px; background: #edf4ff; }
  .completion-notice { margin-top: 26px; padding: 20px; background: #f7f9fb; }
  .completion-notice strong { font-size: 14px; }
  .completion-notice .small { margin-top: 12px; font-size: 13px; line-height: 1.85; }
  .reference { align-self: flex-start; font-size: 11px; padding: 6px 9px; }
  .shipment-notice { padding: 17px 18px; border-radius: 16px; }
  .shipment-notice strong { font-size: 16px; }
  .saved-strip { margin-top: 18px; padding-top: 18px; border-top: 1px solid #f0f2f5; }
  .saved-strip span { text-align: center; font-size: 11px; line-height: 1.8; color: #6b778a; }
  .bottom-links { gap: 0 18px; margin: 12px 0 20px; justify-content: center; }
  .bottom-links .text-button, .bottom-links a { min-height: 44px; padding: 12px 0; font-size: 12px; color: #657286; }
  .bottom-links .danger-text { color: #9e7480; }
  .site-footer { padding: 0 var(--app-gutter) max(24px, env(safe-area-inset-bottom)); font-size: 11px; color: #717e90; }
  .initial-support { margin-top: 20px; }
  .initial-support a { min-height: 44px; display: inline-flex; align-items: center; font-size: 12px; }
  .initial-support .tiny { font-size: 11px; }
  .busy-info, .error { margin-top: 12px; padding: 15px 16px; line-height: 1.8; }
  .loading { min-height: 300px; align-content: center; padding: 40px 0; }
  .practice-banner { margin-top: 15px; padding: 14px; }

  /* Native dialog semantics are preserved; on phones dialogs become sheets. */
  .dialog {
    inset: auto 0 0; margin: 0 auto; width: 100%; max-width: 600px;
    max-height: 91dvh; padding: 24px var(--app-gutter) max(24px, env(safe-area-inset-bottom));
    border-radius: 28px 28px 0 0; background: #fff;
    box-shadow: 0 -12px 60px #1c2d4826; overscroll-behavior: contain;
  }
  .dialog::before { content: ''; display: block; width: 34px; height: 4px; margin: -11px auto 19px; border-radius: 4px; background: #dfe5ed; }
  .dialog::backdrop { background: #15233c70; }
  .dialog-top { align-items: flex-start; gap: 15px; margin-bottom: 18px; }
  .dialog h2 { font-size: 23px; line-height: 1.5; letter-spacing: -.7px; padding-top: 4px; word-break: keep-all; overflow-wrap: break-word; }
  .close { width: 44px; height: 44px; background: #f3f5f8; color: #6a788c; }
  .dialog .actions { margin-top: 24px; }
  .dialog .field { font-size: 16px; }
  .dialog .upload-card { padding-bottom: 23px; border-bottom: 1px solid var(--line); }
  .dialog .upload-card:last-child { border-bottom: 0; padding-bottom: 0; }
  .dialog .mobile-action-bar { position: static; padding-bottom: 0; box-shadow: none; }
  .support-summary { min-height: 180px!important; }
  .guide-dialog { width: 100%; max-height: 94dvh; padding: 24px 18px max(20px, env(safe-area-inset-bottom)); }
  .guide-dialog h2 { font-size: 21px; }
  .guide-toolbar { margin: 10px 0; gap: 10px; flex-wrap: wrap; }
  .guide-toolbar .text-button, .guide-toolbar a { min-height: 44px; font-size: 13px; }
  .guide-image-area { max-height: 56dvh; border-radius: 14px; }
  .guide-dialog .guide-fallback { font-size: 12px; line-height: 1.9; }
  .address-dialog { max-height: 93dvh; padding: 24px 16px max(18px, env(safe-area-inset-bottom)); }
  .address-dialog .dialog-top { padding-inline: 6px; }
  .address-frame { height: min(460px, 60dvh); min-height: 230px; margin: 15px 0; border-radius: 12px; }
  .address-dialog .secondary { min-height: 54px; }
  .toast { bottom: max(22px, env(safe-area-inset-bottom)); max-width: calc(100% - 40px); font-size: 13px; border-radius: 15px; z-index: 30; }

  /* Card-receipt supplementation is intentionally large, never a thumbnail. */
  .receipt-guide { margin: 22px 0 20px; width: 100%; }
  .receipt-guide-trigger { width: 100%; border: 1px solid #c8ddfa; border-radius: 17px; }
  .receipt-guide-trigger img { width: 100%; height: auto; max-height: none; }
  .receipt-guide-trigger span { font-size: 14px; padding: 15px 12px; }
  .receipt-capture-check { margin-top: 16px; padding: 17px; font-size: 16px; border: 0; border-radius: 15px; }
  .receipt-guide .guide-fallback { font-size: 14px; line-height: 1.85; margin: 16px 0; }
  .receipt-guide-steps { grid-template-columns: 1fr; gap: 10px; margin-top: 18px; font-size: 14px; }
  .guide-dialog.receipt-dialog {
    width: 100%; max-width: none; height: 100dvh; max-height: 100dvh;
    inset: 0; margin: 0; border-radius: 0;
    padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  }
  .receipt-dialog::before { display: none; }
  .receipt-dialog .guide-image-area { max-height: calc(100dvh - 250px); min-height: 180px; }
  .receipt-dialog .dialog-top h2 { font-size: 19px; }
  .receipt-dialog .guide-image-area.is-zoomed img { width: 1536px; max-width: none; }
}

@media (max-width: 400px) {
  :root { --app-gutter: 20px; }
  .site-header { min-height: 61px; gap: 7px; }
  .brand-group { gap: 7px; }
  .wordmark { font-size: 18px; }
  .always-open { font-size: 9px; padding: 4px 7px; }
  .header-tools { max-width: 38%; }
  .test-tag { font-size: 9px; }
  .card h2 { font-size: 27px; letter-spacing: -.9px; }
  .intro { font-size: 14px; }
  .card, .receipt-layout .card { padding-top: 25px; }
  .choice { padding: 18px 15px; }
  .choice-label { gap: 12px; }
  .choice-icon { width: 43px; height: 43px; }
  .single-item-note .single-item-heading { font-size: 15px; }
  .guide-preview { grid-template-columns: 60px minmax(0, 1fr); gap: 12px; }
  .guide-preview img { width: 60px; height: 54px; }
  .guide-preview strong { font-size: 13px; }
  .data-card, .home-summary { padding: 21px 18px; }
  .data-row { gap: 12px; font-size: 13px; }
  .price strong { font-size: 28px; }
  .account { font-size: 20px; }
  .dialog h2 { font-size: 21px; }
}

/* Landscape keyboards and very short windows retain normal document flow. */
@media (max-width: 820px) and (max-height: 520px) {
  .site-header { position: relative; }
  .mobile-app-navigation .application-nav { position: relative; }
  .card, .receipt-layout .card { min-height: 0; }
  .actions.sticky-actions, .mobile-action-bar { position: static; box-shadow: none; }
  .dialog { max-height: 96dvh; }
  .address-frame { min-height: 130px; height: 44dvh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto!important; transition: none!important; animation-duration: 0s!important; }
}
