:root {
  --bg: #f6f6f4;
  --panel: #ffffff;
  --panel-2: #fafaf8;
  --line: #e7e6e1;
  --line-2: #d9d8d2;
  --text: #1c1c1a;
  --text-2: #5f5e58;
  --text-3: #8f8d86;
  --accent: #5b5bd6;
  --accent-soft: #ececfd;
  --accent-text: #4040b8;
  --star: #e8a317;
  --danger: #d1453b;
  --ok: #2f9e5b;
  --warn: #c98a12;
  --shadow: 0 1px 2px rgba(20, 20, 15, .05), 0 4px 16px rgba(20, 20, 15, .06);
  --shadow-lg: 0 10px 40px rgba(20, 20, 15, .18);
  --radius: 12px;
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs: 48px;
  --vt-bg: #f0f0ee;
  --vt-ink-muted: #5f5e58;
  --vt-ink-subtle: #8f8d86;
  --vt-success: #27a644;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131313; --vt-bg: #232425; --vt-ink-muted: #d0d6e0; --vt-ink-subtle: #8a8f98; --panel: #1b1b1b; --panel-2: #202020; --line: #2c2c2b; --line-2: #3a3a38;
    --text: #ecebe6; --text-2: #aeada6; --text-3: #7c7b75; --accent: #8d8dff; --accent-soft: #26264a;
    --accent-text: #b4b4ff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    --shadow-lg: 0 10px 40px rgba(0,0,0,.6); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131313; --vt-bg: #232425; --vt-ink-muted: #d0d6e0; --vt-ink-subtle: #8a8f98; --panel: #1b1b1b; --panel-2: #202020; --line: #2c2c2b; --line-2: #3a3a38;
  --text: #ecebe6; --text-2: #aeada6; --text-3: #7c7b75; --accent: #8d8dff; --accent-soft: #26264a;
  --accent-text: #b4b4ff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.6); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 13px/1.45 var(--ui); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
code { font: 12px ui-monospace, Menlo, monospace; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; border: 1px solid var(--line); }
[hidden] { display: none !important; }

.ico { display: inline-flex; width: 16px; height: 16px; flex: none; }
.ico svg, .icon-btn svg { width: 100%; height: 100%; }

/* ---------- layout ---------- */
#app { display: grid; grid-template-columns: 248px 1fr; height: 100vh; }
#sidebar {
  background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto;
  padding: 14px 10px 24px; display: flex; flex-direction: column; gap: 4px;
}
#main { overflow-y: auto; position: relative; }
#scrim { display: none; }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 15px; padding: 2px 8px 10px; }
.logo {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font: 600 14px Georgia, serif;
}
.logo.big { width: 52px; height: 52px; border-radius: 14px; font-size: 26px; margin: 0 auto 6px; }

.folder { margin: 0 4px 8px; padding: 9px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.folder-path { font-size: 12px; color: var(--text-2); word-break: break-all; line-height: 1.35; max-height: 3.6em; overflow: hidden; }
.folder-actions { display: flex; gap: 4px; margin-top: 6px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 6px 9px; border-radius: 8px; border: 0; background: none;
  text-align: left; color: var(--text); text-decoration: none; position: relative; min-height: 31px; width: 100%;
}
.nav-item:hover { background: var(--panel-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 560; }
.nav-item .ico { color: var(--text-3); }
.nav-item.active .ico { color: var(--accent-text); }
.nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-item .cat-actions { display: none; gap: 2px; }
.nav-item:hover .cat-actions, .nav-item:focus-within .cat-actions { display: flex; }
.nav-item:hover .count { display: none; }
.nav-item.drop { outline: 2px dashed var(--accent); }

.side-title {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 9px 4px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600;
}
.filters { padding: 4px 9px; display: flex; flex-direction: column; gap: 9px; }
.check-line { display: flex; align-items: center; gap: 7px; color: var(--text-2); cursor: pointer; }
.check-line input { accent-color: var(--accent); }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }

/* ---------- controls ---------- */
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: none; padding: 7px;
  display: inline-grid; place-items: center; color: var(--text-2); flex: none;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn.sm { width: 24px; height: 24px; padding: 4px; }
.icon-btn.on { background: var(--accent-soft); color: var(--accent-text); }
.btn, .btn-ghost {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font-weight: 520; white-space: nowrap;
  text-decoration: none;
}
.btn:hover { border-color: var(--text-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { border-color: transparent; background: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 99px;
  border: 1px solid var(--line-2); background: var(--panel); font-size: 12px; color: var(--text-2); white-space: nowrap;
}
button.chip:hover { border-color: var(--text-3); color: var(--text); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
input[type="text"], input[type="search"], input[type="password"], textarea, select {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; height: 32px; outline: none;
}
textarea { padding: 8px 10px; height: auto; resize: vertical; line-height: 1.5; width: 100%; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="range"] { accent-color: var(--accent); }

/* ---------- toolbar ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
#btnMenu { display: none; }
.search { position: relative; flex: 0 1 260px; min-width: 150px; }
.search .ico { position: absolute; left: 10px; top: 8px; color: var(--text-3); }
.search input { width: 100%; padding-left: 32px; }
.sample { position: relative; flex: 1 1 300px; min-width: 160px; display: flex; gap: 6px; align-items: center; }
.sample input { flex: 1; min-width: 0; }
.presets { display: flex; gap: 4px; }
.size { display: flex; align-items: center; gap: 8px; flex: none; }
.size input { width: 110px; }
#sizeLabel { width: 42px; color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 12px; }
.seg { display: flex; border: 1px solid var(--line-2); border-radius: 9px; padding: 2px; gap: 2px; background: var(--panel); }
.seg .icon-btn { width: 28px; height: 26px; padding: 5px; }

.subbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px 4px; color: var(--text-2); }
#summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 26px; }
#summary b { color: var(--text); font-weight: 600; }
.subbar-right { display: flex; gap: 6px; align-items: center; }
.subbar select { height: 28px; font-size: 12px; }

/* ---------- results ---------- */
#results { padding: 10px 20px 20px; }
#results.grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(clamp(250px, calc(var(--fs) * 5.2), 620px), 1fr));
}
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); position: relative;
  display: flex; flex-direction: column; min-width: 0; transition: border-color .12s, box-shadow .12s; cursor: pointer;
}
.card:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.card .preview {
  padding: 16px 16px 8px; min-height: calc(var(--fs) * 1.6 + 26px); display: flex; align-items: center;
  overflow: hidden;
}
.fontsample {
  font-size: var(--fs); line-height: 1.22; color: var(--text); overflow-wrap: anywhere; width: 100%;
  transition: opacity .2s; font-synthesis: none;
}
.card .fontsample { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: normal; white-space: pre-wrap; padding-bottom: .08em; }
.card .preview { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.fontsample.pending { opacity: .12; }
.fontsample.failed { opacity: .5; font-size: 13px !important; font-family: var(--ui) !important; color: var(--danger); }
.card .meta { padding: 8px 14px 12px; display: flex; align-items: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.card .meta-text { flex: 1; min-width: 0; }
.name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
/* chip danh mục trong card: cùng kiểu pill với nhãn Việt hoá (status-badge của Linear) */
.tags .chip { height: auto; padding: 2px 8px; border: 0; border-radius: 9999px; background: var(--vt-bg); color: var(--vt-ink-muted); font: 400 12px/1.40 var(--ui); letter-spacing: 0; }
.badge { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 5px; letter-spacing: .02em; }
.badge.vi-full { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.badge.vi-partial { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge.vi-none, .badge.plain { color: var(--text-3); background: var(--panel-2); }
.badge.vi-no { color: var(--danger); background: color-mix(in srgb, var(--danger) 11%, transparent); }

/* ---------- nhãn Việt hoá — theo status-badge của Linear ----------
   pill: nền surface-2, chữ caption 12px/400/1.40, letter-spacing 0, bo 9999px, padding 2px 8px, không viền.
   Trạng thái nằm ở chấm 6px; màu ngữ nghĩa duy nhất là xanh #27a644, không dùng đỏ/cam. */
.vt {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 9999px;
  background: var(--vt-bg); color: var(--vt-ink-muted);
  font: 400 12px/1.40 var(--ui); letter-spacing: 0; white-space: nowrap;
}
.vt-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; display: none; }
.vt-full .vt-dot, .vt-partial .vt-dot, .vt-none .vt-dot { display: block; }
.vt-full .vt-dot { background: var(--vt-success); }
.vt-partial .vt-dot { background: linear-gradient(90deg, var(--vt-success) 50%, transparent 50%); box-shadow: inset 0 0 0 1px var(--vt-success); }
.vt-none .vt-dot { box-shadow: inset 0 0 0 1.25px currentColor; }
.vt-none { color: var(--vt-ink-subtle); }
/* chấm ở thanh bên dùng cùng ngôn ngữ */
.vt-ico { width: 16px; height: 16px; display: grid; place-items: center; flex: none; color: var(--vt-ink-subtle); }
.vt-ico .vt-dot { width: 7px; height: 7px; }
/* lưới: nhãn trong hàng tag; danh sách: cột riêng, thẳng hàng */
.row-vi { display: none; }
#results.list .tag-vi { display: none; }
#results.list .row-vi { display: flex; order: 3; width: 150px; flex: none; padding: 0 8px; }
#results.list .row-actions { order: 4; }
.tag-vi { display: contents; }
.vi-note { font-size: 12px; line-height: 1.4; color: var(--vt-ink-subtle); padding: 4px 9px 4px 34px; }
.vi-missing { margin-top: 6px; font: 400 12px/1.40 var(--ui); color: var(--vt-ink-subtle); }
.vi-missing span { color: var(--vt-ink-muted); letter-spacing: .08em; }
.fontsample .miss, #missLegend .miss { color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); border-radius: .08em; }
.dr-head .tags { margin-top: 6px; }
#missLegend { font-size: 12px; color: var(--text-3); margin-right: auto; }
#missLegend .miss { font-weight: 700; padding: 0 2px; }

.card-top { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; pointer-events: none; z-index: 1; }
.card-top > * { pointer-events: auto; }
.card-top .right { display: flex; align-items: center; gap: 2px; }
.card-actions .icon-btn { background: var(--panel); }
.star-btn.on svg { fill: currentColor; }
.selbox {
  width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line-2); background: var(--panel);
  display: grid; place-items: center; opacity: 0; transition: opacity .1s; padding: 3px; color: #fff;
}
.card:hover .selbox, .selecting .selbox, .selbox:focus-visible { opacity: 1; }
.selected .selbox { background: var(--accent); border-color: var(--accent); }
.selbox svg { width: 100%; height: 100%; visibility: hidden; }
.selected .selbox svg { visibility: visible; }
.star-btn { width: 28px; height: 28px; padding: 5px; border-radius: 7px; border: 0; background: none; color: var(--text-3); opacity: 0; }
.card:hover .star-btn, .star-btn.on, .star-btn:focus-visible { opacity: 1; }
.star-btn:hover { background: var(--panel-2); }
.star-btn.on { color: var(--star); }
.star-btn svg { width: 100%; height: 100%; }
.card-actions { display: flex; gap: 2px; opacity: 0; }
.card:hover .card-actions, .card:focus-within .card-actions { opacity: 1; }

/* list mode */
#results.list { display: flex; flex-direction: column; gap: 0; padding-top: 6px; }
#results.list .card { flex-direction: row; align-items: center; border-radius: 0; border-width: 0 0 1px; background: transparent; }
#results.list .card:first-child { border-top-width: 1px; }
#results.list .card:hover { background: var(--panel); box-shadow: none; }
#results.list .card.selected { background: var(--accent-soft); box-shadow: none; }
#results.list .card-top { position: static; width: auto; gap: 2px; padding-left: 4px; order: 0; flex: none; }
#results.list .card-top .card-actions { display: none; }
#results.list .meta { order: 1; border: 0; width: 240px; flex: none; padding: 10px 12px; align-items: center; }
#results.list .preview { order: 2; flex: 1; min-width: 0; padding: 8px 12px; min-height: calc(var(--fs) * 1.3 + 16px); }
#results.list .fontsample { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-height: none; }
#results.list .row-actions { order: 3; display: flex; gap: 2px; padding-right: 10px; opacity: 0; }
#results.list .card:hover .row-actions { opacity: 1; }
#results.grid .row-actions { display: none; }

#sentinel { height: 1px; }
#empty { text-align: center; color: var(--text-3); padding: 80px 20px; font-size: 14px; }
#empty .big { font-size: 40px; font-family: Georgia, serif; color: var(--line-2); margin-bottom: 8px; }

/* ---------- bulk bar ---------- */
#bulkbar {
  position: fixed; left: calc(248px + (100vw - 248px) / 2); transform: translateX(-50%); bottom: 20px; z-index: 40;
  display: flex; align-items: center; gap: 6px; padding: 7px 7px 7px 16px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg);
}
#bulkCount { font-weight: 600; margin-right: 6px; white-space: nowrap; }

/* ---------- drawer ---------- */
#drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 50; background: var(--panel);
  border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); transform: translateX(105%);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column;
}
#drawer.open { transform: none; }
.dr-head { display: flex; align-items: flex-start; gap: 10px; padding: 18px 18px 12px; border-bottom: 1px solid var(--line); }
.dr-head h2 { margin: 0; font-size: 19px; line-height: 1.25; font-weight: 650; word-break: break-word; }
.dr-head .sub { white-space: normal; margin-top: 3px; }
.dr-title { flex: 1; min-width: 0; }
.dr-body { overflow-y: auto; padding: 4px 18px 30px; flex: 1; }
.dr-section { padding: 14px 0; border-bottom: 1px solid var(--line); }
.dr-section:last-child { border-bottom: 0; }
.dr-section h3 { margin: 0 0 9px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.style-row { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.style-row:last-child { border-bottom: 0; }
.style-row .style-name { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--text-3); gap: 8px; }
.style-row .fontsample { font-size: min(var(--fs), 56px); margin-top: 2px; }
dl.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--text-3); }
dl.kv dd { margin: 0; word-break: break-word; }
.license { max-height: 90px; overflow: auto; font-size: 12px; color: var(--text-2); white-space: pre-wrap; }
.file-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.file-row .path { flex: 1; min-width: 0; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.file-row .ext { font: 600 10.5px ui-monospace, Menlo, monospace; text-transform: uppercase; color: var(--text-3); width: 42px; }
.saved { font-size: 11px; color: var(--ok); text-transform: none; letter-spacing: 0; font-weight: 500; opacity: 0; transition: opacity .2s; }
.saved.show { opacity: 1; }

.glyphs { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 3px; }
.glyph {
  height: 46px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; font-size: 24px;
  background: var(--panel-2); position: relative;
}
.glyph:hover { border-color: var(--accent); }
.glyph.missing { color: var(--danger); opacity: .55; font-family: var(--ui) !important; font-size: 15px; text-decoration: line-through; background: none; border-style: dashed; }
.glyph-head { font-size: 12px; color: var(--text-2); margin: 12px 0 6px; font-weight: 560; }
.glyph-head:first-child { margin-top: 0; }

/* ---------- popover / modal ---------- */
#popover {
  position: fixed; z-index: 70; min-width: 230px; max-width: 300px; max-height: 60vh; overflow: auto; padding: 6px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.pop-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 9px; border: 0; background: none; border-radius: 7px; text-align: left; }
.pop-item:hover { background: var(--panel-2); }
.pop-item .box { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line-2); display: grid; place-items: center; color: #fff; flex: none; }
.pop-item .box.all { background: var(--accent); border-color: var(--accent); }
.pop-item .box.some { background: var(--accent); border-color: var(--accent); }
.pop-item .box svg { width: 12px; height: 12px; }
.pop-sep { height: 1px; background: var(--line); margin: 5px 2px; }
.pop-title { padding: 6px 9px 4px; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

#modal { position: fixed; inset: 0; z-index: 80; background: rgba(10, 10, 8, .38); display: grid; place-items: center; padding: 20px; }
.modal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: min(460px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column;
}
.modal-card.wide { width: min(760px, 100%); }
.modal-card h2 { margin: 0; padding: 18px 20px 6px; font-size: 16px; }
.modal-card .m-body { padding: 8px 20px; overflow: auto; color: var(--text-2); }
.modal-card .m-body input[type="text"] { width: 100%; }
.modal-card .m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; }
.dup-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.dup-group .name { margin-bottom: 4px; }
.sug-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.sug-row .name { width: 200px; flex: none; color: var(--text); }
.sug-row .fontsample { font-size: 22px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- setup / scanning / toast ---------- */
#setup, #scanning { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: grid; place-items: center; padding: 20px; }
#scanning { background: color-mix(in srgb, var(--bg) 80%, transparent); }
.setup-card, .scan-card {
  width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 30px; text-align: center;
}
.setup-card h1 { margin: 0 0 6px; font-size: 22px; }
.setup-card p { color: var(--text-2); margin: 0 0 18px; }
.setup-card .or { color: var(--text-3); font-size: 12px; margin: 16px 0 8px; }
.setup-card form { display: flex; gap: 6px; }
.setup-card form input { flex: 1; }
.err { color: var(--danger) !important; margin: 12px 0 0 !important; min-height: 1em; }
.scan-card { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-2); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { width: 100%; height: 5px; background: var(--line); border-radius: 9px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 380px; animation: pop .18s ease-out; }
.toast.error { background: var(--danger); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .presets { display: none; }
  .size input { width: 80px; }
}
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  #sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.menu-open #sidebar { transform: none; }
  body.menu-open #scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.3); }
  #btnMenu { display: inline-grid; }
  .toolbar { flex-wrap: wrap; padding: 10px 16px; }
  .search { flex: 1 1 200px; }
  .sample { order: 5; flex-basis: 100%; }
  .subbar, #results { padding-left: 16px; padding-right: 16px; }
  #bulkbar { left: 50%; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 32px); }
  #results.list .meta { width: 170px; }
}

/* chạy trên server: không có "Hiện trong Finder" */
.no-reveal [data-act="reveal"], .no-reveal [data-reveal] { display: none !important; }

/* ---------- đăng nhập ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-page .setup-card form { flex-direction: column; gap: 10px; }
.login-page .setup-card input { height: 38px; }
.login-page .setup-card .btn { height: 38px; justify-content: center; }
