/* ==========================================================================
   auth.css — 會員 auth 頁共用樣式（body.lg-auth scope）
   LG-260927 / LG-03＋LG-04：
   - 全部規則以 body.lg-auth 或 .lg-auth 子元素起頭；不引入全域
     .btn/.container 汙染；零入場動畫（A19-noanim，Gate 2 stale 合成層教訓）。
   - LG-04 已兌現 LG-03 銜接約定：LEGACY 區塊（activate.html 舊樣式）整段
     刪除；activate.html 同票改版為 lg-* DOM，並以 scoped 規則承接
     `.hidden`（M3 舊 OTP 區塊 class="hidden" 語意）與 `input[readonly]`
     （唯讀 Email）。
   - tokens 與 css/login.css（LG-02）同值；三頁（login/forgot/activate）各自
     載入本檔或 login.css，改動時請同步核對。
   ========================================================================== */

/* ── LG-03/LG-04 共用 scoped 樣式（每條以 body.lg-auth 或 .lg-auth 起頭）────
   body.lg-auth 之 padding/display 與 h1/h2/p 之 text-align/color 為明確宣告
   （防禦未來再出現元素級全域規則；LG-04 已刪除 LEGACY 區塊）。 */
body.lg-auth {
    --mc-bg: #F7F6F1;
    --mc-paper: #FFFEFA;
    --mc-ink: #213F36;
    --mc-green: #234D40;
    --mc-green-dark: #183C30;
    --mc-green-soft: #E8EDE1;
    --mc-green-tint: #EDF1E9;
    --mc-line: #E1E4D9;
    --mc-muted: #5F6E63;
    --mc-orange: #BC6848;
    --mc-orange-ink: #9C4F2E;
    --mc-sand: #F4E7D7;
    margin: 0;
    padding: 0;        /* 中和 legacy body { padding: 20px } */
    display: block;    /* 中和 legacy body { display: flex; ... } 置中 */
    background: var(--mc-bg);
    color: var(--mc-ink);
    font: 14px/1.7 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
    min-height: 100vh;
}

.lg-auth * { box-sizing: border-box; }
.lg-auth [hidden] { display: none !important; }
/* M3 承接：activate.html 舊 OTP 區塊／訊息以 class="hidden" 隱藏（原 LEGACY
   .hidden{display:none} 已刪；本規則僅作用 body.lg-auth 三頁，login/forgot
   不使用 .hidden，零外溢） */
.lg-auth .hidden { display: none !important; }
.lg-auth a { color: inherit; text-underline-offset: 5px; }
.lg-auth button,
.lg-auth input,
.lg-auth select { font: inherit; }
.lg-auth button,
.lg-auth a,
.lg-auth input,
.lg-auth select { -webkit-tap-highlight-color: transparent; }
.lg-auth button { cursor: pointer; }
.lg-auth :focus-visible { outline: 3px solid var(--mc-orange); outline-offset: 4px; }
.lg-auth h1,
.lg-auth h2,
.lg-auth p { margin: 0; text-align: left; color: var(--mc-ink); }
/* 承接 LG-03 實際渲染：原 LEGACY `p{line-height:1.6}` 對 forgot/activate 所有
 * p 元素生效（footnote/help/eyebrow 等未自設 line-height 者）；LEGACY 刪除後
 * 以本規則凍結同值，forgot 視覺零變更（A22 bytes 比對基準）。
 * .lg-story p（1.95）／.lg-sub（1.9）自有宣告不受影響；login.html 不載本檔
 * 維持 1.7——三頁行高差異列未決事項（LG-05／業主視覺驗收統一）。
 * .lg-story h1（1.5）與 dialog h2 等非 p 元素不受本規則影響。 */
.lg-auth p { line-height: 1.6; }

/* ── 版面 ─────────────────────────────────────────────────────────────── */
.lg-auth .lg-wrap { max-width: 1140px; margin: auto; padding: 40px 32px 24px; }
.lg-auth .lg-eyebrow { font-size: 10px; letter-spacing: .17em; font-weight: 600; color: var(--mc-muted); }
.lg-auth .lg-breadcrumb { margin-bottom: 24px; }
.lg-auth .lg-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; min-height: 660px; }

/* 左側品牌區（葉片延續會員中心，與 login.html 同構） */
.lg-auth .lg-story { min-height: 640px; background: var(--mc-green-soft); border: 1px solid #DFE5D6; border-radius: 24px; position: relative; overflow: hidden; padding: 46px 40px; display: flex; flex-direction: column; justify-content: space-between; }
.lg-auth .lg-story h1 { font-size: 42px; line-height: 1.5; letter-spacing: .035em; font-weight: 600; margin: 22px 0 16px; position: relative; z-index: 1; }
.lg-auth .lg-story h1 span { color: #5A7455; }
.lg-auth .lg-story p { color: #516349; line-height: 1.95; position: relative; z-index: 1; }
.lg-auth .lg-plant { width: 310px; height: 322px; position: absolute; right: -9px; bottom: 60px; }
.lg-auth .lg-story-note { border-top: 1px solid #CCD8BB; padding-top: 18px; font-size: 12px; display: flex; justify-content: space-between; gap: 10px; position: relative; z-index: 1; }

/* 右側表單區 */
.lg-auth .lg-form-area { min-width: 0; padding: 24px 0; max-width: 440px; width: 100%; margin: auto; }
.lg-auth .lg-kicker { display: flex; align-items: center; gap: 8px; color: var(--mc-orange-ink); font-size: 11px; letter-spacing: .13em; font-weight: 600; margin-bottom: 10px; }
.lg-auth .lg-kicker:before { content: ''; height: 1px; width: 22px; background: var(--mc-orange); }
.lg-auth .lg-form-area h2 { font-size: 29px; letter-spacing: .015em; font-weight: 600; line-height: 1.5; }
.lg-auth .lg-sub { color: var(--mc-muted); margin: 10px 0 26px; line-height: 1.9; overflow-wrap: anywhere; }
.lg-auth .lg-sub strong { color: var(--mc-ink); overflow-wrap: anywhere; }

/* ── stepper（三段進度：aria-current=step 當前、.done 已完成）──────────── */
.lg-auth .lg-stepper { display: flex; list-style: none; padding: 0; margin: 0 0 30px; gap: 8px; font-size: 11px; color: var(--mc-muted); }
.lg-auth .lg-stepper li { flex: 1; border-top: 2px solid var(--mc-line); padding-top: 10px; }
.lg-auth .lg-stepper li[aria-current=step] { border-color: var(--mc-green); color: var(--mc-green); font-weight: 700; }
.lg-auth .lg-stepper .done { border-color: #93A784; }

/* ── 欄位 ─────────────────────────────────────────────────────────────── */
.lg-auth .lg-field { margin-bottom: 20px; min-width: 0; }
.lg-auth label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.lg-auth input { width: 100%; min-width: 0; height: 52px; padding: 12px 15px; border: 1px solid #C6CFC1; border-radius: 10px; background: var(--mc-paper); color: var(--mc-ink); font-size: 16px; }
.lg-auth input::placeholder { color: #728073; font-size: 14px; }
.lg-auth input:focus { border-color: var(--mc-green); }
.lg-auth input[readonly] { background: var(--mc-green-tint); }
.lg-auth .lg-help { font-size: 12px; color: var(--mc-muted); margin-top: 7px; }
.lg-auth .lg-code { font-size: 26px; letter-spacing: .42em; text-align: center; font-variant-numeric: tabular-nums; height: 66px; }
.lg-auth .lg-password { position: relative; }
.lg-auth .lg-password input { padding-right: 68px; }
.lg-auth .lg-reveal { position: absolute; right: 4px; top: 4px; height: 44px; min-width: 54px; border: 0; background: none; color: var(--mc-muted); font-size: 12px; border-radius: 7px; }
.lg-auth .lg-policy { padding: 14px 16px; border-radius: 10px; background: var(--mc-green-tint); font-size: 12px; color: var(--mc-muted); margin-bottom: 22px; }

/* ── 按鈕與連結 ───────────────────────────────────────────────────────── */
.lg-auth .lg-btn { min-height: 50px; border: 1px solid var(--mc-green); border-radius: 10px; background: var(--mc-green); color: var(--mc-paper); padding: 12px 20px; font-weight: 600; width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; }
.lg-auth .lg-btn:hover { background: var(--mc-green-dark); }
.lg-auth .lg-btn:disabled { opacity: .55; cursor: wait; }
.lg-auth .lg-secondary { background: transparent; color: var(--mc-green); border-color: #C6CFC1; margin-top: 12px; }
.lg-auth .lg-secondary:hover { background: var(--mc-green-tint); }
.lg-auth .lg-bottom-link { display: flex; justify-content: center; margin-top: 24px; font-size: 13px; }
.lg-auth .lg-bottom-link a { min-height: 44px; display: flex; align-items: center; }
.lg-auth .lg-footnote { margin-top: 28px; border-top: 1px solid var(--mc-line); padding-top: 20px; font-size: 12px; color: var(--mc-muted); display: flex; gap: 10px; align-items: flex-start; }
.lg-auth .lg-footnote svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; }

/* ── 行內訊息（三組 message 區共用樣式） ──────────────────────────────── */
.lg-auth .lg-alert { padding: 14px 16px; border: 1px solid #DFBEAC; background: var(--mc-sand); color: #864329; border-radius: 10px; font-size: 13px; margin: 0 0 20px; overflow-wrap: anywhere; }
.lg-auth .lg-alert[data-kind=success] { background: var(--mc-green-tint); border-color: #C6D2B7; color: var(--mc-green); }
.lg-auth .lg-alert[data-kind=loading] { background: var(--mc-green-tint); border-color: var(--mc-line); color: var(--mc-muted); }

.lg-auth .lg-footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--mc-line); font-size: 11px; color: var(--mc-muted); }

/* ── D02 完成彈窗 ─────────────────────────────────────────────────────── */
.lg-auth dialog { border: 1px solid var(--mc-line); border-radius: 20px; background: var(--mc-paper); color: var(--mc-ink); width: min(440px, calc(100% - 32px)); padding: 32px; max-height: calc(100dvh - 40px); overflow: auto; }
.lg-auth dialog::backdrop { background: rgb(24 60 48 / 38%); }
.lg-auth .lg-dialog-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--mc-green-soft); display: grid; place-items: center; font-size: 24px; margin-bottom: 20px; }
.lg-auth dialog h2 { font-size: 24px; margin-bottom: 12px; }
.lg-auth dialog p { color: var(--mc-muted); margin-bottom: 26px; overflow-wrap: anywhere; }
.lg-auth .lg-close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; background: none; border: 0; font-size: 22px; color: var(--mc-muted); }

/* ── 響應式 ───────────────────────────────────────────────────────────── */
/* 零入場動畫（A19-noanim）：不移植 reference.css 的 lg-arrive（Gate 2 stale
 * 合成層教訓，LG-02 已自 login.css 移除）；不再新增任何動畫。 */
@media (max-width: 1000px) {
    .lg-auth .lg-layout { gap: 32px; }
    .lg-auth .lg-story { padding: 36px 28px; }
    .lg-auth .lg-story h1 { font-size: 35px; }
    .lg-auth .lg-plant { width: 270px; }
}
@media (max-width: 820px) {
    .lg-auth .lg-wrap { padding: 26px 24px 20px; max-width: 620px; }
    .lg-auth .lg-layout { display: block; min-height: 0; }
    .lg-auth .lg-story { min-height: 180px; padding: 24px 26px; border-radius: 18px; margin-bottom: 28px; }
    .lg-auth .lg-story h1 { font-size: 26px; margin: 8px 0; line-height: 1.55; }
    .lg-auth .lg-story h1 br { display: none; }
    .lg-auth .lg-story > div > p { font-size: 12px; max-width: 75%; }
    .lg-auth .lg-story .lg-eyebrow { font-size: 9px; }
    .lg-auth .lg-plant { width: 145px; height: 158px; right: -24px; bottom: -30px; opacity: .7; }
    .lg-auth .lg-story-note { display: none; }
    .lg-auth .lg-form-area { padding: 4px 0 10px; max-width: none; }
    .lg-auth .lg-form-area h2 { font-size: 26px; }
    .lg-auth .lg-breadcrumb { margin-bottom: 16px; }
    .lg-auth .lg-footer { font-size: 10px; }
}
@media (max-width: 360px) {
    .lg-auth .lg-wrap { padding: 20px 16px; }
    .lg-auth .lg-story { padding: 20px; }
    .lg-auth .lg-story h1 { font-size: 23px; }
    .lg-auth .lg-story > div > p { max-width: 90%; }
    .lg-auth .lg-stepper { gap: 5px; font-size: 10px; }
    .lg-auth dialog { padding: 26px 20px; }
}
@media (prefers-reduced-motion: reduce) {
    .lg-auth * { animation: none !important; scroll-behavior: auto !important; }
}
