/* ==========================================================================
   Trợ lý Tài chính số An Giang — hệ thống giao diện dùng chung
   ========================================================================== */

:root {
  /* Nền & mực */
  --plane:        #f4f4f1;
  --surface:      #fcfcfb;
  --surface-2:    #f7f7f4;
  --ink:          #0b0b0b;
  --ink-2:        #52514e;
  --ink-3:        #898781;
  --line:         #e1e0d9;
  --line-2:       #c3c2b7;
  --ring:         rgba(11,11,11,0.10);

  /* Thương hiệu */
  --brand:        #2a78d6;
  --brand-deep:   #184f95;
  --brand-dark:   #0d366b;
  --brand-100:    #cde2fb;
  --brand-150:    #b7d3f6;
  --brand-200:    #9ec5f4;

  /* Trạng thái */
  --good:         #0ca30c;
  --good-ink:     #006300;
  --warning:      #fab219;
  --serious:      #ec835a;
  --critical:     #d03b3b;

  /* Chuỗi dữ liệu */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;

  --r:   10px;
  --r-s: 7px;
  --shadow-1: 0 1px 2px rgba(11,11,11,.05), 0 1px 3px rgba(11,11,11,.04);
  --shadow-2: 0 2px 4px rgba(11,11,11,.05), 0 8px 24px rgba(11,11,11,.07);
  --shadow-3: 0 4px 8px rgba(11,11,11,.06), 0 24px 56px rgba(11,11,11,.12);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--plane);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-deep); }

/* ===== Thanh nhắc demo ================================================== */
.demo-bar {
  background: #1f1f1d; color: #e8e7e1;
  font-size: 12.5px; letter-spacing: .01em;
  padding: 7px 20px; display: flex; align-items: center; gap: 10px;
}
.demo-bar b { color: #fff; font-weight: 600; }
.demo-bar .sep { color: #6e6d67; }
.demo-bar a { color: #9ec5f4; text-decoration: none; }
.demo-bar a:hover { text-decoration: underline; }
.demo-bar .right { margin-left: auto; display: flex; gap: 14px; align-items: center; }

/* ===== Thanh trên ======================================================= */
.topbar {
  background: linear-gradient(180deg, #123f7d 0%, var(--brand-dark) 100%);
  color: #fff; padding: 0 20px;
  display: flex; align-items: center; gap: 16px; height: 60px;
  box-shadow: var(--shadow-1);
  position: sticky; top: 0; z-index: 40;
}
.topbar .logo {
  width: 34px; height: 34px; border-radius: 8px; flex: none;
  background: rgba(255,255,255,.14);
  display: grid; place-items: center; font-size: 17px;
  border: 1px solid rgba(255,255,255,.2);
}
.topbar .brand { line-height: 1.2; }
.topbar .brand strong { display: block; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.topbar .brand span { display: block; font-size: 11.5px; color: #b7d3f6; letter-spacing: .02em; }
.topbar .spacer { flex: 1; }

.who {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.16);
  padding: 5px 12px 5px 6px; border-radius: 999px;
  text-decoration: none; color: #fff; transition: background .15s;
}
.who:hover { background: rgba(255,255,255,.18); }
.who .av {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: #fff; color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.who .nm { line-height: 1.15; max-width: 240px; }
.who .nm b { display: block; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .nm i { display: block; font-style: normal; font-size: 11px; color: #b7d3f6; }
.who .sw { font-size: 11px; color: #b7d3f6; padding-left: 4px; }

/* ===== Bố cục ========================================================== */
.shell { display: flex; min-height: calc(100vh - 60px); align-items: flex-start; }

.side {
  width: 252px; flex: none; background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 14px 10px 28px;
  position: sticky; top: 60px; max-height: calc(100vh - 60px); overflow-y: auto;
}
.side .lbl {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-3); font-weight: 650; padding: 8px 12px 6px;
}
.side a {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 12px; border-radius: var(--r-s);
  text-decoration: none; color: var(--ink-2); margin-bottom: 1px;
  border: 1px solid transparent;
}
.side a:hover { background: var(--surface-2); color: var(--ink); }
.side a.on { background: var(--brand-100); color: var(--brand-dark); border-color: #a9cdf6; }
.side a .ic { width: 18px; text-align: center; flex: none; opacity: .75; font-size: 14px; padding-top: 1px; }
.side a.on .ic { opacity: 1; }
.side a .tx b { display: block; font-size: 13.5px; font-weight: 550; }
.side a .tx s { display: block; font-size: 11px; color: var(--ink-3); text-decoration: none; line-height: 1.35; margin-top: 1px; }
.side a.on .tx s { color: #2f5f9e; }
.side .uc {
  margin-left: auto; font-size: 9.5px; font-weight: 700; color: var(--ink-3);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 4px; letter-spacing: .02em; flex: none;
}
.side a.on .uc { background: #fff; border-color: #a9cdf6; color: var(--brand-deep); }
.side .divider { height: 1px; background: var(--line); margin: 12px 12px; }

.main { flex: 1; min-width: 0; padding: 26px 30px 70px; max-width: 1180px; }

.page-head { margin-bottom: 22px; }
.page-head .eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--brand-deep); font-weight: 700; margin-bottom: 5px;
}
.page-head h1 { margin: 0 0 6px; font-size: 25px; font-weight: 650; letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--ink-2); max-width: 76ch; font-size: 14.5px; }

/* ===== Thẻ ============================================================= */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-1);
}
.card > .hd {
  padding: 13px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.card > .hd h2 { margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.card > .hd .sub { font-size: 12.5px; color: var(--ink-3); }
.card > .hd .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card > .bd { padding: 18px; }
.card > .ft { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); font-size: 13px; color: var(--ink-2); }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g-side { grid-template-columns: 1.55fr 1fr; align-items: start; }
@media (max-width: 1080px) { .g4 { grid-template-columns: repeat(2,1fr); } .g3, .g-side, .g2 { grid-template-columns: 1fr; } }

/* ===== Nút ============================================================= */
.btn {
  appearance: none; font-family: inherit; font-size: 13.5px; font-weight: 550;
  padding: 8px 15px; border-radius: var(--r-s); cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; gap: 7px; transition: all .14s;
  box-shadow: var(--shadow-1); text-decoration: none;
}
.btn, .btn * { text-decoration: none; }
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.pri { background: var(--brand); border-color: var(--brand-deep); color: #fff; }
.btn.pri:hover { background: var(--brand-deep); }
.btn.lg { font-size: 15px; padding: 11px 22px; }
.btn.sm { font-size: 12.5px; padding: 5px 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }

/* ===== Nhãn ============================================================ */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2);
  white-space: nowrap;
}
.tag.good     { background:#e8f7e8; border-color:#a9e0a9; color:var(--good-ink); }
.tag.warning  { background:#fff5de; border-color:#f4d68a; color:#7a5600; }
.tag.serious  { background:#fdece4; border-color:#f5c0a6; color:#8f3d17; }
.tag.critical { background:#fbe9e9; border-color:#f0b3b3; color:#96201f; }
.tag.info     { background:var(--brand-100); border-color:#a9cdf6; color:var(--brand-dark); }
.tag.ai       { background:#ece9fb; border-color:#c3b9f0; color:#3a2d86; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.dot.good{background:var(--good)} .dot.warning{background:var(--warning)}
.dot.serious{background:var(--serious)} .dot.critical{background:var(--critical)}
.dot.info{background:var(--brand)}

/* ===== Ô thống kê ====================================================== */
.stat { padding: 15px 17px; }
.stat .k { font-size: 11.5px; color: var(--ink-3); font-weight: 600; letter-spacing: .02em; margin-bottom: 4px; }
.stat .v { font-size: 30px; font-weight: 640; letter-spacing: -.03em; line-height: 1.1; }
.stat .v small { font-size: 15px; font-weight: 550; color: var(--ink-2); letter-spacing: 0; }
.stat .d { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.stat .d.up { color: var(--good-ink); font-weight: 600; }

/* ===== Danh sách việc ================================================== */
.task {
  display: flex; gap: 12px; padding: 13px 16px;
  border-bottom: 1px solid var(--line); align-items: flex-start;
}
.task:last-child { border-bottom: 0; }
.task .ic {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.task.gap  .ic { background:#fbe9e9; border-color:#f0b3b3; color:#96201f; }
.task.canh .ic { background:#fff5de; border-color:#f4d68a; color:#7a5600; }
.task .tx { flex: 1; min-width: 0; }
.task .tx b { display: block; font-size: 13.8px; font-weight: 570; margin-bottom: 2px; }
.task .tx s { text-decoration: none; font-size: 12.3px; color: var(--ink-3); }
.task .hn { flex: none; text-align: right; font-size: 12px; color: var(--ink-2); padding-top: 3px; }
.task.gap .hn { color: var(--critical); font-weight: 650; }

/* ===== Đồng hồ so sánh ================================================= */
.timesave {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  background: var(--surface);
}
.timesave > div { padding: 13px 18px; flex: 1; }
.timesave .old { background: var(--surface-2); border-right: 1px solid var(--line); }
.timesave .new { background: #f2f9f2; }
.timesave .k { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 650; }
.timesave .v { font-size: 23px; font-weight: 640; letter-spacing: -.02em; margin-top: 2px; }
.timesave .new .v { color: var(--good-ink); }
.timesave .arrow { flex: none; display: grid; place-items: center; padding: 0 12px; background: var(--surface-2); border-right: 1px solid var(--line); color: var(--ink-3); font-size: 18px; }

/* ===== Tiến trình AI =================================================== */
.aiwork { padding: 4px 0; }
.aiwork .step {
  display: flex; gap: 10px; align-items: center; padding: 7px 0;
  font-size: 13.3px; color: var(--ink-3);
  opacity: 0; transform: translateY(4px);
  animation: stepIn .32s ease forwards;
}
@keyframes stepIn { to { opacity: 1; transform: none; } }
.aiwork .step .mk {
  width: 17px; height: 17px; border-radius: 50%; flex: none;
  border: 2px solid var(--line-2); display: grid; place-items: center;
  font-size: 10px; color: #fff;
}
.aiwork .step.run .mk { border-color: var(--brand); border-right-color: transparent; animation: spin .7s linear infinite; }
.aiwork .step.done { color: var(--ink-2); }
.aiwork .step.done .mk { background: var(--good); border-color: var(--good); }
.aiwork .step.done .mk::after { content: "✓"; font-weight: 700; }
@keyframes spin { to { transform: rotate(360deg); } }

.thinking { display: inline-flex; gap: 3px; align-items: center; }
.thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); animation: bounce 1s infinite; }
.thinking i:nth-child(2){ animation-delay:.15s } .thinking i:nth-child(3){ animation-delay:.3s }
@keyframes bounce { 0%,60%,100%{transform:translateY(0);opacity:.4} 30%{transform:translateY(-4px);opacity:1} }

.caret::after {
  content:""; display:inline-block; width:2px; height:1em; background: var(--brand);
  vertical-align:-2px; margin-left:2px; animation: blink .9s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ===== Khối trích dẫn ================================================== */
.quote {
  border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 0 var(--r-s) var(--r-s) 0; background: var(--surface-2);
  padding: 12px 15px; margin-bottom: 11px;
}
.quote .h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.quote .h b { font-size: 13px; font-weight: 650; }
.quote .h .so { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.quote .h .dieu { font-size: 12px; color: var(--brand-deep); font-weight: 600; }
.quote .txt { font-size: 13.3px; color: var(--ink-2); font-style: italic; }
.quote .gc { font-size: 12.2px; color: #7a5600; margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--line-2); }
.quote.het { border-left-color: var(--critical); }

.alert {
  border-radius: var(--r-s); padding: 11px 14px; font-size: 13.2px;
  display: flex; gap: 10px; align-items: flex-start; border: 1px solid;
}
.alert .i { flex: none; font-size: 14px; line-height: 1.4; }
.alert.critical { background:#fbe9e9; border-color:#f0b3b3; color:#7d1b1a; }
.alert.warning  { background:#fff5de; border-color:#f4d68a; color:#6b4b00; }
.alert.info     { background:var(--brand-100); border-color:#a9cdf6; color:#12406f; }
.alert.good     { background:#e8f7e8; border-color:#a9e0a9; color:#0a4a0a; }
.alert.ai       { background:#ece9fb; border-color:#c3b9f0; color:#332777; }

/* ===== Trang văn bản =================================================== */
.doc {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-s);
  padding: 34px 40px; font-size: 14px; line-height: 1.75; color: #111;
  box-shadow: var(--shadow-1); font-family: "Times New Roman", Times, serif;
}
.doc .ct { text-align: center; }
.doc .qh { font-weight: 700; text-transform: uppercase; font-size: 13px; }
.doc .u { display: inline-block; border-bottom: 1px solid #111; padding-bottom: 2px; }
.doc h3 { text-align: center; font-size: 16px; margin: 20px 0 4px; text-transform: uppercase; font-weight: 700; }
.doc .flex2 { display: flex; justify-content: space-between; gap: 30px; margin-bottom: 14px; }
.doc p { margin: 0 0 9px; text-align: justify; }
.doc .ind { text-indent: 28px; }
.mark-num { background: #fff3cd; border-bottom: 2px solid var(--warning); padding: 0 2px; border-radius: 2px; cursor: help; }
.mark-add { background: #ffe9e0; border-bottom: 2px solid var(--serious); padding: 0 2px; border-radius: 2px; }

.ai-stamp {
  display: flex; align-items: center; gap: 8px;
  background: repeating-linear-gradient(45deg, #f4f1fe, #f4f1fe 10px, #efebfd 10px, #efebfd 20px);
  border: 1px dashed #a99ce6; border-radius: var(--r-s);
  padding: 9px 14px; font-size: 12.5px; color: #3a2d86; font-weight: 600;
  margin-bottom: 12px;
}

/* ===== Bảng ============================================================ */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.3px; }
table.tbl th {
  text-align: left; font-weight: 650; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-3); padding: 9px 12px;
  border-bottom: 1px solid var(--line-2);
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--surface-2); }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ===== Thanh tiến độ =================================================== */
.bar { height: 9px; background: var(--line); border-radius: 4px; overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; border-radius: 4px; transition: width .8s cubic-bezier(.2,.7,.3,1); }
.bar > span + span { margin-left: 2px; }

/* ===== Ô nhập ========================================================== */
.ask {
  display: flex; gap: 10px; align-items: center;
  border: 1px solid var(--line-2); background: var(--surface);
  border-radius: var(--r); padding: 6px 6px 6px 15px; box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .15s;
}
.ask:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.ask input {
  flex: 1; border: 0; outline: 0; font-family: inherit; font-size: 14.5px;
  background: transparent; color: var(--ink); padding: 8px 0;
}
.ask input::placeholder { color: var(--ink-3); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: inherit; font-size: 12.8px; color: var(--ink-2); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 6px 13px; text-align: left; transition: all .14s;
}
.chip:hover { border-color: var(--brand); color: var(--brand-deep); background: var(--brand-100); }

/* ===== Tiện ích ======================================================== */
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.mono  { font-variant-numeric: tabular-nums; }
.row   { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mt8{margin-top:8px}.mt12{margin-top:12px}.mt16{margin-top:16px}.mt24{margin-top:24px}
.mb8{margin-bottom:8px}.mb12{margin-bottom:12px}.mb16{margin-bottom:16px}.mb24{margin-bottom:24px}
.hide { display: none !important; }
.fade-in { animation: fadeIn .35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }

/* ===== Trang chọn vị trí =============================================== */
.pick-hero {
  background: linear-gradient(165deg, #123f7d 0%, #0d366b 55%, #0a2c58 100%);
  color: #fff; padding: 52px 30px 62px; text-align: center; position: relative; overflow: hidden;
}
.pick-hero::after {
  content:""; position:absolute; inset:0;
  background: radial-gradient(900px 320px at 50% -10%, rgba(158,197,244,.22), transparent 70%);
}
.pick-hero > * { position: relative; }
.pick-hero .kicker {
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: #9ec5f4; font-weight: 650; margin-bottom: 14px;
}
.pick-hero h1 { margin: 0 0 12px; font-size: 40px; font-weight: 660; letter-spacing: -.035em; }
.pick-hero p { margin: 0 auto; max-width: 66ch; color: #cde2fb; font-size: 16px; }
.pick-hero .meta { margin-top: 22px; display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; font-size: 13px; color: #b7d3f6; }
.pick-hero .meta b { color: #fff; font-weight: 650; }

.pick-wrap { max-width: 1120px; margin: 0 auto; padding: 30px 24px 70px; }

.grp-head { display: flex; align-items: baseline; gap: 12px; margin: 30px 0 12px; }
.grp-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.015em; }
.grp-head span { font-size: 12.5px; color: var(--ink-3); }
.grp-head .ln { flex: 1; height: 1px; background: var(--line); }

.vtgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 11px; }
.vt {
  display: block; text-decoration: none; color: inherit; position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 13px 15px 13px 14px; transition: all .16s; box-shadow: var(--shadow-1);
}
.vt:hover { border-color: var(--brand); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.vt .mh { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.vt .ma {
  font-size: 11px; font-weight: 700; color: #fff; background: var(--brand-deep);
  border-radius: 5px; padding: 2px 7px; font-variant-numeric: tabular-nums; flex: none;
}
.vt.deep .ma { background: #3a2d86; }
.vt .full {
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
  background: #ece9fb; color: #3a2d86; border: 1px solid #c3b9f0;
  padding: 1px 7px; border-radius: 999px; margin-left: auto;
}
.vt .tn { font-size: 13.8px; font-weight: 570; line-height: 1.4; margin-bottom: 6px; }
.vt .ng { font-size: 11.8px; color: var(--ink-3); }
.vt .cb { font-size: 11.5px; color: #96201f; margin-top: 6px; }

.note-box {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 0 var(--r) var(--r) 0; padding: 15px 18px; font-size: 13.6px; color: var(--ink-2);
}
.note-box b { color: var(--ink); }

/* ===== Modal =========================================================== */
.modal-bg {
  position: fixed; inset: 0; background: rgba(11,11,11,.45); z-index: 100;
  display: grid; place-items: center; padding: 24px; animation: fadeIn .18s ease both;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-3);
  max-width: 560px; width: 100%; max-height: 86vh; overflow: auto;
}
.modal .hd { padding: 18px 22px 0; }
.modal .hd h3 { margin: 0 0 4px; font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.modal .bd { padding: 14px 22px 18px; }
.modal .ft { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 14px 14px; }

/* ===== Cuối trang ====================================================== */
.foot {
  border-top: 1px solid var(--line); margin-top: 40px; padding: 22px 0 0;
  font-size: 12.5px; color: var(--ink-3); display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
}
.foot a { color: var(--ink-2); }

@media print { .demo-bar, .side, .topbar { display: none; } }

/* ==========================================================================
   TRỢ LÝ AI NỔI — lớp AI, cố ý khác hẳn phần chrome hành chính bên dưới
   ========================================================================== */
:root {
  --ai-1: #6d5ce0;
  --ai-2: #2a78d6;
  --ai-ink: #2e2378;
  --ai-soft: #f4f2fe;
  --ai-line: #ddd6f7;
}

/* --- Nút nổi ------------------------------------------------------------ */
.ai-fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 90;
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(140deg, var(--ai-1) 0%, var(--ai-2) 100%);
  color: #fff; font-size: 23px; display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(64,45,160,.34), 0 2px 6px rgba(11,11,11,.12);
  transition: transform .18s cubic-bezier(.2,.8,.3,1.2), box-shadow .18s;
  font-family: var(--font);
}
.ai-fab:hover { transform: scale(1.07); box-shadow: 0 10px 26px rgba(64,45,160,.42); }
.ai-fab:active { transform: scale(.96); }
.ai-fab .sp { animation: spark 2.6s ease-in-out infinite; display: block; }
@keyframes spark {
  0%,100% { transform: rotate(0) scale(1); opacity: 1 }
  45%     { transform: rotate(-14deg) scale(1.13); opacity: .82 }
}
.ai-fab::before {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--ai-1); opacity: 0; animation: ring 2.8s ease-out infinite;
}
@keyframes ring {
  0%   { transform: scale(.86); opacity: .55 }
  70%  { transform: scale(1.35); opacity: 0 }
  100% { opacity: 0 }
}
.ai-fab .badge {
  position: absolute; top: -3px; right: -3px; min-width: 19px; height: 19px;
  border-radius: 999px; background: var(--critical); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--plane); padding: 0 4px;
}
.ai-fab.open .sp { transform: rotate(45deg); }
.ai-fab.open::before { display: none; }

/* --- Gợi ý chủ động ----------------------------------------------------- */
.ai-nudge {
  position: fixed; right: 96px; bottom: 34px; z-index: 89;
  max-width: 320px; background: #fff; border: 1px solid var(--ai-line);
  border-radius: 14px 14px 4px 14px; padding: 12px 14px 12px 13px;
  box-shadow: var(--shadow-3); font-size: 13.2px; color: var(--ink);
  animation: nudgeIn .42s cubic-bezier(.2,.8,.3,1.1) both;
  cursor: pointer;
}
@keyframes nudgeIn { from { opacity: 0; transform: translateY(10px) scale(.96) } }
.ai-nudge .t { display: flex; gap: 7px; align-items: center; font-size: 11px;
  font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ai-1); margin-bottom: 5px; }
.ai-nudge .x { position: absolute; top: 6px; right: 8px; border: 0; background: none;
  cursor: pointer; color: var(--ink-3); font-size: 15px; line-height: 1; padding: 2px 4px; }
.ai-nudge .go { color: var(--ai-2); font-weight: 600; margin-top: 6px; display: block; font-size: 12.6px; }

/* --- Bảng trò chuyện ---------------------------------------------------- */
.ai-panel {
  position: fixed; right: 26px; bottom: 96px; z-index: 91;
  width: 392px; max-width: calc(100vw - 32px);
  height: 624px; max-height: calc(100vh - 128px);
  background: var(--surface); border: 1px solid var(--ai-line);
  border-radius: 16px; box-shadow: 0 24px 64px rgba(30,20,80,.24), 0 4px 12px rgba(11,11,11,.10);
  display: flex; flex-direction: column; overflow: hidden;
  animation: panelIn .26s cubic-bezier(.2,.8,.3,1.05) both;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(14px) scale(.98) } }

.ai-hd {
  background: linear-gradient(135deg, var(--ai-1) 0%, var(--ai-2) 100%);
  color: #fff; padding: 12px 14px; flex: none;
}
.ai-hd .r1 { display: flex; align-items: center; gap: 9px; }
.ai-hd .av { width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.28);
  display: grid; place-items: center; font-size: 15px; }
.ai-hd b { font-size: 14px; font-weight: 640; letter-spacing: -.01em; display: block; }
.ai-hd i { font-style: normal; font-size: 11px; color: #d8d2fb; display: block; }
.ai-hd .cl { margin-left: auto; background: rgba(255,255,255,.14); border: 0; color: #fff;
  width: 26px; height: 26px; border-radius: 7px; cursor: pointer; font-size: 15px; line-height: 1; }
.ai-hd .cl:hover { background: rgba(255,255,255,.26); }
.ai-ctx {
  margin-top: 9px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px; padding: 6px 9px; font-size: 11.5px; color: #e7e3fd; line-height: 1.45;
}
.ai-ctx b { display: inline; font-size: 11.5px; color: #fff; }

.ai-body { flex: 1; overflow-y: auto; padding: 14px; background: var(--surface-2); position: relative; }
.ai-body::-webkit-scrollbar { width: 8px }
.ai-body::-webkit-scrollbar-thumb { background: #d9d8d1; border-radius: 4px }

.ai-msg { margin-bottom: 12px; animation: fadeIn .28s ease both; }
.ai-msg.me { display: flex; justify-content: flex-end; }
.ai-msg.me .bb {
  background: var(--brand); color: #fff; border-radius: 13px 13px 4px 13px;
  padding: 8px 12px; font-size: 13.3px; max-width: 86%; line-height: 1.5;
}
.ai-msg.ai .bb {
  background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--ai-1);
  border-radius: 4px 13px 13px 13px; padding: 10px 13px; font-size: 13.3px; line-height: 1.6;
  color: var(--ink); box-shadow: var(--shadow-1);
}
.ai-msg.ai .bb b { font-weight: 640 }
.ai-msg .who { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ai-1); margin-bottom: 4px; display: flex; align-items: center; gap: 5px; }

.ai-steps { font-size: 12px; color: var(--ink-3); margin: 6px 0 2px; }
.ai-steps div { padding: 2px 0; animation: fadeIn .2s ease both; }
.ai-steps .ok { color: var(--good-ink) }

.ai-src { margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line-2); }
.ai-src .lb { font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 5px; }
.ai-src a, .ai-src span.s {
  display: block; font-size: 11.8px; color: var(--brand-deep); text-decoration: none;
  padding: 3px 0; line-height: 1.4;
}
.ai-src span.s::before, .ai-src a::before { content: "⚖ "; color: var(--ink-3) }

.ai-act {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 9px;
  background: linear-gradient(135deg, var(--ai-1), var(--ai-2)); color: #fff;
  border: 0; border-radius: 8px; padding: 7px 13px; font-size: 12.6px; font-weight: 600;
  cursor: pointer; font-family: inherit; text-decoration: none;
}
.ai-act:hover { filter: brightness(1.08) }

.ai-tips { padding: 0 14px 12px; background: var(--surface-2); flex: none; }
.ai-tips .lb { font-size: 10.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 7px; }
.ai-tip {
  display: block; width: 100%; text-align: left; font-family: inherit;
  background: #fff; border: 1px solid var(--ai-line); border-radius: 9px;
  padding: 8px 11px; font-size: 12.6px; color: var(--ai-ink); cursor: pointer;
  margin-bottom: 6px; line-height: 1.45; transition: all .14s;
}
.ai-tip:hover { background: var(--ai-soft); border-color: var(--ai-1); transform: translateX(2px) }
.ai-tip::before { content: "✦ "; color: var(--ai-1); font-weight: 700 }

.ai-ft { flex: none; border-top: 1px solid var(--line); background: var(--surface); padding: 10px 12px; }
.ai-in { display: flex; gap: 8px; align-items: center;
  border: 1px solid var(--line-2); border-radius: 10px; padding: 4px 4px 4px 12px; }
.ai-in:focus-within { border-color: var(--ai-1); box-shadow: 0 0 0 3px var(--ai-soft) }
.ai-in input { flex: 1; border: 0; outline: 0; font-family: inherit; font-size: 13.2px;
  background: transparent; padding: 7px 0; color: var(--ink) }
.ai-in button { border: 0; background: linear-gradient(135deg, var(--ai-1), var(--ai-2));
  color: #fff; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 14px; flex: none }
.ai-note { font-size: 10.8px; color: var(--ink-3); margin-top: 7px; text-align: center; line-height: 1.4 }

@media (max-width: 560px) {
  .ai-panel { right: 12px; left: 12px; width: auto; bottom: 88px; }
  .ai-nudge { right: 12px; left: 12px; max-width: none; bottom: 92px; border-radius: 14px }
}
@media print { .ai-fab, .ai-panel, .ai-nudge { display: none !important } }
