:root {
  --page: #f3f2ef;
  --panel: #fff;
  --line: #dedbd6;
  --text: #211f1c;
  --muted: #6f6a63;
  --accent: #8f4a2b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--text);
  background: var(--page);
}

.card {
  width: min(400px, 100%);
  display: grid;
  gap: 20px;
  padding: 32px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(33, 31, 28, 0.08);
}

h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lead,
.status-message {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-message:empty,
#errorMessage:empty {
  display: none;
}

.users-section {
  display: grid;
  gap: 12px;
}

.idpw-section {
  display: grid;
  gap: 14px;
}

.idpw-field {
  display: grid;
  gap: 7px;
}

.idpw-field > span,
.idpw-field > label {
  color: var(--muted);
  font-size: 12px;
}

.idpw-field > input,
.credential-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 12px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}

.idpw-field > input:focus,
.credential-input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(143, 74, 43, 0.12);
}

.credential-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: stretch;
}

.credential-input-shell {
  position: relative;
}

.credential-input {
  padding-right: 12px;
}

.password-visibility-btn {
  width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
}

.password-visibility-btn:hover {
  color: var(--text);
  border-color: rgba(143, 74, 43, 0.28);
  background: #faf9f7;
}

.password-visibility-btn:focus-visible {
  outline: 2px solid rgba(143, 74, 43, 0.42);
  outline-offset: 1px;
}

.password-eye-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.password-eye-slash {
  display: none;
}

.password-visibility-btn[aria-pressed="true"] .password-eye-slash {
  display: block;
}

.credential-input-shell.is-otp {
  min-height: 44px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.credential-input-shell.is-otp:focus-within {
  border-color: var(--accent);
  outline: 2px solid rgba(143, 74, 43, 0.12);
}

.credential-input-shell.is-otp .credential-input {
  position: absolute;
  inset: 0;
  z-index: 1;
  min-height: 100%;
  border: 0;
  padding: 0;
  opacity: 0;
  color: transparent;
  caret-color: transparent;
  background: transparent;
}

.credential-input-shell.is-otp .credential-input:focus {
  border: 0;
  outline: 0;
}

.otp-code-cells {
  min-height: 42px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  pointer-events: none;
}

.otp-code-cells[hidden] {
  display: none;
}

.otp-code-cell {
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}

.otp-code-cell:last-child {
  border-right: 0;
}

.otp-code-cell.is-active {
  background: rgba(143, 74, 43, 0.06);
}

.users-grid {
  display: grid;
  gap: 8px;
}

.user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.user-card:hover {
  background: #faf9f7;
  border-color: rgba(143, 74, 43, 0.22);
}

.user-card:focus-visible {
  outline: 2px solid rgba(143, 74, 43, 0.65);
  outline-offset: 2px;
}

.user-card-info strong {
  font-size: 14px;
  font-weight: 600;
}

.user-card-actions {
  flex-shrink: 0;
}

#errorMessage {
  color: #b42318;
  font-size: 13px;
  line-height: 1.45;
}

.auth-modal[hidden] {
  display: none;
}

.auth-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 17, 14, 0.42);
  z-index: 1000;
}

.auth-modal-card {
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 20px 50px rgba(28, 20, 15, 0.18);
}

.auth-modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.auth-modal-header h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.auth-modal-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-modal-close {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(69, 58, 49, 0.12);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.auth-modal-close:hover {
  border-color: rgba(143, 74, 43, 0.22);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
}

.auth-modal-setup {
  display: grid;
  gap: 12px;
}

.auth-modal-qr-wrap {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(122, 98, 74, 0.12);
  background: rgba(255, 255, 255, 0.72);
}

.auth-modal-qr {
  width: 220px;
  height: 220px;
  image-rendering: pixelated;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(73, 49, 25, 0.08);
}

.auth-modal-qr-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.auth-modal-field {
  display: grid;
  gap: 6px;
}

.auth-modal-field label,
.auth-modal-field > span {
  color: var(--muted);
  font-size: 12px;
}

.auth-modal-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.auth-modal-copy-row code {
  display: block;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(69, 58, 49, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
}

.auth-code-field {
  gap: 8px;
}

.auth-code-shell {
  position: relative;
}

.auth-code-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  padding: 0;
  opacity: 0;
  color: transparent;
  caret-color: transparent;
  background: transparent;
}

.auth-code-input:focus {
  outline: none;
}

.auth-code-shell:focus-within .auth-code-cells {
  border-color: rgba(143, 74, 43, 0.42);
  box-shadow: 0 0 0 4px rgba(143, 74, 43, 0.07);
}

.auth-code-cells {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border-radius: 18px;
  border: 1px solid rgba(69, 58, 49, 0.12);
  background: rgba(248, 246, 241, 0.88);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.auth-code-cell {
  display: grid;
  place-items: center;
  min-height: 58px;
  border-radius: 12px;
  border: 1px solid rgba(69, 58, 49, 0.08);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.auth-code-cell.is-filled {
  border-color: rgba(143, 74, 43, 0.18);
}

.auth-code-cell.is-active {
  border-color: rgba(143, 74, 43, 0.42);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: inset 0 0 0 1px rgba(143, 74, 43, 0.06);
}

.auth-modal-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.auth-modal-actions button,
.auth-modal-copy-row button,
.login-btn {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 14px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.auth-modal-actions button:hover,
.auth-modal-copy-row button:hover,
.login-btn:hover {
  border-color: rgba(143, 74, 43, 0.22);
  background: #faf9f7;
}

.auth-modal-actions .primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.login-btn.primary {
  width: 100%;
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

@media (max-width: 640px) {
  .card,
  .auth-modal-card {
    padding: 22px;
    border-radius: 14px;
  }

  h1 {
    font-size: 26px;
  }

  .auth-modal-copy-row {
    grid-template-columns: 1fr;
  }

  .auth-code-cells {
    gap: 8px;
  }

  .auth-code-cell {
    min-height: 50px;
    font-size: 20px;
  }

  .auth-modal-actions {
    flex-direction: column-reverse;
  }

  .auth-modal-actions button,
  .auth-modal-copy-row button {
    width: 100%;
  }
}
