/* Khu nội bộ AI · giao diện theo bố cục Navigator.01, màu Mitsubishi Electric (Figma: đỏ #FF0000, đen, xám trung tính) */
:root {
  --red: #ff0000; --red-dark: #d60000; --red-soft: #fff1f1; --red-text: #c40000;
  --black: #141414; --ink: #1a1a1a; --muted: #666666; --faint: #8c8c8c;
  --line: #e1e1e1; --bg: #f5f5f5; --white: #ffffff;
  --ok: #157f3b; --ok-soft: #e7f5ec; --bad: #b3261e; --bad-soft: #fdecea; --warn: #8a5a00; --warn-soft: #fff6e0;
  --radius: 16px; --shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.55 Roboto, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; margin-bottom: 12px; } h3 { font-size: 13px; margin: 14px 0 6px; }
p { margin: 0 0 8px; }
code { background: #efefef; padding: 1px 6px; border-radius: 6px; font-size: 12px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.ico { width: 18px; height: 18px; flex: none; }

/* Khung trang */
.shell { display: flex; min-height: 100vh; }
.side { width: 264px; flex: none; background: var(--white); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: block; padding: 20px 24px 6px; }
.side-brand img { display: block; width: 132px; height: auto; }
.side-product { margin: 0; padding: 0 24px 16px; border-bottom: 1px solid #efefef; font-size: 13px; font-weight: 700; }
.side-product span { margin-left: 6px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--red-text); background: var(--red-soft); padding: 2px 6px; border-radius: 6px; }
.side-nav { padding: 14px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label { margin: 14px 12px 4px; font-size: 10px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; font-size: 13px; font-weight: 500; color: #444; text-decoration: none; }
.nav-item .ico { color: #9a9a9a; }
.nav-item em { margin-left: auto; display: flex; color: var(--faint); }
.nav-item em .ico { width: 14px; height: 14px; }
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.on { background: var(--red-soft); color: var(--red-text); font-weight: 700; }
.nav-item.on .ico { color: var(--red); }
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 20px; border-top: 1px solid #efefef; }
.side-user strong { display: block; font-size: 12px; }
.side-user span { font-size: 11px; color: var(--faint); }
.side-user form { margin: 0; }
.icon-btn { background: none; border: 0; padding: 8px; border-radius: 10px; color: var(--muted); cursor: pointer; display: flex; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.head { position: sticky; top: 0; z-index: 10; background: var(--white); border-bottom: 1px solid var(--line); min-height: 76px; padding: 14px 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head h1 { font-size: 19px; }
.head-title p { margin: 2px 0 0; font-size: 12px; color: var(--faint); }
.head-actions { display: flex; gap: 10px; align-items: center; }
.chip { font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--red-text); background: var(--red-soft); border: 1px solid #ffd0d0; padding: 5px 10px; border-radius: 8px; }
.content { padding: 28px 32px 48px; max-width: 1360px; width: 100%; }
@media (max-width: 900px) { .shell { flex-direction: column; } .side { width: 100%; height: auto; position: static; } .content, .head { padding-left: 16px; padding-right: 16px; } }

/* Đăng nhập */
.bare-main { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login { width: 100%; max-width: 420px; background: var(--white); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 20px 40px rgba(0, 0, 0, .08); padding: 32px; }
.login-logo { display: block; width: 160px; height: auto; margin-bottom: 20px; }
.login h1 { font-size: 22px; margin-bottom: 4px; }
.roles { border: 0; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.roles legend { font-size: 12px; font-weight: 700; margin-bottom: 6px; padding: 0; }
.role { cursor: pointer; }
.role input { position: absolute; opacity: 0; pointer-events: none; }
.role span { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg); }
.role strong { display: block; font-size: 13px; }
.role em { font-style: normal; font-size: 11px; color: var(--faint); }
.role input:checked + span { border-color: var(--red); background: var(--red-soft); box-shadow: 0 0 0 1px var(--red) inset; }
.role input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
.alert { background: var(--bad-soft); border: 1px solid #f5c2bd; color: var(--bad); padding: 10px 12px; border-radius: 12px; font-weight: 500; }

/* Thành phần chung */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 24px; margin: 0 0 20px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.grid2, .grid3 { margin-bottom: 20px; }
.grid2 > .card, .grid3 > .card { margin: 0; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.split > .card { margin: 0; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 14px; } .row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; } .grow { flex: 1; min-width: 220px; }
label, .field { display: grid; gap: 5px; font-size: 12px; font-weight: 700; color: #333; }
input, select, textarea { font: inherit; font-weight: 400; padding: 9px 12px; border: 1px solid #cfcfcf; border-radius: 12px; background: #fafafa; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(255, 0, 0, .12); background: #fff; }
button { font: inherit; cursor: pointer; border-radius: 12px; padding: 9px 16px; border: 1px solid transparent; font-weight: 700; font-size: 13px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--red); color: #fff; } .primary:hover:not(:disabled) { background: var(--red-dark); }
.secondary { background: #f0f0f0; color: #333; } .secondary:hover:not(:disabled) { background: #e5e5e5; }
.block { width: 100%; padding: 11px 16px; }
.link { background: none; border: 0; padding: 0; color: var(--red-text); text-decoration: underline; font-weight: 500; font-size: 12px; border-radius: 0; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: #efefef; color: #555; }
.tag-ok { background: var(--ok-soft); color: var(--ok); } .tag-bad { background: var(--bad-soft); color: var(--bad); }
.error { color: var(--bad); } .warn { color: var(--warn); background: var(--warn-soft); padding: 10px 12px; border-radius: 12px; }
.status { min-height: 1.4em; margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.status.error { color: var(--bad); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* Dải giới thiệu, ô chỉ số, thẻ agent */
.hero { background: var(--red); color: #fff; border-radius: var(--radius); padding: 24px 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; box-shadow: 0 12px 28px rgba(255, 0, 0, .18); }
.hero h2 { font-size: 19px; margin: 0 0 4px; color: #fff; }
.hero p { margin: 0; font-size: 13px; color: #ffe1e1; }
.hero-btn { background: #fff; color: var(--red-text); text-decoration: none; font-weight: 700; font-size: 13px; padding: 10px 18px; border-radius: 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.kpi-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--faint); margin-bottom: 6px; }
.kpi-ico { display: flex; padding: 8px; border-radius: 10px; background: var(--red-soft); color: var(--red); }
.kpi strong { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.kpi strong.ok { color: var(--ok); } .kpi strong.bad { color: var(--bad); }
.kpi em { font-style: normal; font-size: 12px; color: var(--muted); }
.tile { text-decoration: none; display: flex; flex-direction: column; gap: 6px; transition: box-shadow .15s, border-color .15s; }
.tile:hover { border-color: #ffb3b3; box-shadow: 0 8px 20px rgba(0, 0, 0, .06); }
.tile h2 { margin: 6px 0 0; } .tile p { color: var(--muted); margin: 0; flex: 1; }
.tile-ico { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: 12px; background: var(--red-soft); color: var(--red); }
.tile-go { margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--red-text); }

/* AI 1: khung chat */
.chat { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.chat-head { background: var(--black); color: #fff; padding: 14px 20px; display: flex; flex-direction: column; }
.chat-head strong { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.chat-head span { font-size: 11px; color: #b5b5b5; }
.log-empty { margin: auto; text-align: center; color: var(--faint); font-size: 13px; max-width: 360px; }
.chat .log { min-height: 380px; max-height: 62vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 20px; background: #fafafa; }
.msg { max-width: 88%; padding: 12px 16px; border-radius: 16px; }
.msg.user { align-self: flex-end; background: var(--black); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg p { margin: 0 0 6px; } .msg sup a { color: var(--red-text); text-decoration: none; font-weight: 700; }
.msg table { background: #fff; margin: 8px 0; }
.ask { display: flex; gap: 10px; align-items: end; padding: 14px 20px; border-top: 1px solid var(--line); background: #fff; }
.ask textarea { resize: vertical; }
.sources { margin: 8px 0 0; padding-left: 18px; font-size: 12px; } .sources a { color: var(--red-text); }
.rate { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); }
.rate button { padding: 3px 10px; font-size: 12px; background: #fff; border: 1px solid var(--line); }
.panel h2 { font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.suggest { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 6px; }
.suggest button { width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); font-weight: 500; font-size: 12px; padding: 9px 12px; }
.suggest button:hover { border-color: #ffb3b3; background: var(--red-soft); color: var(--red-text); }
.debug { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 12px; margin: 0; }
.debug dt { color: var(--faint); } .debug dd { margin: 0; font-weight: 500; }

/* Bảng */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #ededed; vertical-align: top; font-size: 13px; }
th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); background: #fafafa; }
.list tbody tr:hover { background: #fcfcfc; }

/* AI 3 */
.stepper { list-style: none; counter-reset: s; display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; padding: 0; margin: 0 0 20px; }
.stepper li { counter-increment: s; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 12px; font-weight: 500; }
.stepper li::before { content: counter(s); display: inline-flex; width: 20px; height: 20px; border-radius: 99px; align-items: center; justify-content: center; margin-right: 6px; font-size: 11px; font-weight: 700; background: var(--red); color: #fff; }
.stepper li.sim { border-style: dashed; color: var(--muted); background: transparent; }
.stepper li.sim::before { background: #bdbdbd; }
@media (max-width: 1100px) { .stepper { grid-template-columns: repeat(4, 1fr); } }
.rules { margin: 0; padding-left: 18px; font-size: 13px; }
.variant { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 10px; align-content: start; background: #fff; }
.variant.ok { border-top: 3px solid var(--ok); } .variant.bad { border-top: 3px solid var(--bad); }
.variant header { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.copy { white-space: pre-wrap; margin: 0; }
details summary { cursor: pointer; font-size: 12px; font-weight: 700; color: #444; }
.checks { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12px; display: grid; gap: 4px; }
.checks span { font-weight: 700; } .checks .pass span { color: var(--ok); } .checks .fail span { color: var(--bad); }
.metrics caption { text-align: left; font-size: 11px; color: var(--faint); padding-bottom: 4px; }
.metrics th { background: none; text-transform: none; letter-spacing: 0; font-size: 12px; }
.recommend { margin-top: 16px; padding: 16px; border-radius: 12px; background: #fafafa; border: 1px solid var(--line); }
.jobs { background: #1a1a1a; color: #e6e6e6; padding: 12px 14px; border-radius: 12px; font-size: 12px; max-height: 240px; overflow: auto; white-space: pre-wrap; }
