/* Trang quản trị bot Muse. Token màu ở :root (sáng), tối nằm ở 2 khối: theo máy (prefers-color-scheme) và chọn tay (data-theme="dark"). */
:root {
  color-scheme: light;
  --bg: #FAF7F2;
  --card: #FFFDF9;
  --soft: #F7F2EA;
  --ink: #2B3A55;
  --ink2: #3D4A63;
  --mute: #5E6676;
  --accent: #3E6E71;
  --line: #E8E1D8;
  --line2: #EFE9E0;
  --line-strong: #CFC6B6;
  --lagoon: #609B9E;
  --lagoon-bg: #DCEAEA;
  --lagoon-fg: #2F5C5F;
  --sand: #D4C9AD;
  --red-fg: #8A3324;
  --red-bg: #FBEDE8;
  --red-line: #E4B9AC;
  --yel-fg: #7A5212;
  --yel-bg: #F6ECD9;
  --grn-fg: #2F6B4F;
  --grn-bg: #E3EFE7;
  --neutral-bg: #EFE9E0;
  --dot-xanh: #2F7A55;
  --dot-vang: #B07A1E;
  --dot-do: #B3402C;
  --btn-ink-bg: #2B3A55;
  --btn-ink-fg: #FAF7F2;
  --nav-on-bg: #2B3A55;
  --nav-on-fg: #FAF7F2;
  --banner-bg: #2B3A55;
  --banner-fg: #FAF7F2;
  --banner-btn-bg: #FAF7F2;
  --banner-btn-fg: #2B3A55;
  --banner-mute: #C2CAD8;
  --sw-off: #7A8291;
  --sw-on: #2F7A55;
  --sw-knob: #FFFDF9;
  --shadow: 0 8px 28px rgba(43,58,85,.18);
  --logo-sang: block;
  --logo-toi: none;
  --font: 'Google Sans Flex', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #141A26;
  --card: #1C2433;
  --soft: #242E41;
  --ink: #ECE6DC;
  --ink2: #CFCAC1;
  --mute: #A9B2C1;
  --accent: #82C0C3;
  --line: #2C3647;
  --line2: #283142;
  --line-strong: #4A5871;
  --lagoon: #6FB0B3;
  --lagoon-bg: #1E3B3F;
  --lagoon-fg: #A9D8DA;
  --sand: #D4C9AD;
  --red-fg: #F3A999;
  --red-bg: #3B2220;
  --red-line: #6E3A31;
  --yel-fg: #E8C47C;
  --yel-bg: #3A2F18;
  --grn-fg: #92D3B0;
  --grn-bg: #1D3529;
  --neutral-bg: #2B3548;
  --dot-xanh: #4FB387;
  --dot-vang: #D9A441;
  --dot-do: #E26B55;
  --btn-ink-bg: #ECE6DC;
  --btn-ink-fg: #141A26;
  --nav-on-bg: #ECE6DC;
  --nav-on-fg: #141A26;
  --banner-bg: #2B3A55;
  --banner-fg: #FAF7F2;
  --banner-btn-bg: #FAF7F2;
  --banner-btn-fg: #2B3A55;
  --banner-mute: #C2CAD8;
  --sw-off: #5A667C;
  --sw-on: #3E9A70;
  --sw-knob: #FFFDF9;
  --shadow: 0 8px 28px rgba(0,0,0,.5);
  --logo-sang: none;
  --logo-toi: block;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141A26;
  --card: #1C2433;
  --soft: #242E41;
  --ink: #ECE6DC;
  --ink2: #CFCAC1;
  --mute: #A9B2C1;
  --accent: #82C0C3;
  --line: #2C3647;
  --line2: #283142;
  --line-strong: #4A5871;
  --lagoon: #6FB0B3;
  --lagoon-bg: #1E3B3F;
  --lagoon-fg: #A9D8DA;
  --sand: #D4C9AD;
  --red-fg: #F3A999;
  --red-bg: #3B2220;
  --red-line: #6E3A31;
  --yel-fg: #E8C47C;
  --yel-bg: #3A2F18;
  --grn-fg: #92D3B0;
  --grn-bg: #1D3529;
  --neutral-bg: #2B3548;
  --dot-xanh: #4FB387;
  --dot-vang: #D9A441;
  --dot-do: #E26B55;
  --btn-ink-bg: #ECE6DC;
  --btn-ink-fg: #141A26;
  --nav-on-bg: #ECE6DC;
  --nav-on-fg: #141A26;
  --banner-bg: #2B3A55;
  --banner-fg: #FAF7F2;
  --banner-btn-bg: #FAF7F2;
  --banner-btn-fg: #2B3A55;
  --banner-mute: #C2CAD8;
  --sw-off: #5A667C;
  --sw-on: #3E9A70;
  --sw-knob: #FFFDF9;
  --shadow: 0 8px 28px rgba(0,0,0,.5);
  --logo-sang: none;
  --logo-toi: block;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; }
a { color: var(--accent); }
a:hover { color: var(--ink); }
button, input, select, textarea { font-family: var(--font); }
h1, h2, h3 { margin: 0; }
:focus-visible { outline: 3px solid var(--lagoon); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Bố cục chung */
.app { display: flex; min-height: 100vh; }
.side { flex: 0 0 248px; width: 248px; position: sticky; top: 0; height: 100vh; padding: 28px 16px 20px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.brand { padding: 4px 14px 20px; }
.brand img { width: 170px; height: auto; }
.brand .sub { font-size: 13px; color: var(--mute); margin-top: 8px; }
.logo-sang { display: var(--logo-sang); }
.logo-toi { display: var(--logo-toi); }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border-radius: 999px; text-decoration: none; color: var(--ink2); font-size: 15px; }
.nav a:hover { background: var(--neutral-bg); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--nav-on-bg); color: var(--nav-on-fg); }
.nguoi-dn { display: flex; flex-direction: column; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line2); overflow-wrap: anywhere; }
.nv-form { align-items: flex-end; }
.nv-form[hidden] { display: none; }
.side-foot { margin-top: auto; padding: 16px 6px 0; display: flex; flex-direction: column; gap: 8px; }
.main { flex: 1 1 auto; min-width: 0; padding: 32px clamp(16px, 4vw, 48px) 64px; }
.wrap { max-width: 1000px; display: flex; flex-direction: column; gap: 20px; }
.wrap.narrow { max-width: 820px; }
.mobile-top { display: none; }
.tabbar { display: none; }

/* Thành phần */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.card.col { display: flex; flex-direction: column; gap: 14px; }
.lab { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); font-weight: 600; }
.h1 { font-size: 32px; font-weight: 600; margin: 6px 0 0; }
.h2 { font-size: 20px; font-weight: 600; margin: 6px 0 0; }
.muted { color: var(--mute); }
.sec { color: var(--ink2); }
.small { font-size: 13px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.lead { margin: 8px 0 0; font-size: 15px; color: var(--ink2); max-width: 640px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line2); padding-top: 12px; }
.item { border-top: 1px solid var(--line2); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.inset { background: var(--soft); border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.inset .lab { display: block; margin-bottom: 4px; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.note { font-size: 14px; color: var(--mute); background: var(--soft); border-radius: 12px; padding: 12px 14px; }
.warn { font-size: 15px; background: var(--yel-bg); color: var(--yel-fg); border-radius: 12px; padding: 14px 16px; }
.empty { padding: 20px; text-align: center; color: var(--mute); font-size: 15px; border: 1px dashed var(--line-strong); border-radius: 14px; }
.err-card { border-color: var(--red-line); background: var(--red-bg); color: var(--red-fg); display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }

.pill { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 999px; font: 600 13px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; text-decoration: none; white-space: nowrap; }
.pill[disabled], .pill[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.p-ink { background: var(--btn-ink-bg); color: var(--btn-ink-fg); border: 1px solid var(--btn-ink-bg); }
.p-ink:hover { color: var(--btn-ink-fg); }
.p-line { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); }
.p-line:hover { color: var(--ink); background: var(--neutral-bg); }
.p-line[aria-pressed="true"] { border-color: var(--ink); border-width: 2px; }
.p-red { background: var(--red-bg); color: var(--red-fg); border: 1px solid var(--red-line); }
.p-red:hover { color: var(--red-fg); }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.xanh { background: var(--dot-xanh); }
.dot.vang { background: var(--dot-vang); }
.dot.do { background: var(--dot-do); }
.dot.big { width: 14px; height: 14px; margin-top: 8px; }
.tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--ink2); }
.t-lagoon { background: var(--lagoon-bg); color: var(--lagoon-fg); }
.t-red { background: var(--red-bg); color: var(--red-fg); }
.t-yel { background: var(--yel-bg); color: var(--yel-fg); }
.t-grn { background: var(--grn-bg); color: var(--grn-fg); }
.t-mute { background: var(--neutral-bg); color: var(--mute); }

.chip, .tab { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); cursor: pointer; white-space: nowrap; border-radius: 999px; }
.chip { min-height: 44px; padding: 0 14px; font: 500 14px var(--font); }
.tab { min-height: 44px; padding: 0 16px; font: 500 15px var(--font); }
.chip.on, .tab.on, .chip[aria-pressed="true"], .tab[aria-selected="true"] { background: var(--btn-ink-bg); color: var(--btn-ink-fg); border-color: var(--btn-ink-bg); }
.scroll-x { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.in, .field input, .field textarea, .field select, .in-select { font: 15px var(--font); border: 1px solid var(--line-strong); border-radius: 12px; background: var(--card); color: var(--ink); padding: 10px 12px; min-height: 44px; }
.field textarea { resize: vertical; }
.in-select { padding: 0 10px; }
input[type=time], input[type=number] { min-height: 44px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--card); color: var(--ink); padding: 0 10px; font: 15px var(--font); }
input[type=time] { color-scheme: inherit; }

.sw { position: relative; width: 48px; height: 28px; border-radius: 999px; border: none; cursor: pointer; flex: none; background: var(--sw-off); padding: 0; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--sw-knob); transition: transform .15s; }
.sw[aria-checked="true"] { background: var(--sw-on); }
.sw[aria-checked="true"]::after { transform: translateX(20px); }
.sw-wrap { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }

.seg { display: flex; flex-wrap: wrap; }
.seg button { min-height: 44px; padding: 0 16px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); font: 500 15px var(--font); cursor: pointer; margin-left: -1px; }
.seg button:first-child { border-radius: 999px 0 0 999px; margin-left: 0; }
.seg button:last-child { border-radius: 0 999px 999px 0; }
.seg button[aria-checked="true"] { background: var(--btn-ink-bg); color: var(--btn-ink-fg); border-color: var(--btn-ink-bg); }
.seg button[disabled] { color: var(--mute); cursor: not-allowed; background: var(--soft); }

/* Bảng */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 15px; }
th { text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line2); vertical-align: top; }

/* Hôm nay */
.status { display: flex; flex-direction: column; gap: 16px; }
.status-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: flex-start; }
.status-l { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.status-t { font-size: 20px; font-weight: 600; }
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.h-tile { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--soft); }
.h-tile .dot { margin-top: 5px; }
.summary { font-size: 17px; line-height: 1.6; padding: 4px; margin: 0; }
.job { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }
.job.card { padding: 20px; }

/* Hội thoại */
.hoi { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 18px; align-items: start; }
.dslist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dsitem { display: block; text-decoration: none; padding: 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); color: var(--ink); min-height: 44px; }
.dsitem[aria-current="true"] { border: 2px solid var(--ink); padding: 13px; }
.dsitem:hover { color: var(--ink); }
.dsitem .top { display: flex; justify-content: space-between; gap: 8px; }
.dsitem .tin { font-size: 14px; color: var(--ink2); margin-top: 4px; overflow-wrap: anywhere; }
.dsitem .tt { font-size: 12px; font-weight: 600; color: var(--mute); margin-top: 6px; }
.detail { display: flex; flex-direction: column; min-width: 0; }
.msgs { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1 1 auto; min-height: 0; padding-right: 4px; overscroll-behavior: contain; }
.msgs-box { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.ct-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.ct-ten { font-size: 18px; }
.moi-nut { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); box-shadow: var(--shadow); }
.moi-cham { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--dot-do); margin-right: 7px; vertical-align: middle; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.thumbs img, .nhap-anh { display: block; max-width: 160px; max-height: 160px; width: auto; height: auto; border-radius: 10px; border: 1px solid var(--line); }
.b-k, .b-nv { max-width: 80%; border-radius: 16px 16px 16px 4px; padding: 10px 14px; font-size: 15px; overflow-wrap: anywhere; white-space: pre-wrap; }
.b-moc { align-self: center; text-align: center; font-size: 13px; color: var(--mute); padding: 4px 12px; border-top: 1px dashed currentColor; border-bottom: 1px dashed currentColor; }
.b-k { align-self: flex-start; background: var(--neutral-bg); }
.b-nv { align-self: flex-end; background: var(--lagoon-bg); color: var(--lagoon-fg); border-radius: 16px 16px 4px 16px; }
.when { font-size: 12px; color: var(--mute); text-align: center; }
.nhap { border: 1.5px dashed var(--lagoon); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--card); }
.nhap .txt { font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.nhap .meta { font-size: 13px; color: var(--mute); }
details.vs { border-top: 1px solid var(--line2); padding-top: 10px; }
details.vs summary { cursor: pointer; font-weight: 600; font-size: 14px; min-height: 44px; display: flex; align-items: center; }
details.vs ul { margin: 4px 0 0; padding-left: 18px; font-size: 14px; color: var(--ink2); line-height: 1.7; }
.rate { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line2); padding-top: 12px; }
.back-link { display: none; }

/* Đào tạo */
.banner { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; background: var(--banner-bg); color: var(--banner-fg); border-radius: 16px; padding: 16px 20px; }
.banner .pill.b-run { background: var(--banner-btn-bg); color: var(--banner-btn-fg); border: none; }
.banner .pill.b-apply { background: transparent; color: var(--banner-fg); border: 1px solid var(--banner-mute); }
.banner .pill.b-apply:not([disabled]) { background: var(--banner-fg); color: var(--banner-bg); border-color: var(--banner-fg); }
.banner .pill[disabled] { opacity: .55; cursor: not-allowed; }
.banner .sub { color: var(--banner-mute); font-size: 14px; margin-top: 4px; }
.progress { background: var(--banner-bg); color: var(--banner-fg); border-radius: 16px; padding: 14px 20px; display: flex; flex-direction: column; gap: 8px; }
.bar { height: 10px; border-radius: 999px; background: rgba(250,247,242,.22); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--banner-btn-bg); width: 0; transition: width .15s; }
.locked { background: var(--soft); border-radius: 12px; padding: 16px; }
.locked ul { margin: 8px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.8; color: var(--ink2); }
.ci { display: flex; gap: 14px; align-items: flex-start; border-top: 1px solid var(--line2); padding-top: 12px; }
.ci .body { flex: 1; min-width: 0; }
.ci .nd { font-size: 15px; overflow-wrap: anywhere; }
.thu { width: 32px; height: 32px; border-radius: 50%; background: var(--neutral-bg); display: flex; align-items: center; justify-content: center; font-weight: 600; flex: none; }
.cho { color: var(--yel-fg); font-size: 12px; font-weight: 600; }
.twocol { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.twocol > .card { flex: 1 1 320px; min-width: 0; }
.thu-msg { display: flex; flex-direction: column; gap: 10px; }
.thu-bot { align-self: flex-end; max-width: 88%; border: 1.5px dashed var(--lagoon); border-radius: 16px 16px 4px 16px; padding: 10px 14px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chk { display: flex; gap: 10px; align-items: center; font-size: 14px; min-height: 44px; }
.chk input { width: 22px; height: 22px; }

/* Thiết kế */
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; align-items: start; }
.kcol { min-width: 0; display: flex; flex-direction: column; gap: 12px; background: var(--soft); border-radius: 16px; padding: 14px; }
.kcol h2 { font-size: 16px; }
.tk { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.tk .prev { height: 110px; border-radius: 10px; background: var(--neutral-bg); display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--mute); text-align: center; padding: 0 10px; }
.tk .line { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* Hộp thoại + toast */
dialog.hop { border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--ink); padding: 24px; max-width: min(480px, calc(100vw - 32px)); width: 100%; box-shadow: var(--shadow); }
dialog.hop::backdrop { background: rgba(10,14,22,.55); }
dialog.hop h2 { font-size: 20px; margin-bottom: 8px; }
dialog.hop p { margin: 0 0 14px; font-size: 15px; color: var(--ink2); }
dialog.hop .acts { justify-content: flex-end; margin-top: 16px; }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; width: calc(100% - 32px); max-width: 460px; pointer-events: none; }
.toast { background: var(--btn-ink-bg); color: var(--btn-ink-fg); border-radius: 14px; padding: 12px 16px; font-size: 15px; box-shadow: var(--shadow); pointer-events: auto; }
.toast.loi { background: var(--red-bg); color: var(--red-fg); border: 1px solid var(--red-line); }
.saved { font-size: 13px; color: var(--grn-fg); font-weight: 600; }
.loading { color: var(--mute); padding: 40px 0; }

/* Đăng nhập */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login .card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.login img { width: 180px; height: auto; }
.script { font-family: 'Pinyon Script', cursive; font-size: 26px; color: var(--accent); }

@media (max-width: 768px) {
  .side { display: none; }
  .mobile-top { display: flex; justify-content: space-between; align-items: center; padding: 0 0 14px; }
  .mobile-top img { width: 120px; height: auto; }
  .main { padding: 20px 16px 100px; }
  .h1 { font-size: 26px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 56px; font-size: 12px; text-decoration: none; color: var(--mute); text-align: center; padding: 0 2px; }
  .tabbar a[aria-current="page"] { color: var(--ink); font-weight: 700; box-shadow: inset 0 3px 0 var(--ink); }
  .hoi { grid-template-columns: minmax(0, 1fr); }
  .hoi.has-detail .dslist { display: none; }
  .hoi:not(.has-detail) .detail { display: none; }
  .back-link { display: inline-flex; }
  .b-k, .b-nv { max-width: 92%; }
  #toasts { bottom: 80px; }
  .card { padding: 16px; }
}
@media print { .side, .tabbar { display: none; } }

a.chip, a.tab { text-decoration: none; }
.chip:hover, .tab:hover { color: var(--ink); }
.chip.on:hover, .tab.on:hover, .chip[aria-pressed="true"]:hover, .tab[aria-selected="true"]:hover { color: var(--btn-ink-fg); }
.side .seg button { padding: 0 10px; font-size: 14px; }
.side-foot .pill { width: 100%; }

/* Ảnh bot gửi (Đào tạo bot > Kiến thức): màu lấy từ biến nên chế độ tối tự theo */
.anh-host { display: flex; flex-direction: column; gap: 14px; }
.anh-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.anh-the { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.anh-cac-o { display: flex; flex-wrap: wrap; gap: 12px; }
.anh-o { flex: 1 1 120px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.anh-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--soft); display: block; }
.anh-trong { width: 100%; aspect-ratio: 1 / 1; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--soft); color: var(--mute); display: flex; align-items: center; justify-content: center; font-size: 14px; text-align: center; padding: 8px; box-sizing: border-box; }
.anh-o .acts .pill { min-height: 40px; padding: 0 14px; font-size: 14px; }
.anh-file { display: none; }
/* Hội thoại: khung chat cuộn riêng, mở ở tin mới nhất. Máy tính: cả trang khoá đúng chiều cao màn hình, chỉ danh sách khách và khung chat cuộn. */
.hoi-wrap { max-width: 1240px; }
@media (min-width: 769px) {
  body.khoa-hoi .app { height: 100vh; overflow: hidden; }
  body.khoa-hoi .main { display: flex; flex-direction: column; overflow: hidden; padding-top: 24px; padding-bottom: 20px; }
  body.khoa-hoi .hoi-wrap { flex: 1 1 auto; min-height: 0; width: 100%; gap: 14px; }
  body.khoa-hoi .hoi-wrap .h1 { font-size: 26px; margin-top: 2px; }
  body.khoa-hoi .hoi-wrap .lead { display: none; }
  body.khoa-hoi .hoi { flex: 1 1 auto; min-height: 0; align-items: stretch; grid-template-rows: minmax(0, 1fr); }
  body.khoa-hoi .dslist { overflow-y: auto; min-height: 0; padding-right: 4px; }
  body.khoa-hoi .detail { min-height: 0; overflow: hidden; }
  .tk-chips { display: none; }
}
/* Điện thoại: màn chi tiết riêng, khung chat chiếm màn hình, thanh Quay lại + tên khách dính trên đầu */
@media (max-width: 768px) {
  body.khoa-hoi.hoi-co-ct .app { height: calc(100vh - 56px - env(safe-area-inset-bottom, 0px)); height: calc(100dvh - 56px - env(safe-area-inset-bottom, 0px)); overflow: hidden; }
  body.khoa-hoi.hoi-co-ct .main { display: flex; flex-direction: column; padding: 0; height: 100%; overflow: hidden; }
  body.khoa-hoi.hoi-co-ct .hoi-wrap { flex: 1 1 auto; min-height: 0; gap: 0; max-width: none; }
  body.khoa-hoi.hoi-co-ct .hoi-wrap > .mobile-top, body.khoa-hoi.hoi-co-ct .hoi-wrap > .page-head, body.khoa-hoi.hoi-co-ct .hoi-wrap > .scroll-x { display: none; }
  body.khoa-hoi.hoi-co-ct .hoi { flex: 1 1 auto; min-height: 0; grid-template-rows: minmax(0, 1fr); }
  body.khoa-hoi.hoi-co-ct .detail { border: 0; border-radius: 0; padding: 0; min-height: 0; overflow: hidden; }
  body.khoa-hoi.hoi-co-ct .ct-head { padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--card); }
  body.khoa-hoi.hoi-co-ct .msgs { padding: 12px; }
  .kcol.an-mb { display: none; }
}

/* Thiết kế: thư viện */
.tk-anh { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--neutral-bg); cursor: zoom-in; overflow: hidden; }
.tk-anh img { display: block; width: 100%; max-height: 170px; object-fit: contain; }
.tk-anh.prev { height: auto; padding: 0; }
.tk-ban-dai { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.tk-ban { flex: 0 0 150px; display: flex; flex-direction: column; gap: 6px; }
.tk-ban .tk-anh img { max-height: 110px; }
dialog.xem-anh { max-width: min(760px, calc(100vw - 24px)); }
.xem-anh-img { display: block; width: 100%; height: auto; max-height: 75vh; object-fit: contain; background: var(--neutral-bg); border-radius: 10px; }

/* Kết nối & API key (Cài đặt) */
input.khoa-in { min-height: 44px; min-width: 220px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--card); color: var(--ink); padding: 0 10px; font: 15px var(--font); }
.khoa-form { justify-content: flex-end; }
.khoa-canh-bao { border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px; font-size: 14px; }

/* Thiết kế theo khách (1011tk): hàng chờ xưởng + danh sách khách + timeline */
.tk2-wrap { max-width: 1240px; display: flex; flex-direction: column; gap: 18px; }
.tk2-queue { display: flex; flex-direction: column; gap: 12px; }
.tk2-q-dau { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.tk2-q-dau h2 { font-size: 18px; margin: 0; }
.tk2-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.tk2-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 12px; align-items: center; border-top: 1px solid var(--line2); padding-top: 10px; }
.tk2-row .tk-anh.nho { width: 76px; height: 56px; }
.tk2-row .tk-anh.nho img { height: 56px; max-height: 56px; }
.tk2-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
.tk2-ten { font-weight: 700; color: var(--ink); }
.tk2-main { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.tk2-left { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tk2-list { max-height: 70vh; overflow-y: auto; padding-right: 4px; }
.tk2-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tk2-quay { display: none; align-self: flex-start; }
.tk2-phiens { display: flex; flex-direction: column; gap: 22px; }
.tk2-phien { display: flex; flex-direction: column; gap: 12px; border-top: 2px solid var(--line); padding-top: 16px; }
.tk2-phien:first-child { border-top: 0; padding-top: 0; }
.tk2-ph-dau { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tk2-tl { display: flex; flex-direction: column; gap: 14px; border-left: 2px solid var(--line-strong); margin-left: 6px; padding-left: 16px; }
.tk2-ev { position: relative; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.tk2-ev::before { content: ""; position: absolute; left: -23px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--lagoon); }
.tk2-gopy::before { background: var(--dot-vang); }
.tk2-chot::before { background: var(--dot-xanh); }
.tk2-ev .tk-anh.lon { max-width: 480px; }
.tk2-ev .tk-anh.lon img { max-height: 300px; }
@media (max-width: 768px) {
  .tk2-main { grid-template-columns: minmax(0, 1fr); }
  .tk2-list { max-height: none; overflow: visible; }
  .tk2-row { grid-template-columns: 64px minmax(0, 1fr); }
  .tk2-row .acts { grid-column: 1 / -1; }
  .tk2-row .tk-anh.nho { width: 64px; }
  .tk2-co-ct .tk2-left, .tk2-co-ct .tk2-queue, .tk2-co-ct > .page-head { display: none; }
  .tk2-co-ct .tk2-quay { display: inline-flex; }
  .tk2-trong { display: none; }
}

/* Đào tạo: quy tắc, thay đổi chờ, so sánh chữ, lời dặn thật, lịch sử */
.pill.mini { min-height: 40px; padding: 0 14px; font-size: 12px; }
.cho-ds summary { cursor: pointer; font-weight: 600; font-size: 15px; min-height: 32px; display: flex; align-items: center; }
.cho-ds[open] summary { margin-bottom: 8px; }
.cho-muc { border-top: 1px solid var(--line2); padding: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.cho-dong { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cho-t { flex: 1 1 240px; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.cho-xem { background: var(--soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.qt-nd { font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.df-x { background: var(--red-bg); color: var(--red-fg); text-decoration: line-through; border-radius: 4px; padding: 0 2px; }
.df-t { background: var(--grn-bg); color: var(--grn-fg); text-decoration: none; border-radius: 4px; padding: 0 2px; }
.qt-muc .qt-dau { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.qt-h { font-size: 18px; margin: 0; }
.qt-nhom { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.qt { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--card); }
.qt[hidden], .qt-nhom[hidden] { display: none; }
.qt-top { display: flex; gap: 12px; align-items: flex-start; }
.qt-top .body { flex: 1; min-width: 0; }
.qt-tat .qt-nd { opacity: .55; }
.qt-xoa { background: var(--red-bg); border-color: var(--red-line); }
.qt-xoa .qt-nd { text-decoration: line-through; opacity: .7; }
.qt-moi { border-color: var(--grn-fg); border-style: dashed; }
.qt-act { justify-content: flex-end; }
.qt.flash { box-shadow: 0 0 0 3px var(--lagoon); }
.qt-form { border: 1px dashed var(--line-strong); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--soft); }
.qt-form [hidden], .field[hidden] { display: none; }
.bien { display: inline; background: var(--neutral-bg); border-radius: 6px; padding: 1px 6px; font-size: 14px; cursor: help; }
.bien-ten { font-size: 11px; letter-spacing: .04em; color: var(--mute); }
.bien-la { background: var(--red-bg); color: var(--red-fg); }
.bien-ds { margin: 6px 0 0; padding-left: 18px; line-height: 1.7; }
.dem-sai { color: var(--red-fg); font-weight: 600; }
dialog.xem-prompt { max-width: min(860px, calc(100vw - 24px)); }
.pr-ds { max-height: 52vh; overflow: auto; display: flex; flex-direction: column; gap: 4px; margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--soft); }
.pr-doan { border-left: 4px solid var(--grn-fg); padding: 2px 0 2px 10px; }
.pr-doan.pr-code { border-left-color: var(--mute); }
.pr-doan.pr-bai_hoc { border-left-color: var(--yel-fg); }
.pr-nhan { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); font-weight: 600; }
.pr-doan pre { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.5 var(--font); color: var(--ink); }
.pr-doan mark { background: var(--yel-bg); color: var(--yel-fg); border-radius: 3px; }
.ls .acts { align-items: center; }
@media (max-width: 640px) {
  .qt-top { flex-direction: row; }
  .qt-act .pill { flex: 1 1 auto; }
}

/* ---- Quy tắc thiết kế (tab Thiết kế, 11/10) ---- */
.tk-qt { padding: 4px 16px; margin-bottom: 14px; }
.tk-qt-sum { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.tk-qt-noi { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 14px; }
.tk-qt-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin-top: 6px; }
.tk-qt-o { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--card); cursor: pointer; }
.tk-qt-o > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tk-qt-mau { font-size: 20px; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
.tk-qt-hoa { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.tk-qt-h { flex-direction: column; align-items: center; text-align: center; }
.tk-qt-h img { width: 100%; height: 72px; object-fit: contain; }
.tk-qt-mau-ds { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.tk-qt-dong { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tk-qt-dong strong { min-width: 96px; }
.tk-qt-sw { display: inline-flex; align-items: center; gap: 6px; }
.tk-qt-sw input[type=color] { width: 36px; height: 32px; padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card); }
.tk-qt-khoa { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 4px 14px; margin: 6px 0 0; font-size: 14px; }
.tk-qt-khoa dt { font-weight: 600; color: var(--ink2); }
.tk-qt-khoa dd { margin: 0; color: var(--ink2); overflow-wrap: anywhere; }
@media (max-width: 640px) { .tk-qt-khoa { grid-template-columns: 1fr; } .tk-qt-khoa dd { margin-bottom: 6px; } }

/* Hội thoại: nút "Để bot trả lời ngay" + bản xem trước */
.bot-bam { margin: 8px 0; max-height: 45vh; overflow-y: auto; border: 1.5px solid var(--lagoon); border-radius: 14px; padding: 12px; background: var(--card); display: flex; flex-direction: column; gap: 10px; }
.bot-bam .bot-xem { display: flex; flex-direction: column; gap: 10px; }
.bot-bam .bot-xem-txt { font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.bot-bam .bot-loi { background: var(--red-bg); color: var(--red-fg); }
@media (max-width: 768px) {
  body.khoa-hoi.hoi-co-ct .ct-head .bot-nut { min-height: 36px; padding: 0 12px; }
  body.khoa-hoi.hoi-co-ct .bot-bam { margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
}

/* Đào tạo > Ảnh: thư viện ảnh của shop (ảnh tự do) */
.tv-anh .tv-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.tv-the { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; min-width: 0; }
.tv-the.tv-tat { opacity: .75; }
.tv-the.tv-sua { grid-column: 1 / -1; border: 1.5px solid var(--lagoon); }
.tv-img { width: 120px; height: 120px; flex: none; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--soft); align-self: flex-start; }
.tv-mo-ta { font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.tv-form { display: flex; gap: 14px; width: 100%; min-width: 0; }
.tv-form .tv-img { width: 160px; height: 160px; }
.tv-form textarea { width: 100%; box-sizing: border-box; }
@media (max-width: 600px) {
  .tv-anh .tv-luoi { grid-template-columns: 1fr; }
  .tv-form { flex-direction: column; }
  .tv-form .tv-img { width: 100%; height: auto; max-height: 240px; }
}
