:root {
  --navy: #12324f;
  --navy-deep: #0b2238;
  --teal: #0d8582;
  --teal-dark: #086b69;
  --text: #17212b;
  --muted: #65727f;
  --line: #dfe5e9;
  --surface: #ffffff;
  --canvas: #f3f6f7;
  --danger: #b42318;
  font-family: "Segoe UI", "Malgun Gothic", Arial, sans-serif;
  color: var(--text);
  background: var(--canvas);
  letter-spacing: 0;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(310px, 38%) minmax(0, 1fr); }
.auth-brand { position: relative; display: flex; flex-direction: column; min-height: 100vh; padding: 48px clamp(32px, 5vw, 74px); color: #fff; background: var(--navy-deep); overflow: hidden; }
.auth-brand::after { content: ""; position: absolute; inset: auto 0 0; height: 8px; background: var(--teal); }
.brand-mark { width: min(225px, 100%); padding: 5px; border-radius: 7px; background: #fff; box-shadow: 0 10px 24px rgba(0,0,0,.17); }
.brand-mark img { width: 100%; display: block; border-radius: 4px; }
.brand-copy { margin: auto 0; max-width: 440px; }
.brand-copy p { margin: 0 0 18px; color: #84d2ce; font-size: 12px; font-weight: 700; }
.brand-copy h1 { margin: 0 0 18px; font-size: clamp(30px, 3.2vw, 42px); line-height: 1.15; word-break: keep-all; }
.brand-copy > span { display: block; max-width: 380px; color: #c7d4df; font-size: 15px; line-height: 1.75; }
.security-note { display: flex; align-items: center; gap: 13px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.14); }
.security-note > svg { width: 24px; height: 24px; color: #53c2bb; }
.security-note div { display: grid; gap: 4px; }
.security-note strong { font-size: 13px; }
.security-note span { color: #9fb2c3; font-size: 11px; }

.auth-workspace { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 36px 28px 22px; }
.auth-panel { width: min(100%, 650px); padding: 34px 38px 30px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 42px rgba(18,50,79,.09); }
.auth-panel-head { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.auth-symbol { width: 46px; height: 46px; display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: var(--teal); border-radius: 6px; }
.auth-symbol svg { width: 24px; height: 24px; }
.auth-panel-head h2 { margin: 2px 0 0; font-size: 23px; }
.eyebrow { margin: 0; color: var(--teal-dark); font-size: 10px; font-weight: 800; }

.role-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; margin-bottom: 23px; background: #edf1f3; border: 1px solid #e1e7ea; border-radius: 6px; }
.role-switch button { min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 0; color: var(--muted); background: transparent; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 700; }
.role-switch button.active { color: var(--navy); background: #fff; box-shadow: 0 1px 5px rgba(18,50,79,.1); }
.role-switch svg { width: 17px; height: 17px; }

.auth-form { display: grid; gap: 17px; }
.auth-form.form-grid { grid-template-columns: 1fr 1fr; }
.form-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 17px; }
.auth-form label { min-width: 0; display: grid; gap: 7px; color: #384653; font-size: 12px; font-weight: 700; }
.auth-form label small { color: var(--muted); font-size: 10px; font-weight: 400; }
.employment-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.employment-field legend { margin-bottom: 7px; color: #384653; font-size: 12px; font-weight: 700; }
.employment-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.employment-switch label { cursor: pointer; }
.employment-switch input { position: absolute; opacity: 0; pointer-events: none; }
.employment-switch span { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); background: #f6f8f9; border: 1px solid #d5dde2; border-radius: 5px; transition: border-color .15s, background .15s, color .15s; }
.employment-switch input:checked + span { color: var(--navy); background: #eef8f7; border-color: var(--teal); box-shadow: 0 0 0 2px rgba(13,133,130,.09); }
.employment-switch input:focus-visible + span { outline: 3px solid rgba(13,133,130,.2); outline-offset: 1px; }
.employment-switch svg { width: 17px; height: 17px; }
.input-wrap { min-width: 0; height: 45px; display: flex; align-items: center; gap: 9px; padding: 0 12px; background: #fff; border: 1px solid #ccd6dc; border-radius: 5px; transition: border-color .15s, box-shadow .15s; }
.input-wrap:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,133,130,.12); }
.input-wrap svg { width: 17px; height: 17px; flex: 0 0 auto; color: #82909c; }
.input-wrap input,
.input-wrap select { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; }
.input-wrap input[readonly] { color: #53616d; background: #f4f7f8; cursor: default; }
.form-wide { grid-column: 1 / -1; }
.auth-submit { min-height: 47px; display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 4px; border: 1px solid var(--teal-dark); color: #fff; background: var(--teal); border-radius: 5px; cursor: pointer; font-weight: 800; }
.auth-submit:hover { background: var(--teal-dark); }
.auth-submit:disabled { cursor: wait; opacity: .65; }
.auth-submit svg { width: 18px; height: 18px; }

.auth-message { margin-top: 16px; padding: 11px 13px; color: var(--danger); background: #fff1f0; border: 1px solid #ffd1cc; border-radius: 5px; font-size: 12px; line-height: 1.5; }
.auth-message.success { color: #146c38; background: #edf8f1; border-color: #c8ead4; }
.auth-footer { display: flex; justify-content: center; gap: 8px; margin-top: 24px; padding-top: 20px; color: var(--muted); border-top: 1px solid #edf0f2; font-size: 12px; }
.auth-footer a, .pending-state a { color: var(--teal-dark); font-weight: 800; text-decoration: none; }
.auth-install-button { width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; border: 1px solid #d9e2e7; border-radius: 5px; color: #23445b; background: #f7fafb; cursor: pointer; font: inherit; font-size: 12px; font-weight: 800; }
.auth-install-button:hover { border-color: #91aaa9; background: #eef5f5; }
.auth-install-button svg { width: 16px; height: 16px; }
.pending-state { padding: 22px 0 10px; text-align: center; }
.pending-state > span { width: 60px; height: 60px; display: grid; place-items: center; margin: 0 auto 17px; color: #a75b00; background: #fff5e8; border-radius: 50%; }
.pending-state svg { width: 28px; height: 28px; }
.pending-state h2 { margin: 0 0 9px; font-size: 22px; }
.pending-state p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.pending-state .pending-id { width: fit-content; margin: -7px auto 20px; padding: 8px 12px; color: var(--navy); background: #eef5f8; border: 1px solid #d4e1e8; border-radius: 4px; font-weight: 800; }
.auth-workspace footer { margin-top: 22px; color: #87939c; font-size: 10px; }
[hidden] { display: none !important; }

@media (max-width: 780px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { min-height: auto; padding: 22px 20px; }
  .brand-mark { width: 150px; padding: 3px; }
  .brand-copy { margin: 28px 0 18px; }
  .brand-copy h1 { font-size: 27px; }
  .brand-copy > span, .security-note { display: none; }
  .auth-workspace { min-height: auto; padding: 18px 12px 24px; }
  .auth-panel { padding: 25px 20px 24px; }
}

@media (max-width: 520px) {
  .auth-form.form-grid { grid-template-columns: 1fr; }
  .form-pair { grid-template-columns: 1fr; }
  .form-wide { grid-column: auto; }
  .role-switch button { flex-direction: column; min-height: 50px; gap: 3px; font-size: 11px; }
}

/* v3.43 mobile viewport stabilization */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body,
.auth-shell {
  min-height: 100dvh;
}

@media (max-width: 780px) {
  .auth-brand {
    padding: max(22px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 22px max(20px, env(safe-area-inset-left));
  }

  .auth-workspace {
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
}
