/* =========================================================
   ManhTool — Đếm ký tự & số từ
   Màu theo logo: xanh rừng đậm → xanh ngọc → xanh chanh
   ========================================================= */

:root {
  --ink: #0f2620;
  --brand-800: #0a5c44;
  --brand-700: #0e7c5a;
  --brand-500: #12b886;
  --leaf: #4cb944;
  --lime: #c4e43a;
  --grad: linear-gradient(115deg, #0e7c5a 0%, #12b886 50%, #7ccf3e 85%, #c4e43a 100%);

  --bg: #f5f8f6;
  --surface: #ffffff;
  --surface-2: #f3f7f4;
  --tint: #e9f6ef;           /* nền xanh rất nhạt khi rê chuột / chọn */
  --border: #e1ebe5;
  --border-strong: #cddcd3;
  --text: #13241f;
  --text-2: #4a5a55;
  --text-3: #6f7f79;
  --primary: #0e7c5a;
  --primary-hover: #0a5c44;
  --on-primary: #ffffff;
  --accent-text: #0e7c5a;
  --warn: #b45309;           /* sắp chạm giới hạn */
  --danger: #c2410c;
  --danger-bg: #fff4ee;
  --shadow: 0 1px 2px rgba(15,38,32,.04), 0 4px 16px rgba(15,38,32,.06);
  --shadow-lg: 0 24px 60px rgba(15,38,32,.2);

  --r-lg: 18px;
  --r: 12px;
  --r-sm: 9px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1613; --surface: #121e1a; --surface-2: #17251f; --tint: #173328;
    --border: #213530; --border-strong: #2d463d;
    --text: #e7f1ec; --text-2: #a8bab2; --text-3: #85988f;
    --primary: #12b886; --primary-hover: #34cf98; --on-primary: #04241a; --accent-text: #3dd598;
    --warn: #facc15; --danger: #fb923c; --danger-bg: #2a1a10;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2);
    --shadow-lg: 0 24px 60px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1613; --surface: #121e1a; --surface-2: #17251f; --tint: #173328;
  --border: #213530; --border-strong: #2d463d;
  --text: #e7f1ec; --text-2: #a8bab2; --text-3: #85988f;
  --primary: #12b886; --primary-hover: #34cf98; --on-primary: #04241a; --accent-text: #3dd598;
  --warn: #facc15; --danger: #fb923c; --danger-bg: #2a1a10;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.55);
  color-scheme: dark;
}

/* ---------- Nền tảng ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden;
  font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--text);
  background: var(--bg);
}
body::before {
  /* vệt sáng xanh nhẹ phía trên, lấy cảm hứng từ dải màu logo */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 420px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 300px at 85% -60px, rgba(196,228,58,.22), transparent 70%),
    radial-gradient(700px 320px at 10% -80px, rgba(18,184,134,.18), transparent 70%);
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: var(--accent-text); }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

.ic { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .container { padding: 0 24px; } }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 16px; top: -48px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: 8px 14px; border-radius: 8px; text-decoration: none; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
[hidden] { display: none !important; }

.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: #fff; box-shadow: 0 0 0 1px var(--border); }
.brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.brand-accent { color: var(--primary); }
.header-actions { display: flex; align-items: center; gap: 6px; }
.header-link {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 999px; text-decoration: none; color: var(--text-2); font-weight: 500; font-size: .9rem;
}
.header-link:hover { background: var(--tint); color: var(--accent-text); }
@media (max-width: 479px) { .header-link span { display: none; } .header-link { padding: 0; width: 38px; justify-content: center; } }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { color: var(--accent-text); border-color: var(--border-strong); }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* ---------- Hero ---------- */
.hero { text-align: center; padding-top: 40px; padding-bottom: 28px; }
.hero h1 { font-size: clamp(1.7rem, 3.6vw + .6rem, 2.75rem); font-weight: 800; letter-spacing: -.025em; line-height: 1.15; text-wrap: balance; }
.hero p { margin-top: 10px; color: var(--text-2); font-size: clamp(.98rem, .6vw + .8rem, 1.1rem); text-wrap: balance; }
@media (max-width: 559px) { .hero { padding-top: 24px; padding-bottom: 18px; } }

/* ---------- Bố cục ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 1024px) { .layout { grid-template-columns: minmax(0, 1fr) 288px; gap: 24px; } }
.main-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }

/* ---------- Công cụ ---------- */
.tool { padding: 14px; }
@media (min-width: 768px) { .tool { padding: 20px; } }

/* Ô số liệu chính */
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
@media (min-width: 860px) { .stats-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; } }
.stat {
  display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px;
  padding: 10px 12px; min-width: 0; background: var(--surface-2); border-radius: var(--r);
}
.stat dt { font-size: .76rem; font-weight: 500; color: var(--text-3); line-height: 1.3; }
.stat dd {
  margin: 0; font-size: clamp(1.15rem, 1.2vw + .8rem, 1.55rem); font-weight: 800; letter-spacing: -.02em;
  line-height: 1.2; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.stat-main { background: var(--tint); }
.stat-main dd { color: var(--accent-text); }
#sRead { font-size: clamp(1rem, .8vw + .75rem, 1.25rem); line-height: 1.45; }
@media (max-width: 380px) { .stat { padding: 9px 10px; } .stat dt { font-size: .72rem; } }

/* Ô soạn thảo + thanh trạng thái liền khối */
.editor-box {
  position: relative; border: 1.5px solid var(--border-strong); border-radius: var(--r); background: var(--surface);
  overflow: hidden; transition: border-color .2s, box-shadow .2s;
}
.editor-box:focus-within { border-color: var(--brand-500); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-500) 15%, transparent); }
.editor-box.dragover { border-color: var(--brand-500); border-style: dashed; }
.editor-box.dragover::after {
  content: "Thả file vào đây"; position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 700; color: var(--accent-text); background: color-mix(in srgb, var(--tint) 88%, transparent);
  pointer-events: none;
}
#editor {
  display: block; width: 100%; height: 40vh; min-height: 240px; max-height: 70vh; resize: vertical;
  padding: 14px 16px; border: 0; outline: none; background: transparent; color: var(--text);
  font: inherit; font-size: 1rem; line-height: 1.7;
}
#editor::placeholder { color: var(--text-3); }
@media (min-width: 1024px) { #editor { height: clamp(300px, calc(100vh - 520px), 520px); } }
.editor-status {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; font-size: .8rem; color: var(--text-3);
  background: var(--surface-2); border-top: 1px solid var(--border);
}
.sel-info { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.sel-info .ic { width: 15px; height: 15px; }
.sel-info.is-on { color: var(--accent-text); font-weight: 600; }
.sel-info b { font-variant-numeric: tabular-nums; }
@media (max-width: 479px) { .saved-note { display: none; } }

/* Thanh thao tác */
.toolbar { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 6px; }
.act {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 12px; cursor: pointer;
  font-size: .88rem; font-weight: 500; color: var(--text-2);
  background: transparent; border: 1px solid transparent; border-radius: var(--r-sm);
  transition: background .15s, color .15s;
}
.act:hover:not(:disabled) { background: var(--tint); color: var(--accent-text); }
.act:disabled { opacity: .4; cursor: default; }
.act-danger:hover:not(:disabled) { background: var(--danger-bg); color: var(--danger); }
.act-icon { width: 40px; padding: 0; }
.act-sep { width: 1px; align-self: center; height: 22px; background: var(--border); margin: 0 4px; }

.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px; border-radius: var(--r-sm); cursor: pointer;
  font-size: .92rem; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background .15s, transform .1s, border-color .15s;
}
.btn-primary { color: var(--on-primary); background: var(--primary); border: 0; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active, .btn-ghost:active { transform: scale(.97); }
.btn-ghost { color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); }
.btn-ghost:hover { border-color: var(--brand-500); color: var(--accent-text); }
#btnCopy { min-width: 132px; margin-left: auto; }
#btnCopy .ic-check { display: none; }
#btnCopy.is-done { background: var(--leaf); }
#btnCopy.is-done .ic-copy { display: none; }
#btnCopy.is-done .ic-check { display: block; }

@media (max-width: 559px) {
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  #btnCopy { order: -1; height: 46px; margin: 0; }
  .actions { justify-content: space-between; gap: 0; }
  .act { padding: 0; width: 44px; height: 44px; }
  .act span { display: none; }
  .act-sep { display: none; }
}
/* Khi chật: nút phụ chỉ còn icon để Sao chép luôn cùng hàng */
@media (min-width: 560px) and (max-width: 700px), (min-width: 1024px) and (max-width: 1099px) {
  .act { width: 40px; padding: 0; }
  .act span { display: none; }
}

.mini-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px;
  font-size: .8rem; font-weight: 600; color: var(--text-2); cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 8px; white-space: nowrap;
}
.mini-btn:hover { background: var(--tint); color: var(--accent-text); }
.mini-btn .ic { width: 16px; height: 16px; }
.mini-btn .ic-check { display: none; }
.mini-btn.is-done { color: var(--accent-text); }
.mini-btn.is-done .ic-copy { display: none; }
.mini-btn.is-done .ic-check { display: block; }
.link-btn { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border: 0; border-radius: 7px; background: none; color: var(--accent-text); font-size: .8rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.link-btn:hover { background: var(--tint); }

/* ---------- Thẻ phụ ---------- */
.sub-card { padding: 16px; }
@media (min-width: 768px) { .sub-card { padding: 20px; } }
.sub-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.sub-head h2 { font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.sub-head p { font-size: .84rem; color: var(--text-3); }

/* Độ dài theo nền tảng */
.scope-note {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; padding: 6px 6px 6px 12px;
  font-size: .85rem; color: var(--accent-text); background: var(--tint); border-radius: var(--r-sm);
}
.scope-note .ic { width: 16px; height: 16px; }
.scope-note .link-btn { margin-left: auto; background: var(--surface); }

.goal {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 12px;
  padding: 12px 14px; margin-bottom: 16px; border: 1px dashed var(--border-strong); border-radius: var(--r);
}
.goal-label { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; }
.goal-label .ic { width: 16px; height: 16px; color: var(--accent-text); }
.goal-inputs { display: flex; gap: 6px; }
.goal-inputs input, .goal-inputs select {
  height: 36px; padding: 0 10px; font: inherit; font-size: .9rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
}
.goal-inputs input { width: 108px; font-variant-numeric: tabular-nums; }
.goal-inputs input:focus, .goal-inputs select:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 18%, transparent); }
@media (max-width: 420px) { .goal { grid-template-columns: minmax(0, 1fr); } .goal-inputs input { flex: 1; width: auto; } }

.limit-groups { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .limit-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; } }
.limit-group h3 { font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 2px; }
.limit-group ul { list-style: none; margin: 0; padding: 0; }
.limit-item { padding: 9px 0; border-bottom: 1px solid var(--border); }
.limit-item:last-child { border-bottom: 0; }
.limit-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.limit-name { font-size: .9rem; font-weight: 600; min-width: 0; }
.limit-name small { font-size: .76rem; font-weight: 400; color: var(--text-3); margin-left: 4px; }
.limit-count { font-size: .82rem; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.limit-count b { color: var(--text); font-weight: 700; }
.limit-count em { font-style: normal; font-weight: 600; margin-left: 6px; }
.bar { height: 6px; margin-top: 7px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad); transition: width .25s ease; }
.is-short em { color: var(--text-3); }
.is-good em { color: var(--accent-text); }
.is-near em { color: var(--warn); }
.is-near .bar i { background: var(--warn); }
.is-over em { color: var(--danger); }
.is-over .bar i { background: var(--danger); }
.goal-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
.goal-row .bar { flex: 1; margin: 0; height: 8px; }
.fine-print { margin-top: 14px; font-size: .78rem; color: var(--text-3); }

/* Từ khóa */
.kw-input {
  display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px;
  border: 1.5px solid var(--border-strong); border-radius: var(--r); background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
}
.kw-input:focus-within { border-color: var(--brand-500); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-500) 15%, transparent); }
.kw-input > .ic { color: var(--text-3); }
.kw-input input { flex: 1; min-width: 0; height: 44px; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; font-size: .95rem; }
.kw-input input::placeholder { color: var(--text-3); }
@media (max-width: 479px) { .kw-input input { font-size: 16px; } .kw-input input::placeholder { font-size: .84rem; } }

.kw-results { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.kw-results:empty { display: none; }
.kw-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px;
  padding: 10px 8px 10px 14px; background: var(--surface-2); border-radius: var(--r-sm);
}
.kw-name { font-weight: 700; overflow-wrap: anywhere; }
.kw-meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: .82rem; color: var(--text-2); }
.kw-meta b { color: var(--text); font-variant-numeric: tabular-nums; }
.kw-meta .ok { color: var(--accent-text); font-weight: 600; }
.kw-meta .warn { color: var(--warn); font-weight: 600; }
.kw-meta .bad { color: var(--danger); font-weight: 600; }
.kw-meta .muted { color: var(--text-3); }
.kw-item .mini-btn { grid-column: 2; grid-row: 1 / span 2; }
.kw-item .mini-btn:disabled { opacity: .4; cursor: default; background: none; color: var(--text-2); }
@media (max-width: 479px) { .kw-item .mini-btn span { display: none; } }

.terms-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.terms-head h3 { font-size: .95rem; font-weight: 700; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: block; padding: 5px 13px; font-size: .82rem; font-weight: 600; color: var(--text-2); border-radius: 999px; white-space: nowrap; transition: background .15s, color .15s; }
.seg label:hover span { color: var(--text); }
.seg input:checked + span { background: var(--surface); color: var(--accent-text); box-shadow: 0 1px 3px rgba(15,38,32,.14); }
.seg input:focus-visible + span { outline: 2px solid var(--brand-500); outline-offset: 1px; }

.check-line { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .85rem; color: var(--text-2); cursor: pointer; user-select: none; }
.check-line input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { position: relative; width: 34px; height: 20px; flex-shrink: 0; background: var(--border-strong); border-radius: 999px; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.check-line input:checked + .switch { background: var(--brand-500); }
.check-line input:checked + .switch::after { transform: translateX(14px); }
.check-line input:focus-visible + .switch { outline: 2px solid var(--brand-500); outline-offset: 2px; }

.terms { list-style: none; margin: 12px 0 0; padding: 0; counter-reset: t; }
.terms:empty { display: none; }
.terms li { counter-increment: t; }
.term {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 2px 10px;
  width: 100%; padding: 8px 10px; text-align: left; cursor: pointer;
  background: none; border: 0; border-radius: var(--r-sm);
}
.term::before { content: counter(t); grid-row: 1 / span 2; font-size: .78rem; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.term:hover { background: var(--tint); }
.term-name { font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; }
.term-num { font-size: .82rem; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.term-num b { color: var(--text); }
.term .bar { grid-column: 2 / -1; margin-top: 3px; height: 4px; }
.empty-note { margin-top: 12px; padding: 14px; font-size: .86rem; color: var(--text-3); text-align: center; background: var(--surface-2); border-radius: var(--r-sm); }

/* ---------- Thanh bên ---------- */
.side { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) and (max-width: 1023px) and (hover: hover) { .side { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (hover: none) { .shortcuts-card { display: none; } }

.side-card { padding: 16px; }
.side-head { display: flex; align-items: center; gap: 12px; }
.side-head h2 { font-size: .98rem; font-weight: 700; line-height: 1.3; }
.side-head p { font-size: .82rem; color: var(--text-3); }
.side-icon {
  display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px; background: var(--tint); color: var(--accent-text);
}
.donate .side-icon { background: var(--grad); color: #fff; }
.side-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; font-size: .8rem; color: var(--text-3); }
.side-note .ic { width: 15px; height: 15px; }

.qr-frame {
  position: relative; display: block; width: 100%; margin-top: 14px; padding: 12px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r); cursor: zoom-in; overflow: hidden;
}
.qr-frame img { width: 100%; max-width: 190px; height: auto; margin: 0 auto; }
.qr-zoom {
  position: absolute; left: 50%; bottom: 10px; transform: translate(-50%, 6px);
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  font-size: .78rem; font-weight: 600; color: #fff; background: rgba(15,38,32,.85);
  border-radius: 999px; opacity: 0; transition: opacity .2s, transform .2s;
}
.qr-zoom .ic { width: 14px; height: 14px; }
.qr-frame:hover .qr-zoom, .qr-frame:focus-visible .qr-zoom { opacity: 1; transform: translate(-50%, 0); }

.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 14px 0 0; font-size: .82rem; align-items: center; }
.shortcuts dt { display: flex; align-items: center; gap: 3px; color: var(--text-3); }
.shortcuts dd { margin: 0; color: var(--text-2); text-align: right; }
kbd {
  font-family: var(--mono); font-size: .72rem; font-weight: 600; line-height: 1;
  padding: 4px 6px; border-radius: 5px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border-strong); border-bottom-width: 2px;
}

/* Chi tiết */
.details-card .side-head .mini-btn { margin-left: auto; }
.details { display: grid; grid-template-columns: minmax(0, 1fr) auto; margin: 10px 0 0; font-size: .86rem; }
.details dt, .details dd { padding: 7px 0; border-bottom: 1px solid var(--border); }
.details dt { color: var(--text-2); }
.details dd { margin: 0; padding-left: 12px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.details dt:last-of-type, .details dd:last-of-type { border-bottom: 0; }
.sms-note { margin-top: 4px; padding: 8px 10px; font-size: .78rem; color: var(--text-2); background: var(--surface-2); border-radius: var(--r-sm); }
@media (min-width: 640px) and (max-width: 1023px) {
  .details-card { grid-column: 1 / -1; }
  .details { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; column-gap: 28px; }
  .details dt:nth-last-of-type(2), .details dd:nth-last-of-type(2) { border-bottom: 0; }
}

/* ---------- Hướng dẫn ---------- */
.guide { padding-top: 56px; padding-bottom: 48px; }
.guide h2 { text-align: center; font-size: clamp(1.25rem, 1.5vw + .9rem, 1.6rem); font-weight: 800; letter-spacing: -.015em; margin-bottom: 20px; }
.guide-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 600px) { .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .guide-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.guide-item { padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.guide-ic { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 12px; border-radius: 10px; background: var(--tint); color: var(--accent-text); }
.guide-item h3 { font-size: .98rem; font-weight: 700; }
.guide-item p { margin-top: 4px; font-size: .87rem; color: var(--text-2); }
.guide-item b { color: var(--text); font-weight: 600; }

.faq { max-width: 780px; margin: 48px auto 0; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.faq details + details { margin-top: 8px; }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; font-weight: 600; cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--accent-text); }
.faq .chev { color: var(--text-3); transition: transform .2s; }
.faq details[open] .chev { transform: rotate(180deg); }
.faq details p { padding: 0 16px 16px; font-size: .92rem; color: var(--text-2); }

.privacy { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 24px; font-size: .85rem; color: var(--text-3); text-align: center; }
.privacy .ic { width: 16px; height: 16px; color: var(--accent-text); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 18px 0 calc(18px + env(safe-area-inset-bottom)); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; font-size: .85rem; color: var(--text-3); }
.footer-brand { display: flex; align-items: center; gap: 10px; color: var(--text-2); text-decoration: none; }
.footer-brand img { border-radius: 7px; background: #fff; box-shadow: 0 0 0 1px var(--border); }
.footer-brand strong { color: var(--text); }

/* ---------- Hộp QR phóng to ---------- */
.qr-dialog {
  width: min(92vw, 360px); padding: 22px; border: 0; border-radius: 20px; text-align: center;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.qr-dialog::backdrop { background: rgba(6,20,16,.55); backdrop-filter: blur(3px); }
.qr-dialog h2 { font-size: 1.05rem; margin-bottom: 14px; }
.qr-dialog img { width: 100%; height: auto; padding: 10px; background: #fff; border-radius: var(--r); border: 1px solid var(--border); }
.qr-dialog p { margin-top: 12px; font-size: .88rem; color: var(--text-2); }
.qr-dialog form { position: absolute; top: 12px; right: 12px; margin: 0; }
.qr-close { width: 32px; height: 32px; }
.qr-close .ic { width: 16px; height: 16px; }

/* ---------- Thông báo ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 50;
  max-width: calc(100vw - 32px); padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: .88rem; font-weight: 500; box-shadow: var(--shadow-lg);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
:root[data-theme="dark"] .toast { background: #e7f1ec; color: #0f2620; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #e7f1ec; color: #0f2620; } }

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

/* =========================================================
   Khối "Về ManhTool" + "Hợp tác" — dùng chung cho mọi công cụ
   ========================================================= */
.brand-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; padding-bottom: 48px; }
@media (min-width: 1024px) { .brand-section { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: stretch; } }

.brand-card {
  display: flex; align-items: center; gap: 28px; padding: 28px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.brand-logo {
  width: 150px; height: 150px; flex: none; object-fit: contain;
  border-radius: 24px; background: #fff; border: 1px solid #e8ece9;
  box-shadow: 0 12px 30px -12px rgba(14,124,90,.45);
}
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--accent-text); margin-bottom: 8px; }
.eyebrow .ic { width: 15px; height: 15px; }
.brand-body h2 { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; margin-bottom: 6px; }
.brand-slogan { font-weight: 700; font-size: 1.02rem; margin-bottom: 10px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-body p:not(.brand-slogan) { color: var(--text-2); margin-bottom: 16px; }
.brand-body b { color: var(--text); }

.hire-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 12px; padding: 26px;
  border-radius: var(--r-lg); color: #fff;
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(101,199,40,.28), transparent 70%),
    radial-gradient(360px 200px at 0% 100%, rgba(15,159,110,.3), transparent 70%),
    linear-gradient(160deg, #10241c, #0c1712);
  border: 1px solid rgba(255,255,255,.06);
}
.hire-label { align-self: flex-start; padding: 4px 11px; border-radius: 999px; background: rgba(101,199,40,.16); color: #a6e77a; font-size: .75rem; font-weight: 700; letter-spacing: .02em; }
.hire-card h2 { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.3; }
.hire-card > p { color: rgba(255,255,255,.75); }
.hire-services { list-style: none; margin: 2px 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.hire-services li { display: flex; align-items: center; gap: 10px; font-size: .9rem; font-weight: 500; }
.hire-services .ic { width: 16px; height: 16px; color: #7ddc4a; }
.hire-phone {
  display: flex; align-items: center; gap: 14px; margin-top: 4px; padding: 14px 16px;
  border-radius: 14px; color: #fff; text-decoration: none;
  background: linear-gradient(135deg, #12b886, #4fb52a);
  box-shadow: 0 14px 30px -12px rgba(79,181,42,.65);
  transition: transform .15s, box-shadow .15s;
}
.hire-phone:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -12px rgba(79,181,42,.8); }
.hp-ico { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.2); }
.hp-ico .ic { width: 20px; height: 20px; animation: ring 2.6s ease-in-out infinite; }
@keyframes ring { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-14deg); } 80% { transform: rotate(12deg); } 85% { transform: rotate(-8deg); } 90% { transform: rotate(6deg); } }
.hire-phone small { display: block; font-size: .75rem; opacity: .85; font-weight: 600; }
.hire-phone b { display: block; font-size: 1.45rem; font-weight: 800; letter-spacing: .02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.hire-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-ghost-light {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: var(--r-sm); cursor: pointer;
  font-size: .86rem; font-weight: 600; color: #fff; text-decoration: none;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16);
  transition: background .15s;
}
.btn-ghost-light .ic { width: 16px; height: 16px; }
.btn-ghost-light:hover { background: rgba(255,255,255,.12); }
.hire-tags { font-size: .78rem; color: rgba(255,255,255,.55); margin-top: auto; padding-top: 4px; }

@media (max-width: 767px) {
  .brand-card, .hire-card { padding: 20px 16px; }
}
@media (max-width: 560px) {
  .brand-card { flex-direction: column; text-align: center; gap: 16px; }
  .brand-logo { width: 120px; height: 120px; }
  .hire-actions .btn-ghost-light { flex: 1 1 auto; }
}
