:root {
  --navy-top: #0b2447;
  --navy-deep: #071a36;
  --frame-edge: #d8dee6;
  --bg-dark: #0a0a0c;
  --border-subtle: rgba(255, 255, 255, 0.14);
  --text-main: #ffffff;
  --text-soft: rgba(255, 255, 255, 0.84);
  --accent: #f59e0b;
  --accent-light: #fcd34d;
  --link-blue: #93c5fd;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-dark);
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

.hidden {
  display: none !important;
}

/* =========================================================
   KHUNG HIỂN THỊ MÀN HÌNH DỌC GIỐNG TIKTOK LIVE TRÊN PC
   - Đang TẠM TẮT chặn PC để tiện dev.
   - Khi nào cần bật lại chế độ chỉ xem trên di động, thêm class
     "desktop-blocked" vào thẻ <body class="public-page desktop-blocked">
     trong index.html.
   ========================================================= */
.desktop-notice {
  display: none;
}

body.public-page {
  background-color: #05070c;
  overflow-x: hidden;
}

.mobile-shell {
  position: relative;
  --shell-w: 430px;
  --cqw: calc(var(--shell-w) / 100);
  --shell-h: 100vh;
  --shell-h: 100dvh;
  --unit: calc(var(--shell-h) / 1000);
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--frame-edge);
  overflow-x: hidden;
}

/* NÚT MŨI TÊN BACK GÓC TRÊN CÙNG BÊN TRÁI (TRANG CON) */
.page-back-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 45;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
  text-decoration: none;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.page-back-btn:hover,
.page-back-btn:active {
  background: rgba(0, 0, 0, 0.48);
  transform: translateX(-1px);
}

/* Chế độ màn hình dọc (9:16 / chuẩn điện thoại) căn giữa trên PC giống TikTok Live */
@media (min-width: 521px) {
  body.public-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100dvh;
    min-height: 100dvh;
    padding: 16px;
    overflow: hidden;
    background:
      radial-gradient(circle at 50% 42%, rgba(29, 78, 137, 0.28) 0%, rgba(11, 36, 71, 0.14) 36%, rgba(5, 7, 12, 0.96) 72%),
      #05070c;
  }

  body.public-page .mobile-shell {
    --shell-h: min(calc(100dvh - 32px), 844px);
    width: clamp(340px, calc((100dvh - 32px) * 9 / 16), 430px);
    height: var(--shell-h);
    min-height: 0;
    border-radius: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow:
      0 28px 80px rgba(0, 0, 0, 0.75),
      0 0 0 1px rgba(255, 255, 255, 0.05),
      0 0 60px rgba(29, 78, 137, 0.22);
  }

  body.public-page .mobile-shell::-webkit-scrollbar {
    display: none;
  }
}

/* Giữ lại rule chặn PC để bật lại nhanh khi xong dev (thêm class desktop-blocked vào body) */
@media (min-width: 641px) {
  body.public-page.desktop-blocked {
    padding: 0;
    overflow: auto;
  }

  body.public-page.desktop-blocked .mobile-shell {
    display: none !important;
  }

  body.public-page.desktop-blocked .desktop-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    width: 100%;
    padding: 32px 20px;
    background-color: var(--bg-dark);
    background-image: url("../assets/nen_cham_elip_dong_tam_2400x2400.png");
    background-size: 380px 380px;
    background-repeat: repeat;
  }
}

.desktop-notice-card {
  width: min(100%, 460px);
  background: rgba(13, 21, 36, 0.92);
  border: 1px solid rgba(147, 197, 253, 0.25);
  border-radius: 22px;
  padding: 36px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(12px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.desktop-notice-icon {
  width: 78px;
  height: 78px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(245, 158, 11, 0.2));
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.desktop-notice-card h2 {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
  color: #ffffff;
}

.desktop-notice-card p {
  font-size: 14.5px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.78);
}

.desktop-notice-url {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--link-blue);
  word-break: break-all;
}

.desktop-copy-btn {
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  color: #0b1324;
  background: linear-gradient(135deg, #fde047 0%, #f59e0b 100%);
  box-shadow: 0 10px 26px -6px rgba(245, 158, 11, 0.5);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.desktop-copy-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

/* =========================================================
   GIAO DIỆN DI ĐỘNG THEO ĐÚNG CẤU TRÚC BẢN VẼ
   ========================================================= */

/* 1. HEADER XANH ĐẬM TRÊN CÙNG (Ô ĐỎ 1 + Ô XANH LÁ 1) - 170/1000 chiều cao trang */
.top-header {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: calc(var(--unit) * 170);
  min-height: calc(var(--unit) * 170);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy-top) 0%, var(--navy-deep) 100%);
  padding: clamp(12px, calc(var(--cqw) * 3.5), 18px) clamp(14px, calc(var(--cqw) * 4), 20px);
  display: flex;
  align-items: center;
  gap: clamp(12px, calc(var(--cqw) * 3.5), 16px);
}

.top-header > :not(.module-bg-img):not(.banner-dim-layer) {
  position: relative;
  z-index: 2;
}

.logo-slot {
  height: 100%;
  max-height: 108px;
  aspect-ratio: 1.15 / 1;
  width: auto;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: clamp(13px, calc(var(--cqw) * 3.5), 15px);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-light);
}

.logo-slot.has-logo-img {
  background: transparent;
  border-color: transparent;
}

.logo-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.header-text {
  flex: 1;
  font-size: clamp(16px, calc(var(--cqw) * 4.6), 20px);
  font-weight: 700;
  line-height: 1.35;
  color: #ffffff;
}

/* KHUNG NỘI DUNG BÊN DƯỚI HEADER - Viền khoảng trống xám 8/1000 chiều cao trang */
.content-frame {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  margin: calc(var(--unit) * 8);
  background: #ffffff;
  border-radius: 0;
  overflow-x: hidden;
  overflow-y: visible;
  box-shadow: 0 2px 14px rgba(7, 26, 54, 0.14);
}

/* 2. THANH XANH ĐẬM CHỮ NHỎ (Ô XANH LÁ 2) - 26/1000 chiều cao trang */
.sub-bar {
  width: 100%;
  height: calc(var(--unit) * 26);
  min-height: calc(var(--unit) * 26);
  flex-shrink: 0;
  background: var(--navy-deep);
  padding: 0 clamp(10px, calc(var(--cqw) * 3), 14px);
  display: flex;
  align-items: center;
}

.small-label {
  font-size: clamp(9.5px, calc(var(--unit) * 14), 12px);
  line-height: 1;
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* 3. DẢI NỀN TRẮNG TIÊU ĐỀ CHÍNH (Ô XANH LÁ 3) - 80/1000 chiều cao trang */
.white-title-strip {
  width: 100%;
  height: calc(var(--unit) * 80);
  min-height: calc(var(--unit) * 80);
  flex-shrink: 0;
  background: #ffffff;
  padding: 0 clamp(12px, calc(var(--cqw) * 3.5), 16px);
  display: flex;
  align-items: center;
  overflow: hidden;
}

.main-title {
  font-size: clamp(15px, calc(var(--unit) * 23), 20px);
  font-weight: 800;
  line-height: 1.25;
  color: var(--navy-top);
}

/* 4. KHU VỰC Ô NỀN VÀNG: BANNER BACKGROUND + CÁC NÚT ĐIỀU KHIỂN - 190/1000 chiều cao trang */
.banner-zone {
  position: relative;
  margin: 0 calc(var(--unit) * 12);
  height: calc(var(--unit) * 190);
  min-height: calc(var(--unit) * 190);
  flex-shrink: 0;
  border-radius: 0;
  background: linear-gradient(135deg, #132c4e 0%, #1d4e89 55%, #0f294a 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(12px, calc(var(--cqw) * 3.2), 18px) clamp(10px, calc(var(--cqw) * 2.8), 14px);
  overflow: hidden;
}

.banner-zone.has-banner-bg {
  background-color: #0b1324;
}

.module-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 0;
}

.banner-dim-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.custom-text-module {
  flex-shrink: 0;
  padding: clamp(10px, calc(var(--cqw) * 3), 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.custom-text-body {
  white-space: pre-line;
}

.text-divider-line {
  display: block;
  height: 0;
  max-width: 100%;
  border: none;
  border-top: 2px solid currentColor;
}

/* KHUNG CHỮ TỰ DO (PHOTOSHOP TYPE TOOL - T) */
.free-text-box {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  overflow: visible;
  z-index: 20;
}

.free-text-content {
  width: 100%;
  max-height: 100%;
  overflow: hidden;
  white-space: pre-line;
  word-break: break-word;
}

/* KHUNG ẢNH / LOGO TỰ DO (PHOTOSHOP IMAGE LAYER) */
.free-image-box {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  overflow: visible;
  z-index: 25;
}

.free-image-inner {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.free-image-inner img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.free-image-placeholder {
  width: 100%;
  height: 100%;
  border: 1.5px dashed rgba(147, 197, 253, 0.7);
  background: rgba(15, 23, 42, 0.55);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
}

.control-row {
  position: relative;
  z-index: 2;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, calc(var(--cqw) * 2.2), 12px);
}

.control-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: clamp(6px, calc(var(--cqw) * 2), 10px) 4px;
  border-radius: 12px;
  text-decoration: none;
  color: #ffffff;
  background: transparent;
  border: none;
  backdrop-filter: none;
  box-shadow: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.control-btn:hover,
.control-btn:active {
  transform: translateY(-2px);
  opacity: 0.92;
}

.control-icon {
  width: clamp(32px, calc(var(--cqw) * 8.5), 40px);
  height: clamp(32px, calc(var(--cqw) * 8.5), 40px);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: clamp(20px, calc(var(--cqw) * 5.5), 24px);
}

.control-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.control-label {
  font-size: clamp(11px, calc(var(--cqw) * 2.9), 12.5px);
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
  color: #f8fafc;
  white-space: pre-line;
}

/* 5. PHẦN DƯỚI NỀN TỐI HỌA TIẾT CHẤM ELIP (GIẢM ĐỘ SÁNG HÌNH NỀN 50%) */
.lower-section {
  position: relative;
  isolation: isolate;
  flex: 1;
  margin: 0 calc(var(--unit) * 12) calc(var(--unit) * 12);
  border-radius: 0;
  background-color: var(--bg-dark);
  background-image: url("../assets/nen_cham_elip_dong_tam_2400x2400.png");
  background-size: clamp(600px, calc(var(--cqw) * 175), 900px);
  background-position: center top;
  background-repeat: repeat;
  padding: clamp(20px, calc(var(--cqw) * 5.5), 28px) clamp(14px, calc(var(--cqw) * 4), 20px) clamp(16px, calc(var(--cqw) * 4.5), 22px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(14px, calc(var(--cqw) * 3.8), 20px);
}

.lower-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, var(--lower-dim, 0.5));
  pointer-events: none;
  z-index: 1;
}

.lower-bg-layer {
  position: absolute;
  inset: 0;
  background-position: center top;
  background-repeat: repeat;
  pointer-events: none;
  z-index: 0;
}

.lower-section > :not(.lower-bg-layer) {
  position: relative;
  z-index: 2;
}

/* Ô đỏ 2: Logo giữa */
.center-logo-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.center-logo {
  width: clamp(150px, calc(var(--cqw) * 48), 210px);
  min-height: clamp(82px, calc(var(--cqw) * 24), 114px);
  padding: 12px 18px;
  border-radius: 16px;
  border: 1.5px solid rgba(251, 191, 36, 0.45);
  background: rgba(255, 255, 255, 0.04);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--accent-light);
  font-size: clamp(15px, calc(var(--cqw) * 4.2), 18px);
  font-weight: 800;
  letter-spacing: 0.06em;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.center-logo:not(.is-static):hover {
  transform: scale(1.02);
  border-color: var(--accent-light);
}

.center-logo.is-static {
  cursor: default;
}

.center-logo.is-image {
  background: transparent;
  border: none;
  padding: 0;
  min-height: 0;
  height: clamp(92px, calc(var(--cqw) * 28), 130px);
}

.center-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Ô xanh lá 4: Tiêu đề phụ căn giữa */
.sub-title {
  font-size: clamp(15.5px, calc(var(--cqw) * 4.4), 19px);
  font-weight: 700;
  line-height: 1.35;
  color: #ffffff;
  max-width: 90%;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
}

/* Ô xanh lá 5: Nội dung mô tả */
.desc-text {
  width: 100%;
  font-size: clamp(13.5px, calc(var(--cqw) * 3.6), 15px);
  line-height: 1.65;
  color: var(--text-soft);
  white-space: pre-line;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

/* Ô xanh lam: Thanh các liên kết cuối trang */
.links-bar {
  margin-top: auto;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  padding: clamp(10px, calc(var(--cqw) * 3), 14px) clamp(10px, calc(var(--cqw) * 3), 14px);
  border-radius: 12px;
  background: rgba(29, 78, 216, 0.24);
  border: 1px solid rgba(96, 165, 250, 0.4);
}

.links-bar a {
  color: #dbeafe;
  text-decoration: none;
  font-size: clamp(12.5px, calc(var(--cqw) * 3.4), 14px);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(147, 197, 253, 0.28);
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.links-bar a:hover,
.links-bar a:active {
  color: #ffffff;
  background: rgba(37, 99, 235, 0.55);
  border-color: rgba(191, 219, 254, 0.65);
}

/* Co giãn cho màn hình siêu nhỏ (< 330px) */
@container (max-width: 330px) {
  .control-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =========================================================
   TRANG ADMIN ĐỘC LẬP (LUÔN DÙNG ĐƯỢC TRÊN CẢ MÁY TÍNH & MOBILE)
   ========================================================= */
body.admin-page {
  background-color: var(--bg-dark);
  background-image: url("../assets/nen_cham_elip_dong_tam_2400x2400.png");
  background-size: 380px 380px;
  background-repeat: repeat;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(18px, 4vw, 36px) clamp(14px, 4vw, 24px);
}

.admin-panel {
  width: min(100%, 680px);
  background: rgba(16, 18, 24, 0.94);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: clamp(18px, 4vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-panel h2 {
  font-size: clamp(18px, 4.5vw, 22px);
  margin-bottom: 6px;
}

.admin-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.admin-group h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: 0.01em;
}

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  margin-right: 6px;
  vertical-align: middle;
}

.tag-red { background: rgba(225, 29, 72, 0.28); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.45); }
.tag-green { background: rgba(22, 163, 74, 0.28); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.45); }
.tag-yellow { background: rgba(202, 138, 4, 0.3); color: #fde047; border: 1px solid rgba(234, 179, 8, 0.5); }
.tag-blue { background: rgba(37, 99, 235, 0.3); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.5); }

.status-badge {
  display: inline-block;
  font-size: 12px;
  color: #86efac;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
}

.status-badge.is-draft {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.4);
}

.admin-hint {
  font-size: 12.5px;
  line-height: 1.55;
  color: #d4d4d8;
  background: rgba(56, 189, 248, 0.09);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 12px;
  padding: 11px 14px;
}

.admin-hint code {
  background: rgba(0, 0, 0, 0.45);
  padding: 1px 6px;
  border-radius: 4px;
  color: #7dd3fc;
}

.toast {
  font-size: 13px;
  font-weight: 600;
  color: #bbf7d0;
  background: rgba(22, 163, 74, 0.22);
  border: 1px solid rgba(34, 197, 94, 0.45);
  border-radius: 10px;
  padding: 10px 12px;
}

.toast.toast-error {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.45);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  color: var(--text-soft);
  font-weight: 600;
}

.field input,
.field textarea {
  width: 100%;
  background: rgba(9, 9, 11, 0.85);
  border: 1px solid #3f3f46;
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 10px 15px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-preview {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid var(--border-subtle);
}

.btn-save { background: #22c55e; color: #052e16; }
.btn-export { background: #38bdf8; color: #082f49; }
.btn-import { background: #a78bfa; color: #1e1b4b; }
.btn-reset { background: #ef4444; color: #fff; }

/* =========================================================
   MODULE BIỂU MẪU (TRANG /update)
   ========================================================= */
.form-module {
  position: relative;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.profile-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-fields-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 21px;
}

.form-field {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: #000000;
  text-align: left;
}

.form-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  background-color: #ffffff;
  border: 1px solid #93c5fd;
  border-radius: 5px;
  color: #000000;
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.form-input::placeholder {
  color: rgba(15, 23, 42, 0.5);
}

.form-input:focus {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22);
  filter: brightness(1.03);
}

.form-field.is-error .form-input {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.18);
}

.form-field-error {
  display: none;
  font-size: 12.5px;
  font-weight: 500;
  color: #dc2626;
  line-height: 1.3;
  margin-top: 2px;
}

.form-field.is-error .form-field-error {
  display: block;
}

.editor-canvas .form-input:disabled {
  opacity: 1;
  pointer-events: none;
  cursor: default;
}

/* Searchable Select Dropdown */
.form-select-wrap {
  position: relative;
  width: 100%;
}

.form-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}

.form-select-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-select-value.is-placeholder {
  opacity: 0.55;
}

.form-select-arrow {
  flex-shrink: 0;
  font-size: 13px;
  line-height: 1;
  opacity: 0.7;
  transition: transform 0.16s ease;
}

.form-select-wrap.is-open .form-select-arrow {
  transform: rotate(180deg);
}

.form-select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 60;
  background: #ffffff;
  border: 1px solid #93c5fd;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
}

.form-select-wrap.is-open .form-select-dropdown {
  display: block;
}

.form-select-search-wrap {
  padding: 8px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.form-select-search {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #000000;
  font-family: inherit;
  font-size: 16px;
  outline: none;
}

.form-select-search:focus {
  border-color: #2563eb;
}

.form-select-list {
  max-height: 210px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.form-select-option {
  width: 100%;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
  color: #000000;
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
}

.form-select-option:last-child {
  border-bottom: none;
}

.form-select-option:hover {
  background: #eff6ff;
}

.form-select-option.is-selected {
  background: #dbeafe;
  font-weight: 700;
}

.form-select-empty {
  padding: 14px 12px;
  text-align: center;
  font-size: 13.5px;
  color: #64748b;
}

.form-submit-btn {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 0;
  background-color: #c00000;
  color: #ffffff;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.18s ease, transform 0.12s ease;
}

.form-submit-btn:hover {
  filter: brightness(1.08);
}

.form-submit-btn:active {
  transform: scale(0.99);
}

/* Bỏ toàn bộ bo góc cho mọi thành phần trên trang (trừ khung nhập liệu, thanh loading, khung video scan, khung tĩnh, nút thử lại, khung ảnh reload và thanh chạy màu) */
.mobile-shell,
.mobile-shell *:not(.ve-resize-handle):not(.ve-icon-resize-handle):not(.form-input):not(.reload-progress-track):not(.reload-progress-fill):not(.scan-video-box):not(.scan-corner):not(.verify-static-box):not(.marquee-bar-track):not(.marquee-bar-runner):not(.verify-retry-btn):not(.verify-box-loading-overlay):not(.verify-box-spinner):not(.reload-complete-card) {
  border-radius: 0 !important;
}

/* Popup "Đang xử lý" khi bấm nút Cập nhật */
.form-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.38);
  padding: 20px;
}

.form-loading-overlay.is-visible {
  display: flex;
}

.form-loading-card {
  width: 230px;
  background: #ffffff;
  padding: 28px 20px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

.form-loading-spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 5px solid #f2edf0;
  border-left-color: #c83232;
  animation: formSpinnerSpin 0.85s linear infinite;
}

.form-loading-text {
  font-size: 16.5px;
  font-weight: 500;
  color: #a82a2a;
  line-height: 1.3;
  text-align: center;
}

@keyframes formSpinnerSpin {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================================
   MODULE MÀN HÌNH LOADING (TRANG /reload)
   ========================================================= */
.reload-module {
  position: relative;
  flex: 1 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 28px 20px;
}

.reload-content {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
}

.reload-logo {
  width: min(72%, 240px);
}

.scan-video-box {
  position: relative;
  max-width: 100%;
  border-radius: 18px;
  border: 1.5px dashed rgba(255, 255, 255, 0.32);
  background-color: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.scan-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  z-index: 4;
  pointer-events: none;
  border-style: solid;
  border-color: #ffffff;
  border-width: 0;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.45));
}

.scan-corner-tl {
  top: 12px;
  left: 12px;
  border-top-width: 3.5px;
  border-left-width: 3.5px;
  border-top-left-radius: 10px;
}

.scan-corner-tr {
  top: 12px;
  right: 12px;
  border-top-width: 3.5px;
  border-right-width: 3.5px;
  border-top-right-radius: 10px;
}

.scan-corner-bl {
  bottom: 12px;
  left: 12px;
  border-bottom-width: 3.5px;
  border-left-width: 3.5px;
  border-bottom-left-radius: 10px;
}

.scan-corner-br {
  bottom: 12px;
  right: 12px;
  border-bottom-width: 3.5px;
  border-right-width: 3.5px;
  border-bottom-right-radius: 10px;
}

.scan-video-box.has-video {
  border-style: solid;
  border-color: transparent;
  background-color: transparent;
}

.scan-video-el {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.scan-video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  padding: 12px;
  pointer-events: none;
}

.scan-video-placeholder span {
  font-size: 28px;
  line-height: 1;
}

.scan-video-placeholder strong {
  font-size: 13.5px;
  letter-spacing: 0.05em;
  color: #fcd34d;
}

.scan-video-placeholder small {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.6);
}

.verify-static-box {
  position: relative;
  max-width: 100%;
  flex-shrink: 0;
  background-color: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 24px 16px 26px;
}

.verify-static-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  pointer-events: none;
  display: block;
}

.verify-static-box.is-reload-qr-card {
  padding: 12px;
  justify-content: center;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}

.verify-static-box.is-reload-qr-card .reload-complete-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.reload-qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  padding: 16px;
  user-select: none;
  pointer-events: none;
}

.reload-qr-placeholder span {
  font-size: 28px;
}

.reload-qr-placeholder small {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
}

.verify-retry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 22px;
  border: none;
  border-radius: 10px;
  background-color: #ffcc00;
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  z-index: 6;
  transition: filter 0.15s ease, transform 0.12s ease;
}

.verify-retry-btn:hover {
  filter: brightness(1.05);
}

.verify-retry-btn:active {
  transform: scale(0.97);
}

.verify-retry-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.verify-box-loading-overlay {
  position: absolute;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  pointer-events: all;
}

.verify-box-loading-overlay.is-visible {
  display: flex;
}

.verify-box-revealed-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.verify-box-spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 4.5px solid #e5e7eb;
  border-top-color: #f5c518;
  animation: formSpinnerSpin 0.75s linear infinite;
}

.marquee-bar-wrap {
  position: relative;
  z-index: 5;
  max-width: 100%;
  padding: 6px 0;
  flex-shrink: 0;
}

.marquee-bar-track {
  position: relative;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background-color: transparent;
}

.marquee-bar-runner {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 999px;
  background-color: #f5c518;
  animation: marqueeRunLTR var(--marquee-speed, 1.5s) linear infinite;
}

@keyframes marqueeRunLTR {
  0% {
    left: calc(var(--runner-w, 115px) * -1);
  }
  100% {
    left: 100%;
  }
}

.scan-shimmer-text {
  position: relative;
  z-index: 5;
  max-width: 92%;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  background-image: linear-gradient(
    90deg,
    var(--shimmer-base, #60a5fa) 0%,
    var(--shimmer-base, #60a5fa) 35%,
    var(--shimmer-hi, #ffffff) 50%,
    var(--shimmer-base, #60a5fa) 65%,
    var(--shimmer-base, #60a5fa) 100%
  );
  background-size: 220% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  animation: scanTextShimmer var(--shimmer-speed, 2.2s) linear infinite;
}

.scan-shimmer-text[contenteditable="true"] {
  background-image: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--shimmer-hi, #ffffff) !important;
  -webkit-text-fill-color: var(--shimmer-hi, #ffffff);
  animation: none;
}

@keyframes scanTextShimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

.reload-progress-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.reload-progress-track {
  width: 100%;
  height: 10px;
  padding: 1.5px;
  background-color: #eef2f6;
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  display: flex;
  align-items: center;
}

.reload-progress-fill {
  height: 100%;
  min-width: 7px;
  background-color: #007aff;
  border-radius: 999px;
  transition: width 0.45s ease;
}

.reload-progress-percent {
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.reload-complete-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: linear-gradient(180deg, #0b2447 0%, #071a36 100%);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: reloadFadeIn 0.25s ease;
}

.reload-complete-card {
  width: min(84%, 310px);
  aspect-ratio: 1 / 1;
  background-color: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}

.reload-complete-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

@keyframes reloadFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
