:root {
  --auth-bg: #f1f5f9;
  --auth-surface: #ffffff;
  --auth-soft: #f8fafc;
  --auth-line: #e2e8f0;
  --auth-line-strong: #cbd5e1;
  --auth-text: #0f172a;
  --auth-muted: #64748b;
  --auth-primary: #2563eb;
  --auth-primary-strong: #1d4ed8;
  --auth-primary-soft: #eff6ff;
  --auth-danger: #b42318;
  --auth-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Arial, sans-serif;
  color: var(--auth-text);
  background: var(--auth-bg);
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--auth-bg);
}

button,
input,
select {
  font: inherit;
}

.auth-header {
  min-height: 68px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--auth-line);
  background: var(--auth-surface);
  color: var(--auth-muted);
  font-size: 14px;
}

.brand {
  color: var(--auth-primary);
  font-size: 20px;
  font-weight: 800;
  text-decoration: none;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
  line-height: 1;
}

.site-logo img {
  display: block;
  width: 170px;
  height: 38px;
  object-fit: contain;
}

.auth-container {
  flex: 1;
  width: 100%;
  padding: 32px 16px;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(100%, 480px);
  padding: 32px;
  display: grid;
  gap: 18px;
  border: 1px solid var(--auth-line);
  border-radius: 8px;
  background: var(--auth-surface);
  box-shadow: var(--auth-shadow);
}

.auth-heading {
  text-align: center;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.25;
}

h2 {
  font-size: 18px;
}

.auth-heading p {
  margin: 8px 0 0;
  color: var(--auth-muted);
  font-size: 14px;
}

.invite-context-notice {
  display: grid;
  gap: 5px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px 14px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
  line-height: 1.5;
}

.invite-context-notice strong {
  color: var(--auth-primary-strong);
  font-size: 14px;
}

.invite-context-notice span {
  color: #475569;
}

.role-tabs {
  display: flex;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--auth-line);
  border-radius: 8px;
  background: var(--auth-soft);
}

.role-tab {
  min-height: 40px;
  flex: 1;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--auth-muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.role-tab.active {
  background: var(--auth-surface);
  color: var(--auth-primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.auth-form,
.role-fields {
  display: none;
  gap: 14px;
}

.auth-form.active,
.role-fields:not([hidden]) {
  display: grid;
}

.role-fields {
  padding: 14px;
  border: 1px solid var(--auth-line);
  border-radius: 8px;
  background: var(--auth-soft);
}

.form-group {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.form-group input,
.form-group select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--auth-line-strong);
  border-radius: 6px;
  background: var(--auth-surface);
  color: var(--auth-text);
  font-weight: 500;
}

.form-group input[type="file"] {
  min-height: auto;
  padding: 9px 12px;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--auth-muted);
}

.compact {
  font-size: 12px;
}

.text-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--auth-muted);
  cursor: pointer;
}

.btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.btn-primary {
  border: 1px solid var(--auth-primary);
  background: var(--auth-primary);
  color: #ffffff;
}

.btn-primary:hover {
  border-color: var(--auth-primary-strong);
  background: var(--auth-primary-strong);
}

.btn-outline {
  border: 1px solid var(--auth-line-strong);
  background: var(--auth-surface);
  color: #334155;
}

.btn-outline:hover,
.hospital-item:hover {
  border-color: var(--auth-primary);
  background: var(--auth-primary-soft);
}

.consent-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.consent-group.consent-required {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}

.consent-group.consent-required a {
  color: #1d4ed8;
}

.consent-group label {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.notice,
.status {
  margin: 0;
  color: var(--auth-muted);
  font-size: 13px;
}

.notice {
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--auth-primary-soft);
}

.status {
  min-height: 20px;
}

.status.error {
  color: var(--auth-danger);
}

/* 요청이 접수됐음을 눈에 띄게 보여 준다. */
.status.success {
  padding: 10px 12px;
  border: 1px solid #b7e4c7;
  border-radius: 6px;
  background: #f0fbf4;
  color: #1b6b3a;
  line-height: 1.6;
}

.auth-form button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.account-lookup-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--auth-text);
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #94a3b8;
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--auth-line);
}

.social-btn-group {
  display: grid;
  gap: 8px;
}

/* Social signup/login is temporarily paused. Keep the markup for later re-enable. */
.divider,
.social-btn-group {
  display: none !important;
}

.social-btn {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--auth-line);
  border-radius: 6px;
  background: var(--auth-surface);
  color: #334155;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.kakao-dot {
  color: #f2cf00;
}

.naver-mark {
  color: #03cf5d;
}

.hospital-list {
  max-height: 260px;
  display: grid;
  gap: 8px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--auth-line);
  border-radius: 6px;
  background: var(--auth-surface);
}

.hospital-list[hidden] {
  display: none;
}

.hospital-list-message {
  margin: 4px;
  color: var(--auth-muted);
  font-size: 13px;
  font-weight: 500;
}

.hospital-item {
  min-height: 70px;
  padding: 12px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--auth-line);
  border-radius: 6px;
  background: var(--auth-surface);
  color: var(--auth-text);
  text-align: left;
  cursor: pointer;
}

.hospital-item strong {
  color: var(--auth-primary);
}

.hospital-item span {
  color: var(--auth-muted);
  font-size: 12px;
}

@media (max-width: 560px) {
  .auth-header {
    padding: 0 16px;
  }

  .auth-card {
    padding: 24px 18px;
  }

  .role-tabs,
  .consent-group {
    grid-template-columns: 1fr;
  }

  .role-tabs {
    display: grid;
  }
}

/* 일회용 코드로 로그인을 넘겨받는 동안에는 로그인 화면 대신 안내만 보인다(2026-11-16). */
html.auth-handoff .auth-container { display: none; }
html.auth-handoff body::after { content: "IOPLATE 화면을 여는 중입니다…"; display: block; margin: 96px auto; text-align: center; color: #475569; font-size: 15px; font-weight: 600; }
