:root {
  --brand-deep: #173c2d;
  --brand-deep-hover: #28503d;
  --brand: #1d6b4d;
  --brand-soft: #e7f1eb;
  --accent: #dff45e;
  --accent-hover: #d4eb48;
  --page: #f4f5ef;
  --surface: #ffffff;
  --surface-subtle: #fafbf8;
  --text: #18221c;
  --text-secondary: #6f776f;
  --text-tertiary: #929991;
  --border: #dfe4dc;
  --danger: #963f3f;
  --danger-bg: #f8dddd;
  --font: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --focus: 0 0 0 3px rgba(29, 107, 77, 0.18);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--page); }
body { margin: 0; color: var(--text); font-family: var(--font); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.auth-page { min-height: 100vh; background: var(--page); }
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(440px, 45%) 1fr; }

.auth-story {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px clamp(44px, 6vw, 96px) 52px;
  color: #fff;
  background: var(--brand-deep);
}

.auth-brand { display: inline-flex; z-index: 1; width: fit-content; align-items: center; gap: 14px; color: #fff; text-decoration: none; }
.auth-brand-logo { display: block; width: 164px; height: auto; }
.auth-brand-system { padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, 0.24); color: #cbd8d0; font-size: 12px; line-height: 20px; white-space: nowrap; }

.auth-story-copy { max-width: 560px; padding: 80px 0; }
.auth-story:not(.auth-story-setup) { justify-content: flex-start; }
.auth-story:not(.auth-story-setup) .auth-story-copy { margin: auto 0; }
.auth-eyebrow { display: block; margin-bottom: 20px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.16em; }
.auth-story-copy h1 { margin: 0; font-size: clamp(36px, 3.6vw, 50px); line-height: 1.2; letter-spacing: -0.035em; }
.auth-story-copy p { max-width: 460px; margin: 24px 0 0; color: #cbd8d0; font-size: 16px; line-height: 28px; }
.auth-entry { display: grid; place-items: center; min-width: 0; padding: 48px clamp(32px, 7vw, 112px); }
.auth-card { width: min(100%, 440px); }
.auth-card-head { margin-bottom: 28px; }
.auth-mobile-brand { display: none; }
.auth-page-company { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 24px; color: var(--text-tertiary); font-size: 10px; letter-spacing: 0.08em; }
.auth-page-company img { display: block; width: 104px; height: auto; }
.auth-kicker { margin: 0 0 8px; color: var(--brand); font-size: 13px; font-weight: 700; }
.auth-card-head h2 { margin: 0; font-size: 32px; line-height: 40px; letter-spacing: -0.02em; }
.auth-card-head > p:last-child { margin: 8px 0 0; color: var(--text-secondary); font-size: 14px; line-height: 22px; }

.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255, 255, 255, 0.7); }
.auth-tab { min-height: 40px; border: 0; border-radius: 8px; color: var(--text-secondary); background: transparent; cursor: pointer; font-size: 14px; font-weight: 600; }
.auth-tab:hover { color: var(--brand-deep); }
.auth-tab:focus-visible { outline: 0; box-shadow: var(--focus); }
.auth-tab.is-active { color: var(--brand-deep); background: var(--surface); box-shadow: 0 2px 10px rgba(28, 48, 37, 0.08); }

.auth-panel { padding-top: 28px; }
.qr-shell { position: relative; display: grid; width: 224px; height: 224px; place-items: center; margin: 0 auto; padding: 18px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: 0 8px 28px rgba(28, 48, 37, 0.06); }
.qr-image { width: 188px; height: 188px; object-fit: contain; }
.qr-placeholder { display: grid; width: 170px; height: 170px; place-items: center; background-color: #fff; background-image: linear-gradient(90deg, rgba(23, 60, 45, 0.09) 50%, transparent 50%), linear-gradient(rgba(23, 60, 45, 0.09) 50%, transparent 50%); background-size: 14px 14px; }
.qr-placeholder span { display: grid; width: 46px; height: 46px; place-items: center; border: 7px solid #fff; border-radius: 14px; color: var(--brand-deep); background: var(--accent); font-weight: 700; box-shadow: 0 2px 10px rgba(28, 48, 37, 0.14); }
.qr-corner { position: absolute; width: 24px; height: 24px; border-color: var(--accent); border-style: solid; }
.qr-corner-a { left: -1px; top: -1px; border-width: 3px 0 0 3px; border-radius: 20px 0 0; }
.qr-corner-b { right: -1px; top: -1px; border-width: 3px 3px 0 0; border-radius: 0 20px 0 0; }
.qr-corner-c { right: -1px; bottom: -1px; border-width: 0 3px 3px 0; border-radius: 0 0 20px; }
.qr-corner-d { left: -1px; bottom: -1px; border-width: 0 0 3px 3px; border-radius: 0 0 0 20px; }

.wechat-status { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 20px; }
.wechat-mark { display: grid; flex: 0 0 38px; height: 38px; place-items: center; border-radius: 12px; color: #fff; background: #20b35a; font-size: 13px; font-weight: 700; }
.wechat-status strong, .wechat-status p { display: block; }
.wechat-status strong { font-size: 14px; line-height: 20px; }
.wechat-status p { margin: 2px 0 0; color: var(--text-secondary); font-size: 12px; line-height: 18px; }
.wechat-mobile-flow { padding: 32px 28px 28px; border: 1px solid var(--border); border-radius: 20px; text-align: center; background: var(--surface); box-shadow: 0 8px 28px rgba(28, 48, 37, 0.06); }
.wechat-mobile-visual { position: relative; display: grid; width: 82px; height: 82px; margin: 0 auto 22px; place-items: center; border-radius: 24px; color: #fff; background: #20b35a; font-size: 20px; font-style: normal; font-weight: 700; box-shadow: 0 10px 24px rgba(32, 179, 90, 0.18); }
.wechat-mobile-visual i { position: absolute; right: -6px; bottom: -6px; display: grid; width: 28px; height: 28px; place-items: center; border: 4px solid #fff; border-radius: 50%; color: var(--brand-deep); background: var(--accent); font-size: 12px; font-style: normal; }
.wechat-mobile-flow h3 { margin: 0; font-size: 18px; line-height: 26px; }
.wechat-mobile-flow > p { margin: 6px 0 0; color: var(--text-secondary); font-size: 13px; line-height: 20px; }
.wechat-mobile-flow small { display: block; margin-top: 14px; color: var(--text-tertiary); font-size: 12px; line-height: 18px; }
.wechat-mobile-action, .auth-submit { display: grid; width: 100%; min-height: 44px; place-items: center; border: 0; border-radius: 10px; color: var(--brand-deep); background: var(--accent); cursor: pointer; text-decoration: none; font-size: 14px; font-weight: 700; }
.wechat-mobile-action { margin-top: 26px; }
.wechat-mobile-action:hover, .auth-submit:hover { background: var(--accent-hover); }
.wechat-mobile-action:focus-visible, .auth-submit:focus-visible { outline: 0; box-shadow: var(--focus); }
.auth-link-button { display: block; margin: 24px auto 0; padding: 6px; border: 0; color: var(--brand); background: transparent; cursor: pointer; font-size: 12px; }
.auth-link-button:hover { color: var(--brand-deep); text-decoration: underline; }
.auth-exit-actions { display: grid; gap: 12px; }
.auth-secondary-link { display: grid; min-height: 42px; place-items: center; border: 1px solid var(--border); border-radius: 10px; color: var(--brand); background: var(--surface); text-decoration: none; font-size: 14px; font-weight: 600; }
.auth-secondary-link:hover { border-color: var(--brand); color: var(--brand-deep); }
.auth-secondary-link:focus-visible { outline: 0; box-shadow: var(--focus); }

.auth-alert { margin-bottom: 16px; padding: 12px 14px; border: 1px solid rgba(150, 63, 63, 0.2); border-radius: 10px; color: var(--danger); background: var(--danger-bg); font-size: 13px; line-height: 20px; }
.auth-form { display: grid; gap: 8px; }
.auth-form label { color: var(--text); font-size: 13px; line-height: 20px; font-weight: 600; }
.auth-input { width: 100%; height: 44px; margin-bottom: 10px; padding: 0 13px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--surface); font-size: 14px; outline: none; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.auth-input::placeholder { color: var(--text-tertiary); }
.auth-input:hover { border-color: #c8d0c7; }
.auth-input:focus { border-color: var(--brand); box-shadow: var(--focus); }
.password-label { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.password-label span { color: var(--text-tertiary); font-size: 12px; }
.remember-row { display: inline-flex; width: fit-content; align-items: center; gap: 8px; margin: 2px 0 12px; cursor: pointer; }
.remember-row input { width: 16px; height: 16px; accent-color: var(--brand); }
.remember-row span { color: var(--text-secondary); font-size: 13px; font-weight: 400; }
.field-error { margin: -6px 0 8px; color: var(--danger); font-size: 12px; line-height: 18px; }
.auth-card-foot { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--text-tertiary); font-size: 12px; }
.lock-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

.setup-progress { display: grid; gap: 14px; color: #93a99c; font-size: 13px; }
.setup-progress span { display: flex; align-items: center; gap: 10px; }
.setup-progress b { display: grid; width: 26px; height: 26px; place-items: center; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 50%; color: #cbd8d0; }
.setup-progress .is-done, .setup-progress .is-current { color: #fff; }
.setup-progress .is-done b { border-color: var(--accent); color: var(--brand-deep); background: var(--accent); }
.setup-progress .is-current b { border-color: var(--accent); color: var(--accent); }
.setup-card { width: min(100%, 520px); }
.setup-form { gap: 8px; }
.avatar-field { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-subtle); }
.avatar-preview { display: grid; flex: 0 0 72px; height: 72px; place-items: center; overflow: hidden; border: 3px solid #fff; border-radius: 50%; color: var(--brand-deep); background-color: var(--brand-soft); background-position: center; background-size: cover; font-size: 24px; font-weight: 700; box-shadow: 0 0 0 1px var(--border); }
.avatar-field > div:last-child { min-width: 0; }
.avatar-field p { margin: 2px 0 8px; color: var(--text-secondary); font-size: 12px; line-height: 18px; }
.avatar-upload { display: inline-flex; min-height: 32px; align-items: center; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--brand); background: #fff; cursor: pointer; font-size: 12px !important; }
.avatar-upload:hover { border-color: var(--brand); }
.avatar-field input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.field-hint { margin: -6px 0 8px; color: var(--text-tertiary); font-size: 12px; line-height: 18px; }
.password-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.password-grid > div { min-width: 0; }
.setup-form .auth-submit { margin-top: 10px; }

.result-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.result-card { width: min(100%, 420px); padding: 36px 28px; border: 1px solid var(--border); border-radius: 20px; text-align: center; background: var(--surface); box-shadow: 0 12px 40px rgba(28, 48, 37, 0.08); }
.result-brand { display: grid; width: 150px; height: 42px; margin: 0 auto 30px; place-items: center; }
.result-brand img { display: block; width: 100%; height: auto; }
.result-icon { display: grid; width: 58px; height: 58px; margin: 0 auto 18px; place-items: center; border-radius: 50%; color: var(--brand-deep); background: var(--brand-soft); font-size: 24px; font-weight: 700; }
.result-error, .result-expired, .result-denied { color: var(--danger); background: var(--danger-bg); }
.result-card h1 { margin: 0; font-size: 24px; line-height: 32px; }
.result-card p { margin: 10px 0 0; color: var(--text-secondary); font-size: 14px; line-height: 22px; }
.result-card a { display: inline-flex; min-height: 40px; align-items: center; margin-top: 24px; padding: 0 16px; border-radius: 10px; color: var(--brand-deep); background: var(--accent); text-decoration: none; font-size: 14px; font-weight: 700; }

@media (max-width: 920px) {
  .auth-layout { grid-template-columns: minmax(360px, 40%) 1fr; }
  .auth-story { padding-inline: 40px; }
  .auth-story-copy h1 { font-size: 38px; }
  .auth-story-meta { display: grid; }
  .auth-entry { padding-inline: 40px; }
}

@media (max-width: 680px) {
  .auth-layout { display: block; }
  .auth-story { display: none; }
  .auth-entry { min-height: 100vh; place-items: start center; padding: 32px 24px 48px; }
  .auth-card { width: 100%; }
  .auth-mobile-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 44px; color: var(--brand-deep); }
  .auth-mobile-brand img { display: block; width: 142px; height: auto; }
  .auth-mobile-brand small { padding-left: 12px; border-left: 1px solid var(--border); color: var(--text-secondary); font-size: 11px; line-height: 18px; white-space: nowrap; }
  .auth-page-company { margin-top: 26px; }
  .auth-page-company img { width: 86px; }
  .auth-card-head h2 { font-size: 28px; line-height: 36px; }
  .auth-tabs { margin-top: 24px; }
  .qr-shell { width: 210px; height: 210px; }
  .qr-image { width: 176px; height: 176px; }
  .qr-placeholder { width: 160px; height: 160px; }
  .password-grid { grid-template-columns: 1fr; gap: 0; }
  .setup-progress { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* Shared login/logout responsive composition; preserve desktop brand identity. */
:is(.auth-login-page, .auth-logout-page) .auth-panel { padding-top: 0; }
:is(.auth-login-page, .auth-logout-page) .auth-input { scroll-margin-block: 24px; }
:is(.auth-login-page, .auth-logout-page) .auth-alert, :is(.auth-login-page, .auth-logout-page) .field-error { overflow-wrap: anywhere; }
@media (max-width: 820px) {
  :is(.auth-login-page, .auth-logout-page) .auth-layout { display: block; min-height: 100svh; }
  :is(.auth-login-page, .auth-logout-page) .auth-story { display: flex; padding: max(24px, env(safe-area-inset-top)) 24px 24px; }
  :is(.auth-login-page, .auth-logout-page) .auth-brand { gap: 12px; }
  :is(.auth-login-page, .auth-logout-page) .auth-brand-logo { width: 142px; }
  :is(.auth-login-page, .auth-logout-page) .auth-story:not(.auth-story-setup) .auth-story-copy { margin: 24px 0 0; padding: 0; max-width: 440px; }
  :is(.auth-login-page, .auth-logout-page) .auth-eyebrow { font-size: 10px; margin-bottom: 10px; }
  :is(.auth-login-page, .auth-logout-page) .auth-story-copy h1 { font-size: 28px; line-height: 1.25; letter-spacing: 0; }
  :is(.auth-login-page, .auth-logout-page) .auth-story-copy p { font-size: 13px; line-height: 20px; margin-top: 12px; }
  :is(.auth-login-page, .auth-logout-page) .auth-entry {
    min-height: 0; place-items: start center;
    padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  }
  :is(.auth-login-page, .auth-logout-page) .auth-card { width: min(100%, 440px); }
  :is(.auth-login-page, .auth-logout-page) .auth-mobile-brand { display: none; }
  :is(.auth-login-page, .auth-logout-page) .auth-card-head { margin-bottom: 20px; }
  :is(.auth-login-page, .auth-logout-page) .auth-card-head h2 { font-size: 28px; line-height: 36px; }
  :is(.auth-login-page, .auth-logout-page) .auth-input { height: 48px; font-size: 16px; }
  :is(.auth-login-page, .auth-logout-page) .auth-submit { min-height: 48px; font-size: 16px; }
  :is(.auth-login-page, .auth-logout-page) .auth-secondary-link { min-height: 48px; }
  :is(.auth-login-page, .auth-logout-page) .password-label { flex-wrap: wrap; gap: 4px 12px; }
  :is(.auth-login-page, .auth-logout-page) .password-label span { color: var(--text-secondary); }
  :is(.auth-login-page, .auth-logout-page) .remember-row { min-height: 44px; margin: 0 0 4px; }
  :is(.auth-login-page, .auth-logout-page) .auth-card-foot { margin-top: 24px; padding-top: 16px; align-items: baseline; line-height: 20px; }
  :is(.auth-login-page, .auth-logout-page) .lock-dot { flex: 0 0 7px; }
  :is(.auth-login-page, .auth-logout-page) .auth-page-company { margin-top: 16px; }
}
@media (max-width: 820px) and (max-height: 540px) {
  :is(.auth-login-page, .auth-logout-page) .auth-entry { padding-top: 16px; }
  :is(.auth-login-page, .auth-logout-page) .auth-mobile-brand { margin-bottom: 12px; }
}

/* Confirmed direction: one deep-green authentication surface on every device. */
:is(.auth-login-page, .auth-logout-page) { background:var(--brand-deep); color:#fff; }
:is(.auth-login-page, .auth-logout-page) .auth-layout { display:flex; flex-direction:column; min-height:100svh; }
:is(.auth-login-page, .auth-logout-page) .auth-story { display:block; flex:none; padding:32px 40px; overflow:visible; }
:is(.auth-login-page, .auth-logout-page) .auth-entry { flex:1; min-height:0; padding:24px 24px 48px; }
:is(.auth-login-page, .auth-logout-page) .auth-card { width:min(100%,440px); }
:is(.auth-login-page, .auth-logout-page) .auth-mobile-brand { display:none; }
:is(.auth-login-page, .auth-logout-page) .auth-kicker { color:var(--accent); }
:is(.auth-login-page, .auth-logout-page) .auth-card-head h2,
:is(.auth-login-page, .auth-logout-page) .auth-form label { color:#fff; }
:is(.auth-login-page, .auth-logout-page) .auth-card-head > p:last-child,
:is(.auth-login-page, .auth-logout-page) .password-label span,
:is(.auth-login-page, .auth-logout-page) .remember-row span,
:is(.auth-login-page, .auth-logout-page) .auth-card-foot,
:is(.auth-login-page, .auth-logout-page) .auth-page-company { color:#cbd8d0; }
:is(.auth-login-page, .auth-logout-page) .auth-card-foot { border-color:rgba(255,255,255,.2); }
:is(.auth-login-page, .auth-logout-page) .lock-dot { background:var(--accent); box-shadow:none; }
:is(.auth-login-page, .auth-logout-page) .field-error { color:#ffcece; }
:is(.auth-login-page, .auth-logout-page) .auth-page-company img { background:var(--page); padding:6px 8px; border-radius:6px; width:112px; }
@media(max-width:820px) {
  :is(.auth-login-page, .auth-logout-page) .auth-story { padding:max(24px, env(safe-area-inset-top)) 24px 24px; }
  :is(.auth-login-page, .auth-logout-page) .auth-entry { padding:16px max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
}
