/* Mina Scan — style riêng. Màu thương hiệu chọn ở Setup → Thương hiệu (BRAND_COLOR=#4f46e5). */
.hero { position: relative; overflow: hidden; padding: 4.5rem 0 3.5rem; }
.hero::before { content: ""; position: absolute; inset: -40% -10% auto auto; width: 60vw; height: 60vw; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(79,70,229,.14), transparent); z-index: -1; }
.hero h1 { font-weight: 800; letter-spacing: -.035em; line-height: 1.08; }
.hero .grad { background: linear-gradient(90deg, var(--brand), #9333ea); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ba { position: relative; border-radius: 18px; overflow: hidden; box-shadow: 0 30px 60px -25px rgba(15,23,42,.45); background: #111;
  aspect-ratio: 4/5; user-select: none; touch-action: none; }
.ba img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ba .after-wrap { position: absolute; inset: 0; clip-path: inset(0 0 0 50%); background: #fff; }
.ba .after-wrap img { object-fit: contain; }
.ba .handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; background: #fff; transform: translateX(-50%); cursor: ew-resize; }
.ba .handle::after { content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 40px; height: 40px;
  border-radius: 50%; background: #fff; color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.ba .tag { position: absolute; top: 12px; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: rgba(0,0,0,.55); color: #fff; }
.feature-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--brand-50); color: var(--brand); display: inline-flex;
  align-items: center; justify-content: center; font-size: 1.3rem; }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 700; }

/* ----- công cụ scan ----- */
.dropzone { border: 2px dashed #c7d2fe; border-radius: 16px; background: var(--brand-50); padding: 2.2rem 1rem; text-align: center;
  transition: background .15s, border-color .15s; cursor: pointer; }
.dropzone.drag { background: var(--brand-100); border-color: var(--brand); }
.pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.page-card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: var(--shadow-sm); cursor: grab; }
.page-card.sortable-ghost { opacity: .35; }
.page-card .thumb { aspect-ratio: 210/297; background: #f1f5f9; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.page-card .thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.page-card .num { position: absolute; top: 14px; left: 14px; background: rgba(15,23,42,.75); color: #fff; font-size: .72rem; font-weight: 600;
  border-radius: 999px; padding: .1rem .5rem; }
.page-card .tools { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.page-card .tools button { border: 0; background: transparent; color: var(--muted); padding: .15rem .35rem; border-radius: 6px; }
.page-card .tools button:hover { background: #f1f5f9; color: var(--ink); }
.page-card .warn { position: absolute; top: 14px; right: 14px; color: #b45309; background: #fef3c7; border-radius: 999px; font-size: .7rem; padding: .1rem .45rem; }
.side-panel { position: sticky; top: 88px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg input { display: none; }
.seg label { border: 1px solid var(--line); border-radius: 10px; padding: .55rem .3rem; text-align: center; cursor: pointer; font-size: .85rem; font-weight: 500; }
.seg label i { display: block; font-size: 1.1rem; margin-bottom: 2px; }
.seg input:checked + label { border-color: var(--brand); background: var(--brand-50); color: var(--brand-600); }
.doc-card .thumb { aspect-ratio: 210/297; background: #f8fafc; border-bottom: 1px solid var(--line); border-radius: 14px 14px 0 0; overflow: hidden; }
.doc-card .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }

/* ----- camera chụp liên tục ----- */
.cam { position: fixed; inset: 0; z-index: 2000; background: #000; color: #fff; overflow: hidden; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-frame { position: absolute; inset: 14% 8% 22%; pointer-events: none; }
.cam-frame span { position: absolute; width: 38px; height: 38px; border: 4px solid rgba(255,255,255,.9); }
.cam-frame span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.cam-frame span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.cam-frame span:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.cam-frame span:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }
.cam-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: .75rem;
  padding: calc(env(safe-area-inset-top) + 12px) 14px 12px; background: linear-gradient(rgba(0,0,0,.55), transparent); }
.cam-hint { flex: 1; text-align: center; font-size: .85rem; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.cam-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 1.15rem; }
.cam-btn.on { background: #facc15; color: #111; }
.cam-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 18px 26px calc(env(safe-area-inset-bottom) + 22px); background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.cam-shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.25); transition: transform .1s; }
.cam-shutter:active { transform: scale(.92); background: #fff; }
.cam-thumb { width: 54px; height: 54px; border-radius: 10px; background: rgba(255,255,255,.15) center/cover no-repeat; border: 2px solid #fff;
  position: relative; }
.cam-thumb span { position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--brand);
  font-size: .75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.cam-done { min-width: 64px; height: 44px; border-radius: 22px; border: 0; background: #fff; color: #111; font-weight: 600; padding: 0 16px; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .25s; }
.cam-flash.go { opacity: .7; transition: none; }

/* ----- chỉnh 4 góc ----- */
.crop-stage { position: relative; margin: 0 auto; width: fit-content; max-width: 100%; touch-action: none; user-select: none; }
.crop-stage img { display: block; max-width: 100%; max-height: 70vh; }
@media (max-width: 575.98px) { .crop-stage img { max-height: calc(100vh - 140px); } }
.crop-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.crop-stage polygon { fill: rgba(var(--brand-rgb), .18); stroke: var(--brand); stroke-width: 2; }
.crop-handle { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: rgba(255,255,255,.9);
  border: 3px solid var(--brand); box-shadow: 0 2px 8px rgba(0,0,0,.35); touch-action: none; cursor: grab; }
.page-card .warn.manual { color: var(--brand-600); background: var(--brand-50); }

/* ----- xem tài liệu trong app ----- */
.doc-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; position: sticky; top: 70px; z-index: 5; }
.doc-pages { display: flex; flex-direction: column; gap: 1rem; }
.doc-page { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: var(--shadow-sm); }
.doc-page img { width: 100%; height: auto; display: block; border-radius: 6px; }
.doc-page figcaption { text-align: center; font-size: .78rem; color: var(--muted); padding-top: 6px; }
.cam-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cam-auto { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 122px);
  border: 0; border-radius: 999px; padding: .35rem .9rem; background: rgba(0,0,0,.45); color: #fff; font-size: .8rem; }
.cam-auto[aria-pressed="true"] { background: var(--brand); }
.cam-hint.ok { color: #86efac; }
.plan-box { border: 1px dashed var(--line); border-radius: 12px; padding: .65rem .8rem; background: #fafbff; }
.seg input:disabled + label { opacity: .55; cursor: not-allowed; }
.doc-left { font-size: .72rem; border-radius: 999px; padding: .1rem .5rem; background: #f1f5f9; color: var(--muted); }
.doc-left.soon { background: #fef3c7; color: #92400e; }

/* ---- ký tên / đóng dấu ---- */
.sign-tray { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: 2px; }
.sign-add, .sign-item { flex: 0 0 auto; width: 92px; height: 64px; border-radius: 10px; border: 1px dashed var(--line);
  background: #fafbff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: .72rem; color: var(--muted); cursor: pointer; position: relative; }
.sign-add i { font-size: 1.15rem; color: var(--brand); }
.sign-item { border-style: solid; background: #fff; padding: 4px; }
.sign-item img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sign-item .del { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0;
  background: #ef4444; color: #fff; font-size: .7rem; line-height: 20px; padding: 0; }
.sign-pad canvas { width: 100%; height: auto; aspect-ratio: 5 / 2; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; touch-action: none; display: block;
  background-image: linear-gradient(transparent calc(75% - 1px), #e5e7eb calc(75% - 1px), #e5e7eb 75%, transparent 75%); }
.pad-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 1px var(--line); padding: 0; }
.pad-color.active { box-shadow: 0 0 0 2px var(--brand); }
.sign-stage { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #f3f4f6;
  user-select: none; -webkit-user-select: none; touch-action: none; }
.sign-stage > img { width: 100%; display: block; pointer-events: none; }
.placed { position: absolute; border: 1.5px dashed var(--brand); cursor: move; touch-action: none; }
.placed img { width: 100%; height: 100%; display: block; pointer-events: none; }
.placed .rs { position: absolute; right: -11px; bottom: -11px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: .7rem; display: flex; align-items: center; justify-content: center; cursor: nwse-resize; }
.placed .rm { position: absolute; right: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: #ef4444; color: #fff; font-size: .7rem; padding: 0; }

/* ---- chọn loại giấy tờ (dưới nút chụp) ---- */
.doctype { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.doctype input { position: absolute; opacity: 0; pointer-events: none; }
.doctype-opt { position: relative; display: flex; align-items: center; gap: .7rem; padding: .75rem .8rem; margin: 0;
  border: 1.5px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.doctype-opt:hover { border-color: var(--brand-100); }
.doctype-ic { flex: 0 0 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  background: #f1f5f9; color: #475569; font-size: 1.3rem; transition: background .15s, color .15s; }
.doctype-tx { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.doctype-tx b { font-size: .95rem; }
.doctype-tx small { color: var(--muted); font-size: .76rem; }
.doctype-ck { position: absolute; top: 8px; right: 9px; color: var(--brand); font-size: .95rem; opacity: 0; transform: scale(.6); transition: .15s; }
.doctype input:checked + .doctype-opt { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12); }
.doctype input:checked + .doctype-opt .doctype-ic { background: var(--brand); color: #fff; }
.doctype input:checked + .doctype-opt .doctype-ck { opacity: 1; transform: none; }
.doctype input:focus-visible + .doctype-opt { outline: 2px solid var(--brand); outline-offset: 2px; }
.card-guide { border-radius: 12px; background: #fff; border: 1px dashed var(--brand-100); padding: .65rem .8rem; }
.card-steps { display: flex; align-items: center; gap: .5rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
.card-step { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.card-step.now { color: var(--brand); }
.card-step.done { color: #16a34a; }
.card-step-line { flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.page-card .side { position: absolute; left: 8px; bottom: 44px; background: rgba(15,23,42,.72); color: #fff; font-size: .7rem;
  font-weight: 600; padding: 2px 8px; border-radius: 999px; }
@media (max-width: 380px) { .doctype-tx small { display: none; } }

/* kính lúp khi kéo góc */
.crop-loupe { position: absolute; display: none; width: 120px; height: 120px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,.45); pointer-events: none; z-index: 5; background: #111; }

/* ---- Tài liệu của tôi: chọn nhiều để xoá ---- */
.doc-card { position: relative; transition: transform .15s, box-shadow .15s, opacity .25s; }
.doc-check { position: absolute; top: 10px; left: 10px; z-index: 2; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(15,23,42,.35); color: transparent; display: none; align-items: center; justify-content: center;
  font-size: 1rem; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.selecting .doc-check { display: flex; }
.selecting .doc-card { cursor: pointer; }
.selecting .doc-card .btn, .selecting .doc-card .share-btn { pointer-events: none; opacity: .5; }
.doc-col.sel .doc-card { box-shadow: 0 0 0 3px var(--brand); transform: scale(.97); }
.doc-col.sel .doc-check { background: var(--brand); color: #fff; }
.doc-col.gone { opacity: 0; transform: scale(.9); transition: opacity .25s, transform .25s; }
.sel-bar { position: fixed; left: 50%; transform: translate(-50%, 140%); bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 1030;
  width: min(560px, calc(100% - 24px)); display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; border-radius: 14px;
  background: #fff; box-shadow: 0 10px 30px -8px rgba(15,23,42,.35); border: 1px solid var(--line); transition: transform .2s; }
.sel-bar.on { transform: translate(-50%, 0); }
@media (min-width: 992px) { .sel-bar { bottom: 24px; } }

/* ---- Gộp hồ sơ ---- */
.bundle-wrap { max-width: 720px; }
.bundle-step { padding: .9rem; }
.step-head { display: flex; align-items: center; gap: .55rem; margin-bottom: .7rem; }
.step-no { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: .78rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; }
.bundle-list { list-style: none; padding: 0; margin: 0 0 .6rem; display: flex; flex-direction: column; gap: .45rem; }
.bundle-item { display: flex; align-items: center; gap: .55rem; padding: .45rem .5rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.bundle-item .handle { color: #94a3b8; cursor: grab; touch-action: none; padding: 0 2px; font-size: 1.1rem; }
.bundle-item .idx { width: 20px; text-align: center; font-size: .8rem; font-weight: 700; color: var(--muted); flex: 0 0 20px; }
.bundle-item img { width: 36px; height: 48px; object-fit: cover; object-position: top; border-radius: 5px; border: 1px solid var(--line); flex: 0 0 36px; }
.bundle-item .meta { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.bundle-item .meta b { font-size: .9rem; font-weight: 600; }
.bundle-item .meta small { color: var(--muted); font-size: .75rem; }
.bundle-item .rm { border: 0; background: none; color: #94a3b8; padding: .3rem .4rem; }
.bundle-item.sortable-ghost { opacity: .4; }
.bundle-add { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.bundle-add .btn { white-space: nowrap; font-size: .88rem; padding: .45rem .3rem; }
.preset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .45rem; }
@media (min-width: 576px) { .preset-grid { grid-template-columns: repeat(3, 1fr); } }
.preset-grid input { position: absolute; opacity: 0; pointer-events: none; }
.preset { display: flex; flex-direction: column; gap: 1px; margin: 0; padding: .55rem .65rem; border: 1.5px solid var(--line); border-radius: 12px;
  cursor: pointer; background: #fff; line-height: 1.2; min-width: 0; }
.preset b { font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset small { color: var(--muted); font-size: .74rem; white-space: nowrap; }
.preset-grid input:checked + .preset { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12); }
.preset-grid input:checked + .preset b { color: var(--brand-600); }
.bundle-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 1020;
  width: min(720px, calc(100% - 20px)); display: flex; align-items: center; gap: .75rem; padding: .6rem .7rem .6rem .9rem;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px -10px rgba(15,23,42,.35); }
.bundle-bar > div { flex: 1; min-width: 0; }
.bundle-bar .btn { white-space: nowrap; flex: 0 0 auto; }
@media (min-width: 992px) { .bundle-bar { bottom: 20px; } }
.picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
@media (min-width: 576px) { .picker-grid { grid-template-columns: repeat(4, 1fr); } }
.pick { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: .35rem; border: 1.5px solid var(--line);
  border-radius: 12px; background: #fff; text-align: left; min-width: 0; }
.pick img { width: 100%; aspect-ratio: 210/297; object-fit: cover; object-position: top; border-radius: 7px; background: #f1f5f9; }
.pick .t { font-size: .78rem; font-weight: 600; margin-top: 3px; }
.pick small { font-size: .68rem; color: var(--muted); }
.pick .ck { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff;
  background: rgba(15,23,42,.35); color: transparent; display: flex; align-items: center; justify-content: center; font-size: .85rem; }
.pick.on { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12); }
.pick.on .ck { background: var(--brand); color: #fff; }
.result-ic { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto; background: #dcfce7; color: #16a34a; display: flex;
  align-items: center; justify-content: center; font-size: 1.7rem; }
.res-file { display: flex; align-items: center; gap: .65rem; padding: .55rem .6rem; }
.res-file img { width: 40px; height: 54px; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--line); }
.res-file .meta { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.res-file .meta b { font-size: .88rem; }
.res-file .meta small { font-size: .76rem; color: var(--muted); }
.res-file .acts { display: flex; gap: .3rem; }

/* ---- nhãn tài liệu nhạy cảm ---- */
.badge-sensitive { display: inline-flex; align-items: center; gap: 3px; font-size: .7rem; font-weight: 600; color: #b45309; background: #fef3c7;
  border-radius: 999px; padding: 1px 7px; }
.sensitive-banner { display: flex; gap: .7rem; align-items: flex-start; padding: .75rem .85rem; border-radius: 14px; background: #fffbeb;
  border: 1px solid #fde68a; color: #78350f; }
.sensitive-banner > i { font-size: 1.3rem; color: #d97706; line-height: 1; }
.sensitive-banner .acts { display: flex; gap: .4rem; margin-top: .45rem; flex-wrap: wrap; }
.sensitive-banner .btn { font-size: .8rem; padding: .25rem .6rem; white-space: nowrap; }

/* ---- thanh công cụ tài liệu: icon + chữ ngắn, chia đều, không xuống dòng ---- */
.doc-tools { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .25rem; padding: .35rem; position: sticky; top: 64px; z-index: 5; }
.doc-tools .tool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0;
  padding: .45rem .2rem; border: 0; border-radius: 10px; background: transparent; color: #334155; font-size: .74rem; font-weight: 500;
  text-decoration: none; white-space: nowrap; }
.doc-tools .tool i { font-size: 1.2rem; color: var(--brand); }
.doc-tools .tool:hover { background: var(--brand-50); }
.doc-tools .tool.primary { background: var(--brand); color: #fff; }
.doc-tools .tool.primary i { color: #fff; }
.doc-tools .tool.d-none { display: none !important; }

/* ---- Tài liệu của tôi: thẻ công cụ ---- */
.hist-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.tool-card { display: flex; align-items: center; gap: .55rem; padding: .6rem .65rem; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; color: inherit; text-decoration: none; cursor: pointer; min-width: 0; text-align: left; }
.tool-card > i { flex: 0 0 34px; height: 34px; border-radius: 10px; background: var(--brand-50); color: var(--brand); display: flex;
  align-items: center; justify-content: center; font-size: 1.05rem; }
.tool-card span { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.tool-card b { font-size: .86rem; white-space: nowrap; }
.tool-card small { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-card:hover { border-color: var(--brand-100); }
#selToggle.active { border-color: var(--brand); background: var(--brand-50); }
@media (max-width: 420px) {
  .tool-card { flex-direction: column; text-align: center; gap: .3rem; padding: .55rem .3rem; }
  .tool-card span { align-items: center; }
  .tool-card small { display: none; }
}
.sens-opt { border: 1px dashed #fcd34d; background: #fffbeb; border-radius: 12px; padding: .55rem .7rem; }
.sens-opt .form-check-label { font-size: .9rem; }

.doc-tools a.tool, .doc-tools a.tool:hover { color: #334155 !important; }
.doc-tools a.tool.primary, .doc-tools a.tool.primary:hover { color: #fff !important; }
/* nút Chụp / Chọn ảnh: không xuống dòng trên điện thoại nhỏ */
@media (max-width: 400px) {
  #openCamera, label[for="fileInput"].btn-lg { font-size: 1rem; padding: .6rem .5rem; white-space: nowrap; }
}

/* ---- Chuẩn bị hồ sơ: nguồn giấy tờ ---- */
.src-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.src-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: .7rem .3rem;
  border: 1.5px dashed var(--brand-100); border-radius: 14px; background: var(--brand-50); color: inherit !important; text-decoration: none;
  cursor: pointer; min-width: 0; text-align: center; transition: border-color .15s, background .15s; }
.src-btn i { font-size: 1.35rem; color: var(--brand); margin-bottom: 2px; }
.src-btn b { font-size: .88rem; white-space: nowrap; }
.src-btn small { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.src-btn:hover { border-color: var(--brand); background: #fff; }
.bundle-item.uploading { background: #f8fafc; border-style: dashed; }
.hoso-banner { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border-radius: 12px; background: var(--brand-50);
  border: 1px solid var(--brand-100); font-size: .86rem; }
.hoso-banner > i { color: var(--brand); font-size: 1.2rem; }
.hoso-banner .btn { white-space: nowrap; }

/* ===== Chuẩn bị hồ sơ: 2 cột (máy tính) — điều khiển bên trái, xem trước từng trang bên phải ===== */
.hoso { display: grid; gap: .8rem; grid-template-columns: 1fr;
  grid-template-areas: "src" "board" "opts" "name"; padding-bottom: 92px; }
@media (min-width: 992px) {
  .hoso { grid-template-columns: 340px 1fr; grid-template-areas: "src board" "opts board" "name board"; align-items: start; padding-bottom: 0; }
  .hoso-board { position: sticky; top: 76px; min-height: calc(100vh - 140px); }
}
.hoso-src { grid-area: src; } .hoso-board { grid-area: board; } .hoso-opts { grid-area: opts; } .hoso-name { grid-area: name; }
.hoso-card { padding: .85rem .9rem; }
.card-title-sm { font-weight: 700; font-size: .92rem; margin-bottom: .6rem; }
.board-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.board-hint { margin-bottom: .6rem; }
.board-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
@media (min-width: 576px) { .board-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .board-grid { grid-template-columns: repeat(5, 1fr); } }
.pg { position: relative; min-width: 0; cursor: grab; user-select: none; -webkit-user-select: none; }
.pg-img { aspect-ratio: 210/297; border-radius: 8px; overflow: hidden; background: #f1f5f9; border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(15,23,42,.08); display: flex; align-items: center; justify-content: center; }
.pg-img img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .2s; pointer-events: none; }
.pg-ph { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: .72rem; }
.pg-ph i { font-size: 1.6rem; }
.pg-no { position: absolute; left: 6px; top: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: rgba(15,23,42,.75);
  color: #fff; font-size: .72rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.pg-x, .pg-rot { position: absolute; width: 28px; height: 28px; border-radius: 50%; border: 0; display: flex; align-items: center; justify-content: center;
  font-size: .8rem; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.pg-x { right: 5px; top: 5px; background: #fff; color: #dc2626; }
.pg-rot { right: 5px; bottom: 26px; background: #fff; color: var(--brand); }
.pg-cap { font-size: .72rem; color: var(--muted); margin-top: 4px; text-align: center; }
.pg-ghost .pg-img { opacity: .35; outline: 2px dashed var(--brand); }
.pg-loading { cursor: default; }
.board-empty { text-align: center; padding: 2.2rem 1rem; border: 1.5px dashed var(--line); border-radius: 14px; }
.board-empty > i { font-size: 2.2rem; color: var(--brand); }
.page-big { max-width: 100%; max-height: calc(100vh - 120px); transition: transform .2s; }
.mb-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.mb-chips input { position: absolute; opacity: 0; pointer-events: none; }
.mb-chips label { text-align: center; padding: .45rem .2rem; border: 1.5px solid var(--line); border-radius: 10px; font-weight: 600; font-size: .86rem;
  cursor: pointer; white-space: nowrap; background: #fff; margin: 0; }
.mb-chips input:checked + label { border-color: var(--brand); background: var(--brand-50); color: var(--brand-600); }
.mb-custom { display: flex; align-items: center; gap: .6rem; margin-top: .55rem; }
.mb-custom .input-group { max-width: 150px; }
.pick .in { position: absolute; left: 8px; top: 8px; font-size: .65rem; font-weight: 600; background: #dcfce7; color: #166534; border-radius: 999px; padding: 1px 6px; }
body.selecting .support-fab { display: none; }
