:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: #142235;
  background: #eef2f6;
  --brand: #123d70;
  --text: #142235;
  --muted: #56677b;
  --border: #8595a8;
  --soft: #f3f6fa;
  --error: #ab2525;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; padding: 32px 24px; display: flex; justify-content: center; align-items: flex-start; gap: 48px; }
button, input, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, select { cursor: pointer; }
button, a { transition: background-color 120ms ease, color 120ms ease; }
a { color: var(--brand); }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid #1963b3; outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
svg { width: 24px; height: 24px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.preview { width: 260px; padding: 24px 0; flex-shrink: 0; color: var(--muted); font-size: 0.875rem; line-height: 1.7; }
.preview strong { color: var(--text); font-size: 1.25rem; }
.preview label { display: block; margin: 28px 0 8px; }
.preview select { width: 100%; min-height: 48px; border: 1px solid var(--border); border-radius: 8px; background: white; color: var(--text); padding: 8px; }
.preview-note { margin-top: 24px; }
.screen { width: 390px; flex-shrink: 0; min-height: 844px; background: #fff; border-radius: 24px; overflow: hidden; box-shadow: 0 16px 48px #18355412; }
.topbar { min-height: 64px; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-menu { position: relative; margin-left: auto; z-index: 20; }
.account-menu summary { display: grid; place-items: center; min-width: 64px; min-height: 44px; padding: 8px 12px; border: 1px solid #dce3eb; border-radius: 10px; color: var(--brand); background: #fff; font-size: .875rem; font-weight: 600; cursor: pointer; list-style: none; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 220px; padding: 16px; border: 1px solid #dce3eb; border-radius: 12px; background: #fff; box-shadow: 0 12px 28px #18355424; }
.account-menu-kicker { margin: 0 0 4px; color: var(--muted); font-size: .75rem; }
.account-menu-panel strong { display: block; color: var(--text); font-size: .9375rem; overflow-wrap: anywhere; }
.account-menu-panel p:not(.account-menu-kicker) { margin: 8px 0 12px; color: var(--muted); font-size: .8125rem; line-height: 1.5; }
.account-menu-action, .account-menu-logout { width: 100%; min-height: 44px; border: 1px solid #dce3eb; border-radius: 8px; color: var(--brand); background: #fff; font-size: .875rem; font-weight: 600; }
.account-menu-action { margin-bottom: 8px; background: var(--soft); }
.back { display: inline-flex; align-items: center; min-height: 48px; padding-right: 8px; text-decoration: none; font-size: 1rem; gap: 2px; }
.back:active, .text-button:active { background: #e7eef6; }
.edition { color: var(--muted); font-size: 0.875rem; padding-right: 8px; }
.content { padding: 16px 28px calc(32px + env(safe-area-inset-bottom)); }
.identity { margin-bottom: 32px; }
.brand { display: block; width: 64px; height: 64px; margin-bottom: 24px; }
.eyebrow { color: var(--brand); font-size: 0.875rem; font-weight: 600; margin: 0 0 8px; letter-spacing: .06em; }
h1 { font-size: 1.75rem; line-height: 1.35; margin: 0; letter-spacing: -.02em; }
.intro { color: var(--muted); font-size: 1rem; line-height: 1.6; margin: 10px 0 0; }
.test-note { display: none; color: #79420b; font-size: .8125rem; line-height: 1.6; margin: 12px 0 0; }
.app-preview body { display: block; padding: 0; background: #fff; }
.app-preview .preview { display: none; }
.app-preview .screen { width: 100%; max-width: 480px; margin: 0 auto; min-height: 100dvh; border-radius: 0; box-shadow: none; }
.app-preview .test-note { display: block; }
.field + .field { margin-top: 20px; }
.field label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 1rem; }
input { display: block; width: 100%; min-height: 56px; padding: 15px 16px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); background: white; font-size: 1.0625rem; line-height: 1.4; }
input::placeholder { color: #647489; opacity: 1; }
input:focus { border-color: var(--brand); outline: 2px solid var(--brand); outline-offset: 1px; }
input[aria-invalid="true"] { border-color: var(--error); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 4.75rem; }
.reveal { position: absolute; right: 4px; top: 4px; bottom: 4px; min-width: 4rem; min-height: 48px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--brand); font-size: 0.875rem; font-weight: 600; }
.reveal:active { background: var(--soft); }
.field-error { color: var(--error); font-size: 0.875rem; margin: 8px 0 0; line-height: 1.5; }
.help-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0 8px; margin: 4px 0 16px; font-size: 0.8125rem; color: var(--muted); }
.text-button { min-height: 48px; padding: 8px 0; background: none; border: 0; border-radius: 8px; color: var(--brand); font-size: 0.875rem; }
.primary { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; border: 0; border-radius: var(--radius); background: var(--brand); color: white; font-size: 1.125rem; font-weight: 600; padding: 14px 16px; }
.primary:hover { background: #0d305a; }
.primary:active { background: #082344; }
.primary:disabled { cursor: wait; background: #566d89; }
.account-help { display: block; margin: 4px auto 0; padding: 8px 16px; }
.offline-entry { border-top: 1px solid #dce3eb; margin-top: 20px; padding-top: 24px; text-align: center; }
.secondary { display: flex; justify-content: center; align-items: center; gap: 8px; width: 100%; min-height: 52px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--brand); text-decoration: none; font-size: 1rem; font-weight: 600; padding: 12px; }
.secondary:active, .secondary:hover { background: var(--soft); }
.secondary svg { width: 18px; height: 18px; }
.offline-entry p { color: var(--muted); font-size: 0.8125rem; line-height: 1.6; margin: 10px 0 0; }
.cloud-note { display: flex; align-items: flex-start; gap: 12px; margin-top: 28px; padding: 16px; background: var(--soft); border-radius: var(--radius); color: var(--muted); }
.cloud-note svg { color: var(--brand); margin-top: 2px; }
.cloud-note strong { color: var(--text); font-size: 0.875rem; font-weight: 600; }
.cloud-note p { margin: 6px 0 0; font-size: 0.8125rem; line-height: 1.7; }
.notice, .form-status { background: #fff4e6; color: #79420b; border-radius: 8px; padding: 12px; font-size: 0.875rem; line-height: 1.6; margin: 0 0 20px; overflow-wrap: anywhere; }
.form-status.error { background: #fff0ee; color: var(--error); }
.form-status.success { background: #edf8f1; color: #176037; }
.cloud-panel { margin-top: 8px; }
.cloud-account-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid #dce3eb; padding-bottom: 18px; }
.cloud-account-head h2 { margin: 2px 0 0; font-size: 22px; }
.cloud-account-head .eyebrow { margin: 0; font-size: 12px; }
.cloud-account-label { margin: 6px 0 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.cloud-account-head .text-button { margin-top: -4px; white-space: nowrap; }
.sync-card { display: flex; align-items: flex-start; gap: 12px; margin: 20px 0 16px; padding: 14px 16px; background: var(--soft); border-radius: var(--radius); }
.sync-dot { width: 10px; height: 10px; margin-top: 6px; flex: 0 0 auto; border-radius: 50%; background: #2c8a54; box-shadow: 0 0 0 4px #2c8a5420; }
.sync-card strong { color: var(--text); font-size: 15px; }
.sync-card p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.sync-card.error { background: #fff0ee; }
.sync-card.error .sync-dot { background: var(--error); box-shadow: 0 0 0 4px #ab252520; }
.sync-card.success .sync-dot { background: #2c8a54; }
.weighing-frame { display: block; width: calc(100% + 56px); height: min(720px, 78dvh); margin: 0 -28px -32px; border: 0; background: #fff; }
.spinner { width: 18px; height: 18px; border: 2px solid #ffffff66; border-top-color: white; border-radius: 50%; animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
dialog { width: min(360px, calc(100% - 40px)); border: 0; border-radius: 16px; padding: 24px; color: var(--text); background: white; max-height: calc(100dvh - 40px); overflow-y: auto; }
dialog::backdrop { background: #10223780; }
dialog h2 { margin: 0; font-size: 1.375rem; }
dialog p { font-size: 1rem; line-height: 1.7; color: var(--muted); margin: 16px 0 24px; }
@media (max-width: 760px) {
  body { display: block; padding: 0; background: white; }
  .preview { width: 100%; padding: 12px 20px; background: var(--soft); font-size: 0.75rem; }
  .preview strong { font-size: 0.875rem; }
  .preview p { margin: 4px 0 8px; }
  .preview label { margin: 0 0 4px; }
  .preview select { font-size: 1rem; }
  .preview .preview-note { display: none; }
  .screen { width: 100%; max-width: 480px; margin: 0 auto; min-height: 100dvh; box-shadow: none; border-radius: 0; }
}
@media (max-width: 360px) { .content { padding-left: 20px; padding-right: 20px; } }
@media (max-width: 360px) { .weighing-frame { width: calc(100% + 40px); margin-left: -20px; margin-right: -20px; } }
.logged-in .topbar { min-height: 48px; padding: calc(4px + env(safe-area-inset-top)) 8px 4px; justify-content: flex-end; }
.logged-in .topbar .back, .logged-in .topbar .edition { display: none; }
.logged-in .content { padding: 0; }
.logged-in .cloud-panel { margin: 0; }
.logged-in .cloud-account-head, .logged-in .sync-card, .logged-in .offline-entry, .logged-in .cloud-note { display: none !important; }
.logged-in.syncing .sync-card { display: flex !important; margin: 0; border-radius: 0; }
.logged-in .weighing-frame { width: 100%; height: calc(100dvh - 48px - env(safe-area-inset-top)); margin: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 24px; border-bottom: 1px solid #dce3eb; }
.auth-tabs button { min-height: 52px; border: 0; border-bottom: 3px solid transparent; padding: 10px 4px; color: var(--muted); background: #fff; font-size: .9375rem; font-weight: 600; }
.auth-tabs [aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.auth-tabs button:active { background: var(--soft); }
.phone-wrap { position: relative; }
.phone-wrap > span { position: absolute; left: 16px; top: 17px; line-height: 1.4; font-size: 1.0625rem; }
.phone-wrap input { padding-left: 4rem; }
.code-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.code-wrap input { min-width: 0; padding-left: 12px; padding-right: 8px; font-variant-numeric: tabular-nums; }
.send-code { min-width: 108px; min-height: 56px; padding: 10px; border: 1px solid var(--brand); border-radius: var(--radius); color: var(--brand); background: #f3f6fa; font-size: .875rem; font-weight: 600; }
.send-code:active { background: #e7eef6; }
.send-code:disabled { cursor: default; color: var(--muted); border-color: #8595a8; background: #f3f6fa; }
.field-hint { margin: 8px 0 0; color: var(--muted); font-size: .8125rem; line-height: 1.65; }
.legacy-account-note { margin: 8px 0; color: var(--text); font-size: .875rem; line-height: 1.7; }
.legacy-account-note .text-button { display: block; text-align: left; font-size: .875rem; font-weight: 600; }
.legacy-account-note > span { display: block; color: var(--muted); font-size: .8125rem; }
.check-row { display: flex; align-items: center; min-height: 48px; gap: 12px; padding: 12px 0; color: var(--text); font-size: .875rem; line-height: 1.7; cursor: pointer; }
.check-row input { flex: 0 0 24px; width: 24px; height: 24px; min-height: 24px; margin: 0; padding: 0; accent-color: var(--brand); cursor: pointer; }
.registration-note { margin: 12px 0; padding: 8px; border: 1px solid #8595a8; border-radius: 8px; background: var(--soft); }
.agreement { margin: 12px 0 20px; }
.policy-links { display: flex; flex-wrap: wrap; column-gap: 16px; padding-left: 36px; }
.policy-links a { display: inline-flex; align-items: center; min-height: 48px; font-size: .8125rem; }
.auth-dialog { width: min(440px, calc(100% - 32px)); padding: 20px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dialog-heading h2 { font-size: 1.375rem; }
.dialog-close { display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px; background: var(--soft); border: 0; border-radius: 8px; color: var(--text); font-size: 1.5rem; }
.auth-dialog .primary { margin-top: 20px; }
.auth-dialog .form-status { margin-top: 16px; }
.captcha-image-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0; }
.captcha-image-row img { display: block; width: 180px; max-width: 65%; height: 56px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; }
.captcha-label { display: block; margin-bottom: 8px; font-weight: 600; }
@media (max-width: 360px) { .code-wrap { grid-template-columns: minmax(0,1fr) 100px; } .send-code { min-width: 0; } }
.identity { margin-bottom: 24px; }
.identity .brand { width: 48px; height: 48px; margin-bottom: 12px; }
.identity .eyebrow { display: none; }
.app-preview .test-note { display: none; }
