:root {
  --primary: #1a56db;
  --primary-dark: #1544ad;
  --green: #057a55;
  --green-bg: #def7ec;
  --red: #c81e1e;
  --red-bg: #fde8e8;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --gray: #6b7280;
  --bg: #f3f4f6;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-soft: #374151;
  --input-bg: #ffffff;
  --accent-soft: #eff6ff;
  --accent-border: #bfdbfe;
  --topbar-bg: #1a56db;
  --shadow: rgba(0, 0, 0, .08);
  --radius: 12px;
  color-scheme: light;
}

/* Bộ màu chế độ tối — dùng chung cho lựa chọn thủ công và theo hệ điều hành */
:root[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --green: #34d399;
  --green-bg: #072a1c;
  --red: #f87171;
  --red-bg: #3a1616;
  --amber: #fbbf24;
  --amber-bg: #3a2c0a;
  --gray: #94a3b8;
  --bg: #0f172a;
  --card: #1e293b;
  --border: #334155;
  --text: #e8eef7;
  --text-soft: #cbd5e1;
  --input-bg: #0b1324;
  --accent-soft: #17263f;
  --accent-border: #2d456e;
  --topbar-bg: #0b1220;
  --shadow: rgba(0, 0, 0, .5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --green: #34d399;
    --green-bg: #072a1c;
    --red: #f87171;
    --red-bg: #3a1616;
    --amber: #fbbf24;
    --amber-bg: #3a2c0a;
    --gray: #94a3b8;
    --bg: #0f172a;
    --card: #1e293b;
    --border: #334155;
    --text: #e8eef7;
    --text-soft: #cbd5e1;
    --input-bg: #0b1324;
    --accent-soft: #17263f;
    --accent-border: #2d456e;
    --topbar-bg: #0b1220;
    --shadow: rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.container { max-width: 860px; margin: 0 auto; padding: 16px; }

/* Topbar */
.topbar {
  background: var(--topbar-bg); color: #fff;
  padding: 12px 16px; display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 60;
}
.topbar .brand {
  font-weight: 700; font-size: 18px; text-decoration: none; color: #fff; margin-right: auto;
  display: inline-flex; align-items: center; gap: 8px;
}
.brand-logo { width: 26px; height: 26px; }
.topbar-right { display: flex; gap: 14px; align-items: center; }
.topbar .topbar-menu { display: flex; gap: 14px; align-items: center; }
.theme-toggle { font-size: 17px; line-height: 1; padding: 2px; }
.lang-switch { position: relative; display: inline-flex; }
.lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 80;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px var(--shadow); padding: 6px; min-width: 160px;
}
.lang-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text); font-size: 14px; padding: 8px 10px; border-radius: 7px; cursor: pointer;
}
.lang-menu button:hover { background: var(--bg); }
.lang-menu button.active { color: var(--primary); font-weight: 700; }
.topbar .actions { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.topbar a, .topbar button.link { color: #dbeafe; background: none; border: none; cursor: pointer; font-size: 14px; text-decoration: none; }
.topbar a:hover, .topbar button.link:hover { color: #fff; }
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; padding: 2px 4px; }
.nav-backdrop { display: none; }

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .topbar { gap: 8px; }
  .topbar-right {
    position: fixed; top: 0; right: 0; height: 100vh; width: min(82vw, 300px);
    background: var(--topbar-bg); flex-direction: column; align-items: stretch;
    gap: 6px; padding: 62px 18px 20px; z-index: 70;
    transform: translateX(100%); transition: transform .25s ease;
    box-shadow: -8px 0 24px rgba(0,0,0,.35); overflow-y: auto;
  }
  .topbar.nav-open .topbar-right { transform: translateX(0); }
  .topbar-right .topbar-menu, .topbar-right .actions { flex-direction: column; align-items: stretch; gap: 4px; width: 100%; }
  .topbar-right .topbar-menu > *, .topbar-right .actions > * { padding: 12px 8px; border-radius: 8px; text-align: left; font-size: 16px; }
  .topbar-right .topbar-menu > *:hover, .topbar-right .actions > *:hover { background: rgba(255,255,255,.1); }
  .topbar-right .actions { border-top: 1px solid rgba(255,255,255,.18); margin-top: 4px; padding-top: 8px; }
  .theme-toggle { font-size: 20px; }
  .nav-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 65;
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .topbar.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
}

/* Cards */
.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px; margin-bottom: 16px;
}
.card h2 { font-size: 18px; margin-bottom: 12px; }
.card.clickable { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.card.clickable:hover { box-shadow: 0 4px 16px var(--shadow); transform: translateY(-1px); }

/* Forms */
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
input, select {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 1.5px solid var(--border); border-radius: 10px; margin-bottom: 14px;
  background: var(--input-bg); color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--primary); }
input[type="radio"], input[type="checkbox"] {
  width: 17px; height: 17px; margin: 0; padding: 0; flex: none;
  accent-color: var(--primary);
}
label.radio {
  display: flex; gap: 10px; align-items: flex-start;
  font-weight: 400; font-size: 14px; margin-bottom: 10px; cursor: pointer;
}
label.radio input { margin-top: 2px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; font-size: 16px; font-weight: 600;
  border: none; border-radius: 10px; cursor: pointer;
  background: var(--primary); color: #fff; text-decoration: none;
  transition: background .15s;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.full { width: 100%; }
.btn.big { padding: 16px 28px; font-size: 18px; }
.btn.secondary { background: var(--card); color: var(--text); border: 1.5px solid var(--border); }
.btn.secondary:hover { background: var(--bg); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #a31515; }
.btn.green { background: var(--green); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.draft { background: var(--border); color: var(--text-soft); }
.badge.open { background: var(--green-bg); color: var(--green); }
.badge.closed { background: var(--accent-soft); color: var(--primary); }
.badge.supplement { background: var(--amber-bg); color: var(--amber); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.alert.error { background: var(--red-bg); color: var(--red); }
.alert.success { background: var(--green-bg); color: var(--green); }
.alert.warn { background: var(--amber-bg); color: var(--amber); }
.hidden { display: none !important; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--gray); }
tr:last-child td { border-bottom: none; }

/* Stats */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; text-align: center;
}
.stat .num { font-size: 32px; font-weight: 800; line-height: 1.2; }
.stat .lbl { font-size: 13px; color: var(--gray); }
.stat .num.green { color: var(--green); }
.stat .num.red { color: var(--red); }
.stat .num.amber { color: var(--amber); }

/* Donut tỉ lệ */
.donut-wrap { display: flex; flex-direction: column; align-items: center; padding: 8px 0 16px; }
.donut { width: 210px; height: 210px; }
.donut .pct { font-size: 24px; font-weight: 800; fill: var(--text); }
.donut .sub { font-size: 10px; fill: var(--gray); }

/* QR screen */
.qr-screen { text-align: center; padding: 12px 0; }
.qr-screen img { width: min(78vw, 460px); height: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.qr-note { color: var(--gray); font-size: 14px; margin: 10px 0; }
.qr-counter { font-size: 42px; font-weight: 800; margin: 8px 0; }
.qr-counter small { font-size: 20px; color: var(--gray); font-weight: 600; }
.countdown { font-size: 13px; color: var(--gray); }

/* Trang điểm danh đại biểu */
.checkin-page { max-width: 440px; margin: 0 auto; padding: 24px 16px; }
.checkin-logo { display: block; width: 62px; height: 62px; margin: 0 auto 10px; }
.checkin-page .event-name { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.checkin-page .event-sub { text-align: center; color: var(--gray); font-size: 14px; margin-bottom: 20px; }
.success-screen { text-align: center; padding: 40px 12px; }
.success-screen .icon { width: 88px; height: 88px; border-radius: 50%; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; font-size: 48px; color: #fff; background: var(--green); }
.success-screen .icon.warn { background: var(--amber); }
.success-screen h2 { font-size: 24px; margin-bottom: 6px; }
.success-screen .sub { color: var(--gray); }

/* Upload zone */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px 16px; text-align: center; color: var(--gray); cursor: pointer;
  transition: border-color .15s, background .15s; margin-bottom: 14px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--accent-soft); }

/* ===== Landing (trang giới thiệu) ===== */
.landing { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.hero {
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 32px; align-items: center;
  padding: 48px 0 40px;
}
.hero-eyebrow {
  display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--primary); background: var(--accent-soft);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 16px;
}
.hero h1 { font-size: 38px; line-height: 1.15; margin-bottom: 16px; letter-spacing: -.01em; }
.hero h1 .accent { color: var(--primary); }
.hero p.lead { font-size: 17px; color: var(--text-soft); margin-bottom: 24px; max-width: 30em; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hero-illus { width: 100%; height: auto; }
.hero-note { margin-top: 14px; font-size: 14px; color: var(--gray); }
.hero-note a { color: var(--primary); font-weight: 600; text-decoration: none; }

.section { padding: 36px 0; }
.section-title { text-align: center; font-size: 26px; margin-bottom: 6px; }
.section-sub { text-align: center; color: var(--gray); margin-bottom: 28px; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.info-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 22px;
  transition: box-shadow .15s, transform .15s;
}
.info-card:hover { box-shadow: 0 8px 24px var(--shadow); transform: translateY(-2px); }
.info-card .ic { font-size: 30px; display: block; margin-bottom: 10px; }
.info-card h3 { font-size: 17px; margin-bottom: 6px; }
.info-card p { font-size: 14px; color: var(--text-soft); line-height: 1.55; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; counter-reset: step; }
.step-card { position: relative; padding: 22px 20px 20px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; }
.step-card .n {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; margin-bottom: 12px;
}
.step-card h3 { font-size: 16px; margin-bottom: 5px; }
.step-card p { font-size: 14px; color: var(--text-soft); line-height: 1.55; }

.contact-banner {
  background: linear-gradient(120deg, var(--primary) 0%, #0e3a8f 100%); color: #fff;
  border-radius: 18px; padding: 34px 30px; text-align: center; margin: 8px 0 44px;
}
.contact-banner h2 { font-size: 24px; margin-bottom: 8px; }
.contact-banner p { color: #dbeafe; margin-bottom: 20px; }
.contact-rows { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.contact-pill {
  display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 10px 18px;
  font-size: 15px; font-weight: 600; color: #fff; text-decoration: none;
}
.contact-pill:hover { background: rgba(255,255,255,.24); }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding: 28px 0; gap: 20px; }
  .hero-illus { max-width: 360px; margin: 0 auto; order: -1; }
  .hero h1 { font-size: 30px; }
}

/* Chip trường Excel */
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 34px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--accent-soft); color: var(--primary); border: 1px solid var(--accent-border);
}
.chip.core { background: var(--bg); color: var(--gray); border-color: var(--border); }
.chip-x {
  background: none; border: none; cursor: pointer; padding: 0;
  font-size: 16px; line-height: 1; color: var(--primary);
}
.chip-x:hover { color: var(--red); }

/* Footer sticky */
body { padding-bottom: 58px; }
.site-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--card); border-top: 1px solid var(--border);
  padding: 10px 16px; text-align: center;
  font-size: 13px; color: var(--gray);
}
.site-footer a { color: var(--primary); font-weight: 600; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(17, 24, 39, .55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--card); border-radius: 16px;
  width: 100%; max-width: 640px; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.modal-hero {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px;
  background: linear-gradient(120deg, var(--primary) 0%, #0e3a8f 100%);
  color: #fff;
}
.modal-hero img { width: 46px; height: 46px; flex: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)); }
.modal-hero h2 { font-size: 19px; line-height: 1.25; }
.modal-hero p { font-size: 13px; color: #cfe0ff; margin: 0; }
.modal-hero > div { flex: 1; }
.modal-close {
  background: rgba(255,255,255,.14); border: none; cursor: pointer; flex: none;
  font-size: 22px; line-height: 1; color: #fff; border-radius: 50%;
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.modal-close:hover { background: rgba(255,255,255,.28); }
.modal-body { padding: 18px 22px 22px; overflow-y: auto; font-size: 14px; }
.modal-body h3 {
  font-size: 15px; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px;
  padding-left: 10px; border-left: 3px solid var(--primary);
}
.modal-body h3:first-child { margin-top: 0; }
.modal-body p { margin-bottom: 8px; }
.modal-body ul { margin: 0 0 8px 22px; }
.modal-body li { margin-bottom: 5px; }
.modal-body a { color: var(--primary); font-weight: 600; text-decoration: none; }
.modal-body a:hover { text-decoration: underline; }
.modal-body .step-n {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 800;
  background: var(--primary); color: #fff;
}
.modal-body.guide h3 { border-left: none; padding-left: 0; }
.feature-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 4px;
}
.feature {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; line-height: 1.45;
}
.contact-box {
  background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: 10px;
  padding: 12px 14px; line-height: 1.7;
}
.contact-box .contact-name { font-weight: 800; font-size: 15px; }
@media (max-width: 480px) { .feature-grid { grid-template-columns: 1fr; } }

/* Guide — thẻ hướng dẫn trực quan cho người dùng */
.guide-steps { display: grid; gap: 10px; margin: 4px 0; }
.guide-step {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px;
}
.guide-step .g-ico {
  flex: none; width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  background: var(--accent-soft); border: 1px solid var(--accent-border);
}
.guide-step .g-body { flex: 1; min-width: 0; }
.guide-step .g-title {
  font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px;
}
.guide-step .g-title .g-num {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 800;
  background: var(--primary); color: #fff;
}
.guide-step .g-desc { font-size: 13px; color: var(--gray); line-height: 1.5; margin-top: 4px; }
.guide-tip {
  margin-top: 12px; font-size: 13px; line-height: 1.55;
  background: var(--accent-soft); border: 1px solid var(--accent-border);
  border-radius: 10px; padding: 10px 14px;
}

.link-btn {
  background: none; border: none; cursor: pointer;
  color: var(--primary); font-size: 14px; font-weight: 600; padding: 0;
}
.link-btn:hover { text-decoration: underline; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--gray); font-size: 14px; }
.mt { margin-top: 14px; }

@media (max-width: 600px) {
  .container { padding: 10px; }
  .card { padding: 14px; }
  .stat .num { font-size: 24px; }
}
