:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --ink: #0f1b30;
  --ink-2: #33415c;
  --muted: #64748b;
  --line: #e2e8f0;
  --blue: #0166b3;
  --blue-dark: #014f8c;
  --blue-soft: #e6f1fc;
  --orange: #f16a33;
  --orange-soft: #fff0ea;
  --green: #0e7a5f;
  --green-soft: #e3f4ee;
  --red: #b42318;
  --red-soft: #fef2f2;
  --sans: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; overflow-x: clip; width: 100%; }
body {
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: #e6ecf5;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }

.m-shell {
  width: min(460px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: clip;
  box-shadow: 0 0 40px rgba(15, 27, 48, .12);
}

/* Thanh trên */
.m-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 56px;
  padding: 0 14px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.m-brand { display: flex; align-items: center; gap: 9px; color: var(--ink); min-width: 0; }
.m-brand img { width: 32px; height: 32px; object-fit: contain; flex: none; }
.m-brand div { display: grid; line-height: 1.15; min-width: 0; }
.m-brand b { font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-brand span { font-size: 11px; color: var(--muted); font-weight: 500; }

.m-top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.m-pill-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
}
.m-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid #c6def4;
  background: var(--blue-soft);
  color: var(--blue);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
}

/* Vùng nội dung chính */
.m-main {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 12px 12px calc(78px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 12px;
}
.m-main > *, .m-card > *, .m-form > *, .m-field, .m-pw-wrap, .m-input, .m-select, .m-textarea {
  min-width: 0;
  max-width: 100%;
}

/* Thẻ & tiêu đề */
.m-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 8px -4px rgba(15, 27, 48, .06);
  display: grid;
  gap: 12px;
}
.m-hero {
  background: linear-gradient(145deg, #01467e 0%, #0166b3 65%, #008ad1 100%);
  color: #fff;
  border: 0;
  border-radius: 18px;
  padding: 20px 18px;
  display: grid;
  gap: 10px;
}
.m-eyebrow {
  display: inline-block;
  width: fit-content;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  color: #ffe2d6;
}
.m-hero h1 { font-size: 21px; line-height: 1.28; font-weight: 700; }
.m-hero p { font-size: 13.5px; color: rgba(255, 255, 255, .88); line-height: 1.5; }
.m-hero-btns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-top: 4px; }

.m-sec-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.m-sec-head h2 { font-size: 16px; font-weight: 700; color: var(--ink); }
.m-sec-link { font-size: 13px; font-weight: 600; color: var(--blue); }

/* Lưới KPI 2x2 dễ nhìn */
.m-kpi-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.m-kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  display: grid;
  gap: 4px;
}
.m-kpi span { font-size: 12px; color: var(--muted); font-weight: 500; }
.m-kpi b { font-size: 23px; font-weight: 700; color: var(--ink); line-height: 1.15; font-variant-numeric: tabular-nums; }
.m-kpi b small { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.m-kpi.accent b { color: var(--blue); }
.m-kpi.warn b { color: var(--orange); }
.m-kpi.ok b { color: var(--green); }

/* Thanh tiến độ biểu đồ */
.m-bars { display: grid; gap: 11px; }
.m-bar-item { display: grid; gap: 5px; font-size: 13px; }
.m-bar-top { display: flex; justify-content: space-between; gap: 10px; }
.m-bar-top span { color: var(--ink-2); font-weight: 500; }
.m-bar-top b { font-variant-numeric: tabular-nums; color: var(--ink); }
.m-bar-track { height: 7px; border-radius: 99px; background: #e8eef6; overflow: hidden; }
.m-bar-fill { height: 100%; border-radius: 99px; background: var(--blue); }
.m-bar-fill.alt { background: var(--orange); }

/* Vuốt ngang thẻ lĩnh vực / lọc */
.m-hscroll {
  display: flex;
  gap: 8px;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.m-hscroll::-webkit-scrollbar { display: none; }
.m-chip-filter {
  flex: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
}
.m-chip-filter.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.m-domain-card {
  flex: 0 0 min(215px, 78%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 6px;
}
.m-domain-card b { font-size: 14px; color: var(--blue); }
.m-domain-card p { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }

/* Danh sách phiếu dạng card lớn dễ bấm */
.m-ticket-list { display: grid; gap: 10px; }
.m-ticket {
  display: grid;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 14px 15px;
  color: inherit;
  transition: transform .12s, border-color .12s;
}
.m-ticket:active { transform: scale(.985); border-color: var(--blue); }
.m-ticket-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.m-code { font-size: 12.5px; font-weight: 700; color: var(--blue); }
.m-ticket-title { font-size: 14.5px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.m-ticket-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--muted); align-items: center; }

.m-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}
.st-moi { background: var(--blue-soft); color: var(--blue); }
.st-dang_xu_ly { background: var(--orange-soft); color: #c84b18; }
.st-da_phan_hoi { background: var(--green-soft); color: var(--green); }
.st-da_dong { background: #eef1f6; color: var(--muted); }
.m-tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: var(--blue-soft); color: var(--blue); }

/* Tiến trình xử lý 4 bước dễ nhìn trên di động */
.m-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 4px 0;
}
.m-pg-step { display: grid; justify-items: center; gap: 6px; text-align: center; position: relative; }
.m-pg-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e6ecf5;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  z-index: 1;
}
.m-pg-step span { font-size: 11px; color: var(--muted); line-height: 1.25; font-weight: 500; }
.m-pg-step.done .m-pg-dot { background: var(--green); color: #fff; }
.m-pg-step.done span { color: var(--green); font-weight: 600; }
.m-pg-step.current .m-pg-dot { background: var(--blue); color: #fff; box-shadow: 0 0 0 4px rgba(1, 102, 179, .18); }
.m-pg-step.current span { color: var(--blue); font-weight: 700; }

/* Nút & Form cảm ứng to rõ */
.m-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.m-btn:disabled { opacity: .55; cursor: default; }
.m-btn.primary { background: var(--blue); color: #fff; }
.m-btn.white { background: #fff; color: var(--blue-dark); }
.m-btn.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.m-btn.outline-white { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .36); color: #fff; }
.m-btn.danger { background: var(--red-soft); border-color: #fecaca; color: var(--red); }
.m-btn.block { width: 100%; }
.m-btn.sm { min-height: 36px; font-size: 13px; padding: 0 12px; border-radius: 9px; }

.m-form { display: grid; gap: 13px; }
.m-field { display: grid; gap: 5px; }
.m-field label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; justify-content: space-between; align-items: center; }
.m-input, .m-select, .m-textarea {
  width: 100%;
  min-height: 44px;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid #d5dee9;
  border-radius: 11px;
  padding: 9px 12px;
}
.m-textarea { min-height: 92px; resize: vertical; }
.m-input:focus, .m-select:focus, .m-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(1, 102, 179, .14);
}
.m-search {
  width: 100%;
  min-height: 42px;
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  background: var(--card);
}
.m-err {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--red-soft);
  border: 1px solid #fecaca;
  color: var(--red);
  font-size: 13px;
}
.m-err:empty { display: none; }

/* Nút chọn nhanh (Wizard / Tap chips) */
.m-chips-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.m-chip-opt {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  padding: 9px 13px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
}
.m-chip-opt.on {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-dark);
}
.m-level-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.m-level-btn {
  min-width: 0;
  min-height: 46px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  font: inherit;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.m-level-btn.on { border-color: var(--blue); background: var(--blue); color: #fff; }

.m-wiz-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.m-wiz-bar { height: 5px; border-radius: 99px; background: #dde5f0; }
.m-wiz-bar.done { background: var(--blue); }
.m-wiz-nav { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px; margin-top: 6px; }

/* Auth mobile gọn & vừa khít mọi màn hình */
.m-auth-card {
  position: relative;
  overflow: hidden;
  padding: 18px 15px 15px;
  gap: 11px;
}
.m-auth-card::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue) 0 72%, var(--orange) 72%);
}
.m-auth-head { text-align: center; display: grid; gap: 3px; }
.m-auth-logo { width: 34px; height: 34px; object-fit: contain; margin: 0 auto 2px; display: block; }
.m-auth-head h2 { font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.m-auth-head p { font-size: 12px; color: var(--muted); line-height: 1.4; text-wrap: balance; }

.m-auth-card .m-form { gap: 9px; }
.m-auth-card .m-field { gap: 4px; }
.m-auth-card .m-field label { font-size: 12px; }
.m-auth-card .m-input, .m-auth-card .m-select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  height: 38px;
  font-size: 13.5px;
  border-radius: 9px;
  padding: 6px 10px;
}
.m-auth-card .m-btn { min-height: 40px; border-radius: 9px; font-size: 13.5px; }
.m-auth-row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.m-auth-unit { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 8px; }

.m-pw-wrap { position: relative; display: flex; align-items: center; width: 100%; min-width: 0; }
.m-pw-wrap .m-input { padding-right: 34px; }
.m-pw-eye {
  position: absolute;
  right: 3px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.m-pw-eye svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.m-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 1px 0; }
.m-or::before, .m-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.m-tabs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3px; background: #eaf0f7; padding: 3px; border-radius: 10px; }
.m-tab {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px;
  border-radius: 7px;
  color: var(--ink-2);
  cursor: pointer;
}
.m-tab.active { background: #fff; color: var(--blue); box-shadow: 0 2px 6px rgba(15, 27, 48, .08); }
.m-otp-box { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; width: 100%; }
.m-otp-box input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  border: 1.5px solid #cfdbe9;
  border-radius: 9px;
  background: #f8fafd;
}
.m-otp-box input:focus { outline: none; border-color: var(--blue); background: #fff; }
.m-btn-google {
  min-height: 40px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 9px;
  border: 1.5px solid #d5dee9;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
}
.m-btn-google svg { width: 16px; height: 16px; }
.m-auth-foot {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid #eef2f7;
  text-align: center;
}
.m-auth-foot a, .m-auth-foot button {
  background: none; border: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}

/* Chi tiết & Trao đổi */
.m-kv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.m-kv div { background: var(--bg); padding: 9px 11px; border-radius: 10px; display: grid; gap: 2px; }
.m-kv dt { font-size: 11.5px; color: var(--muted); }
.m-kv dd { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.m-comment {
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--bg);
  display: grid;
  gap: 4px;
}
.m-comment.admin { background: var(--blue-soft); }
.m-comment-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }

/* FAQ & Info */
details.m-faq { border-bottom: 1px solid var(--line); padding: 10px 0; }
details.m-faq:last-child { border-bottom: 0; }
details.m-faq summary { font-weight: 600; font-size: 14px; cursor: pointer; }
details.m-faq p { margin-top: 6px; font-size: 13px; color: var(--ink-2); }

/* Thanh điều hướng đáy kiểu app di động */
.m-tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, 100%);
  min-height: 62px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  z-index: 40;
}
.m-nav-item {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 2px;
  border-radius: 10px;
}
.m-nav-item svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.m-nav-item.active { color: var(--blue); }
.m-nav-item.cta { color: var(--orange); }
.m-nav-item.cta.active { color: var(--blue); }

.m-toast {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(400px, calc(100% - 28px));
  background: #0f1b30;
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  padding: 11px 16px;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 27, 48, .25);
  z-index: 60;
  text-align: center;
}
.m-toast.err { background: var(--red); }

@media (max-width: 480px) {
  .m-shell { box-shadow: none; }
}
