/* History column (chosen: outlined cards). */
:root { --font-sans: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif; }
.hist-scope .hs-avatar { display: none; flex: none; }
.hs-text strong { display: none; }
.hs-text small { display: block; font-size: inherit; }
.hs-short { display: none !important; }

.hist-group + .hist-group { margin-top: 16px; }
.hist-group h3 { display: flex; align-items: center; gap: 8px; padding: 0 2px 8px; font-size: 13.5px; }
.hist-group h3::before { content: ''; flex: none; width: 5px; height: 15px; border-radius: 2px; background: var(--tdtu-red-500); }
.hist-group h3::after { content: ''; flex: 1; height: 1.5px; background: var(--tdtu-blue-200); }
.drawer [data-slot="history"] { margin-right: -12px; padding: 2px 14px 5px 2px; }
.hist-row + .hist-row { margin-top: 8px; }
.hist-item { padding: 9px 12px; border: 1.5px solid var(--tdtu-blue-200); background: var(--primary-soft); transition: transform var(--duration-fast), box-shadow var(--duration-fast), border-color var(--duration-fast); }
.hist-title { font-size: 14px; font-weight: 500; }
.hist-item:hover { border-color: var(--v-ink); background: var(--v-cream); box-shadow: 2px 2px 0 var(--v-ink) !important; transform: translate(-1px, -1px); }
.hist-item[aria-current], .hist-item[aria-current]:hover { border: 2px solid var(--v-ink); background: var(--v-yellow); box-shadow: 3px 3px 0 var(--primary) !important; transform: none; }

.hist-scope, .hist-account { display: flex; align-items: center; flex: none; gap: 10px; padding: 10px 4px 0; border-top: 1.5px solid var(--tdtu-blue-200); border-radius: 0; background: none; color: var(--text-2); font-size: 13px; line-height: 18px; }
.hist-scope .hs-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--tdtu-blue-100); color: var(--tdtu-blue-800); }
.hs-text { flex: 1; min-width: 0; }
.hs-text strong { display: block; font-size: 14px; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-long { display: none !important; }
.hs-text .hs-short { display: block !important; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-account .avatar { width: 36px; height: 36px; font-size: 13px; }
.hs-sub { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.out-btn { flex: none; padding: 6px 14px; border: 2px solid var(--v-ink); border-radius: var(--radius-md); background: var(--paper); color: var(--v-ink); font-size: 13.5px; font-weight: 700; white-space: nowrap; box-shadow: 2px 2px 0 var(--v-ink); transition: background var(--duration-fast); }
.out-btn:hover { background: var(--v-yellow); }

.hist-scope .link { padding: 6px 10px; border: 2px solid var(--v-ink); border-radius: var(--radius-md); background: var(--primary); color: var(--text-inverse); font-size: 13.5px; font-weight: 700; box-shadow: 2px 2px 0 var(--v-ink); transition: background var(--duration-fast), color var(--duration-fast); }
.hist-scope .link:hover { background: var(--v-yellow); color: var(--tdtu-blue-800); }
.foot-links { display: grid; flex: none; margin: 2px 3px 3px 0; padding: 5px; border: 2px solid var(--v-ink); border-radius: var(--radius-md); background: var(--paper); box-shadow: 3px 3px 0 var(--primary); overflow: hidden; }
.foot-links a, .foot-links button { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 7px; border-radius: var(--radius-sm); color: var(--v-ink); font-size: 13px; font-weight: 600; text-align: left; text-decoration: none; white-space: nowrap; transition: background var(--duration-fast); }
.foot-links a:hover, .foot-links button:hover { background: var(--v-yellow); }
.foot-links a:focus-visible, .foot-links button:focus-visible { outline-offset: -2px; }
.foot-links .ic { width: 15px; height: 15px; }

/* Scrollbar stays at the column edge and only shows while the list is hovered */
.drawer [data-slot="history"]::-webkit-scrollbar-thumb { background: transparent; }
.drawer [data-slot="history"]:hover::-webkit-scrollbar-thumb { background: var(--tdtu-blue-200) padding-box; }
.drawer [data-slot="history"]::-webkit-scrollbar-thumb:hover { background: var(--tdtu-blue-400) padding-box; }

/* Show / hide the history column on the chat screen */
.hist-top { display: flex; flex: none; gap: 6px; }
.hist-top .hist-search { flex: 1; min-width: 0; }
.top .side-toggle { display: grid; place-items: center; flex: none; width: 40px; height: 40px; margin-left: -8px; border-radius: var(--radius-md); color: var(--v-ink); transition: background var(--duration-fast); }
.top .side-toggle:hover { background: var(--v-yellow); }
.side-toggle .ic { width: 22px; height: 22px; }
[data-view="chat"] .top .side-toggle { display: grid; }
[data-view="chat"] { grid-template-columns: auto minmax(0, 1fr); }
[data-view="chat"] > aside.drawer { width: 296px; }
[data-side-ready][data-view="chat"] > aside.drawer { transition: margin-left var(--duration-slow) var(--ease-out), visibility var(--duration-slow); }
[data-view="chat"][data-side="closed"] > aside.drawer { margin-left: -296px; visibility: hidden; }

/* AI notice: a quiet caption with a badge instead of a tinted bar. Always visible. */
[data-slot="notice"] { --link-c: var(--v-ink); padding: 7px 24px; background: var(--paper); color: var(--gray-600); font-size: 12.5px; line-height: 19px; }
[data-slot="notice"] .notice-in > .ic { display: none; }
[data-slot="notice"] p::before { content: 'AI'; display: inline-block; margin-right: 8px; padding: 0 6px; border-radius: var(--radius-xs); background: var(--v-yellow); color: var(--tdtu-blue-800); font-size: 11px; line-height: 16px; font-weight: 800; letter-spacing: .03em; }
[data-slot="notice"] .link { margin-left: 2px; font-weight: 700; }
[data-slot="notice"] .link:hover { background: var(--v-yellow); }

/* Usage-rules dialog */
.rm-back { position: fixed; inset: 0; z-index: var(--z-toast); display: grid; place-items: center; padding: 24px; background: var(--overlay); }
.rm-back[hidden] { display: none; }
.rm { display: flex; flex-direction: column; width: min(1140px, 100%); max-height: 100%; border: 2px solid var(--v-ink); border-radius: var(--radius-lg); background: var(--paper); box-shadow: 6px 6px 0 var(--primary); overflow: hidden; }
.rm-head { display: flex; align-items: center; flex: none; gap: 16px; padding: 20px 18px 0 28px; }
.rm-head > div { flex: 1; min-width: 0; }
.rm-head h2 { font-family: var(--font-heading); font-size: 30px; line-height: 38px; font-weight: 800; letter-spacing: -.02em; color: var(--heading); }
.rm-head mark { padding: 0 .14em; border-radius: var(--radius-xs); background: var(--v-yellow); color: var(--tdtu-blue-800); white-space: nowrap; }
.rm-head p { margin-top: 6px; font-size: 14.5px; line-height: 22px; color: var(--text-2); }
.rm-x { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: var(--radius-md); color: var(--v-ink); transition: background var(--duration-fast); }
.rm-x:hover { background: var(--v-yellow); }
.rm-x .ic { width: 20px; height: 20px; }
.rm-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr) minmax(0, 1fr); align-items: stretch; gap: 16px; overflow-y: auto; padding: 14px 28px 8px; }
.rm-body:focus-visible { outline-offset: -3px; }
.rm-sec { padding: 16px; border: 2px solid var(--v-ink); border-radius: var(--radius-md); background: var(--paper); box-shadow: 3px 3px 0 var(--primary); }
.rm-warn { background: var(--v-cream); }
.rm-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.rm-n { display: grid; place-items: center; flex: none; width: 34px; height: 34px; margin: 0 2px 2px 0; box-sizing: border-box; border: 2px solid var(--v-ink); border-radius: var(--radius-sm); background: var(--tdtu-blue-600); color: var(--text-inverse); font-family: var(--font-heading); font-size: 15px; font-weight: 800; box-shadow: 2px 2px 0 var(--v-ink); }
.rm-sec:nth-child(even) .rm-n { background: var(--tdtu-red-600); }
.rm-sec h3 { font-family: var(--font-heading); font-size: 17px; line-height: 23px; font-weight: 700; color: var(--heading); }
.rm-sec ul { display: grid; gap: 14px; list-style: none; font-size: 14px; line-height: 22px; color: var(--gray-800); }
.rm-sec li { display: flex; align-items: flex-start; gap: 10px; }
.rm-sec li > div { flex: 1; min-width: 0; }
.rm-ic { display: grid; place-items: center; flex: none; width: 34px; height: 34px; margin: 1px 2px 2px 0; border: 2px solid var(--v-ink); border-radius: var(--radius-sm); background: var(--paper); color: var(--tdtu-blue-800); box-shadow: 2px 2px 0 var(--v-ink); }
.rm-ic .ic { width: 17px; height: 17px; }
.rm-warn ul { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.rm-sec strong { display: block; margin-bottom: 1px; font-family: var(--font-heading); font-size: 14px; line-height: 21px; font-weight: 700; color: var(--tdtu-blue-800); }
.rm-sec a { color: var(--primary); font-weight: 600; text-underline-offset: 2px; }
.rm-sec a:hover { background: var(--v-yellow); color: var(--tdtu-blue-800); }
.rm-foot { display: flex; justify-content: flex-end; flex: none; padding: 14px 28px 20px; }
.rm-ok { height: 42px; padding: 0 24px; border: 2px solid var(--v-ink); border-radius: var(--radius-md); background: var(--primary); color: var(--text-inverse); font-size: 15px; font-weight: 700; box-shadow: 2px 2px 0 var(--v-ink); transition: background var(--duration-fast), color var(--duration-fast); }
.rm-ok:hover { background: var(--v-yellow); color: var(--tdtu-blue-800); }

/* Header logo: transparent PNG, no white tile. */
.top .tile { background: transparent; }

/* Be Vietnam Pro runs wider than Roboto: keep the same line breaks */
.hist-scope, .hist-account { gap: 8px; }
.sug-q { font-size: 14.5px; }
.signin-text span { font-size: 13px; }

/* Tools: shown to signed-in users only, as on the real page */
.tools-box { display: grid; flex: none; gap: 8px; padding: 10px 12px 13px 10px; border-radius: var(--radius-lg); background: var(--tdtu-blue-100); }
.tools-title { display: flex; align-items: center; gap: 8px; padding: 0 2px 2px; font-family: var(--font-heading); font-size: 13.5px; line-height: 18px; font-weight: 700; color: var(--heading); }
.tools-title::before { content: ''; flex: none; width: 5px; height: 15px; border-radius: 2px; background: var(--tdtu-red-500); }
.tools-title::after { content: ''; flex: 1; height: 1.5px; background: var(--tdtu-blue-300); }
.tool { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 7px 12px; border: 2px solid var(--v-ink); border-radius: var(--radius-md); background: var(--paper); color: var(--v-ink); font-size: 14px; font-weight: 600; text-align: left; box-shadow: 2px 2px 0 var(--v-ink); transition: transform var(--duration-fast), box-shadow var(--duration-fast), background var(--duration-fast); }
.tool > span:first-of-type { flex: 1; min-width: 0; }
.tool:hover { background: var(--v-cream); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--v-ink); }
.tool .ic { width: 18px; height: 18px; }
.tool-badge { display: grid; place-items: center; flex: none; min-width: 22px; height: 22px; padding: 0 5px; box-sizing: border-box; border-radius: var(--radius-xs); background: var(--tdtu-red-600); color: var(--text-inverse); font-size: 12px; font-weight: 700; }

/* A narrower history column (under 1440px): the guest line drops its avatar so "Chưa đăng nhập" is read whole
   beside the sign-in button instead of "Chưa đăng n…". */
@media (max-width: 1439px) { .hist-scope .hs-avatar { display: none; } }
