:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --card: #fff;
  --ink: #14263a;
  --muted: #51657a;
  --line: #d8e3ee;
  --brand: #0b6fb8;
  --brand-d: #084f85;
  --brand-l: #eaf4fc;
  --accent: #c74500;
  --warn: #fff4d6;
  --warn-ink: #6b4a00;
  --shadow: 0 3px 16px rgba(20, 38, 58, 0.05);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    18px/1.6 "Segoe UI",
    system-ui,
    -apple-system,
    Roboto,
    Arial,
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: default;
}

a {
  color: var(--brand-d);
  text-underline-offset: 3px;
}

img,
svg {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--card);
  color: var(--brand-d);
  font-weight: 700;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.wrap {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Nhận diện và tìm kiếm */
header.hero {
  padding: 28px 0 8px;
  background: linear-gradient(115deg, var(--brand-d), var(--brand));
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-home {
  display: block;
  flex: none;
  max-width: 100%;
  border-radius: 4px;
}

.brand-home:focus-visible {
  outline-color: #ffbc8d;
}

.brand img {
  display: block;
  flex: none;
  width: 200px;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
}

.brandtxt {
  min-width: 0;
}

.brandtxt > span,
.eyebrow {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(27px, 3.5vw, 38px);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.hero p {
  max-width: 760px;
  margin: 16px 0 0;
  font-size: 18px;
}

.search-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 12px 0;
  background: linear-gradient(115deg, var(--brand-d), var(--brand));
  box-shadow: 0 4px 16px rgba(20, 38, 58, 0.18);
}

.search-context {
  padding: 8px 0 24px;
  background: linear-gradient(115deg, var(--brand-d), var(--brand));
  color: #fff;
}

.search {
  position: relative;
  display: block;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.search input {
  display: block;
  width: 100%;
  min-height: 58px;
  padding: 14px 58px 14px 50px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  appearance: none;
}

.search input::placeholder {
  color: #52657a;
  opacity: 1;
}

.search input::-webkit-search-cancel-button {
  appearance: none;
}

.search input:focus-visible {
  outline-color: #ffbc8d;
}

.search > svg {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 22px;
  height: 22px;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.search-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--brand-l);
  color: var(--brand-d);
  font-size: 26px;
  transform: translateY(-50%);
}

.quick-search {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
}

.quick-label {
  margin-right: 2px;
  font-size: 16px;
}

.quick-chip {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  background: transparent;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.quick-chip:hover,
.quick-chip[aria-pressed="true"] {
  background: #fff;
  color: var(--brand-d);
}

.quick-chip:focus-visible {
  outline-color: #ffbc8d;
}

.search-context .requirements {
  max-width: 860px;
  margin: 16px 0 0;
  font-size: 16px;
  line-height: 1.5;
}

/* Danh sách giấy tờ */
.catalog {
  padding: 28px 0 0;
}

.gridhead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.gridhead h2 {
  margin: 0;
  font-size: clamp(23px, 3vw, 28px);
  line-height: 1.3;
}

.gridhead small {
  color: var(--muted);
  font-size: 16px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-content: start;
  align-items: start;
  gap: 10px 14px;
  width: 100%;
  min-height: 148px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: left;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.card:hover {
  border-color: var(--brand);
  box-shadow: 0 5px 20px rgba(11, 111, 184, 0.1);
}

.card-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 12px;
  background: var(--brand-l);
  font-size: 29px;
  line-height: 1;
}

.card-copy {
  min-width: 0;
}

.card h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
  overflow-wrap: break-word;
}

.card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.card-meta {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.card-link {
  grid-column: 2;
  align-self: end;
  color: var(--brand-d);
  font-size: 16px;
  font-weight: 700;
}

.card.soon .card-icon {
  background: #f1f3f6;
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}

.badge.soon {
  background: var(--warn);
  color: var(--warn-ink);
}

.empty {
  margin: 0;
  padding: 32px 20px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--muted);
  text-align: center;
}

.empty .btn {
  display: block;
  margin: 16px auto 0;
}

/* Các nội dung chuẩn bị mở khi cần */
.support-panels {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.panel > summary {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 14px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
  list-style: none;
}

.panel > summary::-webkit-details-marker {
  display: none;
}

.panel > summary::after {
  content: "+";
  flex: none;
  color: var(--brand-d);
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
}

.panel[open] > summary::after {
  content: "−";
}

.panel > summary:hover {
  background: var(--brand-l);
}

.prep,
.journey {
  display: grid;
  gap: 12px;
  padding: 4px 20px 20px;
}

.prep > div {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 10px;
  background: var(--brand-l);
  font-size: 17px;
}

.prep .ic {
  flex: none;
  font-size: 27px;
  line-height: 1.4;
}

.prep b,
.journey b {
  display: block;
  margin-bottom: 3px;
}

.journey {
  counter-reset: journey;
}

.journey > div {
  position: relative;
  padding: 12px 12px 12px 54px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 17px;
}

.journey > div::before {
  position: absolute;
  top: 14px;
  left: 12px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-l);
  color: var(--brand-d);
  font-size: 16px;
  font-weight: 700;
  counter-increment: journey;
  content: counter(journey);
}

footer {
  margin-top: 32px;
  padding: 26px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 16px;
  text-align: center;
}

/* Trang hướng dẫn */
.detail {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(14, 32, 51, 0.6);
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.detail.open {
  display: block;
}

.sheet {
  width: 100%;
  max-width: 1080px;
  min-height: calc(100vh - 48px);
  margin: 24px auto;
  border-radius: 16px;
  background: var(--bg);
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.2);
}

.sheet-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  background: var(--card);
}

.back-button,
.btn {
  display: inline-flex;
  width: fit-content;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--brand-d);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.back-button {
  justify-self: end;
  border-color: transparent;
  background: var(--brand-l);
}

.back-button:hover,
.btn:hover {
  border-color: var(--brand);
  background: var(--brand-l);
}

.detail-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.detail-heading .ico {
  flex: none;
  font-size: 32px;
  line-height: 1.2;
}

.detail-heading h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.3;
  overflow-wrap: break-word;
}

.sheet-body {
  padding: 24px;
}

.lead {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 18px;
}

.flow-picker {
  margin-bottom: 28px;
}

.flow-picker > h3 {
  margin: 0 0 12px;
  font-size: 21px;
  line-height: 1.4;
}

.flow-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.flow-option {
  display: grid;
  min-height: 80px;
  align-content: center;
  gap: 4px;
  padding: 13px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  text-align: left;
}

.flow-option:hover {
  border-color: var(--brand);
}

.flow-option[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-l);
  box-shadow: inset 3px 0 var(--brand);
}

.flow-option-name {
  color: var(--brand-d);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.flow-option-meta {
  color: var(--muted);
  font-size: 15px;
}

.flow-content {
  scroll-margin-top: 180px;
}

.flow-title {
  margin: 0 0 8px;
  scroll-margin-top: 180px;
  font-size: 24px;
  line-height: 1.35;
}

.flowdesc {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 17px;
}

.steps {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.step-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  align-items: start;
  gap: 12px;
}

.step-number {
  display: grid;
  width: fit-content;
  min-width: 68px;
  height: 32px;
  padding: 4px 10px;
  flex: none;
  place-items: center;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.step-text {
  min-width: 0;
  padding-top: 2px;
  overflow-wrap: break-word;
}

.step-text > :first-child {
  margin-top: 0;
}

.step-text > :last-child {
  margin-bottom: 0;
}

.step-text b {
  color: var(--brand-d);
}

.step-text ul {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 22px;
  list-style: disc;
}

.step-media {
  display: grid;
  gap: 20px;
  min-width: 0;
  margin-top: 20px;
}

.step-figure {
  min-width: 0;
  margin: 0;
}

.zoom-button {
  display: flex;
  width: 100%;
  min-height: 44px;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f5f8fc;
  color: var(--brand-d);
  cursor: zoom-in;
}

.zoom-button:hover {
  border-color: var(--brand);
  background: var(--brand-l);
}

.zoom-button img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 500px;
  border-radius: 7px;
  object-fit: contain;
}

.zoom-label {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 7px 14px;
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
}

.step-figure figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
}

/* Video bổ sung, chỉ tải khi người dùng chọn phát */
.video-section {
  margin-top: 28px;
}

.videos {
  display: grid;
  gap: 22px;
  padding: 6px 20px 20px;
}

.vid {
  min-width: 0;
}

.vid h4 {
  margin: 0 0 10px;
  font-size: 18px;
}

.player {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: #10263a;
}

.player iframe,
.video-play {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-play {
  display: grid;
  padding: 0;
  place-items: center;
  background: #10263a;
}

.video-play:focus-visible {
  outline-offset: -5px;
}

.video-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
}

.play::after {
  width: 0;
  height: 0;
  margin-left: 5px;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 18px solid #fff;
  content: "";
}

.player.none {
  display: grid;
  min-height: 140px;
  padding: 20px;
  place-items: center;
  color: #fff;
  font-size: 17px;
  text-align: center;
}

.note {
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid #ecd59d;
  border-radius: 12px;
  background: var(--warn);
  color: var(--warn-ink);
  font-size: 17px;
}

.note b {
  display: block;
  margin-bottom: 4px;
}

.help {
  margin: 24px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 16px;
}

/* Ảnh phóng to */
.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 76px 24px 24px;
  background: rgba(8, 20, 33, 0.95);
}

.lb.open {
  display: flex;
}

.lb-close {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  z-index: 1;
  min-width: 120px;
  min-height: 46px;
  padding: 9px 16px;
  border: 1px solid #fff;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
}

.lb-close:hover {
  background: var(--brand-l);
}

.lb-close:focus-visible {
  outline-color: #ffbc8d;
}

.lb-content {
  display: flex;
  min-width: 0;
  max-width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: auto;
}

.lb-content img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 160px);
  max-height: calc(100dvh - 160px);
  border-radius: 8px;
  object-fit: contain;
}

.lb-content p {
  max-width: 760px;
  margin: 0;
  color: #fff;
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
}

@media (min-width: 640px) {
  .grid,
  .flow-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .prep {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .journey {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card {
    min-height: 202px;
    grid-template-rows: 1fr auto;
  }
}

@media (min-width: 800px) {
  .step.has-media {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 24px;
  }

  .step-media {
    margin-top: 0;
  }

  .videos {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vid:only-child {
    max-width: 720px;
    grid-column: 1 / -1;
  }
}

@media (min-width: 960px) {
  .grid,
  .flow-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .journey {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 639px) {
  .wrap {
    padding: 0 16px;
  }

  header.hero {
    padding: 22px 0 8px;
  }

  .brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .brand img {
    width: 160px;
    height: auto;
  }

  .brandtxt > span {
    font-size: 13px;
  }

  .hero h1 {
    font-size: 27px;
  }

  .hero p {
    margin-top: 14px;
  }

  .quick-label {
    width: 100%;
  }

  .search input {
    min-height: 56px;
    font-size: 17px;
  }

  .catalog {
    padding-top: 24px;
  }

  .card {
    padding: 16px;
  }

  .card h3 {
    font-size: 19px;
  }

  .sheet {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .sheet-head {
    gap: 10px;
    padding: max(12px, env(safe-area-inset-top)) 16px 14px;
    border-radius: 0;
  }

  .detail-heading {
    gap: 10px;
  }

  .detail-heading .ico {
    font-size: 29px;
  }

  .detail-heading h2 {
    font-size: 22px;
  }

  .sheet-body {
    padding: 20px 16px max(24px, env(safe-area-inset-bottom));
  }

  .step {
    padding: 16px;
  }

  .step-copy {
    gap: 10px;
  }

  .flow-title {
    scroll-margin-top: 220px;
  }

  .zoom-button {
    padding: 12px;
  }

  .zoom-button img {
    max-height: 540px;
  }

  .videos {
    padding: 4px 14px 16px;
  }

  .lb {
    padding: 78px 12px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .detail {
    position: static;
    overflow: visible;
    background: #fff;
  }

  .sheet {
    max-width: none;
    margin: 0;
    box-shadow: none;
  }

  .sheet-head {
    position: static;
  }

  .search-bar,
  .search-context,
  .search,
  .quick-search,
  .back-button,
  .flow-picker,
  .video-section,
  .zoom-label,
  .lb,
  .skip-link {
    display: none !important;
  }

  .step,
  .step-figure {
    break-inside: avoid;
  }
}
