/* Phần bổ sung của POC trên nền CSS của mockup (app.css, expo.css). */
.fx-brow { grid-template-columns: minmax(0, 11em) minmax(0, 1fr) auto; }
.narr p .typing { vertical-align: middle; }
.m-a .tools { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.m-a .b.err { border-color: #f3c4bf; background: var(--bad-soft); color: var(--bad); }
.logdlg { border: 0; border-radius: 16px; padding: 20px 22px; width: min(720px, 92vw); max-height: 80vh; color: var(--ink); box-shadow: 0 24px 60px rgba(20,40,35,.3); }
.logdlg::backdrop { background: rgba(20,30,45,.45); }
.home-asks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.home-asks .slot { grid-template-columns: 26px minmax(0, 1fr); align-items: center; column-gap: 10px; font-size: 14.5px; }
.home-asks .slot svg { width: 20px; height: 20px; color: var(--wakatake); }
.note-t { font-size: 14px; line-height: 1.75; white-space: pre-wrap; }
/* Màn hình thông thường */
.page-h { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { padding: 14px 16px; display: grid; gap: 4px; align-content: start; text-decoration: none; color: inherit; }
.tile .lbl { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.tile .lbl svg { width: 15px; height: 15px; }
.tile .val { font-size: 26px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 12px; color: var(--ink-3); }
a.tile:hover { border-color: var(--ai-iro); }
.pgrid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.pgrid > .p12 { grid-column: span 12; } .pgrid > .p7 { grid-column: span 7; } .pgrid > .p6 { grid-column: span 6; } .pgrid > .p5 { grid-column: span 5; }
@media (max-width: 1100px) { .pgrid > * { grid-column: span 12 !important; } }
.panel-b { padding: 14px 16px; display: grid; gap: 10px; }
.viz { width: 100%; height: auto; display: block; overflow: visible; }
.viz text { font-family: inherit; fill: var(--ink-3); font-size: 11px; }

/* Các thành phần mockup chỉ khai báo trong ai.html; màn hình thông thường cũng dùng nên khai báo lại ở đây. */
.decision { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid #edf0ef; }
.decision:first-child { border-top: 0; padding-top: 0; }
.decision:last-child { padding-bottom: 0; }
.decision .acts { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.done-row { opacity: .75; }
@media (max-width: 640px) { .decision { grid-template-columns: minmax(0, 1fr); } }
.panel-b > .fx-row:first-child { border-top: 0; padding-top: 0; }
.panel-b > .scroll-x { margin: -2px -4px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
table.grid-t td { white-space: normal; }
/* Bảng nhiều cột: ở màn hình hẹp thì cuộn ngang thay vì ép chữ xuống dòng từng ký tự */
@media (max-width: 900px) { .panel-b .scroll-x table.grid-t { min-width: 760px; } .w .scroll-x table.grid-t { min-width: 520px; } }
/* Bản điện thoại */
.phone .mbtn.ai { text-align: left; justify-content: flex-start; height: auto; }
.phone .rc-b .acts .mbtn.ai { width: 100%; border-radius: 12px; }
.phone .rr .chip { margin-bottom: 3px; }
.phone .rc-b .scroll-x table.grid-t, .phone .sh-body .scroll-x table.grid-t { min-width: 520px; font-size: 12.5px; }
.phone .fx-brow { grid-template-columns: minmax(0, 8em) minmax(0, 1fr) auto; font-size: 12.5px; }
.phone .rk-i b { font-size: 18px; }
.phone .rc-b > .acts { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
.phone .rr > div > span.chip { display: inline-flex; margin-top: 0; font-size: 11.5px; color: var(--wakatake); }
.phone .rr .acts { flex-wrap: nowrap; }

/* Trợ lý AI nổi trên màn hình thông thường */
.ai-poc { right: 20px; bottom: 20px; width: min(460px, calc(100vw - 24px)); height: min(680px, calc(100dvh - 40px)); }
.ai-poc.max { left: 5vw !important; right: 5vw !important; top: 4vh !important; bottom: 4vh !important; width: auto; height: auto; }
.ai-poc .ai-head { cursor: grab; touch-action: none; }
.ai-poc .ai-card { display: grid; gap: 10px; }
.ai-poc .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; }
.ai-poc .kpi { border-radius: 10px; background: #f6f8f7; padding: 9px 11px; display: grid; gap: 1px; }
.ai-poc .kpi .v { font-size: 19px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ai-poc .kpi .l { font-size: 11.5px; color: var(--ink-3); }
.ai-poc:not(.max) .decision { grid-template-columns: minmax(0, 1fr); }
.ai-poc .fx-brow { grid-template-columns: minmax(0, 8em) minmax(0, 1fr) auto; font-size: 12.5px; }
.ai-poc .scroll-x table.grid-t { min-width: 480px; font-size: 12.5px; }
.ai-poc.max .ai-log { padding: 16px max(16px, calc(50% - 480px)); }
@media (max-width: 720px) { .ai-poc { left: 0; right: 0; bottom: 0; width: auto; height: 88dvh; border-radius: 18px 18px 0 0; } }

/* Ô số liệu kiểu dashboard của mockup + thanh tiến độ */
.kstrip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kstrip > .tile { border-left: 1px solid var(--line); border-top: 1px solid var(--line); margin: -1px 0 0 -1px; }
.kstrip { overflow: hidden; }
.tile .viz { max-width: 130px; height: 26px; }
.tile .seg3 { display: flex; gap: 2px; height: 8px; margin-top: 4px; }
.tile .seg3 span { border-radius: 2px; }
.prog { display: block; height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; min-width: 60px; }
.prog > span { display: block; height: 100%; border-radius: 3px; }
.lt-row { display: grid; grid-template-columns: minmax(0, 10.5em) minmax(0, 1fr) 4.2em; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.lt-tr { position: relative; height: 14px; background: #f1f4f3; border-radius: 4px; }
.lt-tr > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.lt-tr > i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.pgrid > .p4 { grid-column: span 4; } .pgrid > .p8 { grid-column: span 8; }
.dl-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid #edf0ef; font-size: 13.5px; }
.dl-row:first-child { border-top: 0; padding-top: 0; }
.dl-row .d { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ai-iro); }
.dl-row small { display: block; font-size: 12px; color: var(--ink-3); }

/* Trang đăng nhập */
.login-wrap { min-height: 100dvh; display: grid; grid-template-columns: minmax(320px, 5fr) 7fr; background: var(--surface); }
.login-side { background: var(--ai-iro); color: #fff; padding: 36px 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; }
.login-main { padding: 20px 24px 32px; display: grid; grid-template-rows: auto 1fr auto; }
.login-form { align-self: center; justify-self: center; width: min(360px, 100%); display: grid; gap: 14px; }
.login-form .field input { padding: 10px 12px; font-size: 15px; }
.login-form .field input:focus-visible { outline: 2px solid var(--ai-iro); outline-offset: 1px; }
.login-err { font-size: 13px; color: var(--bad); background: var(--bad-soft); border-radius: 8px; padding: 8px 10px; }
@media (max-width: 760px) { .login-wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; } .login-side { padding: 22px 20px; gap: 16px; } .login-side .font-display { font-size: 20px; } }
.logout-btn { flex: none; }
.ph-head .logout-btn { border: 0; background: transparent; padding: 4px !important; }
@media (min-width: 961px) { .ph-head .logout-btn { display: none; } }
