/* R46 – dedicated mobile layout. Loaded LAST, scoped to /nhap-bieu-mau/.
   One navigation bar per state; no horizontal clipping; ordinary desktop remains intact. */
body.jvp-form-page {
  --jvp-gutter: clamp(14px, 4vw, 20px);
  --jvp-header-height: calc(61px + env(safe-area-inset-top, 0px));
  --jvp-tab-height: calc(65px + env(safe-area-inset-bottom, 0px));
  --jvp-action-height: calc(69px + env(safe-area-inset-bottom, 0px));
}
#main #home .form-group .group-heading > div,
#main #home .form-group .item > div { min-width: 0; overflow-wrap: anywhere; }
/* R22's 25px arrow column must never hold a text status. */
#main #home .form-group .item:not(.available) {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 4px !important;
}
#main #home .form-group .item:not(.available) .status {
  grid-column: 1 / -1; max-width: 100%; width: auto;
  white-space: normal; text-align: left; overflow-wrap: anywhere;
  color: #61717c;
}
#main #home .group-heading { flex-wrap: wrap; gap: 6px 12px; }
#main #home .group-heading > div { flex: 1 1 175px; }
#main #home .group-heading > span {
  flex: 0 1 auto; max-width: 100%; white-space: normal; overflow-wrap: anywhere;
}
#main #home .jvp46-draft {
  padding: 0 14px; margin: 0; background: #fff; border: 1px solid #dce5e9;
}
#main .jvp46-draft > summary, #main .jvp46-save > summary {
  cursor: pointer; min-height: 44px; padding: 12px 0;
  color: #183b50; font-size: 14px; font-weight: 650; line-height: 1.45;
}
#main .jvp46-draft-body { padding: 0 0 14px; }
#main .jvp46-draft-body > label, #main .jvp46-file-caption {
  display: block; color: #183b50; font-size: 13px; font-weight: 600; margin: 10px 0 5px;
}
#main .jvp46-file-picker {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  align-items: center; gap: 10px; position: relative; min-width: 0;
  min-height: 48px; border: 1px solid #cbd6dc; border-radius: 7px; padding: 5px;
}
#main .jvp46-file-picker #jvp-draft-file {
  position: absolute; width: 1px !important; height: 1px !important;
  min-height: 0 !important; padding: 0 !important; margin: 0 !important;
  clip-path: inset(50%); white-space: nowrap; overflow: hidden;
}
#main .jvp46-file-picker label {
  display: flex; align-items: center; justify-content: center; min-height: 44px;
  margin: 0; padding: 6px 12px; border: 1px solid #dce5e9;
  border-radius: 5px; background: #f5f7f8; color: #183b50; cursor: pointer; font-size: 13px;
}
#main .jvp46-file-picker input:focus-visible + label { outline: 2px solid #426d80; outline-offset: 2px; }
#main #jvp46-file-name { min-width: 0; font-size: 13px; color: #536671; overflow-wrap: anywhere; }
#main .jvp46-draft-body input:not([type=file]) { font-size: 16px !important; min-height: 48px; }
#main .jvp46-draft-body p:empty { display: none; }
#main #wizard .jvp46-save { border-top: 1px solid #dce5e9; margin-top: 12px; }
#main #wizard .jvp46-save > summary { font-size: 13px; }
#main .jvp46-draft-body #jvp-import-status:not(:empty),
#main .jvp46-draft-body #jvp-save-status:not(:empty) { padding-top: 9px; overflow-wrap: anywhere; }
@media screen and (max-width: 1023px) {
  html body.jvp-form-page { margin: 0; min-width: 0; }
  html body.jvp-form-page.jvi-common-nav { padding-bottom: var(--jvp-tab-height) !important; }
  html body.jvp-form-page:has(#wizard:not([hidden])) { padding-bottom: var(--jvp-action-height) !important; }
  /* Safe-area insets belong to the fixed header, not to each child. */
  html body.jvp-form-page #jvi-common-header {
    padding-top: env(safe-area-inset-top, 0px) !important;
  }
  html body.jvp-form-page #jvi-common-header .jvi-common-inner {
    padding-left: max(var(--jvp-gutter), env(safe-area-inset-left, 0px)) !important;
    padding-right: max(var(--jvp-gutter), env(safe-area-inset-right, 0px)) !important;
    gap: 8px !important;
  }
  html body.jvp-form-page #jvi-common-header .jvi-common-logo {
    flex: 1 1 auto !important; min-width: 0 !important; width: auto !important;
  }
  html body.jvp-form-page #jvi-common-header .jvi-common-actions { gap: 6px !important; }
  html body.jvp-form-page #jvi-common-header .jvi-common-icon {
    width: 44px !important; min-width: 44px !important; height: 44px !important; flex-basis: 44px !important;
  }
  html body.jvp-form-page #jvi-common-header #navigation {
    max-height: calc(100vh - var(--jvp-header-height)) !important;
    max-height: calc(100dvh - var(--jvp-header-height)) !important; overflow-y: auto;
  }
  html body.jvp-form-page.jvi-common-fixed #jvi-common-header-space {
    height: var(--jvp-header-height) !important; min-height: var(--jvp-header-height) !important;
  }
  html body.jvp-form-page #jvi-common-bottom {
    padding-left: max(5px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(5px, env(safe-area-inset-right, 0px)) !important;
    min-height: var(--jvp-tab-height) !important; height: var(--jvp-tab-height) !important;
  }
  html body.jvp-form-page:has(#wizard:not([hidden])) #jvi-common-bottom,
  html body.jvp-form-page:has(#wizard:not([hidden])) #jvi-common-up,
  html body.jvp-form-page:has(#wizard:not([hidden])) .jvi-top { display: none !important; }
  html body.jvp-form-page #jvi-common-up {
    bottom: calc(var(--jvp-tab-height) + 12px) !important; right: var(--jvp-gutter) !important;
  }
  #main.shell {
    width: 100%; max-width: 100%; margin: 0 auto;
    padding-left: max(var(--jvp-gutter), env(safe-area-inset-left, 0px));
    padding-right: max(var(--jvp-gutter), env(safe-area-inset-right, 0px));
  }
  #main #home, #main #wizard, #main .workspace, #main .panel, #main .catalog,
  #main #fields, #main .field, #main .form-group, #main .filters, #main .side { min-width: 0; max-width: 100%; }
  #main #home .jvi-breadcrumb { padding-top: 12px; }
  #main #home .hero { margin: 0; padding: 12px 0 12px !important; border-radius: 0; overflow: visible; }
  #main #home .hero:after { content: none; }
  #main #home .hero h1 { font-size: clamp(23px, 5.5vw, 28px) !important; line-height: 1.25 !important; }
  #main #home .hero p { font-size: 14px !important; line-height: 1.5 !important; }
  #main #home .jvi41-form-links { gap: 4px 12px; margin-top: 7px; }
  #main #home .jvi41-form-links a { display: inline-flex; align-items: center; min-height: 32px; font-size: 12px; }
  #main #home .jvi-install-home { margin: 0; }
  #main #home .jvi-install-action { min-height: 38px; padding: 6px 0; font-size: 13px; }
  #main #home .section { margin: 0; padding: 20px 0 24px !important; }
  #main #home .catalog-heading { margin-bottom: 8px; }
  #main #home .r20-groups.jvp42-all-groups {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px !important; margin: 0 0 12px !important;
  }
  #main #home .r20-groups button {
    justify-content: center; padding: 9px 7px !important; min-height: 56px !important;
    font-size: 13px !important; line-height: 1.3; white-space: normal; overflow-wrap: anywhere;
  }
  #main #home .r20-groups button small {
    font-size: 11px !important; line-height: 1.25 !important; margin: 0; overflow-wrap: anywhere;
  }
  #main #home .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 12px; gap: 10px !important; align-items: start; }
  #main #home .filters label:first-child { grid-column: 1 / -1; }
  #main #home .filters:has(#r20-native-group[hidden]) { grid-template-columns: minmax(0, 1fr); }
  #main #home .filters label { min-width: 0; }
  #main #home .filters input, #main #home .filters select { min-height: 48px; font-size: 16px !important; width: 100%; max-width: 100%; min-width: 0; }
  #main #home .catalog { grid-template-columns: minmax(0, 1fr); gap: 16px !important; }
  #main #home .group-heading { padding: 11px 12px !important; border-radius: 7px 7px 0 0 !important; }
  #main #home .group-heading h3 { font-size: 16px !important; }
  #main #home .group-heading > span { font-size: 11px; padding: 3px 7px; }
  #main #home .form-group .item.available { grid-template-columns: minmax(0, 1fr) 25px !important; min-height: 66px !important; }
  #main #home .form-group .item:not(.available) { min-height: 64px !important; }
  /* Form layout. Compact, single scrolling document, only ONE fixed action bar. */
  #main #wizard .workspace { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 18px; }
  #main #wizard #return { min-height: 44px; }
  #main #wizard .wizard-head { margin: 0 0 14px; }
  #main #wizard #form-title { font-size: clamp(22px, 5vw, 27px) !important; line-height: 1.3 !important; overflow-wrap: anywhere; }
  #main #wizard #form-jp { overflow-wrap: anywhere; }
  #main #wizard #fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; }
  #main #wizard #fields .field { min-width: 0; scroll-margin-top: calc(var(--jvp-header-height) + 14px); scroll-margin-bottom: calc(var(--jvp-action-height) + 14px); }
  #main #wizard #fields .field > label, #main #wizard #fields .field legend {
    font-size: 14px; line-height: 1.45; overflow-wrap: anywhere;
  }
  #main #wizard #fields .jvf-date-row { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr); gap: 7px; }
  #main #wizard #fields .jvf-date-part input { padding-inline: 5px !important; }
  #main #wizard #fields .choices { min-width: 0; }
  #main #wizard #fields .choices label { min-width: 0; overflow-wrap: anywhere; word-break: normal; padding: 9px 10px; }
  #main #wizard #fields .check-line { flex-wrap: nowrap; min-width: 0; }
  #main #wizard #fields .check-line > span { min-width: 0; overflow-wrap: anywhere; }
  #main #wizard #fields .jvp-field-guide summary { min-height: 36px; }
  #main #wizard #fields .field-error:empty { display: none; }
  #main #wizard .actionbar {
    position: fixed !important; inset: auto 0 0 !important; width: auto !important;
    max-width: none !important; z-index: 1002 !important; margin: 0 !important;
    padding: 10px max(var(--jvp-gutter), env(safe-area-inset-right, 0px))
      calc(10px + env(safe-area-inset-bottom, 0px))
      max(var(--jvp-gutter), env(safe-area-inset-left, 0px)) !important;
    gap: 8px; display: flex; background: #fff !important; box-shadow: none;
  }
  #main #wizard .actionbar button { min-height: 48px !important; min-width: 0; padding: 10px 12px; }
  #main #wizard .actionbar #back { flex: 0 0 auto; min-width: 96px; }
  #main #wizard .actionbar #continue, #main #wizard .actionbar:has(#continue[hidden]) #back { flex: 1; }
  #main #wizard .actionbar button[hidden] { display: none !important; }
  #main #wizard .side .panel { padding: 12px 0; }
  #main #wizard .summary-row { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  #main #wizard .summary-row dd { overflow-wrap: anywhere; }
  #main #wizard .pager { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 5px; }
  #main #wizard .pager button { min-width: 0; padding: 8px 5px; white-space: normal; }
  #main #wizard #pdf-viewport { min-width: 0; max-width: 100%; scroll-margin-top: calc(var(--jvp-header-height) + 8px); }
  #main #wizard #pdf-viewport canvas { max-width: 100%; height: auto; }
  #main #wizard #download { min-height: 48px; }
  body.jvp-form-page .r8-footer { padding: 20px 0 !important; }
  body.jvp-form-page .r8-footer .foot {
    padding-left: max(var(--jvp-gutter), env(safe-area-inset-left, 0px));
    padding-right: max(var(--jvp-gutter), env(safe-area-inset-right, 0px));
    gap: 12px; grid-template-columns: minmax(0, 1fr);
  }
  body.jvp-form-page .r8-footer .foot > div { min-width: 0; overflow-wrap: anywhere; }
  /* While the keyboard is open, no fixed bottom elements can obscure a focused field. */
  html body.jvp-form-page[data-jvp-keyboard="true"] { padding-bottom: 0 !important; }
  html body.jvp-form-page[data-jvp-keyboard="true"] #jvi-common-bottom,
  html body.jvp-form-page[data-jvp-keyboard="true"] #jvi-common-up,
  html body.jvp-form-page[data-jvp-keyboard="true"] .jvi-top { display: none !important; }
  html body.jvp-form-page[data-jvp-keyboard="true"] #main #wizard .actionbar {
    position: static !important; inset: auto !important; width: 100% !important;
    padding: 10px 0 !important; margin: 12px 0 0 !important;
  }
  html body.jvp-form-page[data-jvp-keyboard="true"] #main #wizard #fields .field { scroll-margin-bottom: 14px; }
}
@media screen and (max-width: 767px) {
  #main #home .r20-groups.jvp42-all-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #main #wizard .panel { padding: 0; border: 0; border-radius: 0; }
  #main #wizard #step-panel { border-top: 1px solid #dbe3e7; padding-top: 14px; }
  #main #wizard #fields { grid-template-columns: minmax(0, 1fr); gap: 17px; }
  #main #wizard #fields .field { grid-column: 1 / -1 !important; }
  #main #wizard #fields .choices:has(>label:nth-child(3)) { grid-template-columns: minmax(0, 1fr); }
  #main #wizard .jvf-guide-row { flex-wrap: wrap; min-width: 0; }
}
@media screen and (max-width: 360px) {
  #main #home .r20-groups button { font-size: 12px !important; }
  #main #home .r20-groups button small { font-size: 10px !important; }
  #main #wizard #fields .choices label { font-size: 13px; padding-inline: 8px; }
}
@media print {
  body.jvp-form-page #main #wizard .actionbar, body.jvp-form-page .jvp46-draft, body.jvp-form-page .jvp46-save { display: none !important; }
}

/* R49: keep the public, usable catalogue first; the draft opener is optional.
   The roadmap is plain information, not part of the supported form catalogue. */
#main #home #jvp-import-details {
  margin: 0 0 4px; padding: 0 !important; border: 0 !important;
  background: transparent; box-shadow: none; border-radius: 0;
}
#main #home #jvp-import-details > summary {
  display: list-item; width: fit-content; max-width: 100%;
  min-height: 44px; padding: 11px 0; font-size: 14px;
  font-weight: 600; color: #36586b; text-decoration: underline; text-underline-offset: 3px;
}
#main #home #jvp-import-details[open] > .jvp46-draft-body {
  max-width: 560px; padding: 12px 14px 16px; margin: 2px 0 12px;
  border: 1px solid #dce5e9; background: #fff; border-radius: 8px;
}
#main #home .jvp49-roadmap {
  border-top: 1px solid #dce5e9; padding: 22px 0 26px; margin: 16px 0 0; min-width: 0;
}
#main #home .jvp49-roadmap-head { margin: 0 0 14px; }
#main #home .jvp49-roadmap-head h2 {
  margin: 0 0 5px; font-size: clamp(18px, 3.8vw, 22px); line-height: 1.35; color: #183b50;
}
#main #home .jvp49-roadmap-head p {
  margin: 0; color: #536671; font-size: 14px; line-height: 1.5;
}
#main #home .jvp49-roadmap-list {
  list-style: none; padding: 0; margin: 0; display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
}
#main #home .jvp49-roadmap-list > li {
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  min-width: 0; margin: 0; padding: 11px 12px; border: 1px solid #dce5e9;
  border-radius: 7px; background: #f5f7f8; color: #405665; overflow-wrap: anywhere;
  font-size: 14px; line-height: 1.4;
}
#main #home .jvp49-roadmap-list > li > span { font-weight: 600; }
#main #home .jvp49-roadmap-list > li > small { color: #536671; font-size: 12px; line-height: 1.35; }
@media (max-width: 768px) {
  #main #home .jvp49-roadmap-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 390px) {
  #main #home .jvp49-roadmap-list { grid-template-columns: minmax(0, 1fr); }
  #main #home .jvp49-roadmap-list > li { padding: 9px 11px; }
}

/* R50: one interaction reveals the actual forms directly beneath its header. */
#main #home .jvp50-catalog-section { margin: 24px 0 12px !important; padding-bottom: 0 !important; }
#main #home .jvp50-catalog-section .catalog-heading { margin: 0 0 12px; }
#main #home #catalog { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; gap:12px !important; margin:0; padding:0; border:0; }
#main #home #catalog .jvp50-group { min-width:0; margin:0; padding:0; border:1px solid #d5e0e5 !important; border-radius:9px !important; background:#fff !important; box-shadow:none; overflow:hidden; }
#main #home #catalog .jvp50-summary {
  list-style:none; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center;
  width:100%; gap:12px; min-height:76px; padding:14px 16px !important; margin:0;
  cursor:pointer; background:#fff !important; color:#183b50; border:0 !important; border-radius:0 !important;
  scroll-margin-top:calc(var(--jvp-header-height) + 12px);
}
#main #home #catalog .jvp50-summary::-webkit-details-marker { display:none; }
#main #home #catalog .jvp50-summary::marker { content:""; }
#main #home #catalog .jvp50-label { display:flex; flex-direction:column; align-items:flex-start; min-width:0; gap:4px; color:inherit; background:transparent; padding:0; border-radius:0; overflow-wrap:anywhere; white-space:normal; }
#main #home #catalog .jvp50-vi { color:inherit; font-size:17px; font-weight:700; line-height:1.35; }
#main #home #catalog .jvp50-label .jp { color:#536671 !important; font-size:12px; font-weight:400; line-height:1.5; }
#main #home #catalog .jvp50-meta { background:transparent; padding:0; display:flex; gap:12px; align-items:center; color:inherit; white-space:nowrap; }
#main #home #catalog .jvp50-label > span, #main #home #catalog .jvp50-meta > span { background:transparent; padding:0; border-radius:0; }
#main #home #catalog .jvp50-count { color:#536671; font-size:12px; font-weight:600; }
#main #home #catalog .jvp50-chevron { width:9px; height:9px; color:inherit; box-sizing:border-box; border-right:1.7px solid currentColor; border-bottom:1.7px solid currentColor; transform:rotate(45deg); margin:0 3px 4px; }
#main #home #catalog .jvp50-group[open] > .jvp50-summary { background:#183b50 !important; color:#fff; }
#main #home #catalog .jvp50-group[open] .jvp50-summary .jp,
#main #home #catalog .jvp50-group[open] .jvp50-count { color:#e1edf2 !important; }
#main #home #catalog .jvp50-group[open] .jvp50-chevron { transform:rotate(225deg); margin:4px 3px 0; }
#main #home #catalog .jvp50-summary:focus-visible { outline:2px solid #467895; outline-offset:-4px; }
#main #home #catalog .jvp50-group:not([open]) > .jvp50-items { display:none !important; }
#main #home #catalog .jvp50-items { min-width:0; }
#main #home #catalog .jvp50-items .item.available { padding:13px 16px !important; border-radius:0 !important; min-height:64px !important; }
#main #home #catalog .jvp50-items .item:last-child { border-bottom:0; }
@media(max-width:1023px) {
  #main #home #catalog { grid-template-columns:minmax(0,1fr); }
  #main #home #catalog .jvp50-summary { min-height:68px; padding:12px 14px !important; }
  #main #home #catalog .jvp50-vi { font-size:16px; }
  #main #home #catalog .jvp50-meta { gap:9px; }
}
@media(max-width:360px) {
  #main #home #catalog .jvp50-summary { padding:12px !important; gap:8px; }
  #main #home #catalog .jvp50-meta { gap:7px; }
}
