/* Standalone safe areas do not alter desktop valuation/report layouts. */
body.workspace-page > footer { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.pwa-connection-notice[hidden] { display: none !important; }
.pwa-connection-notice {
  margin: 0;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
  background: #fff3d5;
  color: #5b4319;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

/* The offline document contains no authenticated styles, scripts or personal data. */
.pwa-offline-page {
  box-sizing: border-box;
  min-height: 100dvh;
  margin: 0;
  padding: max(28px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) max(28px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
  display: grid;
  align-content: center;
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: #f4f3ef;
  color: #203244;
}
.pwa-offline-card { max-width: 410px; margin-inline: auto; }
.pwa-offline-card > img { width: 72px; height: 72px; border-radius: 18px; }
.pwa-offline-kicker { margin: 28px 0 10px; color: #5b6874; font-size: 13px; letter-spacing: .14em; }
.pwa-offline-card h1 { margin: 0; font-size: clamp(26px, 5vw, 34px); line-height: 1.4; }
.pwa-offline-description { margin: 18px 0 26px; font-size: 16px; line-height: 1.9; }
.pwa-offline-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.pwa-offline-actions button, .pwa-offline-actions a {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid #cad1d7;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
}
.pwa-offline-actions button { background: #173b57; border-color: #173b57; color: #fff; }
.pwa-offline-actions button:focus-visible,
.pwa-offline-actions a:focus-visible { outline: 3px solid #176a9c; outline-offset: 4px; }
.pwa-offline-status { min-height: 24px; margin: 18px 0; color: #5b6874; font-size: 14px; line-height: 1.7; }
.pwa-offline-footnote { padding-top: 20px; border-top: 1px solid #dce0e1; color: #5b6874; font-size: 13px; line-height: 1.8; }
.pwa-offline-signature { margin-top: 32px; font-size: 12px; color: #727d87; }

@media (max-width: 800px) {
  body.workspace-page .site-header { padding-top: env(safe-area-inset-top, 0px); }
  body.workspace-page .header-inner { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
  body.workspace-page input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  body.workspace-page select, body.workspace-page textarea { font-size: 16px; }
}
@media (max-width: 760px) {
  .sign-in-page .sign-in-brand { padding-top: calc(26px + env(safe-area-inset-top, 0px)); padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }
  .sign-in-page .sign-in-workspace { padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }
}
@media (prefers-color-scheme: dark) {
  .pwa-offline-page { background: #121c25; color: #ecf0f2; }
  .pwa-offline-kicker, .pwa-offline-status, .pwa-offline-footnote { color: #b6c1c8; }
  .pwa-offline-footnote, .pwa-offline-actions a { border-color: #35434d; }
}
/* One mobile type scale: readable copy and touch targets without magnifying every layer. */
@media screen and (max-width: 640px) {
  body.workspace-page {
    --mobile-input-size: 16px;
    --mobile-label-size: 16px;
    --mobile-note-size: 14px;
    --mobile-control-height: 48px;
    font-size: 16px;
    line-height: 1.6;
  }

  body.workspace-page input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
  body.workspace-page :is(select, textarea) {
    min-height: var(--mobile-control-height);
    padding: 10px 12px;
    font-size: var(--mobile-input-size);
    line-height: 1.5;
  }
  body.workspace-page textarea { min-height: 112px; }
  body.workspace-page .field > label,
  body.workspace-page .field > legend,
  body.workspace-page .field-label-row > label,
  body.workspace-page .password-visibility {
    font-size: var(--mobile-label-size);
    line-height: 1.5;
  }
  body.workspace-page .field > label { margin-bottom: 6px; }
  body.workspace-page .input-unit > span {
    padding-inline: 10px;
    font-size: var(--mobile-label-size);
  }
  body.valuation-workspace .area-unit-select {
    min-height: var(--mobile-control-height);
    min-width: 6rem;
    font-size: var(--mobile-input-size);
  }

  body.workspace-page :is(.primary-button, .secondary-button, .compact-button, .form-action-primary, .form-action-secondary, .report-download),
  body.workspace-page .report-filter-actions button,
  body.workspace-page .report-card__actions .report-download {
    min-height: var(--mobile-control-height);
    padding: 10px 12px;
    font-size: var(--mobile-label-size);
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body.workspace-page .segmented-control span {
    min-height: 44px;
    padding: 9px 4px;
    font-size: 16px;
    line-height: 1.5;
  }
  body.workspace-page :is(.option-checkbox, .password-visibility, #parking-area-unspecified-field) {
    min-height: 44px;
    padding-block: 6px;
    gap: 8px;
    font-size: var(--mobile-label-size);
    line-height: 1.6;
  }
  body.workspace-page :is(.option-checkbox, .password-visibility, #parking-area-unspecified-field) input {
    flex: 0 0 22px;
    width: 22px;
    min-width: 22px;
    height: 22px;
    min-height: 22px;
  }

  body.workspace-page .page-heading h1 { font-size: 26px; line-height: 1.35; }
  body.workspace-page .panel-heading h2 { font-size: 21px; line-height: 1.4; }
  body.valuation-workspace .form-section-heading h3,
  body.valuation-workspace #floor-fields .supplementary-heading h3 { font-size: 17px; }
  body.workspace-page .page-heading p:not(.eyebrow),
  body.workspace-page .sign-in-heading p,
  body.workspace-page .subject-line,
  body.workspace-page .form-error,
  body.workspace-page .submit-status,
  body.workspace-page .section-intro,
  body.workspace-page .section-state { font-size: 16px; line-height: 1.6; }
  body.workspace-page .field :is(small, .field-note),
  body.workspace-page .field .optional-label,
  body.workspace-page :is(.notice, .area-conversion, .area-source-badge, .address-resolver-status, .parking-workflow-note, .advanced-settings__meta, .advanced-settings__guardrail, .prototype-warning, .status-badge, .step-label, .eyebrow),
  body.workspace-page .panel-heading > p,
  body.workspace-page .form-section-heading p,
  body.workspace-page .area-breakdown-summary-copy small,
  body.workspace-page .sign-in-help p,
  body.valuation-workspace #floor-fields .field small,
  body.valuation-workspace .prototype-warning > .result-explanation {
    font-size: var(--mobile-note-size);
    line-height: 1.6;
  }
  body.valuation-workspace .parking-scope-settings summary,
  body.valuation-workspace .advanced-settings > summary,
  body.valuation-workspace .area-breakdown > summary {
    min-height: 44px;
    padding-block: 10px;
    font-size: var(--mobile-label-size);
    line-height: 1.6;
  }
  body.valuation-workspace .address-candidate {
    min-height: var(--mobile-control-height);
    padding-block: 10px;
    font-size: 16px;
    line-height: 1.6;
  }

  body.valuation-workspace :is(.property-grid, .dimensions-grid, .form-grid, .advanced-grid),
  body.valuation-workspace .dimensions-grid > .building-condition-fields,
  body.valuation-workspace .dimensions-grid:has(> .area-field.hidden) > .building-condition-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }
  body.valuation-workspace :is(.property-grid, .dimensions-grid, .form-grid, .advanced-grid) > * {
    grid-column: 1 / -1;
    min-width: 0;
  }
  body.valuation-workspace #floor-fields .advanced-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  body.valuation-workspace #floor-fields .advanced-grid > * { grid-column: auto; }
  body.valuation-workspace .form-actions { gap: 10px; margin-top: 20px; }
  body.valuation-workspace .form-actions:has(#estimate-button) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    align-items: stretch;
  }
  body.valuation-workspace .form-actions #reset-button,
  body.valuation-workspace .form-actions #estimate-button {
    grid-row: 1;
    min-width: 0;
    width: 100%;
    margin: 0;
    order: 0;
  }
  body.valuation-workspace .form-actions #reset-button { grid-column: 1; }
  body.valuation-workspace .form-actions #estimate-button { grid-column: 2; }
  body.valuation-workspace .form-actions #cancel-estimate {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    width: 100%;
    margin: 0;
  }
  body.valuation-workspace #ready-result .estimate-card p { font-size: 16px; }
  body.valuation-workspace #ready-result .estimate-card small { font-size: 14px; line-height: 1.6; }
  body.valuation-workspace #ready-result .estimate-card strong > span:last-child { font-size: 16px; }

  body.reports-workspace .report-filter-grid,
  body.reports-workspace .report-filter-grid:has(#report-branch-field.hidden) {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  body.reports-workspace .report-filter-grid > * { grid-column: 1 / -1; }
  body.reports-workspace .report-filter-grid :is(input, select) {
    min-height: var(--mobile-control-height);
    padding: 10px 12px;
    font-size: var(--mobile-input-size);
  }
  body.reports-workspace .report-card { padding: 14px; }
  body.reports-workspace .report-card h3 { font-size: 17px; line-height: 1.55; }
  body.reports-workspace .report-card-metadata { font-size: 16px; line-height: 1.6; gap: 8px 12px; }
  body.reports-workspace :is(.report-cell-secondary, .report-id, .report-card-label, .status-chip) { font-size: 14px; line-height: 1.6; }
  body.reports-workspace .report-card .report-total-range { font-size: 24px; }
  body.reports-workspace #reports-page { font-size: 16px; white-space: normal; }
  body.reports-workspace #reports-pagination button,
  body.reports-workspace #reports-retry { min-height: 44px; font-size: 16px; }
  body.reports-workspace .reports-feedback .empty-state { font-size: 16px; }

  body.workspace-page .primary-nav a { min-height: 44px; font-size: 16px; }
  body.workspace-page .header-actions :is(button, a) { min-height: 44px; font-size: 14px; }
  body.workspace-page .sign-in-heading h2 { font-size: 24px; }
  body.account-workspace .security-guidance ul { font-size: 16px; }
  body.account-workspace .security-guidance > p:last-child { font-size: 14px; }
  body.admin-workspace .admin-section-nav a { min-height: 44px; font-size: 16px; }
  body.admin-workspace .workspace-disclosure > summary > span,
  body.admin-workspace .summary-stat span,
  body.admin-workspace .status-chip { font-size: 14px; }
  body.admin-workspace #profile-target { font-size: 16px; }
}

@media print { .pwa-connection-notice { display: none !important; } }
