:root {
  --blue: #1e5fd8;
  --blue-dark: #1747a6;
  --blue-soft: #e7efff;
  --yellow: #f5c518;
  --red: #e0435c;
  --green: #16a34a;
  --bg: #eef3fb;
  --card: #ffffff;
  --text: #16213a;
  --muted: #64708a;
  --border: #d9e2f1;
  --shadow: 0 1px 2px rgba(20, 40, 90, .06), 0 4px 14px rgba(20, 40, 90, .07);
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #4c8dff;
    --blue-dark: #2f6fe0;
    --blue-soft: #1b2a4a;
    --bg: #0d1424;
    --card: #162036;
    --text: #e6ecf8;
    --muted: #93a0bb;
    --border: #26324d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
a { color: var(--blue); text-decoration: none; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--text); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

.ico { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ico svg { width: 100%; height: 100%; fill: currentColor; }

/* ---------- Khung trang ---------- */
.page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-t)) 12px 10px;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 10px rgba(20, 60, 150, .25);
}
.topbar h1 { flex: 1; margin: 0; font-size: 20px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-ico {
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; color: var(--blue);
  display: grid; place-items: center;
}
.brand-ico .ico { width: 22px; height: 22px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent; border: 0; color: #fff; cursor: pointer;
}
.icon-btn:active { background: rgba(255, 255, 255, .18); }
.icon-btn .ico { width: 24px; height: 24px; }
.content { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 12px 12px 24px; }

.dropdown {
  position: fixed; top: calc(56px + var(--safe-t)); right: 10px; z-index: 50;
  background: var(--card); border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  padding: 6px; min-width: 220px; display: flex; flex-direction: column;
}
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px;
  color: var(--text); background: none; border: 0; text-align: left; cursor: pointer; font-size: 15px;
}
.dropdown a:active, .dropdown button:active { background: var(--blue-soft); }
.dropdown .ico { color: var(--blue); }

/* ---------- Tìm kiếm ---------- */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 2px solid var(--blue); border-radius: 12px;
  padding: 0 12px; box-shadow: var(--shadow);
}
.search-box .ico { color: var(--blue); }
.search-input { flex: 1; border: 0; outline: 0; background: transparent; padding: 12px 0; font-size: 16px; min-width: 0; }
.chips-row { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 2px; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 999px; font-size: 14px;
  background: var(--card); border: 1px solid var(--border); color: var(--text); cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip-x { border: 0; background: none; color: inherit; font-size: 18px; line-height: 1; padding: 0 0 0 4px; cursor: pointer; }
.list-count { color: var(--muted); font-size: 13px; padding: 10px 4px 4px; }

/* ---------- Danh sách liên hệ ---------- */
.contact-list { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.contact-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius); padding: 12px;
  box-shadow: var(--shadow); color: var(--text);
  border: 1px solid transparent;
}
.contact-card:active { border-color: var(--blue); }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 20px;
}
.avatar-lg { width: 64px; height: 64px; font-size: 28px; }
.cc-body { flex: 1; min-width: 0; }
.cc-name { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.cc-line { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-line .ico { width: 15px; height: 15px; color: var(--blue); }
.round-btn {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; cursor: pointer;
}
.round-btn.call { background: var(--green); }
.round-btn .ico { width: 20px; height: 20px; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-ico { width: 56px; height: 56px; color: var(--blue); opacity: .5; }
.empty p { margin: 8px 0; }

/* ---------- Thanh dưới ---------- */
.bottom-bar {
  position: sticky; bottom: 0; z-index: 15;
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px calc(10px + var(--safe-b));
  background: var(--card); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(20, 40, 90, .08);
}
.bottom-bar .scan-wrap { flex: 1; display: flex; }
.bottom-bar .scan-wrap .btn { flex: 1; }

/* ---------- Nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 12px; border: 0; cursor: pointer;
  font-weight: 600; font-size: 16px; min-height: 48px; text-align: center;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn-block { display: flex; width: 100%; margin-top: 10px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:active { background: var(--blue-dark); }
.btn-scan { font-size: 17px; min-height: 52px; }
.btn-scan .ico { width: 24px; height: 24px; }
.btn-outline { background: var(--card); color: var(--blue); border: 2px solid var(--blue); }
.btn-ghost { background: transparent; color: var(--blue); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--red); border: 1px solid var(--border); }
.btn-ai {
  background: linear-gradient(135deg, #f5c518, #f59e0b); color: #2a1d00;
}
.link-btn { background: none; border: 0; color: var(--blue); font-weight: 600; padding: 6px 0; cursor: pointer; font-size: 14px; }
.mini-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0; flex: none;
  background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; cursor: pointer;
}
.mini-btn .ico { width: 18px; height: 18px; }

/* ---------- Panel / form ---------- */
.panel {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); margin-bottom: 12px;
}
.panel-title { font-weight: 700; color: var(--blue); margin-bottom: 8px; font-size: 15px; }
.field { display: block; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.field input, .field textarea, .field select, .multi-row input, .multi-row select, .tag-editor input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); outline: none; font-size: 16px;
}
.field input:focus, .field textarea:focus, .multi-row input:focus, .tag-editor input:focus { border-color: var(--blue); background: var(--card); }
.field textarea { resize: vertical; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two-col .field { margin-bottom: 12px; }
.multi-rows { display: flex; flex-direction: column; gap: 8px; }
.multi-row { display: flex; gap: 6px; align-items: center; }
.multi-row select { width: auto; flex: none; max-width: 110px; padding-right: 4px; }
.multi-row input { flex: 1; min-width: 0; }
.tag-editor { display: flex; flex-direction: column; gap: 8px; }
.quick-tags .chip { font-size: 13px; padding: 4px 10px; color: var(--muted); }
.form-error { color: var(--red); min-height: 20px; font-size: 14px; }
.form-footer {
  position: sticky; bottom: 0; padding: 10px 0 calc(10px + var(--safe-b));
  background: linear-gradient(transparent, var(--bg) 30%);
}
.form-footer .btn { margin-top: 0; }

/* Ảnh danh thiếp trong form */
.img-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.img-slot {
  position: relative; aspect-ratio: 1.6; border-radius: 12px; overflow: hidden;
  background: var(--bg); border: 1px solid var(--border);
}
.img-slot img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.empty-slot {
  border: 2px dashed var(--blue); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.empty-slot .scan-wrap { display: contents; }
.slot-btn {
  background: none; border: 0; color: var(--blue); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 600; font-size: 14px;
}
.slot-btn .ico { width: 30px; height: 30px; }
.empty-slot .link-btn { font-size: 12px; font-weight: 500; padding: 2px; }
.slot-tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 6px; }
.slot-tools .mini-btn { background: rgba(0, 0, 0, .55); color: #fff; width: 30px; height: 30px; }
.img-label {
  position: absolute; left: 6px; bottom: 6px; background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
}
.ai-status { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--blue-soft); font-size: 14px; }
.ai-status.ok { background: #e3f7ea; color: #0f6b33; }
.ai-status.warn { background: #fff4d6; color: #7a5300; }
@media (prefers-color-scheme: dark) {
  .ai-status.ok { background: #12351f; color: #7ee2a2; }
  .ai-status.warn { background: #3a2e0c; color: #f5d27a; }
}
.dup-box {
  background: #fff4d6; color: #5c4100; border: 1px solid #f5c518; border-radius: 12px;
  padding: 12px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 14px;
}
.dup-box a { color: var(--blue-dark); text-decoration: underline; }

/* ---------- Chi tiết ---------- */
.card-images { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin-bottom: 12px; scrollbar-width: none; }
.card-images::-webkit-scrollbar { display: none; }
.card-img {
  position: relative; flex: 0 0 100%; scroll-snap-align: center; border: 0; padding: 0;
  border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow); cursor: zoom-in;
}
.card-images:has(.card-img + .card-img) .card-img { flex-basis: 88%; }
.card-img img { width: 100%; display: block; aspect-ratio: 1.65; object-fit: contain; background: #fff; }
.detail-head { display: flex; gap: 14px; align-items: center; padding: 4px 4px 14px; }
.detail-head h2 { margin: 0 0 2px; font-size: 22px; }
.detail-head .company { font-weight: 600; color: var(--blue); }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; margin-bottom: 12px; }
.qa {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--card); border-radius: 14px; padding: 10px 4px; box-shadow: var(--shadow);
  font-size: 13px; color: var(--text); font-weight: 600;
}
.qa-ico { width: 40px; height: 40px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; }
.qa.zalo .qa-ico { background: #0068ff; }
.info-list { padding: 4px 14px; }
.info-row { display: flex; gap: 14px; align-items: center; padding: 12px 0; color: var(--text); border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: 0; }
.row-ico { color: var(--blue); }
.row-text { min-width: 0; flex: 1; }
.row-value { word-break: break-word; }
.row-label { font-size: 12px; color: var(--muted); }
.note { white-space: pre-wrap; }
.detail-actions { padding-top: 4px; }

.image-viewer {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .92);
  display: grid; place-items: center; padding: 16px;
}
.image-viewer img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.viewer-close { position: absolute; top: calc(12px + var(--safe-t)); right: 12px; background: rgba(255, 255, 255, .15); }

/* ---------- Cắt ảnh ---------- */
.crop-overlay {
  position: fixed; inset: 0; z-index: 90; background: #0b0f19; color: #fff;
  display: flex; flex-direction: column;
  padding: calc(10px + var(--safe-t)) 0 calc(10px + var(--safe-b));
}
.crop-top { padding: 6px 16px 10px; text-align: center; }
.crop-status { font-size: 13px; color: #b8c3da; margin-top: 4px; min-height: 18px; }
.crop-stage { flex: 1; position: relative; display: grid; place-items: center; margin: 0 12px; min-height: 0; touch-action: none; }
.crop-img { grid-area: 1 / 1; display: block; }
.crop-svg { grid-area: 1 / 1; touch-action: none; overflow: visible; }
.crop-poly { fill: rgba(30, 95, 216, .18); stroke: #4c8dff; stroke-width: 2.5; }
.crop-handle { fill: rgba(255, 255, 255, .9); stroke: #1e5fd8; stroke-width: 4; }
.crop-handle.active { fill: #f5c518; }
.crop-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px 10px 0; }
.crop-actions .btn { padding: 10px 4px; font-size: 14px; min-height: 46px; }
.crop-actions .btn-ghost { color: #dbe6ff; background: rgba(255, 255, 255, .08); }

/* ---------- Đăng nhập ---------- */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--blue) 0 38%, var(--bg) 38%); }
.login-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 20px; padding: 28px 22px; box-shadow: 0 10px 40px rgba(20, 40, 90, .18); text-align: center; }
.login-card h1 { margin: 10px 0 2px; font-size: 24px; }
.login-card .field { text-align: left; }
.login-card > p { margin: 0 0 18px; }
.login-logo { width: 64px; height: 64px; margin: 0 auto; border-radius: 18px; background: var(--yellow); color: var(--blue-dark); display: grid; place-items: center; }
.login-logo .ico { width: 36px; height: 36px; }

/* ---------- Khác ---------- */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 20px; color: var(--muted); }
.ai-status .loading { padding: 0; justify-content: flex-start; }
.spin { width: 22px; height: 22px; border: 3px solid var(--blue-soft); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { margin: 0; padding-left: 20px; }
.steps li { margin: 4px 0; }

.modal-overlay { position: fixed; inset: 0; z-index: 95; background: rgba(0, 0, 0, .45); display: grid; place-items: center; padding: 20px; }
.modal { background: var(--card); border-radius: 18px; padding: 20px; max-width: 360px; width: 100%; }
.modal p { margin: 0 0 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

#toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translate(-50%, 20px);
  background: #16213a; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 200; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--red); }
#toast.ok { background: var(--green); }

.ok-text { color: var(--green); font-weight: 600; }
.warn-text { color: #b45309; font-weight: 600; }
.ai-stats { margin-top: 4px; font-size: 12px; opacity: .85; }
.model-pick { display: flex; flex-direction: column; gap: 8px; }
.model-pick select, .model-pick input { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); font-size: 16px; }
.model-pick .btn { margin-top: 0; }
.usage-info { background: var(--blue-soft); border-radius: 10px; padding: 10px 12px; }

/* ---------- Nhiều người dùng ---------- */
.brand-avatar { object-fit: cover; padding: 0; border: 2px solid #fff; }
.dd-user { padding: 10px 12px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: flex; flex-direction: column; }
.dd-user span { font-size: 12px; color: var(--muted); }
.google-box { display: flex; justify-content: center; min-height: 48px; margin: 8px 0 4px; }
.login-card .link-btn { display: block; margin: 8px auto 0; font-weight: 500; color: var(--muted); }
.pw-form { margin-top: 8px; text-align: left; }
.legal-links { color: var(--muted); margin-top: 16px; }
.legal-links a { color: var(--muted); text-decoration: underline; }
.welcome h2 { margin: 0 0 8px; }
.big-steps li { margin: 8px 0; }
.account-panel { display: flex; align-items: center; gap: 14px; }
.acc-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--yellow); color: #3a2a00; margin-left: 6px; vertical-align: middle; }
.badge-red { background: var(--red); color: #fff; }
.badge-gray { background: var(--border); color: var(--muted); }
.danger-zone summary { cursor: pointer; color: var(--red); font-weight: 600; }
.danger-zone input { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); font-size: 16px; margin-top: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.stat { background: var(--card); border-radius: 14px; padding: 12px 8px; text-align: center; box-shadow: var(--shadow); }
.stat-value { font-size: 20px; font-weight: 800; color: var(--blue); }
.stat-label { font-size: 12px; color: var(--muted); }
.user-list { padding: 4px 14px; }
.user-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: 0; }
.user-row.disabled { opacity: .55; }
.u-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; }
.u-body { flex: 1; min-width: 0; }
.u-name { font-weight: 700; }
.u-sub { font-size: 12px; color: var(--muted); word-break: break-word; }
.u-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.u-actions .chip { font-size: 12px; padding: 4px 10px; }
.chip-danger { color: var(--red); border-color: var(--red); }

/* ---------- Dùng thử & góp ý ---------- */
.stars { display: flex; gap: 6px; margin: 4px 0 10px; }
.star { background: none; border: 0; font-size: 32px; line-height: 1; color: var(--border); cursor: pointer; padding: 0; }
.star.on { color: var(--yellow); }
.feedback-modal textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); font-size: 16px; margin-bottom: 12px; resize: vertical; }
.modal h3 { margin: 0 0 6px; }
.cred-box { background: var(--blue-soft); border-radius: 10px; padding: 12px; margin: 8px 0; line-height: 1.8; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 17px; letter-spacing: .5px; }
.invite-msg { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-size: 12px; max-height: 180px; overflow: auto; font-family: inherit; }
.modal { max-height: 90vh; overflow: auto; }
details > summary.panel-title { cursor: pointer; margin-bottom: 0; }
details[open] > summary.panel-title { margin-bottom: 8px; }
.fb-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.fb-item:last-child { border-bottom: 0; }
.fb-item.done { opacity: .55; }
.fb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fb-stars { color: #f59e0b; letter-spacing: 1px; }
.fb-msg { white-space: pre-wrap; margin: 4px 0 6px; font-size: 15px; }
.key-wrap { display: flex; gap: 6px; }
.key-wrap input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: 15px; }
.eye-btn { flex: none; border: 1px solid var(--border); background: var(--card); color: var(--blue); border-radius: 10px; padding: 0 12px; font-weight: 600; cursor: pointer; }

/* ---------- Thanh trên cùng, logo, ngôn ngữ ---------- */
.topbar { gap: 8px; }
.brand { display: flex; align-items: center; flex: none; border-radius: 10px; }
.brand:active { opacity: .8; }
.brand-logo { width: 34px; height: 34px; display: block; border-radius: 9px; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
.lang-btn {
  flex: none; min-width: 40px; height: 32px; padding: 0 8px; border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, .7); background: transparent; color: #fff;
  font-weight: 700; font-size: 13px; letter-spacing: .5px; cursor: pointer;
}
.lang-btn:active { background: rgba(255, 255, 255, .18); }
.dropdown button.active { background: var(--blue-soft); font-weight: 700; }
.lang-code { display: inline-block; min-width: 28px; font-weight: 800; color: var(--blue); }
.login-langs { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.login-langs .chip { font-size: 13px; padding: 5px 12px; }
.login-logo-img { width: 72px; height: 72px; border-radius: 18px; display: block; margin: 0 auto; box-shadow: 0 4px 14px rgba(30, 95, 216, .25); }
.lang-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 4px 12px; }
.lang-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.lang-bar .chip { font-size: 13px; padding: 5px 12px; }
.lang-add { border: 1px dashed var(--blue); color: var(--blue); background: var(--card); border-radius: 999px; padding: 5px 10px; font-size: 13px; font-weight: 600; }
.auto-note { margin: -6px 4px 12px; font-size: 12px; color: var(--muted); }

/* ---------- Màn hình chụp có khung ---------- */
.cam-overlay { position: fixed; inset: 0; z-index: 95; background: #000; display: flex; flex-direction: column; color: #fff; }
.cam-overlay.flash::after { content: ''; position: absolute; inset: 0; background: #fff; animation: camflash .15s ease-out forwards; }
@keyframes camflash { from { opacity: .9; } to { opacity: 0; } }
.cam-stage { position: relative; flex: 1; overflow: hidden; }
.cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-shade { position: absolute; inset: 0; pointer-events: none; }
.cam-frame {
  position: absolute; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); outline: 2px solid rgba(255, 255, 255, .85);
  transition: all .2s ease;
}
.cam-frame.free { outline-style: dashed; }
.cam-frame .c { position: absolute; width: 26px; height: 26px; border: 4px solid var(--yellow); }
.cam-frame .tl { left: -4px; top: -4px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.cam-frame .tr { right: -4px; top: -4px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.cam-frame .bl { left: -4px; bottom: -4px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.cam-frame .br { right: -4px; bottom: -4px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.cam-hint { position: absolute; left: 0; right: 0; text-align: center; font-size: 14px; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); padding-top: calc(var(--safe-t)); }
.cam-bottom { background: #000; padding: 10px 0 calc(14px + var(--safe-b)); }
.cam-presets { display: flex; gap: 8px; overflow-x: auto; padding: 0 12px 12px; scrollbar-width: none; }
.cam-presets::-webkit-scrollbar { display: none; }
.cam-chip { flex: none; border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .08); color: #fff; border-radius: 999px; padding: 7px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.cam-chip.active { background: var(--yellow); border-color: var(--yellow); color: #2a1d00; font-weight: 700; }
.cam-controls { display: flex; align-items: center; justify-content: space-around; }
.cam-round { width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .15); color: #fff; display: grid; place-items: center; cursor: pointer; }
.cam-round .ico { width: 24px; height: 24px; }
.cam-shutter { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: #fff; box-shadow: inset 0 0 0 4px #000; cursor: pointer; }
.cam-shutter:active { transform: scale(.94); }
.cam-shutter:disabled { opacity: .5; }
.crop-ratio { margin-top: 8px; background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.crop-ratio option { color: #000; }

/* ---------- Hình động thư ký ghi sổ ---------- */
.secretary { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 2px; }
.sec-svg { width: 220px; max-width: 70vw; height: auto; overflow: visible; }
.sec-text { font-size: 14px; font-weight: 600; color: var(--blue); text-align: center; }
.pen-shadow { fill: #1e3a8a; opacity: .08; }
.pen-cover { fill: #2f5fbf; }
.pen-page { fill: #fffdf6; stroke: #e6dcc3; stroke-width: .8; } .pen-page-r { fill: #fdf9ee; }
.pen-spine { stroke: #d8caa5; stroke-width: 1.4; }
.pen-rule { stroke: #cfdcf3; stroke-width: .7; fill: none; }
.pen-card { fill: #fff; stroke: #d5dff0; stroke-width: .8; }
.pen-card-dot { fill: var(--yellow, #f5c518); }
.pen-card-line { fill: #1e5fd8; opacity: .75; } .pen-card-line.soft { opacity: .35; }
.pen-clip { stroke: #9aa7bd; stroke-width: 2.2; stroke-linecap: round; }
.pen-ink { fill: none; stroke: #1e3a8a; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.pen-ink.done { opacity: .55; }
.pen-ink.l1, .pen-ink.l2, .pen-ink.l3 { stroke-dasharray: 100 130; stroke-dashoffset: 100; animation: 4.8s linear infinite; }
.pen-ink.l1 { animation-name: pen-l1; } .pen-ink.l2 { animation-name: pen-l2; } .pen-ink.l3 { animation-name: pen-l3; }
@keyframes pen-l1 { 0% { stroke-dashoffset: 100; opacity: 1; } 28% { stroke-dashoffset: 0; } 94% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes pen-l2 { 0%, 33% { stroke-dashoffset: 100; opacity: 1; } 61% { stroke-dashoffset: 0; } 94% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes pen-l3 { 0%, 66% { stroke-dashoffset: 100; opacity: 1; } 88% { stroke-dashoffset: 0; } 94% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.pen-move { animation: pen-move 4.8s linear infinite; }
@keyframes pen-move {
  0% { transform: translate(112px, 44px); }
  28% { transform: translate(168px, 43px); }
  33% { transform: translate(112px, 58px); }
  61% { transform: translate(168px, 57px); }
  66% { transform: translate(112px, 72px); }
  88% { transform: translate(156px, 72px); }
  94% { transform: translate(160px, 66px); }
  100% { transform: translate(112px, 44px); }
}
.pen-bob { animation: pen-bob .35s ease-in-out infinite alternate; }
@keyframes pen-bob { from { transform: translateY(0); } to { transform: translateY(-1.6px); } }
.pen-nib { fill: #d9a520; } .pen-nib-slit { stroke: #7a5a10; stroke-width: .6; }
.pen-band { fill: #e8c25a; }
.pen-body { fill: #1f2a44; } .pen-shine { fill: #fff; opacity: .25; }
.pen-clipbar { fill: #c9a640; } .pen-cap { fill: #c9a640; }
@media (prefers-reduced-motion: reduce) { .pen-move, .pen-bob, .pen-ink { animation: none !important; } .pen-ink { stroke-dashoffset: 0 !important; } .pen-move { transform: translate(150px, 70px); } }
.chip-static { cursor: default; white-space: normal; display: inline-flex; align-items: center; }
