/* Hộp đăng nhập / đăng ký nổi trên website. Dùng biến màu của site.css.
   Thiết kế gọn để vừa một màn hình laptop, không phải cuộn. */
.am-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(16, 37, 58, .42);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; transition: opacity .18s ease;
}
.am-backdrop.open { opacity: 1; }
.am-backdrop[hidden] { display: none; }
.am-dialog {
  position: relative;
  width: min(480px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  scrollbar-width: none;
  background: var(--surface, #fff);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(16, 37, 58, .25);
  padding: 22px 26px 18px;
  transform: translateY(10px) scale(.98); transition: transform .2s ease;
}
.am-dialog::-webkit-scrollbar { display: none; }
.am-backdrop.open .am-dialog { transform: none; }
.am-close {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted, #6e7b86);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.am-close:hover { background: var(--bg-soft, #fbfaf7); color: var(--ink, #10253a); }
.am-logo { height: 26px; display: block; margin-bottom: 10px; }
.am-title { margin: 0 0 2px; font-size: 20px; line-height: 1.3; letter-spacing: -.02em; color: var(--ink, #10253a); }
.am-sub { margin: 0 0 12px; color: var(--muted, #6e7b86); font-size: 13px; line-height: 1.45; }
.am-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--bg-soft, #fbfaf7); border: 1px solid var(--line, #e8ecef);
  border-radius: 12px; padding: 3px; margin-bottom: 12px;
}
.am-tabs button {
  border: 0; background: transparent; border-radius: 9px; padding: 7px;
  font: inherit; font-weight: 600; font-size: 13.5px; color: var(--muted, #6e7b86); cursor: pointer;
}
.am-tabs button[aria-selected="true"] { background: #fff; color: var(--ink, #10253a); box-shadow: 0 2px 8px rgba(16, 37, 58, .08); }
.am-social { display: grid; gap: 8px; }
.am-social[hidden], .am-social [hidden] { display: none; }
.am-dialog .btn { min-height: 42px; }
.am-dialog .btn:hover { transform: none; }
.am-social .btn { width: 100%; justify-content: center; gap: 10px; }
.am-divider { display: flex; align-items: center; gap: 12px; color: var(--muted, #6e7b86); font-size: 12.5px; margin: 10px 0; }
.am-divider::before, .am-divider::after { content: ''; flex: 1; height: 1px; background: var(--line, #e8ecef); }
.am-form { display: grid; gap: 10px; }
.am-form[hidden] { display: none; }
.am-form label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink, #10253a); min-width: 0; }
.am-form input {
  width: 100%; min-width: 0; font: inherit; font-size: 14.5px; font-weight: 400; color: var(--ink, #10253a);
  background: var(--bg-soft, #fbfaf7); border: 1px solid var(--line-strong, #dde3e7);
  border-radius: 10px; padding: 9px 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.am-form input::placeholder { color: #a7b0b8; }
.am-form input:focus { outline: none; background: #fff; border-color: var(--coral, #ef7188); box-shadow: 0 0 0 3px var(--coral-soft, #fff0f3); }
.am-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.am-form .btn { width: 100%; justify-content: center; margin-top: 2px; }
.am-form .btn:disabled { opacity: .6; cursor: wait; }
.am-msg { font-size: 13px; }
.am-msg:empty { display: none; }
.am-msg.err { color: #d14343; font-weight: 600; }
.am-msg.ok { color: var(--mint, #42bfa0); font-weight: 600; }
.am-note { margin: 0; font-size: 12px; color: var(--muted, #6e7b86); text-align: center; line-height: 1.5; }
.am-note a, .am-link { color: var(--coral, #ef7188); font-weight: 600; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
body.am-lock { overflow: hidden; }

/* Màn hình thấp (laptop phóng to, cửa sổ nhỏ): bỏ dòng phụ, thu khoảng cách. */
@media (max-height: 640px) {
  .am-dialog { padding: 16px 22px 14px; }
  .am-logo { height: 22px; margin-bottom: 6px; }
  .am-sub { display: none; }
  .am-title { margin-bottom: 8px; font-size: 18px; }
  .am-tabs, .am-divider { margin-bottom: 8px; }
  .am-divider { margin-top: 8px; }
  .am-form { gap: 8px; }
  .am-form input { padding: 7px 11px; }
  .am-dialog .btn { min-height: 38px; }
}

@media (max-width: 520px) {
  .am-backdrop { align-items: flex-end; padding: 0; }
  .am-dialog { width: 100%; border-radius: 20px 20px 0 0; padding: 20px 18px 18px; max-height: 94vh; max-height: 94dvh; }
}
@media (max-width: 380px) { .am-row { grid-template-columns: 1fr; } }

/* Quên mật khẩu */
.am-tabs[hidden], .am-step2[hidden], .am-social.am-off, .am-link[hidden] { display: none; }
.am-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.am-label-row .am-link { font-size: 12px; }
.am-step2 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.am-step2 input[name="code"] { letter-spacing: .3em; font-weight: 700; }
.am-form input[readonly] { color: var(--muted, #6e7b86); }
.am-link:disabled { color: var(--muted, #6e7b86); cursor: default; }
.am-note .am-link + .am-link { margin-left: 10px; }

/* Mã xác minh lúc đăng ký */
.am-code[hidden] { display: none; }
.am-code { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; }
.am-code input { letter-spacing: .3em; font-weight: 700; }
.am-code .am-link { font-size: 12.5px; padding-bottom: 10px; white-space: nowrap; }
