/* Token màu tạm theo T06 §(Color & typography) — chờ brand guideline chính thức của Văn phòng/Truyền thông */
:root {
  --navy: #203864; --blue: #2F5597; --bg: #F5F7FA; --white: #FFFFFF; --text: #172033; --muted: #5B6573;
  --green: #548235; --amber: #BF9000; --red: #C00000; --line: #DDE3EC; --soft: #EEF2F8;
  --font: Inter, "Segoe UI", Arial, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 12px; color: var(--navy); }
h2 { font-size: 17px; margin: 22px 0 10px; color: var(--navy); }
h3 { font-size: 15px; margin: 14px 0 6px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
pre { white-space: pre-wrap; word-break: break-word; margin: 4px 0; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; } .err { color: var(--red); }
.nowrap { white-space: nowrap; } .num { text-align: right; font-variant-numeric: tabular-nums; } .dim { opacity: .55; }
.inline { display: inline; } [hidden] { display: none !important; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 54px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar a { color: #fff; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark { font-weight: 800; letter-spacing: .14em; font-size: 18px; }
.brand-sub { font-size: 13px; opacity: .8; }
.topnav { display: flex; gap: 18px; }
.topnav a { opacity: .9; } .topnav a:hover { opacity: 1; text-decoration: none; }
.userbox { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: 13px; }
.userbox small { opacity: .7; }
.envtag { background: var(--amber); color: #000; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 3px; }
button.link { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; text-decoration: underline; }
.topbar button.link { color: #fff; }
td button.link, .panel button.link, form button.link { color: var(--blue); }
button.link.err { color: var(--red); }

.layout { display: flex; flex: 1; min-height: 0; }
.sidebar { width: 230px; flex: none; background: #fff; border-right: 1px solid var(--line); padding: 14px 0; }
.navgroup h4 { margin: 12px 18px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.navgroup a { display: block; padding: 6px 18px; color: var(--text); border-left: 3px solid transparent; }
.navgroup a.on { background: var(--soft); border-left-color: var(--blue); color: var(--navy); font-weight: 600; }
.navgroup a:hover { background: var(--soft); text-decoration: none; }
.content { flex: 1; padding: 20px 26px 40px; min-width: 0; }
.foot { font-size: 11.5px; color: var(--muted); padding: 10px 26px; border-top: 1px solid var(--line); background: #fff; }

.titlebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 7px 14px; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 6px; cursor: pointer; font: inherit; font-weight: 500; }
.btn:hover { border-color: var(--blue); text-decoration: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--navy); }
.btn-ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.small { padding: 3px 9px; font-size: 12.5px; }
.btn.block { display: block; width: 100%; text-align: center; margin: 10px 0; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; border: 1px solid; }
.flash-success { background: #EEF6E9; border-color: #B9D6A6; }
.flash-error { background: #FBECEC; border-color: #E7B1B1; color: #6d0000; }
.flash-info { background: #EAF0FA; border-color: #B7C8E8; }
.callout { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--blue); padding: 10px 16px; border-radius: 6px; margin: 10px 0 16px; }
.callout ol { margin: 6px 0 0 18px; padding: 0; }
.callout-warn { border-left-color: var(--amber); background: #FFF9E6; }
.tokenbox { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.tokenbox code { font-size: 15px; background: #fff; padding: 6px 10px; border: 1px dashed var(--amber); border-radius: 4px; word-break: break-all; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 10px 0 8px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.card .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card .v { font-size: 20px; font-weight: 700; margin-top: 4px; color: var(--navy); }

.tablewrap, .scrollbox { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.scrollbox { max-height: 320px; } .scrollbox.tall { max-height: 460px; }
table.grid { border-collapse: collapse; width: 100%; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
table.grid th { background: var(--soft); font-weight: 600; font-size: 12.5px; position: sticky; top: 0; z-index: 1; }
table.grid tr:hover td { background: #FAFBFD; }
table.grid.small td, table.grid.small th { padding: 4px 7px; font-size: 12.5px; }
table.grid.tiny td, table.grid.tiny th { padding: 2px 6px; font-size: 11.5px; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
table.grid input:not([type=checkbox]), table.grid select { width: 100%; min-width: 50px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
td.del { background: #FBECEC; } td.ins { background: #EEF6E9; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.b-ok { background: #E6F1DF; color: #2F5418; border-color: #C5DDB5; }
.b-warn { background: #FFF3CC; color: #6B5100; border-color: #EBD48A; }
.b-err { background: #FBE3E3; color: #8A0000; border-color: #EDB7B7; }
.b-run { background: #E3EBF8; color: #1D3A70; border-color: #BCCDEB; }
.b-muted { background: #EEF0F3; color: #4C5562; border-color: #D9DEE5; }

.form .field, .field { display: block; margin: 0 0 12px; }
.field > span { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 4px; }
.field small { display: block; color: var(--muted); margin-top: 3px; font-size: 12px; }
.field input:not([type=checkbox]), .field select, .field textarea { width: 100%; padding: 7px 9px; border: 1px solid #C9D2DF; border-radius: 6px; font: inherit; background: #fff; }
.field textarea.mono, textarea.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
textarea.invalid { border-color: var(--red) !important; background: #FFF6F6; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #BFD0F0; border-color: var(--blue); }
.check { display: flex; align-items: baseline; gap: 6px; margin: 4px 0 12px; }
.check small { color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 4px; margin: 0 0 14px; }
legend { font-weight: 700; font-size: 12.5px; color: var(--navy); padding: 0 6px; }
.form.narrow { max-width: 560px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; }
.panel h2:first-child { margin-top: 0; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin: 10px 0; }
.inline-form .field { margin: 0; min-width: 180px; }
.inline-form > input { padding: 7px 9px; border: 1px solid #C9D2DF; border-radius: 6px; min-width: 260px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0 14px; }
.filters input, .filters select { padding: 6px 8px; border: 1px solid #C9D2DF; border-radius: 6px; font: inherit; }
.chip { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.pager { display: flex; gap: 14px; margin: 10px 0; }
.log { background: #0F172A; color: #E2E8F0; border-radius: 8px; padding: 10px 14px; font: 12.5px/1.6 ui-monospace, Menlo, monospace; max-height: 520px; overflow: auto; }
.log .log-error { color: #FCA5A5; } .log .log-warn { color: #FCD34D; } .log .muted { color: #94A3B8; }
pre.json { background: var(--soft); padding: 6px 8px; border-radius: 4px; font-size: 11.5px; max-height: 260px; overflow: auto; }
ul.tree { list-style: none; padding-left: 0; max-height: 360px; overflow: auto; columns: 2; }
.logo-preview { max-height: 60px; display: block; margin-top: 8px; } .logo-thumb { max-height: 34px; }
.kpi-preview { background: var(--soft); border-radius: 8px; padding: 12px 14px; margin: 10px 0; }
.kpi-preview .v { font-size: 30px; font-weight: 800; color: var(--navy); }

body.auth .content { display: flex; justify-content: center; align-items: flex-start; padding-top: 8vh; }
.authcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 26px 30px; width: 100%; max-width: 420px; box-shadow: 0 10px 30px rgba(23, 32, 51, .06); }
.authcard.wide { max-width: 640px; margin: 4vh auto; }
.or { text-align: center; color: var(--muted); font-size: 12px; margin: 6px 0; }

.epic h2 { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.pagecards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pagecard { display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: var(--text); position: relative; }
.pagecard:hover { border-color: var(--blue); text-decoration: none; box-shadow: 0 4px 14px rgba(47, 85, 151, .12); }
.pagecard .pno { position: absolute; right: 12px; top: 10px; color: var(--muted); font-weight: 700; }
.pagecard small { color: var(--muted); }
.pagecard .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.dwrap { position: relative; width: 100%; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.stage-inline { width: 1920px; height: 1080px; transform-origin: 0 0; position: absolute; left: 0; top: 0; }

@media (max-width: 1100px) { .cols2 { grid-template-columns: 1fr; } .row3, .grid3 { grid-template-columns: 1fr; } .sidebar { display: none; } }
.modepanel { border-left: 4px solid var(--blue); }
.modenow { font-size: 15px; }
.modegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modegrid .check small { display: block; }
.explorebar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
ul.tree button.link { color: var(--blue); text-decoration: none; }
@media (max-width: 1100px) { .modegrid { grid-template-columns: 1fr; } }

/* Admin > Địa điểm & nhà máy */
.sitemap { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 8px;
  background: radial-gradient(ellipse at 40% 40%, #fff 0%, #EEF4F7 70%, #E2ECF1 100%); }
#coords-info.ok { color: #2F5418; } #coords-info.warn { color: #6B5100; } #coords-info.err { color: #8A0000; }

/* Admin > Thiết bị Kiosk: link/QR ghép, chọn trang */
.qrbox { display: flex; justify-content: center; margin: 14px 0; }
.qrbox svg { width: min(340px, 100%); height: auto; }
.pair-head { font-size: 16px; line-height: 1.5; }
.pagegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; }
@media print {
  .topbar, .sidebar, .foot, .flash, .noprint, .actions { display: none !important; }
  .layout, .content, .cols2 { display: block !important; margin: 0 !important; padding: 0 !important; }
  .pairsheet { border: 0; text-align: center; }
  .pairsheet .qrbox svg { width: 9cm; }
}
/* Yêu cầu truy cập SSO */
.identity { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 8px 0 14px; }
.btn.err { color: var(--red); border-color: #E8B4B4; }
section.panel.callout-warn { border-left: 4px solid var(--amber); }
section.panel.danger-zone { border-left: 4px solid var(--red); margin-top: 22px; }
