/* Giao diện chung Tiện Ích Nhanh. Đổi màu ở 2 khối :root đầu file. */
:root { --bg:#f3f6f9; --card:#ffffff; --ink:#132029; --mute:#4c5a67; --line:#dfe6ec; --field:#fbfcfd; --field-line:#8593a0;
  --accent:#0a7263; --accent-strong:#075a4e; --accent-text:#08695b; --accent-line:#9fd6cb; --on-accent:#ffffff; --link:#08695b;
  --soft:#e2f3ef; --soft2:#f1f6f8; --ring:rgba(10,114,99,.22); --warn-bg:#fff7e6; --warn-line:#f0d49c; --warn-edge:#c27a0b; }
@media (prefers-color-scheme: dark) { :root { --bg:#0d1317; --card:#161f26; --ink:#e6edf2; --mute:#a3b1bc; --line:#26323b; --field:#10181e; --field-line:#62727f;
  --accent:#4fd0b4; --accent-strong:#7fe0ca; --accent-text:#5fd6bb; --accent-line:#2d5c52; --on-accent:#05241e; --link:#6fdcc3;
  --soft:#14302b; --soft2:#121b21; --ring:rgba(79,208,180,.28); --warn-bg:#2a2214; --warn-line:#5a4722; --warn-edge:#e0a73c; } }
/* Bộ khung giao diện chung của site. Màu nằm ở :root phía trên; phần dưới dùng chung cho 2 site. */
:root { --r: 16px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06); --shadow-up: 0 2px 4px rgba(16,24,40,.06), 0 12px 28px rgba(16,24,40,.12); color-scheme: light dark; }
@media (prefers-color-scheme: dark) { :root { --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25); --shadow-up: 0 2px 4px rgba(0,0,0,.4), 0 12px 28px rgba(0,0,0,.45); } }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px; line-height: 1.6;
  background: var(--bg); color: var(--ink); min-height: 100vh; display: flex; flex-direction: column; }
main { width: 100%; max-width: 720px; margin: 0 auto; padding: 20px 16px 40px; flex: 1; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
h1 { font-size: clamp(1.55rem, 5vw, 2.1rem); line-height: 1.2; margin: 0 0 6px; letter-spacing: -.015em; }
h2 { font-size: 1.22rem; line-height: 1.35; margin: 0 0 8px; letter-spacing: -.005em; }
h3 { font-size: 1.04rem; line-height: 1.4; margin: 18px 0 4px; }
.sub { color: var(--mute); margin: 0 0 20px; font-size: 1.04rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 24px; height: 24px; flex: none; }

/* Đầu trang */
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 20; }
.skip:focus { left: 8px; }
.site-head { background: color-mix(in srgb, var(--card) 92%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: saturate(1.4) blur(8px); }
.site-head .wrap { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.12rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand:hover { color: var(--ink); }
.brand svg { width: 34px; height: 34px; flex: none; }
.nav { display: flex; gap: 2px; overflow-x: auto; margin-left: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { white-space: nowrap; padding: 6px 11px; border-radius: 999px; color: var(--mute); text-decoration: none; font-size: .92rem; font-weight: 600; transition: background .15s, color .15s; }
.nav a:hover, .nav a[aria-current] { background: var(--soft); color: var(--accent-text); }
@media (min-width: 761px) { .site-head { position: sticky; top: 0; z-index: 10; } }
@media (max-width: 760px) { .nav { margin: 0 -16px; padding: 0 12px; width: calc(100% + 32px); } }

/* Breadcrumb */
.crumb ol { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 6px; font-size: .88rem; color: var(--mute); }
.crumb li + li::before { content: "›"; margin-right: 6px; color: var(--mute); }
.crumb a { color: var(--mute); }
.crumb a:hover { color: var(--accent-text); }

/* Đầu công cụ */
.tool-head { display: flex; gap: 14px; align-items: flex-start; margin: 0 0 20px; }
.tool-head .sub { margin: 0; }
.badge-ico { flex: none; width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; background: var(--soft); color: var(--accent-text); }
.badge-ico .ico { width: 28px; height: 28px; }
@media (max-width: 420px) { .tool-head .badge-ico { width: 44px; height: 44px; border-radius: 13px; } .tool-head .badge-ico .ico { width: 24px; height: 24px; } }

/* Thẻ, ô nhập, nút */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
@media (max-width: 420px) { .card { padding: 16px; } }
.card[aria-live] { background: linear-gradient(180deg, var(--soft), var(--card) 140px); border-color: var(--accent-line); }
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .95rem; }
label:first-child { margin-top: 0; }
input, select, textarea { width: 100%; padding: 11px 13px; font: inherit; font-size: 1.02rem; line-height: 1.35; border: 1.5px solid var(--field-line); border-radius: 11px;
  background: var(--field); color: var(--ink); transition: border-color .15s, box-shadow .15s; min-height: 46px; }
input:hover, select:hover, textarea:hover { border-color: var(--mute); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
input[type=range] { padding: 0; border: 0; background: none; box-shadow: none; accent-color: var(--accent); min-height: 30px; }
input[type=color] { padding: 3px; height: 46px; cursor: pointer; }
input[type=file] { padding: 8px; font-size: .95rem; }
button, .btn, .dl, .cta { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; min-height: 44px; font: inherit; font-weight: 650; font-size: 1rem;
  border-radius: 11px; border: 1.5px solid var(--accent); background: var(--accent); color: var(--on-accent); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; }
button:hover, .btn:hover, .dl:hover, .cta:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
button:active, .dl:active, .cta:active { transform: translateY(1px); }
button.alt, button.phu { background: transparent; color: var(--accent-text); }
button.alt:hover, button.phu:hover { background: var(--soft); color: var(--accent-text); }
button.xoa { background: transparent; color: var(--mute); border-color: var(--field-line); }
button.xoa:hover { background: var(--soft); color: var(--ink); border-color: var(--mute); }
.hint { color: var(--mute); font-size: .88rem; }
.note { color: var(--mute); font-size: .9rem; }
.net, .big { font-size: clamp(1.9rem, 8vw, 2.5rem); font-weight: 800; line-height: 1.15; color: var(--accent-text); margin: 2px 0 8px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-weight: 600; }
thead th { font-size: .85rem; color: var(--mute); }
tr.sum td { font-weight: 700; border-bottom: none; }
.disclaimer { background: var(--warn-bg); border: 1px solid var(--warn-line); border-left: 5px solid var(--warn-edge); border-radius: 12px; padding: 12px 16px; margin: 0 0 18px; font-size: .95rem; color: var(--ink); }

/* Khối chữ hướng dẫn, FAQ */
.info { margin-top: 28px; }
.info h2 { margin-top: 26px; }
.info ol, .info ul { padding-left: 1.3em; }
.info li { margin-bottom: 6px; }
.faq h3 { margin-top: 16px; }
.faq p { margin: 0 0 8px; }

/* Thẻ bài viết, thẻ công cụ */
.art-card { display: flex; gap: 14px; align-items: center; padding: 16px 18px; margin: 24px 0 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card);
  box-shadow: var(--shadow); color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.art-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-up); border-color: var(--accent-line); color: var(--ink); }
.art-card small { display: block; color: var(--mute); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.art-card strong { display: block; font-size: 1.04rem; line-height: 1.35; }
.art-card .go { margin-left: auto; color: var(--accent-text); }
.badge-ico.sm { width: 44px; height: 44px; border-radius: 13px; }
.badge-ico.sm .ico { width: 24px; height: 24px; }
.privacy { display: flex; gap: 10px; align-items: flex-start; color: var(--mute); font-size: .9rem; margin: 16px 0; padding: 12px 14px; border-radius: 12px; background: var(--soft2); }
.privacy .ico { width: 20px; height: 20px; margin-top: 1px; color: var(--accent-text); }
.related { margin-top: 32px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.home .tool-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
a.tool-card { display: flex; gap: 13px; align-items: flex-start; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
a.tool-card:hover, a.tool-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-up); border-color: var(--accent-line); color: var(--ink); }
.tool-card strong { display: block; font-size: 1.03rem; line-height: 1.3; margin-bottom: 3px; }
.tool-card .d { display: block; color: var(--mute); font-size: .92rem; line-height: 1.45; }

/* Trang chủ */
main.home { max-width: 1120px; padding-top: 0; }
.hero { text-align: center; padding: 44px 8px 30px; }
.hero h1 { font-size: clamp(1.8rem, 6.5vw, 2.9rem); max-width: 18em; margin: 0 auto 10px; }
.hero .sub { max-width: 36em; margin: 0 auto 22px; font-size: 1.1rem; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 22px; padding: 0; list-style: none; }
.chips li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: .9rem; font-weight: 600; }
.chips .ico { width: 17px; height: 17px; color: var(--accent-text); }
.search { position: relative; max-width: 520px; margin: 0 auto; }
.search .ico { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--mute); pointer-events: none; }
.search input { padding-left: 46px; min-height: 54px; border-radius: 14px; font-size: 1.05rem; box-shadow: var(--shadow); }
.cat { margin-top: 30px; scroll-margin-top: 80px; }
.cat h2 { display: flex; align-items: center; gap: 8px; }
.empty { text-align: center; color: var(--mute); margin-top: 28px; }
.why { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; margin-top: 36px; }
.why .card { margin: 0; }
.why h2 { font-size: 1.05rem; }
.why p { margin: 0; color: var(--mute); font-size: .95rem; }

/* Bài viết */
body.bai main { max-width: 760px; }
.prose { max-width: 70ch; margin: 0 auto; font-size: 1.06rem; line-height: 1.75; }
.prose h1 { font-size: clamp(1.6rem, 5.5vw, 2.25rem); margin-bottom: 14px; }
.prose h2 { font-size: 1.32rem; margin: 2em 0 .5em; scroll-margin-top: 80px; }
.prose p, .prose ul, .prose ol { margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose table { margin: 1em 0 1.4em; font-size: .95rem; line-height: 1.5; border: 1px solid var(--line); border-radius: 12px; border-collapse: separate; border-spacing: 0; overflow: hidden; background: var(--card); }
.prose th { background: var(--soft); font-size: .9rem; }
.prose th, .prose td { padding: 9px 12px; }
.prose tr:last-child td { border-bottom: 0; }
.prose tbody tr:nth-child(even) td, .prose table tr:nth-child(even) td { background: var(--soft2); }
@media (max-width: 600px) { .prose table { display: block; overflow-x: auto; } }
.prose .cta { margin: 4px 0; }
.toc { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 20px; margin: 18px 0 26px; font-size: .98rem; box-shadow: var(--shadow); }
.toc strong { display: block; margin-bottom: 4px; }
.toc ol { margin: 0; padding-left: 1.3em; }
.toc li { margin: 3px 0; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.meta { color: var(--mute); font-size: .9rem; margin: -6px 0 14px; }

/* Chân trang */
.site-foot { border-top: 1px solid var(--line); background: var(--card); margin-top: 40px; font-size: .92rem; color: var(--mute); }
.site-foot .wrap { max-width: 1120px; margin: 0 auto; padding: 26px 16px 30px; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.site-foot .brand { font-size: 1rem; margin-bottom: 6px; }
.site-foot p { margin: 0 0 6px; }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin: 4px 0; }
.site-foot a { color: var(--mute); }
.site-foot a:hover { color: var(--accent-text); }
.site-foot h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); margin: 0 0 8px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .site-head, .site-foot, .crumb, .related, .art-card, .privacy, .info, .toc, .skip { display: none !important; }
  body { display: block; background: #fff; color: #000; }
  .card { box-shadow: none; }
}

/* Ô nhập trong lưới 2 cột: nhãn dài xuống dòng thì ô vẫn thẳng hàng */
.row > div { display: flex; flex-direction: column; }
.row > div > input, .row > div > select { margin-top: auto; }
/* Trang chủ ít công cụ: lưới 2 cột cho cân */
.home .tool-grid.it { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.row > div > label:first-child { margin-top: 14px; }
.card > .row:first-child > div > label:first-child { margin-top: 0; }

/* Chọn ngôn ngữ ở đầu trang (details/summary, không cần JS) */
.langs { position: relative; order: 2; }
.langs summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--mute); font-weight: 650; font-size: .9rem; background: var(--card); }
.langs summary::-webkit-details-marker { display: none; }
.langs summary:hover, .langs[open] summary { color: var(--accent-text); border-color: var(--accent-line); }
.langs summary .ico { width: 18px; height: 18px; }
.langs ul { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; list-style: none; margin: 0; padding: 6px; min-width: 190px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-up); }
.langs a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .95rem; }
.langs a:hover { background: var(--soft); color: var(--ink); }
.langs a[aria-current] { font-weight: 700; color: var(--accent-text); }
@media (max-width: 760px) { .langs { order: 1; margin-left: auto; } .nav { order: 2; } }
