/* Login, sign-up and password-reset pages (원장 2154 · 2155 · handoff v5 C1–C7 · K7 · K8): the boards' narrow centred column,
   labels above fields, the full-width main button, consent rows. Form only: words, ids, hooks and element order stay as
   the pages build them. Loads after style.css and auth.css; the field size the board gives (17px) is set above phone width
   only, so auth.css keeps controls at 16px at phone width. */

/* The column: 560px wide and centred (J1-login-pc · J3-account-pc), the shared 16px gutter at phone width. */
main.account { padding: 56px max(24px, calc((100% - 560px) / 2)) 72px; }
/* The pages show and hide parts with the hidden attribute; the display rules below must not bring them back. */
main.account [hidden] { display: none !important; }
main.account h1 { margin: 0 0 24px; line-height: 1.3; letter-spacing: -0.01em; }
main.account h1 + .status { margin: -8px 0 24px; }
main.account h2 { font-size: 16px; margin: 24px 0 16px; }
main.account section { margin-top: 32px; border-top: 1px solid var(--line); }
main.account fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
main.account legend { padding: 0; margin: 0 0 8px; font-size: 15px; font-weight: 700; }
/* On the login page the legend repeats the heading right above it: kept for screen readers, not drawn twice. */
main.account #email-login-fields > legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
main.account fieldset fieldset { margin-top: 12px; }
main.account fieldset fieldset legend { margin: 0; font-size: 13px; font-weight: 600; color: var(--mn-ink2); }

/* Consent rows (J2-terms · J6-social): box, words, then the link at the far right; a 44px row. */
main.account form .row { flex-wrap: nowrap; align-items: flex-start; gap: 4px; margin: 0; }
main.account form .row > label { display: flex; align-items: flex-start; gap: 12px; flex: 1; min-width: 0; min-height: 44px; padding: 10px 0; font-size: 15px; line-height: 1.5; cursor: pointer; }
main.account form .row > label > input[type="checkbox"] { flex: 0 0 auto; margin: 2px 0 0; }
main.account form .row > a { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: flex-end; min-width: 44px; min-height: 44px; padding: 0 4px; color: var(--mn-ink2); font-size: 14px; }
main.account form .row > a:hover { color: var(--ink); }
/* The notice under a choice sits under its words (18px box + 12px gap). */
/* 원장 2463: no note under '전체 동의하기'; its row keeps the line that set it apart. */
main.account .row:has(> label > #consent-all) { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
main.account #privacy-consent-notice, main.account #diagnosis-alert-notice { margin: -6px 0 8px 30px; font-size: 13px; line-height: 1.6; color: var(--mn-ink2); }

/* Fields: the label above the input, one field to a line (J1-login · J3-account · PW2). */
main.account form .row.fields { flex-wrap: wrap; gap: 24px; margin: 24px 0 0; }
main.account legend + .row.fields { margin-top: 8px; }
/* P 09:59: '가입 정보' over the first field of the e-mail sign-up form, where the consent list ends (the h2 rule above). */
main.account h2 + .row.fields { margin-top: 0; }
main.account form .row > label.field { flex-direction: column; gap: 8px; flex: 1 1 100%; min-height: 0; padding: 0; font-size: 15px; font-weight: 600; cursor: auto; }
main.account label.field input { width: 100%; min-height: 52px; padding: 0 14px; background: var(--mn-paper); font-weight: 400; }
main.account label.field input:hover { border-color: var(--mn-charcoal); }
main.account label.field input:disabled { border-color: var(--mn-disabled-bg); background: var(--mn-disabled-bg); color: var(--mn-disabled-text); }
main.account form .status { margin: 8px 0 0; }
/* The rule under a password field sits 8px under it (J3-account · PW2), inside the row's 24px gap. */
main.account form .row.fields > p.field-hint { flex: 1 1 100%; margin: -16px 0 0; font-size: 13px; line-height: 1.6; color: var(--mn-ink2); }

/* The main button runs the column's width (56px); the code step keeps its other two buttons side by side under it. */
main.account form button.primary { width: 100%; min-height: 56px; margin-top: 24px; padding: 0 22px; font-size: 16px; }
main.account p.submit { margin: 0; }
main.account form .row.actions { flex-wrap: wrap; gap: 12px; margin: 24px 0 0; }
main.account form .row.actions > button { flex: 1 1 0; min-height: 48px; }
main.account form .row.actions > button.primary { flex: 1 1 100%; min-height: 56px; margin-top: 0; }
main.account #otp-verify { margin-top: 8px; }

/* Links under the form (J1-login): 44px tall, the first one stronger. */
main.account p.account-links { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; margin: 24px 0 0; color: var(--mn-ink2); }
main.account p.account-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--mn-ink2); font-size: 14px; font-weight: 600; text-underline-offset: 5px; text-decoration-thickness: 1px; text-decoration-color: var(--mn-line2); }
main.account p.account-links a:first-child { color: var(--ink); font-size: 15px; }

/* The official social buttons (J1s-login-social), art unchanged. Owner's instruction of 2026-11-21: Kakao on the left and Naver to its right on one line, at the same height. Each keeps
   its own picture's proportions (224:46 and 840:192, i.e. 233.74px and 210px wide at 48px); on a narrow screen the two
   shrink together, and the link stays a 48px target. */
main.account #providers { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
main.account #providers .social-btn { margin: 0; min-width: 0; }
main.account #providers .social-kakao { flex: 0 1 233.74px; }
main.account #providers .social-naver { flex: 0 1 210px; }
main.account #providers .social-btn img { width: 100%; height: auto; }
/* REQ#H-1121-1702 · X-CC2 17:31: the sign-up page's two buttons stand in the same one row (its own box id). */
main.account #signup-providers { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
main.account #signup-providers .social-btn { margin: 0; min-width: 0; }
main.account #signup-providers .social-kakao { flex: 0 1 233.74px; }
main.account #signup-providers .social-naver { flex: 0 1 210px; }
main.account #signup-providers .social-btn img { width: 100%; height: auto; }
/* 원장 2464 (e-mail sign-up's first screen): the official buttons full width, one under the other, the same height; each
   image keeps its own size, centred on its own colour, so the button is the guide's. */
main.account.signup-flow #signup-step-1 #signup-providers { flex-direction: column; align-items: stretch; gap: 8px; margin: 24px 0 8px; }
main.account.signup-flow #signup-step-1 #signup-providers > a.social-btn { display: flex; flex: none; justify-content: center; align-items: center; width: 100%; height: 52px; min-height: 52px; overflow: hidden; }
main.account.signup-flow #signup-step-1 #signup-providers > a.social-kakao { background: #FEE500; }
main.account.signup-flow #signup-step-1 #signup-providers > a.social-naver { background: #03A94D; }
main.account.signup-flow #signup-step-1 #signup-providers > a.social-btn img { width: auto; height: 46px; max-width: 100%; }
main.account.signup-flow #signup-step-1 .row:has(> label > #consent-all) { margin-top: 28px; }

/* A message the page shows after a try: an error sits in a box (U6-states-field · 로그인이 맞지 않음). */
main.account #login-message, main.account #otp-message, main.account #otp-timer { margin: 16px 0 0; }
main.account p.error:not(:empty) { padding: 10px 14px; border: 1px solid var(--mn-error); background: var(--mn-paper); font-size: 14px; font-weight: 600; }

@media (min-width: 481px) {
  main.account label.field input { font-size: 17px; }
}
@media (max-width: 480px) {
  main.account { padding: 28px 16px 48px; }
  main.account h1 { font-size: 24px; }
}
/* Ledgers 2296 · 2297. The line under the heading of a social sign-up reads as body text (no box); its link keeps a
   44px target without making the line taller. After 'this number already has an account' one large way to log in
   stands under the message: the page's main button look, or the provider's own button. */
#social-first-note { font-size: 14px; }
#social-first-note a { padding: 14px 0; white-space: nowrap; }
main.account .otp-login { margin: 12px 0 0; }
/* Login page (ledger 2297): 'or' between the provider buttons and the e-mail login, a thin line on either side. */
main.account .or-rule { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; color: var(--muted); font-size: 14px; }
main.account .or-rule::before, main.account .or-rule::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
main.account .or-rule + section { margin-top: 8px; border-top: 0; } /* the 'or' line is the divider here */
main.account a.login-way { display: flex; align-items: center; justify-content: center; min-height: 56px; padding: 0 22px; border-radius: var(--mn-radius); background: var(--accent); color: var(--mn-ivory); font-size: 16px; font-weight: 600; text-decoration: none; }
main.account a.login-way:hover { background: var(--mn-burgundy-deep); }
main.account .otp-login .social-btn { margin: 0; }
/* Login page: the account that already signs in with this e-mail (고침 B), a notice at the top, not an error box. */
main.account #login-notice { margin: 0; font-size: 14px; color: var(--ink); }
main.account #login-way { margin: 12px 0 24px; }
main.account #login-notice:not([hidden]) + #login-way[hidden] + #providers { margin-top: 24px; }

/* Three steps on the two sign-up pages. Hidden steps retain their form values in the DOM. */
/* headerFlow moves this same row beside the site logo. Its hidden controls stay hidden there too. */
:is(main.account.signup-flow, header.site#site-header) > #signup-flow-head { display: flex; align-items: center; gap: 4px 28px; }
:is(main.account.signup-flow, header.site#site-header) > #signup-flow-head button {
  min-width: 44px; min-height: 44px; padding: 0 4px; border: 0; background: none;
  color: var(--mn-charcoal); font-size: 15px; font-weight: 500; white-space: nowrap;
}
:is(main.account.signup-flow, header.site#site-header) > #signup-flow-head button:hover { text-decoration: underline; text-underline-offset: 8px; }
:is(main.account.signup-flow, header.site#site-header) > #signup-flow-head[hidden],
:is(main.account.signup-flow, header.site#site-header) > #signup-flow-head > [hidden] { display: none !important; }
main.account.signup-flow #signup-progress { margin-bottom: 24px; }
main.account.signup-flow #signup-progress p { margin: 0 0 8px; font-size: 14px; }
main.account.signup-flow #signup-count { font-weight: 600; }
main.account.signup-flow #signup-left { color: var(--mn-ink2); }
main.account.signup-flow #signup-progress ol {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  margin: 0; padding: 0;
}
main.account.signup-flow #signup-progress li {
  display: block; min-width: 0; padding-top: 6px; border-top: 3px solid var(--mn-line);
  color: var(--mn-ink2); font-size: 14px; line-height: 20px; overflow-wrap: anywhere;
}
main.account.signup-flow #signup-progress li[aria-current="step"] { color: var(--mn-burgundy); border-color: currentColor; font-weight: 700; }

main.account.signup-flow :is(#signup-step-1, #signup-step-2, #signup-step-3, #signup-verification, #signup-done) { margin-top: 0; border-top: 0; }
main.account.signup-flow p.signup-field-error { margin: 4px 0 12px; padding: 0; border: 0; background: transparent; color: var(--mn-error); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
main.account.signup-flow .signup-field-error:empty { margin: 0; padding: 0; border: 0; }
/* OTP flow owns the two forms. Their submit buttons are next to the live status, outside the forms. */
main.account.signup-flow .signup-send-action,
main.account.signup-flow .signup-verify-actions { margin: 24px 0 0; }
main.account.signup-flow .signup-verify-actions { display: flex; flex-wrap: wrap; gap: 12px; }
main.account.signup-flow .signup-verify-actions > button { flex: 1 1 0; min-width: 44px; min-height: 48px; }
main.account.signup-flow .signup-send-action > button.primary,
main.account.signup-flow .signup-verify-actions > button.primary { flex-basis: 100%; width: 100%; min-height: 56px; margin: 0; padding: 8px 22px; font-size: 16px; }
main.account.signup-flow #signup-verification > #otp-verify[hidden] ~ .signup-verify-actions,
main.account.signup-flow #signup-verification > #otp-verify:not([hidden]) ~ .signup-send-action { display: none; }
/* The provider artwork now sits inside a form row, whose ordinary links have extra padding. */
main.account.signup-flow #signup-providers > a.social-btn { min-height: 48px; padding: 0; }
main.account.signup-flow #social-first-note a { display: inline-flex; align-items: center; min-height: 44px; padding: 0; vertical-align: middle; }
main.account.signup-flow #signup-done { overflow-wrap: anywhere; }
main.account.signup-flow #signup-done dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin: 0; }
main.account.signup-flow #signup-done dt { color: var(--mn-ink2); }
main.account.signup-flow #signup-done dd { margin: 0; min-width: 0; }
main.account.signup-flow #signup-done a { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; }
main.account.signup-flow #signup-done a.primary {
  display: flex; justify-content: center; width: 100%; min-height: 56px; padding: 8px 22px;
  border: 1px solid var(--mn-burgundy); border-radius: var(--mn-radius);
  background: var(--mn-burgundy); color: var(--mn-ivory); font-weight: 600; text-decoration: none;
}
main.account.signup-flow #signup-done a.primary:hover { background: var(--mn-burgundy-deep); }
main.account.signup-flow #signup-close-dialog {
  box-sizing: border-box; width: min(480px, calc(100% - 32px)); max-width: 100%;
  max-height: calc(100% - 32px); overflow: auto; padding: 24px;
  border: 1px solid var(--mn-line2); background: var(--mn-paper); color: var(--ink); overflow-wrap: anywhere;
}
main.account.signup-flow #signup-close-dialog::backdrop { background: rgb(45 37 40 / 45%); }
main.account.signup-flow #signup-close-dialog button { min-width: 44px; min-height: 44px; }
/* 원장 2460 · 허브 16:15 (e-mail sign-up, design J1 · J4): the kept line and the login link on one line (the link at the
   end; on a phone the link goes under it), and the time left beside the code field. */
/* 원장 2465: the owner's line under the title, then the kept line and the login link on one line (the link at the end; on a
   phone the link goes under it). */
main.account.signup-flow #signup-lead { margin: 8px 0 0; }
main.account.signup-flow #signup-intro { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 16px; margin: 12px 0 0; }
main.account.signup-flow #signup-intro > p { margin: 0; }
main.account.signup-flow #signup-intro > p.account-links { margin-left: auto; }
@media (max-width: 480px) {
  main.account.signup-flow #signup-intro { flex-direction: column; align-items: flex-start; }
  main.account.signup-flow #signup-intro > p.account-links { margin-left: 0; }
}
main.account.signup-flow:has(#signup-intro) #signup-verification { display: grid; grid-template-columns: minmax(0, 1fr) fit-content(40%); column-gap: 12px; }
main.account.signup-flow:has(#signup-intro) #signup-verification:is([hidden]) { display: none; }
main.account.signup-flow:has(#signup-intro) #signup-verification > * { grid-column: 1 / -1; min-width: 0; }
main.account.signup-flow:has(#signup-intro) #signup-verification > #otp-verify:not([hidden]) { grid-column: 1; }
main.account.signup-flow:has(#signup-intro) #signup-verification > #otp-verify:not([hidden]) + #otp-timer { grid-column: 2; align-self: end; margin: 0 0 14px; font-weight: 700; }
/* J4: once a code is sent, [다시 받기] sits beside the phone number (the number's field ends where this block starts; the
   button stays where it is in the page, outside the locked fields, so it still works while they are locked). */
main.account.signup-flow:has(#signup-intro) #signup-verification { position: relative; }
main.account.signup-flow:has(#signup-intro):has(#otp-verify:not([hidden])) #phone-row input { width: calc(100% - 112px); }
main.account.signup-flow:has(#signup-intro) #signup-verification > #otp-verify:not([hidden]) ~ .signup-verify-actions > #otp-resend {
  position: absolute; top: -52px; right: 0; width: 100px; min-height: 0; height: 52px; padding: 0 8px; font-size: 15px; }

@media (max-width: 480px) and (min-height: 560px) {
  main.account.signup-flow :is(#signup-step-1, #signup-step-2) > .submit {
    position: sticky;
    bottom: 0;
    z-index: 1;
    padding: 12px 0 max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--mn-line);
    background: var(--mn-ivory);
  }
  main.account.signup-flow :is(#signup-next-1, #signup-next-2) { margin-top: 0; }
  html:has(main.signup-flow :is(#signup-step-1, #signup-step-2):not([hidden])) {
    scroll-padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }
}
