/* Khóa PDF – AIST. Bảng màu và chữ theo aist.org.vn */
/* Open Sans tự chứa (SIL OFL, xem assets/fonts/OFL.txt): không gọi Google Fonts, chạy được khi tắt mạng. */
@font-face { font-family: 'Open Sans'; font-style: normal; font-display: swap; font-weight: 300 800;
  src: url(fonts/open-sans-vietnamese-wght-normal.woff2) format('woff2-variations'), url(fonts/open-sans-vietnamese-wght-normal.woff2) format('woff2');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: 'Open Sans'; font-style: normal; font-display: swap; font-weight: 300 800;
  src: url(fonts/open-sans-latin-ext-wght-normal.woff2) format('woff2-variations'), url(fonts/open-sans-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Open Sans'; font-style: normal; font-display: swap; font-weight: 300 800;
  src: url(fonts/open-sans-latin-wght-normal.woff2) format('woff2-variations'), url(fonts/open-sans-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
:root {
  --navy: #173B6C;
  --blue: #2764A5;
  --blue-soft: #e8f0fa;
  --orange: #E08D2D;
  --orange-soft: #fff4e6;
  --dark: #1D1E20;
  --text: #2b2d31;
  --muted: #5f6672;
  --line: #dfe4ec;
  --bg: #f5f7fb;
  --card: #ffffff;
  --ok: #1f8a4c;
  --ok-soft: #e7f6ec;
  --err: #c2372f;
  --err-soft: #fdecea;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(23, 59, 108, .08);
  --font: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font: 17px/1.6 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
@media (max-width: 640px) { body { font-size: 16px; } }

img, svg { display: block; max-width: 100%; }
a { color: var(--blue); }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.wrap { width: min(1100px, 100% - 32px); margin: 0 auto; }

.skip {
  position: absolute; left: -999px; top: 8px; background: var(--navy); color: #fff;
  padding: 8px 14px; border-radius: 8px; z-index: 100;
}
.skip:focus { left: 8px; }

/* Header */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--navy); }
.brand img { width: 64px; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); font-size: .8rem; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.net-badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted);
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
}
.net-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(31,138,76,.15); }
.net-badge.offline .dot { background: var(--orange); box-shadow: 0 0 0 3px rgba(224,141,45,.18); }
@media (max-width: 720px) { .net-badge span:last-child { display: none; } .net-badge { padding: 7px; } }
.lang-btn {
  border: 1.5px solid var(--navy); color: var(--navy); background: #fff; font-weight: 700;
  border-radius: 8px; padding: 6px 12px; letter-spacing: .04em;
}
.lang-btn:hover { background: var(--navy); color: #fff; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  color: #fff; padding: 52px 0 84px;
}
.hero h1 { margin: 0 0 14px; font-size: clamp(1.85rem, 2.6vw + 1rem, 2.6rem); line-height: 1.2; font-weight: 800; letter-spacing: -.015em; max-width: 760px; }
.hero .lead { margin: 0 0 24px; font-size: 1.1rem; max-width: 720px; opacity: .95; }
.badges { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.badges li {
  display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; font-weight: 600;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 7px 14px;
  backdrop-filter: blur(4px);
}
.badges .ic { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badges .ic .chk { stroke: #ffd59a; stroke-width: 2.2; }

/* Tool */
.tool { margin-top: -56px; position: relative; z-index: 2; display: grid; gap: 20px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px;
  border: 1px solid rgba(23,59,108,.06);
}
@media (max-width: 640px) { .card { padding: 20px 16px; } }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.step-head h2 { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--navy); }
.num {
  width: 32px; height: 32px; border-radius: 50%; background: var(--orange); color: #fff; font-weight: 800;
  display: inline-grid; place-items: center; font-size: .95rem; flex: none;
}

/* Dropzone */
.dropzone {
  border: 2px dashed #b9c6da; border-radius: 12px; background: var(--blue-soft);
  padding: 36px 20px; text-align: center; cursor: pointer; transition: all .15s ease;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--blue); background: #dfeafa; outline: none; }
.dropzone.over { border-color: var(--orange); background: var(--orange-soft); transform: scale(1.01); }
.dz-ic { width: 48px; height: 48px; margin: 0 auto 10px; fill: none; stroke: var(--blue); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dz-title { margin: 0 0 6px; font-weight: 700; color: var(--navy); font-size: 1.05rem; }
.dz-title u { text-decoration-color: var(--orange); text-underline-offset: 3px; }
.dz-help { margin: 0; color: var(--muted); font-size: .9rem; }

.filelist-wrap { margin-top: 18px; }
.filelist-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: .95rem; }
.link-btn { background: none; border: 0; color: var(--blue); text-decoration: underline; padding: 4px; }
.filelist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 320px; overflow: auto; }
.filelist li {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: .92rem;
}
.tag {
  font-size: .72rem; font-weight: 800; letter-spacing: .05em; padding: 3px 8px; border-radius: 6px; text-transform: uppercase;
}
.tag.pdf { background: var(--err-soft); color: var(--err); }
.tag.image { background: var(--ok-soft); color: var(--ok); }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsize { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.rm { border: 0; background: none; color: var(--muted); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.rm:hover { background: var(--err-soft); color: var(--err); }
.rm svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; }

/* Fields */
.field { display: block; margin-bottom: 14px; }
.field .label { display: block; font-weight: 700; margin-bottom: 6px; color: var(--navy); }
.field input[type=text] {
  width: 100%; font: inherit; padding: 12px 14px; border: 1.5px solid #c9d3e2; border-radius: 10px; background: #fff; color: var(--dark);
}
.field input[type=text]:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39,100,165,.15); }
.field.sub { margin: 8px 0 6px 28px; }
.pw-row { display: flex; gap: 8px; align-items: stretch; }
.pw-row input { flex: 1; font-size: 1.1rem; letter-spacing: .03em; font-weight: 600; }
.pw-row input.masked { -webkit-text-security: disc; }
.eye { border: 1.5px solid #c9d3e2; background: #fff; border-radius: 10px; width: 48px; display: grid; place-items: center; color: var(--muted); }
.eye[aria-pressed="true"] { color: var(--blue); border-color: var(--blue); }
.eye svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.hint { font-size: .88rem; color: var(--muted); margin: 6px 0 0; display: block; }
.hint.warn { color: #9a5b00; }
.check, .radio { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; font-size: .95rem; cursor: pointer; }
.check input, .radio input { margin-top: 5px; accent-color: var(--blue); flex: none; width: 17px; height: 17px; }

.adv { margin: 16px 0; border: 1px solid var(--line); border-radius: 10px; }
.adv summary { padding: 12px 16px; font-weight: 700; color: var(--navy); cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.adv summary::-webkit-details-marker { display: none; }
.adv summary::before { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--navy); border-bottom: 2px solid var(--navy); transform: rotate(-45deg); transition: transform .15s; margin-left: 2px; }
.adv[open] summary::before { transform: rotate(45deg); }
.adv-body { padding: 4px 16px 16px; display: grid; gap: 14px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; color: var(--navy); margin-bottom: 4px; font-size: .95rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; padding: 11px 18px;
  font-weight: 700; border: 1.5px solid transparent; text-decoration: none; transition: all .15s;
}
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--orange); color: #fff; }
.btn.primary:hover { background: #cf7c1e; }
.btn.primary:disabled { background: #e6c9a6; cursor: not-allowed; }
.btn.big { padding: 15px 28px; font-size: 1.1rem; }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.light { background: #fff; color: var(--navy); }
.btn.light:hover { background: #ffe9cf; }
.btn.sm { padding: 7px 12px; font-size: .88rem; border-radius: 8px; }
.action-row { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.action-row .hint { margin: 0; }

.progress { margin-top: 16px; }
.progress .bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--orange)); transition: width .25s; }
.progress p { margin: 8px 0 0; font-size: .9rem; color: var(--muted); }

/* Results */
.result-summary { margin: 0 0 14px; font-weight: 700; color: var(--ok); }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.results li {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff;
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
}
.results li.err { border-color: #f1c9c5; background: #fff8f7; }
.r-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); }
.results li.err .r-ic { background: var(--err-soft); color: var(--err); }
.r-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.r-info { min-width: 0; }
.r-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-meta { font-size: .85rem; color: var(--muted); }
.r-err { font-size: .88rem; color: var(--err); }
.r-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn.sm svg { width: 17px; height: 17px; }
@media (max-width: 560px) {
  .results li { grid-template-columns: auto 1fr; }
  .r-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .r-actions .btn { padding: 10px 12px; font-size: .95rem; }
}

/* Nhắc gửi mật khẩu riêng */
.pw-note {
  margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  background: var(--orange-soft); border: 1px solid #f3d3a8; border-radius: 10px; padding: 10px 14px; font-size: .92rem; color: #6b4300;
}
.pw-note svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--orange); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pw-note span { flex: 1 1 220px; }
.pw-note .link-btn { font-weight: 700; }
.result-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; }

/* Info */
.info { margin: 40px auto 56px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.info-card { background: #fff; border-radius: var(--radius); padding: 24px; border: 1px solid var(--line); }
.info-card h3 { margin: 0 0 10px; color: var(--navy); font-size: 1.15rem; }
.info-card ul, .info-card ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: .95rem; }

/* Footer */
.site-footer { background: var(--navy); color: #d9e2ef; padding: 40px 0 0; border-top: 3px solid var(--orange); }
.f-share {
  background: var(--orange); color: #fff; border-radius: var(--radius); padding: 22px 26px; margin: 0 0 40px;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px;
}
.f-share strong { font-size: 1.1rem; display: block; }
.f-share p { margin: 4px 0 0; opacity: .95; font-size: .95rem; }
.f-share-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.f-cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; padding-bottom: 32px; font-size: .92rem; }
@media (max-width: 760px) { .f-cols { grid-template-columns: 1fr; } }
.f-logo { width: 110px; height: auto; margin-bottom: 12px; opacity: .9; }
.f-cols h4 { margin: 0 0 10px; color: #fff; font-size: 1rem; }
.f-cols ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.f-cols a { color: #fff; text-decoration: none; }
.f-cols a:hover { text-decoration: underline; }
.f-cols p { margin: 0; }
.f-copy { border-top: 1px solid rgba(255,255,255,.15); padding: 14px 0; font-size: .82rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: #b8c6da; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--dark); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: .92rem;
  opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; max-width: min(92vw, 520px); text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Spinner */
.spin { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Khung "Gửi file" */
.dlg {
  width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto;
  border: 0; border-radius: 16px; padding: 22px 22px 18px; color: var(--text); background: #fff;
  box-shadow: 0 24px 60px rgba(10, 25, 50, .35);
}
.dlg::backdrop { background: rgba(14, 30, 56, .55); }
.dlg[open] { animation: dlg-in .16s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.dlg-head h2 { margin: 0; font-size: 1.2rem; color: var(--navy); line-height: 1.3; }
.dlg-x { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg); color: var(--muted); display: grid; place-items: center; }
.dlg-x:hover { background: var(--line); color: var(--dark); }
.dlg-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.dlg-files { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; max-height: 150px; overflow: auto; }
.dlg-files li { display: flex; align-items: center; gap: 8px; background: var(--ok-soft); border-radius: 8px; padding: 7px 10px; font-size: .9rem; font-weight: 600; color: var(--dark); }
.dlg-files li svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--ok); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dlg-files li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-files li small { color: var(--muted); font-weight: 400; }
.btn.wide { width: 100%; padding: 13px 18px; font-size: 1.02rem; }
.dlg-native .hint { text-align: center; margin-top: 8px; }
.dlg-fail { margin: 0 0 12px; background: var(--orange-soft); color: #6b4300; border-radius: 8px; padding: 9px 12px; font-size: .9rem; }
.dlg-or { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--muted); font-size: .85rem; }
.dlg-or::before, .dlg-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.dlg-steps-h { margin: 0 0 10px; font-weight: 700; color: var(--navy); }
.dlg-steps { margin: 0; padding: 0; list-style: none; counter-reset: st; display: grid; gap: 14px; }
.dlg-steps > li { counter-increment: st; position: relative; padding-left: 40px; }
.dlg-steps > li::before {
  content: counter(st); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy); color: #fff; font-weight: 800; font-size: .85rem; display: grid; place-items: center;
}
.dlg-steps strong { display: block; color: var(--dark); font-size: .97rem; line-height: 1.45; margin-bottom: 8px; }
.st-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.st-done { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-size: .88rem; font-weight: 600; }
.st-done svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.apps { display: flex; flex-wrap: wrap; gap: 8px; }
.app {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 13px 5px 5px; background: #fff; color: var(--dark); font-weight: 600; font-size: .9rem; text-decoration: none;
}
.app:hover { border-color: var(--blue); background: var(--blue-soft); }
.app-ic { width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: .62rem; font-weight: 800; display: grid; place-items: center; letter-spacing: -.02em; }
.app-ic.zalo { background: #0068ff; } .app-ic.wa { background: #25d366; } .app-ic.ms { background: #0a7cff; } .app-ic.gm { background: #d93025; } .app-ic.ml { background: var(--blue); }
.app-ic svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 2; stroke-linejoin: round; }
.dlg-steps .hint { margin-top: 8px; }
.dlg-pw { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: .9rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.dlg-pw span { flex: 1 1 260px; }
.dlg-pw .link-btn { font-weight: 700; }
@media (max-width: 480px) {
  .dlg { padding: 18px 16px 16px; }
  .dlg-steps > li { padding-left: 36px; }
}
