/* =====================================================================
   MÀN ĐĂNG NHẬP
   ---------------------------------------------------------------------
   Dùng lại đúng bộ biến màu của styles.css — tỉ lệ tương phản đã được
   ghi rõ ở đó, đừng đặt màu mới ở đây rồi phá mất.

   Phủ toàn màn hình thay vì làm trang riêng: app là PWA, một vỏ trang
   duy nhất thì Service Worker đệm gọn và không có cú nháy trắng lúc
   chuyển trang.
   ===================================================================== */

#manDangNhap {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--bg, #0c1119);
  overflow-y: auto;
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--tx, #eaeef6);
}
#manDangNhap[hidden] { display: none !important; }

.dn-the {
  width: 100%;
  max-width: 380px;
  background: var(--card, #1a2230);
  border: 1px solid var(--line, #303b4c);
  border-radius: var(--r, 14px);
  padding: 26px 24px 22px;
  box-shadow: var(--sh, 0 4px 20px rgba(0,0,0,.45));
}

.dn-dau { text-align: center; margin-bottom: 22px }
.dn-ten { font-size: 19px; font-weight: 700; letter-spacing: .01em; margin: 0 0 4px }
.dn-phu { font-size: 13px; color: var(--tx3, #93a0b2); margin: 0 }

/* --- hai thẻ Đăng nhập / Đăng ký --- */
.dn-tab {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg2, #131a25);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}
.dn-tab button {
  border: 0; background: none; color: var(--tx3, #93a0b2);
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 9px 8px; border-radius: 7px; cursor: pointer;
}
.dn-tab button[aria-selected="true"] {
  background: var(--card2, #26303f);
  color: var(--tx, #eaeef6);
}
.dn-tab button:focus-visible { outline: 2px solid var(--acc2, #5cb2ff); outline-offset: 1px }

/* --- ô nhập --- */
.dn-o { margin-bottom: 14px }
.dn-o label {
  display: block; font-size: 11.5px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--tx3, #93a0b2); margin-bottom: 6px;
}
.dn-o input {
  width: 100%;
  background: var(--bg, #0c1119);
  color: var(--tx, #eaeef6);
  border: 1px solid var(--line2, #3f4b5e);
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  /* 16px để iPhone không tự phóng to trang khi chạm vào ô nhập */
  font-size: 16px;
  outline: none;
}
.dn-o input:focus { border-color: var(--acc2, #5cb2ff) }
.dn-o input::placeholder { color: #6d7a8c }

/* --- nút --- */
.dn-chinh {
  width: 100%; margin-top: 6px;
  background: var(--acc, #0f6fd0); color: #fff;
  border: 0; border-radius: 10px; padding: 13px;
  font: inherit; font-size: 15px; font-weight: 650; cursor: pointer;
}
.dn-chinh:hover:not(:disabled) { background: #1580ea }
.dn-chinh:disabled { opacity: .55; cursor: default }
.dn-chinh:focus-visible { outline: 2px solid var(--acc2, #5cb2ff); outline-offset: 2px }

.dn-phu-nut {
  display: block; width: 100%; margin-top: 14px;
  background: none; border: 0; color: var(--tx3, #93a0b2);
  font: inherit; font-size: 13px; cursor: pointer; text-align: center;
}
.dn-phu-nut:hover { color: var(--acc2, #5cb2ff) }

/* --- thông báo --- */
.dn-bao {
  margin: 0 0 16px; padding: 11px 13px; border-radius: 9px;
  font-size: 13.5px; line-height: 1.5;
}
.dn-bao[hidden] { display: none }
.dn-bao.loi { background: #3a1b18; color: var(--bad, #ea7b70); border: 1px solid #5c2a25 }
.dn-bao.ok  { background: #14301f; color: var(--ok, #4fd98d);  border: 1px solid #235437 }
.dn-bao.tin { background: var(--bg2, #131a25); color: var(--tx2, #aeb9ca); border: 1px solid var(--line, #303b4c) }

.dn-chan {
  margin: 18px 0 0; padding-top: 16px;
  border-top: 1px solid var(--line, #303b4c);
  font-size: 12px; color: var(--tx3, #93a0b2); text-align: center; line-height: 1.6;
}

/* --- đang kiểm tra phiên, trước khi biết nên hiện gì --- */
.dn-cho { text-align: center; padding: 30px 0; color: var(--tx3, #93a0b2); font-size: 14px }

/* --- màn hồ sơ khi đã đăng nhập --- */
.dn-hoso dl { margin: 0 0 18px; font-size: 14px }
.dn-hoso dt {
  font-size: 11.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--tx3, #93a0b2); margin-bottom: 3px;
}
.dn-hoso dd { margin: 0 0 13px; color: var(--tx, #eaeef6) }
.dn-han { font-weight: 650 }
.dn-han.con { color: var(--ok, #4fd98d) }
.dn-han.sap { color: var(--warn, #e3ad60) }
.dn-han.het { color: var(--bad, #ea7b70) }
.dn-thoat {
  width: 100%; background: none; color: var(--bad, #ea7b70);
  border: 1px solid #5c2a25; border-radius: 10px; padding: 11px;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.dn-thoat:hover { background: #3a1b18 }

@media (prefers-reduced-motion: reduce) { * { transition: none !important } }
